From f71c97f6c5629c74d1305830f96803c7b8a28d8b Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Mon, 20 Dec 2010 00:46:00 +0100 Subject: [PATCH] =?UTF-8?q?Core/Items:=20Fix=20ITEM=5FSPELLTRIGGER=5FON=5F?= =?UTF-8?q?NO=5FDELAY=5FUSE=20(5).=20This=20trigger=20should=20(only)=20tr?= =?UTF-8?q?igger=20the=20respective=20spell=20when=20the=20item=20is=20add?= =?UTF-8?q?ed=20to=20the=20inventory.=20Aura=C2=B4s=20created=20by=20this?= =?UTF-8?q?=20spell=20will=20be=20properly=20removed=20when=20the=20item?= =?UTF-8?q?=20is=20destroyed=20as=20well.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : trunk --- src/server/game/Entities/Player/Player.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ab56a0bb14..d441a73f7f 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -8072,7 +8072,7 @@ void Player::CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 c continue; // wrong triggering type - if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE && spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_NO_DELAY_USE) + if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) continue; SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId); @@ -11553,6 +11553,11 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update pItem->SetItemRandomProperties(randomPropertyId); pItem = StoreItem(dest, pItem, update); + const ItemPrototype *proto = pItem->GetProto(); + 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 && pItem->GetProto()->GetMaxStackSize() == 1 && pItem->IsSoulBound()) { pItem->SetSoulboundTradeable(allowedLooters, this, true); @@ -12039,6 +12044,11 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) pItem->SetSoulboundTradeable(NULL, this, false); RemoveTradeableItem(pItem); + const ItemPrototype *proto = pItem->GetProto(); + 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 + RemoveAurasDueToSpell(proto->Spells[i].SpellId); + ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount()); if (bag == INVENTORY_SLOT_BAG_0)