0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 02:30:43 -05:00

Fix issue with getBotDifficultySettings() cloning assault bot correctly when bot type not found but storing it against the new bot type with preserved caps, resulting in getting difficulty values failing

This commit is contained in:
Dev 2024-05-14 15:45:04 +01:00
parent ed6e81ab52
commit 1d8bc4537c

View File

@ -56,26 +56,27 @@ export class BotDifficultyHelper
*/
public getBotDifficultySettings(type: string, difficulty: string): Difficulty
{
const bot = this.databaseServer.getTables().bots.types[type];
const desiredType = type.toLowerCase();
const bot = this.databaseServer.getTables().bots.types[desiredType];
if (!bot)
{
// get fallback
this.logger.warning(this.localisationService.getText("bot-unable_to_get_bot_fallback_to_assault", type));
this.databaseServer.getTables().bots.types[type] = this.cloner.clone(
this.databaseServer.getTables().bots.types[desiredType] = this.cloner.clone(
this.databaseServer.getTables().bots.types.assault,
);
}
const difficultySettings = this.botHelper.getBotTemplate(type).difficulty[difficulty];
const difficultySettings = this.botHelper.getBotTemplate(desiredType).difficulty[difficulty];
if (!difficultySettings)
{
this.logger.warning(
this.localisationService.getText("bot-unable_to_get_bot_difficulty_fallback_to_assault", {
botType: type,
botType: desiredType,
difficulty: difficulty,
}),
);
this.databaseServer.getTables().bots.types[type].difficulty[difficulty] = this.cloner.clone(
this.databaseServer.getTables().bots.types[desiredType].difficulty[difficulty] = this.cloner.clone(
this.databaseServer.getTables().bots.types.assault.difficulty[difficulty],
);
}