Basic implementation of pocket tpl quest reward handling

This commit is contained in:
Dev 2024-08-03 23:10:54 +01:00
parent 19d2527e37
commit fc8769ba30
3 changed files with 23 additions and 1 deletions

View File

@ -518,4 +518,22 @@ export class ProfileHelper {
public hasAccessToRepeatableFreeRefreshSystem(pmcProfile: IPmcData): boolean {
return [GameEditions.EDGE_OF_DARKNESS, GameEditions.UNHEARD].includes(<any>pmcProfile.Info?.GameVersion);
}
/**
* Find a profiles "Pockets" item and replace its tpl with passed in value
* @param pmcProfile Player profile
* @param newPocketTpl New tpl to set profiles Pockets to
*/
public replaceProfilePocketTpl(pmcProfile: IPmcData, newPocketTpl: string): void {
const pockets = pmcProfile.Inventory.items.find((item) => item.slotId === "Pockets");
if (!pockets) {
this.logger.error(
`unable to replace profile: ${pmcProfile._id} pocket tpl with: ${newPocketTpl} as Pocket item could not be found.`,
);
return;
}
pockets._tpl = newPocketTpl;
}
}

View File

@ -919,7 +919,7 @@ export class QuestHelper {
this.profileHelper.addAchievementToProfile(pmcProfile, reward.target);
break;
case QuestRewardType.STASH_ROWS:
this.profileHelper.addStashRowsBonusToProfile(sessionId, Number.parseInt(<string>reward.value)); // add specified stash rows from quest reward - requires client restart
this.profileHelper.addStashRowsBonusToProfile(sessionId, Number.parseInt(<string>reward.value)); // Add specified stash rows from quest reward - requires client restart
break;
case QuestRewardType.PRODUCTIONS_SCHEME:
this.findAndAddHideoutProductionIdToProfile(
@ -930,6 +930,9 @@ export class QuestHelper {
questResponse,
);
break;
case QuestRewardType.POCKETS:
this.profileHelper.replaceProfilePocketTpl(pmcProfile, reward.target);
break;
default:
this.logger.error(
this.localisationService.getText("quest-reward_type_not_handled", {

View File

@ -10,4 +10,5 @@ export enum QuestRewardType {
TRADER_STANDING_RESTORE = "TraderStandingRestore",
STASH_ROWS = "StashRows",
ACHIEVEMENT = "Achievement",
POCKETS = "Pockets",
}