Skip to content

Commit

Permalink
[9274] Implement SPELL_EFFECT_SUMMON_ALL_TOTEMS
Browse files Browse the repository at this point in the history
This implement work spells 66842, 66843, 66844.

Patch originall writed by Arthorius, with additional fixes from darkstalker
and hack removes from me.
  • Loading branch information
VladimirMangos committed Jan 31, 2010
1 parent bff1cd4 commit f77e210
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/game/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8,ActionButton> ActionButtonList;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/game/SharedDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions src/game/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/game/Spell.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 16 additions & 1 deletion src/game/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9273"
#define REVISION_NR "9274"
#endif // __REVISION_NR_H__

0 comments on commit f77e210

Please sign in to comment.