Fix processReward()
incorrectly trying to add mods to armor items without slots
Add `itemHasSlots` to itemHelper and consolodate its use across code
This commit is contained in:
parent
47bedcb526
commit
12a9cb5ded
@ -269,7 +269,7 @@ export class BotInventoryGenerator
|
||||
const tacVestsWithArmor = Object.entries(templateInventory.equipment.TacticalVest).reduce(
|
||||
(newVestDictionary, [tplKey]) =>
|
||||
{
|
||||
if (this.itemHelper.getItem(tplKey)[1]._props.Slots?.length > 0)
|
||||
if (this.itemHelper.itemHasSlots(tplKey))
|
||||
{
|
||||
newVestDictionary[tplKey] = templateInventory.equipment.TacticalVest[tplKey];
|
||||
}
|
||||
@ -290,7 +290,7 @@ export class BotInventoryGenerator
|
||||
const tacVestsWithoutArmor = Object.entries(templateInventory.equipment.TacticalVest).reduce(
|
||||
(newVestDictionary, [tplKey]) =>
|
||||
{
|
||||
if (this.itemHelper.getItem(tplKey)[1]._props.Slots?.length === 0)
|
||||
if (this.itemHelper.itemHasSlots(tplKey))
|
||||
{
|
||||
newVestDictionary[tplKey] = templateInventory.equipment.TacticalVest[tplKey];
|
||||
}
|
||||
|
@ -275,6 +275,11 @@ export class ItemHelper
|
||||
return [false, undefined];
|
||||
}
|
||||
|
||||
public itemHasSlots(itemTpl: string): boolean
|
||||
{
|
||||
return this.getItem(itemTpl)[1]._props.Slots?.length > 0;
|
||||
}
|
||||
|
||||
public isItemInDb(tpl: string): boolean
|
||||
{
|
||||
const itemDetails = this.getItem(tpl);
|
||||
|
@ -269,10 +269,14 @@ export class QuestHelper
|
||||
|
||||
// Is armor item that may need inserts / plates
|
||||
if (questReward.items.length === 1 && this.itemHelper.armorItemCanHoldMods(rootItem._tpl))
|
||||
{
|
||||
// Only process items with slots
|
||||
if (this.itemHelper.itemHasSlots(rootItem._tpl))
|
||||
{
|
||||
// Attempt to pull default preset from globals and add child items to reward
|
||||
this.generateArmorRewardChildSlots(rootItem, questReward);
|
||||
}
|
||||
}
|
||||
|
||||
for (const item of questReward.items)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user