take into accout Charisma skill at elite level when calculating daily quest count

This commit is contained in:
Dev 2023-11-07 09:58:58 +00:00
parent 00fbc813ac
commit 1510237b01
3 changed files with 45 additions and 2 deletions

View File

@ -14,6 +14,7 @@ import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
import { ELocationName } from "@spt-aki/models/enums/ELocationName";
import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas";
import { QuestStatus } from "@spt-aki/models/enums/QuestStatus";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { IQuestConfig, IRepeatableQuestConfig } from "@spt-aki/models/spt/config/IQuestConfig";
import { IQuestTypePool } from "@spt-aki/models/spt/repeatable/IQuestTypePool";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
@ -131,7 +132,7 @@ export class RepeatableQuestController
const questTypePool = this.generateQuestPool(repeatableConfig, pmcData.Info.Level);
// Add daily quests
for (let i = 0; i < repeatableConfig.numQuests; i++)
for (let i = 0; i < this.getQuestCount(repeatableConfig, pmcData); i++)
{
let quest = null;
let lifeline = 0;
@ -188,6 +189,23 @@ export class RepeatableQuestController
return returnData;
}
/**
* Get the number of quests to generate - takes into account charisma state of player
* @param repeatableConfig Config
* @param pmcData Player profile
* @returns Quest count
*/
protected getQuestCount(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): number
{
if (repeatableConfig.name.toLowerCase() === "daily" && this.profileHelper.hasEliteSkillLevel(SkillTypes.CHARISMA, pmcData))
{
// Elite charisma skill gives 1 extra daily quest
return repeatableConfig.numQuests + 1;
}
return repeatableConfig.numQuests;
}
/**
* Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists
* @param repeatableConfig daily/weekly config

View File

@ -794,7 +794,7 @@ export class HideoutHelper
{
const bitcoinProduction = this.databaseServer.getTables().hideout.production.find(p => p._id === HideoutHelper.bitcoinFarm);
const productionSlots = bitcoinProduction?.productionLimitCount || 3;
const hasManagementSkillSlots = this.hasEliteHideoutManagementSkill(pmcData);
const hasManagementSkillSlots = this.profileHelper.hasEliteSkillLevel(SkillTypes.HIDEOUT_MANAGEMENT, pmcData);
const managementSlotsCount = this.getBitcoinMinerContainerSlotSize() || 2;
return productionSlots + (hasManagementSkillSlots ? managementSlotsCount : 0);

View File

@ -5,6 +5,7 @@ import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { CounterKeyValue, Stats } from "@spt-aki/models/eft/common/tables/IBotBase";
import { IAkiProfile } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IValidateNicknameRequestData } from "@spt-aki/models/eft/profile/IValidateNicknameRequestData";
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
@ -341,4 +342,28 @@ export class ProfileHelper
stat.Value++;
}
}
/**
* Check if player has a skill at elite level
* @param skillType Skill to check
* @param pmcProfile Profile to find skill in
* @returns True if player has skill at elite level
*/
public hasEliteSkillLevel(skillType: SkillTypes, pmcProfile: IPmcData): boolean
{
const profileSkills = pmcProfile?.Skills?.Common;
if (!profileSkills)
{
return false;
}
const profileSkill = profileSkills.find(x => x.Id === skillType);
if (!profileSkill)
{
this.logger.warning(`Unable to check for elite skill ${skillType}, not found in profile`);
return false;
}
return profileSkill.Progress >= 5100; // level 51
}
}