What bug does the patch fix? What features does the patch add?
Implement Call of the Elements, Call of the Ancestors, Call of the Spirits
For which repository revision was the patch created?
8967
Who has been writing this patch? Please include either forum user names or email addresses.
Arthorius
http://filebeam.com/b07d6a41c23d318fb6b947a81c198d27
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index e89b34f..5872cc6 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -5667,6 +5667,15 @@ void Player::removeActionButton(uint8 button)
sLog.outDetail( "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow() );
}
+uint32 Player::GetActionByActionButton(uint8 button)
+{
+ ActionButtonList::iterator buttonItr = m_actionButtons.find(button);
+ if (buttonItr==m_actionButtons.end())
+ return 0;
+
+ return buttonItr->second.GetAction();
+}
+
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 e1b4a27..718d497 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1657,6 +1657,7 @@ class MANGOS_DLL_SPEC Player : public Unit
ActionButton* addActionButton(uint8 button, uint32 action, uint8 type);
void removeActionButton(uint8 button);
void SendInitialActionButtons() const;
+ uint32 GetActionByActionButton(uint8 button);
PvPInfo pvpInfo;
void UpdatePvP(bool state, bool ovrride=false);
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index 9052f38..d91af78 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 a130bfc..419c7b4 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -494,6 +494,10 @@ void Spell::FillTargetMap()
if(IsAreaAuraEffect(m_spellInfo->Effect[i]))
AddUnitTarget(m_caster, i);
+ // SPELL_EFFECT_SUMMON_ALL_TOTEMS not have any implicit target
+ if(m_spellInfo->Effect[i] == SPELL_EFFECT_SUMMON_ALL_TOTEMS)
+ AddUnitTarget(m_caster, i);
+
std::list<Unit*> tmpUnitMap;
// TargetA/TargetB dependent from each other, we not switch to full support this dependences
diff --git a/src/game/Spell.h b/src/game/Spell.h
index 0965114..2666fd5 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 c899656..e79d5ab 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
@@ -6540,6 +6540,31 @@ void Spell::EffectSummonDeadPet(uint32 /*i*/)
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
}
+void Spell::EffectSummonAllTotems(uint32 i)
+{
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ switch(m_spellInfo->Id)
+ {
+ case 66842: // Call of the Elements
+ case 66843: // Call of the Ancestors
+ case 66844: // Call of the Spirits
+ {
+ for(int32 slot = 0; slot != MAX_TOTEM; ++slot)
+ {
+ uint8 button = m_spellInfo->EffectMiscValue[i]+slot+132;
+ uint32 spell_id = ((Player*)m_caster)->GetActionByActionButton(button);
+ if(spell_id)
+ m_caster->CastSpell(unitTarget,spell_id,true);
+ }
+ break;
+ }
+ default:
+ break;
+ }
+}
+
void Spell::EffectDestroyAllTotems(uint32 /*i*/)
{
int32 mana = 0;