From 86bef7ace55aea4204eb53016821c304f03d972c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 27 May 2010 19:08:24 +0400 Subject: [PATCH] [9984] Implement item 43214 work. * Original version suggested by timmit. * Required DB support for target requirement. --- sql/mangos_spell_check.sql | 2 ++ src/game/Spell.cpp | 13 +++++++++---- src/game/Spell.h | 1 + src/game/SpellEffects.cpp | 26 ++++++++++++++------------ src/shared/revision_nr.h | 2 +- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index d2ede6f9c..8ad7399d5 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -516,6 +516,8 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (57669,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Replenishment', 'Spell::SetTargetMap'), (57723,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Exhaustion', 'Spell::cast'), (57724,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Sated', 'Spell::cast'), +(57908, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Stain Cloth', 'Spell::EffectDummy'), +(57915,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Create Cloth', 'Spell::EffectDummy'), (58067,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Refreshment', 'Spell::EffectScriptEffect'), (58367,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Execution', 'Spell::EffectDummy'), (58418, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Portal to Orgrimmar', 'Spell::EffectDummy'), diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index e79c4c548..0c1d69b8c 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3857,10 +3857,7 @@ void Spell::TakeCastItem() ((Player*)m_caster)->DestroyItemCount(m_CastItem, count, true); // prevent crash at access to deleted m_targets.getItemTarget - if(m_CastItem == m_targets.getItemTarget()) - m_targets.setItemTarget(NULL); - - m_CastItem = NULL; + ClearCastItem(); } } @@ -6634,4 +6631,12 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe target->CastSpell(target, spellId75, true); return; +} + +void Spell::ClearCastItem() +{ + if (m_CastItem==m_targets.getItemTarget()) + m_targets.setItemTarget(NULL); + + m_CastItem = NULL; } \ No newline at end of file diff --git a/src/game/Spell.h b/src/game/Spell.h index c6a372e1a..ebd8c03e1 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -497,6 +497,7 @@ class Spell void CastTriggerSpells(); void CleanupTargetList(); + void ClearCastItem(); static void SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spellId150, uint32 spellId225, uint32 spellId300, uint32 spellIdSpecial); protected: diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 2b01e0f71..3d55cb640 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1686,6 +1686,17 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; } + case 57908: // Stain Cloth + { + // nothing do more + finish(); + + m_caster->CastSpell(m_caster, 57915, false, m_CastItem); + + // cast item deleted + ClearCastItem(); + break; + } case 58418: // Portal to Orgrimmar case 58420: // Portal to Stormwind return; // implemented in EffectScript[0] @@ -3719,10 +3730,7 @@ void Spell::EffectSummonChangeItem(SpellEffectIndex eff_idx) player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt - if (m_CastItem==m_targets.getItemTarget()) - m_targets.setItemTarget(NULL); - - m_CastItem = NULL; + ClearCastItem(); player->StoreItem( dest, pNewItem, true); return; @@ -3737,10 +3745,7 @@ void Spell::EffectSummonChangeItem(SpellEffectIndex eff_idx) player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt - if (m_CastItem==m_targets.getItemTarget()) - m_targets.setItemTarget(NULL); - - m_CastItem = NULL; + ClearCastItem(); player->BankItem( dest, pNewItem, true); return; @@ -3755,10 +3760,7 @@ void Spell::EffectSummonChangeItem(SpellEffectIndex eff_idx) player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt - if (m_CastItem==m_targets.getItemTarget()) - m_targets.setItemTarget(NULL); - - m_CastItem = NULL; + ClearCastItem(); player->EquipItem( dest, pNewItem, true); player->AutoUnequipOffhandIfNeed(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b9c58413c..eff6bd626 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9983" + #define REVISION_NR "9984" #endif // __REVISION_NR_H__