Core/Items: correctly cast spells on item store. Closes #4208
This commit is contained in:
@@ -12180,11 +12180,6 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
|
|||||||
pItem->SetItemRandomProperties(randomPropertyId);
|
pItem->SetItemRandomProperties(randomPropertyId);
|
||||||
pItem = StoreItem(dest, pItem, update);
|
pItem = StoreItem(dest, pItem, update);
|
||||||
|
|
||||||
const ItemTemplate* proto = pItem->GetTemplate();
|
|
||||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
|
||||||
if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
|
|
||||||
CastSpell(this, proto->Spells[i].SpellId, true, pItem);
|
|
||||||
|
|
||||||
if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound())
|
if (allowedLooters.size() > 1 && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound())
|
||||||
{
|
{
|
||||||
pItem->SetSoulboundTradeable(allowedLooters);
|
pItem->SetSoulboundTradeable(allowedLooters);
|
||||||
@@ -12290,6 +12285,14 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
|
|||||||
AddEnchantmentDurations(pItem);
|
AddEnchantmentDurations(pItem);
|
||||||
AddItemDurations(pItem);
|
AddItemDurations(pItem);
|
||||||
|
|
||||||
|
|
||||||
|
const ItemTemplate* proto = pItem->GetTemplate();
|
||||||
|
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||||
|
if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
|
||||||
|
if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END))
|
||||||
|
if (HasAura(proto->Spells[i].SpellId))
|
||||||
|
CastSpell(this, proto->Spells[i].SpellId, true, pItem);
|
||||||
|
|
||||||
return pItem;
|
return pItem;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -12326,6 +12329,13 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
|
|||||||
|
|
||||||
pItem2->SetState(ITEM_CHANGED, this);
|
pItem2->SetState(ITEM_CHANGED, this);
|
||||||
|
|
||||||
|
const ItemTemplate* proto = pItem2->GetTemplate();
|
||||||
|
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||||
|
if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
|
||||||
|
if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END))
|
||||||
|
if (HasAura(proto->Spells[i].SpellId))
|
||||||
|
CastSpell(this, proto->Spells[i].SpellId, true, pItem2);
|
||||||
|
|
||||||
return pItem2;
|
return pItem2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user