Improve data returned from getAllBotDifficulties()
This commit is contained in:
parent
6e262a228f
commit
60eb6bfe80
@ -13,6 +13,7 @@ import { IBotCore } from "@spt-aki/models/eft/common/tables/IBotCore";
|
||||
import { Difficulty } from "@spt-aki/models/eft/common/tables/IBotType";
|
||||
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
|
||||
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
||||
import { WildSpawnTypeNumber } from "@spt-aki/models/enums/WildSpawnTypeNumber";
|
||||
import { BotGenerationDetails } from "@spt-aki/models/spt/bots/BotGenerationDetails";
|
||||
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
|
||||
import { IPmcConfig } from "@spt-aki/models/spt/config/IPmcConfig";
|
||||
@ -146,23 +147,31 @@ export class BotController
|
||||
const result = {};
|
||||
|
||||
const botDb = this.databaseServer.getTables().bots.types;
|
||||
const botTypes = Object.keys(botDb);
|
||||
for (const botType of botTypes)
|
||||
const botTypes = Object.keys(WildSpawnTypeNumber).filter((v) => Number.isNaN(Number(v)));
|
||||
for (let botType of botTypes)
|
||||
{
|
||||
const enumType = botType.toLowerCase();
|
||||
// sptBear/sptUsec need to be converted into `usec`/`bear` so we can read difficulty settings from bots/types
|
||||
botType = this.botHelper.isBotPmc(botType)
|
||||
? this.botHelper.getPmcSideByRole(botType).toLowerCase()
|
||||
: botType.toLowerCase();
|
||||
|
||||
const botDetails = botDb[botType];
|
||||
if (!botDetails.difficulty)
|
||||
if (!botDetails?.difficulty)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
const botDifficulties = Object.keys(botDetails.difficulty);
|
||||
|
||||
result[botType] = {};
|
||||
const botDifficulties = Object.keys(botDetails.difficulty);
|
||||
result[enumType] = {};
|
||||
for (const difficulty of botDifficulties)
|
||||
{
|
||||
result[botType][difficulty] = this.getBotDifficulty(botType, difficulty, true);
|
||||
result[enumType][difficulty] = this.getBotDifficulty(enumType, difficulty, true);
|
||||
}
|
||||
}
|
||||
|
||||
result["core"] = this.getBotCoreDifficulty();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user