Jump to content

[9274][patch] Call of the Elements, Call of the Ancestors, Call of the Spirits


Guest Arthorius

Recommended Posts

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;

Link to comment
Share on other sites

i had one possible implementation here

http://www.getmangos.eu/community/showthread.php?t=10520

still had that target problem (only thing that made me not make a patch) had to do a ugly hack to workaround it.

So its doing this correct? or still hacky?

+        // SPELL_EFFECT_SUMMON_ALL_TOTEMS not have any implicit target
+        if(m_spellInfo->Effect[i] == SPELL_EFFECT_SUMMON_ALL_TOTEMS)
+            AddUnitTarget(m_caster, i);

Link to comment
Share on other sites

patch works with 900x mangos?

any updates/news

and this part correct, typo fix

 
+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;
+    }
+}
+

Link to comment
Share on other sites

  • 1 month later...
patch works on 9261, but there is a bug:

if you set "no totem" in any slot, last totem will be spawned anyway on spell cast. For example you can disable all totems in all slots, but there is no difference - totems will be spawned

thats what i have in my implementation (tested for months)

        uint32 GetActionButtonSpell(uint8 button) const
       {
           ActionButtonList::const_iterator ab = m_actionButtons.find(button);
           return ab != m_actionButtons.end() && ab->second.uState != ACTIONBUTTON_DELETED && ab->second.GetType() == ACTION_BUTTON_SPELL ? ab->second.GetAction() : 0;
       }

void Spell::EffectCastButtons(uint32 i)
{
   if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER)
       return;

   Player *p_caster = (Player*)m_caster;
   uint32 button_id = m_spellInfo->EffectMiscValue[i] + 132;
   uint32 n_buttons = m_spellInfo->EffectMiscValueB[i];

   for (; n_buttons; n_buttons--, button_id++)
   {
       uint32 spell_id = p_caster->GetActionButtonSpell(button_id);
       if (!spell_id)
           continue;
       p_caster->CastSpell(unitTarget, spell_id, true);
   }
}

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use