Further extension of profiel fixing code, deletes more

Clothing, active repeatable quests with bad trader/items, trader purchases from bad traders
This commit is contained in:
Dev 2023-08-04 10:25:21 +01:00
parent 281cba8db5
commit 07217e9ed0

View File

@ -721,6 +721,74 @@ export class ProfileFixerService
} }
} }
} }
const clothing = this.databaseServer.getTables().templates.customization;
for (const suitId of fullProfile.suits)
{
if (!clothing[suitId])
{
this.logger.error(this.localisationService.getText("fixer-mod_item_found", suitId));
if (this.coreConfig.fixes.removeModItemsFromProfile)
{
fullProfile.suits.splice(fullProfile.suits.indexOf(suitId), 1);
this.logger.warning(`Non-default suit purchase: ${suitId} removed from profile`);
}
}
}
for (const repeatable of fullProfile.characters.pmc.RepeatableQuests)
{
for (const activeQuest of repeatable.activeQuests ?? [])
{
if (!Object.values(Traders).some((x) => x === activeQuest.traderId))
{
this.logger.error(this.localisationService.getText("fixer-mod_item_found", activeQuest.traderId));
if (this.coreConfig.fixes.removeModItemsFromProfile)
{
this.logger.warning(`Non-default quest: ${activeQuest._id} from trader: ${activeQuest.traderId} removed from RepeatableQuests list in profile`);
repeatable.activeQuests.splice(repeatable.activeQuests.findIndex(x => x._id === activeQuest._id), 1);
}
continue;
}
for (const successReward of activeQuest.rewards.Success)
{
if (successReward.type === "Item")
{
for (const rewardItem of successReward.items)
{
if (!itemsDb[rewardItem._tpl])
{
this.logger.error(this.localisationService.getText("fixer-mod_item_found", rewardItem._tpl));
if (this.coreConfig.fixes.removeModItemsFromProfile)
{
this.logger.warning(`Non-default quest: ${activeQuest._id} from trader: ${activeQuest.traderId} removed from RepeatableQuests list in profile`);
repeatable.activeQuests.splice(repeatable.activeQuests.findIndex(x => x._id === activeQuest._id), 1);
}
continue;
}
}
}
}
}
}
for (const traderId in fullProfile.traderPurchases)
{
if (!Object.values(Traders).some((x) => x === traderId))
{
this.logger.error(this.localisationService.getText("fixer-mod_item_found", traderId));
if (this.coreConfig.fixes.removeModItemsFromProfile)
{
this.logger.warning(`Non-default trader: ${traderId} removed from traderPurchases list in profile`);
delete fullProfile.traderPurchases[traderId];
}
}
}
} }
/** /**