[11670] Implement in proper way ITEM_SPELLTRIGGER_ON_STORE (5)

Item spells with this trigger mode expected casted at item add
to inventory/equip slots (exclude bank), and spell auras (if any)
applied while item in like slots. Item expected destroyed at aura
remove by some reason.

Implementation note: because 2 step way item moves from slot to slot
related auras not removed at internal RemoveItem call and removed only
at directly item destroy/remove from player function calles, or at StoreItem
(if item added to not appropriate slot). So need in future careful with new
RemoveItem call cases.
This commit is contained in:
VladimirMangos 2011-06-24 22:26:50 +04:00
parent 3f840222ee
commit 04a469f393
6 changed files with 122 additions and 34 deletions

View file

@ -8558,19 +8558,22 @@ void SpellAuraHolder::_AddSpellAuraHolder()
void SpellAuraHolder::_RemoveSpellAuraHolder()
{
// Remove all triggered by aura spells vs unlimited duration
// Remove all triggered by aura spells vs unlimited duration
// except same aura replace case
if(m_removeMode!=AURA_REMOVE_BY_STACK)
CleanupTriggeredSpells();
Unit* caster = GetCaster();
if(caster && IsPersistent())
{
DynamicObject *dynObj = caster->GetDynObject(GetId());
if (dynObj)
if (caster && IsPersistent())
if (DynamicObject *dynObj = caster->GetDynObject(GetId()))
dynObj->RemoveAffected(m_target);
}
// remove at-store spell cast items (for all remove modes?)
if (caster && caster->GetTypeId() == TYPEID_PLAYER && m_removeMode != AURA_REMOVE_BY_DEFAULT && m_removeMode != AURA_REMOVE_BY_DELETE)
if (ObjectGuid castItemGuid = GetCastItemGuid())
if (Item* castItem = ((Player*)m_target)->GetItemByGuid(castItemGuid))
((Player*)caster)->DestroyItemWithOnStoreSpell(castItem);
//passive auras do not get put in slots - said who? ;)
// Note: but totem can be not accessible for aura target in time remove (to far for find in grid)