mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Add ability to adjust skill gain per skill when in menus via inventory config
This commit is contained in:
parent
5343f8982c
commit
f860642882
@ -250,5 +250,8 @@
|
|||||||
],
|
],
|
||||||
"allowBossItems": false
|
"allowBossItems": false
|
||||||
},
|
},
|
||||||
"customMoneyTpls": []
|
"customMoneyTpls": [],
|
||||||
|
"skillGainMultiplers": {
|
||||||
|
"Strength": 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,11 @@ import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
|
|||||||
import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData";
|
import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData";
|
||||||
import { AccountTypes } from "@spt-aki/models/enums/AccountTypes";
|
import { AccountTypes } from "@spt-aki/models/enums/AccountTypes";
|
||||||
import { BonusType } from "@spt-aki/models/enums/BonusType";
|
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 { 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 { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
||||||
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
||||||
import { SaveServer } from "@spt-aki/servers/SaveServer";
|
import { SaveServer } from "@spt-aki/servers/SaveServer";
|
||||||
import { LocalisationService } from "@spt-aki/services/LocalisationService";
|
import { LocalisationService } from "@spt-aki/services/LocalisationService";
|
||||||
@ -21,6 +24,8 @@ import { Watermark } from "@spt-aki/utils/Watermark";
|
|||||||
@injectable()
|
@injectable()
|
||||||
export class ProfileHelper
|
export class ProfileHelper
|
||||||
{
|
{
|
||||||
|
protected inventoryConfig: IInventoryConfig;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject("WinstonLogger") protected logger: ILogger,
|
@inject("WinstonLogger") protected logger: ILogger,
|
||||||
@inject("JsonUtil") protected jsonUtil: JsonUtil,
|
@inject("JsonUtil") protected jsonUtil: JsonUtil,
|
||||||
@ -32,8 +37,11 @@ export class ProfileHelper
|
|||||||
@inject("ItemHelper") protected itemHelper: ItemHelper,
|
@inject("ItemHelper") protected itemHelper: ItemHelper,
|
||||||
@inject("ProfileSnapshotService") protected profileSnapshotService: ProfileSnapshotService,
|
@inject("ProfileSnapshotService") protected profileSnapshotService: ProfileSnapshotService,
|
||||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
@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
|
* Remove/reset a completed quest condtion from players profile quest data
|
||||||
@ -421,7 +429,7 @@ export class ProfileHelper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const profileSkill = profileSkills.find((x) => x.Id === skill);
|
const profileSkill = profileSkills.find((profileSkill) => profileSkill.Id === skill);
|
||||||
if (!profileSkill)
|
if (!profileSkill)
|
||||||
{
|
{
|
||||||
this.logger.error(this.localisationService.getText("quest-no_skill_found", skill));
|
this.logger.error(this.localisationService.getText("quest-no_skill_found", skill));
|
||||||
@ -435,6 +443,12 @@ export class ProfileHelper
|
|||||||
pointsToAddToSkill *= skillProgressRate;
|
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 += pointsToAddToSkill;
|
||||||
profileSkill.Progress = Math.min(profileSkill.Progress, 5100); // Prevent skill from ever going above level 51 (5100)
|
profileSkill.Progress = Math.min(profileSkill.Progress, 5100); // Prevent skill from ever going above level 51 (5100)
|
||||||
profileSkill.LastAccess = this.timeUtil.getTimestamp();
|
profileSkill.LastAccess = this.timeUtil.getTimestamp();
|
||||||
|
@ -10,6 +10,8 @@ export interface IInventoryConfig extends IBaseConfig
|
|||||||
sealedAirdropContainer: ISealedAirdropContainerSettings;
|
sealedAirdropContainer: ISealedAirdropContainerSettings;
|
||||||
/** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */
|
/** Contains item tpls that the server should consider money and treat the same as roubles/euros/dollars */
|
||||||
customMoneyTpls: string[];
|
customMoneyTpls: string[];
|
||||||
|
/** Multipliers for skill gain when inside menus, NOT in-game */
|
||||||
|
skillGainMultiplers: Record<string, number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RewardDetails
|
export interface RewardDetails
|
||||||
|
Loading…
x
Reference in New Issue
Block a user