diff options
Diffstat (limited to 'src/game/SpellMgr.cpp')
-rw-r--r-- | src/game/SpellMgr.cpp | 236 |
1 files changed, 118 insertions, 118 deletions
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index abea24dd0ba..011b8c0e13d 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -263,7 +263,7 @@ bool SpellMgr::IsSrcTargetSpell(SpellEntry const *spellInfo) const { for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i) { - if(SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_AREA_SRC || SpellTargetType[spellInfo->EffectImplicitTargetB[i]] == TARGET_TYPE_AREA_SRC) + if (SpellTargetType[spellInfo->EffectImplicitTargetA[i]] == TARGET_TYPE_AREA_SRC || SpellTargetType[spellInfo->EffectImplicitTargetB[i]] == TARGET_TYPE_AREA_SRC) return true; } return false; @@ -271,20 +271,20 @@ bool SpellMgr::IsSrcTargetSpell(SpellEntry const *spellInfo) const int32 GetSpellDuration(SpellEntry const *spellInfo) { - if(!spellInfo) + if (!spellInfo) return 0; SpellDurationEntry const *du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex); - if(!du) + if (!du) return 0; return (du->Duration[0] == -1) ? -1 : abs(du->Duration[0]); } int32 GetSpellMaxDuration(SpellEntry const *spellInfo) { - if(!spellInfo) + if (!spellInfo) return 0; SpellDurationEntry const *du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex); - if(!du) + if (!du) return 0; return (du->Duration[2] == -1) ? -1 : abs(du->Duration[2]); } @@ -309,7 +309,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell * spell) SpellCastTimesEntry const *spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex); // not all spells have cast time index and this is all is pasiive abilities - if(!spellCastTimeEntry) + if (!spellCastTimeEntry) return 0; int32 castTime = spellCastTimeEntry->CastTime; @@ -333,7 +333,7 @@ bool IsPassiveSpell(uint32 spellId) bool IsPassiveSpell(SpellEntry const * spellInfo) { - if(spellInfo->Attributes & SPELL_ATTR_PASSIVE) + if (spellInfo->Attributes & SPELL_ATTR_PASSIVE) return true; return false; } @@ -341,11 +341,11 @@ bool IsPassiveSpell(SpellEntry const * spellInfo) bool IsAutocastableSpell(uint32 spellId) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + if (!spellInfo) return false; - if(spellInfo->Attributes & SPELL_ATTR_PASSIVE) + if (spellInfo->Attributes & SPELL_ATTR_PASSIVE) return false; - if(spellInfo->AttributesEx & SPELL_ATTR_EX_UNAUTOCASTABLE_BY_PET) + if (spellInfo->AttributesEx & SPELL_ATTR_EX_UNAUTOCASTABLE_BY_PET) return false; return true; } @@ -406,10 +406,10 @@ uint32 CalculatePowerCost(SpellEntry const * spellInfo, Unit const * caster, Spe if ( spellInfo->AttributesEx4 & SPELL_ATTR_EX4_SPELL_VS_EXTEND_COST ) powerCost += caster->GetAttackTime(OFF_ATTACK)/100; // Apply cost mod by spell - if(Player* modOwner = caster->GetSpellModOwner()) + if (Player* modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COST, powerCost); - if(spellInfo->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION) + if (spellInfo->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION) powerCost = int32(powerCost/ (1.117f* spellInfo->spellLevel / caster->getLevel() -0.1327f)); // PCT mod from user auras by school @@ -465,18 +465,18 @@ AuraState GetSpellAuraState(SpellEntry const * spellInfo) return AURA_STATE_SWIFTMEND; // Deadly poison aura state - if(spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && spellInfo->SpellFamilyFlags[0] & 0x10000) + if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && spellInfo->SpellFamilyFlags[0] & 0x10000) return AURA_STATE_DEADLY_POISON; // Enrage aura state - if(spellInfo->Dispel == DISPEL_ENRAGE) + if (spellInfo->Dispel == DISPEL_ENRAGE) return AURA_STATE_ENRAGE; // Bleeding aura state if (GetAllSpellMechanicMask(spellInfo) & 1<<MECHANIC_BLEED) return AURA_STATE_BLEEDING; - if(GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) + if (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) { for (uint8 i = 0; i<MAX_SPELL_EFFECTS; ++i) { @@ -495,7 +495,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo) case SPELLFAMILY_GENERIC: { // Food / Drinks (mostly) - if(spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) + if (spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) { bool food = false; bool drink = false; @@ -518,11 +518,11 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo) } } - if(food && drink) + if (food && drink) return SPELL_SPECIFIC_FOOD_AND_DRINK; - else if(food) + else if (food) return SPELL_SPECIFIC_FOOD; - else if(drink) + else if (drink) return SPELL_SPECIFIC_DRINK; } // scrolls effects @@ -597,7 +597,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo) return SPELL_SPECIFIC_STING; // only hunter aspects have this (but not all aspects in hunter family) - if( spellInfo->SpellFamilyFlags.HasFlag(0x00380000, 0x00440000, 0x00001010)) + if ( spellInfo->SpellFamilyFlags.HasFlag(0x00380000, 0x00440000, 0x00001010)) return SPELL_SPECIFIC_ASPECT; break; @@ -615,7 +615,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo) return SPELL_SPECIFIC_JUDGEMENT; // only paladin auras have this (for palaldin class family) - if( spellInfo->SpellFamilyFlags[2] & 0x00000020 ) + if ( spellInfo->SpellFamilyFlags[2] & 0x00000020 ) return SPELL_SPECIFIC_AURA; break; @@ -637,7 +637,7 @@ SpellSpecific GetSpellSpecific(SpellEntry const * spellInfo) for (int i = 0; i < 3; ++i) { - if(spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA) + if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA) { switch(spellInfo->EffectApplyAuraName[i]) { @@ -800,28 +800,28 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con case SPELL_AURA_MOD_HEALING_PCT: case SPELL_AURA_MOD_HEALING_DONE: case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE: - if(spellproto->CalculateSimpleValue(effIndex) < 0) + if (spellproto->CalculateSimpleValue(effIndex) < 0) return false; break; case SPELL_AURA_MOD_DAMAGE_TAKEN: // dependent from bas point sign (positive -> negative) - if(spellproto->CalculateSimpleValue(effIndex) > 0) + if (spellproto->CalculateSimpleValue(effIndex) > 0) return false; break; case SPELL_AURA_MOD_CRIT_PCT: case SPELL_AURA_MOD_SPELL_CRIT_CHANCE: - if(spellproto->CalculateSimpleValue(effIndex) > 0) + if (spellproto->CalculateSimpleValue(effIndex) > 0) return true; // some expected positive spells have SPELL_ATTR_EX_NEGATIVE break; case SPELL_AURA_ADD_TARGET_TRIGGER: return true; case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: case SPELL_AURA_PERIODIC_TRIGGER_SPELL: - if(!deep) + if (!deep) { uint32 spellTriggeredId = spellproto->EffectTriggerSpell[effIndex]; SpellEntry const *spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId); - if(spellTriggeredProto) + if (spellTriggeredProto) { // non-positive targets of main spell return early for (int i = 0; i < 3; ++i) @@ -830,7 +830,7 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con continue; // if non-positive trigger cast targeted to positive target this main cast is non-positive // this will place this spell auras as debuffs - if(IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex],spellTriggeredProto->EffectImplicitTargetB[effIndex]) && !_isPositiveEffect(spellTriggeredId,i, true)) + if (IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[effIndex],spellTriggeredProto->EffectImplicitTargetB[effIndex]) && !_isPositiveEffect(spellTriggeredId,i, true)) return false; } } @@ -839,11 +839,11 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con // many positive auras have negative triggered spells at damage for example and this not make it negative (it can be canceled for example) break; case SPELL_AURA_MOD_STUN: //have positive and negative spells, we can't sort its correctly at this moment. - if(effIndex==0 && spellproto->Effect[1]==0 && spellproto->Effect[2]==0) + if (effIndex==0 && spellproto->Effect[1]==0 && spellproto->Effect[2]==0) return false; // but all single stun aura spells is negative break; case SPELL_AURA_MOD_PACIFY_SILENCE: - if(spellproto->Id == 24740) // Wisp Costume + if (spellproto->Id == 24740) // Wisp Costume return true; return false; case SPELL_AURA_MOD_ROOT: @@ -855,15 +855,15 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con return false; case SPELL_AURA_PERIODIC_DAMAGE: // used in positive spells also. // part of negative spell if casted at self (prevent cancel) - if(spellproto->EffectImplicitTargetA[effIndex] == TARGET_UNIT_CASTER) + if (spellproto->EffectImplicitTargetA[effIndex] == TARGET_UNIT_CASTER) return false; break; case SPELL_AURA_MOD_DECREASE_SPEED: // used in positive spells also // part of positive spell if casted at self - if(spellproto->EffectImplicitTargetA[effIndex] != TARGET_UNIT_CASTER) + if (spellproto->EffectImplicitTargetA[effIndex] != TARGET_UNIT_CASTER) return false; // but not this if this first effect (didn't find better check) - if(spellproto->Attributes & 0x4000000 && effIndex==0) + if (spellproto->Attributes & 0x4000000 && effIndex==0) return false; break; case SPELL_AURA_MECHANIC_IMMUNITY: @@ -887,7 +887,7 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con switch(spellproto->EffectMiscValue[effIndex]) { case SPELLMOD_COST: // dependent from bas point sign (negative -> positive) - if(spellproto->CalculateSimpleValue(effIndex) > 0) + if (spellproto->CalculateSimpleValue(effIndex) > 0) { if (!deep) { @@ -920,11 +920,11 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con } // non-positive targets - if(!IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex],spellproto->EffectImplicitTargetB[effIndex])) + if (!IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex],spellproto->EffectImplicitTargetB[effIndex])) return false; // AttributesEx check - if(spellproto->AttributesEx & SPELL_ATTR_EX_NEGATIVE) + if (spellproto->AttributesEx & SPELL_ATTR_EX_NEGATIVE) return false; if (!deep && spellproto->EffectTriggerSpell[effIndex] @@ -939,14 +939,14 @@ bool SpellMgr::_isPositiveEffect(uint32 spellId, uint32 effIndex, bool deep) con bool IsPositiveSpell(uint32 spellId) { - if(!sSpellStore.LookupEntry(spellId)) // non-existing spells + if (!sSpellStore.LookupEntry(spellId)) // non-existing spells return false; return !(spellmgr.GetSpellCustomAttr(spellId) & SPELL_ATTR_CU_NEGATIVE); } bool IsPositiveEffect(uint32 spellId, uint32 effIndex) { - if(!sSpellStore.LookupEntry(spellId)) + if (!sSpellStore.LookupEntry(spellId)) return false; switch(effIndex) { @@ -991,7 +991,7 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI { // TODO - need better check // Equal icon and spellfamily - if( spellInfo1->SpellFamilyName == spellInfo2->SpellFamilyName && + if ( spellInfo1->SpellFamilyName == spellInfo2->SpellFamilyName && spellInfo1->SpellIconID == spellInfo2->SpellIconID ) return true; @@ -1002,7 +1002,7 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI { case SPELL_SPECIFIC_JUDGEMENT: case SPELL_SPECIFIC_MAGE_POLYMORPH: - if(GetSpellSpecific(spellInfo2) == spec1) + if (GetSpellSpecific(spellInfo2) == spec1) return true; break; default: @@ -1016,7 +1016,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 { // talents that learn spells can have stance requirements that need ignore // (this requirement only for client-side stance show in talent description) - if( GetTalentSpellCost(spellInfo->Id) > 0 && + if ( GetTalentSpellCost(spellInfo->Id) > 0 && (spellInfo->Effect[0]==SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[1]==SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[2]==SPELL_EFFECT_LEARN_SPELL) ) return SPELL_CAST_OK; @@ -1041,7 +1041,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells } - if(actAsShifted) + if (actAsShifted) { if (spellInfo->Attributes & SPELL_ATTR_NOT_SHAPESHIFT) // not while shapeshifted return SPELL_FAILED_NOT_SHAPESHIFT; @@ -1051,7 +1051,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 else { // needs shapeshift - if(!(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && spellInfo->Stances != 0) + if (!(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && spellInfo->Stances != 0) return SPELL_FAILED_ONLY_SHAPESHIFT; } @@ -1060,7 +1060,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 // TODO: Find a way to disable use of these spells clientside if (shapeInfo && shapeInfo->flags1 & 0x400) { - if(!(stanceMask & spellInfo->Stances)) + if (!(stanceMask & spellInfo->Stances)) return SPELL_FAILED_ONLY_SHAPESHIFT; } @@ -1075,7 +1075,7 @@ void SpellMgr::LoadSpellTargetPositions() // 0 1 2 3 4 5 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); - if( !result ) + if ( !result ) { barGoLink bar( 1 ); @@ -1106,7 +1106,7 @@ void SpellMgr::LoadSpellTargetPositions() st.target_Orientation = fields[5].GetFloat(); SpellEntry const* spellInfo = sSpellStore.LookupEntry(Spell_ID); - if(!spellInfo) + if (!spellInfo) { sLog.outErrorDb("Spell (ID:%u) listed in `spell_target_position` does not exist.",Spell_ID); continue; @@ -1115,26 +1115,26 @@ void SpellMgr::LoadSpellTargetPositions() bool found = false; for (int i = 0; i < 3; ++i) { - if( spellInfo->EffectImplicitTargetA[i]==TARGET_DST_DB || spellInfo->EffectImplicitTargetB[i]==TARGET_DST_DB ) + if ( spellInfo->EffectImplicitTargetA[i]==TARGET_DST_DB || spellInfo->EffectImplicitTargetB[i]==TARGET_DST_DB ) { found = true; break; } } - if(!found) + if (!found) { sLog.outErrorDb("Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DST_DB (17).",Spell_ID); continue; } MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId); - if(!mapEntry) + if (!mapEntry) { sLog.outErrorDb("Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.",Spell_ID,st.target_mapId); continue; } - if(st.target_X==0 && st.target_Y==0 && st.target_Z==0) + if (st.target_X==0 && st.target_Y==0 && st.target_Z==0) { sLog.outErrorDb("Spell (ID:%u) target coordinates not provided.",Spell_ID); continue; @@ -1149,7 +1149,7 @@ void SpellMgr::LoadSpellTargetPositions() for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) { SpellEntry const * spellInfo = sSpellStore.LookupEntry(i); - if(!spellInfo) + if (!spellInfo) continue; bool found = false; @@ -1161,7 +1161,7 @@ void SpellMgr::LoadSpellTargetPositions() found = true; break; } - if(found) + if (found) break; switch(spellInfo->EffectImplicitTargetB[j]) { @@ -1169,12 +1169,12 @@ void SpellMgr::LoadSpellTargetPositions() found = true; break; } - if(found) + if (found) break; } - if(found) + if (found) { -// if(!spellmgr.GetSpellTargetPosition(i)) +// if (!spellmgr.GetSpellTargetPosition(i)) // sLog.outDebug("Spell (ID: %u) does not have record in `spell_target_position`", i); } } @@ -1209,7 +1209,7 @@ void SpellMgr::LoadSpellProcEvents() // 0 1 2 3 4 5 6 7 8 9 10 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); - if( !result ) + if ( !result ) { barGoLink bar( 1 ); bar.step(); @@ -1275,7 +1275,7 @@ void SpellMgr::LoadSpellBonusess() uint32 count = 0; // 0 1 2 3 4 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); - if( !result ) + if ( !result ) { barGoLink bar( 1 ); bar.step(); @@ -1319,7 +1319,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr uint32 procEvent_procEx = PROC_EX_NONE; // check prockFlags for condition - if((procFlags & EventProcFlag) == 0) + if ((procFlags & EventProcFlag) == 0) return false; bool hasFamilyMask = false; @@ -1379,21 +1379,21 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr if (procSpell == NULL) { // Check (if set) for school (melee attack have Normal school) - if(spellProcEvent->schoolMask && (spellProcEvent->schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0) + if (spellProcEvent->schoolMask && (spellProcEvent->schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0) return false; } else // For spells need check school/spell family/family mask { // Check (if set) for school - if(spellProcEvent->schoolMask && (spellProcEvent->schoolMask & procSpell->SchoolMask) == 0) + if (spellProcEvent->schoolMask && (spellProcEvent->schoolMask & procSpell->SchoolMask) == 0) return false; // Check (if set) for spellFamilyName - if(spellProcEvent->spellFamilyName && (spellProcEvent->spellFamilyName != procSpell->SpellFamilyName)) + if (spellProcEvent->spellFamilyName && (spellProcEvent->spellFamilyName != procSpell->SpellFamilyName)) return false; // spellFamilyName is Ok need check for spellFamilyMask if present - if(spellProcEvent->spellFamilyMask) + if (spellProcEvent->spellFamilyMask) { if ((spellProcEvent->spellFamilyMask & procSpell->SpellFamilyFlags ) == 0) return false; @@ -1415,7 +1415,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr if (procEvent_procEx == PROC_EX_NONE) { // No extra req, so can trigger only for hit/crit - spell has to be active - if((procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && active) + if ((procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && active) return true; } else // Passive spells hits here only if resist/reflect/immune/evade @@ -1451,7 +1451,7 @@ void SpellMgr::LoadSpellGroups() // 0 1 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group"); - if( !result ) + if ( !result ) { barGoLink bar( 1 ); @@ -1541,7 +1541,7 @@ void SpellMgr::LoadSpellGroupStackRules() // 0 1 QueryResult_AutoPtr result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules"); - if( !result ) + if ( !result ) { barGoLink bar( 1 ); @@ -1635,22 +1635,22 @@ void SpellMgr::LoadSpellThreats() bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const { SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2); - if(!spellInfo_1 || !spellInfo_2) return false; - if(spellInfo_1->Id == spellId_2) return false; + if (!spellInfo_1 || !spellInfo_2) return false; + if (spellInfo_1->Id == spellId_2) return false; return GetFirstSpellInChain(spellInfo_1->Id)==GetFirstSpellInChain(spellId_2); } bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo) { - if(IsPassiveSpell(spellInfo->Id)) // ranked passive spell + if (IsPassiveSpell(spellInfo->Id)) // ranked passive spell return false; - if(spellInfo->powerType != POWER_MANA && spellInfo->powerType != POWER_HEALTH) + if (spellInfo->powerType != POWER_MANA && spellInfo->powerType != POWER_HEALTH) return false; - if(IsProfessionOrRidingSpell(spellInfo->Id)) + if (IsProfessionOrRidingSpell(spellInfo->Id)) return false; - if(spellmgr.IsSkillBonusSpell(spellInfo->Id)) + if (spellmgr.IsSkillBonusSpell(spellInfo->Id)) return false; // All stance spells. if any better way, change it. @@ -1682,12 +1682,12 @@ bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo) bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + if (!spellInfo) return false; for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i) { - if(spellInfo->Effect[i] == SPELL_EFFECT_SKILL) + if (spellInfo->Effect[i] == SPELL_EFFECT_SKILL) { uint32 skill = spellInfo->EffectMiscValue[i]; @@ -1702,12 +1702,12 @@ bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId) bool SpellMgr::IsProfessionSpell(uint32 spellId) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + if (!spellInfo) return false; for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i) { - if(spellInfo->Effect[i] == SPELL_EFFECT_SKILL) + if (spellInfo->Effect[i] == SPELL_EFFECT_SKILL) { uint32 skill = spellInfo->EffectMiscValue[i]; @@ -1722,12 +1722,12 @@ bool SpellMgr::IsProfessionSpell(uint32 spellId) bool SpellMgr::IsPrimaryProfessionSpell(uint32 spellId) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + if (!spellInfo) return false; for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS ; ++i) { - if(spellInfo->Effect[i] == SPELL_EFFECT_SKILL) + if (spellInfo->Effect[i] == SPELL_EFFECT_SKILL) { uint32 skill = spellInfo->EffectMiscValue[i]; @@ -1754,7 +1754,7 @@ bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const if (!pAbility || pAbility->learnOnGetSkill != ABILITY_LEARNED_ON_GET_PROFESSION_SKILL) continue; - if(pAbility->req_skill_value > 0) + if (pAbility->req_skill_value > 0) return true; } @@ -1764,13 +1764,13 @@ bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const { // ignore passive spells - if(IsPassiveSpell(spellInfo->Id)) + if (IsPassiveSpell(spellInfo->Id)) return spellInfo; bool needRankSelection = false; for (int i=0; i<3; ++i) { - if( IsPositiveEffect(spellInfo->Id, i) && ( + if ( IsPositiveEffect(spellInfo->Id, i) && ( spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA || spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY || spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID @@ -1782,17 +1782,17 @@ SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spell } // not required - if(!needRankSelection) + if (!needRankSelection) return spellInfo; for (uint32 nextSpellId = spellInfo->Id; nextSpellId != 0; nextSpellId = GetPrevSpellInChain(nextSpellId)) { SpellEntry const *nextSpellInfo = sSpellStore.LookupEntry(nextSpellId); - if(!nextSpellInfo) + if (!nextSpellInfo) break; // if found appropriate level - if(playerLevel + 10 >= nextSpellInfo->spellLevel) + if (playerLevel + 10 >= nextSpellInfo->spellLevel) return nextSpellInfo; // one rank less then @@ -1814,12 +1814,12 @@ void SpellMgr::LoadSpellLearnSkills() bar.step(); SpellEntry const* entry = sSpellStore.LookupEntry(spell); - if(!entry) + if (!entry) continue; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if(entry->Effect[i]==SPELL_EFFECT_SKILL) + if (entry->Effect[i]==SPELL_EFFECT_SKILL) { SpellLearnSkillNode dbc_node; dbc_node.skill = entry->EffectMiscValue[i]; @@ -1908,7 +1908,7 @@ void SpellMgr::LoadSpellLearnSpells() for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if(entry->Effect[i]==SPELL_EFFECT_LEARN_SPELL) + if (entry->Effect[i]==SPELL_EFFECT_LEARN_SPELL) { SpellLearnSpellNode dbc_node; dbc_node.spell = entry->EffectTriggerSpell[i]; @@ -1991,7 +1991,7 @@ void SpellMgr::LoadSpellScriptTarget() bool targetfound = false; for (uint8 i = 0; i < 3; ++i) { - if(spellProto->EffectImplicitTargetA[i]==TARGET_UNIT_AREA_ENTRY_SRC || + if (spellProto->EffectImplicitTargetA[i]==TARGET_UNIT_AREA_ENTRY_SRC || spellProto->EffectImplicitTargetB[i]==TARGET_UNIT_AREA_ENTRY_SRC || spellProto->EffectImplicitTargetA[i]==TARGET_UNIT_AREA_ENTRY_DST || spellProto->EffectImplicitTargetB[i]==TARGET_UNIT_AREA_ENTRY_DST || @@ -2041,7 +2041,7 @@ void SpellMgr::LoadSpellScriptTarget() default: { //players - /*if(targetEntry == 0) + /*if (targetEntry == 0) { sLog.outErrorDb("Table `spell_script_target`: target entry == 0 for not GO target type (%u).",type); continue; @@ -2262,11 +2262,11 @@ bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntr return false; // remove duplicates with levelupSpells if any - if(PetLevelupSpellSet const *levelupSpells = cInfo->family ? spellmgr.GetPetLevelupSpellList(cInfo->family) : NULL) + if (PetLevelupSpellSet const *levelupSpells = cInfo->family ? spellmgr.GetPetLevelupSpellList(cInfo->family) : NULL) { for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) { - if(!petDefSpells.spellid[j]) + if (!petDefSpells.spellid[j]) continue; for (PetLevelupSpellSet::const_iterator itr = levelupSpells->begin(); itr != levelupSpells->end(); ++itr) @@ -2324,7 +2324,7 @@ void SpellMgr::LoadPetDefaultSpells() for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) petDefSpells.spellid[j] = spellDataEntry->spellId[j]; - if(LoadPetDefaultSpells_helper(cInfo, petDefSpells)) + if (LoadPetDefaultSpells_helper(cInfo, petDefSpells)) { mPetDefaultSpellsMap[petSpellsId] = petDefSpells; ++countData; @@ -2402,9 +2402,9 @@ bool SpellMgr::IsSpellValid(SpellEntry const *spellInfo, Player *pl, bool msg) // skip auto-loot crafting spells, its not need explicit item info (but have special fake items sometime) if (!IsLootCraftingSpell(spellInfo)) { - if(msg) + if (msg) { - if(pl) + if (pl) ChatHandler(pl).PSendSysMessage("Craft spell %u not have create item entry.",spellInfo->Id); else sLog.outErrorDb("Craft spell %u not have create item entry.",spellInfo->Id); @@ -2448,7 +2448,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const *spellInfo, Player *pl, bool msg) } } - if(need_check_reagents) + if (need_check_reagents) { for (uint8 j = 0; j < 8; ++j) { @@ -2515,7 +2515,7 @@ void SpellMgr::LoadSpellAreas() if (const SpellEntry* spellInfo = sSpellStore.LookupEntry(spell)) { - if(spellArea.autocast) + if (spellArea.autocast) const_cast<SpellEntry*>(spellInfo)->Attributes |= SPELL_ATTR_CANT_CANCEL; } else @@ -2547,7 +2547,7 @@ void SpellMgr::LoadSpellAreas() break; } - if(!ok) + if (!ok) { sLog.outErrorDb("Spell %u listed in `spell_area` already listed with similar requirements.", spell); continue; @@ -2721,7 +2721,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell { for (SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) { - if(itr->second.IsFitToRequirements(player,zone_id,area_id)) + if (itr->second.IsFitToRequirements(player,zone_id,area_id)) return SPELL_CAST_OK; } return SPELL_FAILED_INCORRECT_AREA; @@ -2968,7 +2968,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto) { - if(!IsDiminishingReturnsGroupDurationLimited(group)) + if (!IsDiminishingReturnsGroupDurationLimited(group)) return 0; // Explicit diminishing duration @@ -3132,12 +3132,12 @@ bool SpellMgr::CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *sp return false; } - if(spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName) + if (spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName) return true; - if(!sameCaster) + if (!sameCaster) { - if(spellInfo_1->AttributesEx & SPELL_ATTR_EX_STACK_FOR_DIFF_CASTERS + if (spellInfo_1->AttributesEx & SPELL_ATTR_EX_STACK_FOR_DIFF_CASTERS || spellInfo_1->AttributesEx3 & SPELL_ATTR_EX3_STACK_FOR_DIFF_CASTERS) return true; @@ -3171,23 +3171,23 @@ bool SpellMgr::CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *sp if (spellId_1 == spellId_2) { // Hack for Incanter's Absorption - if(spellId_1 == 44413) + if (spellId_1 == 44413) return true; // same spell with same caster should not stack return false; } // use icon to check generic spells - if(!spellInfo_1->SpellFamilyName) + if (!spellInfo_1->SpellFamilyName) { - if(!spellInfo_1->SpellIconID || spellInfo_1->SpellIconID == 1 + if (!spellInfo_1->SpellIconID || spellInfo_1->SpellIconID == 1 || spellInfo_1->SpellIconID != spellInfo_2->SpellIconID) return true; } // use familyflag to check class spells else { - if(!spellInfo_1->SpellFamilyFlags + if (!spellInfo_1->SpellFamilyFlags || spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags) return true; } @@ -3198,7 +3198,7 @@ bool SpellMgr::CanAurasStack(SpellEntry const *spellInfo_1, SpellEntry const *sp //if spells do not have the same effect or aura or miscvalue, they will stack for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i] + if (spellInfo_1->Effect[i] != spellInfo_2->Effect[i] || spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i] || spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i]) // paladin resist aura return true; // need itemtype check? need an example to add that check @@ -3217,7 +3217,7 @@ bool IsDispelableBySpell(SpellEntry const * dispelSpell, uint32 spellId, bool de if (spellproto->AttributesEx & SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) return false; - if(dispelSpell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) + if (dispelSpell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) return true; return def; @@ -3483,7 +3483,7 @@ void SpellMgr::LoadSpellCustomAttr() case SPELL_EFFECT_JUMP: case SPELL_EFFECT_JUMP2: case SPELL_EFFECT_LEAP_BACK: - if(!spellInfo->speed && !spellInfo->SpellFamilyName) + if (!spellInfo->speed && !spellInfo->SpellFamilyName) spellInfo->speed = SPEED_CHARGE; mSpellCustomAttr[i] |= SPELL_ATTR_CU_CHARGE; count++; @@ -3815,7 +3815,7 @@ void SpellMgr::LoadSpellCustomAttr() { case SPELLFAMILY_WARRIOR: // Shout - if(spellInfo->SpellFamilyFlags[0] & 0x20000 || spellInfo->SpellFamilyFlags[1] & 0x20) + if (spellInfo->SpellFamilyFlags[0] & 0x20000 || spellInfo->SpellFamilyFlags[1] & 0x20) mSpellCustomAttr[i] |= SPELL_ATTR_CU_AURA_CC; else break; @@ -3823,13 +3823,13 @@ void SpellMgr::LoadSpellCustomAttr() break; case SPELLFAMILY_DRUID: // Starfall Target Selection - if(spellInfo->SpellFamilyFlags[2] & 0x100) + if (spellInfo->SpellFamilyFlags[2] & 0x100) spellInfo->MaxAffectedTargets = 2; // Starfall AOE Damage - else if(spellInfo->SpellFamilyFlags[2] & 0x800000) + else if (spellInfo->SpellFamilyFlags[2] & 0x800000) mSpellCustomAttr[i] |= SPELL_ATTR_CU_EXCLUDE_SELF; // Roar - else if(spellInfo->SpellFamilyFlags[0] & 0x8) + else if (spellInfo->SpellFamilyFlags[0] & 0x8) mSpellCustomAttr[i] |= SPELL_ATTR_CU_AURA_CC; else break; @@ -3837,7 +3837,7 @@ void SpellMgr::LoadSpellCustomAttr() break; // Do not allow Deadly throw and Slice and Dice to proc twice case SPELLFAMILY_ROGUE: - if(spellInfo->SpellFamilyFlags[1] & 0x1 || spellInfo->SpellFamilyFlags[0] & 0x40000) + if (spellInfo->SpellFamilyFlags[1] & 0x1 || spellInfo->SpellFamilyFlags[0] & 0x40000) spellInfo->AttributesEx4 |= SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST; else break; @@ -3875,7 +3875,7 @@ void SpellMgr::LoadEnchantCustomAttr() bar.step(); SpellEntry * spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(i); - if(!spellInfo) + if (!spellInfo) continue; // TODO: find a better check @@ -3884,7 +3884,7 @@ void SpellMgr::LoadEnchantCustomAttr() for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j) { - if(spellInfo->Effect[j] == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) + if (spellInfo->Effect[j] == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) { uint32 enchId = spellInfo->EffectMiscValue[j]; SpellItemEnchantmentEntry const *ench = sSpellItemEnchantmentStore.LookupEntry(enchId); @@ -3953,7 +3953,7 @@ void SpellMgr::LoadSpellLinked() continue; } - if(trigger > 0) + if (trigger > 0) { switch(type) { @@ -3967,9 +3967,9 @@ void SpellMgr::LoadSpellLinked() mSpellCustomAttr[-trigger] |= SPELL_ATTR_CU_LINK_REMOVE; } - if(type) //we will find a better way when more types are needed + if (type) //we will find a better way when more types are needed { - if(trigger > 0) + if (trigger > 0) trigger += SPELL_LINKED_MAX_SPELLS * type; else trigger -= SPELL_LINKED_MAX_SPELLS * type; |