Extracted 2 functions from generateBotsFirstTime()
to allow easier overriding for mod authors
This commit is contained in:
parent
512054d29f
commit
81c7b8751b
@ -25,6 +25,7 @@ import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCa
|
||||
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
|
||||
import { ICloner } from "@spt-aki/utils/cloners/ICloner";
|
||||
import { RandomUtil } from "@spt-aki/utils/RandomUtil";
|
||||
import { MinMax } from "@spt-aki/models/common/MinMax";
|
||||
|
||||
@injectable()
|
||||
export class BotController
|
||||
@ -219,11 +220,34 @@ export class BotController
|
||||
const conditionPromises: Promise<void>[] = [];
|
||||
for (const condition of request.conditions)
|
||||
{
|
||||
const botGenerationDetails: BotGenerationDetails = {
|
||||
isPmc: false,
|
||||
const botGenerationDetails = this.getBotGenerationDetailsForWave(
|
||||
condition,
|
||||
pmcProfile,
|
||||
allPmcsHaveSameNameAsPlayer,
|
||||
pmcLevelRangeForMap,
|
||||
false);
|
||||
|
||||
conditionPromises.push(this.generateWithBotDetails(condition, botGenerationDetails, sessionId));
|
||||
}
|
||||
|
||||
await Promise.all(conditionPromises).then(p => Promise.all(p));
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
protected getBotGenerationDetailsForWave(
|
||||
condition: Condition,
|
||||
pmcProfile: IPmcData,
|
||||
allPmcsHaveSameNameAsPlayer: boolean,
|
||||
pmcLevelRangeForMap: MinMax,
|
||||
generateAsPmc: boolean): BotGenerationDetails
|
||||
|
||||
{
|
||||
return {
|
||||
isPmc: generateAsPmc,
|
||||
side: "Savage",
|
||||
role: condition.Role,
|
||||
playerLevel: pmcProfile.Info.Level,
|
||||
playerLevel: this.getPlayerLevelFromProfile(pmcProfile),
|
||||
playerName: pmcProfile.Info.Nickname,
|
||||
botRelativeLevelDeltaMax: this.pmcConfig.botRelativeLevelDeltaMax,
|
||||
botRelativeLevelDeltaMin: this.pmcConfig.botRelativeLevelDeltaMin,
|
||||
@ -233,13 +257,11 @@ export class BotController
|
||||
isPlayerScav: false,
|
||||
allPmcsHaveSameNameAsPlayer: allPmcsHaveSameNameAsPlayer,
|
||||
};
|
||||
|
||||
conditionPromises.push(this.generateWithBotDetails(condition, botGenerationDetails, sessionId));
|
||||
}
|
||||
|
||||
await Promise.all(conditionPromises).then(p => Promise.all(p));
|
||||
|
||||
return [];
|
||||
protected getPlayerLevelFromProfile(pmcProfile: IPmcData): number
|
||||
{
|
||||
return pmcProfile.Info.Level;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user