Fixed questConfig.profileWhitelist causing quests to not be shown when accepting a quest

reversed `questConfig.profileWhitelist` to have quest id as key and allowed game versions as value
This commit is contained in:
Dev 2024-11-14 14:01:54 +00:00
parent 36787b6457
commit d88e705c86
4 changed files with 14 additions and 9 deletions

View File

@ -19,7 +19,7 @@
"unheard_edition": ["666314a50aa5c7436c00908a"]
},
"profileWhitelist": {
"edge_of_darkness": ["666314b4d7f171c4c20226c3"]
"666314b4d7f171c4c20226c3": ["edge_of_darkness"]
},
"questTemplateIds": {
"pmc": {

View File

@ -131,9 +131,13 @@ export class QuestController {
);
// Having accepted new quest, look for newly unlocked quests and inform client of them
acceptQuestResponse.profileChanges[sessionID].quests.push(
...this.questHelper.getNewlyAccessibleQuestsWhenStartingQuest(acceptedQuest.qid, sessionID),
const newlyAccessibleQuests = this.questHelper.getNewlyAccessibleQuestsWhenStartingQuest(
acceptedQuest.qid,
sessionID,
);
if (newlyAccessibleQuests.length > 0) {
acceptQuestResponse.profileChanges[sessionID].quests.push(...newlyAccessibleQuests);
}
return acceptQuestResponse;
}

View File

@ -580,13 +580,14 @@ export class QuestHelper {
* @returns True Quest should be visible to game version
*/
protected questIsProfileWhitelisted(gameVersion: string, questId: string) {
const questWhitelist = this.questConfig.profileWhitelist[gameVersion];
if (!questWhitelist) {
// Not on whitelist for this profile
return false;
const gameVersionWhitelist = this.questConfig.profileWhitelist[questId];
if (!gameVersionWhitelist) {
// Quest not found in whitelist dict, assume quest is good
return true;
}
return questWhitelist.includes(questId);
// Quest in dict, return if game version is on whitelist
return gameVersionWhitelist.includes(gameVersion);
}
/**

View File

@ -17,7 +17,7 @@ export interface IQuestConfig extends IBaseConfig {
usecOnlyQuests: string[];
/** Quests that the keyed game version do not see/access */
profileBlacklist: Record<string, string[]>;
/** Quests that only the keyed game version can see/access */
/** key=questid, gameversions that can see/access quest */
profileWhitelist: Record<string, string[]>;
}