aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMachiavelli <none@none>2010-12-20 00:46:00 +0100
committerMachiavelli <none@none>2010-12-20 00:46:00 +0100
commitf71c97f6c5629c74d1305830f96803c7b8a28d8b (patch)
treea87e6a61df304e2e42c1f33444a13ca738de709e /src
parentbaff745be1b4215449f1260bb39d05ffb4d3bfda (diff)
Core/Items: Fix ITEM_SPELLTRIGGER_ON_NO_DELAY_USE (5). This trigger should (only) trigger the respective spell when the item is added to the inventory. Aura´s created by this spell will be properly removed when the item is destroyed as well.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index ab56a0bb145..d441a73f7fd 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)