diff --git a/src/game/Player.cpp b/src/game/Player.cpp index f8fbbd76a..13832c26d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -5728,6 +5728,15 @@ void Player::removeActionButton(uint8 button) sLog.outDetail( "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow() ); } +ActionButton const* Player::GetActionButton(uint8 button) +{ + ActionButtonList::iterator buttonItr = m_actionButtons.find(button); + if (buttonItr==m_actionButtons.end() || buttonItr->second.uState == ACTIONBUTTON_DELETED) + return NULL; + + return &buttonItr->second; +} + bool Player::SetPosition(float x, float y, float z, float orientation, bool teleport) { // prevent crash when a bad coord is sent by the client diff --git a/src/game/Player.h b/src/game/Player.h index d32f68291..6ded894eb 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -181,6 +181,12 @@ struct ActionButton } }; +// some action button indexes used in code or clarify structure +enum ActionButtonIndex +{ + ACTION_BUTTON_SHAMAN_TOTEMS_BAR = 132, +}; + #define MAX_ACTION_BUTTONS 144 //checked in 3.2.0 typedef std::map ActionButtonList; @@ -1692,6 +1698,7 @@ class MANGOS_DLL_SPEC Player : public Unit ActionButton* addActionButton(uint8 button, uint32 action, uint8 type); void removeActionButton(uint8 button); void SendInitialActionButtons() const; + ActionButton const* GetActionButton(uint8 button); PvPInfo pvpInfo; void UpdatePvP(bool state, bool ovrride=false); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 9074a2a17..b1d063b76 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -624,7 +624,7 @@ enum SpellEffects SPELL_EFFECT_SELF_RESURRECT = 94, SPELL_EFFECT_SKINNING = 95, SPELL_EFFECT_CHARGE = 96, - SPELL_EFFECT_97 = 97, + SPELL_EFFECT_SUMMON_ALL_TOTEMS = 97, SPELL_EFFECT_KNOCK_BACK = 98, SPELL_EFFECT_DISENCHANT = 99, SPELL_EFFECT_INEBRIATE = 100, diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 31f69a294..319680fd2 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2306,13 +2306,12 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni } break; case SPELL_EFFECT_SUMMON: - targetUnitMap.push_back(m_caster); - break; case SPELL_EFFECT_SUMMON_CHANGE_ITEM: case SPELL_EFFECT_TRANS_DOOR: case SPELL_EFFECT_ADD_FARSIGHT: case SPELL_EFFECT_APPLY_GLYPH: case SPELL_EFFECT_STUCK: + case SPELL_EFFECT_SUMMON_ALL_TOTEMS: case SPELL_EFFECT_FEED_PET: case SPELL_EFFECT_DESTROY_ALL_TOTEMS: case SPELL_EFFECT_SKILL: diff --git a/src/game/Spell.h b/src/game/Spell.h index 00878b43f..0a907cf05 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -304,6 +304,7 @@ class Spell void EffectPlayerPull(uint32 i); void EffectDispelMechanic(uint32 i); void EffectSummonDeadPet(uint32 i); + void EffectSummonAllTotems(uint32 i); void EffectDestroyAllTotems(uint32 i); void EffectDurabilityDamage(uint32 i); void EffectSkill(uint32 i); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 54bb9091c..1ecdb78fd 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -154,7 +154,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= &Spell::EffectSelfResurrect, // 94 SPELL_EFFECT_SELF_RESURRECT &Spell::EffectSkinning, // 95 SPELL_EFFECT_SKINNING &Spell::EffectCharge, // 96 SPELL_EFFECT_CHARGE - &Spell::EffectUnused, // 97 SPELL_EFFECT_97 + &Spell::EffectSummonAllTotems, // 97 SPELL_EFFECT_SUMMON_ALL_TOTEMS &Spell::EffectKnockBack, // 98 SPELL_EFFECT_KNOCK_BACK &Spell::EffectDisEnchant, // 99 SPELL_EFFECT_DISENCHANT &Spell::EffectInebriate, //100 SPELL_EFFECT_INEBRIATE @@ -6526,6 +6526,21 @@ void Spell::EffectSummonDeadPet(uint32 /*i*/) pet->SavePetToDB(PET_SAVE_AS_CURRENT); } +void Spell::EffectSummonAllTotems(uint32 i) +{ + if(m_caster->GetTypeId() != TYPEID_PLAYER) + return; + + int32 start_button = ACTION_BUTTON_SHAMAN_TOTEMS_BAR + m_spellInfo->EffectMiscValue[i]; + int32 amount_buttons = m_spellInfo->EffectMiscValueB[i]; + + for(int32 slot = 0; slot < amount_buttons; ++slot) + if (ActionButton const* actionButton = ((Player*)m_caster)->GetActionButton(start_button+slot)) + if (actionButton->GetType()==ACTION_BUTTON_SPELL) + if (uint32 spell_id = actionButton->GetAction()) + m_caster->CastSpell(unitTarget,spell_id,true); +} + void Spell::EffectDestroyAllTotems(uint32 /*i*/) { int32 mana = 0; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 71bade043..d0f60cc04 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 "9273" + #define REVISION_NR "9274" #endif // __REVISION_NR_H__