@@ -126,7 +126,7 @@ module.exports = { | |||||
if ((!obj.mob) || (item.ability)) { | if ((!obj.mob) || (item.ability)) { | ||||
if (item.spell) | if (item.spell) | ||||
inventory.learnAbility({ itemId, slot: item.runeSlot }); | |||||
inventory.learnAbility({ itemId, slot: item.runeSlot, bypassEqCheck: true }); | |||||
else | else | ||||
obj.syncer.setArray(true, 'inventory', 'getItems', inventory.simplifyItem(item)); | obj.syncer.setArray(true, 'inventory', 'getItems', inventory.simplifyItem(item)); | ||||
} | } | ||||
@@ -145,10 +145,12 @@ module.exports = { | |||||
} | } | ||||
}, | }, | ||||
learnAbility: function ({ itemId, slot }) { | |||||
//forceEq is set by the equipment component to force the ability to be learnt since the item is already EQd | |||||
// otherwise the first if check would fail | |||||
learnAbility: function ({ itemId, slot, bypassEqCheck = false }) { | |||||
let item = this.findItem(itemId); | let item = this.findItem(itemId); | ||||
let statValues = this.obj.stats.values; | let statValues = this.obj.stats.values; | ||||
if (!item || item.eq) | |||||
if (!item || (item.eq && !bypassEqCheck)) | |||||
return; | return; | ||||
else if (!item.spell) { | else if (!item.spell) { | ||||
item.eq = false; | item.eq = false; | ||||
@@ -123,12 +123,12 @@ module.exports = (cpnInv, item, hideMessage, noStack, hideAlert, createBagIfFull | |||||
cpnInv.items.push(item); | cpnInv.items.push(item); | ||||
if (item.eq) { | if (item.eq) { | ||||
delete item.eq; | |||||
if (item.ability) | if (item.ability) | ||||
cpnInv.learnAbility({ itemId: item.id, slot: item.runeSlot }); | cpnInv.learnAbility({ itemId: item.id, slot: item.runeSlot }); | ||||
else { | |||||
delete item.eq; | |||||
else | |||||
obj.equipment.equip({ itemId: item.id }); | obj.equipment.equip({ itemId: item.id }); | ||||
} | |||||
} else if (item.has('quickSlot')) { | } else if (item.has('quickSlot')) { | ||||
obj.equipment.setQuickSlot({ | obj.equipment.setQuickSlot({ | ||||
itemId: item.id, | itemId: item.id, | ||||