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"] "unheard_edition": ["666314a50aa5c7436c00908a"]
}, },
"profileWhitelist": { "profileWhitelist": {
"edge_of_darkness": ["666314b4d7f171c4c20226c3"] "666314b4d7f171c4c20226c3": ["edge_of_darkness"]
}, },
"questTemplateIds": { "questTemplateIds": {
"pmc": { "pmc": {

View File

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

View File

@ -580,13 +580,14 @@ export class QuestHelper {
* @returns True Quest should be visible to game version * @returns True Quest should be visible to game version
*/ */
protected questIsProfileWhitelisted(gameVersion: string, questId: string) { protected questIsProfileWhitelisted(gameVersion: string, questId: string) {
const questWhitelist = this.questConfig.profileWhitelist[gameVersion]; const gameVersionWhitelist = this.questConfig.profileWhitelist[questId];
if (!questWhitelist) { if (!gameVersionWhitelist) {
// Not on whitelist for this profile // Quest not found in whitelist dict, assume quest is good
return false; 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[]; usecOnlyQuests: string[];
/** Quests that the keyed game version do not see/access */ /** Quests that the keyed game version do not see/access */
profileBlacklist: Record<string, string[]>; 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[]>; profileWhitelist: Record<string, string[]>;
} }