From 76f7a25f2d342a6d0c6d0af949f1d40683c8c3d2 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Mon, 12 Jan 2009 01:46:50 +0300 Subject: [PATCH] [7071] Fixed recent problem with pacified aura for druids with flight forms. Cleanups code. --- src/game/Player.cpp | 36 ++++++++++++++++++++---------------- src/game/SpellAuras.cpp | 1 + src/shared/revision_nr.h | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 42b7ab1c8..2b13be292 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2723,23 +2723,27 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool disabled // also cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks else if (IsPassiveSpell(spell_id)) { - // if spell doesn't require a stance or the player is in the required stance - if( ( !spellInfo->Stances && - spell_id != 5420 && spell_id != 5419 && spell_id != 7376 && - spell_id != 7381 && spell_id != 21156 && spell_id != 21009 && - spell_id != 21178 && spell_id != 33948 && spell_id != 40121 ) || - m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))) || - (spell_id == 5420 && m_form == FORM_TREE) || - (spell_id == 5419 && m_form == FORM_TRAVEL) || - (spell_id == 7376 && m_form == FORM_DEFENSIVESTANCE) || - (spell_id == 7381 && m_form == FORM_BERSERKERSTANCE) || - (spell_id == 21156 && m_form == FORM_BATTLESTANCE)|| - (spell_id == 21178 && (m_form == FORM_BEAR || m_form == FORM_DIREBEAR) ) || - (spell_id == 33948 && m_form == FORM_FLIGHT) || - (spell_id == 40121 && m_form == FORM_FLIGHT_EPIC) ) + bool need_cast = false; + + switch(spell_id) + { + // some spells not have stance data expacted cast at form change or present + case 5420: need_cast = (m_form == FORM_TREE); break; + case 5419: need_cast = (m_form == FORM_TRAVEL); break; + case 7376: need_cast = (m_form == FORM_DEFENSIVESTANCE); break; + case 7381: need_cast = (m_form == FORM_BERSERKERSTANCE); break; + case 21156: need_cast = (m_form == FORM_BATTLESTANCE); break; + case 21178: need_cast = (m_form == FORM_BEAR || m_form == FORM_DIREBEAR); break; + case 33948: need_cast = (m_form == FORM_FLIGHT); break; + case 34764: need_cast = (m_form == FORM_FLIGHT); break; + case 40121: need_cast = (m_form == FORM_FLIGHT_EPIC); break; + case 40122: need_cast = (m_form == FORM_FLIGHT_EPIC); break; + // another spells have proper stance data + default: need_cast = !spellInfo->Stances && m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))); break; + } //Check CasterAuraStates - if (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))) - CastSpell(this, spell_id, true); + if (need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)))) + CastSpell(this, spell_id, true); } else if( IsSpellHaveEffect(spellInfo,SPELL_EFFECT_SKILL_STEP) ) { diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 4ed1b6f67..f74439b49 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -5296,6 +5296,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) break; case FORM_FLIGHT: spellId = 33948; + spellId2 = 34764; break; case FORM_FLIGHT_EPIC: spellId = 40122; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 982fa31e7..be06bdeeb 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 "7070" + #define REVISION_NR "7071" #endif // __REVISION_NR_H__