diff options
author | Spp <none@none> | 2010-04-07 19:14:10 +0200 |
---|---|---|
committer | Spp <none@none> | 2010-04-07 19:14:10 +0200 |
commit | d19e12708001fbef2308be0e8cb5375a2ac7af48 (patch) | |
tree | 09fc8f67a6197802e0512950f0b0a3438a9834e8 /src/game/Unit.cpp | |
parent | 2e127f7a30706dc1d40c65de22ff02851732da24 (diff) |
Code style (game + scripts only):
"if(" --> "if ("
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 576 |
1 files changed, 288 insertions, 288 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 017f941ffd2..7e81806e658 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -518,7 +518,7 @@ bool Unit::IsWithinMeleeRange(const Unit *obj, float dist) const void Unit::GetRandomContactPoint(const Unit* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const { float combat_reach = GetCombatReach(); - if(combat_reach < 0.1) // sometimes bugged for players + if (combat_reach < 0.1) // sometimes bugged for players { //sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach); //if (GetTypeId() == TYPEID_UNIT) @@ -2004,7 +2004,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEff if (float manaMultiplier = (*i)->GetSpellProto()->EffectMultipleValue[(*i)->GetEffIndex()]) { - if(Player *modOwner = pVictim->GetSpellModOwner()) + if (Player *modOwner = pVictim->GetSpellModOwner()) modOwner->ApplySpellMod((*i)->GetId(), SPELLMOD_MULTIPLE_VALUE, manaMultiplier); int32 maxAbsorb = int32(pVictim->GetPower(POWER_MANA) / manaMultiplier); @@ -2848,7 +2848,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool if (pVictim->IsImmunedToDamage(spell)) return SPELL_MISS_IMMUNE; - if(this == pVictim) + if (this == pVictim) return SPELL_MISS_NONE; // Try victim reflect spell @@ -2857,7 +2857,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool int32 reflectchance = pVictim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS); Unit::AuraEffectList const& mReflectSpellsSchool = pVictim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL); for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i) - if((*i)->GetMiscValue() & GetSpellSchoolMask(spell)) + if ((*i)->GetMiscValue() & GetSpellSchoolMask(spell)) reflectchance += (*i)->GetAmount(); if (reflectchance > 0 && roll_chance_i(reflectchance)) { @@ -2882,7 +2882,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool /*float Unit::MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) const { - if(!pVictim) + if (!pVictim) return 0.0f; // Base misschance 5% @@ -2894,7 +2894,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool bool isNormal = false; for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) { - if( m_currentSpells[i] && (GetSpellSchoolMask(m_currentSpells[i]->m_spellInfo) & SPELL_SCHOOL_MASK_NORMAL) ) + if ( m_currentSpells[i] && (GetSpellSchoolMask(m_currentSpells[i]->m_spellInfo) & SPELL_SCHOOL_MASK_NORMAL) ) { isNormal = true; break; @@ -2910,7 +2910,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool int32 chance = pVictim->GetTypeId() == TYPEID_PLAYER ? 5 : 7; int32 leveldif = int32(pVictim->getLevelForTarget(this)) - int32(getLevelForTarget(pVictim)); - if(leveldif < 0) + if (leveldif < 0) leveldif = 0; // Hit chance from attacker based on ratings and auras @@ -2920,7 +2920,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool else m_modHitChance = m_modMeleeHitChance; - if(leveldif < 3) + if (leveldif < 3) misschance += (leveldif - m_modHitChance); else misschance += ((leveldif - 2) * chance - m_modHitChance); @@ -2935,7 +2935,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool } // Modify miss chance by victim auras - if(attType == RANGED_ATTACK) + if (attType == RANGED_ATTACK) misschance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE); else misschance -= pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE); @@ -2955,7 +2955,7 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool uint32 Unit::GetDefenseSkillValue(Unit const* target) const { - if(GetTypeId() == TYPEID_PLAYER) + if (GetTypeId() == TYPEID_PLAYER) { // in PvP use full skill instead current skill value uint32 value = (target && target->GetTypeId() == TYPEID_PLAYER) @@ -2970,13 +2970,13 @@ uint32 Unit::GetDefenseSkillValue(Unit const* target) const float Unit::GetUnitDodgeChance() const { - if(hasUnitState(UNIT_STAT_STUNNED)) + if (hasUnitState(UNIT_STAT_STUNNED)) return 0.0f; - if( GetTypeId() == TYPEID_PLAYER ) + if ( GetTypeId() == TYPEID_PLAYER ) return GetFloatValue(PLAYER_DODGE_PERCENTAGE); else { - if(((Creature const*)this)->isTotem()) + if (((Creature const*)this)->isTotem()) return 0.0f; else { @@ -2994,22 +2994,22 @@ float Unit::GetUnitParryChance() const float chance = 0.0f; - if(GetTypeId() == TYPEID_PLAYER) + if (GetTypeId() == TYPEID_PLAYER) { Player const* player = (Player const*)this; - if(player->CanParry() ) + if (player->CanParry() ) { Item *tmpitem = player->GetWeaponForAttack(BASE_ATTACK,true); - if(!tmpitem) + if (!tmpitem) tmpitem = player->GetWeaponForAttack(OFF_ATTACK,true); - if(tmpitem) + if (tmpitem) chance = GetFloatValue(PLAYER_PARRY_PERCENTAGE); } } - else if(GetTypeId() == TYPEID_UNIT) + else if (GetTypeId() == TYPEID_UNIT) { - if(GetCreatureType() == CREATURE_TYPE_HUMANOID) + if (GetCreatureType() == CREATURE_TYPE_HUMANOID) { chance = 5.0f; chance += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT); @@ -3024,13 +3024,13 @@ float Unit::GetUnitBlockChance() const if ( IsNonMeleeSpellCasted(false) || hasUnitState(UNIT_STAT_STUNNED)) return 0.0f; - if(GetTypeId() == TYPEID_PLAYER) + if (GetTypeId() == TYPEID_PLAYER) { Player const* player = (Player const*)this; - if(player->CanBlock() ) + if (player->CanBlock() ) { Item *tmpitem = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); - if(tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block) + if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block) return GetFloatValue(PLAYER_BLOCK_PERCENTAGE); } // is player but has no block ability or no not broken shield equipped @@ -3038,7 +3038,7 @@ float Unit::GetUnitBlockChance() const } else { - if(((Creature const*)this)->isTotem()) + if (((Creature const*)this)->isTotem()) return 0.0f; else { @@ -3053,7 +3053,7 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVict { float crit; - if(GetTypeId() == TYPEID_PLAYER) + if (GetTypeId() == TYPEID_PLAYER) { switch(attackType) { @@ -3080,7 +3080,7 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVict } // flat aura mods - if(attackType == RANGED_ATTACK) + if (attackType == RANGED_ATTACK) crit += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE); else crit += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE); @@ -3109,7 +3109,7 @@ float Unit::GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVict uint32 Unit::GetWeaponSkillValue (WeaponAttackType attType, Unit const* target) const { uint32 value = 0; - if(GetTypeId() == TYPEID_PLAYER) + if (GetTypeId() == TYPEID_PLAYER) { Item* item = this->ToPlayer()->GetWeaponForAttack(attType,true); @@ -3152,7 +3152,7 @@ void Unit::_DeleteRemovedAuras() void Unit::_UpdateSpells( uint32 time ) { - if(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]) + if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]) _UpdateAutoRepeatSpell(); // remove finished spells from current pointers @@ -3176,7 +3176,7 @@ void Unit::_UpdateSpells( uint32 time ) // remove expired auras - do that after updates(used in scripts?) for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end();) { - if(i->second->IsExpired()) + if (i->second->IsExpired()) RemoveOwnedAura(i, AURA_REMOVE_BY_EXPIRE); else ++i; @@ -3188,12 +3188,12 @@ void Unit::_UpdateSpells( uint32 time ) _DeleteRemovedAuras(); - if(!m_gameObj.empty()) + if (!m_gameObj.empty()) { GameObjectList::iterator itr; for (itr = m_gameObj.begin(); itr != m_gameObj.end();) { - if( !(*itr)->isSpawned() ) + if ( !(*itr)->isSpawned() ) { (*itr)->SetOwnerGUID(0); (*itr)->SetRespawnTime(0); @@ -3212,7 +3212,7 @@ void Unit::_UpdateAutoRepeatSpell() if ( (GetTypeId() == TYPEID_PLAYER && ((Player*)this)->isMoving()) || IsNonMeleeSpellCasted(false,false,true,m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == 75) ) { // cancel wand shoot - if(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75) + if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id != 75) InterruptSpell(CURRENT_AUTOREPEAT_SPELL); m_AutoRepeatFirstCast = true; return; @@ -3227,7 +3227,7 @@ void Unit::_UpdateAutoRepeatSpell() if (isAttackReady(RANGED_ATTACK)) { // Check if able to cast - if(m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->CheckCast(true) != SPELL_CAST_OK) + if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->CheckCast(true) != SPELL_CAST_OK) { InterruptSpell(CURRENT_AUTOREPEAT_SPELL); return; @@ -3321,12 +3321,12 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi //sLog.outDebug("Interrupt spell for unit %u.", GetEntry()); Spell *spell = m_currentSpells[spellType]; - if(spell + if (spell && (withDelayed || spell->getState() != SPELL_STATE_DELAYED) && (withInstant || spell->GetCastTime() > 0)) { // for example, do not let self-stun aura interrupt itself - if(!spell->IsInterruptable()) + if (!spell->IsInterruptable()) return; m_currentSpells[spellType] = NULL; @@ -3334,7 +3334,7 @@ void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool wi // send autorepeat cancel message for autorepeat spells if (spellType == CURRENT_AUTOREPEAT_SPELL) { - if(GetTypeId() == TYPEID_PLAYER) + if (GetTypeId() == TYPEID_PLAYER) this->ToPlayer()->SendAutoRepeatCancel(this); } @@ -3401,7 +3401,7 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id, bool withI Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const { for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++) - if(m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id==spell_id) + if (m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id==spell_id) return m_currentSpells[i]; return NULL; } @@ -3436,7 +3436,7 @@ void Unit::SetFacingToObject(WorldObject* pObject) bool Unit::isInAccessiblePlaceFor(Creature const* c) const { - if(IsInWater()) + if (IsInWater()) return c->canSwim(); else return c->canWalk() || c->canFly(); @@ -3468,7 +3468,7 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster) // find current aura from spell and change it's stackamount if (Aura * foundAura = GetOwnedAura(aura->GetId(), aura->GetCasterGUID(), 0, aura)) { - if(aura->GetSpellProto()->StackAmount) + if (aura->GetSpellProto()->StackAmount) aura->ModStackAmount(foundAura->GetStackAmount()); // Use the new one to replace the old one @@ -3493,7 +3493,7 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster) Unit::AuraList& scAuras = caster->GetSingleCastAuras(); for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end(); ++itr) { - if( (*itr) != aura && + if ( (*itr) != aura && IsSingleTargetSpells((*itr)->GetSpellProto(), aura->GetSpellProto())) { (*itr)->Remove(); @@ -3502,7 +3502,7 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster) } } - if(!restart) + if (!restart) break; } } @@ -3521,7 +3521,7 @@ AuraApplication * Unit::_CreateAuraApplication(Aura * aura, uint8 effMask) uint32 aurId = aurSpellInfo->Id; // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load) - if( !isAlive() && !IsDeathPersistentSpell(aurSpellInfo) && + if ( !isAlive() && !IsDeathPersistentSpell(aurSpellInfo) && (GetTypeId() != TYPEID_PLAYER || !this->ToPlayer()->GetSession()->PlayerLoading()) ) return NULL; @@ -3530,13 +3530,13 @@ AuraApplication * Unit::_CreateAuraApplication(Aura * aura, uint8 effMask) AuraApplication * aurApp = new AuraApplication(this, caster, aura, effMask); m_appliedAuras.insert(AuraApplicationMap::value_type(aurId, aurApp)); - if(aurSpellInfo->AuraInterruptFlags) + if (aurSpellInfo->AuraInterruptFlags) { m_interruptableAuras.push_back(aurApp); AddInterruptMask(aurSpellInfo->AuraInterruptFlags); } - if(AuraState aState = GetSpellAuraState(aura->GetSpellProto())) + if (AuraState aState = GetSpellAuraState(aura->GetSpellProto())) m_auraStateAuras.insert(AuraStateAurasMap::value_type(aState, aurApp)); aura->_ApplyForTarget(this, caster, aurApp); @@ -3567,7 +3567,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask) return; // Update target aura state flag - if(AuraState aState = GetSpellAuraState(aura->GetSpellProto())) + if (AuraState aState = GetSpellAuraState(aura->GetSpellProto())) ModifyAuraState(aState, true); if (aurApp->GetRemoveMode()) @@ -3666,7 +3666,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo aura->HandleAuraSpecificMods(aurApp, caster, false); // only way correctly remove all auras from list - //if(removedAuras != m_removedAurasCount) new aura may be added + //if (removedAuras != m_removedAurasCount) new aura may be added i = m_appliedAuras.begin(); } @@ -3699,13 +3699,13 @@ void Unit::_RemoveNoStackAuraApplicationsDueToAura(Aura * aura) uint32 spellId = spellProto->Id; // passive spell special case (only non stackable with ranks) - if(IsPassiveSpell(spellId) && IsPassiveSpellStackableWithRanks(spellProto)) + if (IsPassiveSpell(spellId) && IsPassiveSpellStackableWithRanks(spellProto)) return; bool remove = false; for (AuraApplicationMap::iterator i = m_appliedAuras.begin(); i != m_appliedAuras.end(); ++i) { - if(remove) + if (remove) { remove = false; i = m_appliedAuras.begin(); @@ -3715,7 +3715,7 @@ void Unit::_RemoveNoStackAuraApplicationsDueToAura(Aura * aura) continue; RemoveAura(i, AURA_REMOVE_BY_DEFAULT); - if(i == m_appliedAuras.end()) + if (i == m_appliedAuras.end()) break; remove = true; } @@ -3728,13 +3728,13 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura * aura) uint32 spellId = spellProto->Id; // passive spell special case (only non stackable with ranks) - if(IsPassiveSpell(spellId) && IsPassiveSpellStackableWithRanks(spellProto)) + if (IsPassiveSpell(spellId) && IsPassiveSpellStackableWithRanks(spellProto)) return; bool remove = false; for (AuraMap::iterator i = m_ownedAuras.begin(); i != m_ownedAuras.end(); ++i) { - if(remove) + if (remove) { remove = false; i = m_ownedAuras.begin(); @@ -3744,7 +3744,7 @@ void Unit::_RemoveNoStackAurasDueToAura(Aura * aura) continue; RemoveOwnedAura(i, AURA_REMOVE_BY_DEFAULT); - if(i == m_ownedAuras.end()) + if (i == m_ownedAuras.end()) break; remove = true; } @@ -3765,10 +3765,10 @@ bool Unit::_IsNoStackAuraDueToAura(Aura * appliedAura, Aura * existingAura) cons uint32 i_spellId = i_spellProto->Id; bool sameCaster = appliedAura->GetCasterGUID() == existingAura->GetCasterGUID(); - if(IsPassiveSpell(i_spellId)) + if (IsPassiveSpell(i_spellId)) { // passive non-stackable spells not stackable only for same caster - if(!sameCaster) + if (!sameCaster) return false; // passive non-stackable spells not stackable only with another rank of same spell @@ -3792,7 +3792,7 @@ bool Unit::_IsNoStackAuraDueToAura(Aura * appliedAura, Aura * existingAura) cons if (is_triggered_by_spell) return false; - if(spellmgr.CanAurasStack(spellProto, i_spellProto, sameCaster)) + if (spellmgr.CanAurasStack(spellProto, i_spellProto, sameCaster)) return false; return true; } @@ -3830,7 +3830,7 @@ void Unit::RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode) void Unit::RemoveOwnedAura(uint32 spellId, uint64 caster, uint8 reqEffMask, AuraRemoveMode removeMode) { for (AuraMap::iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId);) - if(((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!caster || itr->second->GetCasterGUID() == caster)) + if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!caster || itr->second->GetCasterGUID() == caster)) { RemoveOwnedAura(itr, removeMode); itr = m_ownedAuras.lower_bound(spellId); @@ -3859,7 +3859,7 @@ void Unit::RemoveOwnedAura(Aura * aura, AuraRemoveMode removeMode) Aura * Unit::GetOwnedAura(uint32 spellId, uint64 caster, uint8 reqEffMask, Aura * except) const { for (AuraMap::const_iterator itr = m_ownedAuras.lower_bound(spellId); itr != m_ownedAuras.upper_bound(spellId); ++itr) - if(((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!caster || itr->second->GetCasterGUID() == caster) && (!except || except != itr->second)) + if (((itr->second->GetEffectMask() & reqEffMask) == reqEffMask) && (!caster || itr->second->GetCasterGUID() == caster) && (!except || except != itr->second)) return itr->second; return NULL; } @@ -4358,7 +4358,7 @@ void Unit::_ApplyAllAuraStatMods() AuraEffect * Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const { for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr) - if(itr->second->HasEffect(effIndex) && (!caster || itr->second->GetBase()->GetCasterGUID() == caster)) + if (itr->second->HasEffect(effIndex) && (!caster || itr->second->GetBase()->GetCasterGUID() == caster)) return itr->second->GetBase()->GetEffect(effIndex); return NULL; } @@ -4414,7 +4414,7 @@ AuraApplication * Unit::GetAuraApplication(uint32 spellId, uint64 casterGUID, ui for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr) { Aura const * aura = itr->second->GetBase(); - if(((aura->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || aura->GetCasterGUID() == casterGUID) && (!except || except!=itr->second)) + if (((aura->GetEffectMask() & reqEffMask) == reqEffMask) && (!casterGUID || aura->GetCasterGUID() == casterGUID) && (!except || except!=itr->second)) return itr->second; } return NULL; @@ -4451,7 +4451,7 @@ Aura * Unit::GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID, uint8 reqEf bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const { for (AuraApplicationMap::const_iterator itr = m_appliedAuras.lower_bound(spellId); itr != m_appliedAuras.upper_bound(spellId); ++itr) - if(itr->second->HasEffect(effIndex) && (!caster || itr->second->GetBase()->GetCasterGUID() == caster)) + if (itr->second->HasEffect(effIndex) && (!caster || itr->second->GetBase()->GetCasterGUID() == caster)) return true; return false; } @@ -4729,16 +4729,16 @@ void Unit::AddDynObject(DynamicObject* dynObj) void Unit::RemoveDynObject(uint32 spellid) { - if(m_dynObjGUIDs.empty()) + if (m_dynObjGUIDs.empty()) return; for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();) { DynamicObject* dynObj = GetMap()->GetDynamicObject(*i); - if(!dynObj) // may happen if a dynobj is removed when grid unload + if (!dynObj) // may happen if a dynobj is removed when grid unload { i = m_dynObjGUIDs.erase(i); } - else if(spellid == 0 || dynObj->GetSpellId() == spellid) + else if (spellid == 0 || dynObj->GetSpellId() == spellid) { dynObj->Delete(); i = m_dynObjGUIDs.erase(i); @@ -4753,7 +4753,7 @@ void Unit::RemoveAllDynObjects() while (!m_dynObjGUIDs.empty()) { DynamicObject* dynObj = GetMap()->GetDynamicObject(*m_dynObjGUIDs.begin()); - if(dynObj) + if (dynObj) dynObj->Delete(); m_dynObjGUIDs.erase(m_dynObjGUIDs.begin()); } @@ -4764,7 +4764,7 @@ DynamicObject * Unit::GetDynObject(uint32 spellId) for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();) { DynamicObject* dynObj = GetMap()->GetDynamicObject(*i); - if(!dynObj) + if (!dynObj) { i = m_dynObjGUIDs.erase(i); continue; @@ -4788,7 +4788,7 @@ GameObject* Unit::GetGameObject(uint32 spellId) const void Unit::AddGameObject(GameObject* gameObj) { - if(!gameObj || !gameObj->GetOwnerGUID()==0) return; + if (!gameObj || !gameObj->GetOwnerGUID()==0) return; m_gameObj.push_back(gameObj); gameObj->SetOwnerGUID(GetGUID()); @@ -4804,13 +4804,13 @@ void Unit::AddGameObject(GameObject* gameObj) void Unit::RemoveGameObject(GameObject* gameObj, bool del) { - if(!gameObj || !gameObj->GetOwnerGUID()==GetGUID()) return; + if (!gameObj || !gameObj->GetOwnerGUID()==GetGUID()) return; gameObj->SetOwnerGUID(0); for (uint32 i = 0; i < 4; ++i) { - if(m_ObjectSlot[i] == gameObj->GetGUID()) + if (m_ObjectSlot[i] == gameObj->GetGUID()) { m_ObjectSlot[i] = 0; break; @@ -4834,7 +4834,7 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del) m_gameObj.remove(gameObj); - if(del) + if (del) { gameObj->SetRespawnTime(0); gameObj->Delete(); @@ -4843,16 +4843,16 @@ void Unit::RemoveGameObject(GameObject* gameObj, bool del) void Unit::RemoveGameObject(uint32 spellid, bool del) { - if(m_gameObj.empty()) + if (m_gameObj.empty()) return; GameObjectList::iterator i, next; for (i = m_gameObj.begin(); i != m_gameObj.end(); i = next) { next = i; - if(spellid == 0 || (*i)->GetSpellId() == spellid) + if (spellid == 0 || (*i)->GetSpellId() == spellid) { (*i)->SetOwnerGUID(0); - if(del) + if (del) { (*i)->SetRespawnTime(0); (*i)->Delete(); @@ -4907,7 +4907,7 @@ void Unit::SendSpellNonMeleeDamageLog(Unit *target, uint32 SpellID, uint32 Damag log.physicalLog = PhysicalDamage; log.blocked = Blocked; log.HitInfo = SPELL_HIT_TYPE_UNK1 | SPELL_HIT_TYPE_UNK3 | SPELL_HIT_TYPE_UNK6; - if(CriticalHit) + if (CriticalHit) log.HitInfo |= SPELL_HIT_TYPE_CRIT; SendSpellNonMeleeDamageLog(&log); } @@ -4919,7 +4919,7 @@ void Unit::ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVic ProcDamageAndSpellFor(false, pVictim,procAttacker, procExtra,attType, procSpell, amount, procAura); // Now go on with a victim's events'n'auras // Not much to do if no flags are set or there is no victim - if(pVictim && pVictim->isAlive() && procVictim) + if (pVictim && pVictim->isAlive() && procVictim) pVictim->ProcDamageAndSpellFor(true, this, procVictim, procExtra, attType, procSpell, amount, procAura); } @@ -5004,13 +5004,13 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) data << uint32(damageInfo->damage); // Sub Damage } - if(damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2)) + if (damageInfo->HitInfo & (HITINFO_ABSORB | HITINFO_ABSORB2)) { for (uint32 i = 0; i < count; ++i) data << uint32(damageInfo->absorb); // Absorb } - if(damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2)) + if (damageInfo->HitInfo & (HITINFO_RESIST | HITINFO_RESIST2)) { for (uint32 i = 0; i < count; ++i) data << uint32(damageInfo->resist); // Resist @@ -5020,13 +5020,13 @@ void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) data << uint32(0); data << uint32(0); - if(damageInfo->HitInfo & HITINFO_BLOCK) + if (damageInfo->HitInfo & HITINFO_BLOCK) data << uint32(damageInfo->blocked_amount); - if(damageInfo->HitInfo & HITINFO_UNK3) + if (damageInfo->HitInfo & HITINFO_UNK3) data << uint32(0); - if(damageInfo->HitInfo & HITINFO_UNK1) + if (damageInfo->HitInfo & HITINFO_UNK1) { data << uint32(0); data << float(0); @@ -5147,7 +5147,7 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE case 54646: { Unit* caster = triggeredByAura->GetCaster(); - if(!caster) + if (!caster) return false; triggered_spell_id = 54648; @@ -5159,30 +5159,30 @@ bool Unit::HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 /*damage*/, AuraE } // processed charge only counting case - if(!triggered_spell_id) + if (!triggered_spell_id) return true; SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); - if(!triggerEntry) + if (!triggerEntry) { sLog.outError("Unit::HandleHasteAuraProc: Spell %u have not existed triggered spell %u",triggeredByAuraSpell->Id,triggered_spell_id); return false; } // default case - if(!target || target!=this && !target->isAlive()) + if (!target || target!=this && !target->isAlive()) return false; - if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) + if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) return false; - if(basepoints0) + if (basepoints0) CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); - if( cooldown && GetTypeId() == TYPEID_PLAYER ) + if ( cooldown && GetTypeId() == TYPEID_PLAYER ) this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return true; @@ -5241,7 +5241,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger case 35429: { target = SelectNearbyTarget(); - if(!target) + if (!target) return false; triggered_spell_id = 26654; @@ -5266,7 +5266,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Adaptive Warding (Frostfire Regalia set) case 28764: { - if(!procSpell) + if (!procSpell) return false; // find Mage Armor @@ -5293,7 +5293,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Obsidian Armor (Justice Bearer`s Pauldrons shoulder) case 27539: { - if(!procSpell) + if (!procSpell) return false; switch(GetFirstSchoolInMask(GetSpellSchoolMask(procSpell))) @@ -5318,7 +5318,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger { // Cast on owner target = GetOwner(); - if(!target) + if (!target) return false; triggered_spell_id = 34650; @@ -5329,7 +5329,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger { // Cast on owner target = GetOwner(); - if(!target) + if (!target) return false; triggered_spell_id = 58876; @@ -5375,7 +5375,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // 41409 Dementia: Every 5 seconds either gives you -5% damage/healing. (Druid, Shaman, Priest, Warlock, Mage, Paladin) case 39446: { - if(GetTypeId() != TYPEID_PLAYER || !this->isAlive()) + if (GetTypeId() != TYPEID_PLAYER || !this->isAlive()) return false; // Select class defined buff @@ -5430,7 +5430,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // cast 45429 Arcane Bolt if Exalted by Scryers case 45481: { - if(GetTypeId() != TYPEID_PLAYER) + if (GetTypeId() != TYPEID_PLAYER) return false; // Get Aldor reputation rank @@ -5444,17 +5444,17 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if (ToPlayer()->GetReputationRank(934) == REP_EXALTED) { // triggered at positive/self casts also, current attack target used then - if(IsFriendlyTo(target)) + if (IsFriendlyTo(target)) { target = getVictim(); - if(!target) + if (!target) { uint64 selected_guid = ToPlayer()->GetSelection(); target = ObjectAccessor::GetUnit(*this,selected_guid); - if(!target) + if (!target) return false; } - if(IsFriendlyTo(target)) + if (IsFriendlyTo(target)) return false; } @@ -5468,7 +5468,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // cast 45428 Arcane Strike if Exalted by Scryers case 45482: { - if(GetTypeId() != TYPEID_PLAYER) + if (GetTypeId() != TYPEID_PLAYER) return false; // Get Aldor reputation rank @@ -5491,7 +5491,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // cast 45432 Light's Ward if Exalted by Scryers case 45483: { - if(GetTypeId() != TYPEID_PLAYER) + if (GetTypeId() != TYPEID_PLAYER) return false; // Get Aldor reputation rank @@ -5515,7 +5515,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // cast 45430 Arcane Surge if Exalted by Scryers case 45484: { - if(GetTypeId() != TYPEID_PLAYER) + if (GetTypeId() != TYPEID_PLAYER) return false; // Get Aldor reputation rank @@ -5547,7 +5547,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Remove aura stack from pet RemoveAuraFromStack(58914); Unit* owner = GetOwner(); - if(!owner) + if (!owner) return true; // reduce the owner's aura stack owner->RemoveAuraFromStack(34027); @@ -5604,13 +5604,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Master of Elements if (dummySpell->SpellIconID == 1920) { - if(!procSpell) + if (!procSpell) return false; // mana cost save int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; basepoints0 = cost * triggerAmount/100; - if( basepoints0 <=0 ) + if ( basepoints0 <=0 ) return false; target = this; @@ -5620,7 +5620,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Arcane Potency if (dummySpell->SpellIconID == 2120) { - if(!procSpell) + if (!procSpell) return false; target = this; @@ -5660,12 +5660,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Burnout if (dummySpell->SpellIconID == 2998) { - if(!procSpell) + if (!procSpell) return false; int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; basepoints0 = cost * triggerAmount/100; - if( basepoints0 <=0 ) + if ( basepoints0 <=0 ) return false; triggered_spell_id = 44450; target = this; @@ -5674,7 +5674,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Incanter's Regalia set (add trigger chance to Mana Shield) if (dummySpell->SpellFamilyFlags[0] & 0x8000) { - if(GetTypeId() != TYPEID_PLAYER) + if (GetTypeId() != TYPEID_PLAYER) return false; target = this; @@ -5731,7 +5731,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Glyph of Ice Block case 56372: { - if(GetTypeId() != TYPEID_PLAYER) + if (GetTypeId() != TYPEID_PLAYER) return false; SpellCooldowns const SpellCDs = this->ToPlayer()->GetSpellCooldowns(); @@ -5740,7 +5740,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger { SpellEntry const* SpellCDs_entry = sSpellStore.LookupEntry(itr->first); // Frost Nova - if(SpellCDs_entry && SpellCDs_entry->SpellFamilyName == SPELLFAMILY_MAGE + if (SpellCDs_entry && SpellCDs_entry->SpellFamilyName == SPELLFAMILY_MAGE && SpellCDs_entry->SpellFamilyFlags[0] & 0x00000040) this->ToPlayer()->RemoveSpellCooldown(SpellCDs_entry->Id, true); } @@ -5757,7 +5757,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger case 12328: { target = SelectNearbyTarget(); - if(!target) + if (!target) return false; triggered_spell_id = 26654; @@ -5774,7 +5774,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger } // Retaliation - if(dummySpell->SpellFamilyFlags[1] & 0x8) + if (dummySpell->SpellFamilyFlags[1] & 0x8) { // check attack comes not from behind if (!HasInArc(M_PI, pVictim)) @@ -5840,10 +5840,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Seed of Corruption if (dummySpell->SpellFamilyFlags[1] & 0x00000010) { - if(procSpell && procSpell->Id == 27285) + if (procSpell && procSpell->Id == 27285) return false; // if damage is more than need or target die from damage deal finish spell - if( triggeredByAura->GetAmount() <= damage || GetHealth() <= damage ) + if ( triggeredByAura->GetAmount() <= damage || GetHealth() <= damage ) { // remember guid before aura delete uint64 casterGuid = triggeredByAura->GetCasterGUID(); @@ -5852,7 +5852,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger RemoveAurasDueToSpell(triggeredByAura->GetId()); // Cast finish spell (triggeredByAura already not exist!) - if(Unit* caster = GetUnit(*this, casterGuid)) + if (Unit* caster = GetUnit(*this, casterGuid)) caster->CastSpell(this, 27285, true, castItem); return true; // no hidden cooldown } @@ -5865,7 +5865,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if (dummySpell->SpellFamilyFlags.IsEqual(0,0,0) && dummySpell->SpellIconID == 1932) { // if damage is more than need deal finish spell - if( triggeredByAura->GetAmount() <= damage ) + if ( triggeredByAura->GetAmount() <= damage ) { // remember guid before aura delete uint64 casterGuid = triggeredByAura->GetCasterGUID(); @@ -5874,7 +5874,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger RemoveAurasDueToSpell(triggeredByAura->GetId()); // Cast finish spell (triggeredByAura already not exist!) - if(Unit* caster = GetUnit(*this, casterGuid)) + if (Unit* caster = GetUnit(*this, casterGuid)) caster->CastSpell(this, 32865, true, castItem); return true; // no hidden cooldown } @@ -5976,7 +5976,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger case 37381: { target = GetGuardianPet(); - if(!target) + if (!target) return false; // heal amount @@ -5996,16 +5996,16 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger case SPELLFAMILY_PRIEST: { // Vampiric Touch - if( dummySpell->SpellFamilyFlags[1] & 0x00000400 ) + if ( dummySpell->SpellFamilyFlags[1] & 0x00000400 ) { - if(!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->isAlive()) return false; if (effIndex!=0) return false; // pVictim is caster of aura - if(triggeredByAura->GetCasterGUID() != pVictim->GetGUID()) + if (triggeredByAura->GetCasterGUID() != pVictim->GetGUID()) return false; // Energize 0.25% of max. mana @@ -6042,7 +6042,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Vampiric Embrace case 15286: { - if(!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->isAlive()) return false; // heal amount @@ -6055,10 +6055,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger case 40438: { // Shadow Word: Pain - if( procSpell->SpellFamilyFlags[0] & 0x8000 ) + if ( procSpell->SpellFamilyFlags[0] & 0x8000 ) triggered_spell_id = 40441; // Renew - else if( procSpell->SpellFamilyFlags[0] & 0x40 ) + else if ( procSpell->SpellFamilyFlags[0] & 0x40 ) triggered_spell_id = 40440; else return false; @@ -6072,20 +6072,20 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger triggered_spell_id = 56161; SpellEntry const* GoPoH = sSpellStore.LookupEntry(triggered_spell_id); - if(!GoPoH) + if (!GoPoH) return false; int EffIndex = 0; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++) { - if(GoPoH->Effect[i] == SPELL_EFFECT_APPLY_AURA) + if (GoPoH->Effect[i] == SPELL_EFFECT_APPLY_AURA) { EffIndex = i; break; } } int32 tickcount = GetSpellMaxDuration(GoPoH) / GoPoH->EffectAmplitude[EffIndex]; - if(!tickcount) + if (!tickcount) return false; basepoints0 = damage * triggerAmount / tickcount / 100; @@ -6107,7 +6107,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Dispel Magic shares spellfamilyflag with abolish disease if (procSpell->SpellIconID != 74) return false; - if(!target || !target->IsFriendlyTo(this)) + if (!target || !target->IsFriendlyTo(this)) return false; basepoints0 = int32(target->GetMaxHealth() * triggerAmount / 100); @@ -6126,7 +6126,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Frozen Shadoweave (Shadow's Embrace set) warning! its not only priest set case 39372: { - if(!procSpell || (GetSpellSchoolMask(procSpell) & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW))==0 ) + if (!procSpell || (GetSpellSchoolMask(procSpell) & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW))==0 ) return false; // heal amount @@ -6241,19 +6241,19 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger float chance; // Starfire - if( procSpell->SpellFamilyFlags[0] & 0x4 ) + if ( procSpell->SpellFamilyFlags[0] & 0x4 ) { triggered_spell_id = 40445; chance = 25.0f; } // Rejuvenation - else if( procSpell->SpellFamilyFlags[0] & 0x10 ) + else if ( procSpell->SpellFamilyFlags[0] & 0x10 ) { triggered_spell_id = 40446; chance = 25.0f; } // Mangle (Bear) and Mangle (Cat) - else if( procSpell->SpellFamilyFlags[1] & 0x00000440) + else if ( procSpell->SpellFamilyFlags[1] & 0x00000440) { triggered_spell_id = 40452; chance = 40.0f; @@ -6340,7 +6340,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger case 32748: { // Prevent cast Deadly Throw Interrupt on self from last effect (apply dummy) of Deadly Throw - if(this == pVictim) + if (this == pVictim) return false; triggered_spell_id = 32747; @@ -6348,7 +6348,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger } } // Cut to the Chase - if( dummySpell->SpellIconID == 2909 ) + if ( dummySpell->SpellIconID == 2909 ) { // "refresh your Slice and Dice duration to its 5 combo point maximum" // lookup Slice and Dice @@ -6360,20 +6360,20 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger return false; } // Deadly Brew - else if( dummySpell->SpellIconID == 2963 ) + else if ( dummySpell->SpellIconID == 2963 ) { triggered_spell_id = 3409; break; } // Quick Recovery - else if( dummySpell->SpellIconID == 2116 ) + else if ( dummySpell->SpellIconID == 2116 ) { - if(!procSpell) + if (!procSpell) return false; // energy cost save basepoints0 = procSpell->manaCost * triggerAmount/100; - if(basepoints0 <= 0) + if (basepoints0 <= 0) return false; target = this; @@ -6387,13 +6387,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Thrill of the Hunt if ( dummySpell->SpellIconID == 2236 ) { - if(!procSpell) + if (!procSpell) return false; // mana cost save int32 mana = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100; basepoints0 = mana * 40/100; - if(basepoints0 <= 0) + if (basepoints0 <= 0) return false; target = this; @@ -6411,7 +6411,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if ( dummySpell->SpellIconID == 267 ) { int32 chance = triggeredByAura->GetSpellProto()->EffectBasePoints[triggeredByAura->GetEffIndex()]; - if(!roll_chance_i(chance)) + if (!roll_chance_i(chance)) return false; triggered_spell_id = 24406; @@ -6575,7 +6575,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Holy Power (Redemption Armor set) case 28789: { - if(!pVictim) + if (!pVictim) return false; // Set class defined buff @@ -6620,7 +6620,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Seal of Vengeance (damage calc on apply aura) case 31801: { - if(effIndex != 0) // effect 1,2 used by seal unleashing code + if (effIndex != 0) // effect 1,2 used by seal unleashing code return false; // At melee attack or Hammer of the Righteous spell damage considered as melee attack @@ -6645,7 +6645,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Seal of Corruption case 53736: { - if(effIndex != 0) // effect 1,2 used by seal unleashing code + if (effIndex != 0) // effect 1,2 used by seal unleashing code return false; // At melee attack or Hammer of the Righteous spell damage considered as melee attack @@ -6672,27 +6672,27 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger case 33776: { // if healed by another unit (pVictim) - if(this == pVictim) + if (this == pVictim) return false; // heal amount basepoints0 = triggerAmount*(std::min(damage,GetMaxHealth() - GetHealth()))/100; target = this; - if(basepoints0) + if (basepoints0) triggered_spell_id = 31786; break; } // Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal) case 40470: { - if( !procSpell ) + if ( !procSpell ) return false; float chance; // Flash of light/Holy light - if( procSpell->SpellFamilyFlags[0] & 0xC0000000) + if ( procSpell->SpellFamilyFlags[0] & 0xC0000000) { triggered_spell_id = 40471; chance = 15.0f; @@ -6776,7 +6776,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Totemic Power (The Earthshatterer set) case 28823: { - if( !pVictim ) + if ( !pVictim ) return false; // Set class defined buff @@ -6814,11 +6814,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Windfury Weapon (Passive) 1-5 Ranks case 33757: { - if(GetTypeId()!=TYPEID_PLAYER || !castItem || !castItem->IsEquipped() || !pVictim || !pVictim->isAlive()) + if (GetTypeId()!=TYPEID_PLAYER || !castItem || !castItem->IsEquipped() || !pVictim || !pVictim->isAlive()) return false; // custom cooldown processing case - if( cooldown && this->ToPlayer()->HasSpellCooldown(dummySpell->Id)) + if ( cooldown && this->ToPlayer()->HasSpellCooldown(dummySpell->Id)) return false; if (triggeredByAura->GetBase() && castItem->GetGUID() != triggeredByAura->GetBase()->GetCastItemGUID()) @@ -6863,7 +6863,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger } SpellEntry const* windfurySpellEntry = sSpellStore.LookupEntry(spellId); - if(!windfurySpellEntry) + if (!windfurySpellEntry) { sLog.outError("Unit::HandleDummyAuraProc: non existed spell id: %u (Windfury)",spellId); return false; @@ -6876,7 +6876,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger triggered_spell_id = 25504; // apply cooldown before cast to prevent processing itself - if( cooldown ) + if ( cooldown ) this->ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown); // Attack Twice @@ -6932,7 +6932,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger { // Cast on owner target = GetOwner(); - if(!target) + if (!target) return false; basepoints0 = triggerAmount * damage / 100; triggered_spell_id = 58879; @@ -6962,7 +6962,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger if (dummySpell->SpellIconID == 3063) { // Earthbind Totem summon only - if(procSpell->Id != 2484) + if (procSpell->Id != 2484) return false; float chance = triggerAmount; @@ -6981,7 +6981,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger break; } // Earth Shield - if(dummySpell->SpellFamilyFlags[1] & 0x00000400) + if (dummySpell->SpellFamilyFlags[1] & 0x00000400) { // 3.0.8: Now correctly uses the Shaman's own spell critical strike chance to determine the chance of a critical heal. originalCaster = triggeredByAura->GetCasterGUID(); @@ -7000,7 +7000,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Flametongue Weapon (Passive) if (dummySpell->SpellFamilyFlags[0] & 0x200000) { - if(GetTypeId()!=TYPEID_PLAYER || !pVictim || !pVictim->isAlive() || !castItem || !castItem->IsEquipped()) + if (GetTypeId()!=TYPEID_PLAYER || !pVictim || !pVictim->isAlive() || !castItem || !castItem->IsEquipped()) return false; // firehit = dummySpell->EffectBasePoints[0] / ((4*19.25) * 1.3); @@ -7067,11 +7067,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger // Lightning Overload if (dummySpell->SpellIconID == 2018) // only this spell have SpellFamily Shaman SpellIconID == 2018 and dummy aura { - if(!procSpell || GetTypeId() != TYPEID_PLAYER || !pVictim ) + if (!procSpell || GetTypeId() != TYPEID_PLAYER || !pVictim ) return false; // custom cooldown processing case - if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(dummySpell->Id)) + if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(dummySpell->Id)) return false; uint32 spellId = 0; @@ -7125,13 +7125,13 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger this->ToPlayer()->AddSpellMod(mod, false); - if( cooldown && GetTypeId() == TYPEID_PLAYER ) + if ( cooldown && GetTypeId() == TYPEID_PLAYER ) this->ToPlayer()->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown); return true; } // Static Shock - if(dummySpell->SpellIconID == 3059) + if (dummySpell->SpellIconID == 3059) { // Lightning Shield if (AuraEffect const * aurEff = GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_SHAMAN, 0x400, 0, 0)) @@ -7329,7 +7329,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { // check if shown in spell book - if(!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED) + if (!itr->second->active || itr->second->disabled || itr->second->state == PLAYERSPELL_REMOVED) continue; SpellEntry const *spellProto = sSpellStore.LookupEntry(itr->first); @@ -7410,30 +7410,30 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger } // processed charge only counting case - if(!triggered_spell_id) + if (!triggered_spell_id) return true; SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); - if(!triggerEntry) + if (!triggerEntry) { sLog.outError("Unit::HandleDummyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id); return false; } // default case - if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) + if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) return false; - if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) + if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) return false; - if(basepoints0) + if (basepoints0) CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura, originalCaster); else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura, originalCaster); - if( cooldown && GetTypeId() == TYPEID_PLAYER ) + if ( cooldown && GetTypeId() == TYPEID_PLAYER ) this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return true; @@ -7468,30 +7468,30 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* } } // processed charge only counting case - if(!triggered_spell_id) + if (!triggered_spell_id) return true; SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); // Try handle unknown trigger spells - if(!triggerEntry) + if (!triggerEntry) { sLog.outError("Unit::HandleObsModEnergyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id); return false; } // default case - if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) + if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) return false; - if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) + if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) return false; - if(basepoints0) + if (basepoints0) CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); - if( cooldown && GetTypeId() == TYPEID_PLAYER ) + if ( cooldown && GetTypeId() == TYPEID_PLAYER ) this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return true; } @@ -7526,30 +7526,30 @@ bool Unit::HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEff } } // processed charge only counting case - if(!triggered_spell_id) + if (!triggered_spell_id) return true; SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); - if(!triggerEntry) + if (!triggerEntry) { sLog.outError("Unit::HandleModDamagePctTakenAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id); return false; } // default case - if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) + if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) return false; - if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) + if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) return false; - if(basepoints0) + if (basepoints0) CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); else CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura); - if( cooldown && GetTypeId() == TYPEID_PLAYER ) + if ( cooldown && GetTypeId() == TYPEID_PLAYER ) this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return true; @@ -7614,7 +7614,7 @@ bool Unit::HandleAuraProc(Unit *pVictim, uint32 damage, Aura * triggeredByAura, // Convert recently used Blood Rune to Death Rune if (GetTypeId() == TYPEID_PLAYER) { - if(this->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT) + if (this->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT) return false; RuneType rune = this->ToPlayer()->GetLastUsedRune(); // can't proc from death rune use @@ -7688,7 +7688,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig Unit* target = NULL; int32 basepoints0 = 0; - if(triggeredByAura->GetAuraType() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE) + if (triggeredByAura->GetAuraType() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE) basepoints0 = triggerAmount; Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER @@ -7888,7 +7888,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig return false; } SpellEntry const *TriggerPS = sSpellStore.LookupEntry(trigger_spell_id); - if(!TriggerPS) + if (!TriggerPS) return false; basepoints0 = int32(damage * triggerAmount / 100 / (GetSpellMaxDuration(TriggerPS) / TriggerPS->EffectAmplitude[0])); target = pVictim; @@ -7916,14 +7916,14 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Lightning Capacitor case 37657: { - if(!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->isAlive()) return false; // stacking CastSpell(this, 37658, true, NULL, triggeredByAura); Aura * dummy = GetAura(37658); // release at 3 aura in stack (cont contain in basepoint of trigger aura) - if(!dummy || dummy->GetStackAmount() < triggerAmount) + if (!dummy || dummy->GetStackAmount() < triggerAmount) return false; RemoveAurasDueToSpell(37658); @@ -7934,7 +7934,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Thunder Capacitor case 54841: { - if(!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->isAlive()) return false; // stacking CastSpell(this, 54842, true, NULL, triggeredByAura); @@ -7942,7 +7942,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // counting Aura * dummy = GetAura(54842); // release at 3 aura in stack (cont contain in basepoint of trigger aura) - if(!dummy || dummy->GetStackAmount() < triggerAmount) + if (!dummy || dummy->GetStackAmount() < triggerAmount) return false; RemoveAurasDueToSpell(54842); @@ -7954,12 +7954,12 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Illumination if (auraSpellInfo->SpellIconID==241) { - if(!procSpell) + if (!procSpell) return false; // procspell is triggered spell but we need mana cost of original casted spell uint32 originalSpellId = procSpell->Id; // Holy Shock heal - if(procSpell->SpellFamilyFlags[1] & 0x00010000) + if (procSpell->SpellFamilyFlags[1] & 0x00010000) { switch(procSpell->Id) { @@ -7976,7 +7976,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig } } SpellEntry const *originalSpell = sSpellStore.LookupEntry(originalSpellId); - if(!originalSpell) + if (!originalSpell) { sLog.outError("Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu",originalSpellId); return false; @@ -8011,7 +8011,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Mana Surge (The Earthfury set) case 23572: { - if(!procSpell) + if (!procSpell) return false; basepoints0 = procSpell->manaCost * 35 / 100; trigger_spell_id = 23571; @@ -8021,7 +8021,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig default: { // Lightning Shield (overwrite non existing triggered spell call in spell.dbc - if(auraSpellInfo->SpellFamilyFlags[0] & 0x400) + if (auraSpellInfo->SpellFamilyFlags[0] & 0x400) { trigger_spell_id = spellmgr.GetSpellWithRank(26364, spellmgr.GetSpellRank(auraSpellInfo->Id)); } @@ -8032,7 +8032,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig if (!(10*(int32(GetHealth() - damage)) < 3 * GetMaxHealth())) return false; - if(pVictim && pVictim->isAlive()) + if (pVictim && pVictim->isAlive()) pVictim->getThreatManager().modifyThreatPercent(this,-10); basepoints0 = triggerAmount * GetMaxHealth() / 100; @@ -8090,7 +8090,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig } // not allow proc extra attack spell at extra attack - if( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) + if ( m_extraAttacks && IsSpellHaveEffect(triggerEntry, SPELL_EFFECT_ADD_EXTRA_ATTACKS) ) return false; // Custom requirements (not listed in procEx) Warning! damage dealing after this @@ -8109,14 +8109,14 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Unyielding Knights (item exploit 29108\29109) case 38164: { - if(pVictim->GetEntry() != 19457) // Proc only if you target is Grillok + if (pVictim->GetEntry() != 19457) // Proc only if you target is Grillok return false; break; } // Deflection case 52420: { - if(GetHealth()*100 / GetMaxHealth() >= 35) + if (GetHealth()*100 / GetMaxHealth() >= 35) return false; break; } @@ -8190,7 +8190,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig case 63156: case 63158: // Can proc only if target has hp below 35% - if(!pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this)) + if (!pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, procSpell, this)) return false; break; } @@ -8225,15 +8225,15 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig case 52916: { target = triggeredByAura->GetBase()->GetCaster(); - if(!target) + if (!target) return false; - if( cooldown && GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->HasSpellCooldown(trigger_spell_id)) + if ( cooldown && GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->HasSpellCooldown(trigger_spell_id)) return false; target->CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura); - if( cooldown && GetTypeId() == TYPEID_PLAYER ) + if ( cooldown && GetTypeId() == TYPEID_PLAYER ) this->ToPlayer()->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown); return true; } @@ -8249,7 +8249,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Combo points add triggers (need add combopoint only for main target, and after possible combopoints reset) case 15250: // Rogue Setup { - if(!pVictim || pVictim != getVictim()) // applied only for main target + if (!pVictim || pVictim != getVictim()) // applied only for main target return false; break; // continue normal case } @@ -8277,7 +8277,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Enlightenment (trigger only from mana cost spells) case 35095: { - if(!procSpell || procSpell->powerType!=POWER_MANA || procSpell->manaCost==0 && procSpell->ManaCostPercentage==0 && procSpell->manaCostPerlevel==0) + if (!procSpell || procSpell->powerType!=POWER_MANA || procSpell->manaCost==0 && procSpell->ManaCostPercentage==0 && procSpell->manaCostPerlevel==0) return false; break; } @@ -8312,7 +8312,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // PPM = 2.5 * (rank of talent), uint32 rank = spellmgr.GetSpellRank(auraSpellInfo->Id); // 5 rank -> 100% 4 rank -> 80% and etc from full rate - if(!roll_chance_i(20*rank)) + if (!roll_chance_i(20*rank)) return false; break; } @@ -8330,7 +8330,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig // Burning Determination case 54748: { - if(!procSpell) + if (!procSpell) return false; // Need Interrupt or Silenced mechanic if (!(GetAllSpellMechanicMask(procSpell) & ((1<<MECHANIC_INTERRUPT)|(1<<MECHANIC_SILENCE)))) @@ -8378,7 +8378,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig } } - if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(trigger_spell_id)) + if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(trigger_spell_id)) return false; // try detect target manually if not set @@ -8386,15 +8386,15 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* trig target = !(procFlags & (PROC_FLAG_SUCCESSFUL_POSITIVE_MAGIC_SPELL | PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL_HIT)) && IsPositiveSpell(trigger_spell_id) ? this : pVictim; // default case - if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) + if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive())) return false; - if(basepoints0) + if (basepoints0) CastCustomSpell(target,trigger_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura); else CastSpell(target,trigger_spell_id,true,castItem,triggeredByAura); - if( cooldown && GetTypeId() == TYPEID_PLAYER ) + if ( cooldown && GetTypeId() == TYPEID_PLAYER ) this->ToPlayer()->AddSpellCooldown(trigger_spell_id,0,time(NULL) + cooldown); return true; @@ -8404,7 +8404,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraE { int32 scriptId = triggeredByAura->GetMiscValue(); - if(!pVictim || !pVictim->isAlive()) + if (!pVictim || !pVictim->isAlive()) return false; Item* castItem = triggeredByAura->GetBase()->GetCastItemGUID() && GetTypeId() == TYPEID_PLAYER @@ -8475,24 +8475,24 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraE } // not processed - if(!triggered_spell_id) + if (!triggered_spell_id) return false; // standard non-dummy case SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id); - if(!triggerEntry) + if (!triggerEntry) { sLog.outError("Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u",triggered_spell_id,scriptId); return false; } - if( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) + if ( cooldown && GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->HasSpellCooldown(triggered_spell_id)) return false; CastSpell(pVictim, triggered_spell_id, true, castItem, triggeredByAura); - if( cooldown && GetTypeId() == TYPEID_PLAYER ) + if ( cooldown && GetTypeId() == TYPEID_PLAYER ) this->ToPlayer()->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown); return true; @@ -8502,18 +8502,18 @@ void Unit::setPowerType(Powers new_powertype) { SetByteValue(UNIT_FIELD_BYTES_0, 3, new_powertype); - if(GetTypeId() == TYPEID_PLAYER) + if (GetTypeId() == TYPEID_PLAYER) { - if(this->ToPlayer()->GetGroup()) + if (this->ToPlayer()->GetGroup()) this->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POWER_TYPE); } - else if(this->ToCreature()->isPet()) + else if (this->ToCreature()->isPet()) { Pet *pet = ((Pet*)this); - if(pet->isControlled()) + if (pet->isControlled()) { Unit *owner = GetOwner(); - if(owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup()) + if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup()) owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_POWER_TYPE); } } @@ -8544,11 +8544,11 @@ void Unit::setPowerType(Powers new_powertype) FactionTemplateEntry const* Unit::getFactionTemplateEntry() const { FactionTemplateEntry const* entry = sFactionTemplateStore.LookupEntry(getFaction()); - if(!entry) + if (!entry) { static uint64 guid = 0; // prevent repeating spam same faction problem - if(GetGUID() != guid) + if (GetGUID() != guid) { if (const Player *player = ToPlayer()) sLog.outError("Player %s has invalid faction (faction template id) #%u", player->GetName(), getFaction()); @@ -8565,18 +8565,18 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const bool Unit::IsHostileTo(Unit const* unit) const { - if(!unit) + if (!unit) return false; // always non-hostile to self - if(unit==this) + if (unit==this) return false; // always non-hostile to GM in GM mode - if(unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster()) + if (unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster()) return false; // always hostile to enemy - if(getVictim()==unit || unit->getVictim()==this) + if (getVictim()==unit || unit->getVictim()==this) return true; // test pet/charm masters instead pers/charmeds @@ -8584,51 +8584,51 @@ bool Unit::IsHostileTo(Unit const* unit) const Unit const* targetOwner = unit->GetCharmerOrOwner(); // always hostile to owner's enemy - if(testerOwner && (testerOwner->getVictim()==unit || unit->getVictim()==testerOwner)) + if (testerOwner && (testerOwner->getVictim()==unit || unit->getVictim()==testerOwner)) return true; // always hostile to enemy owner - if(targetOwner && (getVictim()==targetOwner || targetOwner->getVictim()==this)) + if (targetOwner && (getVictim()==targetOwner || targetOwner->getVictim()==this)) return true; // always hostile to owner of owner's enemy - if(testerOwner && targetOwner && (testerOwner->getVictim()==targetOwner || targetOwner->getVictim()==testerOwner)) + if (testerOwner && targetOwner && (testerOwner->getVictim()==targetOwner || targetOwner->getVictim()==testerOwner)) return true; Unit const* tester = testerOwner ? testerOwner : this; Unit const* target = targetOwner ? targetOwner : unit; // always non-hostile to target with common owner, or to owner/pet - if(tester==target) + if (tester==target) return false; // special cases (Duel, etc) - if(tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER) + if (tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER) { Player const* pTester = (Player const*)tester; Player const* pTarget = (Player const*)target; // Duel - if(pTester->duel && pTester->duel->opponent == pTarget && pTester->duel->startTime != 0) + if (pTester->duel && pTester->duel->opponent == pTarget && pTester->duel->startTime != 0) return true; // Group - if(pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup()) + if (pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup()) return false; // Sanctuary - if(pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY)) + if (pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY)) return false; // PvP FFA state - if(pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) + if (pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) return true; //= PvP states // Green/Blue (can't attack) if (!pTester->HasAuraType(SPELL_AURA_MOD_FACTION) && !pTarget->HasAuraType(SPELL_AURA_MOD_FACTION)) { - if(pTester->GetTeam()==pTarget->GetTeam()) + if (pTester->GetTeam()==pTarget->GetTeam()) return false; // Red (can attack) if true, Blue/Yellow (can't attack) in another case @@ -8639,39 +8639,39 @@ bool Unit::IsHostileTo(Unit const* unit) const // faction base cases FactionTemplateEntry const*tester_faction = tester->getFactionTemplateEntry(); FactionTemplateEntry const*target_faction = target->getFactionTemplateEntry(); - if(!tester_faction || !target_faction) + if (!tester_faction || !target_faction) return false; - if(target->isAttackingPlayer() && tester->IsContestedGuard()) + if (target->isAttackingPlayer() && tester->IsContestedGuard()) return true; // PvC forced reaction and reputation case - if(tester->GetTypeId() == TYPEID_PLAYER && !tester->HasAuraType(SPELL_AURA_MOD_FACTION)) + if (tester->GetTypeId() == TYPEID_PLAYER && !tester->HasAuraType(SPELL_AURA_MOD_FACTION)) { // forced reaction - if(target_faction->faction) + if (target_faction->faction) { - if(ReputationRank const* force =tester->ToPlayer()->GetReputationMgr().GetForcedRankIfAny(target_faction)) + if (ReputationRank const* force =tester->ToPlayer()->GetReputationMgr().GetForcedRankIfAny(target_faction)) return *force <= REP_HOSTILE; // if faction have reputation then hostile state for tester at 100% dependent from at_war state - if(FactionEntry const* raw_target_faction = sFactionStore.LookupEntry(target_faction->faction)) - if(FactionState const* factionState = tester->ToPlayer()->GetReputationMgr().GetState(raw_target_faction)) + if (FactionEntry const* raw_target_faction = sFactionStore.LookupEntry(target_faction->faction)) + if (FactionState const* factionState = tester->ToPlayer()->GetReputationMgr().GetState(raw_target_faction)) return (factionState->Flags & FACTION_FLAG_AT_WAR); } } // CvP forced reaction and reputation case - else if(target->GetTypeId() == TYPEID_PLAYER && !target->HasAuraType(SPELL_AURA_MOD_FACTION)) + else if (target->GetTypeId() == TYPEID_PLAYER && !target->HasAuraType(SPELL_AURA_MOD_FACTION)) { // forced reaction - if(tester_faction->faction) + if (tester_faction->faction) { - if(ReputationRank const* force = target->ToPlayer()->GetReputationMgr().GetForcedRankIfAny(tester_faction)) + if (ReputationRank const* force = target->ToPlayer()->GetReputationMgr().GetForcedRankIfAny(tester_faction)) return *force <= REP_HOSTILE; // apply reputation state FactionEntry const* raw_tester_faction = sFactionStore.LookupEntry(tester_faction->faction); - if(raw_tester_faction && raw_tester_faction->reputationListID >=0 ) + if (raw_tester_faction && raw_tester_faction->reputationListID >=0 ) return ((Player const*)target)->GetReputationMgr().GetRank(raw_tester_faction) <= REP_HOSTILE; } } @@ -8683,15 +8683,15 @@ bool Unit::IsHostileTo(Unit const* unit) const bool Unit::IsFriendlyTo(Unit const* unit) const { // always friendly to self - if(unit==this) + if (unit==this) return true; // always friendly to GM in GM mode - if(unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster()) + if (unit->GetTypeId() == TYPEID_PLAYER && ((Player const*)unit)->isGameMaster()) return true; // always non-friendly to enemy - if(getVictim()==unit || unit->getVictim()==this) + if (getVictim()==unit || unit->getVictim()==this) return false; // test pet/charm masters instead pers/charmeds @@ -8699,51 +8699,51 @@ bool Unit::IsFriendlyTo(Unit const* unit) const Unit const* targetOwner = unit->GetCharmerOrOwner(); // always non-friendly to owner's enemy - if(testerOwner && (testerOwner->getVictim()==unit || unit->getVictim()==testerOwner)) + if (testerOwner && (testerOwner->getVictim()==unit || unit->getVictim()==testerOwner)) return false; // always non-friendly to enemy owner - if(targetOwner && (getVictim()==targetOwner || targetOwner->getVictim()==this)) + if (targetOwner && (getVictim()==targetOwner || targetOwner->getVictim()==this)) return false; // always non-friendly to owner of owner's enemy - if(testerOwner && targetOwner && (testerOwner->getVictim()==targetOwner || targetOwner->getVictim()==testerOwner)) + if (testerOwner && targetOwner && (testerOwner->getVictim()==targetOwner || targetOwner->getVictim()==testerOwner)) return false; Unit const* tester = testerOwner ? testerOwner : this; Unit const* target = targetOwner ? targetOwner : unit; // always friendly to target with common owner, or to owner/pet - if(tester==target) + if (tester==target) return true; // special cases (Duel) - if(tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER) + if (tester->GetTypeId() == TYPEID_PLAYER && target->GetTypeId() == TYPEID_PLAYER) { Player const* pTester = (Player const*)tester; Player const* pTarget = (Player const*)target; // Duel - if(pTester->duel && pTester->duel->opponent == target && pTester->duel->startTime != 0) + if (pTester->duel && pTester->duel->opponent == target && pTester->duel->startTime != 0) return false; // Group - if(pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup()) + if (pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup()) return true; // Sanctuary - if(pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY)) + if (pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY)) return true; // PvP FFA state - if(pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) + if (pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) && pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) return false; //= PvP states // Green/Blue (non-attackable) if (!pTester->HasAuraType(SPELL_AURA_MOD_FACTION) && !pTarget->HasAuraType(SPELL_AURA_MOD_FACTION)) { - if(pTester->GetTeam()==pTarget->GetTeam()) + if (pTester->GetTeam()==pTarget->GetTeam()) return true; // Blue (friendly/non-attackable) if not PVP, or Yellow/Red in another case (attackable) @@ -8823,31 +8823,31 @@ bool Unit::IsNeutralToAll() const bool Unit::Attack(Unit *victim, bool meleeAttack) { - if(!victim || victim == this) + if (!victim || victim == this) return false; // dead units can neither attack nor be attacked - if(!isAlive() || !victim->IsInWorld() || !victim->isAlive()) + if (!isAlive() || !victim->IsInWorld() || !victim->isAlive()) return false; // player cannot attack in mount state - if(GetTypeId() == TYPEID_PLAYER && IsMounted()) + if (GetTypeId() == TYPEID_PLAYER && IsMounted()) return false; // nobody can attack GM in GM-mode - if(victim->GetTypeId() == TYPEID_PLAYER) + if (victim->GetTypeId() == TYPEID_PLAYER) { - if(victim->ToPlayer()->isGameMaster()) + if (victim->ToPlayer()->isGameMaster()) return false; } else { - if(victim->ToCreature()->IsInEvadeMode()) + if (victim->ToCreature()->IsInEvadeMode()) return false; } // remove SPELL_AURA_MOD_UNATTACKABLE at attack (in case non-interruptible spells stun aura applied also that not let attack) - if(HasAuraType(SPELL_AURA_MOD_UNATTACKABLE)) + if (HasAuraType(SPELL_AURA_MOD_UNATTACKABLE)) RemoveAurasByType(SPELL_AURA_MOD_UNATTACKABLE); if (m_attacking) @@ -8892,7 +8892,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) addUnitState(UNIT_STAT_MELEE_ATTACKING); // set position before any AI calls/assistance - //if(GetTypeId() == TYPEID_UNIT) + //if (GetTypeId() == TYPEID_UNIT) // this->ToCreature()->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ()); if (GetTypeId() == TYPEID_UNIT) @@ -8908,7 +8908,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) } // delay offhand weapon attack to next attack time - if(haveOffhandWeapon()) + if (haveOffhandWeapon()) resetAttackTimer(OFF_ATTACK); if (meleeAttack) @@ -9213,7 +9213,7 @@ void Unit::SetMinion(Minion *minion, bool apply) { } } - //else if(minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET) + //else if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET) // AddUInt64Value(UNIT_FIELD_CRITTER, minion->GetGUID()); // PvP, FFAPvP @@ -9272,7 +9272,7 @@ void Unit::SetMinion(Minion *minion, bool apply) this->ToPlayer()->SendCooldownEvent(spellInfo); } - //if(minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) + //if (minion->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) { if (RemoveUInt64Value(UNIT_FIELD_SUMMON, minion->GetGUID())) { @@ -9280,7 +9280,7 @@ void Unit::SetMinion(Minion *minion, bool apply) for (ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) { // do not use this check, creature do not have charm guid - //if(GetCharmGUID() == (*itr)->GetGUID()) + //if (GetCharmGUID() == (*itr)->GetGUID()) if (GetGUID() == (*itr)->GetCharmerGUID()) continue; @@ -9311,7 +9311,7 @@ void Unit::SetMinion(Minion *minion, bool apply) } } } - //else if(minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET) + //else if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET) // RemoveUInt64Value(UNIT_FIELD_CRITTER, minion->GetGUID()); } } @@ -9388,7 +9388,7 @@ void Unit::SetCharm(Unit* charm, bool apply) charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); charm->ToPlayer()->UpdatePvPState(); } - else if(Player *player = charm->GetCharmerOrOwnerPlayerOrPlayerItself()) + else if (Player *player = charm->GetCharmerOrOwnerPlayerOrPlayerItself()) { charm->m_ControlledByPlayer = true; charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); @@ -11233,9 +11233,9 @@ void Unit::Mount(uint32 mount, uint32 VehicleId) this->ToPlayer()->UnsummonPetTemporaryIfAny(); } - if(VehicleId !=0) + if (VehicleId !=0) { - if(VehicleEntry const *ve = sVehicleStore.LookupEntry(VehicleId)) + if (VehicleEntry const *ve = sVehicleStore.LookupEntry(VehicleId)) { if (CreateVehicleKit(VehicleId)) @@ -11280,7 +11280,7 @@ void Unit::Unmount() else this->ToPlayer()->ResummonPetTemporaryUnSummonedIfAny(); } - if(GetTypeId()==TYPEID_PLAYER && GetVehicleKit()) + if (GetTypeId()==TYPEID_PLAYER && GetVehicleKit()) { // Send other players that we are no longer a vehicle WorldPacket data( SMSG_PLAYER_VEHICLE_DATA, 8+4 ); @@ -11442,7 +11442,7 @@ bool Unit::canAttack(Unit const* target, bool force) const else if (!IsHostileTo(target)) return false; - //if(m_Vehicle && m_Vehicle == target->m_Vehicle) + //if (m_Vehicle && m_Vehicle == target->m_Vehicle) // return true; if (!target->isAttackableByAOE() || target->hasUnitState(UNIT_STAT_DIED)) @@ -12459,7 +12459,7 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Un if (group == DIMINISHING_TAUNT) { - if(GetTypeId() == TYPEID_UNIT && (((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH)) + if (GetTypeId() == TYPEID_UNIT && (((Creature*)this)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH)) { DiminishingLevels diminish = Level; switch(diminish) @@ -15224,8 +15224,8 @@ Unit *Unit::GetVehicleBase() const Creature *Unit::GetVehicleCreatureBase() const { - if( Unit *veh = GetVehicleBase()) - if( Creature *c = veh->ToCreature()) + if ( Unit *veh = GetVehicleBase()) + if ( Creature *c = veh->ToCreature()) return c; return NULL; @@ -15550,7 +15550,7 @@ float Unit::GetCombatRatingReduction(CombatRating cr) const { // Player's pet get resilience from owner if (Unit* owner = GetOwner()) - if(owner->GetTypeId() == TYPEID_PLAYER) + if (owner->GetTypeId() == TYPEID_PLAYER) return ((Player*)owner)->GetRatingBonusValue(cr); } @@ -15644,7 +15644,7 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form) return 8571; } } - else if(Player::TeamForRace(getRace())==ALLIANCE) + else if (Player::TeamForRace(getRace())==ALLIANCE) return 892; else return 8571; @@ -15723,14 +15723,14 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form) return 2289; } } - else if(Player::TeamForRace(getRace())==ALLIANCE) + else if (Player::TeamForRace(getRace())==ALLIANCE) return 2281; else return 2289; case FORM_TRAVEL: return 632; case FORM_AQUA: - if(Player::TeamForRace(getRace())==ALLIANCE) + if (Player::TeamForRace(getRace())==ALLIANCE) return 2428; else return 2428; @@ -15741,17 +15741,17 @@ uint32 Unit::GetModelForForm(ShapeshiftForm form) case FORM_GHOSTWOLF: return 4613; case FORM_FLIGHT: - if(Player::TeamForRace(getRace())==ALLIANCE) + if (Player::TeamForRace(getRace())==ALLIANCE) return 20857; else return 20872; case FORM_MOONKIN: - if(Player::TeamForRace(getRace())==ALLIANCE) + if (Player::TeamForRace(getRace())==ALLIANCE) return 15374; else return 15375; case FORM_FLIGHT_EPIC: - if(Player::TeamForRace(getRace())==ALLIANCE) + if (Player::TeamForRace(getRace())==ALLIANCE) return 21243; else return 21244; @@ -15841,8 +15841,8 @@ void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId) this->ToPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED); // drop flag at invisible in bg - if(this->ToPlayer()->InBattleGround()) - if(BattleGround *bg = this->ToPlayer()->GetBattleGround()) + if (this->ToPlayer()->InBattleGround()) + if (BattleGround *bg = this->ToPlayer()->GetBattleGround()) bg->EventPlayerDroppedFlag(this->ToPlayer()); } @@ -16073,12 +16073,12 @@ bool Unit::SetPosition(float x, float y, float z, float orientation, bool telepo RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOVE); // move and update visible state if need - if(GetTypeId() == TYPEID_PLAYER) + if (GetTypeId() == TYPEID_PLAYER) GetMap()->PlayerRelocation((Player*)this, x, y, z, orientation); else GetMap()->CreatureRelocation(this->ToCreature(), x, y, z, orientation); } - else if(turn) + else if (turn) SetOrientation(orientation); if ((relocated || turn) && IsVehicle()) |