diff options
Diffstat (limited to 'src/game/SpellMgr.cpp')
-rw-r--r-- | src/game/SpellMgr.cpp | 243 |
1 files changed, 120 insertions, 123 deletions
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 357ea3bc3e3..119412da607 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1915,7 +1915,7 @@ void SpellMgr::LoadSpellScriptTarget() QueryResult *result = WorldDatabase.Query("SELECT entry,type,targetEntry FROM spell_script_target"); - if(!result) + if (!result) { barGoLink bar(1); @@ -1939,14 +1939,14 @@ void SpellMgr::LoadSpellScriptTarget() SpellEntry const* spellProto = sSpellStore.LookupEntry(spellId); - if(!spellProto) + if (!spellProto) { sLog.outErrorDb("Table `spell_script_target`: spellId %u listed for TargetEntry %u does not exist.",spellId,targetEntry); continue; } /*bool targetfound = false; - for (int i = 0; i <3; ++i) + for (uint8 i = 0; i < 3; ++i) { if( spellProto->EffectImplicitTargetA[i]==TARGET_UNIT_NEARBY_ENTRY || spellProto->EffectImplicitTargetB[i]==TARGET_UNIT_NEARBY_ENTRY || @@ -1957,13 +1957,13 @@ void SpellMgr::LoadSpellScriptTarget() break; } } - if(!targetfound) + if (!targetfound) { sLog.outErrorDb("Table `spell_script_target`: spellId %u listed for TargetEntry %u does not have any implicit target TARGET_UNIT_NEARBY_ENTRY(38) or TARGET_DST_NEARBY_ENTRY (46).",spellId,targetEntry); continue; }*/ - if( type >= MAX_SPELL_TARGET_TYPE ) + if (type >= MAX_SPELL_TARGET_TYPE) { sLog.outErrorDb("Table `spell_script_target`: target type %u for TargetEntry %u is incorrect.",type,targetEntry); continue; @@ -1973,35 +1973,35 @@ void SpellMgr::LoadSpellScriptTarget() { case SPELL_TARGET_TYPE_GAMEOBJECT: { - if( targetEntry==0 ) + if (targetEntry == 0) break; - if(!sGOStorage.LookupEntry<GameObjectInfo>(targetEntry)) + if (!sGOStorage.LookupEntry<GameObjectInfo>(targetEntry)) { - sLog.outErrorDb("Table `spell_script_target`: gameobject template entry %u does not exist.",targetEntry); + sLog.outErrorDb("Table `spell_script_target`: gameobject template entry %u does not exist.", targetEntry); continue; } break; } case SPELL_TARGET_TYPE_CONTROLLED: - if( targetEntry==0 ) - sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.",targetEntry); + if (targetEntry == 0) + sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.", targetEntry); 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; }*/ - if(targetEntry && !sCreatureStorage.LookupEntry<CreatureInfo>(targetEntry)) + if (targetEntry && !sCreatureStorage.LookupEntry<CreatureInfo>(targetEntry)) { - sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.",targetEntry); + sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.", targetEntry); continue; } const CreatureInfo* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(targetEntry); - if(spellId == 30427 && !cInfo->SkinLootId) + if (spellId == 30427 && !cInfo->SkinLootId) { sLog.outErrorDb("Table `spell_script_target` has creature %u as a target of spellid 30427, but this creature has no skinlootid. Gas extraction will not work!", cInfo->Entry); continue; @@ -2010,7 +2010,7 @@ void SpellMgr::LoadSpellScriptTarget() } } - mSpellScriptTarget.insert(SpellScriptTarget::value_type(spellId,SpellTargetEntry(SpellScriptTargetType(type),targetEntry))); + mSpellScriptTarget.insert(SpellScriptTarget::value_type(spellId, SpellTargetEntry(SpellScriptTargetType(type), targetEntry))); ++count; } while (result->NextRow()); @@ -2021,13 +2021,13 @@ void SpellMgr::LoadSpellScriptTarget() for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) { SpellEntry const * spellInfo = sSpellStore.LookupEntry(i); - if(!spellInfo) + if (!spellInfo) continue; bool found = false; - for (int j = 0; j < 3; ++j) + for (uint8 j = 0; j < 3; ++j) { - switch(spellInfo->EffectImplicitTargetA[j]) + switch (spellInfo->EffectImplicitTargetA[j]) { case TARGET_UNIT_AREA_ENTRY_SRC: case TARGET_UNIT_AREA_ENTRY_DST: @@ -2037,9 +2037,9 @@ void SpellMgr::LoadSpellScriptTarget() found = true; break; } - if(found) + if (found) break; - switch(spellInfo->EffectImplicitTargetB[j]) + switch (spellInfo->EffectImplicitTargetB[j]) { case TARGET_UNIT_AREA_ENTRY_SRC: case TARGET_UNIT_AREA_ENTRY_DST: @@ -2049,13 +2049,13 @@ void SpellMgr::LoadSpellScriptTarget() found = true; break; } - if(found) + if (found) break; } - if(found) + if (found) { SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(i); - if(bounds.first==bounds.second) + if (bounds.first == bounds.second) sLog.outDebug("Spell (ID: %u) does not have record in `spell_script_target`", i); } } @@ -2072,19 +2072,19 @@ void SpellMgr::LoadSpellPetAuras() // 0 1 2 3 QueryResult *result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell pet auras", count ); + sLog.outString( ">> Loaded %u spell pet auras", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -2098,10 +2098,8 @@ void SpellMgr::LoadSpellPetAuras() uint32 aura = fields[3].GetUInt32(); SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell<<8) + eff); - if(itr != mSpellPetAuraMap.end()) - { + if (itr != mSpellPetAuraMap.end()) itr->second.AddAura(pet, aura); - } else { SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell); @@ -2130,7 +2128,7 @@ void SpellMgr::LoadSpellPetAuras() } ++count; - } while( result->NextRow() ); + } while (result->NextRow()); delete result; @@ -2159,7 +2157,7 @@ void SpellMgr::LoadPetLevelupSpellMap() for (uint32 k = 0; k < sSkillLineAbilityStore.GetNumRows(); ++k) { SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(k); - if( !skillLine ) + if (!skillLine) continue; //if (skillLine->skillId!=creatureFamily->skillLine[0] && @@ -2169,22 +2167,22 @@ void SpellMgr::LoadPetLevelupSpellMap() if (skillLine->skillId!=creatureFamily->skillLine[j]) continue; - if(skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL) + if (skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL) continue; SpellEntry const *spell = sSpellStore.LookupEntry(skillLine->spellId); - if(!spell) // not exist or triggered or talent + if (!spell) // not exist or triggered or talent continue; - if(!spell->spellLevel) + if (!spell->spellLevel) continue; - PetLevelupSpellSet& spellSet = mPetLevelupSpellMap[creatureFamily->ID]; - if(spellSet.empty()) - ++family_count; + PetLevelupSpellSet& spellSet = mPetLevelupSpellMap[creatureFamily->ID]; + if (spellSet.empty()) + ++family_count; - spellSet.insert(PetLevelupSpellSet::value_type(spell->spellLevel,spell->Id)); - count++; + spellSet.insert(PetLevelupSpellSet::value_type(spell->spellLevel,spell->Id)); + ++count; } } } @@ -2197,21 +2195,21 @@ bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntr { // skip empty list; bool have_spell = false; - for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) + for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) { - if(petDefSpells.spellid[j]) + if (petDefSpells.spellid[j]) { have_spell = true; break; } } - if(!have_spell) + if (!have_spell) return false; // remove duplicates with levelupSpells if any if(PetLevelupSpellSet const *levelupSpells = cInfo->family ? spellmgr.GetPetLevelupSpellList(cInfo->family) : NULL) { - for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) + for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) { if(!petDefSpells.spellid[j]) continue; @@ -2229,9 +2227,9 @@ bool LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntr // skip empty list; have_spell = false; - for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) + for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) { - if(petDefSpells.spellid[j]) + if (petDefSpells.spellid[j]) { have_spell = true; break; @@ -2248,23 +2246,23 @@ void SpellMgr::LoadPetDefaultSpells() uint32 countCreature = 0; uint32 countData = 0; - for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i ) + for (uint32 i = 0; i < sCreatureStorage.MaxEntry; ++i) { CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i); - if(!cInfo) + if (!cInfo) continue; - if(!cInfo->PetSpellDataId) + if (!cInfo->PetSpellDataId) continue; // for creature with PetSpellDataId get default pet spells from dbc CreatureSpellDataEntry const* spellDataEntry = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId); - if(!spellDataEntry) + if (!spellDataEntry) continue; - int32 petSpellsId = -(int32)cInfo->PetSpellDataId; + int32 petSpellsId = -int32(cInfo->PetSpellDataId); PetDefaultSpellsEntry petDefSpells; - for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) + for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) petDefSpells.spellid[j] = spellDataEntry->spellId[j]; if(LoadPetDefaultSpells_helper(cInfo, petDefSpells)) @@ -2275,35 +2273,35 @@ void SpellMgr::LoadPetDefaultSpells() } // different summon spells - for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i ) + for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i) { SpellEntry const* spellEntry = sSpellStore.LookupEntry(i); - if(!spellEntry) + if (!spellEntry) continue; - for (int k = 0; k < 3; ++k) + for (uint8 k = 0; k < 3; ++k) { - if(spellEntry->Effect[k]==SPELL_EFFECT_SUMMON || spellEntry->Effect[k]==SPELL_EFFECT_SUMMON_PET) + if (spellEntry->Effect[k] == SPELL_EFFECT_SUMMON || spellEntry->Effect[k] == SPELL_EFFECT_SUMMON_PET) { uint32 creature_id = spellEntry->EffectMiscValue[k]; - CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(creature_id); - if(!cInfo) + CreatureInfo const *cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(creature_id); + if (!cInfo) continue; // already loaded - if(cInfo->PetSpellDataId) + if (cInfo->PetSpellDataId) continue; // for creature without PetSpellDataId get default pet spells from creature_template int32 petSpellsId = cInfo->Entry; - if(mPetDefaultSpellsMap.find(cInfo->Entry) != mPetDefaultSpellsMap.end()) + if (mPetDefaultSpellsMap.find(cInfo->Entry) != mPetDefaultSpellsMap.end()) continue; PetDefaultSpellsEntry petDefSpells; - for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) + for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) petDefSpells.spellid[j] = cInfo->spells[j]; - if(LoadPetDefaultSpells_helper(cInfo, petDefSpells)) + if (LoadPetDefaultSpells_helper(cInfo, petDefSpells)) { mPetDefaultSpellsMap[petSpellsId] = petDefSpells; ++countCreature; @@ -2317,18 +2315,18 @@ void SpellMgr::LoadPetDefaultSpells() } /// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc -bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) +bool SpellMgr::IsSpellValid(SpellEntry const *spellInfo, Player *pl, bool msg) { // not exist - if(!spellInfo) + if (!spellInfo) return false; bool need_check_reagents = false; // check effects - for (int i=0; i<3; ++i) + for (uint8 i = 0; i < 3; ++i) { - switch(spellInfo->Effect[i]) + switch (spellInfo->Effect[i]) { case 0: continue; @@ -2337,11 +2335,11 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) case SPELL_EFFECT_CREATE_ITEM: case SPELL_EFFECT_CREATE_ITEM_2: { - if(!ObjectMgr::GetItemPrototype( spellInfo->EffectItemType[i] )) + if(!ObjectMgr::GetItemPrototype(spellInfo->EffectItemType[i])) { - if(msg) + if (msg) { - if(pl) + if (pl) ChatHandler(pl).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...",spellInfo->Id,spellInfo->EffectItemType[i]); else sLog.outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...",spellInfo->Id,spellInfo->EffectItemType[i]); @@ -2354,12 +2352,12 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) } case SPELL_EFFECT_LEARN_SPELL: { - SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(spellInfo->EffectTriggerSpell[i]); - if( !IsSpellValid(spellInfo2,pl,msg) ) + SpellEntry const *spellInfo2 = sSpellStore.LookupEntry(spellInfo->EffectTriggerSpell[i]); + if (!IsSpellValid(spellInfo2,pl,msg)) { - if(msg) + if (msg) { - if(pl) + if (pl) ChatHandler(pl).PSendSysMessage("Spell %u learn to broken spell %u, and then...",spellInfo->Id,spellInfo->EffectTriggerSpell[i]); else sLog.outErrorDb("Spell %u learn to invalid spell %u, and then...",spellInfo->Id,spellInfo->EffectTriggerSpell[i]); @@ -2373,13 +2371,13 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) if(need_check_reagents) { - for (int j = 0; j < 8; ++j) + for (uint8 j = 0; j < 8; ++j) { - if(spellInfo->Reagent[j] > 0 && !ObjectMgr::GetItemPrototype( spellInfo->Reagent[j] )) + if (spellInfo->Reagent[j] > 0 && !ObjectMgr::GetItemPrototype(spellInfo->Reagent[j])) { - if(msg) + if (msg) { - if(pl) + if (pl) ChatHandler(pl).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...",spellInfo->Id,spellInfo->Reagent[j]); else sLog.outErrorDb("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...",spellInfo->Id,spellInfo->Reagent[j]); @@ -2405,18 +2403,18 @@ void SpellMgr::LoadSpellAreas() // 0 1 2 3 4 5 6 7 8 QueryResult *result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, aura_spell, racemask, gender, autocast FROM spell_area"); - if( !result ) + if (!result) { - barGoLink bar( 1 ); + barGoLink bar(1); bar.step(); sLog.outString(); - sLog.outString( ">> Loaded %u spell area requirements", count ); + sLog.outString(">> Loaded %u spell area requirements", count); return; } - barGoLink bar( result->GetRowCount() ); + barGoLink bar(result->GetRowCount()); do { @@ -2475,46 +2473,45 @@ void SpellMgr::LoadSpellAreas() sLog.outErrorDb("Spell %u listed in `spell_area` already listed with similar requirements.", spell); continue; } - } - if(spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId)) + if (spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId)) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong area (%u) requirement", spell,spellArea.areaId); continue; } - if(spellArea.questStart && !objmgr.GetQuestTemplate(spellArea.questStart)) + if (spellArea.questStart && !objmgr.GetQuestTemplate(spellArea.questStart)) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell,spellArea.questStart); continue; } - if(spellArea.questEnd) + if (spellArea.questEnd) { - if(!objmgr.GetQuestTemplate(spellArea.questEnd)) + if (!objmgr.GetQuestTemplate(spellArea.questEnd)) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell,spellArea.questEnd); continue; } - if(spellArea.questEnd==spellArea.questStart && !spellArea.questStartCanActive) + if (spellArea.questEnd==spellArea.questStart && !spellArea.questStartCanActive) { sLog.outErrorDb("Spell %u listed in `spell_area` have quest (%u) requirement for start and end in same time", spell,spellArea.questEnd); continue; } } - if(spellArea.auraSpell) + if (spellArea.auraSpell) { SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(spellArea.auraSpell)); - if(!spellInfo) + if (!spellInfo) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell,abs(spellArea.auraSpell)); continue; } - switch(spellInfo->EffectApplyAuraName[0]) + switch (spellInfo->EffectApplyAuraName[0]) { case SPELL_AURA_DUMMY: case SPELL_AURA_PHASE: @@ -2525,27 +2522,27 @@ void SpellMgr::LoadSpellAreas() continue; } - if(abs(spellArea.auraSpell)==spellArea.spellId) + if (abs(spellArea.auraSpell) == spellArea.spellId) { sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell,abs(spellArea.auraSpell)); continue; } // not allow autocast chains by auraSpell field (but allow use as alternative if not present) - if(spellArea.autocast && spellArea.auraSpell > 0) + if (spellArea.autocast && spellArea.auraSpell > 0) { bool chain = false; SpellAreaForAuraMapBounds saBound = GetSpellAreaForAuraMapBounds(spellArea.spellId); for (SpellAreaForAuraMap::const_iterator itr = saBound.first; itr != saBound.second; ++itr) { - if(itr->second->autocast && itr->second->auraSpell > 0) + if (itr->second->autocast && itr->second->auraSpell > 0) { chain = true; break; } } - if(chain) + if (chain) { sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell,spellArea.auraSpell); continue; @@ -2554,14 +2551,14 @@ void SpellMgr::LoadSpellAreas() SpellAreaMapBounds saBound2 = GetSpellAreaMapBounds(spellArea.auraSpell); for (SpellAreaMap::const_iterator itr2 = saBound2.first; itr2 != saBound2.second; ++itr2) { - if(itr2->second.autocast && itr2->second.auraSpell > 0) + if (itr2->second.autocast && itr2->second.auraSpell > 0) { chain = true; break; } } - if(chain) + if (chain) { sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell,spellArea.auraSpell); continue; @@ -2569,43 +2566,43 @@ void SpellMgr::LoadSpellAreas() } } - if(spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE)==0) + if (spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE)==0) { sLog.outErrorDb("Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell,spellArea.raceMask); continue; } - if(spellArea.gender!=GENDER_NONE && spellArea.gender!=GENDER_FEMALE && spellArea.gender!=GENDER_MALE) + if (spellArea.gender != GENDER_NONE && spellArea.gender != GENDER_FEMALE && spellArea.gender != GENDER_MALE) { - sLog.outErrorDb("Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell,spellArea.gender); + sLog.outErrorDb("Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender); continue; } SpellArea const* sa = &mSpellAreaMap.insert(SpellAreaMap::value_type(spell,spellArea))->second; // for search by current zone/subzone at zone/subzone change - if(spellArea.areaId) + if (spellArea.areaId) mSpellAreaForAreaMap.insert(SpellAreaForAreaMap::value_type(spellArea.areaId,sa)); // for search at quest start/reward - if(spellArea.questStart) + if (spellArea.questStart) { - if(spellArea.questStartCanActive) + if (spellArea.questStartCanActive) mSpellAreaForActiveQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart,sa)); else mSpellAreaForQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart,sa)); } // for search at quest start/reward - if(spellArea.questEnd) + if (spellArea.questEnd) mSpellAreaForQuestEndMap.insert(SpellAreaForQuestMap::value_type(spellArea.questEnd,sa)); // for search at aura apply - if(spellArea.auraSpell) + if (spellArea.auraSpell) mSpellAreaForAuraMap.insert(SpellAreaForAuraMap::value_type(abs(spellArea.auraSpell),sa)); ++count; - } while( result->NextRow() ); + } while(result->NextRow()); delete result; @@ -2622,7 +2619,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell AreaGroupEntry const* groupEntry = sAreaGroupStore.LookupEntry(spellInfo->AreaGroupId); while (groupEntry) { - for (uint32 i=0; i<6; ++i) + for (uint8 i = 0; i < 6; ++i) if (groupEntry->AreaId[i] == zone_id || groupEntry->AreaId[i] == area_id) found = true; if (found || !groupEntry->nextGroup) @@ -2639,7 +2636,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell if (spellInfo->AttributesEx4 & SPELL_ATTR_EX4_CAST_ONLY_IN_OUTLAND) { uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id); - MapEntry const* mapEntry = sMapStore.LookupEntry(v_map); + MapEntry const *mapEntry = sMapStore.LookupEntry(v_map); if (!mapEntry || mapEntry->addon < 1 || !mapEntry->IsContinent()) return SPELL_FAILED_INCORRECT_AREA; } @@ -2647,7 +2644,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell // raid instance limitation if (spellInfo->AttributesEx6 & SPELL_ATTR_EX6_NOT_IN_RAID_INSTANCE) { - MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); + MapEntry const *mapEntry = sMapStore.LookupEntry(map_id); if (!mapEntry || mapEntry->IsRaid()) return SPELL_FAILED_NOT_IN_RAID_INSTANCE; } @@ -2684,14 +2681,14 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell if (!mapEntry) return SPELL_FAILED_INCORRECT_AREA; - return zone_id == 4197 || mapEntry->IsBattleGround() && player && player->InBattleGround() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA; + return zone_id == 4197 || (mapEntry->IsBattleGround() && player && player->InBattleGround()) ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA; } case 44521: // Preparation { if (!player) return SPELL_FAILED_REQUIRES_AREA; - MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); + MapEntry const *mapEntry = sMapStore.LookupEntry(map_id); if (!mapEntry) return SPELL_FAILED_INCORRECT_AREA; @@ -2699,14 +2696,14 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell return SPELL_FAILED_REQUIRES_AREA; BattleGround* bg = player->GetBattleGround(); - return bg && bg->GetStatus()==STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA; + return bg && bg->GetStatus() == STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA; } case 32724: // Gold Team (Alliance) case 32725: // Green Team (Alliance) case 35774: // Gold Team (Horde) case 35775: // Green Team (Horde) { - MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); + MapEntry const *mapEntry = sMapStore.LookupEntry(map_id); if (!mapEntry) return SPELL_FAILED_INCORRECT_AREA; @@ -2717,22 +2714,22 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell if (!player) return SPELL_FAILED_REQUIRES_AREA; - MapEntry const* mapEntry = sMapStore.LookupEntry(map_id); - if(!mapEntry) + MapEntry const *mapEntry = sMapStore.LookupEntry(map_id); + if (!mapEntry) return SPELL_FAILED_INCORRECT_AREA; - if(!mapEntry->IsBattleArena()) + if (!mapEntry->IsBattleArena()) return SPELL_FAILED_REQUIRES_AREA; - BattleGround* bg = player->GetBattleGround(); - return bg && bg->GetStatus()==STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA; + BattleGround *bg = player->GetBattleGround(); + return bg && bg->GetStatus() == STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA; } } // aura limitations - for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - switch(spellInfo->EffectApplyAuraName[i]) + switch (spellInfo->EffectApplyAuraName[i]) { case SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED: case SPELL_AURA_FLY: @@ -2750,14 +2747,14 @@ void SpellMgr::LoadSkillLineAbilityMap() { mSkillLineAbilityMap.clear(); - barGoLink bar( sSkillLineAbilityStore.GetNumRows() ); + barGoLink bar(sSkillLineAbilityStore.GetNumRows()); uint32 count = 0; for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i) { bar.step(); SkillLineAbilityEntry const *SkillInfo = sSkillLineAbilityStore.LookupEntry(i); - if(!SkillInfo) + if (!SkillInfo) continue; mSkillLineAbilityMap.insert(SkillLineAbilityMap::value_type(SkillInfo->spellId,SkillInfo)); @@ -2771,7 +2768,7 @@ void SpellMgr::LoadSkillLineAbilityMap() DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto, bool triggered) { // Explicit Diminishing Groups - switch(spellproto->SpellFamilyName) + switch (spellproto->SpellFamilyName) { case SPELLFAMILY_GENERIC: // some generic arena related spells have by some strange reason MECHANIC_TURN @@ -2892,7 +2889,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto if (mechanic & (1<<MECHANIC_HORROR)) return DIMINISHING_DEATHCOIL; // Get by effect - for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS; ++i) + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { if (spellproto->EffectApplyAuraName[i] == SPELL_AURA_MOD_TAUNT) return DIMINISHING_TAUNT; |