Added profile version whitelist and blacklist

Blacklisted `Old Patterns` from Unhead profiles
Whitelisted `The Good Times - Part 1` to only Edge of darkness profiles
This commit is contained in:
Dev 2024-09-26 09:44:18 +01:00
parent 14a96cb034
commit 5e528d668e
3 changed files with 54 additions and 2 deletions

View File

@ -15,6 +15,12 @@
"5e4d4ac186f774264f758336", "5e4d4ac186f774264f758336",
"639136d68ba6894d155e77cf" "639136d68ba6894d155e77cf"
], ],
"profileBlacklist": {
"unheard_edition": ["666314a50aa5c7436c00908a"]
},
"profileWhitelist": {
"edge_of_darkness": ["666314b4d7f171c4c20226c3"]
},
"questTemplateIds": { "questTemplateIds": {
"pmc": { "pmc": {
"elimination": "616052ea3054fc0e2c24ce6e", "elimination": "616052ea3054fc0e2c24ce6e",

View File

@ -460,6 +460,14 @@ export class QuestHelper {
return false; return false;
} }
if (this.questIsProfileBlacklisted(profile.Info.GameVersion, quest._id)) {
return false;
}
if (!this.questIsProfileWhitelisted(profile.Info.GameVersion, quest._id)) {
return false;
}
const standingRequirements = this.questConditionHelper.getStandingConditions( const standingRequirements = this.questConditionHelper.getStandingConditions(
quest.conditions.AvailableForStart, quest.conditions.AvailableForStart,
); );
@ -532,18 +540,52 @@ export class QuestHelper {
public questIsForOtherSide(playerSide: string, questId: string): boolean { public questIsForOtherSide(playerSide: string, questId: string): boolean {
const isUsec = playerSide.toLowerCase() === "usec"; const isUsec = playerSide.toLowerCase() === "usec";
if (isUsec && this.questConfig.bearOnlyQuests.includes(questId)) { if (isUsec && this.questConfig.bearOnlyQuests.includes(questId)) {
// player is usec and quest is bear only, skip // Player is usec and quest is bear only, skip
return true; return true;
} }
if (!isUsec && this.questConfig.usecOnlyQuests.includes(questId)) { if (!isUsec && this.questConfig.usecOnlyQuests.includes(questId)) {
// player is bear and quest is usec only, skip // Player is bear and quest is usec only, skip
return true; return true;
} }
return false; return false;
} }
/**
* Is the provided quest prevented from being viewed by the provided game version
* (Inclusive filter)
* @param gameVersion Game version to check against
* @param questId Quest id to check
* @returns True Quest should not be visible to game version
*/
protected questIsProfileBlacklisted(gameVersion: string, questId: string) {
const questBlacklist = this.questConfig.profileBlacklist[gameVersion];
if (!questBlacklist) {
// Not blacklisted
return false;
}
return questBlacklist.includes(questId);
}
/**
* Is the provided quest able to be seen by the provided game version
* (Exclusive filter)
* @param gameVersion Game version to check against
* @param questId Quest id to check
* @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;
}
return questWhitelist.includes(questId);
}
/** /**
* Get quests that can be shown to player after failing a quest * Get quests that can be shown to player after failing a quest
* @param failedQuestId Id of the quest failed by player * @param failedQuestId Id of the quest failed by player

View File

@ -15,6 +15,10 @@ export interface IQuestConfig extends IBaseConfig {
locationIdMap: Record<string, string>; locationIdMap: Record<string, string>;
bearOnlyQuests: string[]; bearOnlyQuests: string[];
usecOnlyQuests: string[]; 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 */
profileWhitelist: Record<string, string[]>;
} }
export interface IPlayerTypeQuestIds { export interface IPlayerTypeQuestIds {