[8225] Some fixes from 320 branch.

(backported from commit 4bdcf42)

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
tomrus88 2009-07-21 04:11:45 +04:00 committed by VladimirMangos
parent b7389d2a20
commit a0efd034ca
10 changed files with 85 additions and 59 deletions

View file

@ -58,9 +58,9 @@ void Totem::Summon(Unit* owner)
// select totem model in dependent from owner team
CreatureInfo const *cinfo = GetCreatureInfo();
if(owner->GetTypeId()==TYPEID_PLAYER && cinfo)
if(owner->GetTypeId() == TYPEID_PLAYER && cinfo)
{
uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(),cinfo);
uint32 display_id = objmgr.ChooseDisplayId(((Player*)owner)->GetTeam(), cinfo);
CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(display_id);
if (minfo)
display_id = minfo->modelid;
@ -75,8 +75,12 @@ void Totem::Summon(Unit* owner)
switch(m_type)
{
case TOTEM_PASSIVE: CastSpell(this, GetSpell(), true); break;
case TOTEM_STATUE: CastSpell(GetOwner(), GetSpell(), true); break;
case TOTEM_PASSIVE:
CastSpell(this, GetSpell(), true);
break;
case TOTEM_STATUE:
CastSpell(GetOwner(), GetSpell(), true);
break;
default: break;
}
}
@ -90,10 +94,10 @@ void Totem::UnSummon()
Unit *owner = GetOwner();
if (owner)
{
// clear owenr's totem slot
// clear owner's totem slot
for(int i = 0; i < MAX_TOTEM; ++i)
{
if(owner->m_TotemSlot[i]==GetGUID())
if(owner->m_TotemSlot[i] == GetGUID())
{
owner->m_TotemSlot[i] = 0;
break;
@ -103,12 +107,10 @@ void Totem::UnSummon()
owner->RemoveAurasDueToSpell(GetSpell());
//remove aura all party members too
Group *pGroup = NULL;
if (owner->GetTypeId() == TYPEID_PLAYER)
{
// Not only the player can summon the totem (scripted AI)
pGroup = ((Player*)owner)->GetGroup();
if (pGroup)
if(Group *pGroup = ((Player*)owner)->GetGroup())
{
for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
{
@ -152,13 +154,13 @@ void Totem::SetTypeBySummonSpell(SpellEntry const * spellProto)
if (GetSpellCastTime(totemSpell))
m_type = TOTEM_ACTIVE;
}
if(spellProto->SpellIconID==2056)
if(spellProto->SpellIconID == 2056)
m_type = TOTEM_STATUE; //Jewelery statue
}
bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
{
// TODO: possibly all negative auras immuned?
// TODO: possibly all negative auras immune?
switch(spellInfo->EffectApplyAuraName[index])
{
case SPELL_AURA_PERIODIC_DAMAGE:
@ -170,4 +172,4 @@ bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) co
break;
}
return Creature::IsImmunedToSpellEffect(spellInfo, index);
}
}