Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving Faction from TT and using it to filter active quests #971

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/features/quests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export const selectQuestsWithActive = createSelector([selectQuests, selectTrader
if (settings[settings.gameMode].playerLevel < quest.minPlayerLevel) {
//return false;
}
if (quest.factionName !== 'Any' && settings[settings.gameMode].pmcFaction !== 'NONE' && settings[settings.gameMode].pmcFaction !== quest.factionName) {
return false;
}
for (const req of quest.taskRequirements) {
let reqSatisfied = false;
for (const status of req.status) {
Expand Down
41 changes: 23 additions & 18 deletions src/features/settings/settingsSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ export const fetchTarkovTrackerProgress = createAsyncThunk(
}

const returnData = {
flea: true,
level: 72,
hasFlea: true,
playerLevel: 72,
pmcFaction: 'NONE',
hideout: {},
quests: [],
questsFailed: [],
Expand Down Expand Up @@ -46,9 +47,11 @@ export const fetchTarkovTrackerProgress = createAsyncThunk(
}
return completedObjectives;
}, []);
returnData.flea = progressData.playerLevel >= 15 ? true : false;
returnData.hasFlea = progressData.playerLevel >= 15 ? true : false;

returnData.level = progressData.playerLevel;
returnData.playerLevel = progressData.playerLevel;

returnData.pmcFaction = progressData.pmcFaction;

const hideoutData = getState().hideout.data;

Expand All @@ -62,12 +65,12 @@ export const fetchTarkovTrackerProgress = createAsyncThunk(
}

for (const station of hideoutData) {
for (const level of station.levels) {
if (level.id !== module.id) {
for (const stationLevel of station.levels) {
if (stationLevel.id !== module.id) {
continue;
}
if (returnData.hideout[station.normalizedName] < level.level) {
returnData.hideout[station.normalizedName] = level.level;
if (returnData.hideout[station.normalizedName] < stationLevel.level) {
returnData.hideout[station.normalizedName] = stationLevel.level;
continue;
}
}
Expand Down Expand Up @@ -101,7 +104,12 @@ const localStorageWriteJson = (key, value) => {

const defaultSettings = {hasFlea: localStorageReadJson('useFlea', true),
playerLevel: 72,
pmcFaction: localStorageReadJson('pmcFaction', 'NONE'),
useTarkovTracker: localStorageReadJson('useTarkovTracker', false),
tarkovTrackerAPIKey: localStorageReadJson('tarkovTrackerAPIKey', ''),
completedQuests: [],
failedQuests: [],
tarkovTrackerModules: [],
prapor: localStorageReadJson('prapor', 4),
therapist: localStorageReadJson('therapist', 4),
fence: localStorageReadJson('fence', 0),
Expand All @@ -115,18 +123,14 @@ const defaultSettings = {hasFlea: localStorageReadJson('useFlea', true),
'booze-generator': localStorageReadJson('booze-generator', 1),
'christmas-tree': localStorageReadJson('christmas-tree', 1),
'intelligence-center': localStorageReadJson('intelligence-center', 3),
lavatory: localStorageReadJson('lavatory', 3),
medstation: localStorageReadJson('medstation', 3),
'lavatory': localStorageReadJson('lavatory', 3),
'medstation': localStorageReadJson('medstation', 3),
'nutrition-unit': localStorageReadJson('nutrition-unit', 3),
'water-collector': localStorageReadJson('water-collector', 3),
workbench: localStorageReadJson('workbench', 3),
'workbench': localStorageReadJson('workbench', 3),
'solar-power': localStorageReadJson('solar-power', 0),
crafting: localStorageReadJson('crafting', 0),
'crafting': localStorageReadJson('crafting', 0),
'hideout-management': localStorageReadJson('hideout-management', 0),
completedQuests: [],
failedQuests: [],
useTarkovTracker: localStorageReadJson('useTarkovTracker', false),
tarkovTrackerModules: [],
minDogtagLevel: localStorageReadJson('minDogtagLevel', 1),
hideDogtagBarters: localStorageReadJson('hideDogtagBarters', false),
};
Expand Down Expand Up @@ -213,8 +217,9 @@ const settingsSlice = createSlice({
state[state.gameMode].completedQuests = action.payload.quests;
state[state.gameMode].failedQuests = action.payload.questsFailed;
state[state.gameMode].objectivesCompleted = action.payload.objectivesCompleted;
state[state.gameMode].hasFlea = action.payload.flea;
state[state.gameMode].playerLevel = action.payload.level;
state[state.gameMode].hasFlea = action.payload.hasFlea;
state[state.gameMode].playerLevel = action.payload.playerLevel;
state[state.gameMode].pmcFaction = action.payload.pmcFaction;

for (const stationKey in action.payload.hideout) {
settingsSlice.caseReducers.setStationOrTraderLevel(state, {
Expand Down
Loading