aboutsummaryrefslogtreecommitdiff
path: root/src/game/Spell.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-31 15:56:51 -0500
committermegamage <none@none>2009-05-31 15:56:51 -0500
commit5ed5513ca82712a6e3691add2c9a0f005d80426f (patch)
tree781e8589bb7f8e95e6b9126f7a555c2f0e1b03ca /src/game/Spell.cpp
parent19e12305515d958c5de586c2a409979b3d193ce6 (diff)
Mangos [7911]. Author: tomrus88
Very big patch. May cause bugs. --HG-- branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r--src/game/Spell.cpp280
1 files changed, 141 insertions, 139 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 299aac060ae..d04d4ab58fd 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -49,7 +49,7 @@
#include "Util.h"
#include "TemporarySummon.h"
-#define SPELL_CHANNEL_UPDATE_INTERVAL (1*IN_MILISECONDS)
+#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILISECONDS)
extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
@@ -212,11 +212,11 @@ void SpellCastTargets::Update(Unit* caster)
{
m_GOTarget = m_GOTargetGUID ? caster->GetMap()->GetGameObject(m_GOTargetGUID) : NULL;
m_unitTarget = m_unitTargetGUID ?
- ( m_unitTargetGUID==caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) :
+ ( m_unitTargetGUID == caster->GetGUID() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) :
NULL;
m_itemTarget = NULL;
- if(caster->GetTypeId()==TYPEID_PLAYER)
+ if(caster->GetTypeId() == TYPEID_PLAYER)
{
if(m_targetMask & TARGET_FLAG_ITEM)
m_itemTarget = ((Player*)caster)->GetItemByGuid(m_itemTargetGUID);
@@ -234,7 +234,7 @@ void SpellCastTargets::Update(Unit* caster)
bool SpellCastTargets::read ( WorldPacket * data, Unit *caster )
{
- if(data->rpos()+4 > data->size())
+ if(data->rpos() + 4 > data->size())
return false;
//data->hexlike();
@@ -264,7 +264,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster )
if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION )
{
- if(data->rpos()+4+4+4 > data->size())
+ if(data->rpos() + 4 + 4 + 4 > data->size())
return false;
*data >> m_srcX >> m_srcY >> m_srcZ;
@@ -274,7 +274,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster )
if( m_targetMask & TARGET_FLAG_DEST_LOCATION )
{
- if(data->rpos()+1+4+4+4 > data->size())
+ if(data->rpos() + 1 + 4 + 4 + 4 > data->size())
return false;
if(!data->readPackGUID(m_unitTargetGUID))
@@ -287,7 +287,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster )
if( m_targetMask & TARGET_FLAG_STRING )
{
- if(data->rpos()+1 > data->size())
+ if(data->rpos() + 1 > data->size())
return false;
*data >> m_strTarget;
@@ -395,7 +395,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
if(m_attackType == RANGED_ATTACK)
{
// wand case
- if((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId()==TYPEID_PLAYER)
+ if((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
{
if(Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK))
m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetProto()->Damage[0].DamageType);
@@ -409,11 +409,11 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
else
m_originalCasterGUID = m_caster->GetGUID();
- if(m_originalCasterGUID==m_caster->GetGUID())
+ if(m_originalCasterGUID == m_caster->GetGUID())
m_originalCaster = m_caster;
else
{
- m_originalCaster = ObjectAccessor::GetUnit(*m_caster,m_originalCasterGUID);
+ m_originalCaster = ObjectAccessor::GetUnit(*m_caster, m_originalCasterGUID);
if(m_originalCaster && !m_originalCaster->IsInWorld()) m_originalCaster = NULL;
}
@@ -453,12 +453,12 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED))
{
- for(int j=0;j<3;j++)
+ for(int j = 0;j < 3; ++j)
{
- if (m_spellInfo->Effect[j]==0)
+ if (m_spellInfo->Effect[j] == 0)
continue;
- if(!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j],m_spellInfo->EffectImplicitTargetB[j]))
+ if(!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j], m_spellInfo->EffectImplicitTargetB[j]))
m_canReflect = true;
else
m_canReflect = (m_spellInfo->AttributesEx & SPELL_ATTR_EX_NEGATIVE) ? true : false;
@@ -586,8 +586,8 @@ void Spell::FillTargetMap()
else
{
// clear cooldown at fail
- if(m_caster->GetTypeId()==TYPEID_PLAYER)
- ((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
+ if(m_caster->GetTypeId() == TYPEID_PLAYER)
+ ((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id, true);
SendCastResult(SPELL_FAILED_NO_EDIBLE_CORPSES);
finish(false);
}
@@ -631,7 +631,7 @@ void Spell::FillTargetMap()
AddUnitTarget(m_targets.getUnitTarget(), i);
if(m_targets.getCorpseTargetGUID())
{
- Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID());
+ Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID());
if(corpse)
{
Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGUID());
@@ -813,7 +813,7 @@ void Spell::CleanupTargetList()
void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
{
- if( m_spellInfo->Effect[effIndex]==0 )
+ if( m_spellInfo->Effect[effIndex] == 0 )
return;
if(!CheckTarget(pVictim, effIndex))
@@ -825,12 +825,12 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
uint64 targetGUID = pVictim->GetGUID();
// Lookup target in already in list
- for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
+ for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if (targetGUID == ihit->targetGUID) // Found in list
{
if (!immuned)
- ihit->effectMask |= 1<<effIndex; // Add only effect mask if not immuned
+ ihit->effectMask |= 1 << effIndex; // Add only effect mask if not immuned
return;
}
}
@@ -840,7 +840,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
// Get spell hit result on target
TargetInfo target;
target.targetGUID = targetGUID; // Store target GUID
- target.effectMask = immuned ? 0 : 1<<effIndex; // Store index of effect if not immuned
+ target.effectMask = immuned ? 0 : 1 << effIndex; // Store index of effect if not immuned
target.processed = false; // Effects not apply on target
target.alive = pVictim->isAlive();
target.damage = 0;
@@ -866,14 +866,14 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
target.timeDelay = (uint64) floor(dist / m_spellInfo->speed * 1000.0f);
// Calculate minimum incoming time
- if (m_delayMoment==0 || m_delayMoment>target.timeDelay)
+ if (m_delayMoment == 0 || m_delayMoment>target.timeDelay)
m_delayMoment = target.timeDelay;
}
else
target.timeDelay = 0LL;
// If target reflect spell back to caster
- if (target.missCondition==SPELL_MISS_REFLECT)
+ if (target.missCondition == SPELL_MISS_REFLECT)
{
// Calculate reflected spell result on caster
target.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect);
@@ -882,7 +882,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
target.reflectResult = SPELL_MISS_PARRY;
// Increase time interval for reflected spells by 1.5
- target.timeDelay+=target.timeDelay>>1;
+ target.timeDelay += target.timeDelay >> 1;
}
else
target.reflectResult = SPELL_MISS_NONE;
@@ -893,24 +893,24 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
void Spell::AddUnitTarget(uint64 unitGUID, uint32 effIndex)
{
- Unit* unit = m_caster->GetGUID()==unitGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, unitGUID);
+ Unit* unit = m_caster->GetGUID() == unitGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, unitGUID);
if (unit)
AddUnitTarget(unit, effIndex);
}
void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex)
{
- if( m_spellInfo->Effect[effIndex]==0 )
+ if( m_spellInfo->Effect[effIndex] == 0 )
return;
uint64 targetGUID = pVictim->GetGUID();
// Lookup target in already in list
- for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit)
+ for(std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
{
if (targetGUID == ihit->targetGUID) // Found in list
{
- ihit->effectMask |= 1<<effIndex; // Add only effect mask
+ ihit->effectMask |= 1 << effIndex; // Add only effect mask
return;
}
}
@@ -919,7 +919,7 @@ void Spell::AddGOTarget(GameObject* pVictim, uint32 effIndex)
GOTargetInfo target;
target.targetGUID = targetGUID;
- target.effectMask = 1<<effIndex;
+ target.effectMask = 1 << effIndex;
target.processed = false; // Effects not apply on target
// Spell have speed - need calculate incoming time
@@ -948,11 +948,11 @@ void Spell::AddGOTarget(uint64 goGUID, uint32 effIndex)
void Spell::AddItemTarget(Item* pitem, uint32 effIndex)
{
- if( m_spellInfo->Effect[effIndex]==0 )
+ if( m_spellInfo->Effect[effIndex] == 0 )
return;
// Lookup target in already in list
- for(std::list<ItemTargetInfo>::iterator ihit= m_UniqueItemInfo.begin();ihit != m_UniqueItemInfo.end();++ihit)
+ for(std::list<ItemTargetInfo>::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
{
if (pitem == ihit->item) // Found in list
{
@@ -965,7 +965,7 @@ void Spell::AddItemTarget(Item* pitem, uint32 effIndex)
ItemTargetInfo target;
target.item = pitem;
- target.effectMask = 1<<effIndex;
+ target.effectMask = 1 << effIndex;
m_UniqueItemInfo.push_back(target);
}
@@ -1178,7 +1178,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
if( !m_caster->IsFriendlyTo(unit) )
{
// for delayed spells ignore not visible explicit target
- if(m_spellInfo->speed > 0.0f && unit==m_targets.getUnitTarget() && !unit->isVisibleForOrDetect(m_caster,false))
+ if(m_spellInfo->speed > 0.0f && unit == m_targets.getUnitTarget() && !unit->isVisibleForOrDetect(m_caster,false))
{
return SPELL_MISS_EVADE;
}
@@ -1376,9 +1376,9 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target)
if(!go)
return;
- for(uint32 effectNumber=0;effectNumber<3;effectNumber++)
- if (effectMask & (1<<effectNumber))
- HandleEffects(NULL,NULL,go,effectNumber);
+ for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber)
+ if (effectMask & (1 << effectNumber))
+ HandleEffects(NULL, NULL, go, effectNumber);
// cast at creature (or GO) quest objectives update at successful cast finished (+channel finished)
// ignore autorepeat/melee casts for speed (not exist quest for spells (hm... )
@@ -1395,8 +1395,8 @@ void Spell::DoAllEffectOnTarget(ItemTargetInfo *target)
if(!target->item || !effectMask)
return;
- for(uint32 effectNumber=0;effectNumber<3;effectNumber++)
- if (effectMask & (1<<effectNumber))
+ for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber)
+ if (effectMask & (1 << effectNumber))
HandleEffects(NULL, target->item, NULL, effectNumber);
}
@@ -1414,11 +1414,11 @@ bool Spell::UpdateChanneledTargetList()
needAuraMask &= needAliveTargetMask;
- for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
+ for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) )
{
- Unit *unit = m_caster->GetGUID()==ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
+ Unit *unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if (unit && unit->isAlive())
{
@@ -1446,7 +1446,7 @@ bool Spell::UpdateChanneledTargetList()
}
// is all effects from m_needAliveTargetMask have alive targets
- return needAliveTargetMask==0;
+ return needAliveTargetMask == 0;
}
// Helper for Chain Healing
@@ -2769,15 +2769,15 @@ void Spell::_handle_immediate_phase()
HandleThreatSpells(m_spellInfo->Id);
m_needSpellLog = IsNeedSendToClient();
- for(uint32 j = 0;j<3;j++)
+ for(uint32 j = 0; j < 3; ++j)
{
- if(m_spellInfo->Effect[j]==0)
+ if(m_spellInfo->Effect[j] == 0)
continue;
// apply Send Event effect to ground in case empty target lists
if( m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j) )
{
- HandleEffects(NULL,NULL,NULL, j);
+ HandleEffects(NULL, NULL, NULL, j);
continue;
}
@@ -2927,20 +2927,20 @@ void Spell::update(uint32 difftime)
{
if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() )
{
- for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
+ for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
TargetInfo* target = &*ihit;
if(!IS_CREATURE_GUID(target->targetGUID))
continue;
- Unit* unit = m_caster->GetGUID()==target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster,target->targetGUID);
- if (unit==NULL)
+ Unit* unit = m_caster->GetGUID() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID);
+ if (unit == NULL)
continue;
- p->CastedCreatureOrGO(unit->GetEntry(),unit->GetGUID(),m_spellInfo->Id);
+ p->CastedCreatureOrGO(unit->GetEntry(), unit->GetGUID(), m_spellInfo->Id);
}
- for(std::list<GOTargetInfo>::iterator ihit= m_UniqueGOTargetInfo.begin();ihit != m_UniqueGOTargetInfo.end();++ihit)
+ for(std::list<GOTargetInfo>::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
{
GOTargetInfo* target = &*ihit;
@@ -2948,7 +2948,7 @@ void Spell::update(uint32 difftime)
if(!go)
continue;
- p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id);
+ p->CastedCreatureOrGO(go->GetEntry(), go->GetGUID(), m_spellInfo->Id);
}
}
}
@@ -3301,33 +3301,35 @@ void Spell::WriteSpellGoTargets( WorldPacket * data )
// m_needAliveTargetMask req for stop channelig if one target die
uint32 hit = m_UniqueGOTargetInfo.size(); // Always hits on GO
uint32 miss = 0;
- for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
+ for(std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if ((*ihit).effectMask == 0) // No effect apply - all immuned add state
{
// possibly SPELL_MISS_IMMUNE2 for this??
ihit->missCondition = SPELL_MISS_IMMUNE2;
- miss++;
+ ++miss;
}
else if ((*ihit).missCondition == SPELL_MISS_NONE)
- hit++;
+ ++hit;
else
- miss++;
+ ++miss;
}
*data << (uint8)hit;
- for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
+ for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+ {
if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits
{
*data << uint64(ihit->targetGUID);
m_needAliveTargetMask |=ihit->effectMask;
}
+ }
- for(std::list<GOTargetInfo>::iterator ighit= m_UniqueGOTargetInfo.begin();ighit != m_UniqueGOTargetInfo.end();++ighit)
+ for(std::list<GOTargetInfo>::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit)
*data << uint64(ighit->targetGUID); // Always hits
*data << (uint8)miss;
- for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
+ for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss
{
@@ -3472,8 +3474,8 @@ void Spell::SendChannelUpdate(uint32 time)
{
if(time == 0)
{
- m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT,0);
- m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL,0);
+ m_caster->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0);
+ m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
}
if (m_caster->GetTypeId() != TYPEID_PLAYER)
@@ -3493,9 +3495,9 @@ void Spell::SendChannelStart(uint32 duration)
// select first not resisted target from target list for _0_ effect
if(!m_UniqueTargetInfo.empty())
{
- for(std::list<TargetInfo>::iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr)
+ for(std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr)
{
- if( (itr->effectMask & (1<<0)) && itr->reflectResult==SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID())
+ if( (itr->effectMask & (1 << 0)) && itr->reflectResult == SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID())
{
target = ObjectAccessor::GetUnit(*m_caster, itr->targetGUID);
break;
@@ -3504,9 +3506,9 @@ void Spell::SendChannelStart(uint32 duration)
}
else if(!m_UniqueGOTargetInfo.empty())
{
- for(std::list<GOTargetInfo>::iterator itr= m_UniqueGOTargetInfo.begin();itr != m_UniqueGOTargetInfo.end();++itr)
+ for(std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr)
{
- if(itr->effectMask & (1<<0) )
+ if(itr->effectMask & (1 << 0) )
{
target = m_caster->GetMap()->GetGameObject(itr->targetGUID);
break;
@@ -3535,16 +3537,16 @@ void Spell::SendResurrectRequest(Player* target)
// Both players and NPCs can resurrect using spells - have a look at creature 28487 for example
// However, the packet structure differs slightly
- const char* sentName = m_caster->GetTypeId()==TYPEID_PLAYER ?"":m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex());
+ const char* sentName = m_caster->GetTypeId() == TYPEID_PLAYER ? "" : m_caster->GetNameForLocaleIdx(target->GetSession()->GetSessionDbLocaleIndex());
WorldPacket data(SMSG_RESURRECT_REQUEST, (8+4+strlen(sentName)+1+1+1));
data << uint64(m_caster->GetGUID());
- data << uint32(strlen(sentName)+1);
+ data << uint32(strlen(sentName) + 1);
data << sentName;
data << uint8(0);
- data << uint8(m_caster->GetTypeId()==TYPEID_PLAYER ?0:1);
+ data << uint8(m_caster->GetTypeId() == TYPEID_PLAYER ? 0 : 1);
target->GetSession()->SendPacket(&data);
}
@@ -3553,7 +3555,7 @@ void Spell::SendPlaySpellVisual(uint32 SpellID)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
- WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 12);
+ WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4);
data << uint64(m_caster->GetGUID());
data << uint32(SpellID); // spell visual id?
((Player*)m_caster)->GetSession()->SendPacket(&data);
@@ -3826,7 +3828,7 @@ void Spell::TakeReagents()
if (p_caster->CanNoReagentCast(m_spellInfo))
return;
- for(uint32 x=0;x<8;x++)
+ for(uint32 x = 0; x < 8; ++x)
{
if(m_spellInfo->Reagent[x] <= 0)
continue;
@@ -3840,7 +3842,7 @@ void Spell::TakeReagents()
ItemPrototype const *proto = m_CastItem->GetProto();
if( proto && proto->ItemId == itemid )
{
- for(int s=0;s < MAX_ITEM_PROTO_SPELLS; ++s)
+ for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
{
// CastItem will be used up and does not count as reagent
int32 charges = m_CastItem->GetSpellCharges(s);
@@ -3856,7 +3858,7 @@ void Spell::TakeReagents()
}
// if getItemTarget is also spell reagent
- if (m_targets.getItemTargetEntry()==itemid)
+ if (m_targets.getItemTargetEntry() == itemid)
m_targets.setItemTarget(NULL);
p_caster->DestroyItemCount(itemid, itemcount, true);
@@ -4034,7 +4036,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if(target->getLevel() + 10 < m_spellInfo->spellLevel)
return SPELL_FAILED_LOWLEVEL;
}
- else if (m_caster->GetTypeId()==TYPEID_PLAYER) // Target - is player caster
+ else if (m_caster->GetTypeId() == TYPEID_PLAYER) // Target - is player caster
{
// Additional check for some spells
// If 0 spell effect empty - client not send target data (need use selection)
@@ -4050,7 +4052,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
// check pet presents
- for(int j=0;j<3;j++)
+ for(int j = 0; j < 3; ++j)
{
if(m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_PET)
{
@@ -4072,7 +4074,7 @@ SpellCastResult Spell::CheckCast(bool strict)
{
if(!CheckTargetCreatureType(target))
{
- if(target->GetTypeId()==TYPEID_PLAYER)
+ if(target->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_TARGET_IS_PLAYER;
else
return SPELL_FAILED_BAD_TARGETS;
@@ -4081,7 +4083,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
- if(m_caster != target && m_caster->GetTypeId()==TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
+ if(m_caster != target && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
{
// check correctness positive/negative cast target (pet cast real check and cheating check)
if(IsPositiveSpell(m_spellInfo->Id))
@@ -4125,7 +4127,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
// Spell casted only on battleground
- if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_BATTLEGROUND) && m_caster->GetTypeId()==TYPEID_PLAYER)
+ if((m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_BATTLEGROUND) && m_caster->GetTypeId() == TYPEID_PLAYER)
if(!((Player*)m_caster)->InBattleGround())
return SPELL_FAILED_ONLY_BATTLEGROUNDS;
@@ -4171,7 +4173,7 @@ SpellCastResult Spell::CheckCast(bool strict)
/*//ImpliciteTargetA-B = 38, If fact there is 0 Spell with ImpliciteTargetB=38
if(m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example)
{
- for(uint8 j = 0; j < 3; j++)
+ for(uint8 j = 0; j < 3; ++j)
{
if( m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_NEARBY_ENTRY ||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetA[j] != TARGET_UNIT_CASTER ||
@@ -4218,7 +4220,7 @@ SpellCastResult Spell::CheckCast(bool strict)
range = go_check.GetLastRange();
}
}
- else if( focusObject ) //Focus Object
+ else if( focusObject ) // Focus Object
{
float frange = m_caster->GetDistance(focusObject);
if(range >= frange)
@@ -4330,7 +4332,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if(m_caster->IsInWater())
return SPELL_FAILED_ONLY_ABOVEWATER;
}
- else if(m_spellInfo->SpellIconID==156) // Holy Shock
+ else if(m_spellInfo->SpellIconID == 156) // Holy Shock
{
// spell different for friends and enemies
// hart version required facing
@@ -4418,7 +4420,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// Can be area effect, Check only for players and not check if target - caster (spell can have multiply drain/burn effects)
if(m_caster->GetTypeId() == TYPEID_PLAYER)
if(Unit* target = m_targets.getUnitTarget())
- if(target!=m_caster && target->getPowerType()!=m_spellInfo->EffectMiscValue[i])
+ if(target != m_caster && target->getPowerType() != m_spellInfo->EffectMiscValue[i])
return SPELL_FAILED_BAD_TARGETS;
break;
}
@@ -4447,14 +4449,14 @@ SpellCastResult Spell::CheckCast(bool strict)
int32 skillValue = ((Player*)m_caster)->GetSkillValue(skill);
int32 TargetLevel = m_targets.getUnitTarget()->getLevel();
- int32 ReqValue = (skillValue < 100 ? (TargetLevel-10)*10 : TargetLevel*5);
+ int32 ReqValue = (skillValue < 100 ? (TargetLevel-10) * 10 : TargetLevel * 5);
if (ReqValue > skillValue)
return SPELL_FAILED_LOW_CASTLEVEL;
// chance for fail at orange skinning attempt
if( (m_selfContainer && (*m_selfContainer) == this) &&
skillValue < sWorld.GetConfigMaxSkillValue() &&
- (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue-25, skillValue+37) )
+ (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37) )
return SPELL_FAILED_TRY_AGAIN;
break;
@@ -4481,17 +4483,17 @@ SpellCastResult Spell::CheckCast(bool strict)
// get the lock entry
uint32 lockId = 0;
- if (GameObject* go=m_targets.getGOTarget())
+ if (GameObject* go = m_targets.getGOTarget())
lockId = go->GetLockId();
- else if(Item* itm=m_targets.getItemTarget())
+ else if(Item* itm = m_targets.getItemTarget())
lockId = itm->GetProto()->LockID;
- SkillType skillId =SKILL_NONE;
+ SkillType skillId = SKILL_NONE;
int32 reqSkillValue = 0;
int32 skillValue = 0;
// check lock compatibility
- SpellCastResult res = CanOpenLock(i,lockId,skillId,reqSkillValue,skillValue);
+ SpellCastResult res = CanOpenLock(i, lockId, skillId, reqSkillValue, skillValue);
if(res != SPELL_CAST_OK)
return res;
@@ -4502,7 +4504,7 @@ SpellCastResult Spell::CheckCast(bool strict)
bool canFailAtMax = skillId != SKILL_HERBALISM && skillId != SKILL_MINING;
// chance for failure in orange gather / lockpick (gathering skill can't fail at maxskill)
- if((canFailAtMax || skillValue < sWorld.GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue-25, skillValue+37))
+ if((canFailAtMax || skillValue < sWorld.GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue - 25, skillValue + 37))
return SPELL_FAILED_TRY_AGAIN;
}
break;
@@ -4568,13 +4570,13 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_EFFECT_SUMMON_PLAYER:
{
- if(m_caster->GetTypeId()!=TYPEID_PLAYER)
+ if(m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
if(!((Player*)m_caster)->GetSelection())
return SPELL_FAILED_BAD_TARGETS;
Player* target = objmgr.GetPlayer(((Player*)m_caster)->GetSelection());
- if( !target || ((Player*)m_caster)==target || !target->IsInSameRaidWith((Player*)m_caster) )
+ if( !target || ((Player*)m_caster) == target || !target->IsInSameRaidWith((Player*)m_caster) )
return SPELL_FAILED_BAD_TARGETS;
// check if our map is dungeon
@@ -4600,7 +4602,7 @@ SpellCastResult Spell::CheckCast(bool strict)
}
case SPELL_EFFECT_STEAL_BENEFICIAL_BUFF:
{
- if (m_targets.getUnitTarget()==m_caster)
+ if (m_targets.getUnitTarget() == m_caster)
return SPELL_FAILED_BAD_TARGETS;
break;
}
@@ -4618,7 +4620,7 @@ SpellCastResult Spell::CheckCast(bool strict)
switch(m_spellInfo->Id)
{
case 61336:
- if(m_caster->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_caster)->IsInFeralForm())
+ if(m_caster->GetTypeId() != TYPEID_PLAYER || !((Player*)m_caster)->IsInFeralForm())
return SPELL_FAILED_ONLY_SHAPESHIFT;
break;
case 1515:
@@ -4674,11 +4676,11 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->IsInWater())
return SPELL_FAILED_ONLY_ABOVEWATER;
- if (m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->GetTransport())
+ if (m_caster->GetTypeId() == TYPEID_PLAYER && ((Player*)m_caster)->GetTransport())
return SPELL_FAILED_NO_MOUNTS_ALLOWED;
// Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells
- if (m_caster->GetTypeId()==TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->AreaGroupId)
+ if (m_caster->GetTypeId() == TYPEID_PLAYER && !sMapStore.LookupEntry(m_caster->GetMapId())->IsMountAllowed() && !m_IsTriggeredSpell && !m_spellInfo->AreaGroupId)
return SPELL_FAILED_NO_MOUNTS_ALLOWED;
ShapeshiftForm form = m_caster->m_form;
@@ -4717,10 +4719,10 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!m_targets.getUnitTarget())
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
- if (m_caster->GetTypeId()!=TYPEID_PLAYER || m_CastItem)
+ if (m_caster->GetTypeId() != TYPEID_PLAYER || m_CastItem)
break;
- if(m_targets.getUnitTarget()->getPowerType()!=POWER_MANA)
+ if(m_targets.getUnitTarget()->getPowerType() != POWER_MANA)
return SPELL_FAILED_BAD_TARGETS;
break;
@@ -4786,18 +4788,18 @@ SpellCastResult Spell::CheckCasterAuras() const
// Flag drop spells totally immuned to caster auras
// FIXME: find more nice check for all totally immuned spells
// AttributesEx3 & 0x10000000?
- if(m_spellInfo->Id==23336 || m_spellInfo->Id==23334 || m_spellInfo->Id==34991)
+ if(m_spellInfo->Id == 23336 || m_spellInfo->Id == 23334 || m_spellInfo->Id == 34991)
return SPELL_CAST_OK;
uint8 school_immune = 0;
uint32 mechanic_immune = 0;
uint32 dispel_immune = 0;
- //Check if the spell grants school or mechanic immunity.
- //We use bitmasks so the loop is done only once and not on every aura check below.
+ // Check if the spell grants school or mechanic immunity.
+ // We use bitmasks so the loop is done only once and not on every aura check below.
if ( m_spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY )
{
- for(int i = 0;i < 3; i ++)
+ for(int i = 0; i < 3; ++i)
{
if(m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_IMMUNITY)
school_immune |= uint32(m_spellInfo->EffectMiscValue[i]);
@@ -4811,7 +4813,7 @@ SpellCastResult Spell::CheckCasterAuras() const
mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
}
- //Check whether the cast should be prevented by any state you might have.
+ // Check whether the cast should be prevented by any state you might have.
SpellCastResult prevented_reason = SPELL_CAST_OK;
// Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out
uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state
@@ -4821,9 +4823,9 @@ SpellCastResult Spell::CheckCasterAuras() const
prevented_reason = SPELL_FAILED_CONFUSED;
else if(unitflag & UNIT_FLAG_FLEEING && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED))
prevented_reason = SPELL_FAILED_FLEEING;
- else if(unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE)
+ else if(unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE)
prevented_reason = SPELL_FAILED_SILENCED;
- else if(unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY)
+ else if(unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY)
prevented_reason = SPELL_FAILED_PACIFIED;
// Attr must make flag drop spell totally immune from all effects
@@ -4878,7 +4880,7 @@ SpellCastResult Spell::CheckCasterAuras() const
}
}
}
- //You are prevented from casting and the spell casted does not grant immunity. Return a failed error.
+ // You are prevented from casting and the spell casted does not grant immunity. Return a failed error.
else
return prevented_reason;
}
@@ -4889,7 +4891,7 @@ bool Spell::CanAutoCast(Unit* target)
{
uint64 targetguid = target->GetGUID();
- for(uint32 j = 0;j<3;j++)
+ for(uint32 j = 0; j < 3; ++j)
{
if(m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA)
{
@@ -4975,9 +4977,9 @@ SpellCastResult Spell::CheckRange(bool strict)
if(m_targets.m_targetMask == TARGET_FLAG_DEST_LOCATION && m_targets.m_destX != 0 && m_targets.m_destY != 0 && m_targets.m_destZ != 0)
{
- if(!m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,max_range))
+ if(!m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, max_range))
return SPELL_FAILED_OUT_OF_RANGE;
- if(m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ,min_range))
+ if(m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, min_range))
return SPELL_FAILED_TOO_CLOSE;
}
@@ -5099,16 +5101,16 @@ SpellCastResult Spell::CheckItems()
else
{
uint32 itemid = m_CastItem->GetEntry();
- if( !p_caster->HasItemCount(itemid,1) )
+ if( !p_caster->HasItemCount(itemid, 1) )
return SPELL_FAILED_ITEM_NOT_READY;
ItemPrototype const *proto = m_CastItem->GetProto();
if(!proto)
return SPELL_FAILED_ITEM_NOT_READY;
- for (int i = 0; i<5; i++)
+ for (int i = 0; i < 5; ++i)
if (proto->Spells[i].SpellCharges)
- if(m_CastItem->GetSpellCharges(i)==0)
+ if(m_CastItem->GetSpellCharges(i) == 0)
return SPELL_FAILED_NO_CHARGES_REMAIN;
// consumable cast item checks
@@ -5191,7 +5193,7 @@ SpellCastResult Spell::CheckItems()
GameObject* ok = NULL;
MaNGOS::GameObjectFocusCheck go_check(m_caster,m_spellInfo->RequiresSpellFocus);
- MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck> checker(m_caster,ok,go_check);
+ MaNGOS::GameObjectSearcher<MaNGOS::GameObjectFocusCheck> checker(m_caster, ok, go_check);
TypeContainerVisitor<Trinity::GameObjectSearcher<Trinity::GameObjectFocusCheck>, GridTypeMapContainer > object_checker(checker);
CellLock<GridReadGuard> cell_lock(cell, p);
@@ -5241,7 +5243,7 @@ SpellCastResult Spell::CheckItems()
// check totem-item requirements (items presence in inventory)
uint32 totems = 2;
- for(int i=0;i<2;++i)
+ for(int i = 0; i < 2 ; ++i)
{
if(m_spellInfo->Totem[i] != 0)
{
@@ -5258,7 +5260,7 @@ SpellCastResult Spell::CheckItems()
// Check items for TotemCategory (items presence in inventory)
uint32 TotemCategory = 2;
- for(int i=0;i<2;++i)
+ for(int i= 0; i < 2; ++i)
{
if(m_spellInfo->TotemCategory[i] != 0)
{
@@ -5470,11 +5472,11 @@ SpellCastResult Spell::CheckItems()
{
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
- if(ammoProto->SubClass!=ITEM_SUBCLASS_ARROW)
+ if(ammoProto->SubClass != ITEM_SUBCLASS_ARROW)
return SPELL_FAILED_NO_AMMO;
break;
case ITEM_SUBCLASS_WEAPON_GUN:
- if(ammoProto->SubClass!=ITEM_SUBCLASS_BULLET)
+ if(ammoProto->SubClass != ITEM_SUBCLASS_BULLET)
return SPELL_FAILED_NO_AMMO;
break;
default:
@@ -5485,6 +5487,7 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_NO_AMMO;
}; break;
case ITEM_SUBCLASS_WEAPON_WAND:
+ break;
default:
break;
}
@@ -5547,7 +5550,7 @@ void Spell::Delayed() // only called in DealDamage()
//check pushback reduce
int32 delaytime = 500; // spellcasting delay is normally 500ms
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
- ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
+ ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if(delayReduce >= 100)
return;
@@ -5562,13 +5565,13 @@ void Spell::Delayed() // only called in DealDamage()
else
m_timer += delaytime;
- sLog.outDetail("Spell %u partially interrupted for (%d) ms at damage",m_spellInfo->Id,delaytime);
+ sLog.outDetail("Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime);
WorldPacket data(SMSG_SPELL_DELAYED, 8+4);
data.append(m_caster->GetPackGUID());
data << uint32(delaytime);
- m_caster->SendMessageToSet(&data,true);
+ m_caster->SendMessageToSet(&data, true);
}
void Spell::DelayedChannel()
@@ -5582,7 +5585,7 @@ void Spell::DelayedChannel()
//check pushback reduce
int32 delaytime = GetSpellDuration(m_spellInfo) * 25 / 100; // channeling delay is normally 25% of its time per hit
int32 delayReduce = 100; // must be initialized to 100 for percent modifiers
- ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id,SPELLMOD_NOT_LOSE_CASTING_TIME,delayReduce, this);
+ ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this);
delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100;
if(delayReduce >= 100)
return;
@@ -5599,11 +5602,11 @@ void Spell::DelayedChannel()
sLog.outDebug("Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer);
- for(std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit)
+ for(std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
if ((*ihit).missCondition == SPELL_MISS_NONE)
{
- Unit* unit = m_caster->GetGUID()==ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
+ Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if (unit)
{
unit->DelayAura(m_spellInfo->Id, m_caster->GetGUID(), delaytime);
@@ -5611,7 +5614,7 @@ void Spell::DelayedChannel()
}
}
- for(int j = 0; j < 3; j++)
+ for(int j = 0; j < 3; ++j)
{
// partially interrupt persistent area auras
DynamicObject* dynObj = m_caster->GetDynObject(m_spellInfo->Id, j);
@@ -5680,7 +5683,7 @@ CurrentSpellTypes Spell::GetCurrentContainer()
bool Spell::CheckTarget(Unit* target, uint32 eff)
{
// Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets)
- if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_UNIT_CASTER)
+ if(m_spellInfo->EffectImplicitTargetA[eff] != TARGET_UNIT_CASTER)
{
if (!CheckTargetCreatureType(target))
return false;
@@ -5709,9 +5712,9 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
}
//Check player targets and remove if in GM mode or GM invisibility (for not self casting case)
- if( target != m_caster && target->GetTypeId()==TYPEID_PLAYER)
+ if( target != m_caster && target->GetTypeId() == TYPEID_PLAYER)
{
- if(((Player*)target)->GetVisibility()==VISIBILITY_OFF)
+ if(((Player*)target)->GetVisibility() == VISIBILITY_OFF)
return false;
if(((Player*)target)->isGameMaster() && !IsPositiveSpell(m_spellInfo->Id))
@@ -5728,21 +5731,21 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
case SPELL_EFFECT_SUMMON_PLAYER: // from anywhere
break;
case SPELL_EFFECT_DUMMY:
- if(m_spellInfo->Id!=20577) // Cannibalize
+ if(m_spellInfo->Id != 20577) // Cannibalize
break;
//fall through
case SPELL_EFFECT_RESURRECT_NEW:
// player far away, maybe his corpse near?
- if(target!=m_caster && !target->IsWithinLOSInMap(m_caster))
+ if(target != m_caster && !target->IsWithinLOSInMap(m_caster))
{
if(!m_targets.getCorpseTargetGUID())
return false;
- Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster,m_targets.getCorpseTargetGUID());
+ Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.getCorpseTargetGUID());
if(!corpse)
return false;
- if(target->GetGUID()!=corpse->GetOwnerGUID())
+ if(target->GetGUID() != corpse->GetOwnerGUID())
return false;
if(!corpse->IsWithinLOSInMap(m_caster))
@@ -5758,7 +5761,7 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID);
if (!caster)
caster = m_caster;
- if(target!=m_caster && !target->IsWithinLOSInMap(caster))
+ if(target != m_caster && !target->IsWithinLOSInMap(caster))
return false;
break;
}
@@ -5774,16 +5777,16 @@ bool Spell::IsNeedSendToClient() const
bool Spell::HaveTargetsForEffect( uint8 effect ) const
{
- for(std::list<TargetInfo>::const_iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr)
- if(itr->effectMask & (1<<effect))
+ for(std::list<TargetInfo>::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr)
+ if(itr->effectMask & (1 << effect))
return true;
- for(std::list<GOTargetInfo>::const_iterator itr= m_UniqueGOTargetInfo.begin();itr != m_UniqueGOTargetInfo.end();++itr)
- if(itr->effectMask & (1<<effect))
+ for(std::list<GOTargetInfo>::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr)
+ if(itr->effectMask & (1 << effect))
return true;
- for(std::list<ItemTargetInfo>::const_iterator itr= m_UniqueItemInfo.begin();itr != m_UniqueItemInfo.end();++itr)
- if(itr->effectMask & (1<<effect))
+ for(std::list<ItemTargetInfo>::const_iterator itr = m_UniqueItemInfo.begin(); itr != m_UniqueItemInfo.end(); ++itr)
+ if(itr->effectMask & (1 << effect))
return true;
return false;
@@ -5806,7 +5809,7 @@ SpellEvent::~SpellEvent()
else
{
sLog.outError("~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.",
- (m_Spell->GetCaster()->GetTypeId()==TYPEID_PLAYER?"Player":"Creature"), m_Spell->GetCaster()->GetGUIDLow(),m_Spell->m_spellInfo->Id);
+ (m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id);
}
}
@@ -5825,8 +5828,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
if (m_Spell->IsDeletable())
{
// check, if we do have unfinished triggered spells
-
- return(true); // spell is deletable, finish event
+ return true; // spell is deletable, finish event
}
// event will be re-added automatically at the end of routine)
} break;
@@ -5863,7 +5865,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
{
// re-add us to the queue
m_Spell->GetCaster()->m_Events.AddEvent(this, m_Spell->GetDelayStart() + n_offset, false);
- return(false); // event not complete
+ return false; // event not complete
}
// event complete
// finish update event will be re-added automatically at the end of routine)
@@ -5875,7 +5877,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
m_Spell->SetDelayStart(e_time);
// re-plan the event for the delay moment
m_Spell->GetCaster()->m_Events.AddEvent(this, e_time + m_Spell->GetDelayMoment(), false);
- return(false); // event not complete
+ return false; // event not complete
}
} break;
@@ -5888,7 +5890,7 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
// spell processing not complete, plan event on the next update interval
m_Spell->GetCaster()->m_Events.AddEvent(this, e_time + 1, false);
- return(false); // event not complete
+ return false; // event not complete
}
void SpellEvent::Abort(uint64 /*e_time*/)