diff options
author | Spp <none@none> | 2010-04-07 22:59:46 +0200 |
---|---|---|
committer | Spp <none@none> | 2010-04-07 22:59:46 +0200 |
commit | 49d05ba9aa1cd5c1f3ae96546283e6d03a037ff7 (patch) | |
tree | f7e6135573366a686c1f527e16a0a7d42a7877ff /src/game/Spell.cpp | |
parent | d19e12708001fbef2308be0e8cb5375a2ac7af48 (diff) |
Code style (game + scripts only):
"( " --> "("
" )" --> ")"
--HG--
branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r-- | src/game/Spell.cpp | 312 |
1 files changed, 156 insertions, 156 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 01fc86ff186..859c872d24f 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -82,7 +82,7 @@ class PrioritizeManaUnitWraper struct PrioritizeMana { - int operator()( PrioritizeManaUnitWraper const& x, PrioritizeManaUnitWraper const& y ) const + int operator()(PrioritizeManaUnitWraper const& x, PrioritizeManaUnitWraper const& y) const { return x.getPercent() > y.getPercent(); } @@ -106,7 +106,7 @@ private: struct PrioritizeHealth { - int operator()( PrioritizeHealthUnitWraper const& x, PrioritizeHealthUnitWraper const& y ) const + int operator()(PrioritizeHealthUnitWraper const& x, PrioritizeHealthUnitWraper const& y) const { return x.getPercent() > y.getPercent(); } @@ -206,7 +206,7 @@ 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; @@ -224,7 +224,7 @@ void SpellCastTargets::Update(Unit* caster) } } -bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) +bool SpellCastTargets::read (WorldPacket * data, Unit *caster) { if (data->rpos() + 4 > data->size()) return false; @@ -238,7 +238,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) return true; // TARGET_FLAG_UNK2 is used for non-combat pets, maybe other? - if ( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_UNK2 )) + if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNK2)) { if (!data->readPackGUID(m_unitTargetGUID)) return false; @@ -246,22 +246,22 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) m_intTargetFlags |= FLAG_INT_UNIT; } - if ( m_targetMask & ( TARGET_FLAG_OBJECT )) + if (m_targetMask & (TARGET_FLAG_OBJECT)) { if (!data->readPackGUID(m_GOTargetGUID)) return false; m_intTargetFlags |= FLAG_INT_OBJECT; } - if (( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM )) && caster->GetTypeId() == TYPEID_PLAYER) + if ((m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM)) && caster->GetTypeId() == TYPEID_PLAYER) if (!data->readPackGUID(m_itemTargetGUID)) return false; - if ( m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) ) + if (m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE)) if (!data->readPackGUID(m_CorpseTargetGUID)) return false; - if ( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) + if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { if (data->rpos() + 1 + 4 + 4 + 4 > data->size()) return false; @@ -277,7 +277,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) else m_srcPos.Relocate(caster); - if ( m_targetMask & TARGET_FLAG_DEST_LOCATION ) + if (m_targetMask & TARGET_FLAG_DEST_LOCATION) { if (data->rpos() + 1 + 4 + 4 + 4 > data->size()) return false; @@ -291,7 +291,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) m_intTargetFlags |= FLAG_INT_DST_LOC; - if ( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) + if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { if (data->rpos() + 4 + 4 <= data->size()) { @@ -306,7 +306,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) else m_dstPos.Relocate(caster); - if ( m_targetMask & TARGET_FLAG_STRING ) + if (m_targetMask & TARGET_FLAG_STRING) { if (data->rpos() + 1 > data->size()) return false; @@ -319,12 +319,12 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster ) return true; } -void SpellCastTargets::write ( WorldPacket * data ) +void SpellCastTargets::write (WorldPacket * data) { *data << uint32(m_targetMask); //sLog.outDebug("Spell write, target mask = %u", m_targetMask); - if ( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_PVP_CORPSE | TARGET_FLAG_OBJECT | TARGET_FLAG_CORPSE | TARGET_FLAG_UNK2 ) ) + if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_PVP_CORPSE | TARGET_FLAG_OBJECT | TARGET_FLAG_CORPSE | TARGET_FLAG_UNK2)) { if (m_targetMask & TARGET_FLAG_UNIT) { @@ -333,20 +333,20 @@ void SpellCastTargets::write ( WorldPacket * data ) else *data << uint8(0); } - else if ( m_targetMask & TARGET_FLAG_OBJECT ) + else if (m_targetMask & TARGET_FLAG_OBJECT) { if (m_GOTarget) data->append(m_GOTarget->GetPackGUID()); else *data << uint8(0); } - else if ( m_targetMask & ( TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) ) + else if (m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE)) data->appendPackGUID(m_CorpseTargetGUID); else *data << uint8(0); } - if ( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM ) ) + if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM)) { if (m_itemTarget) data->append(m_itemTarget->GetPackGUID()); @@ -354,23 +354,23 @@ void SpellCastTargets::write ( WorldPacket * data ) *data << uint8(0); } - if ( m_targetMask & TARGET_FLAG_SOURCE_LOCATION ) + if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { *data << uint8(0); // It seems the client doesn't like unit target GUID being sent here, we must send 0 *data << m_srcPos.m_positionX << m_srcPos.m_positionY << m_srcPos.m_positionZ; } - if ( m_targetMask & TARGET_FLAG_DEST_LOCATION ) + if (m_targetMask & TARGET_FLAG_DEST_LOCATION) { *data << uint8(0); // It seems the client doesn't like unit target GUID being sent here, we must send 0 *data << m_dstPos.m_positionX << m_dstPos.m_positionY << m_dstPos.m_positionZ; } - if ( m_targetMask & TARGET_FLAG_STRING ) + if (m_targetMask & TARGET_FLAG_STRING) *data << m_strTarget; } -Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, Spell** triggeringContainer, bool skipCheck ) +Spell::Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID, Spell** triggeringContainer, bool skipCheck) : m_spellInfo(info), m_spellValue(new SpellValue(m_spellInfo)) , m_caster(Caster) { @@ -776,8 +776,8 @@ void Spell::prepareDataForTriggerSystem(AuraEffect const * triggeredByAura) { //========================================================================================== // Now fill data for trigger system, need know: - // can spell trigger another or not ( m_canTrigger ) - // Create base triggers flags for Attacker and Victim ( m_procAttacker, m_procVictim and m_procEx) + // can spell trigger another or not (m_canTrigger) + // Create base triggers flags for Attacker and Victim (m_procAttacker, m_procVictim and m_procEx) //========================================================================================== m_procVictim = m_procAttacker = 0; @@ -956,7 +956,7 @@ void Spell::AddUnitTarget(uint64 unitGUID, uint32 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(); @@ -1004,7 +1004,7 @@ 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 @@ -1238,7 +1238,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) spellHitTarget->ToCreature()->AI()->SpellHit(m_caster, m_spellInfo); // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) - // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... ) + // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm...) if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !spellHitTarget->ToCreature()->isPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself()) p->CastedCreatureOrGO(spellHitTarget->GetEntry(),spellHitTarget->GetGUID(),m_spellInfo->Id); @@ -1280,7 +1280,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool m_caster->ToPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, m_spellInfo->Id, 0, unit); } - if ( m_caster != unit ) + if (m_caster != unit) { // Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells if (m_spellInfo->speed > 0.0f && @@ -1290,7 +1290,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool return SPELL_MISS_EVADE; } - if ( !m_caster->IsFriendlyTo(unit) ) + if (!m_caster->IsFriendlyTo(unit)) { // reset damage to 0 if target has Invisibility and isn't visible for caster // I do not think this is a correct way to fix it. Sanctuary effect should make all delayed spells invalid @@ -1325,7 +1325,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool if (m_caster->GetTypeId() == TYPEID_PLAYER) m_caster->ToPlayer()->UpdatePvP(true); } - if ( unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO) ) + if (unit->isInCombat() && !(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_NO_INITIAL_AGGRO)) { m_caster->SetInCombatState(unit->GetCombatTimer() > 0, unit); unit->getHostileRefManager().threatAssist(m_caster, 0.0f); @@ -1493,10 +1493,10 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target) 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... ) - if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) + // ignore autorepeat/melee casts for speed (not exist quest for spells (hm...) + if (m_originalCaster && m_originalCaster->IsControlledByPlayer() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) { - if ( Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself() ) + if (Player* p = m_originalCaster->GetCharmerOrOwnerPlayerOrPlayerItself()) p->CastedCreatureOrGO(go->GetEntry(),go->GetGUID(),m_spellInfo->Id); } } @@ -1536,7 +1536,7 @@ bool Spell::UpdateChanneledTargetList() for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { - if ( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) ) + if (ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask)) { Unit *unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); @@ -1691,7 +1691,7 @@ void Spell::SearchAreaTarget(std::list<Unit*> &TagUnitMap, float radius, SpellNo Unit *target = m_targets.getUnitTarget(); if (!target) { - sLog.outError( "SPELL: cannot find unit target for spell ID %u\n", m_spellInfo->Id ); + sLog.outError("SPELL: cannot find unit target for spell ID %u\n", m_spellInfo->Id); return; } pos = target; @@ -1756,7 +1756,7 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType) range = m_caster->GetDistance(goScriptTarget); } } - else if ( focusObject ) //Focus Object + else if (focusObject) //Focus Object { float frange = m_caster->GetDistance(focusObject); if (range >= frange) @@ -2115,7 +2115,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) } else { - sLog.outDebug( "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id ); + sLog.outDebug("SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); Unit *target = NULL; if (uint64 guid = m_caster->GetUInt64Value(UNIT_FIELD_TARGET)) target = ObjectAccessor::GetUnit(*m_caster, guid); @@ -2143,7 +2143,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) { if (!m_originalCaster || !m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)) { - sLog.outError( "SPELL: no current channeled spell for spell ID %u", m_spellInfo->Id ); + sLog.outError("SPELL: no current channeled spell for spell ID %u", m_spellInfo->Id); break; } @@ -2154,7 +2154,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) if (Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTargetGUID())) AddUnitTarget(target, i); else - sLog.outError( "SPELL: cannot find channel spell target for spell ID %u", m_spellInfo->Id ); + sLog.outError("SPELL: cannot find channel spell target for spell ID %u", m_spellInfo->Id); break; case TARGET_DEST_CHANNEL: if (m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.HasDst()) @@ -2162,7 +2162,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) else if (Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTargetGUID())) m_targets.setDst(target); else - sLog.outError( "SPELL: cannot find channel spell destination for spell ID %u", m_spellInfo->Id ); + sLog.outError("SPELL: cannot find channel spell destination for spell ID %u", m_spellInfo->Id); break; } break; @@ -2431,9 +2431,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) Player* Target = itr->getSource(); // IsHostileTo check duel and controlled by enemy - if ( Target && targetPlayer->IsWithinDistInMap(Target, radius) && + if (Target && targetPlayer->IsWithinDistInMap(Target, radius) && targetPlayer->getClass() == Target->getClass() && - !m_caster->IsHostileTo(Target) ) + !m_caster->IsHostileTo(Target)) { AddUnitTarget(Target, i); } @@ -2740,7 +2740,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere { // stealth must be removed at cast starting (at show channel bar) // skip triggered spell (item equip spell casting and other not explicit character casts/item uses) - if (!m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) ) + if (!m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo)) { m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST); for (uint32 i = 0; i < 3; ++i) @@ -2753,7 +2753,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggere } } - m_caster->SetCurrentCastedSpell( this ); + m_caster->SetCurrentCastedSpell(this); SendSpellStart(); if (!m_casttime && !m_spellInfo->StartRecoveryTime @@ -3080,9 +3080,9 @@ uint64 Spell::handle_delayed(uint64 t_offset) { if (ihit->processed == false) { - if ( single_missile || ihit->timeDelay <= t_offset ) + if (single_missile || ihit->timeDelay <= t_offset) DoAllEffectOnTarget(&(*ihit)); - else if ( next_time == 0 || ihit->timeDelay < next_time ) + else if (next_time == 0 || ihit->timeDelay < next_time) next_time = ihit->timeDelay; } } @@ -3092,9 +3092,9 @@ uint64 Spell::handle_delayed(uint64 t_offset) { if (ighit->processed == false) { - if ( single_missile || ighit->timeDelay <= t_offset ) + if (single_missile || ighit->timeDelay <= t_offset) DoAllEffectOnTarget(&(*ighit)); - else if ( next_time == 0 || ighit->timeDelay < next_time ) + else if (next_time == 0 || ighit->timeDelay < next_time) next_time = ighit->timeDelay; } } @@ -3133,7 +3133,7 @@ void Spell::_handle_immediate_phase() continue; // apply Send Event effect to ground in case empty target lists - if ( m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j) ) + if (m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(j)) { HandleEffects(NULL, NULL, NULL, j); continue; @@ -3239,7 +3239,7 @@ void Spell::SendSpellCooldown() } // have infinity cooldown but set at aura apply // do not set cooldown for triggered spells (needed by reincarnation) - if (m_spellInfo->Attributes & (SPELL_ATTR_DISABLED_WHILE_ACTIVE | SPELL_ATTR_PASSIVE ) || m_IsTriggeredSpell) + if (m_spellInfo->Attributes & (SPELL_ATTR_DISABLED_WHILE_ACTIVE | SPELL_ATTR_PASSIVE) || m_IsTriggeredSpell) return; _player->AddSpellAndCategoryCooldowns(m_spellInfo,m_CastItem ? m_CastItem->GetEntry() : 0, this); @@ -3306,10 +3306,10 @@ void Spell::update(uint32 difftime) // channeled spell processed independently for quest targeting // cast at creature (or GO) quest objectives update at successful cast channel finished - // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) - if ( !IsAutoRepeat() && !IsNextMeleeSwingSpell() ) + // ignore autorepeat/melee casts for speed (not exist quest for spells (hm...) + if (!IsAutoRepeat() && !IsNextMeleeSwingSpell()) { - if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) + if (Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) { for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { @@ -3378,7 +3378,7 @@ void Spell::finish(bool ok) { // Unsummon statue uint32 spell = m_caster->GetUInt32Value(UNIT_CREATED_BY_SPELL); - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell); if (spellInfo && spellInfo->SpellIconID==2056) { sLog.outDebug("Statue %d is unsummoned in spell %d finish", m_caster->GetGUIDLow(), m_spellInfo->Id); @@ -3442,7 +3442,7 @@ void Spell::finish(bool ok) } // Stop Attack for some spells - if ( m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET ) + if (m_spellInfo->Attributes & SPELL_ATTR_STOP_ATTACK_TARGET) m_caster->AttackStop(); } @@ -3540,7 +3540,7 @@ void Spell::SendSpellStart() castFlags |= CAST_FLAG_AMMO; if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet())) - && m_spellInfo->powerType != POWER_HEALTH ) + && m_spellInfo->powerType != POWER_HEALTH) castFlags |= CAST_FLAG_POWER_LEFT_SELF; if (m_spellInfo->runeCostID && m_spellInfo->powerType == POWER_RUNE) @@ -3576,10 +3576,10 @@ void Spell::SendSpellStart() if (castFlags & CAST_FLAG_POWER_LEFT_SELF) data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType)); - if ( castFlags & CAST_FLAG_AMMO ) + if (castFlags & CAST_FLAG_AMMO) WriteAmmoToPacket(&data); - if ( castFlags & CAST_FLAG_UNKNOWN_23 ) + if (castFlags & CAST_FLAG_UNKNOWN_23) { data << uint32(0); data << uint32(0); @@ -3606,7 +3606,7 @@ void Spell::SendSpellGo() castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual if ((m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet())) - && m_spellInfo->powerType != POWER_HEALTH ) + && m_spellInfo->powerType != POWER_HEALTH) castFlags |= CAST_FLAG_POWER_LEFT_SELF; // should only be sent to self, but the current messaging doesn't make that possible if ((m_caster->GetTypeId() == TYPEID_PLAYER) @@ -3661,7 +3661,7 @@ void Spell::SendSpellGo() if (castFlags & CAST_FLAG_POWER_LEFT_SELF) data << uint32(m_caster->GetPower((Powers)m_spellInfo->powerType)); - if ( castFlags & CAST_FLAG_RUNE_LIST ) // rune cooldowns list + if (castFlags & CAST_FLAG_RUNE_LIST) // rune cooldowns list { uint8 v1 = m_runesState; uint8 v2 = m_caster->ToPlayer()->GetRunesState(); @@ -3676,22 +3676,22 @@ void Spell::SendSpellGo() } } - if ( castFlags & CAST_FLAG_UNKNOWN_18 ) // unknown wotlk + if (castFlags & CAST_FLAG_UNKNOWN_18) // unknown wotlk { data << float(0); data << uint32(0); } - if ( castFlags & CAST_FLAG_AMMO ) + if (castFlags & CAST_FLAG_AMMO) WriteAmmoToPacket(&data); - if ( castFlags & CAST_FLAG_UNKNOWN_20 ) // unknown wotlk + if (castFlags & CAST_FLAG_UNKNOWN_20) // unknown wotlk { data << uint32(0); data << uint32(0); } - if ( m_targets.getTargetMask() & TARGET_FLAG_DEST_LOCATION ) + if (m_targets.getTargetMask() & TARGET_FLAG_DEST_LOCATION) { data << uint8(0); } @@ -3699,25 +3699,25 @@ void Spell::SendSpellGo() m_caster->SendMessageToSet(&data, true); } -void Spell::WriteAmmoToPacket( WorldPacket * data ) +void Spell::WriteAmmoToPacket(WorldPacket * data) { uint32 ammoInventoryType = 0; uint32 ammoDisplayID = 0; if (m_caster->GetTypeId() == TYPEID_PLAYER) { - Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack( RANGED_ATTACK ); + Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); if (pItem) { ammoInventoryType = pItem->GetProto()->InventoryType; - if ( ammoInventoryType == INVTYPE_THROWN ) + if (ammoInventoryType == INVTYPE_THROWN) ammoDisplayID = pItem->GetProto()->DisplayInfoID; else { uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID); if (ammoID) { - ItemPrototype const *pProto = objmgr.GetItemPrototype( ammoID ); + ItemPrototype const *pProto = objmgr.GetItemPrototype(ammoID); if (pProto) { ammoDisplayID = pProto->DisplayInfoID; @@ -3771,7 +3771,7 @@ void Spell::WriteAmmoToPacket( WorldPacket * data ) *data << uint32(ammoInventoryType); } -void Spell::WriteSpellGoTargets( WorldPacket * data ) +void Spell::WriteSpellGoTargets(WorldPacket * data) { // This function also fill data for channeled spells: // m_needAliveTargetMask req for stop channelig if one target die @@ -3807,11 +3807,11 @@ void Spell::WriteSpellGoTargets( WorldPacket * data ) *data << (uint8)miss; for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { - if ( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss + if (ihit->missCondition != SPELL_MISS_NONE) // Add only miss { *data << uint64(ihit->targetGUID); *data << uint8(ihit->missCondition); - if ( ihit->missCondition == SPELL_MISS_REFLECT ) + if (ihit->missCondition == SPELL_MISS_REFLECT) *data << uint8(ihit->reflectResult); } } @@ -3956,7 +3956,7 @@ void Spell::SendChannelUpdate(uint32 time) if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - WorldPacket data( MSG_CHANNEL_UPDATE, 8+4 ); + WorldPacket data(MSG_CHANNEL_UPDATE, 8+4); data.append(m_caster->GetPackGUID()); data << uint32(time); @@ -3972,7 +3972,7 @@ void Spell::SendChannelStart(uint32 duration) { 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; @@ -3983,7 +3983,7 @@ void Spell::SendChannelStart(uint32 duration) { 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; @@ -3991,7 +3991,7 @@ void Spell::SendChannelStart(uint32 duration) } } - WorldPacket data( MSG_CHANNEL_START, (8+4+4) ); + WorldPacket data(MSG_CHANNEL_START, (8+4+4)); data.append(m_caster->GetPackGUID()); data << uint32(m_spellInfo->Id); data << uint32(duration); @@ -4134,7 +4134,7 @@ void Spell::TakePower() // health as power used if (m_spellInfo->powerType == POWER_HEALTH) { - m_caster->ModifyHealth( -(int32)m_powerCost ); + m_caster->ModifyHealth(-(int32)m_powerCost); return; } @@ -4158,13 +4158,13 @@ void Spell::TakeAmmo() { if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER) { - Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack( RANGED_ATTACK ); + Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); // wands don't have ammo if (!pItem || pItem->IsBroken() || pItem->GetProto()->SubClass==ITEM_SUBCLASS_WEAPON_WAND) return; - if ( pItem->GetProto()->InventoryType == INVTYPE_THROWN ) + if (pItem->GetProto()->InventoryType == INVTYPE_THROWN) { if (pItem->GetMaxStackCount()==1) { @@ -4175,7 +4175,7 @@ void Spell::TakeAmmo() { // decrease items amount for stackable throw weapon uint32 count = 1; - m_caster->ToPlayer()->DestroyItemCount( pItem, count, true); + m_caster->ToPlayer()->DestroyItemCount(pItem, count, true); } } else if (uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID)) @@ -4326,7 +4326,7 @@ void Spell::TakeReagents() if (m_CastItem) { ItemPrototype const *proto = m_CastItem->GetProto(); - if ( proto && proto->ItemId == itemid ) + if (proto && proto->ItemId == itemid) { for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) { @@ -4385,14 +4385,14 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar uint8 eff = m_spellInfo->Effect[i]; - sLog.outDebug( "Spell: %u Effect : %u", m_spellInfo->Id, eff); + sLog.outDebug("Spell: %u Effect : %u", m_spellInfo->Id, eff); //we do not need DamageMultiplier here. damage = CalculateDamage(i, NULL); if (eff < TOTAL_SPELL_EFFECTS) { - //sLog.outDebug( "WORLD: Spell FX %d < TOTAL_SPELL_EFFECTS ", eff); + //sLog.outDebug("WORLD: Spell FX %d < TOTAL_SPELL_EFFECTS ", eff); (this->*SpellEffects[eff])(i); } } @@ -4425,14 +4425,14 @@ SpellCastResult Spell::CheckCast(bool strict) } // only allow triggered spells if at an ended battleground - if ( !m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER) + if (!m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER) if (BattleGround * bg = m_caster->ToPlayer()->GetBattleGround()) if (bg->GetStatus() == STATUS_WAIT_LEAVE) return SPELL_FAILED_DONT_REPORT; // only check at first call, Stealth auras are already removed at second call // for now, ignore triggered spells - if ( strict && !m_IsTriggeredSpell) + if (strict && !m_IsTriggeredSpell) { bool checkForm = true; // Ignore form req aura @@ -4491,11 +4491,11 @@ SpellCastResult Spell::CheckCast(bool strict) // cancel autorepeat spells if cast start when moving // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code) - if ( m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving() ) + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->isMoving()) { // skip stuck spell to allow use it in falling case and apply spell limitations at movement - if ( (!m_caster->ToPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) && - (IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0) ) + if ((!m_caster->ToPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING) || m_spellInfo->Effect[0] != SPELL_EFFECT_STUCK) && + (IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0)) return SPELL_FAILED_MOVING; } @@ -4650,7 +4650,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_TARGET_AURASTATE; //Must be behind the target. - if ( m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(M_PI, m_caster) + if (m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(M_PI, m_caster) //Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags && (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellFamilyFlags.IsEqual(0x20000,0,0))) //Mutilate no longer requires you be behind the target as of patch 3.0.3 @@ -4663,7 +4663,7 @@ SpellCastResult Spell::CheckCast(bool strict) } //Target must be facing you. - if ((m_spellInfo->Attributes == 0x150010) && !target->HasInArc(M_PI, m_caster) ) + if ((m_spellInfo->Attributes == 0x150010) && !target->HasInArc(M_PI, m_caster)) { SendInterrupted(2); return SPELL_FAILED_NOT_INFRONT; @@ -4723,10 +4723,10 @@ SpellCastResult Spell::CheckCast(bool strict) { for (uint8 j = 0; j < 3; ++j) { - if ( m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_NEARBY_ENTRY || + if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_NEARBY_ENTRY || m_spellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_NEARBY_ENTRY && m_spellInfo->EffectImplicitTargetA[j] != TARGET_UNIT_CASTER || m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY ) + m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY) { SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(m_spellInfo->Id); SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(m_spellInfo->Id); @@ -4799,7 +4799,7 @@ SpellCastResult Spell::CheckCast(bool strict) CellLock<GridReadGuard> cell_lock(cell, p); cell_lock->Visit(cell_lock, grid_creature_searcher, *m_caster->GetMap(), *m_caster, range); - if (p_Creature ) + if (p_Creature) { creatureScriptTarget = p_Creature; goScriptTarget = NULL; @@ -4814,7 +4814,7 @@ SpellCastResult Spell::CheckCast(bool strict) { // store coordinates for TARGET_DST_NEARBY_ENTRY if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY ) + m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY) { m_targets.setDst(creatureScriptTarget->GetPositionX(),creatureScriptTarget->GetPositionY(),creatureScriptTarget->GetPositionZ()); @@ -4829,7 +4829,7 @@ SpellCastResult Spell::CheckCast(bool strict) { // store coordinates for TARGET_DST_NEARBY_ENTRY if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DST_NEARBY_ENTRY || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY ) + m_spellInfo->EffectImplicitTargetB[j] == TARGET_DST_NEARBY_ENTRY) { m_targets.setDst(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ()); @@ -4884,7 +4884,7 @@ SpellCastResult Spell::CheckCast(bool strict) { // spell different for friends and enemies // hurt version required facing - if (m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc( M_PI, m_targets.getUnitTarget() )) + if (m_targets.getUnitTarget() && !m_caster->IsFriendlyTo(m_targets.getUnitTarget()) && !m_caster->HasInArc(M_PI, m_targets.getUnitTarget())) return SPELL_FAILED_UNIT_NOT_INFRONT; } else if (m_spellInfo->SpellIconID == 33 && m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_FIRE_NOVA) @@ -5023,7 +5023,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() != TYPEID_PLAYER || !m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetTypeId() != TYPEID_UNIT) return SPELL_FAILED_BAD_TARGETS; - if ( !(m_targets.getUnitTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & UNIT_FLAG_SKINNABLE) ) + if (!(m_targets.getUnitTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & UNIT_FLAG_SKINNABLE)) return SPELL_FAILED_TARGET_UNSKINNABLE; Creature* creature = m_targets.getUnitTarget()->ToCreature(); @@ -5039,30 +5039,30 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_LOW_CASTLEVEL; // chance for fail at orange skinning attempt - if ( (m_selfContainer && (*m_selfContainer) == this) && + 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; } case SPELL_EFFECT_OPEN_LOCK: { - if ( m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT && - m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT_ITEM ) + if (m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT && + m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT_ITEM) break; - if ( m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc. + if (m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc. // we need a go target in case of TARGET_GAMEOBJECT || m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT && !m_targets.getGOTarget() // we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM || m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_ITEM && !m_targets.getGOTarget() && - (!m_targets.getItemTarget() || !m_targets.getItemTarget()->GetProto()->LockID || m_targets.getItemTarget()->GetOwner() != m_caster ) ) + (!m_targets.getItemTarget() || !m_targets.getItemTarget()->GetProto()->LockID || m_targets.getItemTarget()->GetOwner() != m_caster)) return SPELL_FAILED_BAD_TARGETS; // In BattleGround players can use only flags and banners - if ( m_caster->ToPlayer()->InBattleGround() && - !m_caster->ToPlayer()->CanUseBattleGroundObject() ) + if (m_caster->ToPlayer()->InBattleGround() && + !m_caster->ToPlayer()->CanUseBattleGroundObject()) return SPELL_FAILED_TRY_AGAIN; // get the lock entry @@ -5153,11 +5153,11 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_BAD_TARGETS; Player* target = objmgr.GetPlayer(m_caster->ToPlayer()->GetSelection()); - if ( !target || m_caster->ToPlayer() == target || !target->IsInSameRaidWith(m_caster->ToPlayer()) ) + if (!target || m_caster->ToPlayer() == target || !target->IsInSameRaidWith(m_caster->ToPlayer())) return SPELL_FAILED_BAD_TARGETS; // check if our map is dungeon - if ( sMapStore.LookupEntry(m_caster->GetMapId())->IsDungeon() ) + if (sMapStore.LookupEntry(m_caster->GetMapId())->IsDungeon()) { InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(m_caster->GetMapId()); if (!instance) @@ -5327,10 +5327,10 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_NO_MOUNTS_ALLOWED; ShapeshiftForm form = m_caster->m_form; - if ( form == FORM_CAT || form == FORM_TREE || form == FORM_TRAVEL || + if (form == FORM_CAT || form == FORM_TREE || form == FORM_TRAVEL || form == FORM_AQUA || form == FORM_BEAR || form == FORM_DIREBEAR || form == FORM_CREATUREBEAR || form == FORM_GHOSTWOLF || form == FORM_FLIGHT || - form == FORM_FLIGHT_EPIC || form == FORM_MOONKIN || form == FORM_METAMORPHOSIS ) + form == FORM_FLIGHT_EPIC || form == FORM_MOONKIN || form == FORM_METAMORPHOSIS) return SPELL_FAILED_NOT_SHAPESHIFT; break; @@ -5441,7 +5441,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target) SpellCastResult Spell::CheckCasterAuras() const { - // spells totally immuned to caster auras ( wsg flag drop, give marks etc) + // spells totally immuned to caster auras (wsg flag drop, give marks etc) if (m_spellInfo->AttributesEx6& SPELL_ATTR_EX6_IGNORE_CASTER_AURAS) return SPELL_CAST_OK; @@ -5451,7 +5451,7 @@ SpellCastResult Spell::CheckCasterAuras() const // 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 ) + if (m_spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) { for (int i = 0; i < 3; ++i) { @@ -5492,11 +5492,11 @@ SpellCastResult Spell::CheckCasterAuras() const for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { Aura const * aura = itr->second->GetBase(); - if ( GetAllSpellMechanicMask(aura->GetSpellProto()) & mechanic_immune ) + if (GetAllSpellMechanicMask(aura->GetSpellProto()) & mechanic_immune) continue; - if ( GetSpellSchoolMask(aura->GetSpellProto()) & school_immune ) + if (GetSpellSchoolMask(aura->GetSpellProto()) & school_immune) continue; - if ( (1<<(aura->GetSpellProto()->Dispel)) & dispel_immune) + if ((1<<(aura->GetSpellProto()->Dispel)) & dispel_immune) continue; //Make a second check for spell failed so the right SPELL_FAILED message is returned. @@ -5522,9 +5522,9 @@ SpellCastResult Spell::CheckCasterAuras() const case SPELL_AURA_MOD_SILENCE: case SPELL_AURA_MOD_PACIFY: case SPELL_AURA_MOD_PACIFY_SILENCE: - if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY) + if (m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY) return SPELL_FAILED_PACIFIED; - else if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE) + else if (m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE) return SPELL_FAILED_SILENCED; break; default: break; @@ -5548,21 +5548,21 @@ bool Spell::CanAutoCast(Unit* target) { if (m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA) { - if ( m_spellInfo->StackAmount <= 1) + if (m_spellInfo->StackAmount <= 1) { - if ( target->HasAuraEffect(m_spellInfo->Id, j) ) + if (target->HasAuraEffect(m_spellInfo->Id, j)) return false; } else { - if ( AuraEffect * aureff = target->GetAuraEffect(m_spellInfo->Id, j)) + if (AuraEffect * aureff = target->GetAuraEffect(m_spellInfo->Id, j)) if (aureff->GetBase()->GetStackAmount() >= m_spellInfo->StackAmount) return false; } } - else if ( IsAreaAuraEffect( m_spellInfo->Effect[j] )) + else if (IsAreaAuraEffect(m_spellInfo->Effect[j])) { - if ( target->HasAuraEffect(m_spellInfo->Id, j) ) + if (target->HasAuraEffect(m_spellInfo->Id, j)) return false; } } @@ -5574,7 +5574,7 @@ bool Spell::CanAutoCast(Unit* target) SelectSpellTargets(); //check if among target units, our WANTED target is as well (->only self cast spells return false) for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) - if ( ihit->targetGUID == targetguid ) + if (ihit->targetGUID == targetguid) return true; } return false; //target invalid @@ -5619,8 +5619,8 @@ SpellCastResult Spell::CheckRange(bool strict) else if (min_range && m_caster->IsWithinCombatRange(target, min_range)) // skip this check if min_range = 0 return SPELL_FAILED_TOO_CLOSE; - if ( m_caster->GetTypeId() == TYPEID_PLAYER && - (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc( M_PI, target ) ) + if (m_caster->GetTypeId() == TYPEID_PLAYER && + (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(M_PI, target)) return SPELL_FAILED_UNIT_NOT_INFRONT; } @@ -5649,7 +5649,7 @@ SpellCastResult Spell::CheckPower() return SPELL_CAST_OK; } // Check valid power type - if ( m_spellInfo->powerType >= MAX_POWERS ) + if (m_spellInfo->powerType >= MAX_POWERS) { sLog.outError("Spell::CheckPower: Unknown power type '%d'", m_spellInfo->powerType); return SPELL_FAILED_UNKNOWN; @@ -5686,7 +5686,7 @@ 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(); @@ -5805,7 +5805,7 @@ SpellCastResult Spell::CheckItems() uint32 itemcount = m_spellInfo->ReagentCount[i]; // if CastItem is also spell reagent - if ( m_CastItem && m_CastItem->GetEntry() == itemid ) + if (m_CastItem && m_CastItem->GetEntry() == itemid) { ItemPrototype const *proto = m_CastItem->GetProto(); if (!proto) @@ -5821,7 +5821,7 @@ SpellCastResult Spell::CheckItems() } } } - if ( !p_caster->HasItemCount(itemid,itemcount) ) + if (!p_caster->HasItemCount(itemid,itemcount)) return SPELL_FAILED_ITEM_NOT_READY; //0x54 } } @@ -5832,7 +5832,7 @@ SpellCastResult Spell::CheckItems() { if (m_spellInfo->Totem[i] != 0) { - if ( p_caster->HasItemCount(m_spellInfo->Totem[i],1) ) + if (p_caster->HasItemCount(m_spellInfo->Totem[i],1)) { totems -= 1; continue; @@ -5849,7 +5849,7 @@ SpellCastResult Spell::CheckItems() { if (m_spellInfo->TotemCategory[i] != 0) { - if ( p_caster->HasItemTotemCategory(m_spellInfo->TotemCategory[i]) ) + if (p_caster->HasItemTotemCategory(m_spellInfo->TotemCategory[i])) { TotemCategory -= 1; continue; @@ -5872,13 +5872,13 @@ SpellCastResult Spell::CheckItems() if (!m_IsTriggeredSpell && m_spellInfo->EffectItemType[i]) { ItemPosCountVec dest; - uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1 ); - if (msg != EQUIP_ERR_OK ) + uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1); + if (msg != EQUIP_ERR_OK) { ItemPrototype const *pProto = objmgr.GetItemPrototype(m_spellInfo->EffectItemType[i]); if (pProto && !(pProto->ItemLimitCategory)) { - p_caster->SendEquipError( msg, NULL, NULL ); + p_caster->SendEquipError(msg, NULL, NULL); return SPELL_FAILED_DONT_REPORT; } else @@ -5906,10 +5906,10 @@ SpellCastResult Spell::CheckItems() if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_TRIGGERED_CAST) return SPELL_FAILED_TOTEM_CATEGORY; ItemPosCountVec dest; - uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1 ); - if (msg != EQUIP_ERR_OK ) + uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1); + if (msg != EQUIP_ERR_OK) { - p_caster->SendEquipError( msg, NULL, NULL ); + p_caster->SendEquipError(msg, NULL, NULL); return SPELL_FAILED_DONT_REPORT; } } @@ -5919,10 +5919,10 @@ SpellCastResult Spell::CheckItems() if (!targetItem) return SPELL_FAILED_ITEM_NOT_FOUND; - if ( targetItem->GetProto()->ItemLevel < m_spellInfo->baseLevel ) + if (targetItem->GetProto()->ItemLevel < m_spellInfo->baseLevel) return SPELL_FAILED_LOWLEVEL; // Not allow enchant in trade slot for some enchant type - if ( targetItem->GetOwner() != m_caster ) + if (targetItem->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); @@ -5939,7 +5939,7 @@ SpellCastResult Spell::CheckItems() if (!item) return SPELL_FAILED_ITEM_NOT_FOUND; // Not allow enchant in trade slot for some enchant type - if ( item->GetOwner() != m_caster ) + if (item->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); @@ -5959,7 +5959,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_CANT_BE_DISENCHANTED; // prevent disenchanting in trade slot - if ( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() ) + if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID()) return SPELL_FAILED_CANT_BE_DISENCHANTED; ItemPrototype const* itemProto = m_targets.getItemTarget()->GetProto(); @@ -5989,7 +5989,7 @@ SpellCastResult Spell::CheckItems() if (!(m_targets.getItemTarget()->GetProto()->BagFamily & BAG_FAMILY_MASK_MINING_SUPP) || m_targets.getItemTarget()->GetProto()->Class != ITEM_CLASS_TRADE_GOODS) return SPELL_FAILED_CANT_BE_PROSPECTED; //prevent prospecting in trade slot - if ( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() ) + if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID()) return SPELL_FAILED_CANT_BE_PROSPECTED; //Check for enough skill in jewelcrafting uint32 item_prospectingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank; @@ -6012,7 +6012,7 @@ SpellCastResult Spell::CheckItems() if (!(m_targets.getItemTarget()->GetProto()->BagFamily & BAG_FAMILY_MASK_HERBS) || m_targets.getItemTarget()->GetProto()->Class != ITEM_CLASS_TRADE_GOODS) return SPELL_FAILED_CANT_BE_MILLED; //prevent milling in trade slot - if ( m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID() ) + if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID()) return SPELL_FAILED_CANT_BE_MILLED; //Check for enough skill in inscription uint32 item_millingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank; @@ -6031,7 +6031,7 @@ SpellCastResult Spell::CheckItems() case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: { if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER; - if ( m_attackType != RANGED_ATTACK ) + if (m_attackType != RANGED_ATTACK) break; Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType); if (!pItem || pItem->IsBroken()) @@ -6042,7 +6042,7 @@ SpellCastResult Spell::CheckItems() case ITEM_SUBCLASS_WEAPON_THROWN: { uint32 ammo = pItem->GetEntry(); - if ( !m_caster->ToPlayer()->HasItemCount( ammo, 1 ) ) + if (!m_caster->ToPlayer()->HasItemCount(ammo, 1)) return SPELL_FAILED_NO_AMMO; }; break; case ITEM_SUBCLASS_WEAPON_GUN: @@ -6059,7 +6059,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_NO_AMMO; } - ItemPrototype const *ammoProto = objmgr.GetItemPrototype( ammo ); + ItemPrototype const *ammoProto = objmgr.GetItemPrototype(ammo); if (!ammoProto) return SPELL_FAILED_NO_AMMO; @@ -6082,7 +6082,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_NO_AMMO; } - if ( !m_caster->ToPlayer()->HasItemCount( ammo, 1 ) ) + if (!m_caster->ToPlayer()->HasItemCount(ammo, 1)) return SPELL_FAILED_NO_AMMO; }; break; case ITEM_SUBCLASS_WEAPON_WAND: @@ -6122,7 +6122,7 @@ SpellCastResult Spell::CheckItems() Item* item = m_caster->ToPlayer()->GetWeaponForAttack(BASE_ATTACK); // skip spell if no weapon in slot or broken - if (!item || item->IsBroken() ) + if (!item || item->IsBroken()) return m_IsTriggeredSpell? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS; // skip spell if weapon not fit to triggered spell @@ -6136,7 +6136,7 @@ SpellCastResult Spell::CheckItems() Item* item = m_caster->ToPlayer()->GetWeaponForAttack(OFF_ATTACK); // skip spell if no weapon in slot or broken - if (!item || item->IsBroken() ) + if (!item || item->IsBroken()) return m_IsTriggeredSpell? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS; // skip spell if weapon not fit to triggered spell @@ -6159,7 +6159,7 @@ void Spell::Delayed() // only called in DealDamage() if (isDelayableNoMore()) // Spells may only be delayed twice return; - // spells not loosing casting time ( slam, dynamites, bombs.. ) + // spells not loosing casting time (slam, dynamites, bombs..) //if (!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE)) // return; @@ -6315,14 +6315,14 @@ bool Spell::CheckTarget(Unit* target, uint32 eff) // unselectable targets skipped in all cases except TARGET_UNIT_NEARBY_ENTRY targeting // in case TARGET_UNIT_NEARBY_ENTRY target selected by server always and can't be cheated - /*if ( target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && + /*if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && m_spellInfo->EffectImplicitTargetA[eff] != TARGET_UNIT_NEARBY_ENTRY && - m_spellInfo->EffectImplicitTargetB[eff] != TARGET_UNIT_NEARBY_ENTRY ) + m_spellInfo->EffectImplicitTargetB[eff] != TARGET_UNIT_NEARBY_ENTRY) return false;*/ } //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 (target->ToPlayer()->GetVisibility() == VISIBILITY_OFF) return false; @@ -6354,7 +6354,7 @@ bool Spell::CheckTarget(Unit* target, uint32 eff) if (m_IsTriggeredSpell) return true; - //Check targets for LOS visibility (except spells without range limitations ) + //Check targets for LOS visibility (except spells without range limitations) switch(m_spellInfo->Effect[eff]) { case SPELL_EFFECT_SUMMON_PLAYER: // from anywhere @@ -6406,7 +6406,7 @@ bool Spell::IsNeedSendToClient() const m_spellInfo->speed > 0.0f || !m_triggeredByAuraSpell && !m_IsTriggeredSpell; } -bool Spell::HaveTargetsForEffect( uint8 effect ) 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)) @@ -6741,7 +6741,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk skillId = SkillByLockType(LockType(lockInfo->Index[j])); - if ( skillId != SKILL_NONE ) + if (skillId != SKILL_NONE) { // skill bonus provided by casting spell (mostly item spells) // add the damage modifier from the spell casted (cheat lock / skeleton key etc.) (use m_currentBasePoints, CalculateDamage returns wrong value) @@ -6930,7 +6930,7 @@ void Spell::SelectTrajTargets() } } -void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster ) +void Spell::FillRaidOrPartyTargets(UnitList &TagUnitMap, Unit* target, float radius, bool raid, bool withPets, bool withcaster) { Player *pTarget = target->GetCharmerOrOwnerPlayerOrPlayerItself(); Group *pGroup = pTarget ? pTarget->GetGroup() : NULL; @@ -6974,7 +6974,7 @@ void Spell::FillRaidOrPartyTargets( UnitList &TagUnitMap, Unit* target, float ra } } -void Spell::FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withCaster ) +void Spell::FillRaidOrPartyManaPriorityTargets(UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withCaster) { FillRaidOrPartyTargets(TagUnitMap,target,radius,raid,withPets,withCaster); @@ -6991,7 +6991,7 @@ void Spell::FillRaidOrPartyManaPriorityTargets( UnitList &TagUnitMap, Unit* targ } } -void Spell::FillRaidOrPartyHealthPriorityTargets( UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withCaster ) +void Spell::FillRaidOrPartyHealthPriorityTargets(UnitList &TagUnitMap, Unit* target, float radius, uint32 count, bool raid, bool withPets, bool withCaster) { FillRaidOrPartyTargets(TagUnitMap,target,radius,raid,withPets,withCaster); |