Add ability to adjust skill gain per skill when in menus via inventory config

This commit is contained in:
Dev 2024-03-09 16:14:34 +00:00
parent 5343f8982c
commit f860642882
3 changed files with 22 additions and 3 deletions

View File

@ -250,5 +250,8 @@
],
"allowBossItems": false
},
"customMoneyTpls": []
"customMoneyTpls": [],
"skillGainMultiplers": {
"Strength": 1
}
}

View File

@ -7,8 +7,11 @@ import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData";
import { AccountTypes } from "@spt-aki/models/enums/AccountTypes";
import { BonusType } from "@spt-aki/models/enums/BonusType";
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { IInventoryConfig } from "@spt-aki/models/spt/config/IInventoryConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
@ -21,6 +24,8 @@ import { Watermark } from "@spt-aki/utils/Watermark";
@injectable()
export class ProfileHelper
{
protected inventoryConfig: IInventoryConfig;
constructor(
@inject("WinstonLogger") protected logger: ILogger,
@inject("JsonUtil") protected jsonUtil: JsonUtil,
@ -32,8 +37,11 @@ export class ProfileHelper
@inject("ItemHelper") protected itemHelper: ItemHelper,
@inject("ProfileSnapshotService") protected profileSnapshotService: ProfileSnapshotService,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("ConfigServer") protected configServer: ConfigServer,
)
{}
{
this.inventoryConfig = this.configServer.getConfig(ConfigTypes.INVENTORY);
}
/**
* Remove/reset a completed quest condtion from players profile quest data
@ -421,7 +429,7 @@ export class ProfileHelper
return;
}
const profileSkill = profileSkills.find((x) => x.Id === skill);
const profileSkill = profileSkills.find((profileSkill) => profileSkill.Id === skill);
if (!profileSkill)
{
this.logger.error(this.localisationService.getText("quest-no_skill_found", skill));
@ -435,6 +443,12 @@ export class ProfileHelper
pointsToAddToSkill *= skillProgressRate;
}
// Apply custom multipler to skill amount gained, if exists
if (this.inventoryConfig.skillGainMultiplers[skill])
{
pointsToAddToSkill *= this.inventoryConfig.skillGainMultiplers[skill];
}
profileSkill.Progress += pointsToAddToSkill;
profileSkill.Progress = Math.min(profileSkill.Progress, 5100); // Prevent skill from ever going above level 51 (5100)
profileSkill.LastAccess = this.timeUtil.getTimestamp();

View File

@ -10,6 +10,8 @@ export interface IInventoryConfig extends IBaseConfig
sealedAirdropContainer: ISealedAirdropContainerSettings;
/** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */
customMoneyTpls: string[];
/** Multipliers for skill gain when inside menus, NOT in-game */
skillGainMultiplers: Record<string, number>;
}
export interface RewardDetails