[9274] Implement SPELL_EFFECT_SUMMON_ALL_TOTEMS

This implement work spells 66842, 66843, 66844.

Patch originall writed by Arthorius, with additional fixes from darkstalker
and hack removes from me.
This commit is contained in:
VladimirMangos 2010-01-31 18:37:32 +03:00
parent 9aedd3a864
commit 904995c024
7 changed files with 36 additions and 5 deletions

View file

@ -5728,6 +5728,15 @@ void Player::removeActionButton(uint8 button)
sLog.outDetail( "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow() ); 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) bool Player::SetPosition(float x, float y, float z, float orientation, bool teleport)
{ {
// prevent crash when a bad coord is sent by the client // prevent crash when a bad coord is sent by the client

View file

@ -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 #define MAX_ACTION_BUTTONS 144 //checked in 3.2.0
typedef std::map<uint8,ActionButton> ActionButtonList; typedef std::map<uint8,ActionButton> ActionButtonList;
@ -1692,6 +1698,7 @@ class MANGOS_DLL_SPEC Player : public Unit
ActionButton* addActionButton(uint8 button, uint32 action, uint8 type); ActionButton* addActionButton(uint8 button, uint32 action, uint8 type);
void removeActionButton(uint8 button); void removeActionButton(uint8 button);
void SendInitialActionButtons() const; void SendInitialActionButtons() const;
ActionButton const* GetActionButton(uint8 button);
PvPInfo pvpInfo; PvPInfo pvpInfo;
void UpdatePvP(bool state, bool ovrride=false); void UpdatePvP(bool state, bool ovrride=false);

View file

@ -624,7 +624,7 @@ enum SpellEffects
SPELL_EFFECT_SELF_RESURRECT = 94, SPELL_EFFECT_SELF_RESURRECT = 94,
SPELL_EFFECT_SKINNING = 95, SPELL_EFFECT_SKINNING = 95,
SPELL_EFFECT_CHARGE = 96, SPELL_EFFECT_CHARGE = 96,
SPELL_EFFECT_97 = 97, SPELL_EFFECT_SUMMON_ALL_TOTEMS = 97,
SPELL_EFFECT_KNOCK_BACK = 98, SPELL_EFFECT_KNOCK_BACK = 98,
SPELL_EFFECT_DISENCHANT = 99, SPELL_EFFECT_DISENCHANT = 99,
SPELL_EFFECT_INEBRIATE = 100, SPELL_EFFECT_INEBRIATE = 100,

View file

@ -2306,13 +2306,12 @@ void Spell::SetTargetMap(uint32 effIndex, uint32 targetMode, UnitList& targetUni
} }
break; break;
case SPELL_EFFECT_SUMMON: case SPELL_EFFECT_SUMMON:
targetUnitMap.push_back(m_caster);
break;
case SPELL_EFFECT_SUMMON_CHANGE_ITEM: case SPELL_EFFECT_SUMMON_CHANGE_ITEM:
case SPELL_EFFECT_TRANS_DOOR: case SPELL_EFFECT_TRANS_DOOR:
case SPELL_EFFECT_ADD_FARSIGHT: case SPELL_EFFECT_ADD_FARSIGHT:
case SPELL_EFFECT_APPLY_GLYPH: case SPELL_EFFECT_APPLY_GLYPH:
case SPELL_EFFECT_STUCK: case SPELL_EFFECT_STUCK:
case SPELL_EFFECT_SUMMON_ALL_TOTEMS:
case SPELL_EFFECT_FEED_PET: case SPELL_EFFECT_FEED_PET:
case SPELL_EFFECT_DESTROY_ALL_TOTEMS: case SPELL_EFFECT_DESTROY_ALL_TOTEMS:
case SPELL_EFFECT_SKILL: case SPELL_EFFECT_SKILL:

View file

@ -304,6 +304,7 @@ class Spell
void EffectPlayerPull(uint32 i); void EffectPlayerPull(uint32 i);
void EffectDispelMechanic(uint32 i); void EffectDispelMechanic(uint32 i);
void EffectSummonDeadPet(uint32 i); void EffectSummonDeadPet(uint32 i);
void EffectSummonAllTotems(uint32 i);
void EffectDestroyAllTotems(uint32 i); void EffectDestroyAllTotems(uint32 i);
void EffectDurabilityDamage(uint32 i); void EffectDurabilityDamage(uint32 i);
void EffectSkill(uint32 i); void EffectSkill(uint32 i);

View file

@ -154,7 +154,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectSelfResurrect, // 94 SPELL_EFFECT_SELF_RESURRECT &Spell::EffectSelfResurrect, // 94 SPELL_EFFECT_SELF_RESURRECT
&Spell::EffectSkinning, // 95 SPELL_EFFECT_SKINNING &Spell::EffectSkinning, // 95 SPELL_EFFECT_SKINNING
&Spell::EffectCharge, // 96 SPELL_EFFECT_CHARGE &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::EffectKnockBack, // 98 SPELL_EFFECT_KNOCK_BACK
&Spell::EffectDisEnchant, // 99 SPELL_EFFECT_DISENCHANT &Spell::EffectDisEnchant, // 99 SPELL_EFFECT_DISENCHANT
&Spell::EffectInebriate, //100 SPELL_EFFECT_INEBRIATE &Spell::EffectInebriate, //100 SPELL_EFFECT_INEBRIATE
@ -6526,6 +6526,21 @@ void Spell::EffectSummonDeadPet(uint32 /*i*/)
pet->SavePetToDB(PET_SAVE_AS_CURRENT); 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*/) void Spell::EffectDestroyAllTotems(uint32 /*i*/)
{ {
int32 mana = 0; int32 mana = 0;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9273" #define REVISION_NR "9274"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__