Expanded input parameters for getBotGenerationDetailsForWave()
and include change inside returnSingleBotFromCache()
This commit is contained in:
parent
81c7b8751b
commit
ed6e81ab52
@ -208,15 +208,17 @@ export class BotController
|
|||||||
// Clear bot cache before any work starts
|
// Clear bot cache before any work starts
|
||||||
this.botGenerationCacheService.clearStoredBots();
|
this.botGenerationCacheService.clearStoredBots();
|
||||||
|
|
||||||
const raidSettings = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION)?.getValue<
|
const raidSettings = this.applicationContext
|
||||||
IGetRaidConfigurationRequestData
|
.getLatestValue(ContextVariableType.RAID_CONFIGURATION)
|
||||||
>();
|
?.getValue<IGetRaidConfigurationRequestData>();
|
||||||
|
|
||||||
const pmcLevelRangeForMap
|
const pmcLevelRangeForMap
|
||||||
= this.pmcConfig.locationSpecificPmcLevelOverride[raidSettings?.location.toLowerCase()];
|
= this.pmcConfig.locationSpecificPmcLevelOverride[raidSettings?.location.toLowerCase()];
|
||||||
|
|
||||||
const allPmcsHaveSameNameAsPlayer = this.randomUtil.getChance100(
|
const allPmcsHaveSameNameAsPlayer = this.randomUtil.getChance100(
|
||||||
this.pmcConfig.allPMCsHavePlayerNameWithRandomPrefixChance,
|
this.pmcConfig.allPMCsHavePlayerNameWithRandomPrefixChance,
|
||||||
);
|
);
|
||||||
|
|
||||||
const conditionPromises: Promise<void>[] = [];
|
const conditionPromises: Promise<void>[] = [];
|
||||||
for (const condition of request.conditions)
|
for (const condition of request.conditions)
|
||||||
{
|
{
|
||||||
@ -225,6 +227,7 @@ export class BotController
|
|||||||
pmcProfile,
|
pmcProfile,
|
||||||
allPmcsHaveSameNameAsPlayer,
|
allPmcsHaveSameNameAsPlayer,
|
||||||
pmcLevelRangeForMap,
|
pmcLevelRangeForMap,
|
||||||
|
this.botConfig.presetBatch[condition.Role],
|
||||||
false);
|
false);
|
||||||
|
|
||||||
conditionPromises.push(this.generateWithBotDetails(condition, botGenerationDetails, sessionId));
|
conditionPromises.push(this.generateWithBotDetails(condition, botGenerationDetails, sessionId));
|
||||||
@ -235,11 +238,22 @@ export class BotController
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a BotGenerationDetails for the bot generator to use
|
||||||
|
* @param condition Client data defining bot type and difficulty
|
||||||
|
* @param pmcProfile Player who is generating bots
|
||||||
|
* @param allPmcsHaveSameNameAsPlayer Should all PMCs have same name as player
|
||||||
|
* @param pmcLevelRangeForMap Min/max levels for PMCs to generate within
|
||||||
|
* @param botCountToGenerate How many bots to generate
|
||||||
|
* @param generateAsPmc Force bot being generated a PMC
|
||||||
|
* @returns BotGenerationDetails
|
||||||
|
*/
|
||||||
protected getBotGenerationDetailsForWave(
|
protected getBotGenerationDetailsForWave(
|
||||||
condition: Condition,
|
condition: Condition,
|
||||||
pmcProfile: IPmcData,
|
pmcProfile: IPmcData,
|
||||||
allPmcsHaveSameNameAsPlayer: boolean,
|
allPmcsHaveSameNameAsPlayer: boolean,
|
||||||
pmcLevelRangeForMap: MinMax,
|
pmcLevelRangeForMap: MinMax,
|
||||||
|
botCountToGenerate: number,
|
||||||
generateAsPmc: boolean): BotGenerationDetails
|
generateAsPmc: boolean): BotGenerationDetails
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -251,7 +265,7 @@ export class BotController
|
|||||||
playerName: pmcProfile.Info.Nickname,
|
playerName: pmcProfile.Info.Nickname,
|
||||||
botRelativeLevelDeltaMax: this.pmcConfig.botRelativeLevelDeltaMax,
|
botRelativeLevelDeltaMax: this.pmcConfig.botRelativeLevelDeltaMax,
|
||||||
botRelativeLevelDeltaMin: this.pmcConfig.botRelativeLevelDeltaMin,
|
botRelativeLevelDeltaMin: this.pmcConfig.botRelativeLevelDeltaMin,
|
||||||
botCountToGenerate: this.botConfig.presetBatch[condition.Role],
|
botCountToGenerate: botCountToGenerate,
|
||||||
botDifficulty: condition.Difficulty,
|
botDifficulty: condition.Difficulty,
|
||||||
locationSpecificPmcLevelOverride: pmcLevelRangeForMap,
|
locationSpecificPmcLevelOverride: pmcLevelRangeForMap,
|
||||||
isPlayerScav: false,
|
isPlayerScav: false,
|
||||||
@ -259,6 +273,11 @@ export class BotController
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get players profile level
|
||||||
|
* @param pmcProfile Profile to get level from
|
||||||
|
* @returns Level as number
|
||||||
|
*/
|
||||||
protected getPlayerLevelFromProfile(pmcProfile: IPmcData): number
|
protected getPlayerLevelFromProfile(pmcProfile: IPmcData): number
|
||||||
{
|
{
|
||||||
return pmcProfile.Info.Level;
|
return pmcProfile.Info.Level;
|
||||||
@ -350,19 +369,18 @@ export class BotController
|
|||||||
= this.pmcConfig.locationSpecificPmcLevelOverride[raidSettings.location.toLowerCase()];
|
= this.pmcConfig.locationSpecificPmcLevelOverride[raidSettings.location.toLowerCase()];
|
||||||
|
|
||||||
// Create gen request for when cache is empty
|
// Create gen request for when cache is empty
|
||||||
const botGenerationDetails: BotGenerationDetails = {
|
const condition: Condition = {
|
||||||
isPmc: false,
|
Role: requestedBot.Role,
|
||||||
side: "Savage",
|
Limit: 5,
|
||||||
role: requestedBot.Role,
|
Difficulty: requestedBot.Difficulty
|
||||||
playerLevel: pmcProfile.Info.Level,
|
|
||||||
playerName: pmcProfile.Info.Nickname,
|
|
||||||
botRelativeLevelDeltaMax: this.pmcConfig.botRelativeLevelDeltaMax,
|
|
||||||
botRelativeLevelDeltaMin: this.pmcConfig.botRelativeLevelDeltaMin,
|
|
||||||
botCountToGenerate: this.botConfig.presetBatch[requestedBot.Role],
|
|
||||||
botDifficulty: requestedBot.Difficulty,
|
|
||||||
locationSpecificPmcLevelOverride: pmcLevelRangeForMap,
|
|
||||||
isPlayerScav: false,
|
|
||||||
};
|
};
|
||||||
|
const botGenerationDetails = this.getBotGenerationDetailsForWave(
|
||||||
|
condition,
|
||||||
|
pmcProfile,
|
||||||
|
false,
|
||||||
|
pmcLevelRangeForMap,
|
||||||
|
this.botConfig.presetBatch[requestedBot.Role],
|
||||||
|
false);
|
||||||
|
|
||||||
// Event bots need special actions to occur, set data up for them
|
// Event bots need special actions to occur, set data up for them
|
||||||
const isEventBot = requestedBot.Role.toLowerCase().includes("event");
|
const isEventBot = requestedBot.Role.toLowerCase().includes("event");
|
||||||
|
Loading…
Reference in New Issue
Block a user