diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index 51a647d5d..63143c50e 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -236,7 +236,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) continue; } - for(int i = 0; i < MAX_TEXT_ID; ++i) + for (int i = 0; i < MAX_TEXT_ID; ++i) { if (tmp.textId[i] && (tmp.textId[i] < MIN_DB_SCRIPT_STRING_ID || tmp.textId[i] >= MAX_DB_SCRIPT_STRING_ID)) { @@ -299,21 +299,21 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) if (float(tmp.questExplored.distance) > DEFAULT_VISIBILITY_DISTANCE) { sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", - tablename, tmp.questExplored.distance, tmp.id); + tablename, tmp.questExplored.distance, tmp.id); continue; } if (tmp.questExplored.distance && float(tmp.questExplored.distance) > DEFAULT_VISIBILITY_DISTANCE) { sLog.outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check", - tablename, tmp.questExplored.distance, tmp.id, DEFAULT_VISIBILITY_DISTANCE); + tablename, tmp.questExplored.distance, tmp.id, DEFAULT_VISIBILITY_DISTANCE); continue; } if (tmp.questExplored.distance && float(tmp.questExplored.distance) < INTERACTION_DISTANCE) { sLog.outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check", - tablename, tmp.questExplored.distance, tmp.id, INTERACTION_DISTANCE); + tablename, tmp.questExplored.distance, tmp.id, INTERACTION_DISTANCE); continue; } @@ -360,10 +360,10 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) } if (info->type == GAMEOBJECT_TYPE_FISHINGNODE || - info->type == GAMEOBJECT_TYPE_FISHINGHOLE || - info->type == GAMEOBJECT_TYPE_DOOR || - info->type == GAMEOBJECT_TYPE_BUTTON || - info->type == GAMEOBJECT_TYPE_TRAP) + info->type == GAMEOBJECT_TYPE_FISHINGHOLE || + info->type == GAMEOBJECT_TYPE_DOOR || + info->type == GAMEOBJECT_TYPE_BUTTON || + info->type == GAMEOBJECT_TYPE_TRAP) { sLog.outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tablename, info->id, tmp.id); continue; @@ -432,7 +432,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) if (!sSpellStore.LookupEntry(tmp.removeAura.spellId)) { sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u", - tablename, tmp.removeAura.spellId, tmp.id); + tablename, tmp.removeAura.spellId, tmp.id); continue; } break; @@ -442,7 +442,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) if (!sSpellStore.LookupEntry(tmp.castSpell.spellId)) { sLog.outErrorDb("Table `%s` using nonexistent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA or SCRIPT_COMMAND_CAST_SPELL for script id %u", - tablename, tmp.castSpell.spellId, tmp.id); + tablename, tmp.castSpell.spellId, tmp.id); continue; } break; @@ -452,7 +452,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) if (!sSoundEntriesStore.LookupEntry(tmp.playSound.soundId)) { sLog.outErrorDb("Table `%s` using nonexistent sound (id: %u) in SCRIPT_COMMAND_PLAY_SOUND for script id %u", - tablename, tmp.playSound.soundId, tmp.id); + tablename, tmp.playSound.soundId, tmp.id); continue; } break; @@ -462,13 +462,13 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) if (!ObjectMgr::GetItemPrototype(tmp.createItem.itemEntry)) { sLog.outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", - tablename, tmp.createItem.itemEntry, tmp.id); + tablename, tmp.createItem.itemEntry, tmp.id); continue; } if (!tmp.createItem.amount) { sLog.outErrorDb("Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u", - tablename, tmp.createItem.amount, tmp.id); + tablename, tmp.createItem.amount, tmp.id); continue; } break; @@ -483,7 +483,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) if (!sMovieStore.LookupEntry(tmp.playMovie.movieId)) { sLog.outErrorDb("Table `%s` use non-existing movie_id (id: %u) in SCRIPT_COMMAND_PLAY_MOVIE for script id %u", - tablename, tmp.playMovie.movieId, tmp.id); + tablename, tmp.playMovie.movieId, tmp.id); continue; } break; @@ -493,7 +493,7 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) if (tmp.movement.movementType >= MAX_DB_MOTION_TYPE) { sLog.outErrorDb("Table `%s` SCRIPT_COMMAND_MOVEMENT has invalid MovementType %u for script id %u", - tablename, tmp.movement.movementType, tmp.id); + tablename, tmp.movement.movementType, tmp.id); continue; } @@ -630,7 +630,8 @@ void ScriptMgr::LoadScripts(ScriptMapMapName& scripts, const char* tablename) scripts.second[tmp.id].insert(ScriptMap::value_type(tmp.delay, tmp)); ++count; - } while(result->NextRow()); + } + while (result->NextRow()); delete result; @@ -643,7 +644,7 @@ void ScriptMgr::LoadGameObjectScripts() LoadScripts(sGameObjectScripts, "gameobject_scripts"); // check ids - for(ScriptMapMap::const_iterator itr = sGameObjectScripts.second.begin(); itr != sGameObjectScripts.second.end(); ++itr) + for (ScriptMapMap::const_iterator itr = sGameObjectScripts.second.begin(); itr != sGameObjectScripts.second.end(); ++itr) { if (!sObjectMgr.GetGOData(itr->first)) sLog.outErrorDb("Table `gameobject_scripts` has not existing gameobject (GUID: %u) as script id", itr->first); @@ -667,7 +668,7 @@ void ScriptMgr::LoadQuestEndScripts() LoadScripts(sQuestEndScripts, "quest_end_scripts"); // check ids - for(ScriptMapMap::const_iterator itr = sQuestEndScripts.second.begin(); itr != sQuestEndScripts.second.end(); ++itr) + for (ScriptMapMap::const_iterator itr = sQuestEndScripts.second.begin(); itr != sQuestEndScripts.second.end(); ++itr) { if (!sObjectMgr.GetQuestTemplate(itr->first)) sLog.outErrorDb("Table `quest_end_scripts` has not existing quest (Id: %u) as script id", itr->first); @@ -679,7 +680,7 @@ void ScriptMgr::LoadQuestStartScripts() LoadScripts(sQuestStartScripts, "quest_start_scripts"); // check ids - for(ScriptMapMap::const_iterator itr = sQuestStartScripts.second.begin(); itr != sQuestStartScripts.second.end(); ++itr) + for (ScriptMapMap::const_iterator itr = sQuestStartScripts.second.begin(); itr != sQuestStartScripts.second.end(); ++itr) { if (!sObjectMgr.GetQuestTemplate(itr->first)) sLog.outErrorDb("Table `quest_start_scripts` has not existing quest (Id: %u) as script id", itr->first); @@ -723,7 +724,7 @@ void ScriptMgr::LoadEventScripts() std::set evt_scripts; // Load all possible script entries from gameobjects - for(uint32 i = 1; i < sGOStorage.MaxEntry; ++i) + for (uint32 i = 1; i < sGOStorage.MaxEntry; ++i) { if (GameObjectInfo const* goInfo = sGOStorage.LookupEntry(i)) { @@ -745,12 +746,12 @@ void ScriptMgr::LoadEventScripts() } // Load all possible script entries from spells - for(uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) + for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) { SpellEntry const* spell = sSpellStore.LookupEntry(i); if (spell) { - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT) { @@ -761,9 +762,9 @@ void ScriptMgr::LoadEventScripts() } } - for(size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx) + for (size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx) { - for(size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx) + for (size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx) { TaxiPathNodeEntry const& node = sTaxiPathNodesByPath[path_idx][node_idx]; @@ -776,12 +777,12 @@ void ScriptMgr::LoadEventScripts() } // Then check if all scripts are in above list of possible script entries - for(ScriptMapMap::const_iterator itr = sEventScripts.second.begin(); itr != sEventScripts.second.end(); ++itr) + for (ScriptMapMap::const_iterator itr = sEventScripts.second.begin(); itr != sEventScripts.second.end(); ++itr) { std::set::const_iterator itr2 = evt_scripts.find(itr->first); if (itr2 == evt_scripts.end()) sLog.outErrorDb("Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field, type 29 or any spell effect %u or path taxi node data", - itr->first, SPELL_EFFECT_SEND_EVENT); + itr->first, SPELL_EFFECT_SEND_EVENT); } } @@ -805,7 +806,7 @@ void ScriptMgr::LoadDbScriptStrings() std::set ids; - for(int32 i = MIN_DB_SCRIPT_STRING_ID; i < MAX_DB_SCRIPT_STRING_ID; ++i) + for (int32 i = MIN_DB_SCRIPT_STRING_ID; i < MAX_DB_SCRIPT_STRING_ID; ++i) if (sObjectMgr.GetMangosStringLocale(i)) ids.insert(i); @@ -820,22 +821,22 @@ void ScriptMgr::LoadDbScriptStrings() sWaypointMgr.CheckTextsExistance(ids); - for(std::set::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) + for (std::set::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) sLog.outErrorDb("Table `db_script_string` has unused string id %u", *itr); } void ScriptMgr::CheckScriptTexts(ScriptMapMapName const& scripts, std::set& ids) { - for(ScriptMapMap::const_iterator itrMM = scripts.second.begin(); itrMM != scripts.second.end(); ++itrMM) + for (ScriptMapMap::const_iterator itrMM = scripts.second.begin(); itrMM != scripts.second.end(); ++itrMM) { - for(ScriptMap::const_iterator itrM = itrMM->second.begin(); itrM != itrMM->second.end(); ++itrM) + for (ScriptMap::const_iterator itrM = itrMM->second.begin(); itrM != itrMM->second.end(); ++itrM) { if (itrM->second.command == SCRIPT_COMMAND_TALK) { - for(int i = 0; i < MAX_TEXT_ID; ++i) + for (int i = 0; i < MAX_TEXT_ID; ++i) { if (itrM->second.textId[i] && !sObjectMgr.GetMangosStringLocale(itrM->second.textId[i])) - sLog.outErrorDb( "Table `db_script_string` is missing string id %u, used in database script table %s id %u.", itrM->second.textId[i], scripts.first, itrMM->first); + sLog.outErrorDb("Table `db_script_string` is missing string id %u, used in database script table %s id %u.", itrM->second.textId[i], scripts.first, itrMM->first); if (ids.find(itrM->second.textId[i]) != ids.end()) ids.erase(itrM->second.textId[i]); @@ -877,7 +878,7 @@ bool ScriptAction::GetScriptCommandObject(const ObjectGuid guid, bool includeIte resultObject = HashMapHolder::Find(guid); break; case HIGHGUID_ITEM: - // case HIGHGUID_CONTAINER: ==HIGHGUID_ITEM + // case HIGHGUID_CONTAINER: ==HIGHGUID_ITEM { if (includeItem) { @@ -1042,7 +1043,7 @@ void ScriptAction::HandleScriptStep() if (m_script->textId[1]) { int i = 2; - for(; i < MAX_TEXT_ID; ++i) + for (; i < MAX_TEXT_ID; ++i) { if (!m_script->textId[i]) break; @@ -1121,8 +1122,8 @@ void ScriptAction::HandleScriptStep() // Just turn around if (m_script->x == 0.0f && m_script->y == 0.0f && m_script->z == 0.0f || - // Check point-to-point distance, hence revert effect of bounding radius - ((Unit*)pSource)->IsWithinDist3d(m_script->x, m_script->y, m_script->z, 0.01f - ((Unit*)pSource)->GetObjectBoundingRadius())) + // Check point-to-point distance, hence revert effect of bounding radius + ((Unit*)pSource)->IsWithinDist3d(m_script->x, m_script->y, m_script->z, 0.01f - ((Unit*)pSource)->GetObjectBoundingRadius())) { ((Unit*)pSource)->SetFacingTo(m_script->o); break; @@ -1155,7 +1156,7 @@ void ScriptAction::HandleScriptStep() if (m_script->setFlag.fieldId <= OBJECT_FIELD_ENTRY || m_script->setFlag.fieldId >= source->GetValuesCount()) { sLog.outError("SCRIPT_COMMAND_FLAG_SET (script id %u) call for wrong field %u (max count: %u) in object (TypeId: %u).", - m_script->id, m_script->setFlag.fieldId, source->GetValuesCount(), source->GetTypeId()); + m_script->id, m_script->setFlag.fieldId, source->GetValuesCount(), source->GetTypeId()); break; } @@ -1171,7 +1172,7 @@ void ScriptAction::HandleScriptStep() if (m_script->removeFlag.fieldId <= OBJECT_FIELD_ENTRY || m_script->removeFlag.fieldId >= source->GetValuesCount()) { sLog.outError("SCRIPT_COMMAND_FLAG_REMOVE (script id %u) call for wrong field %u (max count: %u) in object (TypeId: %u).", - m_script->id, m_script->removeFlag.fieldId, source->GetValuesCount(), source->GetTypeId()); + m_script->id, m_script->removeFlag.fieldId, source->GetValuesCount(), source->GetTypeId()); break; } @@ -1277,9 +1278,9 @@ void ScriptAction::HandleScriptStep() } if (pGo->GetGoType()==GAMEOBJECT_TYPE_FISHINGNODE || - pGo->GetGoType()==GAMEOBJECT_TYPE_DOOR || - pGo->GetGoType()==GAMEOBJECT_TYPE_BUTTON || - pGo->GetGoType()==GAMEOBJECT_TYPE_TRAP) + pGo->GetGoType()==GAMEOBJECT_TYPE_DOOR || + pGo->GetGoType()==GAMEOBJECT_TYPE_BUTTON || + pGo->GetGoType()==GAMEOBJECT_TYPE_TRAP) { sLog.outError(" DB-SCRIPTS: Process table `%s` id %u, command %u can not be used with gameobject of type %u (guid: %u, buddyEntry: %u).", m_table, m_script->id, m_script->command, uint32(pGo->GetGoType()), m_script->respawnGo.goGuid, m_script->buddyEntry); break; @@ -1351,7 +1352,7 @@ void ScriptAction::HandleScriptStep() } if (m_script->command == SCRIPT_COMMAND_OPEN_DOOR && pDoor->GetGoState() != GO_STATE_READY || - m_script->command == SCRIPT_COMMAND_CLOSE_DOOR && pDoor->GetGoState() == GO_STATE_READY) + m_script->command == SCRIPT_COMMAND_CLOSE_DOOR && pDoor->GetGoState() == GO_STATE_READY) break; // to be opened door already open, or to be closed door already closed pDoor->UseDoorOrButton(time_to_reset); @@ -1472,7 +1473,7 @@ void ScriptAction::HandleScriptStep() // Consider add additional checks for cases where creature should not change movementType // (pet? in combat? already using same MMgen as script try to apply?) - switch(m_script->movement.movementType) + switch (m_script->movement.movementType) { case IDLE_MOTION_TYPE: ((Creature*)pSource)->GetMotionMaster()->MoveIdle(); @@ -1521,15 +1522,15 @@ void ScriptAction::HandleScriptStep() break; if (!m_script->morph.creatureOrModelEntry) - ((Creature*)pSource)->DeMorph(); + ((Creature*)pSource)->DeMorph(); else if (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) - ((Creature*)pSource)->SetDisplayId(m_script->morph.creatureOrModelEntry); + ((Creature*)pSource)->SetDisplayId(m_script->morph.creatureOrModelEntry); else { CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(m_script->morph.creatureOrModelEntry); uint32 display_id = Creature::ChooseDisplayId(ci); - ((Creature*)pSource)->SetDisplayId(display_id); + ((Creature*)pSource)->SetDisplayId(display_id); } break; @@ -1540,15 +1541,15 @@ void ScriptAction::HandleScriptStep() break; if (!m_script->mount.creatureOrModelEntry) - ((Creature*)pSource)->Unmount(); + ((Creature*)pSource)->Unmount(); else if (m_script->data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL) - ((Creature*)pSource)->Mount(m_script->mount.creatureOrModelEntry); + ((Creature*)pSource)->Mount(m_script->mount.creatureOrModelEntry); else { CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(m_script->mount.creatureOrModelEntry); uint32 display_id = Creature::ChooseDisplayId(ci); - ((Creature*)pSource)->Mount(display_id); + ((Creature*)pSource)->Mount(display_id); } break; @@ -1661,7 +1662,7 @@ void ScriptAction::HandleScriptStep() void ScriptMgr::LoadAreaTriggerScripts() { m_AreaTriggerScripts.clear(); // need for reload case - QueryResult *result = WorldDatabase.Query("SELECT entry, ScriptName FROM scripted_areatrigger"); + QueryResult* result = WorldDatabase.Query("SELECT entry, ScriptName FROM scripted_areatrigger"); uint32 count = 0; @@ -1682,10 +1683,10 @@ void ScriptMgr::LoadAreaTriggerScripts() ++count; bar.step(); - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 triggerId = fields[0].GetUInt32(); - const char *scriptName = fields[1].GetString(); + const char* scriptName = fields[1].GetString(); if (!sAreaTriggerStore.LookupEntry(triggerId)) { @@ -1694,7 +1695,8 @@ void ScriptMgr::LoadAreaTriggerScripts() } m_AreaTriggerScripts[triggerId] = GetScriptId(scriptName); - } while(result->NextRow()); + } + while (result->NextRow()); delete result; @@ -1705,7 +1707,7 @@ void ScriptMgr::LoadAreaTriggerScripts() void ScriptMgr::LoadEventIdScripts() { m_EventIdScripts.clear(); // need for reload case - QueryResult *result = WorldDatabase.Query("SELECT id, ScriptName FROM scripted_event_id"); + QueryResult* result = WorldDatabase.Query("SELECT id, ScriptName FROM scripted_event_id"); uint32 count = 0; @@ -1747,12 +1749,12 @@ void ScriptMgr::LoadEventIdScripts() } // Load all possible event entries from spells - for(uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) + for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) { SpellEntry const* spell = sSpellStore.LookupEntry(i); if (spell) { - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT) { @@ -1764,9 +1766,9 @@ void ScriptMgr::LoadEventIdScripts() } // Load all possible event entries from taxi path nodes - for(size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx) + for (size_t path_idx = 0; path_idx < sTaxiPathNodesByPath.size(); ++path_idx) { - for(size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx) + for (size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx) { TaxiPathNodeEntry const& node = sTaxiPathNodesByPath[path_idx][node_idx]; @@ -1783,18 +1785,19 @@ void ScriptMgr::LoadEventIdScripts() ++count; bar.step(); - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 eventId = fields[0].GetUInt32(); - const char *scriptName = fields[1].GetString(); + const char* scriptName = fields[1].GetString(); std::set::const_iterator itr = evt_scripts.find(eventId); if (itr == evt_scripts.end()) sLog.outErrorDb("Table `scripted_event_id` has id %u not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field, type 29 or any spell effect %u or path taxi node data", - eventId, SPELL_EFFECT_SEND_EVENT); + eventId, SPELL_EFFECT_SEND_EVENT); m_EventIdScripts[eventId] = GetScriptId(scriptName); - } while(result->NextRow()); + } + while (result->NextRow()); delete result; @@ -1805,20 +1808,20 @@ void ScriptMgr::LoadEventIdScripts() void ScriptMgr::LoadScriptNames() { m_scriptNames.push_back(""); - QueryResult *result = WorldDatabase.Query( - "SELECT DISTINCT(ScriptName) FROM creature_template WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM gameobject_template WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM item_template WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM scripted_areatrigger WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM scripted_event_id WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM instance_template WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM world_template WHERE ScriptName <> ''"); + QueryResult* result = WorldDatabase.Query( + "SELECT DISTINCT(ScriptName) FROM creature_template WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM gameobject_template WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM item_template WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM scripted_areatrigger WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM scripted_event_id WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM instance_template WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM world_template WHERE ScriptName <> ''"); if (!result) { @@ -1837,7 +1840,8 @@ void ScriptMgr::LoadScriptNames() bar.step(); m_scriptNames.push_back((*result)[0].GetString()); ++count; - } while (result->NextRow()); + } + while (result->NextRow()); delete result; std::sort(m_scriptNames.begin(), m_scriptNames.end()); @@ -1845,7 +1849,7 @@ void ScriptMgr::LoadScriptNames() sLog.outString(">> Loaded %d Script Names", count); } -uint32 ScriptMgr::GetScriptId(const char *name) const +uint32 ScriptMgr::GetScriptId(const char* name) const { // use binary search to find the script name in the sorted vector // assume "" is the first element @@ -2033,7 +2037,7 @@ ScriptLoadResult ScriptMgr::LoadScriptLibrary(const char* libName) } // let check used mangosd revision for build library (unsafe use with different revision because changes in inline functions, define and etc) - char const* (MANGOS_IMPORT* pGetMangosRevStr) (); + char const* (MANGOS_IMPORT* pGetMangosRevStr)(); GET_SCRIPT_HOOK_PTR(pGetMangosRevStr, "GetMangosRevStr"); @@ -2130,7 +2134,7 @@ uint32 GetEventIdScriptId(uint32 eventId) return sScriptMgr.GetEventIdScriptId(eventId); } -uint32 GetScriptId(const char *name) +uint32 GetScriptId(const char* name) { return sScriptMgr.GetScriptId(name); } diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h index f0cb4df96..bad545720 100644 --- a/src/game/ScriptMgr.h +++ b/src/game/ScriptMgr.h @@ -44,13 +44,13 @@ class WorldObject; enum ScriptCommand // resSource, resTarget are the resulting Source/ Target after buddy search is done { SCRIPT_COMMAND_TALK = 0, // resSource = WorldObject, resTarget = Unit/none - // datalong1 (see enum ChatType for supported CHAT_TYPE_'s), datalong2 = language - // dataint = text entry from db_script_string -table. dataint2-4 optional for random selected texts. + // datalong1 (see enum ChatType for supported CHAT_TYPE_'s), datalong2 = language + // dataint = text entry from db_script_string -table. dataint2-4 optional for random selected texts. SCRIPT_COMMAND_EMOTE = 1, // resSource = Unit, resTarget = Unit/none - // datalong1 = emote_id + // datalong1 = emote_id SCRIPT_COMMAND_FIELD_SET = 2, // source = any, datalong = field_id, datalong2 = value SCRIPT_COMMAND_MOVE_TO = 3, // resSource = Creature, datalong2 = travel_speed*100, x/y/z - // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: teleport unit to position + // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL: teleport unit to position SCRIPT_COMMAND_FLAG_SET = 4, // source = any, datalong = field_id, datalong2 = bitmask SCRIPT_COMMAND_FLAG_REMOVE = 5, // source = any, datalong = field_id, datalong2 = bitmask SCRIPT_COMMAND_TELEPORT_TO = 6, // source or target with Player, datalong2 = map_id, x/y/z @@ -58,45 +58,46 @@ enum ScriptCommand // resSource, resTar SCRIPT_COMMAND_KILL_CREDIT = 8, // source or target with Player, datalong = creature entry (or 0 for target-entry), datalong2 = bool (0=personal credit, 1=group credit) SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = any, datalong=db_guid, datalong2=despawn_delay SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = any, datalong=creature entry, datalong2=despawn_delay - // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = summon active + // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = summon active SCRIPT_COMMAND_OPEN_DOOR = 11, // datalong=db_guid (or not provided), datalong2=reset_delay SCRIPT_COMMAND_CLOSE_DOOR = 12, // datalong=db_guid (or not provided), datalong2=reset_delay SCRIPT_COMMAND_ACTIVATE_OBJECT = 13, // source = unit, target=GO SCRIPT_COMMAND_REMOVE_AURA = 14, // resSource = Unit, datalong = spell_id SCRIPT_COMMAND_CAST_SPELL = 15, // resSource = Unit, cast spell at resTarget = Unit - // datalong=spellid - // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = cast triggered + // datalong=spellid + // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = cast triggered SCRIPT_COMMAND_PLAY_SOUND = 16, // resSource = WorldObject, target=any/player, datalong (sound_id), datalong2 (bitmask: 0/1=anyone/target, 0/2=with distance dependent, so 1|2 = 3 is target with distance dependent) SCRIPT_COMMAND_CREATE_ITEM = 17, // source or target must be player, datalong = item entry, datalong2 = amount SCRIPT_COMMAND_DESPAWN_SELF = 18, // resSource = Creature, datalong = despawn delay SCRIPT_COMMAND_PLAY_MOVIE = 19, // target can only be a player, datalog = movie id SCRIPT_COMMAND_MOVEMENT = 20, // resSource = Creature. datalong = MovementType (0:idle, 1:random or 2:waypoint), datalong2 = wander-distance - // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = Random-movement around current position + // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = Random-movement around current position SCRIPT_COMMAND_SET_ACTIVEOBJECT = 21, // resSource = Creature - // datalong=bool 0=off, 1=on + // datalong=bool 0=off, 1=on SCRIPT_COMMAND_SET_FACTION = 22, // resSource = Creature - // datalong=factionId, datalong2=faction_flags + // datalong=factionId, datalong2=faction_flags SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL = 23, // resSource = Creature, datalong=creature entry/modelid - // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = use datalong value as modelid explicit + // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = use datalong value as modelid explicit SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL = 24, // resSource = Creature, datalong=creature entry/modelid - // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = use datalong value as modelid explicit + // data_flags & SCRIPT_FLAG_COMMAND_ADDITIONAL = use datalong value as modelid explicit SCRIPT_COMMAND_SET_RUN = 25, // resSource = Creature - // datalong= bool 0=off, 1=on + // datalong= bool 0=off, 1=on SCRIPT_COMMAND_ATTACK_START = 26, // resSource = Creature, resTarget = Unit SCRIPT_COMMAND_GO_LOCK_STATE = 27, // resSource = GameObject - // datalong= 1=lock, 2=unlock, 4=set not-interactable, 8=set interactable + // datalong= 1=lock, 2=unlock, 4=set not-interactable, 8=set interactable SCRIPT_COMMAND_STAND_STATE = 28, // resSource = Creature - // datalong = stand state (enum UnitStandStateType) + // datalong = stand state (enum UnitStandStateType) SCRIPT_COMMAND_MODIFY_NPC_FLAGS = 29, // resSource = Creature - // datalong=NPCFlags - // datalong2:0x00=toggle, 0x01=add, 0x02=remove + // datalong=NPCFlags + // datalong2:0x00=toggle, 0x01=add, 0x02=remove SCRIPT_COMMAND_SEND_TAXI_PATH = 30, // datalong = taxi path id (source or target must be player) }; #define MAX_TEXT_ID 4 // used for SCRIPT_COMMAND_TALK enum ScriptInfoDataFlags -{ // default: s/b -> t +{ + // default: s/b -> t SCRIPT_FLAG_BUDDY_AS_TARGET = 0x01, // s -> b SCRIPT_FLAG_REVERSE_DIRECTION = 0x02, // t* -> s* (* result after previous flag is evaluated) SCRIPT_FLAG_SOURCE_TARGETS_SELF = 0x04, // s* -> s* (* result after previous flag is evaluated) @@ -177,7 +178,7 @@ struct ScriptInfo uint32 despawnDelay; // datalong2 } summonCreature; - // SCRIPT_COMMAND_OPEN_DOOR (11) + // SCRIPT_COMMAND_OPEN_DOOR (11) struct // SCRIPT_COMMAND_CLOSE_DOOR (12) { uint32 goGuid; // datalong @@ -429,7 +430,7 @@ class ScriptMgr uint32 GetEventIdScriptId(uint32 eventId) const; const char* GetScriptName(uint32 id) const { return id < m_scriptNames.size() ? m_scriptNames[id].c_str() : ""; } - uint32 GetScriptId(const char *name) const; + uint32 GetScriptId(const char* name) const; uint32 GetScriptIdsCount() const { return m_scriptNames.size(); } ScriptLoadResult LoadScriptLibrary(const char* libName); @@ -493,37 +494,37 @@ class ScriptMgr void (MANGOS_IMPORT* m_pOnFreeScriptLibrary)(); const char* (MANGOS_IMPORT* m_pGetScriptLibraryVersion)(); - CreatureAI* (MANGOS_IMPORT* m_pGetCreatureAI) (Creature*); - InstanceData* (MANGOS_IMPORT* m_pCreateInstanceData) (Map*); + CreatureAI* (MANGOS_IMPORT* m_pGetCreatureAI)(Creature*); + InstanceData* (MANGOS_IMPORT* m_pCreateInstanceData)(Map*); - bool (MANGOS_IMPORT* m_pOnGossipHello) (Player*, Creature*); - bool (MANGOS_IMPORT* m_pOnGOGossipHello) (Player*, GameObject*); - bool (MANGOS_IMPORT* m_pOnGossipSelect) (Player*, Creature*, uint32, uint32); - bool (MANGOS_IMPORT* m_pOnGOGossipSelect) (Player*, GameObject*, uint32, uint32); - bool (MANGOS_IMPORT* m_pOnGossipSelectWithCode) (Player*, Creature*, uint32, uint32, const char*); - bool (MANGOS_IMPORT* m_pOnGOGossipSelectWithCode) (Player*, GameObject*, uint32, uint32, const char*); - bool (MANGOS_IMPORT* m_pOnQuestAccept) (Player*, Creature*, Quest const*); - bool (MANGOS_IMPORT* m_pOnGOQuestAccept) (Player*, GameObject*, Quest const*); - bool (MANGOS_IMPORT* m_pOnItemQuestAccept) (Player*, Item*, Quest const*); - bool (MANGOS_IMPORT* m_pOnQuestRewarded) (Player*, Creature*, Quest const*); - bool (MANGOS_IMPORT* m_pOnGOQuestRewarded) (Player*, GameObject*, Quest const*); - uint32 (MANGOS_IMPORT* m_pGetNPCDialogStatus) (Player*, Creature*); - uint32 (MANGOS_IMPORT* m_pGetGODialogStatus) (Player*, GameObject*); - bool (MANGOS_IMPORT* m_pOnGOUse) (Player*, GameObject*); - bool (MANGOS_IMPORT* m_pOnItemUse) (Player*, Item*, SpellCastTargets const&); - bool (MANGOS_IMPORT* m_pOnAreaTrigger) (Player*, AreaTriggerEntry const*); - bool (MANGOS_IMPORT* m_pOnProcessEvent) (uint32, Object*, Object*, bool); - bool (MANGOS_IMPORT* m_pOnEffectDummyCreature) (Unit*, uint32, SpellEffectIndex, Creature*); - bool (MANGOS_IMPORT* m_pOnEffectDummyGO) (Unit*, uint32, SpellEffectIndex, GameObject*); - bool (MANGOS_IMPORT* m_pOnEffectDummyItem) (Unit*, uint32, SpellEffectIndex, Item*); - bool (MANGOS_IMPORT* m_pOnAuraDummy) (Aura const*, bool); + bool (MANGOS_IMPORT* m_pOnGossipHello)(Player*, Creature*); + bool (MANGOS_IMPORT* m_pOnGOGossipHello)(Player*, GameObject*); + bool (MANGOS_IMPORT* m_pOnGossipSelect)(Player*, Creature*, uint32, uint32); + bool (MANGOS_IMPORT* m_pOnGOGossipSelect)(Player*, GameObject*, uint32, uint32); + bool (MANGOS_IMPORT* m_pOnGossipSelectWithCode)(Player*, Creature*, uint32, uint32, const char*); + bool (MANGOS_IMPORT* m_pOnGOGossipSelectWithCode)(Player*, GameObject*, uint32, uint32, const char*); + bool (MANGOS_IMPORT* m_pOnQuestAccept)(Player*, Creature*, Quest const*); + bool (MANGOS_IMPORT* m_pOnGOQuestAccept)(Player*, GameObject*, Quest const*); + bool (MANGOS_IMPORT* m_pOnItemQuestAccept)(Player*, Item*, Quest const*); + bool (MANGOS_IMPORT* m_pOnQuestRewarded)(Player*, Creature*, Quest const*); + bool (MANGOS_IMPORT* m_pOnGOQuestRewarded)(Player*, GameObject*, Quest const*); + uint32(MANGOS_IMPORT* m_pGetNPCDialogStatus)(Player*, Creature*); + uint32(MANGOS_IMPORT* m_pGetGODialogStatus)(Player*, GameObject*); + bool (MANGOS_IMPORT* m_pOnGOUse)(Player*, GameObject*); + bool (MANGOS_IMPORT* m_pOnItemUse)(Player*, Item*, SpellCastTargets const&); + bool (MANGOS_IMPORT* m_pOnAreaTrigger)(Player*, AreaTriggerEntry const*); + bool (MANGOS_IMPORT* m_pOnProcessEvent)(uint32, Object*, Object*, bool); + bool (MANGOS_IMPORT* m_pOnEffectDummyCreature)(Unit*, uint32, SpellEffectIndex, Creature*); + bool (MANGOS_IMPORT* m_pOnEffectDummyGO)(Unit*, uint32, SpellEffectIndex, GameObject*); + bool (MANGOS_IMPORT* m_pOnEffectDummyItem)(Unit*, uint32, SpellEffectIndex, Item*); + bool (MANGOS_IMPORT* m_pOnAuraDummy)(Aura const*, bool); }; #define sScriptMgr MaNGOS::Singleton::Instance() MANGOS_DLL_SPEC uint32 GetAreaTriggerScriptId(uint32 triggerId); MANGOS_DLL_SPEC uint32 GetEventIdScriptId(uint32 eventId); -MANGOS_DLL_SPEC uint32 GetScriptId(const char *name); +MANGOS_DLL_SPEC uint32 GetScriptId(const char* name); MANGOS_DLL_SPEC char const* GetScriptName(uint32 id); MANGOS_DLL_SPEC uint32 GetScriptIdsCount(); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index d77fcbdd3..ccf154a49 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -172,30 +172,30 @@ enum SpellSchoolMask { SPELL_SCHOOL_MASK_NONE = 0x00, // not exist SPELL_SCHOOL_MASK_NORMAL = (1 << SPELL_SCHOOL_NORMAL), // PHYSICAL (Armor) - SPELL_SCHOOL_MASK_HOLY = (1 << SPELL_SCHOOL_HOLY ), - SPELL_SCHOOL_MASK_FIRE = (1 << SPELL_SCHOOL_FIRE ), + SPELL_SCHOOL_MASK_HOLY = (1 << SPELL_SCHOOL_HOLY), + SPELL_SCHOOL_MASK_FIRE = (1 << SPELL_SCHOOL_FIRE), SPELL_SCHOOL_MASK_NATURE = (1 << SPELL_SCHOOL_NATURE), - SPELL_SCHOOL_MASK_FROST = (1 << SPELL_SCHOOL_FROST ), + SPELL_SCHOOL_MASK_FROST = (1 << SPELL_SCHOOL_FROST), SPELL_SCHOOL_MASK_SHADOW = (1 << SPELL_SCHOOL_SHADOW), SPELL_SCHOOL_MASK_ARCANE = (1 << SPELL_SCHOOL_ARCANE), // unions // 124, not include normal and holy damage - SPELL_SCHOOL_MASK_SPELL = ( SPELL_SCHOOL_MASK_FIRE | - SPELL_SCHOOL_MASK_NATURE | SPELL_SCHOOL_MASK_FROST | - SPELL_SCHOOL_MASK_SHADOW | SPELL_SCHOOL_MASK_ARCANE ), + SPELL_SCHOOL_MASK_SPELL = (SPELL_SCHOOL_MASK_FIRE | + SPELL_SCHOOL_MASK_NATURE | SPELL_SCHOOL_MASK_FROST | + SPELL_SCHOOL_MASK_SHADOW | SPELL_SCHOOL_MASK_ARCANE), // 126 - SPELL_SCHOOL_MASK_MAGIC = ( SPELL_SCHOOL_MASK_HOLY | SPELL_SCHOOL_MASK_SPELL ), + SPELL_SCHOOL_MASK_MAGIC = (SPELL_SCHOOL_MASK_HOLY | SPELL_SCHOOL_MASK_SPELL), // 127 - SPELL_SCHOOL_MASK_ALL = ( SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_MAGIC ) + SPELL_SCHOOL_MASK_ALL = (SPELL_SCHOOL_MASK_NORMAL | SPELL_SCHOOL_MASK_MAGIC) }; inline SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask) { - for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) - if(mask & (1 << i)) + for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) + if (mask & (1 << i)) return SpellSchools(i); return SPELL_SCHOOL_NORMAL; @@ -215,7 +215,8 @@ enum ItemQualities #define MAX_ITEM_QUALITY 8 -const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = { +const uint32 ItemQualityColors[MAX_ITEM_QUALITY] = +{ 0xff9d9d9d, //GREY 0xffffffff, //WHITE 0xff1eff00, //GREEN @@ -1065,7 +1066,8 @@ enum SpellCastResultCustom // Spell aura states enum AuraState -{ // (C) used in caster aura state (T) used in target aura state +{ + // (C) used in caster aura state (T) used in target aura state // (c) used in caster aura state-not (t) used in target aura state-not AURA_STATE_DEFENSE = 1, // C | AURA_STATE_HEALTHLESS_20_PERCENT = 2, // CcT | @@ -2224,7 +2226,7 @@ enum QuestSort inline uint8 ClassByQuestSort(int32 QuestSort) { - switch(QuestSort) + switch (QuestSort) { case QUEST_SORT_WARLOCK: return CLASS_WARLOCK; case QUEST_SORT_WARRIOR: return CLASS_WARRIOR; @@ -2400,7 +2402,7 @@ enum SkillType inline SkillType SkillByLockType(LockType locktype) { - switch(locktype) + switch (locktype) { case LOCKTYPE_PICKLOCK: return SKILL_LOCKPICKING; case LOCKTYPE_HERBALISM: return SKILL_HERBALISM; diff --git a/src/game/SkillDiscovery.cpp b/src/game/SkillDiscovery.cpp index ac33ef9b5..ef2e6fb3b 100644 --- a/src/game/SkillDiscovery.cpp +++ b/src/game/SkillDiscovery.cpp @@ -54,12 +54,12 @@ void LoadSkillDiscoveryTable() uint32 count = 0; // 0 1 2 3 - QueryResult *result = WorldDatabase.Query("SELECT spellId, reqSpell, reqSkillValue, chance FROM skill_discovery_template"); + QueryResult* result = WorldDatabase.Query("SELECT spellId, reqSpell, reqSkillValue, chance FROM skill_discovery_template"); if (!result) { sLog.outString(); - sLog.outString( ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty." ); + sLog.outString(">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); return; } @@ -70,7 +70,7 @@ void LoadSkillDiscoveryTable() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); uint32 spellId = fields[0].GetUInt32(); @@ -81,7 +81,7 @@ void LoadSkillDiscoveryTable() if (chance <= 0) // chance { ssNonDiscoverableEntries << "spellId = " << spellId << " reqSkillOrSpell = " << reqSkillOrSpell - << " reqSkillValue = " << reqSkillValue << " chance = " << chance << "(chance problem)\n"; + << " reqSkillValue = " << reqSkillValue << " chance = " << chance << "(chance problem)\n"; continue; } @@ -100,20 +100,20 @@ void LoadSkillDiscoveryTable() // mechanic discovery if (reqSpellEntry->Mechanic != MECHANIC_DISCOVERY && - // explicit discovery ability - !IsExplicitDiscoverySpell(reqSpellEntry)) + // explicit discovery ability + !IsExplicitDiscoverySpell(reqSpellEntry)) { if (reportedReqSpells.find(reqSkillOrSpell) == reportedReqSpells.end()) { sLog.outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc" - " and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table", - reqSkillOrSpell,spellId); + " and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table", + reqSkillOrSpell,spellId); reportedReqSpells.insert(reqSkillOrSpell); } continue; } - SkillDiscoveryStore[reqSkillOrSpell].push_back( SkillDiscoveryEntry(spellId, reqSkillValue, chance) ); + SkillDiscoveryStore[reqSkillOrSpell].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance)); } else if (reqSkillOrSpell == 0) // skill case { @@ -125,8 +125,8 @@ void LoadSkillDiscoveryTable() continue; } - for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) - SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back( SkillDiscoveryEntry(spellId, reqSkillValue, chance) ); + for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) + SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance)); } else { @@ -135,17 +135,18 @@ void LoadSkillDiscoveryTable() } ++count; - } while (result->NextRow()); + } + while (result->NextRow()); delete result; sLog.outString(); - sLog.outString( ">> Loaded %u skill discovery definitions", count ); + sLog.outString(">> Loaded %u skill discovery definitions", count); if (!ssNonDiscoverableEntries.str().empty()) sLog.outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s",ssNonDiscoverableEntries.str().c_str()); // report about empty data for explicit discovery spells - for(uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id) + for (uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id) { SpellEntry const* spellEntry = sSpellStore.LookupEntry(spell_id); if (!spellEntry) @@ -172,7 +173,7 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) uint32 skillvalue = bounds.first != bounds.second ? player->GetSkillValue(bounds.first->second->skillId) : 0; float full_chance = 0; - for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) + for (SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) if (item_iter->reqSkillValue <= skillvalue) if (!player->HasSpell(item_iter->spellId)) full_chance += item_iter->chance; @@ -180,7 +181,7 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) float rate = full_chance / 100.0f; float roll = rand_chance_f() * rate; // roll now in range 0..full_chance - for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) + for (SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) { if (item_iter->reqSkillValue > skillvalue) continue; @@ -206,11 +207,11 @@ uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player) if (tab != SkillDiscoveryStore.end()) { - for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) + for (SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) { if (roll_chance_f(item_iter->chance * sWorld.getConfig(CONFIG_FLOAT_RATE_SKILL_DISCOVERY)) && - item_iter->reqSkillValue <= skillvalue && - !player->HasSpell(item_iter->spellId)) + item_iter->reqSkillValue <= skillvalue && + !player->HasSpell(item_iter->spellId)) return item_iter->spellId; } @@ -224,11 +225,11 @@ uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player) tab = SkillDiscoveryStore.find(-(int32)skillId); if (tab != SkillDiscoveryStore.end()) { - for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) + for (SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) { if (roll_chance_f(item_iter->chance * sWorld.getConfig(CONFIG_FLOAT_RATE_SKILL_DISCOVERY)) && - item_iter->reqSkillValue <= skillvalue && - !player->HasSpell(item_iter->spellId)) + item_iter->reqSkillValue <= skillvalue && + !player->HasSpell(item_iter->spellId)) return item_iter->spellId; } diff --git a/src/game/SkillExtraItems.cpp b/src/game/SkillExtraItems.cpp index 92171272e..b9c78a97a 100644 --- a/src/game/SkillExtraItems.cpp +++ b/src/game/SkillExtraItems.cpp @@ -59,7 +59,7 @@ void LoadSkillExtraItemTable() SkillExtraItemStore.clear(); // need for reload // 0 1 2 3 - QueryResult *result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template"); + QueryResult* result = WorldDatabase.Query("SELECT spellId, requiredSpecialization, additionalCreateChance, additionalMaxNum FROM skill_extra_item_template"); if (result) { @@ -67,7 +67,7 @@ void LoadSkillExtraItemTable() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); uint32 spellId = fields[0].GetUInt32(); @@ -106,7 +106,8 @@ void LoadSkillExtraItemTable() skillExtraItemEntry.additionalMaxNum = additionalMaxNum; ++count; - } while (result->NextRow()); + } + while (result->NextRow()); delete result; @@ -116,25 +117,25 @@ void LoadSkillExtraItemTable() else { sLog.outString(); - sLog.outString( ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty." ); + sLog.outString(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); } } -bool canCreateExtraItems(Player * player, uint32 spellId, float &additionalChance, uint8 &additionalMax) +bool canCreateExtraItems(Player* player, uint32 spellId, float& additionalChance, uint8& additionalMax) { // get the info for the specified spell SkillExtraItemMap::const_iterator ret = SkillExtraItemStore.find(spellId); - if(ret==SkillExtraItemStore.end()) + if (ret==SkillExtraItemStore.end()) return false; SkillExtraItemEntry const* specEntry = &ret->second; // if no entry, then no extra items can be created - if(!specEntry) + if (!specEntry) return false; // the player doesn't have the required specialization, return false - if(!player->HasSpell(specEntry->requiredSpecialization)) + if (!player->HasSpell(specEntry->requiredSpecialization)) return false; // set the arguments to the appropriate values diff --git a/src/game/SkillExtraItems.h b/src/game/SkillExtraItems.h index 7bfd5afc4..e06dad850 100644 --- a/src/game/SkillExtraItems.h +++ b/src/game/SkillExtraItems.h @@ -24,7 +24,7 @@ // predef classes used in functions class Player; // returns true and sets the appropriate info if the player can create extra items with the given spellId -bool canCreateExtraItems(Player * player, uint32 spellId, float &additionalChance, uint8 &additionalMax); +bool canCreateExtraItems(Player* player, uint32 spellId, float& additionalChance, uint8& additionalMax); // function to load the extra item creation info from DB void LoadSkillExtraItemTable(); #endif diff --git a/src/game/SkillHandler.cpp b/src/game/SkillHandler.cpp index df4dd759a..8feb29d9c 100644 --- a/src/game/SkillHandler.cpp +++ b/src/game/SkillHandler.cpp @@ -25,7 +25,7 @@ #include "WorldSession.h" #include "UpdateMask.h" -void WorldSession::HandleLearnTalentOpcode( WorldPacket & recv_data ) +void WorldSession::HandleLearnTalentOpcode(WorldPacket& recv_data) { uint32 talent_id, requested_rank; recv_data >> talent_id >> requested_rank; @@ -43,7 +43,7 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket) uint32 talentId, talentRank; - for(uint32 i = 0; i < talentsCount; ++i) + for (uint32 i = 0; i < talentsCount; ++i) { recvPacket >> talentId >> talentRank; @@ -53,16 +53,16 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket) _player->SendTalentsInfoData(false); } -void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data ) +void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recv_data) { DETAIL_LOG("MSG_TALENT_WIPE_CONFIRM"); ObjectGuid guid; recv_data >> guid; - Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); + Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { - DEBUG_LOG( "WORLD: HandleTalentWipeConfirmOpcode - %s not found or you can't interact with him.", guid.GetString().c_str()); + DEBUG_LOG("WORLD: HandleTalentWipeConfirmOpcode - %s not found or you can't interact with him.", guid.GetString().c_str()); return; } @@ -72,10 +72,10 @@ void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data ) if (!(_player->resetTalents())) { - WorldPacket data( MSG_TALENT_WIPE_CONFIRM, 8+4); //you have not any talent + WorldPacket data(MSG_TALENT_WIPE_CONFIRM, 8+4); //you have not any talent data << uint64(0); data << uint32(0); - SendPacket( &data ); + SendPacket(&data); return; } @@ -83,7 +83,7 @@ void WorldSession::HandleTalentWipeConfirmOpcode( WorldPacket & recv_data ) unit->CastSpell(_player, 14867, true); //spell: "Untalent Visual Effect" } -void WorldSession::HandleUnlearnSkillOpcode(WorldPacket & recv_data) +void WorldSession::HandleUnlearnSkillOpcode(WorldPacket& recv_data) { uint32 skill_id; recv_data >> skill_id; diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp index be12f4e13..100cb6b9a 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -26,7 +26,7 @@ #include "World.h" #include "Util.h" -INSTANTIATE_SINGLETON_1( SocialMgr ); +INSTANTIATE_SINGLETON_1(SocialMgr); PlayerSocial::PlayerSocial() { @@ -40,9 +40,9 @@ PlayerSocial::~PlayerSocial() uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag) { uint32 counter = 0; - for(PlayerSocialMap::const_iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr) + for (PlayerSocialMap::const_iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr) { - if(itr->second.Flags & flag) + if (itr->second.Flags & flag) ++counter; } return counter; @@ -51,23 +51,23 @@ uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag) bool PlayerSocial::AddToSocialList(ObjectGuid friend_guid, bool ignore) { // check client limits - if(ignore) + if (ignore) { - if(GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT) + if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT) return false; } else { - if(GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT) + if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT) return false; } uint32 flag = SOCIAL_FLAG_FRIEND; - if(ignore) + if (ignore) flag = SOCIAL_FLAG_IGNORED; PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter()); - if(itr != m_playerSocialMap.end()) + if (itr != m_playerSocialMap.end()) { CharacterDatabase.PExecute("UPDATE character_social SET flags = (flags | %u) WHERE guid = '%u' AND friend = '%u'", flag, m_playerLowGuid, friend_guid.GetCounter()); m_playerSocialMap[friend_guid.GetCounter()].Flags |= flag; @@ -85,15 +85,15 @@ bool PlayerSocial::AddToSocialList(ObjectGuid friend_guid, bool ignore) void PlayerSocial::RemoveFromSocialList(ObjectGuid friend_guid, bool ignore) { PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_guid.GetCounter()); - if(itr == m_playerSocialMap.end()) // not exist + if (itr == m_playerSocialMap.end()) // not exist return; uint32 flag = SOCIAL_FLAG_FRIEND; - if(ignore) + if (ignore) flag = SOCIAL_FLAG_IGNORED; itr->second.Flags &= ~flag; - if(itr->second.Flags == 0) + if (itr->second.Flags == 0) { CharacterDatabase.PExecute("DELETE FROM character_social WHERE guid = '%u' AND friend = '%u'", m_playerLowGuid, friend_guid.GetCounter()); m_playerSocialMap.erase(itr); @@ -107,7 +107,7 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid friend_guid, bool ignore) void PlayerSocial::SetFriendNote(ObjectGuid friend_guid, std::string note) { PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter()); - if(itr == m_playerSocialMap.end()) // not exist + if (itr == m_playerSocialMap.end()) // not exist return; utf8truncate(note,48); // DB and client size limitation @@ -120,8 +120,8 @@ void PlayerSocial::SetFriendNote(ObjectGuid friend_guid, std::string note) void PlayerSocial::SendSocialList() { - Player *plr = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, m_playerLowGuid)); - if(!plr) + Player* plr = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, m_playerLowGuid)); + if (!plr) return; uint32 size = m_playerSocialMap.size(); @@ -130,17 +130,17 @@ void PlayerSocial::SendSocialList() data << uint32(7); // unk flag (0x1, 0x2, 0x4), 0x7 if it include ignore list data << uint32(size); // friends count - for(PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr) + for (PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr) { sSocialMgr.GetFriendInfo(plr, itr->first, itr->second); data << ObjectGuid(HIGHGUID_PLAYER, itr->first); // player guid data << uint32(itr->second.Flags); // player flag (0x1-friend?, 0x2-ignored?, 0x4-muted?) data << itr->second.Note; // string note - if(itr->second.Flags & SOCIAL_FLAG_FRIEND) // if IsFriend() + if (itr->second.Flags & SOCIAL_FLAG_FRIEND) // if IsFriend() { data << uint8(itr->second.Status); // online/offline/etc? - if(itr->second.Status) // if online + if (itr->second.Status) // if online { data << uint32(itr->second.Area); // player area data << uint32(itr->second.Level); // player level @@ -156,7 +156,7 @@ void PlayerSocial::SendSocialList() bool PlayerSocial::HasFriend(ObjectGuid friend_guid) { PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter()); - if(itr != m_playerSocialMap.end()) + if (itr != m_playerSocialMap.end()) return itr->second.Flags & SOCIAL_FLAG_FRIEND; return false; } @@ -164,7 +164,7 @@ bool PlayerSocial::HasFriend(ObjectGuid friend_guid) bool PlayerSocial::HasIgnore(ObjectGuid ignore_guid) { PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(ignore_guid.GetCounter()); - if(itr != m_playerSocialMap.end()) + if (itr != m_playerSocialMap.end()) return itr->second.Flags & SOCIAL_FLAG_IGNORED; return false; } @@ -179,33 +179,33 @@ SocialMgr::~SocialMgr() } -void SocialMgr::GetFriendInfo(Player *player, uint32 friend_lowguid, FriendInfo &friendInfo) +void SocialMgr::GetFriendInfo(Player* player, uint32 friend_lowguid, FriendInfo& friendInfo) { - if(!player) + if (!player) return; - Player *pFriend = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, friend_lowguid)); + Player* pFriend = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, friend_lowguid)); Team team = player->GetTeam(); AccountTypes security = player->GetSession()->GetSecurity(); bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_WHO_LIST); - AccountTypes gmLevelInWhoList = AccountTypes (sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_WHO_LIST)); + AccountTypes gmLevelInWhoList = AccountTypes(sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_WHO_LIST)); PlayerSocialMap::iterator itr = player->GetSocial()->m_playerSocialMap.find(friend_lowguid); - if(itr != player->GetSocial()->m_playerSocialMap.end()) + if (itr != player->GetSocial()->m_playerSocialMap.end()) friendInfo.Note = itr->second.Note; // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && pFriend->GetName() && - (security > SEC_PLAYER || - ((pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList))) && - pFriend->IsVisibleGloballyFor(player)) + (security > SEC_PLAYER || + ((pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList))) && + pFriend->IsVisibleGloballyFor(player)) { friendInfo.Status = FRIEND_STATUS_ONLINE; - if(pFriend->isAFK()) + if (pFriend->isAFK()) friendInfo.Status = FRIEND_STATUS_AFK; - if(pFriend->isDND()) + if (pFriend->isDND()) friendInfo.Status = FRIEND_STATUS_DND; friendInfo.Area = pFriend->GetZoneId(); friendInfo.Level = pFriend->getLevel(); @@ -220,14 +220,14 @@ void SocialMgr::GetFriendInfo(Player *player, uint32 friend_lowguid, FriendInfo } } -void SocialMgr::MakeFriendStatusPacket(FriendsResult result, uint32 guid, WorldPacket *data) +void SocialMgr::MakeFriendStatusPacket(FriendsResult result, uint32 guid, WorldPacket* data) { data->Initialize(SMSG_FRIEND_STATUS, 5); *data << uint8(result); *data << ObjectGuid(HIGHGUID_PLAYER, guid); } -void SocialMgr::SendFriendStatus(Player *player, FriendsResult result, ObjectGuid friend_guid, bool broadcast) +void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGuid friend_guid, bool broadcast) { uint32 friend_lowguid = friend_guid.GetCounter(); @@ -236,7 +236,7 @@ void SocialMgr::SendFriendStatus(Player *player, FriendsResult result, ObjectGui WorldPacket data; MakeFriendStatusPacket(result, friend_lowguid, &data); GetFriendInfo(player, friend_lowguid, fi); - switch(result) + switch (result) { case FRIEND_ADDED_OFFLINE: case FRIEND_ADDED_ONLINE: @@ -246,7 +246,7 @@ void SocialMgr::SendFriendStatus(Player *player, FriendsResult result, ObjectGui break; } - switch(result) + switch (result) { case FRIEND_ADDED_ONLINE: case FRIEND_ONLINE: @@ -259,15 +259,15 @@ void SocialMgr::SendFriendStatus(Player *player, FriendsResult result, ObjectGui break; } - if(broadcast) + if (broadcast) BroadcastToFriendListers(player, &data); else player->GetSession()->SendPacket(&data); } -void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet) +void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet) { - if(!player) + if (!player) return; Team team = player->GetTeam(); @@ -276,19 +276,19 @@ void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet) AccountTypes gmLevelInWhoList = AccountTypes(sWorld.getConfig(CONFIG_UINT32_GM_LEVEL_IN_WHO_LIST)); bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_WHO_LIST); - for(SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr) + for (SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr) { PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(guid); - if(itr2 != itr->second.m_playerSocialMap.end() && (itr2->second.Flags & SOCIAL_FLAG_FRIEND)) + if (itr2 != itr->second.m_playerSocialMap.end() && (itr2->second.Flags & SOCIAL_FLAG_FRIEND)) { - Player *pFriend = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first)); + Player* pFriend = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first)); // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && pFriend->IsInWorld() && - (pFriend->GetSession()->GetSecurity() > SEC_PLAYER || - ((pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList)) && - player->IsVisibleGloballyFor(pFriend)) + (pFriend->GetSession()->GetSecurity() > SEC_PLAYER || + ((pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList)) && + player->IsVisibleGloballyFor(pFriend)) { pFriend->GetSession()->SendPacket(packet); } @@ -296,12 +296,12 @@ void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet) } } -PlayerSocial *SocialMgr::LoadFromDB(QueryResult *result, ObjectGuid guid) +PlayerSocial* SocialMgr::LoadFromDB(QueryResult* result, ObjectGuid guid) { - PlayerSocial *social = &m_socialMap[guid.GetCounter()]; + PlayerSocial* social = &m_socialMap[guid.GetCounter()]; social->SetPlayerGuid(guid); - if(!result) + if (!result) return social; uint32 friend_guid = 0; @@ -313,25 +313,25 @@ PlayerSocial *SocialMgr::LoadFromDB(QueryResult *result, ObjectGuid guid) do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); friend_guid = fields[0].GetUInt32(); flags = fields[1].GetUInt32(); note = fields[2].GetCppString(); - if((flags & SOCIAL_FLAG_IGNORED) && ignoreCounter >= SOCIALMGR_IGNORE_LIMIT) + if ((flags & SOCIAL_FLAG_IGNORED) && ignoreCounter >= SOCIALMGR_IGNORE_LIMIT) continue; - if((flags & SOCIAL_FLAG_FRIEND) && friendCounter >= SOCIALMGR_FRIEND_LIMIT) + if ((flags & SOCIAL_FLAG_FRIEND) && friendCounter >= SOCIALMGR_FRIEND_LIMIT) continue; social->m_playerSocialMap[friend_guid] = FriendInfo(flags, note); - if(flags & SOCIAL_FLAG_IGNORED) + if (flags & SOCIAL_FLAG_IGNORED) ignoreCounter++; else friendCounter++; } - while( result->NextRow() ); + while (result->NextRow()); delete result; return social; } diff --git a/src/game/SocialMgr.h b/src/game/SocialMgr.h index 81f94fd5c..8ff44486b 100644 --- a/src/game/SocialMgr.h +++ b/src/game/SocialMgr.h @@ -115,7 +115,7 @@ enum FriendsResult class PlayerSocial { - friend class SocialMgr; + friend class SocialMgr; public: PlayerSocial(); ~PlayerSocial(); @@ -143,13 +143,13 @@ class SocialMgr // Misc void RemovePlayerSocial(uint32 guid) { m_socialMap.erase(guid); } - void GetFriendInfo(Player *player, uint32 friendGUID, FriendInfo &friendInfo); + void GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo& friendInfo); // Packet management - void MakeFriendStatusPacket(FriendsResult result, uint32 friend_guid, WorldPacket *data); - void SendFriendStatus(Player *player, FriendsResult result, ObjectGuid friend_guid, bool broadcast); - void BroadcastToFriendListers(Player *player, WorldPacket *packet); + void MakeFriendStatusPacket(FriendsResult result, uint32 friend_guid, WorldPacket* data); + void SendFriendStatus(Player* player, FriendsResult result, ObjectGuid friend_guid, bool broadcast); + void BroadcastToFriendListers(Player* player, WorldPacket* packet); // Loading - PlayerSocial *LoadFromDB(QueryResult *result, ObjectGuid guid); + PlayerSocial* LoadFromDB(QueryResult* result, ObjectGuid guid); private: SocialMap m_socialMap; }; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index b5887c526..d97cdf21b 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -64,7 +64,7 @@ class PrioritizeManaUnitWraper struct PrioritizeMana { - int operator()( PrioritizeManaUnitWraper const& x, PrioritizeManaUnitWraper const& y ) const + int operator()(PrioritizeManaUnitWraper const& x, PrioritizeManaUnitWraper const& y) const { return x.getPercent() > y.getPercent(); } @@ -74,21 +74,21 @@ typedef std::priority_queueGetHealth() * 100 / unit->GetMaxHealth(); - } - Unit* getUnit() const { return i_unit; } - uint32 getPercent() const { return i_percent; } -private: - Unit* i_unit; - uint32 i_percent; + public: + explicit PrioritizeHealthUnitWraper(Unit* unit) : i_unit(unit) + { + i_percent = unit->GetHealth() * 100 / unit->GetMaxHealth(); + } + Unit* getUnit() const { return i_unit; } + uint32 getPercent() const { return i_percent; } + private: + Unit* i_unit; + uint32 i_percent; }; struct PrioritizeHealth { - int operator()( PrioritizeHealthUnitWraper const& x, PrioritizeHealthUnitWraper const& y ) const + int operator()(PrioritizeHealthUnitWraper const& x, PrioritizeHealthUnitWraper const& y) const { return x.getPercent() > y.getPercent(); } @@ -98,12 +98,12 @@ typedef std::priority_queueEffect[EFFECT_INDEX_0] == SPELL_EFFECT_THREAT - && spellproto->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_APPLY_AURA && spellproto->EffectApplyAuraName[EFFECT_INDEX_1] == SPELL_AURA_DUMMY; + && spellproto->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_APPLY_AURA && spellproto->EffectApplyAuraName[EFFECT_INDEX_1] == SPELL_AURA_DUMMY; } SpellCastTargets::SpellCastTargets() @@ -123,7 +123,7 @@ SpellCastTargets::~SpellCastTargets() { } -void SpellCastTargets::setUnitTarget(Unit *target) +void SpellCastTargets::setUnitTarget(Unit* target) { if (!target) return; @@ -152,7 +152,7 @@ void SpellCastTargets::setSource(float x, float y, float z) m_targetMask |= TARGET_FLAG_SOURCE_LOCATION; } -void SpellCastTargets::setGOTarget(GameObject *target) +void SpellCastTargets::setGOTarget(GameObject* target) { m_GOTarget = target; m_GOTargetGUID = target->GetObjectGuid(); @@ -161,7 +161,7 @@ void SpellCastTargets::setGOTarget(GameObject *target) void SpellCastTargets::setItemTarget(Item* item) { - if(!item) + if (!item) return; m_itemTarget = item; @@ -188,13 +188,13 @@ void SpellCastTargets::Update(Unit* caster) { m_GOTarget = m_GOTargetGUID ? caster->GetMap()->GetGameObject(m_GOTargetGUID) : NULL; m_unitTarget = m_unitTargetGUID ? - ( m_unitTargetGUID == caster->GetObjectGuid() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID) ) : - NULL; + (m_unitTargetGUID == caster->GetObjectGuid() ? caster : ObjectAccessor::GetUnit(*caster, m_unitTargetGUID)) : + NULL; m_itemTarget = NULL; if (caster->GetTypeId() == TYPEID_PLAYER) - { - Player *player = ((Player*)caster); +{ + Player* player = ((Player*)caster); if (m_targetMask & TARGET_FLAG_ITEM) m_itemTarget = player->GetItemByGuid(m_itemTargetGUID); @@ -210,11 +210,11 @@ void SpellCastTargets::Update(Unit* caster) } } -void SpellCastTargets::read( ByteBuffer& data, Unit *caster ) +void SpellCastTargets::read(ByteBuffer& data, Unit* caster) { data >> m_targetMask; - if(m_targetMask == TARGET_FLAG_SELF) + if (m_targetMask == TARGET_FLAG_SELF) { m_destX = caster->GetPositionX(); m_destY = caster->GetPositionY(); @@ -225,23 +225,23 @@ void SpellCastTargets::read( ByteBuffer& data, Unit *caster ) } // TARGET_FLAG_UNK2 is used for non-combat pets, maybe other? - if( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_UNK2 )) + if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNK2)) data >> m_unitTargetGUID.ReadAsPacked(); - if( m_targetMask & ( TARGET_FLAG_OBJECT )) + if (m_targetMask & (TARGET_FLAG_OBJECT)) data >> m_GOTargetGUID.ReadAsPacked(); - if(( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM )) && caster->GetTypeId() == TYPEID_PLAYER) + if ((m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM)) && caster->GetTypeId() == TYPEID_PLAYER) data >> m_itemTargetGUID.ReadAsPacked(); - if( m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) ) + if (m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE)) data >> m_CorpseTargetGUID.ReadAsPacked(); if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) { data >> m_srcTransportGUID.ReadAsPacked(); data >> m_srcX >> m_srcY >> m_srcZ; - if(!MaNGOS::IsValidMapCoord(m_srcX, m_srcY, m_srcZ)) + if (!MaNGOS::IsValidMapCoord(m_srcX, m_srcY, m_srcZ)) throw ByteBufferException(false, data.rpos(), 0, data.size()); } @@ -249,46 +249,46 @@ void SpellCastTargets::read( ByteBuffer& data, Unit *caster ) { data >> m_destTransportGUID.ReadAsPacked(); data >> m_destX >> m_destY >> m_destZ; - if(!MaNGOS::IsValidMapCoord(m_destX, m_destY, m_destZ)) + if (!MaNGOS::IsValidMapCoord(m_destX, m_destY, m_destZ)) throw ByteBufferException(false, data.rpos(), 0, data.size()); } - if( m_targetMask & TARGET_FLAG_STRING ) + if (m_targetMask & TARGET_FLAG_STRING) data >> m_strTarget; // find real units/GOs Update(caster); } -void SpellCastTargets::write( ByteBuffer& data ) const +void SpellCastTargets::write(ByteBuffer& data) const { data << uint32(m_targetMask); - if( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_PVP_CORPSE | TARGET_FLAG_OBJECT | TARGET_FLAG_CORPSE | TARGET_FLAG_UNK2 ) ) + if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_PVP_CORPSE | TARGET_FLAG_OBJECT | TARGET_FLAG_CORPSE | TARGET_FLAG_UNK2)) { - if(m_targetMask & TARGET_FLAG_UNIT) + if (m_targetMask & TARGET_FLAG_UNIT) { - if(m_unitTarget) + if (m_unitTarget) data << m_unitTarget->GetPackGUID(); else data << uint8(0); } - else if( m_targetMask & TARGET_FLAG_OBJECT ) + else if (m_targetMask & TARGET_FLAG_OBJECT) { - if(m_GOTarget) + if (m_GOTarget) data << m_GOTarget->GetPackGUID(); else data << uint8(0); } - else if( m_targetMask & ( TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) ) + else if (m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE)) data << m_CorpseTargetGUID.WriteAsPacked(); else data << uint8(0); } - if( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM ) ) + if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM)) { - if(m_itemTarget) + if (m_itemTarget) data << m_itemTarget->GetPackGUID(); else data << uint8(0); @@ -306,14 +306,14 @@ void SpellCastTargets::write( ByteBuffer& data ) const data << m_destX << m_destY << m_destZ; } - if( m_targetMask & TARGET_FLAG_STRING ) + if (m_targetMask & TARGET_FLAG_STRING) data << m_strTarget; } -Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid originalCasterGUID, SpellEntry const* triggeredBy ) +Spell::Spell(Unit* caster, SpellEntry const* info, bool triggered, ObjectGuid originalCasterGUID, SpellEntry const* triggeredBy) { - MANGOS_ASSERT( caster != NULL && info != NULL ); - MANGOS_ASSERT( info == sSpellStore.LookupEntry( info->Id ) && "`info` must be pointer to sSpellStore element"); + MANGOS_ASSERT(caster != NULL && info != NULL); + MANGOS_ASSERT(info == sSpellStore.LookupEntry(info->Id) && "`info` must be pointer to sSpellStore element"); if (info->SpellDifficultyId && caster->IsInWorld() && caster->GetMap()->IsDungeon()) { @@ -340,12 +340,12 @@ Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid o m_spellSchoolMask = GetSpellSchoolMask(info); // Can be override for some spell (wand shoot for example) - if(m_attackType == RANGED_ATTACK) + if (m_attackType == RANGED_ATTACK) { // wand case - if((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER) + if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER) { - if(Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK)) + if (Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK)) m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetProto()->Damage[0].DamageType); } } @@ -356,7 +356,7 @@ Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid o UpdateOriginalCasterPointer(); - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) m_currentBasePoints[i] = m_spellInfo->CalculateSimpleValue(SpellEffectIndex(i)); m_spellState = SPELL_STATE_PREPARING; @@ -392,19 +392,19 @@ Spell::Spell( Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid o m_spellFlags = SPELL_FLAG_NORMAL; - if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !m_spellInfo->HasAttribute(SPELL_ATTR_EX2_CANT_REFLECTED)) + if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !m_spellInfo->HasAttribute(SPELL_ATTR_EX2_CANT_REFLECTED)) { - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { if (m_spellInfo->Effect[j] == 0) continue; - if(!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j], m_spellInfo->EffectImplicitTargetB[j])) + if (!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j], m_spellInfo->EffectImplicitTargetB[j])) m_canReflect = true; else m_canReflect = m_spellInfo->HasAttribute(SPELL_ATTR_EX_NEGATIVE); - if(m_canReflect) + if (m_canReflect) continue; else break; @@ -444,7 +444,7 @@ void Spell::FillTargetMap() UnitList tmpUnitLists[MAX_EFFECT_INDEX]; // Stores the temporary Target Lists for each effect uint8 effToIndex[MAX_EFFECT_INDEX] = {0, 1, 2}; // Helper array, to link to another tmpUnitList, if the targets for both effects match - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { // not call for empty effect. // Also some spells use not used effect targets for store targets for dummy effect in triggered spells @@ -455,9 +455,9 @@ void Spell::FillTargetMap() // for TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT (A) all is checked in Spell::CheckCast and in Spell::CheckItem // filled in Spell::CheckCast call if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_SCRIPT_COORDINATES || - m_spellInfo->EffectImplicitTargetA[i] == TARGET_SCRIPT || - m_spellInfo->EffectImplicitTargetA[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT || - (m_spellInfo->EffectImplicitTargetB[i] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[i] != TARGET_SELF)) + m_spellInfo->EffectImplicitTargetA[i] == TARGET_SCRIPT || + m_spellInfo->EffectImplicitTargetA[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT || + (m_spellInfo->EffectImplicitTargetB[i] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[i] != TARGET_SELF)) continue; // TODO: find a way so this is not needed? @@ -470,8 +470,8 @@ void Spell::FillTargetMap() { // Check if same target, but handle i.e. AreaAuras different if (m_spellInfo->EffectImplicitTargetA[i] == m_spellInfo->EffectImplicitTargetA[j] && m_spellInfo->EffectImplicitTargetB[i] == m_spellInfo->EffectImplicitTargetB[j] - && m_spellInfo->Effect[j] != SPELL_EFFECT_NONE - && !IsAreaAuraEffect(m_spellInfo->Effect[i]) && !IsAreaAuraEffect(m_spellInfo->Effect[j])) + && m_spellInfo->Effect[j] != SPELL_EFFECT_NONE + && !IsAreaAuraEffect(m_spellInfo->Effect[i]) && !IsAreaAuraEffect(m_spellInfo->Effect[j])) // Add further conditions here if required { effToIndex[i] = j; // effect i has same targeting list as effect j @@ -483,10 +483,10 @@ void Spell::FillTargetMap() { // TargetA/TargetB dependent from each other, we not switch to full support this dependences // but need it support in some know cases - switch(m_spellInfo->EffectImplicitTargetA[i]) + switch (m_spellInfo->EffectImplicitTargetA[i]) { case TARGET_NONE: - switch(m_spellInfo->EffectImplicitTargetB[i]) + switch (m_spellInfo->EffectImplicitTargetB[i]) { case TARGET_NONE: if (m_caster->GetObjectGuid().IsPet()) @@ -500,14 +500,14 @@ void Spell::FillTargetMap() } break; case TARGET_SELF: - switch(m_spellInfo->EffectImplicitTargetB[i]) + switch (m_spellInfo->EffectImplicitTargetB[i]) { case TARGET_NONE: case TARGET_EFFECT_SELECT: SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetA[i], tmpUnitLists[i /*==effToIndex[i]*/]); break; case TARGET_AREAEFFECT_INSTANT: // use B case that not dependent from from A in fact - if((m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) == 0) + if ((m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) == 0) m_targets.setDestination(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ()); SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetB[i], tmpUnitLists[i /*==effToIndex[i]*/]); break; @@ -521,13 +521,13 @@ void Spell::FillTargetMap() } break; case TARGET_EFFECT_SELECT: - switch(m_spellInfo->EffectImplicitTargetB[i]) + switch (m_spellInfo->EffectImplicitTargetB[i]) { case TARGET_NONE: case TARGET_EFFECT_SELECT: SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetA[i], tmpUnitLists[i /*==effToIndex[i]*/]); break; - // dest point setup required + // dest point setup required case TARGET_AREAEFFECT_INSTANT: case TARGET_AREAEFFECT_CUSTOM: case TARGET_ALL_ENEMY_IN_AREA: @@ -542,7 +542,7 @@ void Spell::FillTargetMap() m_targets.setDestination(castObject->GetPositionX(), castObject->GetPositionY(), castObject->GetPositionZ()); SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetB[i], tmpUnitLists[i /*==effToIndex[i]*/]); break; - // target pre-selection required + // target pre-selection required case TARGET_INNKEEPER_COORDINATES: case TARGET_TABLE_X_Y_Z_COORDINATES: case TARGET_CASTER_COORDINATES: @@ -568,7 +568,7 @@ void Spell::FillTargetMap() } break; case TARGET_CASTER_COORDINATES: - switch(m_spellInfo->EffectImplicitTargetB[i]) + switch (m_spellInfo->EffectImplicitTargetB[i]) { case TARGET_ALL_ENEMY_IN_AREA: // Note: this hack with search required until GO casting not implemented @@ -576,7 +576,7 @@ void Spell::FillTargetMap() // currently each enemy selected explicitly and self cast damage if (m_spellInfo->Effect[i] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) { - if(m_targets.getUnitTarget()) + if (m_targets.getUnitTarget()) tmpUnitLists[i /*==effToIndex[i]*/].push_back(m_targets.getUnitTarget()); } else @@ -596,7 +596,7 @@ void Spell::FillTargetMap() } break; case TARGET_TABLE_X_Y_Z_COORDINATES: - switch(m_spellInfo->EffectImplicitTargetB[i]) + switch (m_spellInfo->EffectImplicitTargetB[i]) { case TARGET_NONE: SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetA[i], tmpUnitLists[i /*==effToIndex[i]*/]); @@ -614,7 +614,7 @@ void Spell::FillTargetMap() } break; case TARGET_SELF2: - switch(m_spellInfo->EffectImplicitTargetB[i]) + switch (m_spellInfo->EffectImplicitTargetB[i]) { case TARGET_NONE: case TARGET_EFFECT_SELECT: @@ -627,14 +627,14 @@ void Spell::FillTargetMap() m_targets.setDestination(castObject->GetPositionX(), castObject->GetPositionY(), castObject->GetPositionZ()); SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetB[i], tmpUnitLists[i /*==effToIndex[i]*/]); break; - // most A/B target pairs is self->negative and not expect adding caster to target list + // most A/B target pairs is self->negative and not expect adding caster to target list default: SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetB[i], tmpUnitLists[i /*==effToIndex[i]*/]); break; } break; case TARGET_DUELVSPLAYER_COORDINATES: - switch(m_spellInfo->EffectImplicitTargetB[i]) + switch (m_spellInfo->EffectImplicitTargetB[i]) { case TARGET_NONE: case TARGET_EFFECT_SELECT: @@ -649,7 +649,7 @@ void Spell::FillTargetMap() } break; default: - switch(m_spellInfo->EffectImplicitTargetB[i]) + switch (m_spellInfo->EffectImplicitTargetB[i]) { case TARGET_NONE: case TARGET_EFFECT_SELECT: @@ -672,7 +672,7 @@ void Spell::FillTargetMap() Player* me = (Player*)m_caster; for (UnitList::const_iterator itr = tmpUnitLists[effToIndex[i]].begin(); itr != tmpUnitLists[effToIndex[i]].end(); ++itr) { - Player *targetOwner = (*itr)->GetCharmerOrOwnerPlayerOrPlayerItself(); + Player* targetOwner = (*itr)->GetCharmerOrOwnerPlayerOrPlayerItself(); if (targetOwner && targetOwner != me && targetOwner->IsPvP() && !me->IsInDuelWith(targetOwner)) { me->UpdatePvP(true); @@ -684,7 +684,7 @@ void Spell::FillTargetMap() for (UnitList::iterator itr = tmpUnitLists[effToIndex[i]].begin(); itr != tmpUnitLists[effToIndex[i]].end();) { - if (!CheckTarget (*itr, SpellEffectIndex(i))) + if (!CheckTarget(*itr, SpellEffectIndex(i))) { itr = tmpUnitLists[effToIndex[i]].erase(itr); continue; @@ -837,7 +837,7 @@ void Spell::AddUnitTarget(Unit* pVictim, SpellEffectIndex effIndex) ObjectGuid targetGUID = pVictim->GetObjectGuid(); // Lookup target in already in list - for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (targetGUID == ihit->targetGUID) // Found in list { @@ -912,7 +912,7 @@ void Spell::AddGOTarget(GameObject* pVictim, SpellEffectIndex effIndex) ObjectGuid targetGUID = pVictim->GetObjectGuid(); // Lookup target in already in list - for(GOTargetList::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) + for (GOTargetList::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) { if (targetGUID == ihit->targetGUID) // Found in list { @@ -961,7 +961,7 @@ void Spell::AddItemTarget(Item* pitem, SpellEffectIndex effIndex) return; // Lookup target in already in list - for(ItemTargetList::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) + for (ItemTargetList::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) { if (pitem == ihit->item) // Found in list { @@ -978,7 +978,7 @@ void Spell::AddItemTarget(Item* pitem, SpellEffectIndex effIndex) m_UniqueItemInfo.push_back(target); } -void Spell::DoAllEffectOnTarget(TargetInfo *target) +void Spell::DoAllEffectOnTarget(TargetInfo* target) { if (target->processed) // Check target return; @@ -992,9 +992,9 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) return; // Get original caster (if exist) and calculate damage/healing from him data - Unit *real_caster = GetAffectiveCaster(); + Unit* real_caster = GetAffectiveCaster(); // FIXME: in case wild GO heal/damage spells will be used target bonuses - Unit *caster = real_caster ? real_caster : m_caster; + Unit* caster = real_caster ? real_caster : m_caster; SpellMissInfo missInfo = target->missCondition; // Need init unitTarget by default unit (can changed in code on reflect) @@ -1013,7 +1013,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) // for example caster bonus or animation, // except miss case where will assigned PROC_EX_* flags later if (((procAttacker | procVictim) & NEGATIVE_TRIGGER_MASK) && - !(target->effectMask & m_negativeEffectMask) && missInfo == SPELL_MISS_NONE) + !(target->effectMask & m_negativeEffectMask) && missInfo == SPELL_MISS_NONE) { procAttacker = PROC_FLAG_NONE; procVictim = PROC_FLAG_NONE; @@ -1040,13 +1040,13 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) unitTarget = m_caster; } } - else if(missInfo == SPELL_MISS_MISS || missInfo == SPELL_MISS_RESIST) + else if (missInfo == SPELL_MISS_MISS || missInfo == SPELL_MISS_RESIST) { - if(real_caster && real_caster != unit) + if (real_caster && real_caster != unit) { // can cause back attack (if detected) if (!m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO) && !IsPositiveSpell(m_spellInfo->Id) && - m_caster->isVisibleForOrDetect(unit, unit, false)) + m_caster->isVisibleForOrDetect(unit, unit, false)) { if (!unit->isInCombat() && unit->GetTypeId() != TYPEID_PLAYER && ((Creature*)unit)->AI()) ((Creature*)unit)->AI()->AttackedBy(real_caster); @@ -1118,14 +1118,14 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) // trigger weapon enchants for weapon based spells; exclude spells that stop attack, because may break CC if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && - !m_spellInfo->HasAttribute(SPELL_ATTR_STOP_ATTACK_TARGET)) + !m_spellInfo->HasAttribute(SPELL_ATTR_STOP_ATTACK_TARGET)) ((Player*)m_caster)->CastItemCombatSpell(unitTarget, m_attackType); // Haunt (NOTE: for avoid use additional field damage stored in dummy value (replace unused 100%) // apply before deal damage because aura can be removed at target kill if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellIconID == 3172 && - (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0004000000000000))) - if(Aura* dummy = unitTarget->GetDummyAura(m_spellInfo->Id)) + (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0004000000000000))) + if (Aura* dummy = unitTarget->GetDummyAura(m_spellInfo->Id)) dummy->GetModifier()->m_amount = damageInfo.damage; caster->DealSpellDamage(&damageInfo, true); @@ -1135,10 +1135,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) { uint32 count = 0; Unit::SpellAuraHolderMap const& auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) + for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) { - if(itr->second->GetSpellProto()->Dispel == DISPEL_DISEASE && - itr->second->GetCasterGuid() == caster->GetObjectGuid()) + if (itr->second->GetSpellProto()->Dispel == DISPEL_DISEASE && + itr->second->GetCasterGuid() == caster->GetObjectGuid()) ++count; } @@ -1170,7 +1170,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) if (Player* p = real_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) p->RewardPlayerAndGroupAtCast(unit, m_spellInfo->Id); - if(((Creature*)unit)->AI()) + if (((Creature*)unit)->AI()) ((Creature*)unit)->AI()->SpellHit(m_caster, m_spellInfo); } @@ -1181,7 +1181,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) ((Creature*)real_caster)->AI()->SpellHitTarget(unit, m_spellInfo); } -void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) +void Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask) { if (!unit || !effectMask) return; @@ -1190,8 +1190,8 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) // Recheck immune (only for delayed spells) if (m_spellInfo->speed && ( - unit->IsImmunedToDamage(GetSpellSchoolMask(m_spellInfo)) || - unit->IsImmuneToSpell(m_spellInfo))) + unit->IsImmunedToDamage(GetSpellSchoolMask(m_spellInfo)) || + unit->IsImmuneToSpell(m_spellInfo))) { if (realCaster) realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_IMMUNE); @@ -1213,8 +1213,8 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) { // Recheck UNIT_FLAG_NON_ATTACKABLE for delayed spells if (m_spellInfo->speed > 0.0f && - unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && - unit->GetCharmerOrOwnerGuid() != m_caster->GetObjectGuid()) + unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && + unit->GetCharmerOrOwnerGuid() != m_caster->GetObjectGuid()) { realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); ResetEffectDamageAndHeal(); @@ -1225,7 +1225,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) { // for delayed spells ignore not visible explicit target if (m_spellInfo->speed > 0.0f && unit == m_targets.getUnitTarget() && - !unit->isVisibleForOrDetect(m_caster, m_caster, false)) + !unit->isVisibleForOrDetect(m_caster, m_caster, false)) { realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); ResetEffectDamageAndHeal(); @@ -1238,7 +1238,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) // can cause back attack (if detected), stealth removed at Spell::cast if spell break it if (!m_spellInfo->HasAttribute(SPELL_ATTR_EX3_NO_INITIAL_AGGRO) && !IsPositiveSpell(m_spellInfo->Id) && - m_caster->isVisibleForOrDetect(unit, unit, false)) + m_caster->isVisibleForOrDetect(unit, unit, false)) { // use speedup check to avoid re-remove after above lines if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_NOT_BREAK_STEALTH)) @@ -1257,7 +1257,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) unit->SetInCombatWith(realCaster); realCaster->SetInCombatWith(unit); - if (Player *attackedPlayer = unit->GetCharmerOrOwnerPlayerOrPlayerItself()) + if (Player* attackedPlayer = unit->GetCharmerOrOwnerPlayerOrPlayerItself()) realCaster->SetContestedPvP(attackedPlayer); } } @@ -1288,7 +1288,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) m_diminishLevel = unit->GetDiminishing(m_diminishGroup); // Increase Diminishing on unit, current informations for actually casts will use values above if ((GetDiminishingReturnsGroupType(m_diminishGroup) == DRTYPE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) || - GetDiminishingReturnsGroupType(m_diminishGroup) == DRTYPE_ALL) + GetDiminishingReturnsGroupType(m_diminishGroup) == DRTYPE_ALL) unit->IncrDiminishing(m_diminishGroup); // Apply additional spell effects to target @@ -1302,18 +1302,18 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) else m_spellAuraHolder = NULL; - for(int effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber) + for (int effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber) { if (effectMask & (1 << effectNumber)) { HandleEffects(unit, NULL, NULL, SpellEffectIndex(effectNumber), m_damageMultipliers[effectNumber]); - if ( m_applyMultiplierMask & (1 << effectNumber) ) + if (m_applyMultiplierMask & (1 << effectNumber)) { // Get multiplier float multiplier = m_spellInfo->DmgMultiplier[effectNumber]; // Apply multiplier mods if (realCaster) - if(Player* modOwner = realCaster->GetSpellModOwner()) + if (Player* modOwner = realCaster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier, this); m_damageMultipliers[effectNumber] *= multiplier; } @@ -1357,47 +1357,47 @@ void Spell::DoSpellHitOnUnit(Unit *unit, uint32 effectMask) } } -void Spell::DoAllEffectOnTarget(GOTargetInfo *target) +void Spell::DoAllEffectOnTarget(GOTargetInfo* target) { if (target->processed) // Check target return; target->processed = true; // Target checked in apply effects procedure uint32 effectMask = target->effectMask; - if(!effectMask) + if (!effectMask) return; GameObject* go = m_caster->GetMap()->GetGameObject(target->targetGUID); - if(!go) + if (!go) return; - for(int effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber) + for (int effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber) if (effectMask & (1 << effectNumber)) HandleEffects(NULL, NULL, go, SpellEffectIndex(effectNumber)); // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) - if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive() ) + if (!IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) { - if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) + if (Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) p->RewardPlayerAndGroupAtCast(go, m_spellInfo->Id); } } -void Spell::DoAllEffectOnTarget(ItemTargetInfo *target) +void Spell::DoAllEffectOnTarget(ItemTargetInfo* target) { uint32 effectMask = target->effectMask; - if(!target->item || !effectMask) + if (!target->item || !effectMask) return; - for(int effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber) + for (int effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber) if (effectMask & (1 << effectNumber)) HandleEffects(NULL, target->item, NULL, SpellEffectIndex(effectNumber)); } -void Spell::HandleDelayedSpellLaunch(TargetInfo *target) +void Spell::HandleDelayedSpellLaunch(TargetInfo* target) { - // Get mask of effects for target + // Get mask of effects for target uint32 mask = target->effectMask; Unit* unit = m_caster->GetObjectGuid() == target->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, target->targetGUID); @@ -1405,9 +1405,9 @@ void Spell::HandleDelayedSpellLaunch(TargetInfo *target) return; // Get original caster (if exist) and calculate damage/healing from him data - Unit *real_caster = GetAffectiveCaster(); + Unit* real_caster = GetAffectiveCaster(); // FIXME: in case wild GO heal/damage spells will be used target bonuses - Unit *caster = real_caster ? real_caster : m_caster; + Unit* caster = real_caster ? real_caster : m_caster; SpellMissInfo missInfo = target->missCondition; // Need init unitTarget by default unit (can changed in code on reflect) @@ -1429,13 +1429,13 @@ void Spell::HandleDelayedSpellLaunch(TargetInfo *target) if (mask & (1 << effectNumber) && IsEffectHandledOnDelayedSpellLaunch(m_spellInfo, SpellEffectIndex(effectNumber))) { HandleEffects(unit, NULL, NULL, SpellEffectIndex(effectNumber), m_damageMultipliers[effectNumber]); - if ( m_applyMultiplierMask & (1 << effectNumber) ) + if (m_applyMultiplierMask & (1 << effectNumber)) { // Get multiplier float multiplier = m_spellInfo->DmgMultiplier[effectNumber]; // Apply multiplier mods if (real_caster) - if(Player* modOwner = real_caster->GetSpellModOwner()) + if (Player* modOwner = real_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier, this); m_damageMultipliers[effectNumber] *= multiplier; } @@ -1459,12 +1459,12 @@ void Spell::InitializeDamageMultipliers() uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i]; if (Unit* realCaster = GetAffectiveCaster()) - if(Player* modOwner = realCaster->GetSpellModOwner()) + if (Player* modOwner = realCaster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, EffectChainTarget, this); m_damageMultipliers[i] = 1.0f; - if( (m_spellInfo->EffectImplicitTargetA[i] == TARGET_CHAIN_DAMAGE || m_spellInfo->EffectImplicitTargetA[i] == TARGET_CHAIN_HEAL) && - (EffectChainTarget > 1) ) + if ((m_spellInfo->EffectImplicitTargetA[i] == TARGET_CHAIN_DAMAGE || m_spellInfo->EffectImplicitTargetA[i] == TARGET_CHAIN_HEAL) && + (EffectChainTarget > 1)) m_applyMultiplierMask |= (1 << i); } } @@ -1477,11 +1477,11 @@ bool Spell::IsAliveUnitPresentInTargetList() uint8 needAliveTargetMask = m_needAliveTargetMask; - for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask)) { - Unit *unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); + Unit* unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); // either unit is alive and normal spell, or unit dead and deathonly-spell if (unit && (unit->isAlive() != IsDeathOnlySpell(m_spellInfo))) @@ -1511,7 +1511,7 @@ struct ChainHealingOrder : public std::binary_functionGetTypeId() == TYPEID_PLAYER && MainTarget->GetTypeId() == TYPEID_PLAYER && - ((Player const*)Target)->IsInSameRaidWith((Player const*)MainTarget)) + ((Player const*)Target)->IsInSameRaidWith((Player const*)MainTarget)) { if (Target->GetHealth() == Target->GetMaxHealth()) return 40000; @@ -1573,7 +1573,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& if (Unit* realCaster = GetAffectiveCaster()) { - if(Player* modOwner = realCaster->GetSpellModOwner()) + if (Player* modOwner = realCaster->GetSpellModOwner()) { modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius, this); modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, EffectChainTarget, this); @@ -1584,11 +1584,11 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& uint32 unMaxTargets = m_spellInfo->MaxAffectedTargets; // custom target amount cases - switch(m_spellInfo->SpellFamilyName) + switch (m_spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 802: // Mutate Bug case 804: // Explode Bug @@ -1752,9 +1752,9 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& // overwrite EffectChainTarget for non single target spell if (Spell* currSpell = m_caster->GetCurrentSpell(CURRENT_GENERIC_SPELL)) if (currSpell->m_spellInfo->MaxAffectedTargets > 0 || - currSpell->m_spellInfo->EffectChainTarget[EFFECT_INDEX_0] > 0 || - currSpell->m_spellInfo->EffectChainTarget[EFFECT_INDEX_1] > 0 || - currSpell->m_spellInfo->EffectChainTarget[EFFECT_INDEX_2] > 0) + currSpell->m_spellInfo->EffectChainTarget[EFFECT_INDEX_0] > 0 || + currSpell->m_spellInfo->EffectChainTarget[EFFECT_INDEX_1] > 0 || + currSpell->m_spellInfo->EffectChainTarget[EFFECT_INDEX_2] > 0) EffectChainTarget = 0; // no chain targets } break; @@ -1804,7 +1804,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& } Unit::AuraList const& mod = m_caster->GetAurasByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS); - for(Unit::AuraList::const_iterator m = mod.begin(); m != mod.end(); ++m) + for (Unit::AuraList::const_iterator m = mod.begin(); m != mod.end(); ++m) { if (!(*m)->isAffectedOnSpell(m_spellInfo)) continue; @@ -1896,7 +1896,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& Cell::VisitAllObjects(m_caster, searcher, max_range); } - if(tempTargetUnitMap.empty()) + if (tempTargetUnitMap.empty()) break; tempTargetUnitMap.sort(TargetDistanceOrderNear(m_caster)); @@ -1904,15 +1904,15 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& //Now to get us a random target that's in the initial range of the spell uint32 t = 0; UnitList::iterator itr = tempTargetUnitMap.begin(); - while(itr!= tempTargetUnitMap.end() && (*itr)->IsWithinDist(m_caster, radius)) + while (itr!= tempTargetUnitMap.end() && (*itr)->IsWithinDist(m_caster, radius)) ++t, ++itr; - if(!t) + if (!t) break; itr = tempTargetUnitMap.begin(); std::advance(itr, rand() % t); - Unit *pUnitTarget = *itr; + Unit* pUnitTarget = *itr; targetUnitMap.push_back(pUnitTarget); tempTargetUnitMap.erase(itr); @@ -1920,15 +1920,15 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& tempTargetUnitMap.sort(TargetDistanceOrderNear(pUnitTarget)); t = unMaxTargets - 1; - Unit *prev = pUnitTarget; + Unit* prev = pUnitTarget; UnitList::iterator next = tempTargetUnitMap.begin(); - while(t && next != tempTargetUnitMap.end()) + while (t && next != tempTargetUnitMap.end()) { - if(!prev->IsWithinDist(*next, CHAIN_SPELL_JUMP_RADIUS)) + if (!prev->IsWithinDist(*next, CHAIN_SPELL_JUMP_RADIUS)) break; - if(!prev->IsWithinLOSInMap(*next)) + if (!prev->IsWithinLOSInMap(*next)) { ++next; continue; @@ -1956,7 +1956,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& Cell::VisitAllObjects(m_caster, searcher, max_range); } - if(tempTargetUnitMap.empty()) + if (tempTargetUnitMap.empty()) break; tempTargetUnitMap.sort(TargetDistanceOrderNear(m_caster)); @@ -1964,15 +1964,15 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& //Now to get us a random target that's in the initial range of the spell uint32 t = 0; UnitList::iterator itr = tempTargetUnitMap.begin(); - while(itr != tempTargetUnitMap.end() && (*itr)->IsWithinDist(m_caster, radius)) + while (itr != tempTargetUnitMap.end() && (*itr)->IsWithinDist(m_caster, radius)) ++t, ++itr; - if(!t) + if (!t) break; itr = tempTargetUnitMap.begin(); std::advance(itr, rand() % t); - Unit *pUnitTarget = *itr; + Unit* pUnitTarget = *itr; targetUnitMap.push_back(pUnitTarget); tempTargetUnitMap.erase(itr); @@ -1980,15 +1980,15 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& tempTargetUnitMap.sort(TargetDistanceOrderNear(pUnitTarget)); t = unMaxTargets - 1; - Unit *prev = pUnitTarget; + Unit* prev = pUnitTarget; UnitList::iterator next = tempTargetUnitMap.begin(); - while(t && next != tempTargetUnitMap.end()) + while (t && next != tempTargetUnitMap.end()) { - if(!prev->IsWithinDist(*next, CHAIN_SPELL_JUMP_RADIUS)) + if (!prev->IsWithinDist(*next, CHAIN_SPELL_JUMP_RADIUS)) break; - if(!prev->IsWithinLOSInMap(*next)) + if (!prev->IsWithinLOSInMap(*next)) { ++next; continue; @@ -2013,7 +2013,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& { if (EffectChainTarget <= 1) { - if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) + if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) { m_targets.setUnitTarget(pUnitTarget); m_spellFlags |= SPELL_FLAG_REDIRECTED; @@ -2024,13 +2024,13 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& { Unit* pUnitTarget = m_targets.getUnitTarget(); WorldObject* originalCaster = GetAffectiveCasterObject(); - if(!pUnitTarget || !originalCaster) + if (!pUnitTarget || !originalCaster) break; unMaxTargets = EffectChainTarget; float max_range; - if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE) + if (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE) max_range = radius; else //FIXME: This very like horrible hack and wrong for most spells @@ -2053,7 +2053,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& targetUnitMap.push_back(pUnitTarget); uint32 t = unMaxTargets - 1; - Unit *prev = pUnitTarget; + Unit* prev = pUnitTarget; UnitList::iterator next = tempTargetUnitMap.begin(); while (t && next != tempTargetUnitMap.end()) @@ -2108,7 +2108,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& // fill real target list if no spell script target defined FillAreaTargets(bounds.first != bounds.second ? tempTargetUnitMap : targetUnitMap, - radius, PUSH_DEST_CENTER, bounds.first != bounds.second ? SPELL_TARGETS_ALL : targetB); + radius, PUSH_DEST_CENTER, bounds.first != bounds.second ? SPELL_TARGETS_ALL : targetB); if (!tempTargetUnitMap.empty()) { @@ -2117,7 +2117,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& if ((*iter)->GetTypeId() != TYPEID_UNIT) continue; - for(SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) + for (SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) { // only creature entries supported for this target type if (i_spellST->second.type == SPELL_TARGET_TYPE_GAMEOBJECT) @@ -2166,7 +2166,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& if ((*iter)->GetTypeId() != TYPEID_UNIT) continue; - for(SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) + for (SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) { // only creature entries supported for this target type if (i_spellST->second.type == SPELL_TARGET_TYPE_GAMEOBJECT) @@ -2191,7 +2191,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& else { // remove not targetable units if spell has no script targets - for (UnitList::iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ) + for (UnitList::iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end();) { if (!(*itr)->isTargetableForAttack(m_spellInfo->HasAttribute(SPELL_ATTR_EX3_CAST_ON_DEAD))) targetUnitMap.erase(itr++); @@ -2246,7 +2246,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& case TARGET_ALL_ENEMY_IN_AREA_INSTANT: { // targets the ground, not the units in the area - switch(m_spellInfo->Effect[effIndex]) + switch (m_spellInfo->Effect[effIndex]) { case SPELL_EFFECT_PERSISTENT_AREA_AURA: break; @@ -2267,7 +2267,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& } case TARGET_DUELVSPLAYER_COORDINATES: { - if(Unit* currentTarget = m_targets.getUnitTarget()) + if (Unit* currentTarget = m_targets.getUnitTarget()) m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ()); break; } @@ -2294,7 +2294,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& } case TARGET_ALL_RAID_AROUND_CASTER: { - if(m_spellInfo->Id == 57669) // Replenishment (special target selection) + if (m_spellInfo->Id == 57669) // Replenishment (special target selection) { // in arena, target should be only caster if (m_caster->GetMap()->IsBattleArena()) @@ -2310,18 +2310,18 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& } case TARGET_SINGLE_FRIEND: case TARGET_SINGLE_FRIEND_2: - if(m_targets.getUnitTarget()) + if (m_targets.getUnitTarget()) targetUnitMap.push_back(m_targets.getUnitTarget()); break; case TARGET_NONCOMBAT_PET: - if(Unit* target = m_targets.getUnitTarget()) - if( target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsPet() && ((Pet*)target)->getPetType() == MINI_PET) + if (Unit* target = m_targets.getUnitTarget()) + if (target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsPet() && ((Pet*)target)->getPetType() == MINI_PET) targetUnitMap.push_back(target); break; case TARGET_CASTER_COORDINATES: { // Check original caster is GO - set its coordinates as src cast - if (WorldObject *caster = GetCastingObject()) + if (WorldObject* caster = GetCastingObject()) m_targets.setSource(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ()); break; } @@ -2362,12 +2362,12 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && m_spellInfo->SpellVisual[0] == 8253) { Unit* target = m_targets.getUnitTarget(); - if(!target) + if (!target) target = m_caster; uint32 count = 5; // Glyph of Circle of Healing - if(Aura const* glyph = m_caster->GetDummyAura(55675)) + if (Aura const* glyph = m_caster->GetDummyAura(55675)) count += glyph->GetModifier()->m_amount; FillRaidOrPartyHealthPriorityTargets(targetUnitMap, m_caster, target, radius, count, true, false, true); @@ -2376,7 +2376,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DRUID && m_spellInfo->SpellIconID == 2864) { Unit* target = m_targets.getUnitTarget(); - if(!target) + if (!target) target = m_caster; uint32 count = CalculateDamage(EFFECT_INDEX_2,m_caster); // stored in dummy effect, affected by mods @@ -2385,23 +2385,23 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& else FillAreaTargets(targetUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_FRIENDLY); break; - // TARGET_SINGLE_PARTY means that the spells can only be casted on a party member and not on the caster (some seals, fire shield from imp, etc..) + // TARGET_SINGLE_PARTY means that the spells can only be casted on a party member and not on the caster (some seals, fire shield from imp, etc..) case TARGET_SINGLE_PARTY: { - Unit *target = m_targets.getUnitTarget(); + Unit* target = m_targets.getUnitTarget(); // Those spells apparently can't be casted on the caster. - if( target && target != m_caster) + if (target && target != m_caster) { // Can only be casted on group's members or its pets - Group *pGroup = NULL; + Group* pGroup = NULL; Unit* owner = m_caster->GetCharmerOrOwner(); - Unit *targetOwner = target->GetCharmerOrOwner(); - if(owner) + Unit* targetOwner = target->GetCharmerOrOwner(); + if (owner) { - if(owner->GetTypeId() == TYPEID_PLAYER) + if (owner->GetTypeId() == TYPEID_PLAYER) { - if( target == owner ) + if (target == owner) { targetUnitMap.push_back(target); break; @@ -2411,7 +2411,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& } else if (m_caster->GetTypeId() == TYPEID_PLAYER) { - if( targetOwner == m_caster && target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsPet()) + if (targetOwner == m_caster && target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsPet()) { targetUnitMap.push_back(target); break; @@ -2419,15 +2419,15 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& pGroup = ((Player*)m_caster)->GetGroup(); } - if(pGroup) + if (pGroup) { // Our target can also be a player's pet who's grouped with us or our pet. But can't be controlled player - if(targetOwner) + if (targetOwner) { - if( targetOwner->GetTypeId() == TYPEID_PLAYER && - target->GetTypeId() == TYPEID_UNIT && (((Creature*)target)->IsPet()) && - target->GetOwnerGuid() == targetOwner->GetObjectGuid() && - pGroup->IsMember(((Player*)targetOwner)->GetObjectGuid())) + if (targetOwner->GetTypeId() == TYPEID_PLAYER && + target->GetTypeId() == TYPEID_UNIT && (((Creature*)target)->IsPet()) && + target->GetOwnerGuid() == targetOwner->GetObjectGuid() && + pGroup->IsMember(((Player*)targetOwner)->GetObjectGuid())) { targetUnitMap.push_back(target); } @@ -2442,7 +2442,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& break; } case TARGET_GAMEOBJECT: - if(m_targets.getGOTarget()) + if (m_targets.getGOTarget()) AddGOTarget(m_targets.getGOTarget(), effIndex); break; case TARGET_IN_FRONT_OF_CASTER: @@ -2462,16 +2462,16 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& break; case TARGET_DUELVSPLAYER: { - Unit *target = m_targets.getUnitTarget(); - if(target) + Unit* target = m_targets.getUnitTarget(); + if (target) { - if(m_caster->IsFriendlyTo(target)) + if (m_caster->IsFriendlyTo(target)) { targetUnitMap.push_back(target); } else { - if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) + if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) { m_targets.setUnitTarget(pUnitTarget); m_spellFlags |= SPELL_FLAG_REDIRECTED; @@ -2488,7 +2488,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& AddItemTarget(m_targets.getItemTarget(), effIndex); break; case TARGET_MASTER: - if(Unit* owner = m_caster->GetCharmerOrOwner()) + if (Unit* owner = m_caster->GetCharmerOrOwner()) targetUnitMap.push_back(owner); break; case TARGET_ALL_ENEMY_IN_AREA_CHANNELED: @@ -2497,12 +2497,12 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& FillAreaTargets(targetUnitMap, radius, PUSH_DEST_CENTER, SPELL_TARGETS_AOE_DAMAGE); break; case TARGET_MINION: - if(m_spellInfo->Effect[effIndex] != SPELL_EFFECT_DUEL) + if (m_spellInfo->Effect[effIndex] != SPELL_EFFECT_DUEL) targetUnitMap.push_back(m_caster); break; case TARGET_SINGLE_ENEMY: { - if(Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) + if (Unit* pUnitTarget = m_caster->SelectMagnetTarget(m_targets.getUnitTarget(), this, effIndex)) { m_targets.setUnitTarget(pUnitTarget); m_spellFlags |= SPELL_FLAG_REDIRECTED; @@ -2513,24 +2513,24 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& case TARGET_AREAEFFECT_PARTY: { Unit* owner = m_caster->GetCharmerOrOwner(); - Player *pTarget = NULL; + Player* pTarget = NULL; - if(owner) + if (owner) { targetUnitMap.push_back(m_caster); - if(owner->GetTypeId() == TYPEID_PLAYER) + if (owner->GetTypeId() == TYPEID_PLAYER) pTarget = (Player*)owner; } else if (m_caster->GetTypeId() == TYPEID_PLAYER) { - if(Unit* target = m_targets.getUnitTarget()) + if (Unit* target = m_targets.getUnitTarget()) { - if( target->GetTypeId() != TYPEID_PLAYER) + if (target->GetTypeId() != TYPEID_PLAYER) { - if(((Creature*)target)->IsPet()) + if (((Creature*)target)->IsPet()) { - Unit *targetOwner = target->GetOwner(); - if(targetOwner->GetTypeId() == TYPEID_PLAYER) + Unit* targetOwner = target->GetOwner(); + if (targetOwner->GetTypeId() == TYPEID_PLAYER) pTarget = (Player*)targetOwner; } } @@ -2541,46 +2541,46 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& Group* pGroup = pTarget ? pTarget->GetGroup() : NULL; - if(pGroup) + if (pGroup) { uint8 subgroup = pTarget->GetSubGroup(); - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); // IsHostileTo check duel and controlled by enemy - if(Target && Target->GetSubGroup() == subgroup && !m_caster->IsHostileTo(Target)) + if (Target && Target->GetSubGroup() == subgroup && !m_caster->IsHostileTo(Target)) { - if( pTarget->IsWithinDistInMap(Target, radius) ) + if (pTarget->IsWithinDistInMap(Target, radius)) targetUnitMap.push_back(Target); - if(Pet* pet = Target->GetPet()) - if( pTarget->IsWithinDistInMap(pet, radius) ) + if (Pet* pet = Target->GetPet()) + if (pTarget->IsWithinDistInMap(pet, radius)) targetUnitMap.push_back(pet); } } } else if (owner) { - if(m_caster->IsWithinDistInMap(owner, radius)) + if (m_caster->IsWithinDistInMap(owner, radius)) targetUnitMap.push_back(owner); } - else if(pTarget) + else if (pTarget) { targetUnitMap.push_back(pTarget); - if(Pet* pet = pTarget->GetPet()) - if( m_caster->IsWithinDistInMap(pet, radius) ) + if (Pet* pet = pTarget->GetPet()) + if (m_caster->IsWithinDistInMap(pet, radius)) targetUnitMap.push_back(pet); } break; } case TARGET_SCRIPT: { - if(m_targets.getUnitTarget()) + if (m_targets.getUnitTarget()) targetUnitMap.push_back(m_targets.getUnitTarget()); - if(m_targets.getItemTarget()) + if (m_targets.getItemTarget()) AddItemTarget(m_targets.getItemTarget(), effIndex); break; } @@ -2590,7 +2590,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& case TARGET_CHAIN_HEAL: { Unit* pUnitTarget = m_targets.getUnitTarget(); - if(!pUnitTarget) + if (!pUnitTarget) break; if (EffectChainTarget <= 1) @@ -2617,21 +2617,21 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& targetUnitMap.push_back(pUnitTarget); uint32 t = unMaxTargets - 1; - Unit *prev = pUnitTarget; + Unit* prev = pUnitTarget; UnitList::iterator next = tempTargetUnitMap.begin(); - while(t && next != tempTargetUnitMap.end()) + while (t && next != tempTargetUnitMap.end()) { - if(!prev->IsWithinDist(*next, CHAIN_SPELL_JUMP_RADIUS)) + if (!prev->IsWithinDist(*next, CHAIN_SPELL_JUMP_RADIUS)) break; - if(!prev->IsWithinLOSInMap(*next)) + if (!prev->IsWithinLOSInMap(*next)) { ++next; continue; } - if((*next)->GetHealth() == (*next)->GetMaxHealth()) + if ((*next)->GetHealth() == (*next)->GetMaxHealth()) { next = tempTargetUnitMap.erase(next); continue; @@ -2651,7 +2651,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& case TARGET_CURRENT_ENEMY_COORDINATES: { Unit* currentTarget = m_targets.getUnitTarget(); - if(currentTarget) + if (currentTarget) { targetUnitMap.push_back(currentTarget); m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ()); @@ -2661,25 +2661,25 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& case TARGET_AREAEFFECT_PARTY_AND_CLASS: { Player* targetPlayer = m_targets.getUnitTarget() && m_targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER - ? (Player*)m_targets.getUnitTarget() : NULL; + ? (Player*)m_targets.getUnitTarget() : NULL; Group* pGroup = targetPlayer ? targetPlayer->GetGroup() : NULL; - if(pGroup) + if (pGroup) { - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); // IsHostileTo check duel and controlled by enemy - if( Target && targetPlayer->IsWithinDistInMap(Target, radius) && - targetPlayer->getClass() == Target->getClass() && - !m_caster->IsHostileTo(Target) ) + if (Target && targetPlayer->IsWithinDistInMap(Target, radius) && + targetPlayer->getClass() == Target->getClass() && + !m_caster->IsHostileTo(Target)) { targetUnitMap.push_back(Target); } } } - else if(m_targets.getUnitTarget()) + else if (m_targets.getUnitTarget()) targetUnitMap.push_back(m_targets.getUnitTarget()); break; } @@ -2692,7 +2692,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& // far-teleport spells are handled in SpellEffect, elsewise report an error about an unexpected map (spells are always locally) if (st->target_mapId != m_caster->GetMapId() && m_spellInfo->Effect[effIndex] != SPELL_EFFECT_TELEPORT_UNITS) - sLog.outError( "SPELL: wrong map (%u instead %u) target coordinates for spell ID %u", st->target_mapId, m_caster->GetMapId(), m_spellInfo->Id); + sLog.outError("SPELL: wrong map (%u instead %u) target coordinates for spell ID %u", st->target_mapId, m_caster->GetMapId(), m_spellInfo->Id); } else sLog.outError("SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); @@ -2703,23 +2703,23 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& case TARGET_RIGHT_FROM_VICTIM: case TARGET_LEFT_FROM_VICTIM: { - Unit *pTarget = NULL; + Unit* pTarget = NULL; // explicit cast data from client or server-side cast // some spell at client send caster - if(m_targets.getUnitTarget() && m_targets.getUnitTarget()!=m_caster) + if (m_targets.getUnitTarget() && m_targets.getUnitTarget()!=m_caster) pTarget = m_targets.getUnitTarget(); - else if(m_caster->getVictim()) + else if (m_caster->getVictim()) pTarget = m_caster->getVictim(); - else if(m_caster->GetTypeId() == TYPEID_PLAYER) + else if (m_caster->GetTypeId() == TYPEID_PLAYER) pTarget = ObjectAccessor::GetUnit(*m_caster, ((Player*)m_caster)->GetSelectionGuid()); - if(pTarget) + if (pTarget) { float angle = 0.0f; float dist = (radius && targetMode != TARGET_BEHIND_VICTIM) ? radius : CONTACT_DISTANCE; - switch(targetMode) + switch (targetMode) { case TARGET_INFRONT_OF_VICTIM: break; case TARGET_BEHIND_VICTIM: angle = M_PI_F; break; @@ -2729,7 +2729,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& float _target_x, _target_y, _target_z; pTarget->GetClosePoint(_target_x, _target_y, _target_z, pTarget->GetObjectBoundingRadius(), dist, angle); - if(pTarget->IsWithinLOS(_target_x, _target_y, _target_z)) + if (pTarget->IsWithinLOS(_target_x, _target_y, _target_z)) { targetUnitMap.push_back(m_caster); m_targets.setDestination(_target_x, _target_y, _target_z); @@ -2764,7 +2764,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& radius = 10.0f; float angle = m_caster->GetOrientation(); - switch(targetMode) + switch (targetMode) { case TARGET_DYNAMIC_OBJECT_FRONT: break; case TARGET_DYNAMIC_OBJECT_BEHIND: angle += M_PI_F; break; @@ -2795,7 +2795,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& Unit* currentTarget = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster; float angle = currentTarget != m_caster ? currentTarget->GetAngle(m_caster) : m_caster->GetOrientation(); - switch(targetMode) + switch (targetMode) { case TARGET_POINT_AT_NORTH: break; case TARGET_POINT_AT_SOUTH: angle += M_PI_F; break; @@ -2834,19 +2834,19 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& { // add here custom effects that need default target. // FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!! - switch(m_spellInfo->Effect[effIndex]) + switch (m_spellInfo->Effect[effIndex]) { case SPELL_EFFECT_DUMMY: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 20577: // Cannibalize { WorldObject* result = FindCorpseUsing (); - if(result) + if (result) { - switch(result->GetTypeId()) + switch (result->GetTypeId()) { case TYPEID_UNIT: case TYPEID_PLAYER: @@ -2910,7 +2910,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& targetUnitMap.push_back(m_targets.getUnitTarget()); if (m_targets.getCorpseTargetGuid()) { - if (Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGuid())) + if (Corpse* corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGuid())) if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGuid())) targetUnitMap.push_back(owner); } @@ -2930,7 +2930,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& targetUnitMap.push_back(m_caster); break; case SPELL_EFFECT_PERSISTENT_AREA_AURA: - if(Unit* currentTarget = m_targets.getUnitTarget()) + if (Unit* currentTarget = m_targets.getUnitTarget()) m_targets.setDestination(currentTarget->GetPositionX(), currentTarget->GetPositionY(), currentTarget->GetPositionZ()); break; case SPELL_EFFECT_LEARN_PET_SPELL: @@ -2947,7 +2947,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& AddItemTarget(m_targets.getItemTarget(), effIndex); break; case SPELL_EFFECT_APPLY_AURA: - switch(m_spellInfo->EffectApplyAuraName[effIndex]) + switch (m_spellInfo->EffectApplyAuraName[effIndex]) { case SPELL_AURA_ADD_FLAT_MODIFIER: // some spell mods auras have 0 target modes instead expected TARGET_SELF(1) (and present for other ranks for same spell for example) case SPELL_AURA_ADD_PCT_MODIFIER: @@ -2969,7 +2969,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& targetUnitMap.push_back(m_targets.getUnitTarget()); else if (m_targets.getCorpseTargetGuid()) { - if (Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGuid())) + if (Corpse* corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGuid())) if (Player* owner = ObjectAccessor::FindPlayer(corpse->GetOwnerGuid())) targetUnitMap.push_back(owner); } @@ -3070,7 +3070,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura) m_castPositionZ = m_caster->GetPositionZ(); m_castOrientation = m_caster->GetOrientation(); - if(triggeredByAura) + if (triggeredByAura) m_triggeredByAuraSpell = triggeredByAura->GetSpellProto(); // create and add update event for this spell @@ -3078,7 +3078,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura) m_caster->m_Events.AddEvent(Event, m_caster->m_Events.CalculateTime(1)); //Prevent casting at cast another spell (ServerSide check) - if(m_caster->IsNonMeleeSpellCasted(false, true, true) && m_cast_count) + if (m_caster->IsNonMeleeSpellCasted(false, true, true) && m_cast_count) { SendCastResult(SPELL_FAILED_SPELL_IN_PROGRESS); finish(false); @@ -3089,9 +3089,9 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura) m_powerCost = CalculatePowerCost(m_spellInfo, m_caster, this, m_CastItem); SpellCastResult result = CheckCast(true); - if(result != SPELL_CAST_OK && !IsAutoRepeat()) //always cast autorepeat dummy for triggering + if (result != SPELL_CAST_OK && !IsAutoRepeat()) //always cast autorepeat dummy for triggering { - if(triggeredByAura) + if (triggeredByAura) { SendChannelUpdate(0); triggeredByAura->GetHolder()->SetAuraDuration(0); @@ -3113,7 +3113,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura) // stealth must be removed at cast starting (at show channel bar) // skip triggered spell (item equip spell casting and other not explicit character casts/item uses) - if ( !m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) ) + if (!m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo)) { m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); m_caster->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH); @@ -3123,7 +3123,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura) if (!m_IsTriggeredSpell) { // add to cast type slot - m_caster->SetCurrentCastedSpell( this ); + m_caster->SetCurrentCastedSpell(this); // will show cast bar SendSpellStart(); @@ -3131,7 +3131,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura) TriggerGlobalCooldown(); } // execute triggered without cast time explicitly in call point - else if(m_timer == 0) + else if (m_timer == 0) cast(true); // else triggered with cast time will execute execute at next tick or later // without adding to cast type slot @@ -3140,7 +3140,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura) void Spell::cancel() { - if(m_spellState == SPELL_STATE_FINISHED) + if (m_spellState == SPELL_STATE_FINISHED) return; // channeled spells don't display interrupted message even if they are interrupted, possible other cases with no "Interrupted" message @@ -3163,7 +3163,7 @@ void Spell::cancel() case SPELL_STATE_CASTING: { - for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (ihit->missCondition == SPELL_MISS_NONE) { @@ -3241,7 +3241,7 @@ void Spell::cast(bool skipCheck) if (!skipCheck) { castResult = CheckCast(false); - if(castResult != SPELL_CAST_OK) + if (castResult != SPELL_CAST_OK) { SendCastResult(castResult); finish(false); @@ -3252,7 +3252,7 @@ void Spell::cast(bool skipCheck) } // different triggered (for caster and main target after main cast) and pre-cast (casted before apply effect to each target) cases - switch(m_spellInfo->SpellFamilyName) + switch (m_spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { @@ -3304,7 +3304,7 @@ void Spell::cast(bool skipCheck) // Bloodsurge (triggered), Sudden Death (triggered) else if (m_spellInfo->Id == 46916 || m_spellInfo->Id == 52437) // Item - Warrior T10 Melee 4P Bonus - if (Aura *aur = m_caster->GetAura(70847, EFFECT_INDEX_0)) + if (Aura* aur = m_caster->GetAura(70847, EFFECT_INDEX_0)) if (roll_chance_i(aur->GetModifier()->m_amount)) AddTriggeredSpell(70849); // Extra Charge! break; @@ -3313,13 +3313,13 @@ void Spell::cast(bool skipCheck) { // Power Word: Shield if (m_spellInfo->Mechanic == MECHANIC_SHIELD && - (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000001))) + (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000001))) AddPrecastSpell(6788); // Weakened Soul // Prayer of Mending (jump animation), we need formal caster instead original for correct animation else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000002000000000)) AddTriggeredSpell(41637); - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 15237: AddTriggeredSpell(23455); break;// Holy Nova, rank 1 case 15430: AddTriggeredSpell(23458); break;// Holy Nova, rank 2 @@ -3353,7 +3353,7 @@ void Spell::cast(bool skipCheck) case SPELLFAMILY_ROGUE: // Fan of Knives (main hand) if (m_spellInfo->Id == 51723 && m_caster->GetTypeId() == TYPEID_PLAYER && - ((Player*)m_caster)->haveOffhandWeapon()) + ((Player*)m_caster)->haveOffhandWeapon()) { AddTriggeredSpell(52874); // Fan of Knives (offhand) } @@ -3448,7 +3448,7 @@ void Spell::cast(bool skipCheck) FillTargetMap(); - if(m_spellState == SPELL_STATE_FINISHED) // stop cast if spell marked as finish somewhere in FillTargetMap + if (m_spellState == SPELL_STATE_FINISHED) // stop cast if spell marked as finish somewhere in FillTargetMap { m_caster->DecreaseCastCounter(); SetExecutedCurrently(false); @@ -3466,7 +3466,7 @@ void Spell::cast(bool skipCheck) InitializeDamageMultipliers(); - Unit *procTarget = m_targets.getUnitTarget(); + Unit* procTarget = m_targets.getUnitTarget(); if (!procTarget) procTarget = m_caster; @@ -3479,7 +3479,7 @@ void Spell::cast(bool skipCheck) TakeCastItem(); // fill initial spell damage from caster for delayed casted spells - for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) HandleDelayedSpellLaunch(&(*ihit)); // Okay, maps created, now prepare flags @@ -3517,10 +3517,10 @@ void Spell::handle_immediate() SendChannelStart(m_duration); } - for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) DoAllEffectOnTarget(&(*ihit)); - for(GOTargetList::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) + for (GOTargetList::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) DoAllEffectOnTarget(&(*ihit)); // spell is finished, perform some last features of the spell here @@ -3529,7 +3529,7 @@ void Spell::handle_immediate() // Remove used for cast item if need (it can be already NULL after TakeReagents call TakeCastItem(); - if(m_spellState != SPELL_STATE_CASTING) + if (m_spellState != SPELL_STATE_CASTING) finish(true); // successfully finish spell cast (not last in case autorepeat or channel spell) } @@ -3544,7 +3544,7 @@ uint64 Spell::handle_delayed(uint64 t_offset) } // now recheck units targeting correctness (need before any effects apply to prevent adding immunity at first effect not allow apply second spell effect and similar cases) - for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (!ihit->processed) { @@ -3556,7 +3556,7 @@ uint64 Spell::handle_delayed(uint64 t_offset) } // now recheck gameobject targeting correctness - for(GOTargetList::iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit) + for (GOTargetList::iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit) { if (!ighit->processed) { @@ -3590,20 +3590,20 @@ void Spell::_handle_immediate_phase() HandleThreatSpells(); m_needSpellLog = IsNeedSendToClient(); - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { - if(m_spellInfo->Effect[j] == 0) + if (m_spellInfo->Effect[j] == 0) continue; // apply Send Event effect to ground in case empty target lists - if( m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(SpellEffectIndex(j)) ) + if (m_spellInfo->Effect[j] == SPELL_EFFECT_SEND_EVENT && !HaveTargetsForEffect(SpellEffectIndex(j))) { HandleEffects(NULL, NULL, NULL, SpellEffectIndex(j)); continue; } // Don't do spell log, if is school damage spell - if(m_spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE || m_spellInfo->Effect[j] == 0) + if (m_spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE || m_spellInfo->Effect[j] == 0) m_needSpellLog = false; } @@ -3612,14 +3612,14 @@ void Spell::_handle_immediate_phase() m_diminishGroup = DIMINISHING_NONE; // process items - for(ItemTargetList::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) + for (ItemTargetList::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) DoAllEffectOnTarget(&(*ihit)); // process ground - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { // persistent area auras target only the ground - if(m_spellInfo->Effect[j] == SPELL_EFFECT_PERSISTENT_AREA_AURA) + if (m_spellInfo->Effect[j] == SPELL_EFFECT_PERSISTENT_AREA_AURA) HandleEffects(NULL, NULL, NULL, SpellEffectIndex(j)); } } @@ -3627,13 +3627,13 @@ void Spell::_handle_immediate_phase() void Spell::_handle_finish_phase() { // spell log - if(m_needSpellLog) + if (m_needSpellLog) SendLogExecute(); } void Spell::SendSpellCooldown() { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; Player* _player = (Player*)m_caster; @@ -3666,48 +3666,48 @@ void Spell::update(uint32 difftime) // check if the player caster has moved before the spell finished if ((m_caster->GetTypeId() == TYPEID_PLAYER && m_timer != 0) && - (m_castPositionX != m_caster->GetPositionX() || m_castPositionY != m_caster->GetPositionY() || m_castPositionZ != m_caster->GetPositionZ()) && - (m_spellInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_STUCK || !((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLINGFAR))) + (m_castPositionX != m_caster->GetPositionX() || m_castPositionY != m_caster->GetPositionY() || m_castPositionZ != m_caster->GetPositionZ()) && + (m_spellInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_STUCK || !((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLINGFAR))) { // always cancel for channeled spells - if( m_spellState == SPELL_STATE_CASTING ) + if (m_spellState == SPELL_STATE_CASTING) cancel(); // don't cancel for melee, autorepeat, triggered and instant spells - else if(!IsNextMeleeSwingSpell() && !IsAutoRepeat() && !m_IsTriggeredSpell && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)) + else if (!IsNextMeleeSwingSpell() && !IsAutoRepeat() && !m_IsTriggeredSpell && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_MOVEMENT)) cancel(); } - switch(m_spellState) + switch (m_spellState) { case SPELL_STATE_PREPARING: { - if(m_timer) + if (m_timer) { - if(difftime >= m_timer) + if (difftime >= m_timer) m_timer = 0; else m_timer -= difftime; } - if(m_timer == 0 && !IsNextMeleeSwingSpell() && !IsAutoRepeat()) + if (m_timer == 0 && !IsNextMeleeSwingSpell() && !IsAutoRepeat()) cast(); } break; case SPELL_STATE_CASTING: { - if(m_timer > 0) + if (m_timer > 0) { - if( m_caster->GetTypeId() == TYPEID_PLAYER ) + if (m_caster->GetTypeId() == TYPEID_PLAYER) { // check if player has jumped before the channeling finished - if(((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLING)) + if (((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLING)) cancel(); // check for incapacitating player states - if( m_caster->hasUnitState(UNIT_STAT_CAN_NOT_REACT)) + if (m_caster->hasUnitState(UNIT_STAT_CAN_NOT_REACT)) cancel(); // check if player has turned if flag is set - if( m_spellInfo->ChannelInterruptFlags & CHANNEL_FLAG_TURNING && m_castOrientation != m_caster->GetOrientation() ) + if (m_spellInfo->ChannelInterruptFlags & CHANNEL_FLAG_TURNING && m_castOrientation != m_caster->GetOrientation()) cancel(); } @@ -3718,24 +3718,24 @@ void Spell::update(uint32 difftime) finish(); } - if(difftime >= m_timer) + if (difftime >= m_timer) m_timer = 0; else m_timer -= difftime; } - if(m_timer == 0) + if (m_timer == 0) { SendChannelUpdate(0); // channeled spell processed independently for quest targeting // cast at creature (or GO) quest objectives update at successful cast channel finished // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) - if( !IsAutoRepeat() && !IsNextMeleeSwingSpell() ) + if (!IsAutoRepeat() && !IsNextMeleeSwingSpell()) { - if ( Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself() ) + if (Player* p = m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) { - for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { TargetInfo const& target = *ihit; if (!target.targetGUID.IsCreatureOrVehicle()) @@ -3748,12 +3748,12 @@ void Spell::update(uint32 difftime) p->RewardPlayerAndGroupAtCast(unit, m_spellInfo->Id); } - for(GOTargetList::const_iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) + for (GOTargetList::const_iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit) { GOTargetInfo const& target = *ihit; GameObject* go = m_caster->GetMap()->GetGameObject(target.targetGUID); - if(!go) + if (!go) continue; p->RewardPlayerAndGroupAtCast(go, m_spellInfo->Id); @@ -3766,7 +3766,7 @@ void Spell::update(uint32 difftime) } break; default: { - }break; + } break; } } @@ -3786,24 +3786,24 @@ void Spell::finish(bool ok) // handle SPELL_AURA_ADD_TARGET_TRIGGER auras Unit::AuraList const& targetTriggers = m_caster->GetAurasByType(SPELL_AURA_ADD_TARGET_TRIGGER); - for(Unit::AuraList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i) + for (Unit::AuraList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i) { if (!(*i)->isAffectedOnSpell(m_spellInfo)) continue; - for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (ihit->missCondition == SPELL_MISS_NONE) { // check m_caster->GetGUID() let load auras at login and speedup most often case - Unit *unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); + Unit* unit = m_caster->GetObjectGuid() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if (unit && unit->isAlive()) { - SpellEntry const *auraSpellInfo = (*i)->GetSpellProto(); + SpellEntry const* auraSpellInfo = (*i)->GetSpellProto(); SpellEffectIndex auraSpellIdx = (*i)->GetEffIndex(); // Calculate chance at that moment (can be depend for example from combo points) int32 auraBasePoints = (*i)->GetBasePoints(); int32 chance = m_caster->CalculateSpellDamage(unit, auraSpellInfo, auraSpellIdx, &auraBasePoints); - if(roll_chance_i(chance)) + if (roll_chance_i(chance)) m_caster->CastSpell(unit, auraSpellInfo->EffectTriggerSpell[auraSpellIdx], true, NULL, (*i)); } } @@ -3821,7 +3821,7 @@ void Spell::finish(bool ok) if (IsMeleeAttackResetSpell()) { m_caster->resetAttackTimer(BASE_ATTACK); - if(m_caster->haveOffhandWeapon()) + if (m_caster->haveOffhandWeapon()) m_caster->resetAttackTimer(OFF_ATTACK); } @@ -3829,13 +3829,13 @@ void Spell::finish(bool ok) m_caster->resetAttackTimer(RANGED_ATTACK);*/ // Clear combo at finish state - if(m_caster->GetTypeId() == TYPEID_PLAYER && NeedsComboPoints(m_spellInfo)) + if (m_caster->GetTypeId() == TYPEID_PLAYER && NeedsComboPoints(m_spellInfo)) { // Not drop combopoints if negative spell and if any miss on enemy exist bool needDrop = true; if (!IsPositiveSpell(m_spellInfo->Id)) { - for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (ihit->missCondition != SPELL_MISS_NONE && ihit->targetGUID != m_caster->GetObjectGuid()) { @@ -3853,7 +3853,7 @@ void Spell::finish(bool ok) ((Player*)m_caster)->UpdatePotionCooldown(this); // call triggered spell only at successful cast (after clear combo points -> for add some if need) - if(!m_TriggerSpells.empty()) + if (!m_TriggerSpells.empty()) CastTriggerSpells(); // Stop Attack for some spells @@ -3861,20 +3861,20 @@ void Spell::finish(bool ok) m_caster->AttackStop(); // update encounter state if needed - Map *map = m_caster->GetMap(); + Map* map = m_caster->GetMap(); if (map->IsDungeon()) ((DungeonMap*)map)->GetPersistanceState()->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, m_spellInfo->Id); } void Spell::SendCastResult(SpellCastResult result) { - if(result == SPELL_CAST_OK) + if (result == SPELL_CAST_OK) return; if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - if(((Player*)m_caster)->GetSession()->PlayerLoading()) // don't send cast results at loading time + if (((Player*)m_caster)->GetSession()->PlayerLoading()) // don't send cast results at loading time return; SendCastResult((Player*)m_caster, m_spellInfo, m_cast_count, result); @@ -3882,7 +3882,7 @@ void Spell::SendCastResult(SpellCastResult result) void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 cast_count, SpellCastResult result) { - if(result == SPELL_CAST_OK) + if (result == SPELL_CAST_OK) return; WorldPacket data(SMSG_CAST_FAILED, (4+1+1)); @@ -3899,7 +3899,7 @@ void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 ca break; case SPELL_FAILED_REQUIRES_AREA: // AreaTable.dbc id // hardcode areas limitation case - switch(spellInfo->Id) + switch (spellInfo->Id) { case 41617: // Cenarion Mana Salve case 41619: // Cenarion Healing Salve @@ -3918,13 +3918,13 @@ void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 ca } break; case SPELL_FAILED_TOTEMS: - for(int i = 0; i < MAX_SPELL_TOTEMS; ++i) - if(spellInfo->Totem[i]) + for (int i = 0; i < MAX_SPELL_TOTEMS; ++i) + if (spellInfo->Totem[i]) data << uint32(spellInfo->Totem[i]); // client needs only one id, not 2... break; case SPELL_FAILED_TOTEM_CATEGORY: - for(int i = 0; i < MAX_SPELL_TOTEM_CATEGORIES; ++i) - if(spellInfo->TotemCategory[i]) + for (int i = 0; i < MAX_SPELL_TOTEM_CATEGORIES; ++i) + if (spellInfo->TotemCategory[i]) data << uint32(spellInfo->TotemCategory[i]);// client needs only one id, not 2... break; case SPELL_FAILED_EQUIPPED_ITEM_CLASS: @@ -4002,11 +4002,11 @@ void Spell::SendSpellStart() uint8 v2 = 0;//((Player*)m_caster)->GetRunesState(); data << uint8(v1); // runes state before data << uint8(v2); // runes state after - for(uint8 i = 0; i < MAX_RUNES; ++i) + for (uint8 i = 0; i < MAX_RUNES; ++i) { uint8 m = (1 << i); - if(m & v1) // usable before... - if(!(m & v2)) // ...but on cooldown now... + if (m & v1) // usable before... + if (!(m & v2)) // ...but on cooldown now... data << uint8(0); // some unknown byte (time?) } } @@ -4068,11 +4068,11 @@ void Spell::SendSpellGo() uint8 v2 = m_caster->getClass() == CLASS_DEATH_KNIGHT ? ((Player*)m_caster)->GetRunesState() : 0; data << uint8(v1); // runes state before data << uint8(v2); // runes state after - for(uint8 i = 0; i < MAX_RUNES; ++i) + for (uint8 i = 0; i < MAX_RUNES; ++i) { uint8 m = (1 << i); - if(m & v1) // usable before... - if(!(m & v2)) // ...but on cooldown now... + if (m & v1) // usable before... + if (!(m & v2)) // ...but on cooldown now... data << uint8(0); // some unknown byte (time?) } } @@ -4118,25 +4118,25 @@ void Spell::WriteAmmoToPacket(WorldPacket* data) if (m_caster->GetTypeId() == TYPEID_PLAYER) { - Item *pItem = ((Player*)m_caster)->GetWeaponForAttack( RANGED_ATTACK ); - if(pItem) + Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK); + if (pItem) { ammoInventoryType = pItem->GetProto()->InventoryType; - if( ammoInventoryType == INVTYPE_THROWN ) + if (ammoInventoryType == INVTYPE_THROWN) ammoDisplayID = pItem->GetProto()->DisplayInfoID; else { uint32 ammoID = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID); - if(ammoID) + if (ammoID) { - ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( ammoID ); - if(pProto) + ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(ammoID); + if (pProto) { ammoDisplayID = pProto->DisplayInfoID; ammoInventoryType = pProto->InventoryType; } } - else if(m_caster->GetDummyAura(46699)) // Requires No Ammo + else if (m_caster->GetDummyAura(46699)) // Requires No Ammo { ammoDisplayID = 5996; // normal arrow ammoInventoryType = INVTYPE_AMMO; @@ -4148,13 +4148,13 @@ void Spell::WriteAmmoToPacket(WorldPacket* data) { for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i) { - if(uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i)) + if (uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i)) { - if(ItemEntry const * itemEntry = sItemStore.LookupEntry(item_id)) + if (ItemEntry const* itemEntry = sItemStore.LookupEntry(item_id)) { - if(itemEntry->Class == ITEM_CLASS_WEAPON) + if (itemEntry->Class == ITEM_CLASS_WEAPON) { - switch(itemEntry->SubClass) + switch (itemEntry->SubClass) { case ITEM_SUBCLASS_WEAPON_THROWN: ammoDisplayID = itemEntry->DisplayId; @@ -4193,7 +4193,7 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) uint32 hit = m_UniqueGOTargetInfo.size(); // Always hits on GO uint32 miss = 0; - for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (ihit->effectMask == 0) // No effect apply - all immuned add state { @@ -4211,13 +4211,13 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) ++miss; } - for(GOTargetList::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit) + for (GOTargetList::const_iterator ighit = m_UniqueGOTargetInfo.begin(); ighit != m_UniqueGOTargetInfo.end(); ++ighit) *data << ighit->targetGUID; // Always hits data->put(count_pos, hit); *data << (uint8)miss; - for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (ihit->missCondition != SPELL_MISS_NONE) // Add only miss { @@ -4228,17 +4228,17 @@ void Spell::WriteSpellGoTargets(WorldPacket* data) } } // Reset m_needAliveTargetMask for non channeled spell - if(!IsChanneledSpell(m_spellInfo)) + if (!IsChanneledSpell(m_spellInfo)) m_needAliveTargetMask = 0; } void Spell::SendLogExecute() { - Unit *target = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster; + Unit* target = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster; WorldPacket data(SMSG_SPELLLOGEXECUTE, (8+4+4+4+4+8)); - if(m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->GetTypeId() == TYPEID_PLAYER) data << m_caster->GetPackGUID(); else data << target->GetPackGUID(); @@ -4246,17 +4246,17 @@ void Spell::SendLogExecute() data << uint32(m_spellInfo->Id); uint32 count1 = 1; data << uint32(count1); // count1 (effect count?) - for(uint32 i = 0; i < count1; ++i) + for (uint32 i = 0; i < count1; ++i) { data << uint32(m_spellInfo->Effect[EFFECT_INDEX_0]);// spell effect uint32 count2 = 1; data << uint32(count2); // count2 (target count?) - for(uint32 j = 0; j < count2; ++j) + for (uint32 j = 0; j < count2; ++j) { - switch(m_spellInfo->Effect[EFFECT_INDEX_0]) + switch (m_spellInfo->Effect[EFFECT_INDEX_0]) { case SPELL_EFFECT_POWER_DRAIN: - if(Unit *unit = m_targets.getUnitTarget()) + if (Unit* unit = m_targets.getUnitTarget()) data << unit->GetPackGUID(); else data << uint8(0); @@ -4265,21 +4265,21 @@ void Spell::SendLogExecute() data << float(0); break; case SPELL_EFFECT_ADD_EXTRA_ATTACKS: - if(Unit *unit = m_targets.getUnitTarget()) + if (Unit* unit = m_targets.getUnitTarget()) data << unit->GetPackGUID(); else data << uint8(0); data << uint32(0); // count? break; case SPELL_EFFECT_INTERRUPT_CAST: - if(Unit *unit = m_targets.getUnitTarget()) + if (Unit* unit = m_targets.getUnitTarget()) data << unit->GetPackGUID(); else data << uint8(0); data << uint32(0); // spellid break; case SPELL_EFFECT_DURABILITY_DAMAGE: - if(Unit *unit = m_targets.getUnitTarget()) + if (Unit* unit = m_targets.getUnitTarget()) data << unit->GetPackGUID(); else data << uint8(0); @@ -4287,7 +4287,7 @@ void Spell::SendLogExecute() data << uint32(0); break; case SPELL_EFFECT_OPEN_LOCK: - if(Item *item = m_targets.getItemTarget()) + if (Item* item = m_targets.getItemTarget()) data << item->GetPackGUID(); else data << uint8(0); @@ -4306,11 +4306,11 @@ void Spell::SendLogExecute() case SPELL_EFFECT_SUMMON_OBJECT_SLOT2: case SPELL_EFFECT_SUMMON_OBJECT_SLOT3: case SPELL_EFFECT_SUMMON_OBJECT_SLOT4: - if (Unit *unit = m_targets.getUnitTarget()) + if (Unit* unit = m_targets.getUnitTarget()) data << unit->GetPackGUID(); else if (m_targets.getItemTargetGuid()) data << m_targets.getItemTargetGuid().WriteAsPacked(); - else if (GameObject *go = m_targets.getGOTarget()) + else if (GameObject* go = m_targets.getGOTarget()) data << go->GetPackGUID(); else data << uint8(0); // guid @@ -4319,14 +4319,14 @@ void Spell::SendLogExecute() data << uint32(m_targets.getItemTargetEntry()); break; case SPELL_EFFECT_DISMISS_PET: - if(Unit *unit = m_targets.getUnitTarget()) + if (Unit* unit = m_targets.getUnitTarget()) data << unit->GetPackGUID(); else data << uint8(0); break; case SPELL_EFFECT_RESURRECT: case SPELL_EFFECT_RESURRECT_NEW: - if(Unit *unit = m_targets.getUnitTarget()) + if (Unit* unit = m_targets.getUnitTarget()) data << unit->GetPackGUID(); else data << uint8(0); @@ -4361,33 +4361,33 @@ void Spell::SendChannelUpdate(uint32 time) { if (time == 0) { - // Reset farsight for some possessing auras of possessed summoned (as they might work with different aura types) - if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_FARSIGHT) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->GetCharmGuid() - && !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MOD_POSSESS) && !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MOD_POSSESS_PET)) + // Reset farsight for some possessing auras of possessed summoned (as they might work with different aura types) + if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_FARSIGHT) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->GetCharmGuid() + && !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MOD_POSSESS) && !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MOD_POSSESS_PET)) + { + Player* player = (Player*)m_caster; + // These Auras are applied to self, so get the possessed first + Unit* possessed = player->GetCharm(); + + player->SetCharm(NULL); + if (possessed) + player->SetClientControl(possessed, 0); + player->SetMover(NULL); + player->GetCamera().ResetView(); + player->RemovePetActionBar(); + + if (possessed) { - Player* player = (Player*)m_caster; - // These Auras are applied to self, so get the possessed first - Unit* possessed = player->GetCharm(); + possessed->clearUnitState(UNIT_STAT_CONTROLLED); + possessed->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + possessed->SetCharmerGuid(ObjectGuid()); + // TODO - Requires more specials for target? - player->SetCharm(NULL); - if (possessed) - player->SetClientControl(possessed, 0); - player->SetMover(NULL); - player->GetCamera().ResetView(); - player->RemovePetActionBar(); - - if (possessed) - { - possessed->clearUnitState(UNIT_STAT_CONTROLLED); - possessed->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); - possessed->SetCharmerGuid(ObjectGuid()); - // TODO - Requires more specials for target? - - // Some possessed might want to despawn? - if (possessed->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id && possessed->GetTypeId() == TYPEID_UNIT) - ((Creature*)possessed)->ForcedDespawn(); - } + // Some possessed might want to despawn? + if (possessed->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id && possessed->GetTypeId() == TYPEID_UNIT) + ((Creature*)possessed)->ForcedDespawn(); } + } @@ -4406,7 +4406,7 @@ void Spell::SendChannelUpdate(uint32 time) m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, 0); } - WorldPacket data( MSG_CHANNEL_UPDATE, 8+4 ); + WorldPacket data(MSG_CHANNEL_UPDATE, 8+4); data << m_caster->GetPackGUID(); data << uint32(time); m_caster->SendMessageToSet(&data, true); @@ -4422,19 +4422,19 @@ void Spell::SendChannelStart(uint32 duration) // select first not resisted target from target list for _0_ effect else if (!m_UniqueTargetInfo.empty()) { - for(TargetList::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) + for (TargetList::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) { if ((itr->effectMask & (1 << EFFECT_INDEX_0)) && itr->reflectResult == SPELL_MISS_NONE && - itr->targetGUID != m_caster->GetObjectGuid()) + itr->targetGUID != m_caster->GetObjectGuid()) { target = ObjectAccessor::GetUnit(*m_caster, itr->targetGUID); break; } } } - else if(!m_UniqueGOTargetInfo.empty()) + else if (!m_UniqueGOTargetInfo.empty()) { - for(GOTargetList::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) + for (GOTargetList::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) { if (itr->effectMask & (1 << EFFECT_INDEX_0)) { @@ -4444,7 +4444,7 @@ void Spell::SendChannelStart(uint32 duration) } } - WorldPacket data( MSG_CHANNEL_START, (8+4+4) ); + WorldPacket data(MSG_CHANNEL_START, (8+4+4)); data << m_caster->GetPackGUID(); data << uint32(m_spellInfo->Id); data << uint32(duration); @@ -4489,16 +4489,16 @@ void Spell::SendPlaySpellVisual(uint32 SpellID) void Spell::TakeCastItem() { - if(!m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER) + if (!m_CastItem || m_caster->GetTypeId() != TYPEID_PLAYER) return; // not remove cast item at triggered spell (equipping, weapon damage, etc) - if(m_IsTriggeredSpell && !(m_targets.m_targetMask & TARGET_FLAG_TRADE_ITEM)) + if (m_IsTriggeredSpell && !(m_targets.m_targetMask & TARGET_FLAG_TRADE_ITEM)) return; - ItemPrototype const *proto = m_CastItem->GetProto(); + ItemPrototype const* proto = m_CastItem->GetProto(); - if(!proto) + if (!proto) { // This code is to avoid a crash // I'm not sure, if this is really an error, but I guess every item needs a prototype @@ -4548,17 +4548,17 @@ void Spell::TakeCastItem() void Spell::TakePower() { - if(m_CastItem || m_triggeredByAuraSpell) + if (m_CastItem || m_triggeredByAuraSpell) return; // health as power used - if(m_spellInfo->powerType == POWER_HEALTH) + if (m_spellInfo->powerType == POWER_HEALTH) { - m_caster->ModifyHealth( -(int32)m_powerCost ); + m_caster->ModifyHealth(-(int32)m_powerCost); return; } - if(m_spellInfo->powerType >= MAX_POWERS) + if (m_spellInfo->powerType >= MAX_POWERS) { sLog.outError("Spell::TakePower: Unknown power type '%d'", m_spellInfo->powerType); return; @@ -4566,7 +4566,7 @@ void Spell::TakePower() Powers powerType = Powers(m_spellInfo->powerType); - if(powerType == POWER_RUNE) + if (powerType == POWER_RUNE) { CheckOrTakeRunePower(true); return; @@ -4581,20 +4581,20 @@ void Spell::TakePower() SpellCastResult Spell::CheckOrTakeRunePower(bool take) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_CAST_OK; - Player *plr = (Player*)m_caster; + Player* plr = (Player*)m_caster; - if(plr->getClass() != CLASS_DEATH_KNIGHT) + if (plr->getClass() != CLASS_DEATH_KNIGHT) return SPELL_CAST_OK; - SpellRuneCostEntry const *src = sSpellRuneCostStore.LookupEntry(m_spellInfo->runeCostID); + SpellRuneCostEntry const* src = sSpellRuneCostStore.LookupEntry(m_spellInfo->runeCostID); - if(!src) + if (!src) return SPELL_CAST_OK; - if(src->NoRuneCost() && (!take || src->NoRunicPowerGain())) + if (src->NoRuneCost() && (!take || src->NoRunicPowerGain())) return SPELL_CAST_OK; if (take) @@ -4602,7 +4602,7 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take) // at this moment for rune cost exist only no cost mods, and no percent mods int32 runeCostMod = 10000; - if(Player* modOwner = plr->GetSpellModOwner()) + if (Player* modOwner = plr->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCostMod, this); if (runeCostMod > 0) @@ -4610,20 +4610,20 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take) int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death // init cost data and apply mods - for(uint32 i = 0; i < RUNE_DEATH; ++i) + for (uint32 i = 0; i < RUNE_DEATH; ++i) runeCost[i] = runeCostMod > 0 ? src->RuneCost[i] : 0; runeCost[RUNE_DEATH] = 0; // calculated later // scan non-death runes (death rune not used explicitly in rune costs) - for(uint32 i = 0; i < MAX_RUNES; ++i) + for (uint32 i = 0; i < MAX_RUNES; ++i) { RuneType rune = plr->GetCurrentRune(i); if (runeCost[rune] <= 0) continue; // already used - if(plr->GetRuneCooldown(i) != 0) + if (plr->GetRuneCooldown(i) != 0) continue; if (take) @@ -4633,21 +4633,21 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take) } // collect all not counted rune costs to death runes cost - for(uint32 i = 0; i < RUNE_DEATH; ++i) - if(runeCost[i] > 0) + for (uint32 i = 0; i < RUNE_DEATH; ++i) + if (runeCost[i] > 0) runeCost[RUNE_DEATH] += runeCost[i]; // scan death runes - if(runeCost[RUNE_DEATH] > 0) + if (runeCost[RUNE_DEATH] > 0) { - for(uint32 i = 0; i < MAX_RUNES && runeCost[RUNE_DEATH]; ++i) + for (uint32 i = 0; i < MAX_RUNES && runeCost[RUNE_DEATH]; ++i) { RuneType rune = plr->GetCurrentRune(i); if (rune != RUNE_DEATH) continue; // already used - if(plr->GetRuneCooldown(i) != 0) + if (plr->GetRuneCooldown(i) != 0) continue; if (take) @@ -4660,11 +4660,11 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take) } } - if(!take && runeCost[RUNE_DEATH] > 0) + if (!take && runeCost[RUNE_DEATH] > 0) return SPELL_FAILED_NO_POWER; // not sure if result code is correct } - if(take) + if (take) { // you can gain some runic power when use runes float rp = float(src->runePowerGain); @@ -4687,9 +4687,9 @@ void Spell::TakeReagents() if (p_caster->CanNoReagentCast(m_spellInfo)) return; - for(uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x) + for (uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x) { - if(m_spellInfo->Reagent[x] <= 0) + if (m_spellInfo->Reagent[x] <= 0) continue; uint32 itemid = m_spellInfo->Reagent[x]; @@ -4698,10 +4698,10 @@ void Spell::TakeReagents() // if CastItem is also spell reagent if (m_CastItem) { - ItemPrototype const *proto = m_CastItem->GetProto(); - if( proto && proto->ItemId == itemid ) + ItemPrototype const* proto = m_CastItem->GetProto(); + if (proto && proto->ItemId == itemid) { - for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) + for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) { // CastItem will be used up and does not count as reagent int32 charges = m_CastItem->GetSpellCharges(s); @@ -4786,7 +4786,7 @@ void Spell::HandleThreatSpells() DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell %u added an additional %f threat for %s %u target(s)", m_spellInfo->Id, threat, positive ? "assisting" : "harming", uint32(m_UniqueTargetInfo.size())); } -void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,SpellEffectIndex i, float DamageMultiplier) +void Spell::HandleEffects(Unit* pUnitTarget,Item* pItemTarget,GameObject* pGOTarget,SpellEffectIndex i, float DamageMultiplier) { unitTarget = pUnitTarget; itemTarget = pItemTarget; @@ -4797,12 +4797,12 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar damage = int32(CalculateDamage(i, unitTarget) * DamageMultiplier); DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell %u Effect%d : %u Targets: %s, %s, %s", - m_spellInfo->Id, i, eff, - unitTarget ? unitTarget->GetGuidStr().c_str() : "-", - itemTarget ? itemTarget->GetGuidStr().c_str() : "-", - gameObjTarget ? gameObjTarget->GetGuidStr().c_str() : "-"); + m_spellInfo->Id, i, eff, + unitTarget ? unitTarget->GetGuidStr().c_str() : "-", + itemTarget ? itemTarget->GetGuidStr().c_str() : "-", + gameObjTarget ? gameObjTarget->GetGuidStr().c_str() : "-"); - if(eff < TOTAL_SPELL_EFFECTS) + if (eff < TOTAL_SPELL_EFFECTS) { (*this.*SpellEffects[eff])(i); } @@ -4812,11 +4812,11 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar } } -void Spell::AddTriggeredSpell( uint32 spellId ) +void Spell::AddTriggeredSpell(uint32 spellId) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + if (!spellInfo) { sLog.outError("Spell::AddTriggeredSpell: unknown spell id %u used as triggred spell for spell %u)", spellId, m_spellInfo->Id); return; @@ -4825,11 +4825,11 @@ void Spell::AddTriggeredSpell( uint32 spellId ) m_TriggerSpells.push_back(spellInfo); } -void Spell::AddPrecastSpell( uint32 spellId ) +void Spell::AddPrecastSpell(uint32 spellId) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + if (!spellInfo) { sLog.outError("Spell::AddPrecastSpell: unknown spell id %u used as pre-cast spell for spell %u)", spellId, m_spellInfo->Id); return; @@ -4840,7 +4840,7 @@ void Spell::AddPrecastSpell( uint32 spellId ) void Spell::CastTriggerSpells() { - for(SpellInfoList::const_iterator si = m_TriggerSpells.begin(); si != m_TriggerSpells.end(); ++si) + for (SpellInfoList::const_iterator si = m_TriggerSpells.begin(); si != m_TriggerSpells.end(); ++si) { Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID); spell->prepare(&m_targets); // use original spell original targets @@ -4849,7 +4849,7 @@ void Spell::CastTriggerSpells() void Spell::CastPreCastSpells(Unit* target) { - for(SpellInfoList::const_iterator si = m_preCastSpells.begin(); si != m_preCastSpells.end(); ++si) + for (SpellInfoList::const_iterator si = m_preCastSpells.begin(); si != m_preCastSpells.end(); ++si) m_caster->CastSpell(target, (*si), true, m_CastItem); } @@ -4857,9 +4857,9 @@ SpellCastResult Spell::CheckCast(bool strict) { // check cooldowns to prevent cheating (ignore passive spells, that client side visual only) if (m_caster->GetTypeId()==TYPEID_PLAYER && !m_spellInfo->HasAttribute(SPELL_ATTR_PASSIVE) && - ((Player*)m_caster)->HasSpellCooldown(m_spellInfo->Id)) + ((Player*)m_caster)->HasSpellCooldown(m_spellInfo->Id)) { - if(m_triggeredByAuraSpell) + if (m_triggeredByAuraSpell) return SPELL_FAILED_DONT_REPORT; else return SPELL_FAILED_NOT_READY; @@ -4871,23 +4871,23 @@ SpellCastResult Spell::CheckCast(bool strict) // only allow triggered spells if at an ended battleground if (!m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER) - if(BattleGround * bg = ((Player*)m_caster)->GetBattleGround()) - if(bg->GetStatus() == STATUS_WAIT_LEAVE) + if (BattleGround* bg = ((Player*)m_caster)->GetBattleGround()) + if (bg->GetStatus() == STATUS_WAIT_LEAVE) return SPELL_FAILED_DONT_REPORT; if (!m_IsTriggeredSpell && IsNonCombatSpell(m_spellInfo) && - m_caster->isInCombat() && !m_caster->IsIgnoreUnitState(m_spellInfo, IGNORE_UNIT_COMBAT_STATE)) + m_caster->isInCombat() && !m_caster->IsIgnoreUnitState(m_spellInfo, IGNORE_UNIT_COMBAT_STATE)) return SPELL_FAILED_AFFECTING_COMBAT; if (m_caster->GetTypeId() == TYPEID_PLAYER && !((Player*)m_caster)->isGameMaster() && - sWorld.getConfig(CONFIG_BOOL_VMAP_INDOOR_CHECK) && - VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled()) + sWorld.getConfig(CONFIG_BOOL_VMAP_INDOOR_CHECK) && + VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled()) { if (m_spellInfo->HasAttribute(SPELL_ATTR_OUTDOORS_ONLY) && !m_caster->GetTerrain()->IsOutdoors(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ())) return SPELL_FAILED_ONLY_OUTDOORS; - if(m_spellInfo->HasAttribute(SPELL_ATTR_INDOORS_ONLY) && + if (m_spellInfo->HasAttribute(SPELL_ATTR_INDOORS_ONLY) && m_caster->GetTerrain()->IsOutdoors(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ())) return SPELL_FAILED_ONLY_INDOORS; } @@ -4900,7 +4900,7 @@ SpellCastResult Spell::CheckCast(bool strict) { // Cannot be used in this stance/form SpellCastResult shapeError = GetErrorAtShapeshiftedCast(m_spellInfo, m_caster->GetShapeshiftForm()); - if(shapeError != SPELL_CAST_OK) + if (shapeError != SPELL_CAST_OK) return shapeError; if (m_spellInfo->HasAttribute(SPELL_ATTR_ONLY_STEALTHED) && !(m_caster->HasStealthAura())) @@ -4909,24 +4909,24 @@ SpellCastResult Spell::CheckCast(bool strict) } // caster state requirements - if(m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraState))) + if (m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraState))) return SPELL_FAILED_CASTER_AURASTATE; - if(m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot))) + if (m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot))) return SPELL_FAILED_CASTER_AURASTATE; // Caster aura req check if need - if(m_spellInfo->casterAuraSpell && !m_caster->HasAura(m_spellInfo->casterAuraSpell)) + if (m_spellInfo->casterAuraSpell && !m_caster->HasAura(m_spellInfo->casterAuraSpell)) return SPELL_FAILED_CASTER_AURASTATE; - if(m_spellInfo->excludeCasterAuraSpell) + if (m_spellInfo->excludeCasterAuraSpell) { // Special cases of non existing auras handling - if(m_spellInfo->excludeCasterAuraSpell == 61988) + if (m_spellInfo->excludeCasterAuraSpell == 61988) { // Avenging Wrath Marker - if(m_caster->HasAura(61987)) + if (m_caster->HasAura(61987)) return SPELL_FAILED_CASTER_AURASTATE; } - else if(m_caster->HasAura(m_spellInfo->excludeCasterAuraSpell)) + else if (m_caster->HasAura(m_spellInfo->excludeCasterAuraSpell)) return SPELL_FAILED_CASTER_AURASTATE; } @@ -4934,33 +4934,33 @@ SpellCastResult Spell::CheckCast(bool strict) { // cancel autorepeat spells if cast start when moving // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code) - if (((Player*)m_caster)->isMoving() ) + if (((Player*)m_caster)->isMoving()) { // skip stuck spell to allow use it in falling case and apply spell limitations at movement if ((!((Player*)m_caster)->m_movementInfo.HasMovementFlag(MOVEFLAG_FALLINGFAR) || m_spellInfo->Effect[EFFECT_INDEX_0] != SPELL_EFFECT_STUCK) && - (IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0)) + (IsAutoRepeat() || (m_spellInfo->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) != 0)) return SPELL_FAILED_MOVING; } if (!m_IsTriggeredSpell && NeedsComboPoints(m_spellInfo) && !m_caster->IsIgnoreUnitState(m_spellInfo, IGNORE_UNIT_TARGET_STATE) && - (!m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetObjectGuid() != ((Player*)m_caster)->GetComboTargetGuid())) + (!m_targets.getUnitTarget() || m_targets.getUnitTarget()->GetObjectGuid() != ((Player*)m_caster)->GetComboTargetGuid())) // warrior not have real combo-points at client side but use this way for mark allow Overpower use return m_caster->getClass() == CLASS_WARRIOR ? SPELL_FAILED_CASTER_AURASTATE : SPELL_FAILED_NO_COMBO_POINTS; } - if(Unit *target = m_targets.getUnitTarget()) + if (Unit* target = m_targets.getUnitTarget()) { // target state requirements (not allowed state), apply to self also - if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot))) + if (m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot))) return SPELL_FAILED_TARGET_AURASTATE; if (!m_IsTriggeredSpell && IsDeathOnlySpell(m_spellInfo) && target->isAlive()) return SPELL_FAILED_TARGET_NOT_DEAD; // Target aura req check if need - if(m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell)) + if (m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell)) return SPELL_FAILED_CASTER_AURASTATE; - if(m_spellInfo->excludeTargetAuraSpell) + if (m_spellInfo->excludeTargetAuraSpell) { // Special cases of non existing auras handling if (m_spellInfo->excludeTargetAuraSpell == 61988) @@ -4977,25 +4977,25 @@ SpellCastResult Spell::CheckCast(bool strict) // totem immunity for channeled spells(needs to be before spell cast) // spell attribs for player channeled spells if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_UNK14) - && m_spellInfo->HasAttribute(SPELL_ATTR_EX5_UNK13) - && target->GetTypeId() == TYPEID_UNIT - && ((Creature*)target)->IsTotem()) + && m_spellInfo->HasAttribute(SPELL_ATTR_EX5_UNK13) + && target->GetTypeId() == TYPEID_UNIT + && ((Creature*)target)->IsTotem()) return SPELL_FAILED_IMMUNE; bool non_caster_target = target != m_caster && !IsSpellWithCasterSourceTargetsOnly(m_spellInfo); - if(non_caster_target) + if (non_caster_target) { // target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds if (m_spellInfo->TargetAuraState && !target->HasAuraStateForCaster(AuraState(m_spellInfo->TargetAuraState), m_caster->GetObjectGuid()) && - !m_caster->IsIgnoreUnitState(m_spellInfo, m_spellInfo->TargetAuraState == AURA_STATE_FROZEN ? IGNORE_UNIT_TARGET_NON_FROZEN : IGNORE_UNIT_TARGET_STATE)) + !m_caster->IsIgnoreUnitState(m_spellInfo, m_spellInfo->TargetAuraState == AURA_STATE_FROZEN ? IGNORE_UNIT_TARGET_NON_FROZEN : IGNORE_UNIT_TARGET_STATE)) return SPELL_FAILED_TARGET_AURASTATE; // Not allow casting on flying player if (target->IsTaxiFlying()) return SPELL_FAILED_BAD_TARGETS; - if(!m_IsTriggeredSpell && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target)) + if (!m_IsTriggeredSpell && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target)) return SPELL_FAILED_LINE_OF_SIGHT; // auto selection spell rank implemented in WorldSession::HandleCastSpellOpcode @@ -5015,9 +5015,9 @@ SpellCastResult Spell::CheckCast(bool strict) // If 0 spell effect empty - client not send target data (need use selection) // TODO: check it on next client version if (m_targets.m_targetMask == TARGET_FLAG_SELF && - m_spellInfo->EffectImplicitTargetA[EFFECT_INDEX_1] == TARGET_CHAIN_DAMAGE) + m_spellInfo->EffectImplicitTargetA[EFFECT_INDEX_1] == TARGET_CHAIN_DAMAGE) { - target = m_caster->GetMap()->GetUnit(((Player *)m_caster)->GetSelectionGuid()); + target = m_caster->GetMap()->GetUnit(((Player*)m_caster)->GetSelectionGuid()); if (!target) return SPELL_FAILED_BAD_TARGETS; @@ -5029,7 +5029,7 @@ SpellCastResult Spell::CheckCast(bool strict) // Fire Shield if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && - m_spellInfo->SpellIconID == 16) + m_spellInfo->SpellIconID == 16) return SPELL_FAILED_BAD_TARGETS; // Focus Magic (main spell) @@ -5038,7 +5038,7 @@ SpellCastResult Spell::CheckCast(bool strict) // Lay on Hands (self cast) if (m_spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN && - m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000008000)) + m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000008000)) { if (target->HasAura(25771)) // Forbearance return SPELL_FAILED_CASTER_AURASTATE; @@ -5068,11 +5068,11 @@ SpellCastResult Spell::CheckCast(bool strict) //check creature type //ignore self casts (including area casts when caster selected as target) - if(non_caster_target) + if (non_caster_target) { - if(!CheckTargetCreatureType(target)) + if (!CheckTargetCreatureType(target)) { - if(target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) return SPELL_FAILED_TARGET_IS_PLAYER; else return SPELL_FAILED_BAD_TARGETS; @@ -5084,7 +5084,7 @@ SpellCastResult Spell::CheckCast(bool strict) bool target_hostile_checked = false; bool target_friendly = false; bool target_friendly_checked = false; - for(int k = 0; k < MAX_EFFECT_INDEX; ++k) + for (int k = 0; k < MAX_EFFECT_INDEX; ++k) { if (IsExplicitPositiveTarget(m_spellInfo->EffectImplicitTargetA[k])) { @@ -5094,7 +5094,7 @@ SpellCastResult Spell::CheckCast(bool strict) target_hostile = m_caster->IsHostileTo(target); } - if(target_hostile) + if (target_hostile) return SPELL_FAILED_BAD_TARGETS; explicit_target_mode = true; @@ -5107,7 +5107,7 @@ SpellCastResult Spell::CheckCast(bool strict) target_friendly = m_caster->IsFriendlyTo(target); } - if(target_friendly) + if (target_friendly) return SPELL_FAILED_BAD_TARGETS; explicit_target_mode = true; @@ -5118,7 +5118,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!explicit_target_mode && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGuid()) { // check correctness positive/negative cast target (pet cast real check and cheating check) - if(IsPositiveSpell(m_spellInfo->Id)) + if (IsPositiveSpell(m_spellInfo->Id)) { if (!target_hostile_checked) { @@ -5126,7 +5126,7 @@ SpellCastResult Spell::CheckCast(bool strict) target_hostile = m_caster->IsHostileTo(target); } - if(target_hostile) + if (target_hostile) return SPELL_FAILED_BAD_TARGETS; } else @@ -5137,14 +5137,14 @@ SpellCastResult Spell::CheckCast(bool strict) target_friendly = m_caster->IsFriendlyTo(target); } - if(target_friendly) + if (target_friendly) return SPELL_FAILED_BAD_TARGETS; } } } - if(IsPositiveSpell(m_spellInfo->Id)) - if(target->IsImmuneToSpell(m_spellInfo)) + if (IsPositiveSpell(m_spellInfo->Id)) + if (target->IsImmuneToSpell(m_spellInfo)) return SPELL_FAILED_TARGET_AURASTATE; //Must be behind the target. @@ -5154,8 +5154,8 @@ SpellCastResult Spell::CheckCast(bool strict) // Exclusion for Mutilate:Facing Limitation was removed in 2.0.1 and 3.0.3, but they still use the same, old Ex-Flags // Exclusion for Throw: Facing limitation was added in 3.2.x, but that shouldn't be if (!m_spellInfo->IsFitToFamily(SPELLFAMILY_DRUID, UI64LIT(0x0000000000020000)) && - !m_spellInfo->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x0020000000000000)) && - m_spellInfo->Id != 2764) + !m_spellInfo->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x0020000000000000)) && + m_spellInfo->Id != 2764) { SendInterrupted(2); return SPELL_FAILED_NOT_BEHIND; @@ -5178,13 +5178,13 @@ SpellCastResult Spell::CheckCast(bool strict) m_caster->GetZoneAndAreaId(zone, area); SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(m_spellInfo, m_caster->GetMapId(), zone, area, - m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()); + m_caster->GetCharmerOrOwnerPlayerOrPlayerItself()); if (locRes != SPELL_CAST_OK) return locRes; // not let players cast spells at mount (and let do it to creatures) if (m_caster->IsMounted() && m_caster->GetTypeId()==TYPEID_PLAYER && !m_IsTriggeredSpell && - !IsPassiveSpell(m_spellInfo) && !m_spellInfo->HasAttribute(SPELL_ATTR_CASTABLE_WHILE_MOUNTED)) + !IsPassiveSpell(m_spellInfo) && !m_spellInfo->HasAttribute(SPELL_ATTR_CASTABLE_WHILE_MOUNTED)) { if (m_caster->IsTaxiFlying()) return SPELL_FAILED_NOT_ON_TAXI; @@ -5196,20 +5196,20 @@ SpellCastResult Spell::CheckCast(bool strict) if (!IsPassiveSpell(m_spellInfo)) { SpellCastResult castResult = CheckItems(); - if(castResult != SPELL_CAST_OK) + if (castResult != SPELL_CAST_OK) return castResult; } // Database based targets from spell_target_script if (m_UniqueTargetInfo.empty()) // skip second CheckCast apply (for delayed spells for example) { - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT || - (m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[j] != TARGET_SELF) || - m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES || - m_spellInfo->EffectImplicitTargetA[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT) + (m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT && m_spellInfo->EffectImplicitTargetA[j] != TARGET_SELF) || + m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES || + m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES || + m_spellInfo->EffectImplicitTargetA[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT) { SpellScriptTargetBounds bounds = sSpellMgr.GetSpellScriptTargetBounds(m_spellInfo->Id); @@ -5233,9 +5233,9 @@ SpellCastResult Spell::CheckCast(bool strict) Creature* creatureScriptTarget = NULL; GameObject* goScriptTarget = NULL; - for(SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) + for (SpellScriptTarget::const_iterator i_spellST = bounds.first; i_spellST != bounds.second; ++i_spellST) { - switch(i_spellST->second.type) + switch (i_spellST->second.type) { case SPELL_TARGET_TYPE_GAMEOBJECT: { @@ -5271,7 +5271,7 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_TARGET_TYPE_DEAD: default: { - Creature *p_Creature = NULL; + Creature* p_Creature = NULL; // check if explicit target is provided and check it up against database valid target entry/state if (Unit* pTarget = m_targets.getUnitTarget()) @@ -5323,7 +5323,7 @@ SpellCastResult Spell::CheckCast(bool strict) { // store coordinates for TARGET_SCRIPT_COORDINATES if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES) + m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES) { m_targets.setDestination(creatureScriptTarget->GetPositionX(),creatureScriptTarget->GetPositionY(),creatureScriptTarget->GetPositionZ()); @@ -5334,7 +5334,7 @@ SpellCastResult Spell::CheckCast(bool strict) else { if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT) + m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT) AddUnitTarget(creatureScriptTarget, SpellEffectIndex(j)); } } @@ -5342,7 +5342,7 @@ SpellCastResult Spell::CheckCast(bool strict) { // store coordinates for TARGET_SCRIPT_COORDINATES if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES) + m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES) { m_targets.setDestination(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ()); @@ -5353,7 +5353,7 @@ SpellCastResult Spell::CheckCast(bool strict) else { if (m_spellInfo->EffectImplicitTargetA[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT || - m_spellInfo->EffectImplicitTargetB[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT) + m_spellInfo->EffectImplicitTargetB[j] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT) AddGOTarget(goScriptTarget, SpellEffectIndex(j)); } } @@ -5376,34 +5376,34 @@ SpellCastResult Spell::CheckCast(bool strict) } } - if(!m_IsTriggeredSpell) + if (!m_IsTriggeredSpell) { SpellCastResult castResult = CheckRange(strict); - if(castResult != SPELL_CAST_OK) + if (castResult != SPELL_CAST_OK) return castResult; } { SpellCastResult castResult = CheckPower(); - if(castResult != SPELL_CAST_OK) + if (castResult != SPELL_CAST_OK) return castResult; } - if(!m_IsTriggeredSpell) // triggered spell not affected by stun/etc + if (!m_IsTriggeredSpell) // triggered spell not affected by stun/etc { SpellCastResult castResult = CheckCasterAuras(); - if(castResult != SPELL_CAST_OK) + if (castResult != SPELL_CAST_OK) return castResult; } for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { // for effects of spells that have only one target - switch(m_spellInfo->Effect[i]) + switch (m_spellInfo->Effect[i]) { case SPELL_EFFECT_INSTAKILL: // Death Pact - if(m_spellInfo->Id == 48743) + if (m_spellInfo->Id == 48743) { if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_ERROR; @@ -5436,7 +5436,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->IsInWater()) return SPELL_FAILED_ONLY_ABOVEWATER; } - else if(m_spellInfo->SpellIconID == 156) // Holy Shock + else if (m_spellInfo->SpellIconID == 156) // Holy Shock { // spell different for friends and enemies // hart version required facing @@ -5455,12 +5455,12 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_EFFECT_SCHOOL_DAMAGE: { // Hammer of Wrath - if(m_spellInfo->SpellVisual[0] == 7250) + if (m_spellInfo->SpellVisual[0] == 7250) { if (!m_targets.getUnitTarget()) return SPELL_FAILED_BAD_IMPLICIT_TARGETS; - if(m_targets.getUnitTarget()->GetHealth() > m_targets.getUnitTarget()->GetMaxHealth()*0.2) + if (m_targets.getUnitTarget()->GetHealth() > m_targets.getUnitTarget()->GetMaxHealth()*0.2) return SPELL_FAILED_BAD_TARGETS; } break; @@ -5470,8 +5470,8 @@ SpellCastResult Spell::CheckCast(bool strict) // Spell can be triggered, we need to check original caster prior to caster Unit* caster = GetAffectiveCaster(); if (!caster || caster->GetTypeId() != TYPEID_PLAYER || - !m_targets.getUnitTarget() || - m_targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER) + !m_targets.getUnitTarget() || + m_targets.getUnitTarget()->GetTypeId() == TYPEID_PLAYER) return SPELL_FAILED_BAD_TARGETS; Player* plrCaster = (Player*)caster; @@ -5484,7 +5484,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_DONT_REPORT; } - if(plrCaster->getClass() != CLASS_HUNTER && !gmmode) + if (plrCaster->getClass() != CLASS_HUNTER && !gmmode) { plrCaster->SendPetTameFailure(PETTAME_UNITSCANTTAME); return SPELL_FAILED_DONT_REPORT; @@ -5492,7 +5492,7 @@ SpellCastResult Spell::CheckCast(bool strict) Creature* target = (Creature*)m_targets.getUnitTarget(); - if(target->IsPet() || target->isCharmed()) + if (target->IsPet() || target->isCharmed()) { plrCaster->SendPetTameFailure(PETTAME_CREATUREALREADYOWNED); return SPELL_FAILED_DONT_REPORT; @@ -5526,20 +5526,20 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_EFFECT_LEARN_SPELL: { - if(m_spellInfo->EffectImplicitTargetA[i] != TARGET_PET) + if (m_spellInfo->EffectImplicitTargetA[i] != TARGET_PET) break; Pet* pet = m_caster->GetPet(); - if(!pet) + if (!pet) return SPELL_FAILED_NO_PET; - SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]); + SpellEntry const* learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]); - if(!learn_spellproto) + if (!learn_spellproto) return SPELL_FAILED_NOT_KNOWN; - if(m_spellInfo->spellLevel > pet->getLevel()) + if (m_spellInfo->spellLevel > pet->getLevel()) return SPELL_FAILED_LOWLEVEL; break; @@ -5548,15 +5548,15 @@ SpellCastResult Spell::CheckCast(bool strict) { Pet* pet = m_caster->GetPet(); - if(!pet) + if (!pet) return SPELL_FAILED_NO_PET; - SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]); + SpellEntry const* learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]); - if(!learn_spellproto) + if (!learn_spellproto) return SPELL_FAILED_NOT_KNOWN; - if(m_spellInfo->spellLevel > pet->getLevel()) + if (m_spellInfo->spellLevel > pet->getLevel()) return SPELL_FAILED_LOWLEVEL; break; @@ -5564,8 +5564,8 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_EFFECT_APPLY_GLYPH: { uint32 glyphId = m_spellInfo->EffectMiscValue[i]; - if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyphId)) - if(m_caster->HasAura(gp->SpellId)) + if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyphId)) + if (m_caster->HasAura(gp->SpellId)) return SPELL_FAILED_UNIQUE_GLYPH; break; } @@ -5575,21 +5575,21 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_BAD_TARGETS; Item* foodItem = m_targets.getItemTarget(); - if(!foodItem) + if (!foodItem) return SPELL_FAILED_BAD_TARGETS; Pet* pet = m_caster->GetPet(); - if(!pet) + if (!pet) return SPELL_FAILED_NO_PET; - if(!pet->HaveInDiet(foodItem->GetProto())) + if (!pet->HaveInDiet(foodItem->GetProto())) return SPELL_FAILED_WRONG_PET_FOOD; - if(!pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel)) + if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel)) return SPELL_FAILED_FOOD_LOWLEVEL; - if(pet->isInCombat()) + if (pet->isInCombat()) return SPELL_FAILED_AFFECTING_COMBAT; break; @@ -5620,7 +5620,7 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_TARGET_UNSKINNABLE; Creature* creature = (Creature*)m_targets.getUnitTarget(); - if ( creature->GetCreatureType() != CREATURE_TYPE_CRITTER && ( !creature->lootForBody || creature->lootForSkin || !creature->loot.empty() ) ) + if (creature->GetCreatureType() != CREATURE_TYPE_CRITTER && (!creature->lootForBody || creature->lootForSkin || !creature->loot.empty())) { return SPELL_FAILED_TARGET_NOT_LOOTED; } @@ -5634,9 +5634,9 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_LOW_CASTLEVEL; // chance for fail at orange skinning attempt - if( (m_selfContainer && (*m_selfContainer) == this) && - skillValue < sWorld.GetConfigMaxSkillValue() && - (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37) ) + if ((m_selfContainer && (*m_selfContainer) == this) && + skillValue < sWorld.GetConfigMaxSkillValue() && + (ReqValue < 0 ? 0 : ReqValue) > irand(skillValue - 25, skillValue + 37)) return SPELL_FAILED_TRY_AGAIN; break; @@ -5658,15 +5658,15 @@ SpellCastResult Spell::CheckCast(bool strict) if (GameObject* go = m_targets.getGOTarget()) { // In BattleGround players can use only flags and banners - if( ((Player*)m_caster)->InBattleGround() && - !((Player*)m_caster)->CanUseBattleGroundObject() ) + if (((Player*)m_caster)->InBattleGround() && + !((Player*)m_caster)->CanUseBattleGroundObject()) return SPELL_FAILED_TRY_AGAIN; lockId = go->GetGOInfo()->GetLockId(); if (!lockId) return SPELL_FAILED_ALREADY_OPEN; } - else if(Item* item = m_targets.getItemTarget()) + else if (Item* item = m_targets.getItemTarget()) { // not own (trade?) if (item->GetOwner() != m_caster) @@ -5687,28 +5687,28 @@ SpellCastResult Spell::CheckCast(bool strict) // check lock compatibility SpellCastResult res = CanOpenLock(SpellEffectIndex(i), lockId, skillId, reqSkillValue, skillValue); - if(res != SPELL_CAST_OK) + if (res != SPELL_CAST_OK) return res; // chance for fail at orange mining/herb/LockPicking gathering attempt // second check prevent fail at rechecks - if(skillId != SKILL_NONE && (!m_selfContainer || ((*m_selfContainer) != this))) + if (skillId != SKILL_NONE && (!m_selfContainer || ((*m_selfContainer) != this))) { bool canFailAtMax = skillId != SKILL_HERBALISM && skillId != SKILL_MINING; // chance for failure in orange gather / lockpick (gathering skill can't fail at maxskill) - if((canFailAtMax || skillValue < sWorld.GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue - 25, skillValue + 37)) + if ((canFailAtMax || skillValue < sWorld.GetConfigMaxSkillValue()) && reqSkillValue > irand(skillValue - 25, skillValue + 37)) return SPELL_FAILED_TRY_AGAIN; } break; } case SPELL_EFFECT_SUMMON_DEAD_PET: { - Creature *pet = m_caster->GetPet(); - if(!pet) + Creature* pet = m_caster->GetPet(); + if (!pet) return SPELL_FAILED_NO_PET; - if(pet->isAlive()) + if (pet->isAlive()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; break; @@ -5716,9 +5716,9 @@ SpellCastResult Spell::CheckCast(bool strict) // This is generic summon effect case SPELL_EFFECT_SUMMON: { - if(SummonPropertiesEntry const *summon_prop = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i])) + if (SummonPropertiesEntry const* summon_prop = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i])) { - if(summon_prop->Group == SUMMON_PROP_GROUP_PETS) + if (summon_prop->Group == SUMMON_PROP_GROUP_PETS) { if (m_caster->GetPetGuid()) return SPELL_FAILED_ALREADY_HAVE_SUMMON; @@ -5763,14 +5763,14 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_BAD_TARGETS; // check if our map is dungeon - if( sMapStore.LookupEntry(m_caster->GetMapId())->IsDungeon() ) + if (sMapStore.LookupEntry(m_caster->GetMapId())->IsDungeon()) { InstanceTemplate const* instance = ObjectMgr::GetInstanceTemplate(m_caster->GetMapId()); - if(!instance) + if (!instance) return SPELL_FAILED_TARGET_NOT_IN_INSTANCE; - if ( instance->levelMin > target->getLevel() ) + if (instance->levelMin > target->getLevel()) return SPELL_FAILED_LOWLEVEL; - if ( instance->levelMax && instance->levelMax < target->getLevel() ) + if (instance->levelMax && instance->levelMax < target->getLevel()) return SPELL_FAILED_HIGHLEVEL; } break; @@ -5783,18 +5783,18 @@ SpellCastResult Spell::CheckCast(bool strict) float fy = m_caster->GetPositionY() + dis * sin(m_caster->GetOrientation()); // teleport a bit above terrain level to avoid falling below it float fz = m_caster->GetTerrain()->GetHeight(fx, fy, m_caster->GetPositionZ(), true); - if(fz <= INVALID_HEIGHT) // note: this also will prevent use effect in instances without vmaps height enabled + if (fz <= INVALID_HEIGHT) // note: this also will prevent use effect in instances without vmaps height enabled return SPELL_FAILED_TRY_AGAIN; float caster_pos_z = m_caster->GetPositionZ(); // Control the caster to not climb or drop when +-fz > 8 - if(!(fz <= caster_pos_z + 8 && fz >= caster_pos_z - 8)) + if (!(fz <= caster_pos_z + 8 && fz >= caster_pos_z - 8)) return SPELL_FAILED_TRY_AGAIN; // not allow use this effect at battleground until battleground start - if(m_caster->GetTypeId() == TYPEID_PLAYER) - if(BattleGround const *bg = ((Player*)m_caster)->GetBattleGround()) - if(bg->GetStatus() != STATUS_IN_PROGRESS) + if (m_caster->GetTypeId() == TYPEID_PLAYER) + if (BattleGround const* bg = ((Player*)m_caster)->GetBattleGround()) + if (bg->GetStatus() != STATUS_IN_PROGRESS) return SPELL_FAILED_TRY_AGAIN; break; } @@ -5810,12 +5810,12 @@ SpellCastResult Spell::CheckCast(bool strict) for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { - switch(m_spellInfo->EffectApplyAuraName[i]) + switch (m_spellInfo->EffectApplyAuraName[i]) { case SPELL_AURA_DUMMY: { //custom check - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 34026: // Kill Command if (!m_caster->GetPet()) @@ -5922,11 +5922,11 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS: { - if(!m_targets.getUnitTarget()) + if (!m_targets.getUnitTarget()) return SPELL_FAILED_BAD_IMPLICIT_TARGETS; // can be casted at non-friendly unit or own pet/charm - if(m_caster->IsFriendlyTo(m_targets.getUnitTarget())) + if (m_caster->IsFriendlyTo(m_targets.getUnitTarget())) return SPELL_FAILED_TARGET_FRIENDLY; break; @@ -5951,7 +5951,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() != TYPEID_PLAYER || m_CastItem) break; - if(m_targets.getUnitTarget()->getPowerType() != POWER_MANA) + if (m_targets.getUnitTarget()->getPowerType() != POWER_MANA) return SPELL_FAILED_BAD_TARGETS; break; @@ -5990,7 +5990,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_NOT_TRADING; - Player *pCaster = ((Player*)m_caster); + Player* pCaster = ((Player*)m_caster); TradeData* my_trade = pCaster->GetTradeData(); if (!my_trade) @@ -6015,70 +6015,70 @@ SpellCastResult Spell::CheckCast(bool strict) SpellCastResult Spell::CheckPetCast(Unit* target) { - if(!m_caster->isAlive()) + if (!m_caster->isAlive()) return SPELL_FAILED_CASTER_DEAD; - if(m_caster->IsNonMeleeSpellCasted(false)) //prevent spellcast interruption by another spellcast + if (m_caster->IsNonMeleeSpellCasted(false)) //prevent spellcast interruption by another spellcast return SPELL_FAILED_SPELL_IN_PROGRESS; - if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo)) + if (m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo)) return SPELL_FAILED_AFFECTING_COMBAT; - if(m_caster->GetTypeId()==TYPEID_UNIT && (((Creature*)m_caster)->IsPet() || m_caster->isCharmed())) + if (m_caster->GetTypeId()==TYPEID_UNIT && (((Creature*)m_caster)->IsPet() || m_caster->isCharmed())) { - //dead owner (pets still alive when owners ressed?) - if(m_caster->GetCharmerOrOwner() && !m_caster->GetCharmerOrOwner()->isAlive()) + //dead owner (pets still alive when owners ressed?) + if (m_caster->GetCharmerOrOwner() && !m_caster->GetCharmerOrOwner()->isAlive()) return SPELL_FAILED_CASTER_DEAD; - if(!target && m_targets.getUnitTarget()) + if (!target && m_targets.getUnitTarget()) target = m_targets.getUnitTarget(); bool need = false; - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_CHAIN_DAMAGE || - m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_FRIEND || - m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_FRIEND_2 || - m_spellInfo->EffectImplicitTargetA[i] == TARGET_DUELVSPLAYER || - m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_PARTY || - m_spellInfo->EffectImplicitTargetA[i] == TARGET_CURRENT_ENEMY_COORDINATES) + m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_FRIEND || + m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_FRIEND_2 || + m_spellInfo->EffectImplicitTargetA[i] == TARGET_DUELVSPLAYER || + m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_PARTY || + m_spellInfo->EffectImplicitTargetA[i] == TARGET_CURRENT_ENEMY_COORDINATES) { need = true; - if(!target) + if (!target) return SPELL_FAILED_BAD_IMPLICIT_TARGETS; break; } } - if(need) + if (need) m_targets.setUnitTarget(target); Unit* _target = m_targets.getUnitTarget(); - if(_target) //for target dead/target not valid + if (_target) //for target dead/target not valid { if (!_target->isTargetableForAttack()) return SPELL_FAILED_BAD_TARGETS; // guessed error - if(IsPositiveSpell(m_spellInfo->Id)) + if (IsPositiveSpell(m_spellInfo->Id)) { - if(m_caster->IsHostileTo(_target)) + if (m_caster->IsHostileTo(_target)) return SPELL_FAILED_BAD_TARGETS; } else { bool duelvsplayertar = false; - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { - //TARGET_DUELVSPLAYER is positive AND negative + //TARGET_DUELVSPLAYER is positive AND negative duelvsplayertar |= (m_spellInfo->EffectImplicitTargetA[j] == TARGET_DUELVSPLAYER); } - if(m_caster->IsFriendlyTo(target) && !duelvsplayertar) + if (m_caster->IsFriendlyTo(target) && !duelvsplayertar) { return SPELL_FAILED_BAD_TARGETS; } } } - //cooldown - if(((Creature*)m_caster)->HasSpellCooldown(m_spellInfo->Id)) + //cooldown + if (((Creature*)m_caster)->HasSpellCooldown(m_spellInfo->Id)) return SPELL_FAILED_NOT_READY; } @@ -6091,8 +6091,8 @@ SpellCastResult Spell::CheckCasterAuras() const // FIXME: find more nice check for all totally immuned spells // HasAttribute(SPELL_ATTR_EX3_UNK28) ? if (m_spellInfo->Id == 23336 || // Alliance Flag Drop - m_spellInfo->Id == 23334 || // Horde Flag Drop - m_spellInfo->Id == 34991) // Summon Netherstorm Flag + m_spellInfo->Id == 23334 || // Horde Flag Drop + m_spellInfo->Id == 34991) // Summon Netherstorm Flag return SPELL_CAST_OK; uint8 school_immune = 0; @@ -6103,7 +6103,7 @@ SpellCastResult Spell::CheckCasterAuras() const // We use bitmasks so the loop is done only once and not on every aura check below. if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)) { - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { if (m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_IMMUNITY) school_immune |= uint32(m_spellInfo->EffectMiscValue[i]); @@ -6160,12 +6160,12 @@ SpellCastResult Spell::CheckCasterAuras() const prevented_reason = SPELL_FAILED_SILENCED; else if (unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY) prevented_reason = SPELL_FAILED_PACIFIED; - else if(m_caster->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY)) + else if (m_caster->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY)) { Unit::AuraList const& casingLimit = m_caster->GetAurasByType(SPELL_AURA_ALLOW_ONLY_ABILITY); - for(Unit::AuraList::const_iterator itr = casingLimit.begin(); itr != casingLimit.end(); ++itr) + for (Unit::AuraList::const_iterator itr = casingLimit.begin(); itr != casingLimit.end(); ++itr) { - if(!(*itr)->isAffectedOnSpell(m_spellInfo)) + if (!(*itr)->isAffectedOnSpell(m_spellInfo)) { prevented_reason = SPELL_FAILED_CASTER_AURASTATE; break; @@ -6180,10 +6180,10 @@ SpellCastResult Spell::CheckCasterAuras() const { //Checking auras is needed now, because you are prevented by some state but the spell grants immunity. Unit::SpellAuraHolderMap const& auras = m_caster->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { - SpellAuraHolder *holder = itr->second; - SpellEntry const * pEntry = holder->GetSpellProto(); + SpellAuraHolder* holder = itr->second; + SpellEntry const* pEntry = holder->GetSpellProto(); if ((GetSpellSchoolMask(pEntry) & school_immune) && !pEntry->HasAttribute(SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE)) continue; @@ -6192,7 +6192,7 @@ SpellCastResult Spell::CheckCasterAuras() const for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) { - Aura *aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)); + Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)); if (!aura) continue; @@ -6200,7 +6200,7 @@ SpellCastResult Spell::CheckCasterAuras() const continue; // Make a second check for spell failed so the right SPELL_FAILED message is returned. // That is needed when your casting is prevented by multiple states and you are only immune to some of them. - switch(aura->GetModifier()->m_auraname) + switch (aura->GetModifier()->m_auraname) { case SPELL_AURA_MOD_STUN: if (!spellUsableWhileStunned || !aura->HasMechanic(MECHANIC_STUN)) @@ -6217,9 +6217,9 @@ SpellCastResult Spell::CheckCasterAuras() const case SPELL_AURA_MOD_SILENCE: case SPELL_AURA_MOD_PACIFY: case SPELL_AURA_MOD_PACIFY_SILENCE: - if( m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY) + if (m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_PACIFY) return SPELL_FAILED_PACIFIED; - else if ( m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) + else if (m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) return SPELL_FAILED_SILENCED; break; default: break; @@ -6238,36 +6238,36 @@ bool Spell::CanAutoCast(Unit* target) { ObjectGuid targetguid = target->GetObjectGuid(); - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { - if(m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA) + if (m_spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA) { - if( m_spellInfo->StackAmount <= 1) + if (m_spellInfo->StackAmount <= 1) { - if( target->HasAura(m_spellInfo->Id, SpellEffectIndex(j)) ) + if (target->HasAura(m_spellInfo->Id, SpellEffectIndex(j))) return false; } else { - if(Aura* aura = target->GetAura(m_spellInfo->Id, SpellEffectIndex(j))) - if(aura->GetStackAmount() >= m_spellInfo->StackAmount) + if (Aura* aura = target->GetAura(m_spellInfo->Id, SpellEffectIndex(j))) + if (aura->GetStackAmount() >= m_spellInfo->StackAmount) return false; } } - else if ( IsAreaAuraEffect( m_spellInfo->Effect[j] )) + else if (IsAreaAuraEffect(m_spellInfo->Effect[j])) { - if( target->HasAura(m_spellInfo->Id, SpellEffectIndex(j)) ) - return false; + if (target->HasAura(m_spellInfo->Id, SpellEffectIndex(j))) + return false; } } SpellCastResult result = CheckPetCast(target); - if(result == SPELL_CAST_OK || result == SPELL_FAILED_UNIT_NOT_INFRONT) + if (result == SPELL_CAST_OK || result == SPELL_FAILED_UNIT_NOT_INFRONT) { FillTargetMap(); //check if among target units, our WANTED target is as well (->only self cast spells return false) - for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) if (ihit->targetGUID == targetguid) return true; } @@ -6276,17 +6276,17 @@ bool Spell::CanAutoCast(Unit* target) SpellCastResult Spell::CheckRange(bool strict) { - Unit *target = m_targets.getUnitTarget(); + Unit* target = m_targets.getUnitTarget(); // special range cases - switch(m_spellInfo->rangeIndex) + switch (m_spellInfo->rangeIndex) { - // self cast doesn't need range checking -- also for Starshards fix - // spells that can be cast anywhere also need no check + // self cast doesn't need range checking -- also for Starshards fix + // spells that can be cast anywhere also need no check case SPELL_RANGE_IDX_SELF_ONLY: case SPELL_RANGE_IDX_ANYWHERE: return SPELL_CAST_OK; - // combat range spells are treated differently + // combat range spells are treated differently case SPELL_RANGE_IDX_COMBAT: { if (target) @@ -6314,29 +6314,29 @@ SpellCastResult Spell::CheckRange(bool strict) float max_range = GetSpellMaxRange(srange, friendly) + range_mod; float min_range = GetSpellMinRange(srange, friendly); - if(Player* modOwner = m_caster->GetSpellModOwner()) + if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, max_range, this); - if(target && target != m_caster) + if (target && target != m_caster) { // distance from target in checks float dist = m_caster->GetCombatDistance(target); - if(dist > max_range) + if (dist > max_range) return SPELL_FAILED_OUT_OF_RANGE; - if(min_range && dist < min_range) + if (min_range && dist < min_range) return SPELL_FAILED_TOO_CLOSE; - if( m_caster->GetTypeId() == TYPEID_PLAYER && - (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc( M_PI_F, target ) ) + if (m_caster->GetTypeId() == TYPEID_PLAYER && + (m_spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT) && !m_caster->HasInArc(M_PI_F, target)) return SPELL_FAILED_UNIT_NOT_INFRONT; } // TODO verify that such spells really use bounding radius - if(m_targets.m_targetMask == TARGET_FLAG_DEST_LOCATION && m_targets.m_destX != 0 && m_targets.m_destY != 0 && m_targets.m_destZ != 0) + if (m_targets.m_targetMask == TARGET_FLAG_DEST_LOCATION && m_targets.m_destX != 0 && m_targets.m_destY != 0 && m_targets.m_destZ != 0) { - if(!m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, max_range)) + if (!m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, max_range)) return SPELL_FAILED_OUT_OF_RANGE; - if(min_range && m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, min_range)) + if (min_range && m_caster->IsWithinDist3d(m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, min_range)) return SPELL_FAILED_TOO_CLOSE; } @@ -6369,7 +6369,7 @@ uint32 Spell::CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spel { switch (spellInfo->powerType) { - // health as power used + // health as power used case POWER_HEALTH: powerCost += spellInfo->ManaCostPercentage * caster->GetCreateHealth() / 100; break; @@ -6415,7 +6415,7 @@ uint32 Spell::CalculatePowerCost(SpellEntry const* spellInfo, Unit* caster, Spel SpellCastResult Spell::CheckPower() { // item cast not used power - if(m_CastItem) + if (m_CastItem) return SPELL_CAST_OK; // Do precise power regen on spell cast @@ -6492,17 +6492,17 @@ SpellCastResult Spell::CheckItems() bool isVellumTarget = false; // cast item checks - if(m_CastItem) + if (m_CastItem) { if (m_CastItem->IsInTrade()) return SPELL_FAILED_ITEM_NOT_FOUND; uint32 itemid = m_CastItem->GetEntry(); - if( !p_caster->HasItemCount(itemid, 1) ) + if (!p_caster->HasItemCount(itemid, 1)) return SPELL_FAILED_ITEM_NOT_FOUND; - ItemPrototype const *proto = m_CastItem->GetProto(); - if(!proto) + ItemPrototype const* proto = m_CastItem->GetProto(); + if (!proto) return SPELL_FAILED_ITEM_NOT_FOUND; if (proto->Flags & ITEM_FLAG_ENCHANT_SCROLL) @@ -6510,7 +6510,7 @@ SpellCastResult Spell::CheckItems() for (int i = 0; i < 5; ++i) if (proto->Spells[i].SpellCharges) - if(m_CastItem->GetSpellCharges(i) == 0) + if (m_CastItem->GetSpellCharges(i) == 0) return SPELL_FAILED_NO_CHARGES_REMAIN; // consumable cast item checks @@ -6541,7 +6541,7 @@ SpellCastResult Spell::CheckItems() // Mana Potion, Rage Potion, Thistle Tea(Rogue), ... if (m_spellInfo->Effect[i] == SPELL_EFFECT_ENERGIZE) { - if(m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS) + if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS) { failReason = SPELL_FAILED_ALREADY_AT_FULL_POWER; continue; @@ -6570,38 +6570,38 @@ SpellCastResult Spell::CheckItems() { if (m_caster->GetTypeId() != TYPEID_PLAYER) return m_IsTriggeredSpell && !(m_targets.m_targetMask & TARGET_FLAG_TRADE_ITEM) - ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_BAD_TARGETS; + ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_BAD_TARGETS; if (!m_targets.getItemTarget()) return m_IsTriggeredSpell && !(m_targets.m_targetMask & TARGET_FLAG_TRADE_ITEM) - ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_ITEM_GONE; + ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_ITEM_GONE; isVellumTarget = m_targets.getItemTarget()->GetProto()->IsVellum(); if (!m_targets.getItemTarget()->IsFitToSpellRequirements(m_spellInfo)) return m_IsTriggeredSpell && !(m_targets.m_targetMask & TARGET_FLAG_TRADE_ITEM) - ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS; + ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS; // Do not enchant vellum with scroll if (isVellumTarget && isScrollItem) return m_IsTriggeredSpell && !(m_targets.m_targetMask & TARGET_FLAG_TRADE_ITEM) - ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_BAD_TARGETS; + ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_BAD_TARGETS; } // if not item target then required item must be equipped (for triggered case not report error) else { - if(m_caster->GetTypeId() == TYPEID_PLAYER && !((Player*)m_caster)->HasItemFitToSpellReqirements(m_spellInfo)) + if (m_caster->GetTypeId() == TYPEID_PLAYER && !((Player*)m_caster)->HasItemFitToSpellReqirements(m_spellInfo)) return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS; } // check spell focus object - if(m_spellInfo->RequiresSpellFocus) + if (m_spellInfo->RequiresSpellFocus) { GameObject* ok = NULL; MaNGOS::GameObjectFocusCheck go_check(m_caster,m_spellInfo->RequiresSpellFocus); MaNGOS::GameObjectSearcher checker(ok, go_check); Cell::VisitGridObjects(m_caster, checker, m_caster->GetMap()->GetVisibilityDistance()); - if(!ok) + if (!ok) return SPELL_FAILED_REQUIRES_SPELL_FOCUS; focusObject = ok; // game object found in range @@ -6612,9 +6612,9 @@ SpellCastResult Spell::CheckItems() { if (!p_caster->CanNoReagentCast(m_spellInfo)) { - for(uint32 i = 0; i < MAX_SPELL_REAGENTS; ++i) + for (uint32 i = 0; i < MAX_SPELL_REAGENTS; ++i) { - if(m_spellInfo->Reagent[i] <= 0) + if (m_spellInfo->Reagent[i] <= 0) continue; uint32 itemid = m_spellInfo->Reagent[i]; @@ -6623,10 +6623,10 @@ SpellCastResult Spell::CheckItems() // if CastItem is also spell reagent if (m_CastItem && m_CastItem->GetEntry() == itemid) { - ItemPrototype const *proto = m_CastItem->GetProto(); + ItemPrototype const* proto = m_CastItem->GetProto(); if (!proto) return SPELL_FAILED_REAGENTS; - for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) + for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) { // CastItem will be used up and does not count as reagent int32 charges = m_CastItem->GetSpellCharges(s); @@ -6645,7 +6645,7 @@ SpellCastResult Spell::CheckItems() // check totem-item requirements (items presence in inventory) uint32 totems = MAX_SPELL_TOTEMS; - for(int i = 0; i < MAX_SPELL_TOTEMS ; ++i) + for (int i = 0; i < MAX_SPELL_TOTEMS ; ++i) { if (m_spellInfo->Totem[i] != 0) { @@ -6664,7 +6664,7 @@ SpellCastResult Spell::CheckItems() // Check items for TotemCategory (items presence in inventory) uint32 TotemCategory = MAX_SPELL_TOTEM_CATEGORIES; - for(int i= 0; i < MAX_SPELL_TOTEM_CATEGORIES; ++i) + for (int i= 0; i < MAX_SPELL_TOTEM_CATEGORIES; ++i) { if (m_spellInfo->TotemCategory[i] != 0) { @@ -6683,7 +6683,7 @@ SpellCastResult Spell::CheckItems() } // special checks for spell effects - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { switch (m_spellInfo->Effect[i]) { @@ -6711,10 +6711,10 @@ SpellCastResult Spell::CheckItems() } ItemPosCountVec dest; - InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1 ); - if (msg != EQUIP_ERR_OK ) + InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1); + if (msg != EQUIP_ERR_OK) { - p_caster->SendEquipError( msg, NULL, NULL, m_spellInfo->EffectItemType[i] ); + p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->EffectItemType[i]); return SPELL_FAILED_DONT_REPORT; } } @@ -6732,28 +6732,28 @@ SpellCastResult Spell::CheckItems() case SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC: { Item* targetItem = m_targets.getItemTarget(); - if(!targetItem) + if (!targetItem) return SPELL_FAILED_ITEM_NOT_FOUND; - if( targetItem->GetProto()->ItemLevel < m_spellInfo->baseLevel ) + if (targetItem->GetProto()->ItemLevel < m_spellInfo->baseLevel) return SPELL_FAILED_LOWLEVEL; // Check if we can store a new scroll, enchanting vellum has implicit SPELL_EFFECT_CREATE_ITEM if (isVellumTarget && m_spellInfo->EffectItemType[i]) { ItemPosCountVec dest; - InventoryResult msg = p_caster->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1 ); + InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1); if (msg != EQUIP_ERR_OK) { - p_caster->SendEquipError( msg, NULL, NULL ); + p_caster->SendEquipError(msg, NULL, NULL); return SPELL_FAILED_DONT_REPORT; } } // Not allow enchant in trade slot for some enchant type - if( targetItem->GetOwner() != m_caster ) + if (targetItem->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!pEnchant) + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + if (!pEnchant) return SPELL_FAILED_ERROR; if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND) return SPELL_FAILED_NOT_TRADEABLE; @@ -6765,15 +6765,15 @@ SpellCastResult Spell::CheckItems() } case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY: { - Item *item = m_targets.getItemTarget(); - if(!item) + Item* item = m_targets.getItemTarget(); + if (!item) return SPELL_FAILED_ITEM_NOT_FOUND; // Not allow enchant in trade slot for some enchant type - if( item->GetOwner() != m_caster ) + if (item->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!pEnchant) + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + if (!pEnchant) return SPELL_FAILED_ERROR; if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND) return SPELL_FAILED_NOT_TRADEABLE; @@ -6785,15 +6785,15 @@ SpellCastResult Spell::CheckItems() break; case SPELL_EFFECT_DISENCHANT: { - if(!m_targets.getItemTarget()) + if (!m_targets.getItemTarget()) return SPELL_FAILED_CANT_BE_DISENCHANTED; // prevent disenchanting in trade slot - if( m_targets.getItemTarget()->GetOwnerGuid() != m_caster->GetObjectGuid() ) + if (m_targets.getItemTarget()->GetOwnerGuid() != m_caster->GetObjectGuid()) return SPELL_FAILED_CANT_BE_DISENCHANTED; ItemPrototype const* itemProto = m_targets.getItemTarget()->GetProto(); - if(!itemProto) + if (!itemProto) return SPELL_FAILED_CANT_BE_DISENCHANTED; // must have disenchant loot (other static req. checked at item prototype loading) @@ -6808,7 +6808,7 @@ SpellCastResult Spell::CheckItems() } case SPELL_EFFECT_PROSPECTING: { - if(!m_targets.getItemTarget()) + if (!m_targets.getItemTarget()) return SPELL_FAILED_CANT_BE_PROSPECTED; // ensure item is a prospectable ore if (!(m_targets.getItemTarget()->GetProto()->Flags & ITEM_FLAG_PROSPECTABLE)) @@ -6831,7 +6831,7 @@ SpellCastResult Spell::CheckItems() } case SPELL_EFFECT_MILLING: { - if(!m_targets.getItemTarget()) + if (!m_targets.getItemTarget()) return SPELL_FAILED_CANT_BE_MILLED; // ensure item is a millable herb if (!(m_targets.getItemTarget()->GetProto()->Flags & ITEM_FLAG_MILLABLE)) @@ -6847,7 +6847,7 @@ SpellCastResult Spell::CheckItems() if (int32(m_targets.getItemTarget()->GetCount()) < CalculateDamage(SpellEffectIndex(i), m_caster)) return SPELL_FAILED_NEED_MORE_ITEMS; - if(!LootTemplates_Milling.HaveLootFor(m_targets.getItemTargetEntry())) + if (!LootTemplates_Milling.HaveLootFor(m_targets.getItemTargetEntry())) return SPELL_FAILED_CANT_BE_MILLED; break; @@ -6855,19 +6855,19 @@ SpellCastResult Spell::CheckItems() case SPELL_EFFECT_WEAPON_DAMAGE: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: { - if(m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER; - if( m_attackType != RANGED_ATTACK ) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER; + if (m_attackType != RANGED_ATTACK) break; - Item *pItem = ((Player*)m_caster)->GetWeaponForAttack(m_attackType,true,false); + Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(m_attackType,true,false); if (!pItem) return SPELL_FAILED_EQUIPPED_ITEM; - switch(pItem->GetProto()->SubClass) + switch (pItem->GetProto()->SubClass) { case ITEM_SUBCLASS_WEAPON_THROWN: { uint32 ammo = pItem->GetEntry(); - if( !((Player*)m_caster)->HasItemCount( ammo, 1 ) ) + if (!((Player*)m_caster)->HasItemCount(ammo, 1)) return SPELL_FAILED_NO_AMMO; }; break; case ITEM_SUBCLASS_WEAPON_GUN: @@ -6875,39 +6875,39 @@ SpellCastResult Spell::CheckItems() case ITEM_SUBCLASS_WEAPON_CROSSBOW: { uint32 ammo = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID); - if(!ammo) + if (!ammo) { // Requires No Ammo - if(m_caster->GetDummyAura(46699)) + if (m_caster->GetDummyAura(46699)) break; // skip other checks return SPELL_FAILED_NO_AMMO; } - ItemPrototype const *ammoProto = ObjectMgr::GetItemPrototype( ammo ); - if(!ammoProto) + ItemPrototype const* ammoProto = ObjectMgr::GetItemPrototype(ammo); + if (!ammoProto) return SPELL_FAILED_NO_AMMO; - if(ammoProto->Class != ITEM_CLASS_PROJECTILE) + if (ammoProto->Class != ITEM_CLASS_PROJECTILE) return SPELL_FAILED_NO_AMMO; // check ammo ws. weapon compatibility - switch(pItem->GetProto()->SubClass) + switch (pItem->GetProto()->SubClass) { case ITEM_SUBCLASS_WEAPON_BOW: case ITEM_SUBCLASS_WEAPON_CROSSBOW: - if(ammoProto->SubClass != ITEM_SUBCLASS_ARROW) + if (ammoProto->SubClass != ITEM_SUBCLASS_ARROW) return SPELL_FAILED_NO_AMMO; break; case ITEM_SUBCLASS_WEAPON_GUN: - if(ammoProto->SubClass != ITEM_SUBCLASS_BULLET) + if (ammoProto->SubClass != ITEM_SUBCLASS_BULLET) return SPELL_FAILED_NO_AMMO; break; default: return SPELL_FAILED_NO_AMMO; } - if( !((Player*)m_caster)->HasItemCount( ammo, 1 ) ) + if (!((Player*)m_caster)->HasItemCount(ammo, 1)) return SPELL_FAILED_NO_AMMO; }; break; case ITEM_SUBCLASS_WEAPON_WAND: @@ -6926,17 +6926,17 @@ SpellCastResult Spell::CheckItems() void Spell::Delayed() { - if(!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER) + if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER) return; if (m_spellState == SPELL_STATE_DELAYED) return; // spell is active and can't be time-backed - if(isDelayableNoMore()) // Spells may only be delayed twice + if (isDelayableNoMore()) // Spells may only be delayed twice return; // spells not loosing casting time ( slam, dynamites, bombs.. ) - if(!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE)) + if (!(m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_DAMAGE)) return; // check pushback reduce @@ -6944,12 +6944,12 @@ void Spell::Delayed() int32 delayReduce = 100; // must be initialized to 100 for percent modifiers ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this); delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100; - if(delayReduce >= 100) + if (delayReduce >= 100) return; delaytime = delaytime * (100 - delayReduce) / 100; - if(int32(m_timer) + delaytime > m_casttime) + if (int32(m_timer) + delaytime > m_casttime) { delaytime = m_casttime - m_timer; m_timer = m_casttime; @@ -6968,10 +6968,10 @@ void Spell::Delayed() void Spell::DelayedChannel() { - if(!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER || getState() != SPELL_STATE_CASTING) + if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER || getState() != SPELL_STATE_CASTING) return; - if(isDelayableNoMore()) // Spells may only be delayed twice + if (isDelayableNoMore()) // Spells may only be delayed twice return; // check pushback reduce @@ -6979,12 +6979,12 @@ void Spell::DelayedChannel() int32 delayReduce = 100; // must be initialized to 100 for percent modifiers ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_NOT_LOSE_CASTING_TIME, delayReduce, this); delayReduce += m_caster->GetTotalAuraModifier(SPELL_AURA_REDUCE_PUSHBACK) - 100; - if(delayReduce >= 100) + if (delayReduce >= 100) return; delaytime = delaytime * (100 - delayReduce) / 100; - if(int32(m_timer) < delaytime) + if (int32(m_timer) < delaytime) { delaytime = m_timer; m_timer = 0; @@ -6994,7 +6994,7 @@ void Spell::DelayedChannel() DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); - for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if ((*ihit).missCondition == SPELL_MISS_NONE) { @@ -7003,7 +7003,7 @@ void Spell::DelayedChannel() } } - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { // partially interrupt persistent area auras if (DynamicObject* dynObj = m_caster->GetDynObject(m_spellInfo->Id, SpellEffectIndex(j))) @@ -7015,7 +7015,7 @@ void Spell::DelayedChannel() void Spell::UpdateOriginalCasterPointer() { - if(m_originalCasterGUID == m_caster->GetObjectGuid()) + if (m_originalCasterGUID == m_caster->GetObjectGuid()) m_originalCaster = m_caster; else if (m_originalCasterGUID.IsGameObject()) { @@ -7044,14 +7044,14 @@ bool Spell::CheckTargetCreatureType(Unit* target) const if (m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->Category == 1179) { // not allow cast at player - if(target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) return false; spellCreatureTargetMask = 0x7FF; } // Dismiss Pet and Taming Lesson skipped - if(m_spellInfo->Id == 2641 || m_spellInfo->Id == 23356) + if (m_spellInfo->Id == 2641 || m_spellInfo->Id == 23356) spellCreatureTargetMask = 0; if (spellCreatureTargetMask) @@ -7075,17 +7075,17 @@ CurrentSpellTypes Spell::GetCurrentContainer() return(CURRENT_GENERIC_SPELL); } -bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff ) +bool Spell::CheckTarget(Unit* target, SpellEffectIndex eff) { // Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets) - if(m_spellInfo->EffectImplicitTargetA[eff] != TARGET_SELF ) + if (m_spellInfo->EffectImplicitTargetA[eff] != TARGET_SELF) { if (!CheckTargetCreatureType(target)) return false; } // Check Aura spell req (need for AoE spells) - if(m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell)) + if (m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell)) return false; if (m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell)) return false; @@ -7101,50 +7101,50 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff ) // unselectable targets skipped in all cases except TARGET_SCRIPT targeting // in case TARGET_SCRIPT target selected by server always and can't be cheated if ((!m_IsTriggeredSpell || target != m_targets.getUnitTarget()) && - target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && - m_spellInfo->EffectImplicitTargetA[eff] != TARGET_SCRIPT && - m_spellInfo->EffectImplicitTargetB[eff] != TARGET_SCRIPT && - m_spellInfo->EffectImplicitTargetA[eff] != TARGET_AREAEFFECT_INSTANT && - m_spellInfo->EffectImplicitTargetB[eff] != TARGET_AREAEFFECT_INSTANT && - m_spellInfo->EffectImplicitTargetA[eff] != TARGET_AREAEFFECT_CUSTOM && - m_spellInfo->EffectImplicitTargetB[eff] != TARGET_AREAEFFECT_CUSTOM ) + target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE) && + m_spellInfo->EffectImplicitTargetA[eff] != TARGET_SCRIPT && + m_spellInfo->EffectImplicitTargetB[eff] != TARGET_SCRIPT && + m_spellInfo->EffectImplicitTargetA[eff] != TARGET_AREAEFFECT_INSTANT && + m_spellInfo->EffectImplicitTargetB[eff] != TARGET_AREAEFFECT_INSTANT && + m_spellInfo->EffectImplicitTargetA[eff] != TARGET_AREAEFFECT_CUSTOM && + m_spellInfo->EffectImplicitTargetB[eff] != TARGET_AREAEFFECT_CUSTOM) return false; } // Check player targets and remove if in GM mode or GM invisibility (for not self casting case) - if( target != m_caster && target->GetTypeId() == TYPEID_PLAYER) + if (target != m_caster && target->GetTypeId() == TYPEID_PLAYER) { - if(((Player*)target)->GetVisibility() == VISIBILITY_OFF) + if (((Player*)target)->GetVisibility() == VISIBILITY_OFF) return false; - if(((Player*)target)->isGameMaster() && !IsPositiveSpell(m_spellInfo->Id)) + if (((Player*)target)->isGameMaster() && !IsPositiveSpell(m_spellInfo->Id)) return false; } // Check targets for LOS visibility (except spells without range limitations ) - switch(m_spellInfo->Effect[eff]) + switch (m_spellInfo->Effect[eff]) { case SPELL_EFFECT_SUMMON_PLAYER: // from anywhere break; case SPELL_EFFECT_DUMMY: - if(m_spellInfo->Id != 20577) // Cannibalize + if (m_spellInfo->Id != 20577) // Cannibalize break; // fall through case SPELL_EFFECT_RESURRECT_NEW: // player far away, maybe his corpse near? - if(target != m_caster && !target->IsWithinLOSInMap(m_caster)) + if (target != m_caster && !target->IsWithinLOSInMap(m_caster)) { if (!m_targets.getCorpseTargetGuid()) return false; - Corpse *corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGuid()); - if(!corpse) + Corpse* corpse = m_caster->GetMap()->GetCorpse(m_targets.getCorpseTargetGuid()); + if (!corpse) return false; - if(target->GetObjectGuid() != corpse->GetOwnerGuid()) + if (target->GetObjectGuid() != corpse->GetOwnerGuid()) return false; - if(!corpse->IsWithinLOSInMap(m_caster)) + if (!corpse->IsWithinLOSInMap(m_caster)) return false; } @@ -7153,7 +7153,7 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff ) default: // normal case // Get GO cast coordinates if original caster -> GO if (target != m_caster) - if (WorldObject *caster = GetCastingObject()) + if (WorldObject* caster = GetCastingObject()) if (!target->IsWithinLOSInMap(caster)) return false; break; @@ -7173,28 +7173,28 @@ bool Spell::CheckTarget( Unit* target, SpellEffectIndex eff ) bool Spell::IsNeedSendToClient() const { return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || IsChanneledSpell(m_spellInfo) || - m_spellInfo->speed > 0.0f || (!m_triggeredByAuraSpell && !m_IsTriggeredSpell); + m_spellInfo->speed > 0.0f || (!m_triggeredByAuraSpell && !m_IsTriggeredSpell); } bool Spell::IsTriggeredSpellWithRedundentData() const { return m_triggeredByAuraSpell || m_triggeredBySpellInfo || - // possible not need after above check? - m_IsTriggeredSpell && (m_spellInfo->manaCost || m_spellInfo->ManaCostPercentage); + // possible not need after above check? + m_IsTriggeredSpell && (m_spellInfo->manaCost || m_spellInfo->ManaCostPercentage); } bool Spell::HaveTargetsForEffect(SpellEffectIndex effect) const { - for(TargetList::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) - if(itr->effectMask & (1 << effect)) + for (TargetList::const_iterator itr = m_UniqueTargetInfo.begin(); itr != m_UniqueTargetInfo.end(); ++itr) + if (itr->effectMask & (1 << effect)) return true; - for(GOTargetList::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) - if(itr->effectMask & (1 << effect)) + for (GOTargetList::const_iterator itr = m_UniqueGOTargetInfo.begin(); itr != m_UniqueGOTargetInfo.end(); ++itr) + if (itr->effectMask & (1 << effect)) return true; - for(ItemTargetList::const_iterator itr = m_UniqueItemInfo.begin(); itr != m_UniqueItemInfo.end(); ++itr) - if(itr->effectMask & (1 << effect)) + for (ItemTargetList::const_iterator itr = m_UniqueItemInfo.begin(); itr != m_UniqueItemInfo.end(); ++itr) + if (itr->effectMask & (1 << effect)) return true; return false; @@ -7217,7 +7217,7 @@ SpellEvent::~SpellEvent() else { sLog.outError("~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.", - (m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id); + (m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id); } } @@ -7321,24 +7321,24 @@ bool SpellEvent::IsDeletable() const SpellCastResult Spell::CanOpenLock(SpellEffectIndex effIndex, uint32 lockId, SkillType& skillId, int32& reqSkillValue, int32& skillValue) { - if(!lockId) // possible case for GO and maybe for items. + if (!lockId) // possible case for GO and maybe for items. return SPELL_CAST_OK; // Get LockInfo - LockEntry const *lockInfo = sLockStore.LookupEntry(lockId); + LockEntry const* lockInfo = sLockStore.LookupEntry(lockId); if (!lockInfo) return SPELL_FAILED_BAD_TARGETS; bool reqKey = false; // some locks not have reqs - for(int j = 0; j < 8; ++j) + for (int j = 0; j < 8; ++j) { - switch(lockInfo->Type[j]) + switch (lockInfo->Type[j]) { - // check key item (many fit cases can be) + // check key item (many fit cases can be) case LOCK_KEY_ITEM: - if(lockInfo->Index[j] && m_CastItem && m_CastItem->GetEntry()==lockInfo->Index[j]) + if (lockInfo->Index[j] && m_CastItem && m_CastItem->GetEntry()==lockInfo->Index[j]) return SPELL_CAST_OK; reqKey = true; break; @@ -7348,12 +7348,12 @@ SpellCastResult Spell::CanOpenLock(SpellEffectIndex effIndex, uint32 lockId, Ski reqKey = true; // wrong locktype, skip - if(uint32(m_spellInfo->EffectMiscValue[effIndex]) != lockInfo->Index[j]) + if (uint32(m_spellInfo->EffectMiscValue[effIndex]) != lockInfo->Index[j]) continue; skillId = SkillByLockType(LockType(lockInfo->Index[j])); - if ( skillId != SKILL_NONE ) + if (skillId != SKILL_NONE) { // skill bonus provided by casting spell (mostly item spells) // add the damage modifier from the spell casted (cheat lock / skeleton key etc.) (use m_currentBasePoints, CalculateDamage returns wrong value) @@ -7362,7 +7362,7 @@ SpellCastResult Spell::CanOpenLock(SpellEffectIndex effIndex, uint32 lockId, Ski // castitem check: rogue using skeleton keys. the skill values should not be added in this case. skillValue = m_CastItem || m_caster->GetTypeId()!= TYPEID_PLAYER ? - 0 : ((Player*)m_caster)->GetSkillValue(skillId); + 0 : ((Player*)m_caster)->GetSkillValue(skillId); skillValue += spellSkillBonus; @@ -7375,7 +7375,7 @@ SpellCastResult Spell::CanOpenLock(SpellEffectIndex effIndex, uint32 lockId, Ski } } - if(reqKey) + if (reqKey) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; @@ -7392,37 +7392,37 @@ SpellCastResult Spell::CanOpenLock(SpellEffectIndex effIndex, uint32 lockId, Ski * @param spellTargets Additional rules for target selection base at hostile/friendly state to original spell caster * @param originalCaster If provided set alternative original caster, if =NULL then used Spell::GetAffectiveObject() return */ -void Spell::FillAreaTargets(UnitList &targetUnitMap, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster /*=NULL*/) +void Spell::FillAreaTargets(UnitList& targetUnitMap, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster /*=NULL*/) { MaNGOS::SpellNotifierCreatureAndPlayer notifier(*this, targetUnitMap, radius, pushType, spellTargets, originalCaster); Cell::VisitAllObjects(notifier.GetCenterX(), notifier.GetCenterY(), m_caster->GetMap(), notifier, radius); } -void Spell::FillRaidOrPartyTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster) +void Spell::FillRaidOrPartyTargets(UnitList& targetUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster) { - Player *pMember = member->GetCharmerOrOwnerPlayerOrPlayerItself(); - Group *pGroup = pMember ? pMember->GetGroup() : NULL; + Player* pMember = member->GetCharmerOrOwnerPlayerOrPlayerItself(); + Group* pGroup = pMember ? pMember->GetGroup() : NULL; if (pGroup) { uint8 subgroup = pMember->GetSubGroup(); - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); // IsHostileTo check duel and controlled by enemy if (Target && (raid || subgroup==Target->GetSubGroup()) - && !m_caster->IsHostileTo(Target)) + && !m_caster->IsHostileTo(Target)) { if ((Target == center || center->IsWithinDistInMap(Target, radius)) && - (withcaster || Target != m_caster)) + (withcaster || Target != m_caster)) targetUnitMap.push_back(Target); if (withPets) if (Pet* pet = Target->GetPet()) if ((pet == center || center->IsWithinDistInMap(pet, radius)) && - (withcaster || pet != m_caster)) + (withcaster || pet != m_caster)) targetUnitMap.push_back(pet); } } @@ -7431,45 +7431,45 @@ void Spell::FillRaidOrPartyTargets(UnitList &targetUnitMap, Unit* member, Unit* { Unit* ownerOrSelf = pMember ? pMember : member->GetCharmerOrOwnerOrSelf(); if ((ownerOrSelf == center || center->IsWithinDistInMap(ownerOrSelf, radius)) && - (withcaster || ownerOrSelf != m_caster)) + (withcaster || ownerOrSelf != m_caster)) targetUnitMap.push_back(ownerOrSelf); if (withPets) if (Pet* pet = ownerOrSelf->GetPet()) if ((pet == center || center->IsWithinDistInMap(pet, radius)) && - (withcaster || pet != m_caster)) + (withcaster || pet != m_caster)) targetUnitMap.push_back(pet); } } -void Spell::FillRaidOrPartyManaPriorityTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withCaster) +void Spell::FillRaidOrPartyManaPriorityTargets(UnitList& targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withCaster) { FillRaidOrPartyTargets(targetUnitMap, member, center, radius, raid, withPets, withCaster); PrioritizeManaUnitQueue manaUsers; - for(UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ++itr) + for (UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ++itr) if ((*itr)->getPowerType() == POWER_MANA && !(*itr)->isDead()) manaUsers.push(PrioritizeManaUnitWraper(*itr)); targetUnitMap.clear(); - while(!manaUsers.empty() && targetUnitMap.size() < count) + while (!manaUsers.empty() && targetUnitMap.size() < count) { targetUnitMap.push_back(manaUsers.top().getUnit()); manaUsers.pop(); } } -void Spell::FillRaidOrPartyHealthPriorityTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withCaster) +void Spell::FillRaidOrPartyHealthPriorityTargets(UnitList& targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withCaster) { FillRaidOrPartyTargets(targetUnitMap, member, center, radius, raid, withPets, withCaster); PrioritizeHealthUnitQueue healthQueue; - for(UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ++itr) + for (UnitList::const_iterator itr = targetUnitMap.begin(); itr != targetUnitMap.end(); ++itr) if (!(*itr)->isDead()) healthQueue.push(PrioritizeHealthUnitWraper(*itr)); targetUnitMap.clear(); - while(!healthQueue.empty() && targetUnitMap.size() < count) + while (!healthQueue.empty() && targetUnitMap.size() < count) { targetUnitMap.push_back(healthQueue.top().getUnit()); healthQueue.pop(); @@ -7514,7 +7514,7 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, SpellEntry const* parentSpel if (skillval >= 225 && (spellId300 > 0 || spellId225 > 0)) { uint32 spellid = skillval >= 300 ? spellId300 : spellId225; - SpellEntry const *pSpell = sSpellStore.LookupEntry(spellid); + SpellEntry const* pSpell = sSpellStore.LookupEntry(spellid); if (!pSpell) { sLog.outError("SelectMountByAreaAndSkill: unknown spell id %i by caster: %s", spellid, target->GetGuidStr().c_str()); @@ -7534,10 +7534,10 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, SpellEntry const* parentSpel { if (iter->second.state != PLAYERSPELL_REMOVED) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(iter->first); - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + SpellEntry const* spellInfo = sSpellStore.LookupEntry(iter->first); + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { - if(spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED) + if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED) { int32 mountSpeed = spellInfo->CalculateSimpleValue(SpellEffectIndex(i)); diff --git a/src/game/Spell.h b/src/game/Spell.h index afd8a3513..703fe0d33 100644 --- a/src/game/Spell.h +++ b/src/game/Spell.h @@ -107,12 +107,12 @@ class SpellCastTargets SpellCastTargets(); ~SpellCastTargets(); - void read( ByteBuffer& data, Unit *caster ); - void write( ByteBuffer& data ) const; + void read(ByteBuffer& data, Unit* caster); + void write(ByteBuffer& data) const; SpellCastTargetsReader ReadForCaster(Unit* caster) { return SpellCastTargetsReader(*this,caster); } - SpellCastTargets& operator=(const SpellCastTargets &target) + SpellCastTargets& operator=(const SpellCastTargets& target) { m_unitTarget = target.m_unitTarget; m_itemTarget = target.m_itemTarget; @@ -143,14 +143,14 @@ class SpellCastTargets } ObjectGuid getUnitTargetGuid() const { return m_unitTargetGUID; } - Unit *getUnitTarget() const { return m_unitTarget; } - void setUnitTarget(Unit *target); + Unit* getUnitTarget() const { return m_unitTarget; } + void setUnitTarget(Unit* target); void setDestination(float x, float y, float z); void setSource(float x, float y, float z); ObjectGuid getGOTargetGuid() const { return m_GOTargetGUID; } - GameObject *getGOTarget() const { return m_GOTarget; } - void setGOTarget(GameObject *target); + GameObject* getGOTarget() const { return m_GOTarget; } + void setGOTarget(GameObject* target); ObjectGuid getCorpseTargetGuid() const { return m_CorpseTargetGUID; } void setCorpseTarget(Corpse* corpse); @@ -162,7 +162,7 @@ class SpellCastTargets void setTradeItemTarget(Player* caster); void updateTradeSlotItem() { - if(m_itemTarget && (m_targetMask & TARGET_FLAG_TRADE_ITEM)) + if (m_itemTarget && (m_targetMask & TARGET_FLAG_TRADE_ITEM)) { m_itemTargetGUID = m_itemTarget->GetObjectGuid(); m_itemTargetEntry = m_itemTarget->GetEntry(); @@ -180,9 +180,9 @@ class SpellCastTargets uint32 m_targetMask; private: // objects (can be used at spell creating and after Update at casting - Unit *m_unitTarget; - GameObject *m_GOTarget; - Item *m_itemTarget; + Unit* m_unitTarget; + GameObject* m_GOTarget; + Item* m_itemTarget; // object GUID/etc, can be used always ObjectGuid m_unitTargetGUID; @@ -228,9 +228,9 @@ typedef std::multimap SpellTargetTimeMap; class Spell { - friend struct MaNGOS::SpellNotifierPlayer; - friend struct MaNGOS::SpellNotifierCreatureAndPlayer; - friend void Unit::SetCurrentCastedSpell( Spell * pSpell ); + friend struct MaNGOS::SpellNotifierPlayer; + friend struct MaNGOS::SpellNotifierCreatureAndPlayer; + friend void Unit::SetCurrentCastedSpell(Spell* pSpell); public: void EffectEmpty(SpellEffectIndex eff_idx); @@ -322,7 +322,7 @@ class Spell void EffectDispelMechanic(SpellEffectIndex eff_idx); void EffectSummonDeadPet(SpellEffectIndex eff_idx); void EffectSummonAllTotems(SpellEffectIndex eff_idx); - void EffectBreakPlayerTargeting (SpellEffectIndex eff_idx); + void EffectBreakPlayerTargeting(SpellEffectIndex eff_idx); void EffectDestroyAllTotems(SpellEffectIndex eff_idx); void EffectDurabilityDamage(SpellEffectIndex eff_idx); void EffectSkill(SpellEffectIndex eff_idx); @@ -353,7 +353,7 @@ class Spell void EffectActivateSpec(SpellEffectIndex eff_idx); void EffectCancelAura(SpellEffectIndex eff_idx); - Spell(Unit* caster, SpellEntry const *info, bool triggered, ObjectGuid originalCasterGUID = ObjectGuid(), SpellEntry const* triggeredBy = NULL); + Spell(Unit* caster, SpellEntry const* info, bool triggered, ObjectGuid originalCasterGUID = ObjectGuid(), SpellEntry const* triggeredBy = NULL); ~Spell(); void prepare(SpellCastTargets const* targets, Aura* triggeredByAura = NULL); @@ -399,16 +399,16 @@ class Spell typedef std::list UnitList; void FillTargetMap(); - void SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList &targetUnitMap); + void SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& targetUnitMap); - void FillAreaTargets(UnitList &targetUnitMap, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster = NULL); - void FillRaidOrPartyTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster); - void FillRaidOrPartyManaPriorityTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster); - void FillRaidOrPartyHealthPriorityTargets(UnitList &targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster); + void FillAreaTargets(UnitList& targetUnitMap, float radius, SpellNotifyPushType pushType, SpellTargets spellTargets, WorldObject* originalCaster = NULL); + void FillRaidOrPartyTargets(UnitList& targetUnitMap, Unit* member, Unit* center, float radius, bool raid, bool withPets, bool withcaster); + void FillRaidOrPartyManaPriorityTargets(UnitList& targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster); + void FillRaidOrPartyHealthPriorityTargets(UnitList& targetUnitMap, Unit* member, Unit* center, float radius, uint32 count, bool raid, bool withPets, bool withcaster); template WorldObject* FindCorpseUsing(); - bool CheckTarget( Unit* target, SpellEffectIndex eff ); + bool CheckTarget(Unit* target, SpellEffectIndex eff); bool CanAutoCast(Unit* target); static void MANGOS_DLL_SPEC SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 cast_count, SpellCastResult result); @@ -423,7 +423,7 @@ class Spell void SendResurrectRequest(Player* target); void SendPlaySpellVisual(uint32 SpellID); - void HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,SpellEffectIndex i, float DamageMultiplier = 1.0); + void HandleEffects(Unit* pUnitTarget,Item* pItemTarget,GameObject* pGOTarget,SpellEffectIndex i, float DamageMultiplier = 1.0); void HandleThreatSpells(); //void HandleAddAura(Unit* Target); @@ -504,7 +504,7 @@ class Spell Unit* m_caster; ObjectGuid m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection - // e.g. damage around area spell trigered by victim aura and da,age emeies of aura caster + // e.g. damage around area spell trigered by victim aura and da,age emeies of aura caster Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers() Spell** m_selfContainer; // pointer to our spell container (if applicable) @@ -523,7 +523,7 @@ class Spell uint8 m_delayAtDamageCount; bool isDelayableNoMore() { - if(m_delayAtDamageCount >= 2) + if (m_delayAtDamageCount >= 2) return true; m_delayAtDamageCount++; @@ -597,7 +597,7 @@ class Spell struct ItemTargetInfo { - Item *item; + Item* item; uint8 effectMask; }; @@ -614,13 +614,13 @@ class Spell void AddGOTarget(GameObject* target, SpellEffectIndex effIndex); void AddGOTarget(ObjectGuid goGuid, SpellEffectIndex effIndex); void AddItemTarget(Item* target, SpellEffectIndex effIndex); - void DoAllEffectOnTarget(TargetInfo *target); - void HandleDelayedSpellLaunch(TargetInfo *target); + void DoAllEffectOnTarget(TargetInfo* target); + void HandleDelayedSpellLaunch(TargetInfo* target); void InitializeDamageMultipliers(); void ResetEffectDamageAndHeal(); - void DoSpellHitOnUnit(Unit *unit, uint32 effectMask); - void DoAllEffectOnTarget(GOTargetInfo *target); - void DoAllEffectOnTarget(ItemTargetInfo *target); + void DoSpellHitOnUnit(Unit* unit, uint32 effectMask); + void DoAllEffectOnTarget(GOTargetInfo* target); + void DoAllEffectOnTarget(ItemTargetInfo* target); bool IsAliveUnitPresentInTargetList(); SpellCastResult CanOpenLock(SpellEffectIndex effIndex, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue); // ------------------------------------------- @@ -679,43 +679,43 @@ namespace MaNGOS { struct MANGOS_DLL_DECL SpellNotifierPlayer // Currently unused. When put to use this one requires handling for source-location (smilar to below) { - Spell::UnitList &i_data; - Spell &i_spell; + Spell::UnitList& i_data; + Spell& i_spell; const uint32& i_index; float i_radius; WorldObject* i_originalCaster; - SpellNotifierPlayer(Spell &spell, Spell::UnitList &data, const uint32 &i, float radius) + SpellNotifierPlayer(Spell& spell, Spell::UnitList& data, const uint32& i, float radius) : i_data(data), i_spell(spell), i_index(i), i_radius(radius) { i_originalCaster = i_spell.GetAffectiveCasterObject(); } - void Visit(PlayerMapType &m) + void Visit(PlayerMapType& m) { - if(!i_originalCaster) + if (!i_originalCaster) return; - for(PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) + for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr) { - Player * pPlayer = itr->getSource(); - if( !pPlayer->isAlive() || pPlayer->IsTaxiFlying()) + Player* pPlayer = itr->getSource(); + if (!pPlayer->isAlive() || pPlayer->IsTaxiFlying()) continue; - if( i_originalCaster->IsFriendlyTo(pPlayer) ) + if (i_originalCaster->IsFriendlyTo(pPlayer)) continue; - if( pPlayer->IsWithinDist3d(i_spell.m_targets.m_destX, i_spell.m_targets.m_destY, i_spell.m_targets.m_destZ,i_radius)) + if (pPlayer->IsWithinDist3d(i_spell.m_targets.m_destX, i_spell.m_targets.m_destY, i_spell.m_targets.m_destZ,i_radius)) i_data.push_back(pPlayer); } } - template void Visit(GridRefManager &) {} + template void Visit(GridRefManager&) {} }; struct MANGOS_DLL_DECL SpellNotifierCreatureAndPlayer { - Spell::UnitList *i_data; - Spell &i_spell; + Spell::UnitList* i_data; + Spell& i_spell; SpellNotifyPushType i_push_type; float i_radius; SpellTargets i_TargetType; @@ -729,16 +729,16 @@ namespace MaNGOS float GetCenterX() const { return i_centerX; } float GetCenterY() const { return i_centerY; } - SpellNotifierCreatureAndPlayer(Spell &spell, Spell::UnitList &data, float radius, SpellNotifyPushType type, - SpellTargets TargetType = SPELL_TARGETS_NOT_FRIENDLY, WorldObject* originalCaster = NULL) + SpellNotifierCreatureAndPlayer(Spell& spell, Spell::UnitList& data, float radius, SpellNotifyPushType type, + SpellTargets TargetType = SPELL_TARGETS_NOT_FRIENDLY, WorldObject* originalCaster = NULL) : i_data(&data), i_spell(spell), i_push_type(type), i_radius(radius), i_TargetType(TargetType), - i_originalCaster(originalCaster), i_castingObject(i_spell.GetCastingObject()) + i_originalCaster(originalCaster), i_castingObject(i_spell.GetCastingObject()) { if (!i_originalCaster) i_originalCaster = i_spell.GetAffectiveCasterObject(); i_playerControlled = i_originalCaster ? i_originalCaster->IsControlledByPlayer() : false; - switch(i_push_type) + switch (i_push_type) { case PUSH_IN_FRONT: case PUSH_IN_FRONT_90: @@ -778,38 +778,38 @@ namespace MaNGOS } } - template inline void Visit(GridRefManager &m) + template inline void Visit(GridRefManager& m) { MANGOS_ASSERT(i_data); if (!i_originalCaster || !i_castingObject) return; - for(typename GridRefManager::iterator itr = m.begin(); itr != m.end(); ++itr) + for (typename GridRefManager::iterator itr = m.begin(); itr != m.end(); ++itr) { // there are still more spells which can be casted on dead, but // they are no AOE and don't have such a nice SPELL_ATTR flag if ((i_TargetType != SPELL_TARGETS_ALL && !itr->getSource()->isTargetableForAttack(i_spell.m_spellInfo->HasAttribute(SPELL_ATTR_EX3_CAST_ON_DEAD))) - // mostly phase check - || !itr->getSource()->IsInMap(i_originalCaster)) + // mostly phase check + || !itr->getSource()->IsInMap(i_originalCaster)) continue; switch (i_TargetType) { case SPELL_TARGETS_HOSTILE: - if (!i_originalCaster->IsHostileTo( itr->getSource() )) + if (!i_originalCaster->IsHostileTo(itr->getSource())) continue; break; case SPELL_TARGETS_NOT_FRIENDLY: - if (i_originalCaster->IsFriendlyTo( itr->getSource() )) + if (i_originalCaster->IsFriendlyTo(itr->getSource())) continue; break; case SPELL_TARGETS_NOT_HOSTILE: - if (i_originalCaster->IsHostileTo( itr->getSource() )) + if (i_originalCaster->IsHostileTo(itr->getSource())) continue; break; case SPELL_TARGETS_FRIENDLY: - if (!i_originalCaster->IsFriendlyTo( itr->getSource() )) + if (!i_originalCaster->IsFriendlyTo(itr->getSource())) continue; break; case SPELL_TARGETS_AOE_DAMAGE: @@ -819,12 +819,12 @@ namespace MaNGOS if (i_playerControlled) { - if (i_originalCaster->IsFriendlyTo( itr->getSource() )) + if (i_originalCaster->IsFriendlyTo(itr->getSource())) continue; } else { - if (!i_originalCaster->IsHostileTo( itr->getSource() )) + if (!i_originalCaster->IsHostileTo(itr->getSource())) continue; } } @@ -835,26 +835,26 @@ namespace MaNGOS } // we don't need to check InMap here, it's already done some lines above - switch(i_push_type) + switch (i_push_type) { case PUSH_IN_FRONT: - if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, 2*M_PI_F/3 )) + if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, 2*M_PI_F/3)) i_data->push_back(itr->getSource()); break; case PUSH_IN_FRONT_90: - if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F/2 )) + if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F/2)) i_data->push_back(itr->getSource()); break; case PUSH_IN_FRONT_30: - if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F/6 )) + if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F/6)) i_data->push_back(itr->getSource()); break; case PUSH_IN_FRONT_15: - if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F/12 )) + if (i_castingObject->isInFront((Unit*)(itr->getSource()), i_radius, M_PI_F/12)) i_data->push_back(itr->getSource()); break; case PUSH_IN_BACK: - if (i_castingObject->isInBack((Unit*)(itr->getSource()), i_radius, 2*M_PI_F/3 )) + if (i_castingObject->isInBack((Unit*)(itr->getSource()), i_radius, 2*M_PI_F/3)) i_data->push_back(itr->getSource()); break; case PUSH_SELF_CENTER: @@ -873,20 +873,20 @@ namespace MaNGOS } } - #ifdef WIN32 - template<> inline void Visit(CorpseMapType & ) {} - template<> inline void Visit(GameObjectMapType & ) {} - template<> inline void Visit(DynamicObjectMapType & ) {} - template<> inline void Visit(CameraMapType & ) {} - #endif +#ifdef WIN32 + template<> inline void Visit(CorpseMapType&) {} + template<> inline void Visit(GameObjectMapType&) {} + template<> inline void Visit(DynamicObjectMapType&) {} + template<> inline void Visit(CameraMapType&) {} +#endif }; - #ifndef WIN32 - template<> inline void SpellNotifierCreatureAndPlayer::Visit(CorpseMapType& ) {} - template<> inline void SpellNotifierCreatureAndPlayer::Visit(GameObjectMapType& ) {} - template<> inline void SpellNotifierCreatureAndPlayer::Visit(DynamicObjectMapType& ) {} - template<> inline void SpellNotifierCreatureAndPlayer::Visit(CameraMapType& ) {} - #endif +#ifndef WIN32 + template<> inline void SpellNotifierCreatureAndPlayer::Visit(CorpseMapType&) {} + template<> inline void SpellNotifierCreatureAndPlayer::Visit(GameObjectMapType&) {} + template<> inline void SpellNotifierCreatureAndPlayer::Visit(DynamicObjectMapType&) {} + template<> inline void SpellNotifierCreatureAndPlayer::Visit(CameraMapType&) {} +#endif } typedef void(Spell::*pEffect)(SpellEffectIndex eff_idx); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index ee28bd337..e032f4ba3 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -372,13 +372,13 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= static AuraType const frozenAuraTypes[] = { SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_NONE }; -Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem) : -m_periodicTimer(0), m_periodicTick(0), m_removeMode(AURA_REMOVE_BY_DEFAULT), -m_effIndex(eff), m_positive(false), m_isPeriodic(false), m_isAreaAura(false), -m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder) +Aura::Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster, Item* castItem) : + m_periodicTimer(0), m_periodicTick(0), m_removeMode(AURA_REMOVE_BY_DEFAULT), + m_effIndex(eff), m_positive(false), m_isPeriodic(false), m_isAreaAura(false), + m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder) { MANGOS_ASSERT(target); - MANGOS_ASSERT(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element"); + MANGOS_ASSERT(spellproto && spellproto == sSpellStore.LookupEntry(spellproto->Id) && "`info` must be pointer to sSpellStore element"); m_currentBasePoints = currentBasePoints ? *currentBasePoints : spellproto->CalculateSimpleValue(eff); @@ -394,20 +394,20 @@ m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder) if (!damage && castItem && castItem->GetItemSuffixFactor()) { - ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId())); if (item_rand_suffix) { for (int k = 0; k < 3; ++k) { - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]); if (pEnchant) { for (int t = 0; t < 3; ++t) { - if(pEnchant->spellid[t] != spellproto->Id) + if (pEnchant->spellid[t] != spellproto->Id) continue; - damage = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000 ); + damage = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000); break; } } @@ -440,8 +440,8 @@ Aura::~Aura() { } -AreaAura::AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, -Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem) +AreaAura::AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, + Unit* caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem) { m_isAreaAura = true; @@ -449,10 +449,10 @@ Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, Unit* caster_ptr = caster ? caster : target; m_radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(spellproto->EffectRadiusIndex[m_effIndex])); - if(Player* modOwner = caster_ptr->GetSpellModOwner()) + if (Player* modOwner = caster_ptr->GetSpellModOwner()) modOwner->ApplySpellMod(spellproto->Id, SPELLMOD_RADIUS, m_radius); - switch(spellproto->Effect[eff]) + switch (spellproto->Effect[eff]) { case SPELL_EFFECT_APPLY_AREA_AURA_PARTY: m_areaAuraType = AREA_AURA_PARTY; @@ -494,8 +494,8 @@ AreaAura::~AreaAura() { } -PersistentAreaAura::PersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, -Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem) +PersistentAreaAura::PersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, + Unit* caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem) { m_isPersistent = true; } @@ -504,8 +504,8 @@ PersistentAreaAura::~PersistentAreaAura() { } -SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, -Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem) +SingleEnemyTargetAura::SingleEnemyTargetAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, + Unit* caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem) { if (caster) m_castersTargetGuid = caster->GetTypeId()==TYPEID_PLAYER ? ((Player*)caster)->GetSelectionGuid() : caster->GetTargetGuid(); @@ -520,14 +520,14 @@ Unit* SingleEnemyTargetAura::GetTriggerTarget() const return ObjectAccessor::GetUnit(*(m_spellAuraHolder->GetTarget()), m_castersTargetGuid); } -Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem) +Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster, Item* castItem) { if (IsAreaAuraEffect(spellproto->Effect[eff])) return new AreaAura(spellproto, eff, currentBasePoints, holder, target, caster, castItem); uint32 triggeredSpellId = spellproto->EffectTriggerSpell[eff]; - if(SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId)) + if (SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId)) for (int i = 0; i < MAX_EFFECT_INDEX; ++i) if (triggeredSpellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_ENEMY) return new SingleEnemyTargetAura(spellproto, eff, currentBasePoints, holder, target, caster, castItem); @@ -535,7 +535,7 @@ Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *curr return new Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem); } -SpellAuraHolder* CreateSpellAuraHolder(SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem) +SpellAuraHolder* CreateSpellAuraHolder(SpellEntry const* spellproto, Unit* target, WorldObject* caster, Item* castItem) { return new SpellAuraHolder(spellproto, target, caster, castItem); } @@ -553,7 +553,7 @@ void Aura::Update(uint32 diff) if (m_isPeriodic) { m_periodicTimer -= diff; - if(m_periodicTimer <= 0) // tick also at m_periodicTimer==0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N + if (m_periodicTimer <= 0) // tick also at m_periodicTimer==0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N { // update before applying (aura can be removed in TriggerSpell or PeriodicTick calls) m_periodicTimer += m_modifier.periodictime; @@ -566,38 +566,38 @@ void Aura::Update(uint32 diff) void AreaAura::Update(uint32 diff) { // update for the caster of the aura - if(GetCasterGuid() == GetTarget()->GetObjectGuid()) + if (GetCasterGuid() == GetTarget()->GetObjectGuid()) { Unit* caster = GetTarget(); - if( !caster->hasUnitState(UNIT_STAT_ISOLATED) ) + if (!caster->hasUnitState(UNIT_STAT_ISOLATED)) { Unit* owner = caster->GetCharmerOrOwner(); if (!owner) owner = caster; Spell::UnitList targets; - switch(m_areaAuraType) + switch (m_areaAuraType) { case AREA_AURA_PARTY: { - Group *pGroup = NULL; + Group* pGroup = NULL; if (owner->GetTypeId() == TYPEID_PLAYER) pGroup = ((Player*)owner)->GetGroup(); - if( pGroup) + if (pGroup) { uint8 subgroup = ((Player*)owner)->GetSubGroup(); - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); - if(Target && Target->isAlive() && Target->GetSubGroup()==subgroup && caster->IsFriendlyTo(Target)) + if (Target && Target->isAlive() && Target->GetSubGroup()==subgroup && caster->IsFriendlyTo(Target)) { - if(caster->IsWithinDistInMap(Target, m_radius)) + if (caster->IsWithinDistInMap(Target, m_radius)) targets.push_back(Target); - Pet *pet = Target->GetPet(); - if(pet && pet->isAlive() && caster->IsWithinDistInMap(pet, m_radius)) + Pet* pet = Target->GetPet(); + if (pet && pet->isAlive() && caster->IsWithinDistInMap(pet, m_radius)) targets.push_back(pet); } } @@ -605,33 +605,33 @@ void AreaAura::Update(uint32 diff) else { // add owner - if( owner != caster && caster->IsWithinDistInMap(owner, m_radius) ) + if (owner != caster && caster->IsWithinDistInMap(owner, m_radius)) targets.push_back(owner); // add caster's pet Unit* pet = caster->GetPet(); - if( pet && caster->IsWithinDistInMap(pet, m_radius)) + if (pet && caster->IsWithinDistInMap(pet, m_radius)) targets.push_back(pet); } break; } case AREA_AURA_RAID: { - Group *pGroup = NULL; + Group* pGroup = NULL; if (owner->GetTypeId() == TYPEID_PLAYER) pGroup = ((Player*)owner)->GetGroup(); - if( pGroup) + if (pGroup) { - for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); - if(Target && Target->isAlive() && caster->IsFriendlyTo(Target)) + if (Target && Target->isAlive() && caster->IsFriendlyTo(Target)) { - if(caster->IsWithinDistInMap(Target, m_radius)) + if (caster->IsWithinDistInMap(Target, m_radius)) targets.push_back(Target); - Pet *pet = Target->GetPet(); - if(pet && pet->isAlive() && caster->IsWithinDistInMap(pet, m_radius)) + Pet* pet = Target->GetPet(); + if (pet && pet->isAlive() && caster->IsWithinDistInMap(pet, m_radius)) targets.push_back(pet); } } @@ -639,11 +639,11 @@ void AreaAura::Update(uint32 diff) else { // add owner - if( owner != caster && caster->IsWithinDistInMap(owner, m_radius) ) + if (owner != caster && caster->IsWithinDistInMap(owner, m_radius)) targets.push_back(owner); // add caster's pet Unit* pet = caster->GetPet(); - if( pet && caster->IsWithinDistInMap(pet, m_radius)) + if (pet && caster->IsWithinDistInMap(pet, m_radius)) targets.push_back(pet); } break; @@ -665,13 +665,13 @@ void AreaAura::Update(uint32 diff) case AREA_AURA_OWNER: case AREA_AURA_PET: { - if(owner != caster && caster->IsWithinDistInMap(owner, m_radius)) + if (owner != caster && caster->IsWithinDistInMap(owner, m_radius)) targets.push_back(owner); break; } } - for(Spell::UnitList::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) + for (Spell::UnitList::iterator tIter = targets.begin(); tIter != targets.end(); ++tIter) { // flag for seelction is need apply aura to current iteration target bool apply = true; @@ -679,26 +679,26 @@ void AreaAura::Update(uint32 diff) // we need ignore present caster self applied are auras sometime // in cases if this only auras applied for spell effect Unit::SpellAuraHolderBounds spair = (*tIter)->GetSpellAuraHolderBounds(GetId()); - for(Unit::SpellAuraHolderMap::const_iterator i = spair.first; i != spair.second; ++i) + for (Unit::SpellAuraHolderMap::const_iterator i = spair.first; i != spair.second; ++i) { if (i->second->IsDeleted()) continue; - Aura *aur = i->second->GetAuraByEffectIndex(m_effIndex); + Aura* aur = i->second->GetAuraByEffectIndex(m_effIndex); if (!aur) continue; - switch(m_areaAuraType) + switch (m_areaAuraType) { case AREA_AURA_ENEMY: // non caster self-casted auras (non stacked) - if(aur->GetModifier()->m_auraname != SPELL_AURA_NONE) + if (aur->GetModifier()->m_auraname != SPELL_AURA_NONE) apply = false; break; case AREA_AURA_RAID: // non caster self-casted auras (stacked from diff. casters) - if(aur->GetModifier()->m_auraname != SPELL_AURA_NONE || i->second->GetCasterGuid() == GetCasterGuid()) + if (aur->GetModifier()->m_auraname != SPELL_AURA_NONE || i->second->GetCasterGuid() == GetCasterGuid()) apply = false; break; default: @@ -707,21 +707,21 @@ void AreaAura::Update(uint32 diff) break; } - if(!apply) + if (!apply) break; } - if(!apply) + if (!apply) continue; - if(SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(GetSpellProto(), (*tIter)->getLevel())) + if (SpellEntry const* actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(GetSpellProto(), (*tIter)->getLevel())) { int32 actualBasePoints = m_currentBasePoints; // recalculate basepoints for lower rank (all AreaAura spell not use custom basepoints?) - if(actualSpellInfo != GetSpellProto()) + if (actualSpellInfo != GetSpellProto()) actualBasePoints = actualSpellInfo->CalculateSimpleValue(m_effIndex); - SpellAuraHolder *holder = (*tIter)->GetSpellAuraHolder(actualSpellInfo->Id, GetCasterGuid()); + SpellAuraHolder* holder = (*tIter)->GetSpellAuraHolder(actualSpellInfo->Id, GetCasterGuid()); bool addedToExisting = true; if (!holder) @@ -732,7 +732,7 @@ void AreaAura::Update(uint32 diff) holder->SetAuraDuration(GetAuraDuration()); - AreaAura *aur = new AreaAura(actualSpellInfo, m_effIndex, &actualBasePoints, holder, (*tIter), caster, NULL); + AreaAura* aur = new AreaAura(actualSpellInfo, m_effIndex, &actualBasePoints, holder, (*tIter), caster, NULL); holder->AddAura(aur, m_effIndex); if (addedToExisting) @@ -760,44 +760,44 @@ void AreaAura::Update(uint32 diff) // or caster is isolated or caster no longer has the aura // or caster is (no longer) friendly bool needFriendly = (m_areaAuraType == AREA_AURA_ENEMY ? false : true); - if( !caster || caster->hasUnitState(UNIT_STAT_ISOLATED) || - !caster->IsWithinDistInMap(target, m_radius) || - !caster->HasAura(GetId(), GetEffIndex()) || - caster->IsFriendlyTo(target) != needFriendly + if (!caster || caster->hasUnitState(UNIT_STAT_ISOLATED) || + !caster->IsWithinDistInMap(target, m_radius) || + !caster->HasAura(GetId(), GetEffIndex()) || + caster->IsFriendlyTo(target) != needFriendly ) { target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGuid()); } - else if( m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group + else if (m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group { // not check group if target == owner or target == pet if (caster->GetCharmerOrOwnerGuid() != target->GetObjectGuid() && caster->GetObjectGuid() != target->GetCharmerOrOwnerGuid()) { Player* check = caster->GetCharmerOrOwnerPlayerOrPlayerItself(); - Group *pGroup = check ? check->GetGroup() : NULL; - if( pGroup ) + Group* pGroup = check ? check->GetGroup() : NULL; + if (pGroup) { Player* checkTarget = target->GetCharmerOrOwnerPlayerOrPlayerItself(); - if(!checkTarget || !pGroup->SameSubGroup(check, checkTarget)) + if (!checkTarget || !pGroup->SameSubGroup(check, checkTarget)) target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGuid()); } else target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGuid()); } } - else if( m_areaAuraType == AREA_AURA_RAID) // TODO: fix me! + else if (m_areaAuraType == AREA_AURA_RAID) // TODO: fix me! { // not check group if target == owner or target == pet if (caster->GetCharmerOrOwnerGuid() != target->GetObjectGuid() && caster->GetObjectGuid() != target->GetCharmerOrOwnerGuid()) { Player* check = caster->GetCharmerOrOwnerPlayerOrPlayerItself(); - Group *pGroup = check ? check->GetGroup() : NULL; - if( pGroup ) + Group* pGroup = check ? check->GetGroup() : NULL; + if (pGroup) { Player* checkTarget = target->GetCharmerOrOwnerPlayerOrPlayerItself(); - if(!checkTarget) + if (!checkTarget) target->RemoveSingleAuraFromSpellAuraHolder(GetId(), GetEffIndex(), GetCasterGuid()); } else @@ -818,9 +818,9 @@ void PersistentAreaAura::Update(uint32 diff) // remove the aura if its caster or the dynamic object causing it was removed // or if the target moves too far from the dynamic object - if(Unit *caster = GetCaster()) + if (Unit* caster = GetCaster()) { - DynamicObject *dynObj = caster->GetDynObject(GetId(), GetEffIndex()); + DynamicObject* dynObj = caster->GetDynObject(GetId(), GetEffIndex()); if (dynObj) { if (!GetTarget()->IsWithinDistInMap(dynObj, dynObj->GetRadius())) @@ -837,7 +837,7 @@ void PersistentAreaAura::Update(uint32 diff) Aura::Update(diff); - if(remove) + if (remove) GetTarget()->RemoveAura(GetId(), GetEffIndex()); } @@ -847,18 +847,18 @@ void Aura::ApplyModifier(bool apply, bool Real) GetHolder()->SetInUse(true); SetInUse(true); - if(aura < TOTAL_AURAS) + if (aura < TOTAL_AURAS) (*this.*AuraHandler [aura])(apply, Real); SetInUse(false); GetHolder()->SetInUse(false); } -bool Aura::isAffectedOnSpell(SpellEntry const *spell) const +bool Aura::isAffectedOnSpell(SpellEntry const* spell) const { return spell->IsFitToFamily(SpellFamily(GetSpellProto()->SpellFamilyName), GetAuraSpellClassMask()); } -bool Aura::CanProcFrom(SpellEntry const *spell, uint32 procFlag, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const +bool Aura::CanProcFrom(SpellEntry const* spell, uint32 procFlag, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const { // Check EffectClassMask ClassFamilyMask const& mask = GetAuraSpellClassMask(); @@ -884,7 +884,7 @@ bool Aura::CanProcFrom(SpellEntry const *spell, uint32 procFlag, uint32 EventPro if (EventProcEx == PROC_EX_NONE) { // No extra req, so can trigger only for active (damage/healing present) and hit/crit - if(((procEx & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && active) || procEx == PROC_EX_CAST_END) + if (((procEx & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && active) || procEx == PROC_EX_CAST_END) return true; else return false; @@ -906,7 +906,7 @@ bool Aura::CanProcFrom(SpellEntry const *spell, uint32 procFlag, uint32 EventPro } } -void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode ) +void Aura::ReapplyAffectedPassiveAuras(Unit* target, bool owner_mode) { // we need store cast item guids for self casted spells // expected that not exist permanent auras from stackable auras from different items @@ -914,15 +914,15 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode ) std::set affectedAuraCaster; - for(Unit::SpellAuraHolderMap::const_iterator itr = target->GetSpellAuraHolderMap().begin(); itr != target->GetSpellAuraHolderMap().end(); ++itr) + for (Unit::SpellAuraHolderMap::const_iterator itr = target->GetSpellAuraHolderMap().begin(); itr != target->GetSpellAuraHolderMap().end(); ++itr) { // permanent passive or permanent area aura // passive spells can be affected only by own or owner spell mods) if ((itr->second->IsPermanent() && (owner_mode && itr->second->IsPassive() || itr->second->IsAreaAura())) && - // non deleted and not same aura (any with same spell id) - !itr->second->IsDeleted() && itr->second->GetId() != GetId() && - // and affected by aura - isAffectedOnSpell(itr->second->GetSpellProto())) + // non deleted and not same aura (any with same spell id) + !itr->second->IsDeleted() && itr->second->GetId() != GetId() && + // and affected by aura + isAffectedOnSpell(itr->second->GetSpellProto())) { // only applied by self or aura caster if (itr->second->GetCasterGuid() == target->GetObjectGuid()) @@ -936,7 +936,7 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode ) { Player* pTarget = target->GetTypeId() == TYPEID_PLAYER ? (Player*)target : NULL; - for(std::map::const_iterator map_itr = affectedSelf.begin(); map_itr != affectedSelf.end(); ++map_itr) + for (std::map::const_iterator map_itr = affectedSelf.begin(); map_itr != affectedSelf.end(); ++map_itr) { Item* item = pTarget && map_itr->second ? pTarget->GetItemByGuid(map_itr->second) : NULL; target->RemoveAurasDueToSpell(map_itr->first); @@ -947,7 +947,7 @@ void Aura::ReapplyAffectedPassiveAuras( Unit* target, bool owner_mode ) if (!affectedAuraCaster.empty()) { Unit* caster = GetCaster(); - for(std::set::const_iterator set_itr = affectedAuraCaster.begin(); set_itr != affectedAuraCaster.end(); ++set_itr) + for (std::set::const_iterator set_itr = affectedAuraCaster.begin(); set_itr != affectedAuraCaster.end(); ++set_itr) { target->RemoveAurasDueToSpell(*set_itr); if (caster) @@ -991,7 +991,7 @@ void Aura::ReapplyAffectedPassiveAuras() // re-apply talents/passives/area auras applied to group members (it affected by player spellmods) if (Group* group = ((Player*)GetTarget())->GetGroup()) - for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* member = itr->getSource()) if (member != GetTarget() && member->IsInMap(GetTarget())) ReapplyAffectedPassiveAuras(member, false); @@ -1002,10 +1002,10 @@ void Aura::ReapplyAffectedPassiveAuras() /*********************************************************/ void Aura::HandleAddModifier(bool apply, bool Real) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER || !Real) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER || !Real) return; - if(m_modifier.m_miscvalue >= MAX_SPELLMOD) + if (m_modifier.m_miscvalue >= MAX_SPELLMOD) return; if (apply) @@ -1035,7 +1035,7 @@ void Aura::HandleAddModifier(bool apply, bool Real) { // Corruption and Unstable Affliction // TODO: drop when override will be possible - SpellEntry *entry = const_cast(spellProto); + SpellEntry* entry = const_cast(spellProto); entry->EffectSpellClassMask[GetEffIndex()].Flags = UI64LIT(0x0000010000000002); } // Improved Flametongue Weapon, overwrite wrong data, maybe time re-add table @@ -1043,7 +1043,7 @@ void Aura::HandleAddModifier(bool apply, bool Real) { // Flametongue Weapon (Passive) // TODO: drop when override will be possible - SpellEntry *entry = const_cast(spellProto); + SpellEntry* entry = const_cast(spellProto); entry->EffectSpellClassMask[GetEffIndex()].Flags = UI64LIT(0x0000000000200000); } } @@ -1074,11 +1074,11 @@ void Aura::TriggerSpell() // specific code for cases with no trigger spell provided in field if (triggeredSpellInfo == NULL) { - switch(auraSpellInfo->SpellFamilyName) + switch (auraSpellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(auraId) + switch (auraId) { case 812: // Periodic Mana Burn { @@ -1202,7 +1202,7 @@ void Aura::TriggerSpell() return; ThreatList const& tList = target->getThreatManager().getThreatList(); - for (ThreatList::const_iterator itr = tList.begin();itr != tList.end(); ++itr) + for (ThreatList::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { Unit* pUnit = target->GetMap()->GetUnit((*itr)->getUnitGuid()); @@ -1221,13 +1221,13 @@ void Aura::TriggerSpell() { uint32 spellForTick[8] = { 24820, 24821, 24822, 24823, 24835, 24836, 24837, 24838 }; uint32 tick = GetAuraTicks(); - if(tick < 8) + if (tick < 8) { trigger_spell_id = spellForTick[tick]; // casted in left/right (but triggered spell have wide forward cone) float forward = target->GetOrientation(); - float angle = target->GetOrientation() + ( tick % 2 == 0 ? M_PI_F / 2 : - M_PI_F / 2); + float angle = target->GetOrientation() + (tick % 2 == 0 ? M_PI_F / 2 : - M_PI_F / 2); target->SetOrientation(angle); triggerTarget->CastSpell(triggerTarget, trigger_spell_id, true, NULL, this, casterGUID); target->SetOrientation(forward); @@ -1362,8 +1362,8 @@ void Aura::TriggerSpell() return; // move loot to player inventory and despawn target if (caster->GetTypeId() ==TYPEID_PLAYER && - triggerTarget->GetTypeId() == TYPEID_UNIT && - ((Creature*)triggerTarget)->GetCreatureInfo()->type == CREATURE_TYPE_GAS_CLOUD) + triggerTarget->GetTypeId() == TYPEID_UNIT && + ((Creature*)triggerTarget)->GetCreatureInfo()->type == CREATURE_TYPE_GAS_CLOUD) { Player* player = (Player*)caster; Creature* creature = (Creature*)triggerTarget; @@ -1426,9 +1426,9 @@ void Aura::TriggerSpell() case 34229: // Flame Quills { // cast 24 spells 34269-34289, 34314-34316 - for(uint32 spell_id = 34269; spell_id != 34290; ++spell_id) + for (uint32 spell_id = 34269; spell_id != 34290; ++spell_id) triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID); - for(uint32 spell_id = 34314; spell_id != 34317; ++spell_id) + for (uint32 spell_id = 34314; spell_id != 34317; ++spell_id) triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID); return; } @@ -1711,7 +1711,7 @@ void Aura::TriggerSpell() } case SPELLFAMILY_MAGE: { - switch(auraId) + switch (auraId) { case 66: // Invisibility // Here need periodic trigger reducing threat spell (or do it manually) @@ -1772,7 +1772,7 @@ void Aura::TriggerSpell() } // select rank of buff - switch(auraId) + switch (auraId) { case 53302: trigger_spell_id = 64418; break; case 53303: trigger_spell_id = 64419; break; @@ -1791,7 +1791,7 @@ void Aura::TriggerSpell() } case SPELLFAMILY_DRUID: { - switch(auraId) + switch (auraId) { case 768: // Cat Form // trigger_spell_id not set and unknown effect triggered in this case, ignoring for while @@ -1854,17 +1854,17 @@ void Aura::TriggerSpell() // } case SPELLFAMILY_SHAMAN: { - switch(auraId) + switch (auraId) { case 28820: // Lightning Shield (The Earthshatterer set trigger after cast Lighting Shield) { // Need remove self if Lightning Shield not active Unit::SpellAuraHolderMap const& auras = triggerTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { SpellEntry const* spell = itr->second->GetSpellProto(); if (spell->SpellFamilyName == SPELLFAMILY_SHAMAN && - (spell->SpellFamilyFlags & UI64LIT(0x0000000000000400))) + (spell->SpellFamilyFlags & UI64LIT(0x0000000000000400))) return; } triggerTarget->RemoveAurasDueToSpell(28820); @@ -1921,7 +1921,7 @@ void Aura::TriggerSpell() } // Spell exist but require custom code - switch(auraId) + switch (auraId) { case 9347: // Mortal Strike { @@ -1951,11 +1951,11 @@ void Aura::TriggerSpell() int32 spiritLoss = 0; Unit::AuraList const& mModStat = triggerTarget->GetAurasByType(SPELL_AURA_MOD_STAT); - for(Unit::AuraList::const_iterator i = mModStat.begin(); i != mModStat.end(); ++i) + for (Unit::AuraList::const_iterator i = mModStat.begin(); i != mModStat.end(); ++i) { if ((*i)->GetId() == 1010) { - switch((*i)->GetModifier()->m_miscvalue) + switch ((*i)->GetModifier()->m_miscvalue) { case STAT_INTELLECT: intelectLoss += (*i)->GetModifier()->m_amount; break; case STAT_SPIRIT: spiritLoss += (*i)->GetModifier()->m_amount; break; @@ -2008,7 +2008,7 @@ void Aura::TriggerSpell() { if (triggerTargetObject) triggerCaster->CastSpell(triggerTargetObject->GetPositionX(), triggerTargetObject->GetPositionY(), triggerTargetObject->GetPositionZ(), - triggeredSpellInfo, true, NULL, this, casterGUID); + triggeredSpellInfo, true, NULL, this, casterGUID); else triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, NULL, this, casterGUID); } @@ -2047,16 +2047,16 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); // AT APPLY if (apply) { - switch(GetSpellProto()->SpellFamilyName) + switch (GetSpellProto()->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(GetId()) + switch (GetId()) { case 1515: // Tame beast // FIX_ME: this is 2.0.12 threat effect replaced in 2.1.x by dummy aura, must be checked for correctness @@ -2113,7 +2113,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } case 31606: // Stormcrow Amulet { - CreatureInfo const * cInfo = ObjectMgr::GetCreatureTemplate(17970); + CreatureInfo const* cInfo = ObjectMgr::GetCreatureTemplate(17970); // we must assume db or script set display id to native at ending flight (if not, target is stuck with this model) if (cInfo) @@ -2246,7 +2246,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } case SPELLFAMILY_WARRIOR: { - switch(GetId()) + switch (GetId()) { case 41099: // Battle Stance { @@ -2364,7 +2364,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; Unit::AuraList const& modifierAuras = caster->GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER); - for(Unit::AuraList::const_iterator itr = modifierAuras.begin(); itr != modifierAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = modifierAuras.begin(); itr != modifierAuras.end(); ++itr) { // Unrelenting Assault if ((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARRIOR && (*itr)->GetSpellProto()->SpellIconID == 2775) @@ -2391,7 +2391,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) break; case SPELLFAMILY_HUNTER: { - switch(GetId()) + switch (GetId()) { case 34026: // Kill Command target->CastSpell(target, 34027, true, NULL, this); @@ -2401,7 +2401,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } case SPELLFAMILY_SHAMAN: { - switch(GetId()) + switch (GetId()) { case 55198: // Tidal Force target->CastSpell(target, 55166, true, NULL, this); @@ -2436,7 +2436,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; uint32 finalSpellId = 0; - switch(GetId()) + switch (GetId()) { case 19548: finalSpellId = 19597; break; case 19674: finalSpellId = 19677; break; @@ -2464,7 +2464,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) return; } - switch(GetId()) + switch (GetId()) { case 10255: // Stoned { @@ -2719,7 +2719,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // Dalaran restricted flight zone (recheck before apply unmount) if (area && target->GetTypeId() == TYPEID_PLAYER && (area->flags & AREA_FLAG_CANNOT_FLY) && - ((Player*)target)->IsFreeFlying() && !((Player*)target)->isGameMaster()) + ((Player*)target)->IsFreeFlying() && !((Player*)target)->isGameMaster()) { target->CastSpell(target, 58601, true); // Remove Flight Auras (also triggered Parachute (45472)) } @@ -2754,11 +2754,11 @@ void Aura::HandleAuraDummy(bool apply, bool Real) // AT APPLY & REMOVE - switch(GetSpellProto()->SpellFamilyName) + switch (GetSpellProto()->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(GetId()) + switch (GetId()) { case 6606: // Self Visual - Sleep Until Cancelled (DND) { @@ -2865,7 +2865,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (!caster) return; - Unit *owner = caster->GetOwner(); + Unit* owner = caster->GetOwner(); if (owner && owner->GetTypeId() == TYPEID_PLAYER) { if (apply) @@ -2881,7 +2881,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (!caster) return; - Unit *owner = caster->GetOwner(); + Unit* owner = caster->GetOwner(); if (owner && owner->GetTypeId() == TYPEID_PLAYER) { if (apply) @@ -2933,7 +2933,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { // Play part 1 if (apply) - target->PlayDirectSound(14970, (Player *)target); + target->PlayDirectSound(14970, (Player*)target); // continue in 58205 else target->CastSpell(target, 58205, true); @@ -2944,10 +2944,10 @@ void Aura::HandleAuraDummy(bool apply, bool Real) { // Play part 2 if (apply) - target->PlayDirectSound(14971, (Player *)target); + target->PlayDirectSound(14971, (Player*)target); // Play part 3 else - target->PlayDirectSound(14972, (Player *)target); + target->PlayDirectSound(14972, (Player*)target); } return; case 27978: @@ -2982,7 +2982,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } case SPELLFAMILY_DRUID: { - switch(GetId()) + switch (GetId()) { case 52610: // Savage Roar { @@ -2999,7 +2999,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } case 61336: // Survival Instincts { - if(apply) + if (apply) { if (!target->IsInFeralForm()) return; @@ -3061,7 +3061,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) if (GetSpellProto()->SpellIconID == 2855) { uint32 spell_id; - switch(GetId()) + switch (GetId()) { case 48384: spell_id = 50170; break; //Rank 1 case 48395: spell_id = 50171; break; //Rank 2 @@ -3085,7 +3085,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) break; } case SPELLFAMILY_ROGUE: - switch(GetId()) + switch (GetId()) { case 57934: // Tricks of the Trade, main spell { @@ -3103,7 +3103,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) break; case SPELLFAMILY_HUNTER: { - switch(GetId()) + switch (GetId()) { case 34477: // Misdirection, main spell { @@ -3121,7 +3121,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) break; } case SPELLFAMILY_PALADIN: - switch(GetId()) + switch (GetId()) { case 20911: // Blessing of Sanctuary case 25899: // Greater Blessing of Sanctuary @@ -3136,7 +3136,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) break; case SPELLFAMILY_SHAMAN: { - switch(GetId()) + switch (GetId()) { case 6495: // Sentry Totem { @@ -3175,7 +3175,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) uint32 zone, area; target->GetZoneAndAreaId(zone, area); - for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) + for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) { // some auras remove at aura remove if (!itr->second->IsFitToRequirements((Player*)target, zone, area)) @@ -3198,22 +3198,22 @@ void Aura::HandleAuraDummy(bool apply, bool Real) void Aura::HandleAuraMounted(bool apply, bool Real) { // only at real add/remove aura - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); - if(apply) + if (apply) { CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(m_modifier.m_miscvalue); - if(!ci) + if (!ci) { sLog.outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need it modelid)", m_modifier.m_miscvalue); return; } uint32 display_id = Creature::ChooseDisplayId(ci); - CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); + CreatureModelInfo const* minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; @@ -3228,11 +3228,11 @@ void Aura::HandleAuraMounted(bool apply, bool Real) void Aura::HandleAuraWaterWalk(bool apply, bool Real) { // only at real add/remove aura - if(!Real) + if (!Real) return; WorldPacket data; - if(apply) + if (apply) data.Initialize(SMSG_MOVE_WATER_WALK, 8+4); else data.Initialize(SMSG_MOVE_LAND_WALK, 8+4); @@ -3244,11 +3244,11 @@ void Aura::HandleAuraWaterWalk(bool apply, bool Real) void Aura::HandleAuraFeatherFall(bool apply, bool Real) { // only at real add/remove aura - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); WorldPacket data; - if(apply) + if (apply) data.Initialize(SMSG_MOVE_FEATHER_FALL, 8+4); else data.Initialize(SMSG_MOVE_NORMAL_FALL, 8+4); @@ -3257,18 +3257,18 @@ void Aura::HandleAuraFeatherFall(bool apply, bool Real) target->SendMessageToSet(&data, true); // start fall from current height - if(!apply && target->GetTypeId() == TYPEID_PLAYER) + if (!apply && target->GetTypeId() == TYPEID_PLAYER) ((Player*)target)->SetFallInformation(0, target->GetPositionZ()); } void Aura::HandleAuraHover(bool apply, bool Real) { // only at real add/remove aura - if(!Real) + if (!Real) return; WorldPacket data; - if(apply) + if (apply) data.Initialize(SMSG_MOVE_SET_HOVER, 8+4); else data.Initialize(SMSG_MOVE_UNSET_HOVER, 8+4); @@ -3280,7 +3280,7 @@ void Aura::HandleAuraHover(bool apply, bool Real) void Aura::HandleWaterBreathing(bool /*apply*/, bool /*Real*/) { // update timers in client - if(GetTarget()->GetTypeId()==TYPEID_PLAYER) + if (GetTarget()->GetTypeId()==TYPEID_PLAYER) ((Player*)GetTarget())->UpdateMirrorTimers(); } @@ -3350,9 +3350,9 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) // If spell that caused this aura has Croud Control or Daze effect if ((aurMechMask & MECHANIC_NOT_REMOVED_BY_SHAPESHIFT) || - // some Daze spells have these parameters instead of MECHANIC_DAZE (skip snare spells) - (aurSpellInfo->SpellIconID == 15 && aurSpellInfo->Dispel == 0 && - (aurMechMask & (1 << (MECHANIC_SNARE-1))) == 0)) + // some Daze spells have these parameters instead of MECHANIC_DAZE (skip snare spells) + (aurSpellInfo->SpellIconID == 15 && aurSpellInfo->Dispel == 0 && + (aurMechMask & (1 << (MECHANIC_SNARE-1))) == 0)) { ++iter; continue; @@ -3370,7 +3370,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) break; } default: - break; + break; } if (apply) @@ -3451,13 +3451,13 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) // Stance mastery + Tactical mastery (both passive, and last have aura only in defense stance, but need apply at any stance switch) if (target->GetTypeId() == TYPEID_PLAYER) { - PlayerSpellMap const& sp_list = ((Player *)target)->GetSpellMap(); + PlayerSpellMap const& sp_list = ((Player*)target)->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { if (itr->second.state == PLAYERSPELL_REMOVED) continue; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) Rage_val += target->CalculateSpellDamage(target, spellInfo, EFFECT_INDEX_0) * 10; } @@ -3493,14 +3493,14 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) switch (form) { - // Nordrassil Harness - bonus + // Nordrassil Harness - bonus case FORM_BEAR: case FORM_DIREBEAR: case FORM_CAT: if (Aura* dummy = target->GetDummyAura(37315)) target->CastSpell(target, 37316, true, NULL, dummy); break; - // Nordrassil Regalia - bonus + // Nordrassil Regalia - bonus case FORM_MOONKIN: if (Aura* dummy = target->GetDummyAura(37324)) target->CastSpell(target, 37325, true, NULL, dummy); @@ -3526,7 +3526,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) void Aura::HandleAuraTransform(bool apply, bool Real) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (apply) { // special case (spell specific functionality) @@ -3537,47 +3537,47 @@ void Aura::HandleAuraTransform(bool apply, bool Real) case 16739: // Orb of Deception { uint32 orb_model = target->GetNativeDisplayId(); - switch(orb_model) + switch (orb_model) { - // Troll Female + // Troll Female case 1479: target->SetDisplayId(10134); break; - // Troll Male + // Troll Male case 1478: target->SetDisplayId(10135); break; - // Tauren Male + // Tauren Male case 59: target->SetDisplayId(10136); break; - // Human Male + // Human Male case 49: target->SetDisplayId(10137); break; - // Human Female + // Human Female case 50: target->SetDisplayId(10138); break; - // Orc Male + // Orc Male case 51: target->SetDisplayId(10139); break; - // Orc Female + // Orc Female case 52: target->SetDisplayId(10140); break; - // Dwarf Male + // Dwarf Male case 53: target->SetDisplayId(10141); break; - // Dwarf Female + // Dwarf Female case 54: target->SetDisplayId(10142); break; - // NightElf Male + // NightElf Male case 55: target->SetDisplayId(10143); break; - // NightElf Female + // NightElf Female case 56: target->SetDisplayId(10144); break; - // Undead Female + // Undead Female case 58: target->SetDisplayId(10145); break; - // Undead Male + // Undead Male case 57: target->SetDisplayId(10146); break; - // Tauren Female + // Tauren Female case 60: target->SetDisplayId(10147); break; - // Gnome Male + // Gnome Male case 1563: target->SetDisplayId(10148); break; - // Gnome Female + // Gnome Female case 1564: target->SetDisplayId(10149); break; - // BloodElf Female + // BloodElf Female case 15475: target->SetDisplayId(17830); break; - // BloodElf Male + // BloodElf Male case 15476: target->SetDisplayId(17829); break; - // Dranei Female + // Dranei Female case 16126: target->SetDisplayId(17828); break; - // Dranei Male + // Dranei Male case 16125: target->SetDisplayId(17827); break; default: break; } @@ -3586,9 +3586,9 @@ void Aura::HandleAuraTransform(bool apply, bool Real) case 42365: // Murloc costume target->SetDisplayId(21723); break; - //case 44186: // Gossip NPC Appearance - All, Brewfest + //case 44186: // Gossip NPC Appearance - All, Brewfest //break; - //case 48305: // Gossip NPC Appearance - All, Spirit of Competition + //case 48305: // Gossip NPC Appearance - All, Spirit of Competition //break; case 50517: // Dread Corsair case 51926: // Corsair Costume @@ -3596,7 +3596,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) // expected for players uint32 race = target->getRace(); - switch(race) + switch (race) { case RACE_HUMAN: target->SetDisplayId(target->getGender() == GENDER_MALE ? 25037 : 25048); @@ -3636,23 +3636,23 @@ void Aura::HandleAuraTransform(bool apply, bool Real) break; } //case 50531: // Gossip NPC Appearance - All, Pirate Day - //break; + //break; //case 51010: // Dire Brew - //break; + //break; //case 53806: // Pygmy Oil - //break; + //break; //case 62847: // NPC Appearance - Valiant 02 - //break; + //break; //case 62852: // NPC Appearance - Champion 01 - //break; + //break; //case 63965: // NPC Appearance - Champion 02 - //break; + //break; //case 63966: // NPC Appearance - Valiant 03 - //break; + //break; case 65386: // Honor the Dead case 65495: { - switch(target->getGender()) + switch (target->getGender()) { case GENDER_MALE: target->SetDisplayId(29203); // Chapman @@ -3665,19 +3665,19 @@ void Aura::HandleAuraTransform(bool apply, bool Real) break; } //case 65511: // Gossip NPC Appearance - Brewfest - //break; + //break; //case 65522: // Gossip NPC Appearance - Winter Veil - //break; + //break; //case 65523: // Gossip NPC Appearance - Default - //break; + //break; //case 65524: // Gossip NPC Appearance - Lunar Festival - //break; + //break; //case 65525: // Gossip NPC Appearance - Hallow's End - //break; + //break; //case 65526: // Gossip NPC Appearance - Midsummer - //break; + //break; //case 65527: // Gossip NPC Appearance - Spirit of Competition - //break; + //break; case 65528: // Gossip NPC Appearance - Pirates' Day { // expecting npc's using this spell to have models with race info. @@ -3725,20 +3725,20 @@ void Aura::HandleAuraTransform(bool apply, bool Real) // random, regardless of current gender target->SetDisplayId(roll_chance_i(50) ? 29203 : 29204); break; - //case 66236: // Incinerate Flesh + //case 66236: // Incinerate Flesh //break; - //case 69999: // [DND] Swap IDs + //case 69999: // [DND] Swap IDs //break; - //case 70764: // Citizen Costume (note: many spells w/same name) + //case 70764: // Citizen Costume (note: many spells w/same name) //break; - //case 71309: // [DND] Spawn Portal + //case 71309: // [DND] Spawn Portal //break; case 71450: // Crown Parcel Service Uniform target->SetDisplayId(target->getGender() == GENDER_MALE ? 31002 : 31003); break; - //case 75531: // Gnomeregan Pride + //case 75531: // Gnomeregan Pride //break; - //case 75532: // Darkspear Pride + //case 75532: // Darkspear Pride //break; default: sLog.outError("Aura::HandleAuraTransform, spell %u does not have creature entry defined, need custom defined model.", GetId()); @@ -3749,7 +3749,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) { uint32 model_id; - CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(m_modifier.m_miscvalue); + CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(m_modifier.m_miscvalue); if (!ci) { model_id = 16358; // pig pink ^_^ @@ -3771,7 +3771,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) ((Creature*)target)->LoadEquipment(ci->equipmentId, true); // Dragonmaw Illusion (set mount model also) - if(GetId()==42016 && target->GetMountID() && !target->GetAurasByType(SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED).empty()) + if (GetId()==42016 && target->GetMountID() && !target->GetAurasByType(SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED).empty()) target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); } @@ -3808,7 +3808,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) { // look for other transform auras Aura* handledAura = *otherTransforms.begin(); - for(Unit::AuraList::const_iterator i = otherTransforms.begin();i != otherTransforms.end(); ++i) + for (Unit::AuraList::const_iterator i = otherTransforms.begin(); i != otherTransforms.end(); ++i) { // negative auras are preferred if (!IsPositiveSpell((*i)->GetSpellProto()->Id)) @@ -3829,7 +3829,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real) if (CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(cr_id)) { uint32 display_id = Creature::ChooseDisplayId(ci); - CreatureModelInfo const *minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); + CreatureModelInfo const* minfo = sObjectMgr.GetCreatureModelRandomGender(display_id); if (minfo) display_id = minfo->modelid; @@ -3842,10 +3842,10 @@ void Aura::HandleAuraTransform(bool apply, bool Real) void Aura::HandleForceReaction(bool apply, bool Real) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - if(!Real) + if (!Real) return; Player* player = (Player*)GetTarget(); @@ -3863,14 +3863,14 @@ void Aura::HandleForceReaction(bool apply, bool Real) void Aura::HandleAuraModSkill(bool apply, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; uint32 prot=GetSpellProto()->EffectMiscValue[m_effIndex]; int32 points = GetModifier()->m_amount; ((Player*)GetTarget())->ModifySkillBonus(prot, (apply ? points: -points), m_modifier.m_auraname == SPELL_AURA_MOD_SKILL_TALENT); - if(prot == SKILL_DEFENSE) + if (prot == SKILL_DEFENSE) ((Player*)GetTarget())->UpdateDefenseBonusesMod(); } @@ -3884,7 +3884,7 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real) if (m_modifier.m_amount <= 0) return; - SpellEntry const *spellInfo = GetSpellProto(); + SpellEntry const* spellInfo = GetSpellProto(); if (spellInfo->EffectItemType[m_effIndex] == 0) return; @@ -3898,7 +3898,7 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real) { // Only from non-grey units if (!((Player*)caster)->isHonorOrXPTarget(victim) || - (victim->GetTypeId() == TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim))) + (victim->GetTypeId() == TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim))) return; } @@ -3907,11 +3907,11 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real) uint32 count = m_modifier.m_amount; ItemPosCountVec dest; - InventoryResult msg = ((Player*)caster)->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, spellInfo->EffectItemType[m_effIndex], count, &noSpaceForCount); - if( msg != EQUIP_ERR_OK ) + InventoryResult msg = ((Player*)caster)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, spellInfo->EffectItemType[m_effIndex], count, &noSpaceForCount); + if (msg != EQUIP_ERR_OK) { count-=noSpaceForCount; - ((Player*)caster)->SendEquipError( msg, NULL, NULL, spellInfo->EffectItemType[m_effIndex] ); + ((Player*)caster)->SendEquipError(msg, NULL, NULL, spellInfo->EffectItemType[m_effIndex]); if (count==0) return; } @@ -3932,7 +3932,7 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real) void Aura::HandleBindSight(bool apply, bool /*Real*/) { Unit* caster = GetCaster(); - if(!caster || caster->GetTypeId() != TYPEID_PLAYER) + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; Camera& camera = ((Player*)caster)->GetCamera(); @@ -3945,7 +3945,7 @@ void Aura::HandleBindSight(bool apply, bool /*Real*/) void Aura::HandleFarSight(bool apply, bool /*Real*/) { Unit* caster = GetCaster(); - if(!caster || caster->GetTypeId() != TYPEID_PLAYER) + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; Camera& camera = ((Player*)caster)->GetCamera(); @@ -3985,10 +3985,10 @@ void Aura::HandleAuraTrackResources(bool apply, bool /*Real*/) void Aura::HandleAuraTrackStealthed(bool apply, bool /*Real*/) { - if(GetTarget()->GetTypeId()!=TYPEID_PLAYER) + if (GetTarget()->GetTypeId()!=TYPEID_PLAYER) return; - if(apply) + if (apply) GetTarget()->RemoveNoStackAurasDueToAuraHolder(GetHolder()); GetTarget()->ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_TRACK_STEALTHED, apply); @@ -4002,23 +4002,23 @@ void Aura::HandleAuraModScale(bool apply, bool /*Real*/) void Aura::HandleModPossess(bool apply, bool Real) { - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); // not possess yourself if (GetCasterGuid() == target->GetObjectGuid()) return; Unit* caster = GetCaster(); - if(!caster || caster->GetTypeId() != TYPEID_PLAYER) + if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return; Player* p_caster = (Player*)caster; Camera& camera = p_caster->GetCamera(); - if( apply ) + if (apply) { target->addUnitState(UNIT_STAT_CONTROLLED); @@ -4038,7 +4038,7 @@ void Aura::HandleModPossess(bool apply, bool Real) target->DeleteThreatList(); target->getHostileRefManager().deleteReferences(); - if(CharmInfo *charmInfo = target->InitCharmInfo(target)) + if (CharmInfo* charmInfo = target->InitCharmInfo(target)) { charmInfo->InitPossessCreateSpells(); charmInfo->SetReactState(REACT_PASSIVE); @@ -4047,11 +4047,11 @@ void Aura::HandleModPossess(bool apply, bool Real) p_caster->PossessSpellInitialize(); - if(target->GetTypeId() == TYPEID_UNIT) + if (target->GetTypeId() == TYPEID_UNIT) { ((Creature*)target)->AIM_Initialize(); } - else if(target->GetTypeId() == TYPEID_PLAYER) + else if (target->GetTypeId() == TYPEID_PLAYER) { ((Player*)target)->SetClientControl(target, 0); } @@ -4071,7 +4071,7 @@ void Aura::HandleModPossess(bool apply, bool Real) p_caster->RemovePetActionBar(); // on delete only do caster related effects - if(m_removeMode == AURA_REMOVE_BY_DELETE) + if (m_removeMode == AURA_REMOVE_BY_DELETE) return; target->clearUnitState(UNIT_STAT_CONTROLLED); @@ -4084,18 +4084,18 @@ void Aura::HandleModPossess(bool apply, bool Real) target->SetCharmerGuid(ObjectGuid()); - if(target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) { ((Player*)target)->setFactionForRace(target->getRace()); ((Player*)target)->SetClientControl(target, 1); } - else if(target->GetTypeId() == TYPEID_UNIT) + else if (target->GetTypeId() == TYPEID_UNIT) { - CreatureInfo const *cinfo = ((Creature*)target)->GetCreatureInfo(); + CreatureInfo const* cinfo = ((Creature*)target)->GetCreatureInfo(); target->setFaction(cinfo->faction_A); } - if(target->GetTypeId() == TYPEID_UNIT) + if (target->GetTypeId() == TYPEID_UNIT) { ((Creature*)target)->AIM_Initialize(); target->AttackedBy(caster); @@ -4105,7 +4105,7 @@ void Aura::HandleModPossess(bool apply, bool Real) void Aura::HandleModPossessPet(bool apply, bool Real) { - if(!Real) + if (!Real) return; Unit* caster = GetCaster(); @@ -4150,7 +4150,7 @@ void Aura::HandleModPossessPet(bool apply, bool Real) camera.ResetView(); // on delete only do caster related effects - if(m_removeMode == AURA_REMOVE_BY_DELETE) + if (m_removeMode == AURA_REMOVE_BY_DELETE) return; pet->clearUnitState(UNIT_STAT_CONTROLLED); @@ -4173,30 +4173,30 @@ void Aura::HandleModPossessPet(bool apply, bool Real) void Aura::HandleAuraModPetTalentsPoints(bool /*Apply*/, bool Real) { - if(!Real) + if (!Real) return; // Recalculate pet talent points - if (Pet *pet=GetTarget()->GetPet()) + if (Pet* pet=GetTarget()->GetPet()) pet->InitTalentForLevel(); } void Aura::HandleModCharm(bool apply, bool Real) { - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); // not charm yourself if (GetCasterGuid() == target->GetObjectGuid()) return; Unit* caster = GetCaster(); - if(!caster) + if (!caster) return; - if( apply ) + if (apply) { // is it really need after spell check checks? target->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM, GetHolder()); @@ -4211,22 +4211,22 @@ void Aura::HandleModCharm(bool apply, bool Real) target->DeleteThreatList(); target->getHostileRefManager().deleteReferences(); - if(target->GetTypeId() == TYPEID_UNIT) + if (target->GetTypeId() == TYPEID_UNIT) { ((Creature*)target)->AIM_Initialize(); - CharmInfo *charmInfo = target->InitCharmInfo(target); + CharmInfo* charmInfo = target->InitCharmInfo(target); charmInfo->InitCharmCreateSpells(); - charmInfo->SetReactState( REACT_DEFENSIVE ); + charmInfo->SetReactState(REACT_DEFENSIVE); - if(caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK) + if (caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK) { - CreatureInfo const *cinfo = ((Creature*)target)->GetCreatureInfo(); - if(cinfo && cinfo->type == CREATURE_TYPE_DEMON) + CreatureInfo const* cinfo = ((Creature*)target)->GetCreatureInfo(); + if (cinfo && cinfo->type == CREATURE_TYPE_DEMON) { // creature with pet number expected have class set - if(target->GetByteValue(UNIT_FIELD_BYTES_0, 1)==0) + if (target->GetByteValue(UNIT_FIELD_BYTES_0, 1)==0) { - if(cinfo->unit_class==0) + if (cinfo->unit_class==0) sLog.outErrorDb("Creature (Entry: %u) have unit_class = 0 but used in charmed spell, that will be result client crash.",cinfo->Entry); else sLog.outError("Creature (Entry: %u) have unit_class = %u but at charming have class 0!!! that will be result client crash.",cinfo->Entry,cinfo->unit_class); @@ -4242,37 +4242,37 @@ void Aura::HandleModCharm(bool apply, bool Real) } } - if(caster->GetTypeId() == TYPEID_PLAYER) + if (caster->GetTypeId() == TYPEID_PLAYER) ((Player*)caster)->CharmSpellInitialize(); } else { target->SetCharmerGuid(ObjectGuid()); - if(target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) ((Player*)target)->setFactionForRace(target->getRace()); else { - CreatureInfo const *cinfo = ((Creature*)target)->GetCreatureInfo(); + CreatureInfo const* cinfo = ((Creature*)target)->GetCreatureInfo(); // restore faction - if(((Creature*)target)->IsPet()) + if (((Creature*)target)->IsPet()) { - if(Unit* owner = target->GetOwner()) + if (Unit* owner = target->GetOwner()) target->setFaction(owner->getFaction()); - else if(cinfo) + else if (cinfo) target->setFaction(cinfo->faction_A); } - else if(cinfo) // normal creature + else if (cinfo) // normal creature target->setFaction(cinfo->faction_A); // restore UNIT_FIELD_BYTES_0 - if(cinfo && caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON) + if (cinfo && caster->GetTypeId() == TYPEID_PLAYER && caster->getClass() == CLASS_WARLOCK && cinfo->type == CREATURE_TYPE_DEMON) { // DB must have proper class set in field at loading, not req. restore, including workaround case at apply // m_target->SetByteValue(UNIT_FIELD_BYTES_0, 1, cinfo->unit_class); - if(target->GetCharmInfo()) + if (target->GetCharmInfo()) target->GetCharmInfo()->SetPetNumber(0, true); else sLog.outError("Aura::HandleModCharm: target (GUID: %u TypeId: %u) has a charm aura but no charm info!", target->GetGUIDLow(), target->GetTypeId()); @@ -4281,14 +4281,14 @@ void Aura::HandleModCharm(bool apply, bool Real) caster->SetCharm(NULL); - if(caster->GetTypeId() == TYPEID_PLAYER) + if (caster->GetTypeId() == TYPEID_PLAYER) ((Player*)caster)->RemovePetActionBar(); target->CombatStop(true); target->DeleteThreatList(); target->getHostileRefManager().deleteReferences(); - if(target->GetTypeId() == TYPEID_UNIT) + if (target->GetTypeId() == TYPEID_UNIT) { ((Creature*)target)->AIM_Initialize(); target->AttackedBy(caster); @@ -4298,7 +4298,7 @@ void Aura::HandleModCharm(bool apply, bool Real) void Aura::HandleModConfuse(bool apply, bool Real) { - if(!Real) + if (!Real) return; GetTarget()->SetConfused(apply, GetCasterGuid(), GetId()); @@ -4314,7 +4314,7 @@ void Aura::HandleModFear(bool apply, bool Real) void Aura::HandleFeignDeath(bool apply, bool Real) { - if(!Real) + if (!Real) return; GetTarget()->SetFeignDeath(apply, GetCasterGuid(), GetId()); @@ -4322,12 +4322,12 @@ void Aura::HandleFeignDeath(bool apply, bool Real) void Aura::HandleAuraModDisarm(bool apply, bool Real) { - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); - if(!apply && target->HasAuraType(GetModifier()->m_auraname)) + if (!apply && target->HasAuraType(GetModifier()->m_auraname)) return; uint32 flags; @@ -4372,17 +4372,17 @@ void Aura::HandleAuraModDisarm(bool apply, bool Real) if (apply) target->SetAttackTime(attack_type, BASE_ATTACK_TIME); else - ((Player *)target)->SetRegularAttackTime(); + ((Player*)target)->SetRegularAttackTime(); target->UpdateDamagePhysical(attack_type); } void Aura::HandleAuraModStun(bool apply, bool Real) { - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (apply) { @@ -4397,7 +4397,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) target->CastStop(target->GetObjectGuid() == GetCasterGuid() ? GetId() : 0); // Creature specific - if(target->GetTypeId() != TYPEID_PLAYER) + if (target->GetTypeId() != TYPEID_PLAYER) target->StopMoving(); else { @@ -4411,11 +4411,11 @@ void Aura::HandleAuraModStun(bool apply, bool Real) target->SendMessageToSet(&data, true); // Summon the Naj'entus Spine GameObject on target if spell is Impaling Spine - if(GetId() == 39837) + if (GetId() == 39837) { GameObject* pObj = new GameObject; - if(pObj->Create(target->GetMap()->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), 185584, target->GetMap(), target->GetPhaseMask(), - target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation())) + if (pObj->Create(target->GetMap()->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), 185584, target->GetMap(), target->GetPhaseMask(), + target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation())) { pObj->SetRespawnTime(GetAuraDuration()/IN_MILLISECONDS); pObj->SetSpellId(GetId()); @@ -4432,35 +4432,35 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) { bool found_another = false; - for(AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; ++itr) + for (AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; ++itr) { Unit::AuraList const& auras = target->GetAurasByType(*itr); - for(Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) + for (Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) { - if( GetSpellSchoolMask((*i)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) + if (GetSpellSchoolMask((*i)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) { found_another = true; break; } } - if(found_another) + if (found_another) break; } - if(!found_another) + if (!found_another) target->ModifyAuraState(AURA_STATE_FROZEN, apply); } // Real remove called after current aura remove from lists, check if other similar auras active - if(target->HasAuraType(SPELL_AURA_MOD_STUN)) + if (target->HasAuraType(SPELL_AURA_MOD_STUN)) return; target->clearUnitState(UNIT_STAT_STUNNED); target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); - if(!target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect + if (!target->hasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect { - if(target->getVictim() && target->isAlive()) + if (target->getVictim() && target->isAlive()) target->SetTargetGuid(target->getVictim()->GetObjectGuid()); WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 8+4); @@ -4473,12 +4473,12 @@ void Aura::HandleAuraModStun(bool apply, bool Real) if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000100000000000)) { Unit* caster = GetCaster(); - if( !caster || caster->GetTypeId()!=TYPEID_PLAYER ) + if (!caster || caster->GetTypeId()!=TYPEID_PLAYER) return; uint32 spell_id = 0; - switch(GetId()) + switch (GetId()) { case 19386: spell_id = 24131; break; case 24132: spell_id = 24134; break; @@ -4493,7 +4493,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id); - if(!spellInfo) + if (!spellInfo) return; caster->CastSpell(target,spellInfo,true,NULL,this); @@ -4504,7 +4504,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real) void Aura::HandleModStealth(bool apply, bool Real) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (apply) { @@ -4527,10 +4527,10 @@ void Aura::HandleModStealth(bool apply, bool Real) } // apply full stealth period bonuses only at first stealth aura in stack - if(target->GetAurasByType(SPELL_AURA_MOD_STEALTH).size()<=1) + if (target->GetAurasByType(SPELL_AURA_MOD_STEALTH).size()<=1) { Unit::AuraList const& mDummyAuras = target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) + for (Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) { // Master of Subtlety if ((*i)->GetSpellProto()->SpellIconID == 2114) @@ -4573,7 +4573,7 @@ void Aura::HandleModStealth(bool apply, bool Real) // apply delayed talent bonus remover at last stealth aura remove Unit::AuraList const& mDummyAuras = target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) + for (Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) { // Master of Subtlety if ((*i)->GetSpellProto()->SpellIconID == 2114) @@ -4594,7 +4594,7 @@ void Aura::HandleModStealth(bool apply, bool Real) void Aura::HandleInvisibility(bool apply, bool Real) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (apply) { @@ -4622,7 +4622,7 @@ void Aura::HandleInvisibility(bool apply, bool Real) // recalculate value at modifier remove (current aura already removed) target->m_invisibilityMask = 0; Unit::AuraList const& auras = target->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY); - for(Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) target->m_invisibilityMask |= (1 << (*itr)->GetModifier()->m_miscvalue); // only at real aura remove and if not have different invisibility auras. @@ -4648,9 +4648,9 @@ void Aura::HandleInvisibility(bool apply, bool Real) void Aura::HandleInvisibilityDetect(bool apply, bool Real) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); - if(apply) + if (apply) { target->m_detectInvisibilityMask |= (1 << m_modifier.m_miscvalue); } @@ -4659,10 +4659,10 @@ void Aura::HandleInvisibilityDetect(bool apply, bool Real) // recalculate value at modifier remove (current aura already removed) target->m_detectInvisibilityMask = 0; Unit::AuraList const& auras = target->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION); - for(Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) target->m_detectInvisibilityMask |= (1 << (*itr)->GetModifier()->m_miscvalue); } - if(Real && target->GetTypeId()==TYPEID_PLAYER) + if (Real && target->GetTypeId()==TYPEID_PLAYER) ((Player*)target)->GetCamera().UpdateVisibilityForOwner(); } @@ -4674,10 +4674,10 @@ void Aura::HandleDetectAmore(bool apply, bool /*real*/) void Aura::HandleAuraModRoot(bool apply, bool Real) { // only at real add/remove aura - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (apply) { @@ -4689,10 +4689,10 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) target->SetTargetGuid(ObjectGuid()); //Save last orientation - if( target->getVictim() ) + if (target->getVictim()) target->SetOrientation(target->GetAngle(target->getVictim())); - if(target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) { WorldPacket data(SMSG_FORCE_MOVE_ROOT, 10); data << target->GetPackGUID(); @@ -4711,37 +4711,37 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) { bool found_another = false; - for(AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; ++itr) + for (AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; ++itr) { Unit::AuraList const& auras = target->GetAurasByType(*itr); - for(Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) + for (Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) { - if( GetSpellSchoolMask((*i)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) + if (GetSpellSchoolMask((*i)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST) { found_another = true; break; } } - if(found_another) + if (found_another) break; } - if(!found_another) + if (!found_another) target->ModifyAuraState(AURA_STATE_FROZEN, apply); } // Real remove called after current aura remove from lists, check if other similar auras active - if(target->HasAuraType(SPELL_AURA_MOD_ROOT)) + if (target->HasAuraType(SPELL_AURA_MOD_ROOT)) return; target->clearUnitState(UNIT_STAT_ROOT); - if(!target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect + if (!target->hasUnitState(UNIT_STAT_STUNNED)) // prevent allow move if have also stun effect { - if(target->getVictim() && target->isAlive()) + if (target->getVictim() && target->isAlive()) target->SetTargetGuid(target->getVictim()->GetObjectGuid()); - if(target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) { WorldPacket data(SMSG_FORCE_MOVE_UNROOT, 10); data << target->GetPackGUID(); @@ -4755,25 +4755,25 @@ void Aura::HandleAuraModRoot(bool apply, bool Real) void Aura::HandleAuraModSilence(bool apply, bool Real) { // only at real add/remove aura - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); - if(apply) + if (apply) { target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED); // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i))) - if(spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) + if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) // Stop spells on prepare or casting state target->InterruptSpell(CurrentSpellTypes(i), false); } else { // Real remove called after current aura remove from lists, check if other similar auras active - if(target->HasAuraType(SPELL_AURA_MOD_SILENCE)) + if (target->HasAuraType(SPELL_AURA_MOD_SILENCE)) return; target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED); @@ -4786,7 +4786,7 @@ void Aura::HandleModThreat(bool apply, bool Real) if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (!target->isAlive()) return; @@ -4795,12 +4795,12 @@ void Aura::HandleModThreat(bool apply, bool Real) int multiplier = 0; switch (GetId()) { - // Arcane Shroud + // Arcane Shroud case 26400: level_diff = target->getLevel() - 60; multiplier = 2; break; - // The Eye of Diminution + // The Eye of Diminution case 28862: level_diff = target->getLevel() - 60; multiplier = 1; @@ -4811,7 +4811,7 @@ void Aura::HandleModThreat(bool apply, bool Real) m_modifier.m_amount += multiplier * level_diff; if (target->GetTypeId() == TYPEID_PLAYER) - for(int8 x=0;x < MAX_SPELL_SCHOOL;x++) + for (int8 x=0; x < MAX_SPELL_SCHOOL; x++) if (m_modifier.m_miscvalue & int32(1<m_threatModifier[x], float(m_modifier.m_amount), apply); } @@ -4822,7 +4822,7 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real) if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (!target->isAlive() || target->GetTypeId() != TYPEID_PLAYER) return; @@ -4843,7 +4843,7 @@ void Aura::HandleModTaunt(bool apply, bool Real) if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (!target->isAlive() || !target->CanHaveThreatList()) return; @@ -4887,7 +4887,7 @@ void Aura::HandleAuraFakeInebriation(bool apply, bool Real) void Aura::HandleAuraModIncreaseSpeed(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove - if(!Real) + if (!Real) return; GetTarget()->UpdateSpeed(MOVE_RUN, true); @@ -4896,10 +4896,10 @@ void Aura::HandleAuraModIncreaseSpeed(bool /*apply*/, bool Real) void Aura::HandleAuraModIncreaseMountedSpeed(bool apply, bool Real) { // all applied/removed only at real aura add/remove - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); target->UpdateSpeed(MOVE_RUN, true); @@ -4912,16 +4912,16 @@ void Aura::HandleAuraModIncreaseMountedSpeed(bool apply, bool Real) void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) { // all applied/removed only at real aura add/remove - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); // Enable Fly mode for flying mounts if (m_modifier.m_auraname == SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED) { WorldPacket data; - if(apply) + if (apply) data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12); else data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12); @@ -4951,10 +4951,10 @@ void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) if (iter->second.state != PLAYERSPELL_REMOVED) { bool changedSpeed = false; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(iter->first); - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + SpellEntry const* spellInfo = sSpellStore.LookupEntry(iter->first); + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { - if(spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED) + if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED) { int32 mountSpeed = spellInfo->CalculateSimpleValue(SpellEffectIndex(i)); if (mountSpeed > m_modifier.m_amount) @@ -4977,7 +4977,7 @@ void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove - if(!Real) + if (!Real) return; GetTarget()->UpdateSpeed(MOVE_SWIM, true); @@ -4986,7 +4986,7 @@ void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real) void Aura::HandleAuraModDecreaseSpeed(bool apply, bool Real) { // all applied/removed only at real aura add/remove - if(!Real) + if (!Real) return; Unit* target = GetTarget(); @@ -5009,10 +5009,10 @@ void Aura::HandleAuraModDecreaseSpeed(bool apply, bool Real) void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real) { // all applied/removed only at real aura add/remove - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); target->UpdateSpeed(MOVE_RUN, true); target->UpdateSpeed(MOVE_SWIM, true); @@ -5031,7 +5031,7 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) if (GetId() == 25771) misc = MECHANIC_IMMUNE_SHIELD; - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (apply && GetSpellProto()->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)) { @@ -5054,7 +5054,7 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/) { // Search talent The Beast Within Unit::AuraList const& dummyAuras = owner->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); - for(Unit::AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i) + for (Unit::AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i) { if ((*i)->GetSpellProto()->SpellIconID == 2229) { @@ -5085,13 +5085,13 @@ void Aura::HandleModMechanicImmunityMask(bool apply, bool /*Real*/) //this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect void Aura::HandleAuraModEffectImmunity(bool apply, bool /*Real*/) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); // when removing flag aura, handle flag drop - if( !apply && target->GetTypeId() == TYPEID_PLAYER - && (GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION) ) + if (!apply && target->GetTypeId() == TYPEID_PLAYER + && (GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION)) { - if( BattleGround *bg = ((Player*)target)->GetBattleGround() ) + if (BattleGround* bg = ((Player*)target)->GetBattleGround()) bg->EventPlayerDroppedFlag(((Player*)target)); } @@ -5103,7 +5103,7 @@ void Aura::HandleAuraModStateImmunity(bool apply, bool Real) if (apply && Real && GetSpellProto()->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)) { Unit::AuraList const& auraList = GetTarget()->GetAurasByType(AuraType(m_modifier.m_miscvalue)); - for(Unit::AuraList::const_iterator itr = auraList.begin(); itr != auraList.end();) + for (Unit::AuraList::const_iterator itr = auraList.begin(); itr != auraList.end();) { if (auraList.front() != this) // skip itself aura (it already added) { @@ -5129,32 +5129,32 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) // TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else if (Real && apply - && GetSpellProto()->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) - && IsPositiveSpell(GetId())) // Only positive immunity removes auras + && GetSpellProto()->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) + && IsPositiveSpell(GetId())) // Only positive immunity removes auras { uint32 school_mask = m_modifier.m_miscvalue; Unit::SpellAuraHolderMap& Auras = target->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next) + for (Unit::SpellAuraHolderMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next) { next = iter; ++next; - SpellEntry const *spell = iter->second->GetSpellProto(); + SpellEntry const* spell = iter->second->GetSpellProto(); if ((GetSpellSchoolMask(spell) & school_mask) // Check for school mask - && !spell->HasAttribute(SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) //Spells unaffected by invulnerability - && !iter->second->IsPositive() // Don't remove positive spells - && spell->Id != GetId() ) // Don't remove self + && !spell->HasAttribute(SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) //Spells unaffected by invulnerability + && !iter->second->IsPositive() // Don't remove positive spells + && spell->Id != GetId()) // Don't remove self { target->RemoveAurasDueToSpell(spell->Id); - if(Auras.empty()) + if (Auras.empty()) break; else next = Auras.begin(); } } } - if( Real && GetSpellProto()->Mechanic == MECHANIC_BANISH ) + if (Real && GetSpellProto()->Mechanic == MECHANIC_BANISH) { - if( apply ) + if (apply) target->addUnitState(UNIT_STAT_ISOLATED); else target->clearUnitState(UNIT_STAT_ISOLATED); @@ -5169,7 +5169,7 @@ void Aura::HandleAuraModDmgImmunity(bool apply, bool /*Real*/) void Aura::HandleAuraModDispelImmunity(bool apply, bool Real) { // all applied/removed only at real aura add/remove - if(!Real) + if (!Real) return; GetTarget()->ApplySpellDispelImmunity(GetSpellProto(), DispelType(m_modifier.m_miscvalue), apply); @@ -5177,16 +5177,16 @@ void Aura::HandleAuraModDispelImmunity(bool apply, bool Real) void Aura::HandleAuraProcTriggerSpell(bool apply, bool Real) { - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); switch (GetId()) { - // some spell have charges by functionality not have its in spell data + // some spell have charges by functionality not have its in spell data case 28200: // Ascendance (Talisman of Ascendance trinket) - if(apply) + if (apply) GetHolder()->SetAuraCharges(6); break; case 50720: // Vigilance (threat transfering) @@ -5206,7 +5206,7 @@ void Aura::HandleAuraProcTriggerSpell(bool apply, bool Real) void Aura::HandleAuraModStalked(bool apply, bool /*Real*/) { // used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND - if(apply) + if (apply) GetTarget()->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TRACK_UNIT); else GetTarget()->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TRACK_UNIT); @@ -5220,11 +5220,11 @@ void Aura::HandlePeriodicTriggerSpell(bool apply, bool /*Real*/) { m_isPeriodic = apply; - Unit *target = GetTarget(); + Unit* target = GetTarget(); if (!apply) { - switch(GetId()) + switch (GetId()) { case 66: // Invisibility if (m_removeMode == AURA_REMOVE_BY_EXPIRE) @@ -5269,7 +5269,7 @@ void Aura::HandlePeriodicEnergize(bool apply, bool Real) if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); // For prevent double apply bonuses bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); @@ -5320,22 +5320,22 @@ void Aura::HandleAuraPowerBurn(bool apply, bool /*Real*/) void Aura::HandleAuraPeriodicDummy(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); // For prevent double apply bonuses bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); - SpellEntry const*spell = GetSpellProto(); - switch( spell->SpellFamilyName) + SpellEntry const* spell = GetSpellProto(); + switch (spell->SpellFamilyName) { case SPELLFAMILY_ROGUE: { - switch(spell->Id) + switch (spell->Id) { - // Master of Subtlety + // Master of Subtlety case 31666: { if (apply) @@ -5372,7 +5372,7 @@ void Aura::HandlePeriodicHeal(bool apply, bool /*Real*/) { m_isPeriodic = apply; - Unit *target = GetTarget(); + Unit* target = GetTarget(); // For prevent double apply bonuses bool loading = (target->GetTypeId() == TYPEID_PLAYER && ((Player*)target)->GetSession()->PlayerLoading()); @@ -5380,19 +5380,19 @@ void Aura::HandlePeriodicHeal(bool apply, bool /*Real*/) // Custom damage calculation after if (apply) { - if(loading) + if (loading) return; - Unit *caster = GetCaster(); + Unit* caster = GetCaster(); if (!caster) return; // Gift of the Naaru (have diff spellfamilies) if (GetSpellProto()->SpellIconID == 329 && GetSpellProto()->SpellVisual[0] == 7625) { - int32 ap = int32 (0.22f * caster->GetTotalAttackPowerValue(BASE_ATTACK)); + int32 ap = int32(0.22f * caster->GetTotalAttackPowerValue(BASE_ATTACK)); int32 holy = caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(GetSpellProto())); - if (holy < 0) + if (holy < 0) holy = 0; holy = int32(holy * 377 / 1000); m_modifier.m_amount += ap > holy ? ap : holy; @@ -5400,7 +5400,7 @@ void Aura::HandlePeriodicHeal(bool apply, bool /*Real*/) // Lifeblood else if (GetSpellProto()->SpellIconID == 3088 && GetSpellProto()->SpellVisual[0] == 8145) { - int32 healthBonus = int32 (0.0032f * caster->GetMaxHealth()); + int32 healthBonus = int32(0.0032f * caster->GetMaxHealth()); m_modifier.m_amount += healthBonus; } @@ -5444,12 +5444,12 @@ void Aura::HandleDamagePercentTaken(bool apply, bool Real) void Aura::HandlePeriodicDamage(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; m_isPeriodic = apply; - Unit *target = GetTarget(); + Unit* target = GetTarget(); SpellEntry const* spellProto = GetSpellProto(); // For prevent double apply bonuses @@ -5458,10 +5458,10 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) // Custom damage calculation after if (apply) { - if(loading) + if (loading) return; - Unit *caster = GetCaster(); + Unit* caster = GetCaster(); if (!caster) return; @@ -5480,7 +5480,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) m_modifier.m_amount+=int32(((mwb_min+mwb_max)/2+ap*mws/14000)*0.2f); // If used while target is above 75% health, Rend does 35% more damage if (spellProto->CalculateSimpleValue(EFFECT_INDEX_1) !=0 && - target->GetHealth() > target->GetMaxHealth() * spellProto->CalculateSimpleValue(EFFECT_INDEX_1) / 100) + target->GetHealth() > target->GetMaxHealth() * spellProto->CalculateSimpleValue(EFFECT_INDEX_1) / 100) m_modifier.m_amount += m_modifier.m_amount * spellProto->CalculateSimpleValue(EFFECT_INDEX_2) / 100; } break; @@ -5498,9 +5498,9 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) // Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs Unit::AuraList const& dummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) { - if((*itr)->GetId()==34241) + if ((*itr)->GetId()==34241) { m_modifier.m_amount += cp * (*itr)->GetModifier()->m_amount; break; @@ -5547,10 +5547,10 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) break; } - if(m_modifier.m_auraname == SPELL_AURA_PERIODIC_DAMAGE) + if (m_modifier.m_auraname == SPELL_AURA_PERIODIC_DAMAGE) { // SpellDamageBonusDone for magic spells - if(spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellProto->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) + if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellProto->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) m_modifier.m_amount = caster->SpellDamageBonusDone(target, GetSpellProto(), m_modifier.m_amount, DOT, GetStackAmount()); // MeleeDamagebonusDone for weapon based spells else @@ -5564,7 +5564,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real) else { // Parasitic Shadowfiend - handle summoning of two Shadowfiends on DoT expire - if(spellProto->Id == 41917) + if (spellProto->Id == 41917) target->CastSpell(target, 41915, true); } } @@ -5584,10 +5584,10 @@ void Aura::HandlePeriodicLeech(bool apply, bool /*Real*/) // Custom damage calculation after if (apply) { - if(loading) + if (loading) return; - Unit *caster = GetCaster(); + Unit* caster = GetCaster(); if (!caster) return; @@ -5610,10 +5610,10 @@ void Aura::HandlePeriodicHealthFunnel(bool apply, bool /*Real*/) // Custom damage calculation after if (apply) { - if(loading) + if (loading) return; - Unit *caster = GetCaster(); + Unit* caster = GetCaster(); if (!caster) return; @@ -5631,12 +5631,12 @@ void Aura::HandlePeriodicHealthFunnel(bool apply, bool /*Real*/) void Aura::HandleAuraModResistanceExclusive(bool apply, bool /*Real*/) { - for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++) + for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++) { - if(m_modifier.m_miscvalue & int32(1<HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_modifier.m_amount), apply); - if(GetTarget()->GetTypeId() == TYPEID_PLAYER) + if (GetTarget()->GetTypeId() == TYPEID_PLAYER) GetTarget()->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply); } } @@ -5644,12 +5644,12 @@ void Aura::HandleAuraModResistanceExclusive(bool apply, bool /*Real*/) void Aura::HandleAuraModResistance(bool apply, bool /*Real*/) { - for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++) + for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++) { - if(m_modifier.m_miscvalue & int32(1<HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply); - if(GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->IsPet()) + if (GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->IsPet()) GetTarget()->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply); } } @@ -5658,17 +5658,17 @@ void Aura::HandleAuraModResistance(bool apply, bool /*Real*/) void Aura::HandleAuraModBaseResistancePCT(bool apply, bool /*Real*/) { // only players have base stats - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) { //pets only have base armor - if(((Creature*)GetTarget())->IsPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) + if (((Creature*)GetTarget())->IsPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) GetTarget()->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply); } else { - for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++) + for (int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL; x++) { - if(m_modifier.m_miscvalue & int32(1<HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(m_modifier.m_amount), apply); } } @@ -5676,14 +5676,14 @@ void Aura::HandleAuraModBaseResistancePCT(bool apply, bool /*Real*/) void Aura::HandleModResistancePercent(bool apply, bool /*Real*/) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); - for(int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++) + for (int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++) { - if(m_modifier.m_miscvalue & int32(1<HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); - if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->IsPet()) + if (target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->IsPet()) { target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, float(m_modifier.m_amount), apply); target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, float(m_modifier.m_amount), apply); @@ -5695,16 +5695,16 @@ void Aura::HandleModResistancePercent(bool apply, bool /*Real*/) void Aura::HandleModBaseResistance(bool apply, bool /*Real*/) { // only players have base stats - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) { //only pets have base stats - if(((Creature*)GetTarget())->IsPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) + if (((Creature*)GetTarget())->IsPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) GetTarget()->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(m_modifier.m_amount), apply); } else { - for(int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++) - if(m_modifier.m_miscvalue & (1<HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); } } @@ -5721,14 +5721,14 @@ void Aura::HandleAuraModStat(bool apply, bool /*Real*/) return; } - for(int32 i = STAT_STRENGTH; i < MAX_STATS; i++) + for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++) { // -1 or -2 is all stats ( misc < -2 checked in function beginning ) if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue == i) { //m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply); GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); - if(GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->IsPet()) + if (GetTarget()->GetTypeId() == TYPEID_PLAYER || ((Creature*)GetTarget())->IsPet()) GetTarget()->ApplyStatBuffMod(Stats(i), float(m_modifier.m_amount), apply); } } @@ -5748,14 +5748,14 @@ void Aura::HandleModPercentStat(bool apply, bool /*Real*/) for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i) { - if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) + if (m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_modifier.m_amount), apply); } } void Aura::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Magic damage modifiers implemented in Unit::SpellDamageBonusDone @@ -5766,7 +5766,7 @@ void Aura::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool /*Real*/) void Aura::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Recalculate bonus @@ -5775,16 +5775,16 @@ void Aura::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool /*Real*/) void Aura::HandleAuraModDispelResist(bool apply, bool Real) { - if(!Real || !apply) + if (!Real || !apply) return; - if(GetId() == 33206) + if (GetId() == 33206) GetTarget()->CastSpell(GetTarget(), 44416, true, NULL, this, GetCasterGuid()); } void Aura::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Magic damage modifiers implemented in Unit::SpellDamageBonusDone @@ -5795,7 +5795,7 @@ void Aura::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool /*Rea void Aura::HandleModSpellHealingPercentFromAttackPower(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Recalculate bonus @@ -5804,7 +5804,7 @@ void Aura::HandleModSpellHealingPercentFromAttackPower(bool /*apply*/, bool /*Re void Aura::HandleModHealingDone(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // implemented in Unit::SpellHealingBonusDone // this information is for client side only @@ -5819,7 +5819,7 @@ void Aura::HandleModTotalPercentStat(bool apply, bool /*Real*/) return; } - Unit *target = GetTarget(); + Unit* target = GetTarget(); //save current and max HP before applying aura uint32 curHPValue = target->GetHealth(); @@ -5827,11 +5827,11 @@ void Aura::HandleModTotalPercentStat(bool apply, bool /*Real*/) for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++) { - if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) + if (m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1) { target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); - if(target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->IsPet()) - target->ApplyStatPercentBuffMod(Stats(i), float(m_modifier.m_amount), apply ); + if (target->GetTypeId() == TYPEID_PLAYER || ((Creature*)target)->IsPet()) + target->ApplyStatPercentBuffMod(Stats(i), float(m_modifier.m_amount), apply); } } @@ -5846,10 +5846,10 @@ void Aura::HandleModTotalPercentStat(bool apply, bool /*Real*/) void Aura::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - if(m_modifier.m_miscvalue != SPELL_SCHOOL_MASK_NORMAL) + if (m_modifier.m_miscvalue != SPELL_SCHOOL_MASK_NORMAL) { // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update // and include in UpdateResistence same code as in UpdateArmor for aura mod apply. @@ -5871,7 +5871,7 @@ void Aura::HandleAuraModTotalHealthPercentRegen(bool apply, bool /*Real*/) void Aura::HandleAuraModTotalManaPercentRegen(bool apply, bool /*Real*/) { - if(m_modifier.periodictime == 0) + if (m_modifier.periodictime == 0) m_modifier.periodictime = 1000; m_periodicTimer = m_modifier.periodictime; @@ -5880,7 +5880,7 @@ void Aura::HandleAuraModTotalManaPercentRegen(bool apply, bool /*Real*/) void Aura::HandleModRegen(bool apply, bool /*Real*/) // eating { - if(m_modifier.periodictime == 0) + if (m_modifier.periodictime == 0) m_modifier.periodictime = 5000; m_periodicTimer = 5000; @@ -5893,7 +5893,7 @@ void Aura::HandleModPowerRegen(bool apply, bool Real) // drinking return; Powers pt = GetTarget()->getPowerType(); - if(m_modifier.periodictime == 0) + if (m_modifier.periodictime == 0) { // Anger Management (only spell use this aura for rage) if (pt == POWER_RAGE) @@ -5913,7 +5913,7 @@ void Aura::HandleModPowerRegen(bool apply, bool Real) // drinking void Aura::HandleModPowerRegenPCT(bool /*apply*/, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; if (GetTarget()->GetTypeId() != TYPEID_PLAYER) @@ -5927,7 +5927,7 @@ void Aura::HandleModPowerRegenPCT(bool /*apply*/, bool Real) void Aura::HandleModManaRegen(bool /*apply*/, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; if (GetTarget()->GetTypeId() != TYPEID_PLAYER) @@ -5939,7 +5939,7 @@ void Aura::HandleModManaRegen(bool /*apply*/, bool Real) void Aura::HandleComprehendLanguage(bool apply, bool /*Real*/) { - if(apply) + if (apply) GetTarget()->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG); else GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG); @@ -5947,10 +5947,10 @@ void Aura::HandleComprehendLanguage(bool apply, bool /*Real*/) void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); // Special case with temporary increase max/current health - switch(GetId()) + switch (GetId()) { case 12976: // Warrior Last Stand triggered spell case 28726: // Nightmare Seed ( Nightmare Seed ) @@ -5963,9 +5963,9 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) case 55233: // Vampiric Blood case 59465: // Brood Rage (Ahn'Kahet) { - if(Real) + if (Real) { - if(apply) + if (apply) { // Demonic Empowerment (Voidwalker) & Vampiric Blood - special cases, store percent in data // recalculate to full amount at apply for proper remove @@ -5994,17 +5994,17 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) void Aura::HandleAuraModIncreaseMaxHealth(bool apply, bool /*Real*/) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); uint32 oldhealth = target->GetHealth(); double healthPercentage = (double)oldhealth / (double)target->GetMaxHealth(); target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); // refresh percentage - if(oldhealth > 0) + if (oldhealth > 0) { uint32 newhealth = uint32(ceil((double)target->GetMaxHealth() * healthPercentage)); - if(newhealth==0) + if (newhealth==0) newhealth = 1; target->SetHealth(newhealth); @@ -6013,9 +6013,9 @@ void Aura::HandleAuraModIncreaseMaxHealth(bool apply, bool /*Real*/) void Aura::HandleAuraModIncreaseEnergy(bool apply, bool Real) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); Powers powerType = target->getPowerType(); - if(int32(powerType) != m_modifier.m_miscvalue) + if (int32(powerType) != m_modifier.m_miscvalue) return; UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType); @@ -6023,7 +6023,7 @@ void Aura::HandleAuraModIncreaseEnergy(bool apply, bool Real) // Special case with temporary increase max/current power (percent) if (GetId()==64904) // Hymn of Hope { - if(Real) + if (Real) { uint32 val = target->GetPower(powerType); target->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply); @@ -6039,7 +6039,7 @@ void Aura::HandleAuraModIncreaseEnergy(bool apply, bool Real) void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool /*Real*/) { Powers powerType = GetTarget()->getPowerType(); - if(int32(powerType) != m_modifier.m_miscvalue) + if (int32(powerType) != m_modifier.m_miscvalue) return; UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType); @@ -6049,7 +6049,7 @@ void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool /*Real*/) void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool /*Real*/) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply); @@ -6077,7 +6077,7 @@ void Aura::HandleAuraIncreaseBaseHealthPercent(bool apply, bool /*Real*/) void Aura::HandleAuraModParryPercent(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())->UpdateParryPercentage(); @@ -6085,7 +6085,7 @@ void Aura::HandleAuraModParryPercent(bool /*apply*/, bool /*Real*/) void Aura::HandleAuraModDodgePercent(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())->UpdateDodgePercentage(); @@ -6094,7 +6094,7 @@ void Aura::HandleAuraModDodgePercent(bool /*apply*/, bool /*Real*/) void Aura::HandleAuraModBlockPercent(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())->UpdateBlockPercentage(); @@ -6104,10 +6104,10 @@ void Aura::HandleAuraModBlockPercent(bool /*apply*/, bool /*Real*/) void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())->UpdateManaRegen(); @@ -6115,16 +6115,16 @@ void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real) void Aura::HandleAuraModCritPercent(bool apply, bool Real) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); - if(target->GetTypeId() != TYPEID_PLAYER) + if (target->GetTypeId() != TYPEID_PLAYER) return; // apply item specific bonuses for already equipped weapon - if(Real) + if (Real) { - for(int i = 0; i < MAX_ATTACK; ++i) - if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) + for (int i = 0; i < MAX_ATTACK; ++i) + if (Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) ((Player*)target)->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply); } @@ -6134,9 +6134,9 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real) if (GetSpellProto()->EquippedItemClass == -1) { - ((Player*)target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); - ((Player*)target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); - ((Player*)target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float(m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float(m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float(m_modifier.m_amount), apply); } else { @@ -6146,9 +6146,9 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real) void Aura::HandleModHitChance(bool apply, bool /*Real*/) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); - if(target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) { ((Player*)target)->UpdateMeleeHitChances(); ((Player*)target)->UpdateRangedHitChances(); @@ -6162,7 +6162,7 @@ void Aura::HandleModHitChance(bool apply, bool /*Real*/) void Aura::HandleModSpellHitChance(bool apply, bool /*Real*/) { - if(GetTarget()->GetTypeId() == TYPEID_PLAYER) + if (GetTarget()->GetTypeId() == TYPEID_PLAYER) { ((Player*)GetTarget())->UpdateSpellHitChances(); } @@ -6175,10 +6175,10 @@ void Aura::HandleModSpellHitChance(bool apply, bool /*Real*/) void Aura::HandleModSpellCritChance(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - if(GetTarget()->GetTypeId() == TYPEID_PLAYER) + if (GetTarget()->GetTypeId() == TYPEID_PLAYER) { ((Player*)GetTarget())->UpdateAllSpellCritChances(); } @@ -6191,13 +6191,13 @@ void Aura::HandleModSpellCritChance(bool apply, bool Real) void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - for(int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school) + for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school) if (m_modifier.m_miscvalue & (1<UpdateSpellCritChance(school); } @@ -6213,7 +6213,7 @@ void Aura::HandleModCastingSpeed(bool apply, bool /*Real*/) void Aura::HandleModMeleeRangedSpeedPct(bool apply, bool /*Real*/) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply); target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply); target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); @@ -6221,7 +6221,7 @@ void Aura::HandleModMeleeRangedSpeedPct(bool apply, bool /*Real*/) void Aura::HandleModCombatSpeedPct(bool apply, bool /*Real*/) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); target->ApplyCastTimePercentMod(float(m_modifier.m_amount), apply); target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply); target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply); @@ -6235,7 +6235,7 @@ void Aura::HandleModAttackSpeed(bool apply, bool /*Real*/) void Aura::HandleModMeleeSpeedPct(bool apply, bool /*Real*/) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply); target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply); } @@ -6247,7 +6247,7 @@ void Aura::HandleAuraModRangedHaste(bool apply, bool /*Real*/) void Aura::HandleRangedAmmoHaste(bool apply, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; GetTarget()->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply); } @@ -6263,7 +6263,7 @@ void Aura::HandleAuraModAttackPower(bool apply, bool /*Real*/) void Aura::HandleAuraModRangedAttackPower(bool apply, bool /*Real*/) { - if((GetTarget()->getClassMask() & CLASSMASK_WAND_USERS)!=0) + if ((GetTarget()->getClassMask() & CLASSMASK_WAND_USERS)!=0) return; GetTarget()->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); @@ -6277,7 +6277,7 @@ void Aura::HandleAuraModAttackPowerPercent(bool apply, bool /*Real*/) void Aura::HandleAuraModRangedAttackPowerPercent(bool apply, bool /*Real*/) { - if((GetTarget()->getClassMask() & CLASSMASK_WAND_USERS)!=0) + if ((GetTarget()->getClassMask() & CLASSMASK_WAND_USERS)!=0) return; //UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1 @@ -6287,33 +6287,33 @@ void Aura::HandleAuraModRangedAttackPowerPercent(bool apply, bool /*Real*/) void Aura::HandleAuraModRangedAttackPowerOfStatPercent(bool /*apply*/, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; // Recalculate bonus - if(GetTarget()->GetTypeId() == TYPEID_PLAYER && !(GetTarget()->getClassMask() & CLASSMASK_WAND_USERS)) + if (GetTarget()->GetTypeId() == TYPEID_PLAYER && !(GetTarget()->getClassMask() & CLASSMASK_WAND_USERS)) ((Player*)GetTarget())->UpdateAttackPowerAndDamage(true); } void Aura::HandleAuraModAttackPowerOfStatPercent(bool /*apply*/, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; // Recalculate bonus - if(GetTarget()->GetTypeId() == TYPEID_PLAYER) + if (GetTarget()->GetTypeId() == TYPEID_PLAYER) ((Player*)GetTarget())->UpdateAttackPowerAndDamage(false); } void Aura::HandleAuraModAttackPowerOfArmor(bool /*apply*/, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; // Recalculate bonus - if(GetTarget()->GetTypeId() == TYPEID_PLAYER) + if (GetTarget()->GetTypeId() == TYPEID_PLAYER) ((Player*)GetTarget())->UpdateAttackPowerAndDamage(false); } /********************************/ @@ -6321,13 +6321,13 @@ void Aura::HandleAuraModAttackPowerOfArmor(bool /*apply*/, bool Real) /********************************/ void Aura::HandleModDamageDone(bool apply, bool Real) { - Unit *target = GetTarget(); + Unit* target = GetTarget(); // apply item specific bonuses for already equipped weapon - if(Real && target->GetTypeId() == TYPEID_PLAYER) + if (Real && target->GetTypeId() == TYPEID_PLAYER) { - for(int i = 0; i < MAX_ATTACK; ++i) - if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) + for (int i = 0; i < MAX_ATTACK; ++i) + if (Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) ((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply); } @@ -6340,7 +6340,7 @@ void Aura::HandleModDamageDone(bool apply, bool Real) // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask // m_modifier.m_miscvalue comparison with item generated damage types - if((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) != 0) + if ((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) != 0) { // apply generic physical damage bonuses including wand case if (GetSpellProto()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER) @@ -6354,9 +6354,9 @@ void Aura::HandleModDamageDone(bool apply, bool Real) // done in Player::_ApplyWeaponDependentAuraMods } - if(target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) { - if(m_positive) + if (m_positive) target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, m_modifier.m_amount, apply); else target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG, m_modifier.m_amount, apply); @@ -6364,10 +6364,10 @@ void Aura::HandleModDamageDone(bool apply, bool Real) } // Skip non magic case for speedup - if((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_MAGIC) == 0) + if ((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_MAGIC) == 0) return; - if( GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0 ) + if (GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0) { // wand magic case (skip generic to all item spell bonuses) // done in Player::_ApplyWeaponDependentAuraMods @@ -6378,26 +6378,26 @@ void Aura::HandleModDamageDone(bool apply, bool Real) // Magic damage modifiers implemented in Unit::SpellDamageBonusDone // This information for client side use only - if(target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) { - if(m_positive) + if (m_positive) { - for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) + for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) { - if((m_modifier.m_miscvalue & (1<ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, m_modifier.m_amount, apply); } } else { - for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) + for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) { - if((m_modifier.m_miscvalue & (1<ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + i, m_modifier.m_amount, apply); } } Pet* pet = target->GetPet(); - if(pet) + if (pet) pet->UpdateAttackPowerAndDamage(); } } @@ -6405,13 +6405,13 @@ void Aura::HandleModDamageDone(bool apply, bool Real) void Aura::HandleModDamagePercentDone(bool apply, bool Real) { DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "AURA MOD DAMAGE type:%u negative:%u", m_modifier.m_miscvalue, m_positive ? 0 : 1); - Unit *target = GetTarget(); + Unit* target = GetTarget(); // apply item specific bonuses for already equipped weapon - if(Real && target->GetTypeId() == TYPEID_PLAYER) + if (Real && target->GetTypeId() == TYPEID_PLAYER) { - for(int i = 0; i < MAX_ATTACK; ++i) - if(Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) + for (int i = 0; i < MAX_ATTACK; ++i) + if (Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i),true,false)) ((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply); } @@ -6424,7 +6424,7 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) // with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask // m_modifier.m_miscvalue comparison with item generated damage types - if((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) != 0) + if ((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) != 0) { // apply generic physical damage bonuses including wand case if (GetSpellProto()->EquippedItemClass == -1 || target->GetTypeId() != TYPEID_PLAYER) @@ -6438,15 +6438,15 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) // done in Player::_ApplyWeaponDependentAuraMods } // For show in client - if(target->GetTypeId() == TYPEID_PLAYER) + if (target->GetTypeId() == TYPEID_PLAYER) target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, m_modifier.m_amount/100.0f, apply); } // Skip non magic case for speedup - if((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_MAGIC) == 0) + if ((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_MAGIC) == 0) return; - if( GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0 ) + if (GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0) { // wand magic case (skip generic to all item spell bonuses) // done in Player::_ApplyWeaponDependentAuraMods @@ -6457,15 +6457,15 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) // Magic damage percent modifiers implemented in Unit::SpellDamageBonusDone // Send info to client - if(target->GetTypeId() == TYPEID_PLAYER) - for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) + if (target->GetTypeId() == TYPEID_PLAYER) + for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT + i, m_modifier.m_amount/100.0f, apply); } void Aura::HandleModOffhandDamagePercent(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "AURA MOD OFFHAND DAMAGE"); @@ -6480,38 +6480,38 @@ void Aura::HandleModOffhandDamagePercent(bool apply, bool Real) void Aura::HandleModPowerCostPCT(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; float amount = m_modifier.m_amount/100.0f; - for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) - if(m_modifier.m_miscvalue & (1<ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + i, amount, apply); } void Aura::HandleModPowerCost(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - for(int i = 0; i < MAX_SPELL_SCHOOL; ++i) - if(m_modifier.m_miscvalue & (1<ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + i, m_modifier.m_amount, apply); } void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); - if(target->GetTypeId() != TYPEID_PLAYER) + Unit* target = GetTarget(); + if (target->GetTypeId() != TYPEID_PLAYER) return; ClassFamilyMask mask; Unit::AuraList const& noReagent = target->GetAurasByType(SPELL_AURA_NO_REAGENT_USE); - for(Unit::AuraList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i) + for (Unit::AuraList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i) mask |= (*i)->GetAuraSpellClassMask(); target->SetUInt64Value(PLAYER_NO_REAGENT_COST_1+0, mask.Flags); @@ -6531,9 +6531,9 @@ void Aura::HandleShapeshiftBoosts(bool apply) ShapeshiftForm form = ShapeshiftForm(GetModifier()->m_miscvalue); - Unit *target = GetTarget(); + Unit* target = GetTarget(); - switch(form) + switch (form) { case FORM_CAT: spellId1 = 3025; @@ -6596,7 +6596,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) case FORM_SHADOW: spellId1 = 49868; - if(target->GetTypeId() == TYPEID_PLAYER) // Spell 49868 have same category as main form spell and share cooldown + if (target->GetTypeId() == TYPEID_PLAYER) // Spell 49868 have same category as main form spell and share cooldown ((Player*)target)->RemoveSpellCooldown(49868); break; case FORM_GHOSTWOLF: @@ -6610,21 +6610,21 @@ void Aura::HandleShapeshiftBoosts(bool apply) break; } - if(apply) + if (apply) { if (spellId1) - target->CastSpell(target, spellId1, true, NULL, this ); + target->CastSpell(target, spellId1, true, NULL, this); if (spellId2) target->CastSpell(target, spellId2, true, NULL, this); if (target->GetTypeId() == TYPEID_PLAYER) { - const PlayerSpellMap& sp_list = ((Player *)target)->GetSpellMap(); + const PlayerSpellMap& sp_list = ((Player*)target)->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { if (itr->second.state == PLAYERSPELL_REMOVED) continue; if (itr->first==spellId1 || itr->first==spellId2) continue; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); if (!spellInfo || !IsNeedCastSpellAtFormApply(spellInfo, form)) continue; target->CastSpell(target, itr->first, true, NULL, this); @@ -6633,9 +6633,9 @@ void Aura::HandleShapeshiftBoosts(bool apply) Unit::SpellAuraHolderMap& tAuras = target->GetSpellAuraHolderMap(); for (Unit::SpellAuraHolderMap::iterator itr = tAuras.begin(); itr != tAuras.end();) { - SpellEntry const *spellInfo = itr->second->GetSpellProto(); + SpellEntry const* spellInfo = itr->second->GetSpellProto(); if (itr->second->IsPassive() && spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) - && (spellInfo->StancesNot & (1<<(form-1)))) + && (spellInfo->StancesNot & (1<<(form-1)))) { target->RemoveAurasDueToSpell(itr->second->GetId()); itr = tAuras.begin(); @@ -6649,7 +6649,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) if (MasterShaperSpellId) { Unit::AuraList const& ShapeShifterAuras = target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = ShapeShifterAuras.begin(); i != ShapeShifterAuras.end(); ++i) + for (Unit::AuraList::const_iterator i = ShapeShifterAuras.begin(); i != ShapeShifterAuras.end(); ++i) { if ((*i)->GetSpellProto()->SpellIconID == 2851) { @@ -6663,7 +6663,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) // Leader of the Pack if (((Player*)target)->HasSpell(17007)) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(24932); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(24932); if (spellInfo && spellInfo->Stances & (1<<(form-1))) target->CastSpell(target, 24932, true, NULL, this); } @@ -6679,7 +6679,7 @@ void Aura::HandleShapeshiftBoosts(bool apply) for (Unit::AuraList::const_iterator i = modAuras.begin(); i != modAuras.end(); ++i) { if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && - (*i)->GetSpellProto()->SpellIconID == 961) + (*i)->GetSpellProto()->SpellIconID == 961) { int32 bp = (*i)->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_2); if (bp) @@ -6693,23 +6693,23 @@ void Aura::HandleShapeshiftBoosts(bool apply) if (form == FORM_MOONKIN) { Unit::AuraList const& dummyAuras = target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i) + for (Unit::AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i) { if ((*i)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_DRUID && - (*i)->GetSpellProto()->SpellIconID == 2855) + (*i)->GetSpellProto()->SpellIconID == 2855) { uint32 spell_id = 0; - switch((*i)->GetId()) + switch ((*i)->GetId()) { - case 48384:spell_id=50170;break;//Rank 1 - case 48395:spell_id=50171;break;//Rank 2 - case 48396:spell_id=50172;break;//Rank 3 + case 48384:spell_id=50170; break; //Rank 1 + case 48395:spell_id=50171; break; //Rank 2 + case 48396:spell_id=50172; break; //Rank 3 default: sLog.outError("Aura::HandleShapeshiftBoosts: Not handled rank of IMF (Spell: %u)",(*i)->GetId()); break; } - if(spell_id) + if (spell_id) target->CastSpell(target, spell_id, true, NULL, this); break; } @@ -6720,12 +6720,12 @@ void Aura::HandleShapeshiftBoosts(bool apply) if (HotWSpellId) { Unit::AuraList const& mModTotalStatPct = target->GetAurasByType(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE); - for(Unit::AuraList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i) + for (Unit::AuraList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i) { if ((*i)->GetSpellProto()->SpellIconID == 240 && (*i)->GetModifier()->m_miscvalue == 3) { int32 HotWMod = (*i)->GetModifier()->m_amount; - if(GetModifier()->m_miscvalue == FORM_CAT) + if (GetModifier()->m_miscvalue == FORM_CAT) HotWMod /= 2; target->CastCustomSpell(target, HotWSpellId, &HotWMod, NULL, NULL, true, NULL, this); @@ -6737,22 +6737,22 @@ void Aura::HandleShapeshiftBoosts(bool apply) } else { - if(spellId1) + if (spellId1) target->RemoveAurasDueToSpell(spellId1); - if(spellId2) + if (spellId2) target->RemoveAurasDueToSpell(spellId2); - if(MasterShaperSpellId) + if (MasterShaperSpellId) target->RemoveAurasDueToSpell(MasterShaperSpellId); if (target->GetTypeId() == TYPEID_PLAYER) { // re-apply passive spells that don't need shapeshift but were inactive in current form: - const PlayerSpellMap& sp_list = ((Player *)target)->GetSpellMap(); + const PlayerSpellMap& sp_list = ((Player*)target)->GetSpellMap(); for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) { if (itr->second.state == PLAYERSPELL_REMOVED) continue; if (itr->first==spellId1 || itr->first==spellId2) continue; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); if (!spellInfo || !IsPassiveSpell(spellInfo)) continue; if (spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && (spellInfo->StancesNot & (1<<(form-1)))) @@ -6776,17 +6776,17 @@ void Aura::HandleShapeshiftBoosts(bool apply) void Aura::HandleAuraEmpathy(bool apply, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_UNIT) + if (GetTarget()->GetTypeId() != TYPEID_UNIT) return; - CreatureInfo const * ci = ObjectMgr::GetCreatureTemplate(GetTarget()->GetEntry()); - if(ci && ci->type == CREATURE_TYPE_BEAST) + CreatureInfo const* ci = ObjectMgr::GetCreatureTemplate(GetTarget()->GetEntry()); + if (ci && ci->type == CREATURE_TYPE_BEAST) GetTarget()->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply); } void Aura::HandleAuraUntrackable(bool apply, bool /*Real*/) { - if(apply) + if (apply) GetTarget()->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE); else GetTarget()->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE); @@ -6808,10 +6808,10 @@ void Aura::HandleAuraModPacifyAndSilence(bool apply, bool Real) void Aura::HandleAuraGhost(bool apply, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - if(apply) + if (apply) { GetTarget()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST); } @@ -6824,12 +6824,12 @@ void Aura::HandleAuraGhost(bool apply, bool /*Real*/) void Aura::HandleAuraAllowFlight(bool apply, bool Real) { // all applied/removed only at real aura add/remove - if(!Real) + if (!Real) return; // allow fly WorldPacket data; - if(apply) + if (apply) data.Initialize(SMSG_MOVE_SET_CAN_FLY, 12); else data.Initialize(SMSG_MOVE_UNSET_CAN_FLY, 12); @@ -6841,10 +6841,10 @@ void Aura::HandleAuraAllowFlight(bool apply, bool Real) void Aura::HandleModRating(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating) @@ -6855,10 +6855,10 @@ void Aura::HandleModRating(bool apply, bool Real) void Aura::HandleModRatingFromStat(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; // Just recalculate ratings for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating) @@ -6868,10 +6868,10 @@ void Aura::HandleModRatingFromStat(bool apply, bool Real) void Aura::HandleForceMoveForward(bool apply, bool Real) { - if(!Real) + if (!Real) return; - if(apply) + if (apply) GetTarget()->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE); else GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE); @@ -6879,7 +6879,7 @@ void Aura::HandleForceMoveForward(bool apply, bool Real) void Aura::HandleAuraModExpertise(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())->UpdateExpertise(BASE_ATTACK); @@ -6889,9 +6889,9 @@ void Aura::HandleAuraModExpertise(bool /*apply*/, bool /*Real*/) void Aura::HandleModTargetResistance(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); // applied to damage as HandleNoImmediateEffect in Unit::CalculateAbsorbAndResist and Unit::CalcArmorReducedDamage // show armor penetration if (target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)) @@ -6905,23 +6905,23 @@ void Aura::HandleModTargetResistance(bool apply, bool Real) void Aura::HandleShieldBlockValue(bool apply, bool /*Real*/) { BaseModType modType = FLAT_MOD; - if(m_modifier.m_auraname == SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT) + if (m_modifier.m_auraname == SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT) modType = PCT_MOD; - if(GetTarget()->GetTypeId() == TYPEID_PLAYER) + if (GetTarget()->GetTypeId() == TYPEID_PLAYER) ((Player*)GetTarget())->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(m_modifier.m_amount), apply); } void Aura::HandleAuraRetainComboPoints(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - Player *target = (Player*)GetTarget(); + Player* target = (Player*)GetTarget(); // combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler // remove only if aura expire by time (in case combo points amount change aura removed without combo points lost) @@ -6930,34 +6930,34 @@ void Aura::HandleAuraRetainComboPoints(bool apply, bool Real) target->AddComboPoints(unit, -m_modifier.m_amount); } -void Aura::HandleModUnattackable( bool Apply, bool Real ) +void Aura::HandleModUnattackable(bool Apply, bool Real) { - if(Real && Apply) - { + if (Real && Apply) + { GetTarget()->CombatStop(); GetTarget()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION); - } + } GetTarget()->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE,Apply); } -void Aura::HandleSpiritOfRedemption( bool apply, bool Real ) +void Aura::HandleSpiritOfRedemption(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); // prepare spirit state - if(apply) + if (apply) { - if(target->GetTypeId()==TYPEID_PLAYER) + if (target->GetTypeId()==TYPEID_PLAYER) { // disable breath/etc timers ((Player*)target)->StopMirrorTimers(); // set stand state (expected in this form) - if(!target->IsStandState()) + if (!target->IsStandState()) target->SetStandState(UNIT_STAND_STATE_STAND); } @@ -6970,14 +6970,14 @@ void Aura::HandleSpiritOfRedemption( bool apply, bool Real ) void Aura::HandleSchoolAbsorb(bool apply, bool Real) { - if(!Real) + if (!Real) return; Unit* caster = GetCaster(); - if(!caster) + if (!caster) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); SpellEntry const* spellProto = GetSpellProto(); if (apply) { @@ -6985,7 +6985,7 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) if (target->GetTypeId()!=TYPEID_PLAYER || !((Player*)target)->GetSession()->PlayerLoading()) { float DoneActualBenefit = 0.0f; - switch(spellProto->SpellFamilyName) + switch (spellProto->SpellFamilyName) { case SPELLFAMILY_GENERIC: // Stoicism @@ -7000,10 +7000,10 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) DoneActualBenefit = caster->SpellBaseHealingBonusDone(GetSpellSchoolMask(spellProto)) * 0.8068f; //Borrowed Time Unit::AuraList const& borrowedTime = caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = borrowedTime.begin(); itr != borrowedTime.end(); ++itr) + for (Unit::AuraList::const_iterator itr = borrowedTime.begin(); itr != borrowedTime.end(); ++itr) { SpellEntry const* i_spell = (*itr)->GetSpellProto(); - if(i_spell->SpellFamilyName==SPELLFAMILY_PRIEST && i_spell->SpellIconID == 2899 && i_spell->EffectMiscValue[(*itr)->GetEffIndex()] == 24) + if (i_spell->SpellFamilyName==SPELLFAMILY_PRIEST && i_spell->SpellIconID == 2899 && i_spell->EffectMiscValue[(*itr)->GetEffIndex()] == 24) { DoneActualBenefit += DoneActualBenefit * (*itr)->GetModifier()->m_amount / 100; break; @@ -7049,21 +7049,21 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) else { if (caster && - // Power Word: Shield - spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->Mechanic == MECHANIC_SHIELD && - (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001)) && - // completely absorbed or dispelled - (m_removeMode == AURA_REMOVE_BY_SHIELD_BREAK || m_removeMode == AURA_REMOVE_BY_DISPEL)) + // Power Word: Shield + spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->Mechanic == MECHANIC_SHIELD && + (spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001)) && + // completely absorbed or dispelled + (m_removeMode == AURA_REMOVE_BY_SHIELD_BREAK || m_removeMode == AURA_REMOVE_BY_DISPEL)) { Unit::AuraList const& vDummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr) { SpellEntry const* vSpell = (*itr)->GetSpellProto(); // Rapture (main spell) - if(vSpell->SpellFamilyName == SPELLFAMILY_PRIEST && vSpell->SpellIconID == 2894 && vSpell->Effect[EFFECT_INDEX_1]) + if (vSpell->SpellFamilyName == SPELLFAMILY_PRIEST && vSpell->SpellIconID == 2894 && vSpell->Effect[EFFECT_INDEX_1]) { - switch((*itr)->GetEffIndex()) + switch ((*itr)->GetEffIndex()) { case EFFECT_INDEX_0: { @@ -7079,7 +7079,7 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) if (!roll_chance_i((*itr)->GetModifier()->m_amount) || caster->HasAura(63853)) break; - switch(target->getPowerType()) + switch (target->getPowerType()) { case POWER_RUNIC_POWER: target->CastSpell(target, 63652, true, NULL, NULL, GetCasterGuid()); @@ -7088,11 +7088,11 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) target->CastSpell(target, 63653, true, NULL, NULL, GetCasterGuid()); break; case POWER_MANA: - { - int32 basepoints0 = target->GetMaxPower(POWER_MANA) * 2 / 100; - target->CastCustomSpell(target, 63654, &basepoints0, NULL, NULL, true); - break; - } + { + int32 basepoints0 = target->GetMaxPower(POWER_MANA) * 2 / 100; + target->CastCustomSpell(target, 63654, &basepoints0, NULL, NULL, true); + break; + } case POWER_ENERGY: target->CastSpell(target, 63655, true, NULL, NULL, GetCasterGuid()); break; @@ -7116,10 +7116,10 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real) void Aura::PeriodicTick() { - Unit *target = GetTarget(); + Unit* target = GetTarget(); SpellEntry const* spellProto = GetSpellProto(); - switch(m_modifier.m_auraname) + switch (m_modifier.m_auraname) { case SPELL_AURA_PERIODIC_DAMAGE: case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: @@ -7128,28 +7128,28 @@ void Aura::PeriodicTick() if (!target->isAlive()) return; - Unit *pCaster = GetCaster(); - if(!pCaster) + Unit* pCaster = GetCaster(); + if (!pCaster) return; - if( spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) + if (spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && + pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) return; // Check for immune (not use charges) - if(target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) + if (target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; // some auras remove at specific health level or more - if(m_modifier.m_auraname == SPELL_AURA_PERIODIC_DAMAGE) + if (m_modifier.m_auraname == SPELL_AURA_PERIODIC_DAMAGE) { - switch(GetId()) + switch (GetId()) { case 43093: case 31956: case 38801: case 35321: case 38363: case 39215: case 48920: { - if(target->GetHealth() == target->GetMaxHealth() ) + if (target->GetHealth() == target->GetMaxHealth()) { target->RemoveAurasDueToSpell(GetId()); return; @@ -7162,7 +7162,7 @@ void Aura::PeriodicTick() GetEffIndex() < EFFECT_INDEX_2 && spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_DUMMY ? pCaster->CalculateSpellDamage(target, spellProto, SpellEffectIndex(GetEffIndex() + 1)) : 100; - if(target->GetHealth() * 100 >= target->GetMaxHealth() * percent ) + if (target->GetHealth() * 100 >= target->GetMaxHealth() * percent) { target->RemoveAurasDueToSpell(GetId()); return; @@ -7176,20 +7176,20 @@ void Aura::PeriodicTick() uint32 absorb = 0; uint32 resist = 0; - CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL ); + CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL); // ignore non positive values (can be result apply spellmods to aura damage uint32 amount = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; uint32 pdamage; - if(m_modifier.m_auraname == SPELL_AURA_PERIODIC_DAMAGE) + if (m_modifier.m_auraname == SPELL_AURA_PERIODIC_DAMAGE) pdamage = amount; else pdamage = uint32(target->GetMaxHealth()*amount/100); // SpellDamageBonus for magic spells - if(spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellProto->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) + if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE || spellProto->DmgClass == SPELL_DAMAGE_CLASS_MAGIC) pdamage = target->SpellDamageBonusTaken(pCaster, spellProto, pdamage, DOT, GetStackAmount()); // MeleeDamagebonus for weapon based spells else @@ -7201,7 +7201,7 @@ void Aura::PeriodicTick() // Calculate armor mitigation if it is a physical spell // But not for bleed mechanic spells if (GetSpellSchoolMask(spellProto) & SPELL_SCHOOL_MASK_NORMAL && - GetEffectMechanic(spellProto, m_effIndex) != MECHANIC_BLEED) + GetEffectMechanic(spellProto, m_effIndex) != MECHANIC_BLEED) { uint32 pdamageReductedArmor = pCaster->CalcArmorReducedDamage(target, pdamage); cleanDamage.damage += pdamage - pdamageReductedArmor; @@ -7215,7 +7215,7 @@ void Aura::PeriodicTick() if (GetAuraTicks() <= 4) pdamage = pdamage/2; // 9..12 ticks, 3/2 from normal tick damage - else if(GetAuraTicks() >= 9) + else if (GetAuraTicks() >= 9) pdamage += (pdamage + 1) / 2; // +1 prevent 0.5 damage possible lost at 1..4 ticks // 5..8 ticks have normal tick damage } @@ -7239,7 +7239,7 @@ void Aura::PeriodicTick() target->CalculateDamageAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !GetSpellProto()->HasAttribute(SPELL_ATTR_EX2_CANT_REFLECTED)); DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s attacked %s for %u dmg inflicted by %u abs is %u", - GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId(),absorb); + GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId(),absorb); pCaster->DealDamageMods(target, pdamage, &absorb); @@ -7266,8 +7266,8 @@ void Aura::PeriodicTick() { // Only from non-grey units if (roll_chance_i(10) && // 1-2 from drain with final and without glyph, 0-1 from damage - ((Player*)pCaster)->isHonorOrXPTarget(target) && - (target->GetTypeId() != TYPEID_UNIT || ((Player*)pCaster)->isAllowedToLoot((Creature*)target))) + ((Player*)pCaster)->isHonorOrXPTarget(target) && + (target->GetTypeId() != TYPEID_UNIT || ((Player*)pCaster)->isAllowedToLoot((Creature*)target))) { pCaster->CastSpell(pCaster, 43836, true, NULL, this); } @@ -7282,24 +7282,24 @@ void Aura::PeriodicTick() if (!target->isAlive()) return; - Unit *pCaster = GetCaster(); - if(!pCaster) + Unit* pCaster = GetCaster(); + if (!pCaster) return; - if(!pCaster->isAlive()) + if (!pCaster->isAlive()) return; - if( spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) + if (spellProto->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && + pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) return; // Check for immune - if(target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) + if (target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; uint32 absorb=0; uint32 resist=0; - CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL ); + CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL); uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; @@ -7331,7 +7331,7 @@ void Aura::PeriodicTick() target->CalculateDamageAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !spellProto->HasAttribute(SPELL_ATTR_EX2_CANT_REFLECTED)); DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s health leech of %s for %u dmg inflicted by %u abs is %u", - GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId(),absorb); + GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId(),absorb); pCaster->DealDamageMods(target, pdamage, &absorb); @@ -7357,7 +7357,7 @@ void Aura::PeriodicTick() if (spell->m_spellInfo->Id == GetId()) spell->cancel(); - if(Player *modOwner = pCaster->GetSpellModOwner()) + if (Player* modOwner = pCaster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, multiplier); int32 heal = pCaster->SpellHealingBonusTaken(pCaster, spellProto, int32(new_damage * multiplier), DOT, GetStackAmount()); @@ -7376,12 +7376,12 @@ void Aura::PeriodicTick() if (!target->isAlive()) return; - Unit *pCaster = GetCaster(); - if(!pCaster) + Unit* pCaster = GetCaster(); + if (!pCaster) return; // heal for caster damage (must be alive) - if(target != pCaster && spellProto->SpellVisual[0] == 163 && !pCaster->isAlive()) + if (target != pCaster && spellProto->SpellVisual[0] == 163 && !pCaster->isAlive()) return; // ignore non positive values (can be result apply spellmods to aura damage @@ -7389,7 +7389,7 @@ void Aura::PeriodicTick() uint32 pdamage; - if(m_modifier.m_auraname==SPELL_AURA_OBS_MOD_HEALTH) + if (m_modifier.m_auraname==SPELL_AURA_OBS_MOD_HEALTH) pdamage = uint32(target->GetMaxHealth() * amount / 100); else { @@ -7404,7 +7404,7 @@ void Aura::PeriodicTick() if (GetAuraTicks() != 1) // Item - Druid T10 Restoration 2P Bonus - if (Aura *aura = pCaster->GetAura(70658, EFFECT_INDEX_0)) + if (Aura* aura = pCaster->GetAura(70658, EFFECT_INDEX_0)) addition += abs(int32((addition * aura->GetModifier()->m_amount) / ((ticks-1)* 100))); pdamage = int32(pdamage) + addition; @@ -7421,7 +7421,7 @@ void Aura::PeriodicTick() pdamage -= absorbHeal; DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s heal of %s for %u health (absorbed %u) inflicted by %u", - GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, absorbHeal, GetId()); + GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, absorbHeal, GetId()); int32 gain = target->ModifyHealth(pdamage); SpellPeriodicAuraLogInfo pInfo(this, pdamage, (pdamage - uint32(gain)), absorbHeal, 0, 0.0f, isCrit); @@ -7434,17 +7434,17 @@ void Aura::PeriodicTick() pCaster->ProcDamageAndSpell(target, procAttacker, procVictim, procEx, gain, BASE_ATTACK, spellProto); // add HoTs to amount healed in bgs - if( pCaster->GetTypeId() == TYPEID_PLAYER ) - if( BattleGround *bg = ((Player*)pCaster)->GetBattleGround() ) + if (pCaster->GetTypeId() == TYPEID_PLAYER) + if (BattleGround* bg = ((Player*)pCaster)->GetBattleGround()) bg->UpdatePlayerScore(((Player*)pCaster), SCORE_HEALING_DONE, gain); target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); // heal for caster damage - if(target != pCaster && spellProto->SpellVisual[0] == 163) + if (target != pCaster && spellProto->SpellVisual[0] == 163) { uint32 dmg = spellProto->manaPerSecond; - if(pCaster->GetHealth() <= dmg && pCaster->GetTypeId()==TYPEID_PLAYER) + if (pCaster->GetHealth() <= dmg && pCaster->GetTypeId()==TYPEID_PLAYER) { pCaster->RemoveAurasDueToSpell(GetId()); @@ -7459,7 +7459,7 @@ void Aura::PeriodicTick() pCaster->DealDamageMods(pCaster, damage, &absorb); pCaster->SendSpellNonMeleeDamageLog(pCaster, GetId(), damage, GetSpellSchoolMask(spellProto), absorb, 0, false, 0, false); - CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL ); + CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL); pCaster->DealDamage(pCaster, damage, &cleanDamage, NODAMAGE, GetSpellSchoolMask(spellProto), spellProto, true); } } @@ -7494,7 +7494,7 @@ void Aura::PeriodicTick() return; if (GetSpellProto()->Effect[GetEffIndex()] == SPELL_EFFECT_PERSISTENT_AREA_AURA && - pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) + pCaster->SpellHitResult(target, spellProto, false) != SPELL_MISS_NONE) return; // Check for immune (not use charges) @@ -7516,7 +7516,7 @@ void Aura::PeriodicTick() } DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s power leech of %s for %u dmg inflicted by %u", - GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); + GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); int32 drain_amount = target->GetPower(power) > pdamage ? pdamage : target->GetPower(power); @@ -7532,7 +7532,7 @@ void Aura::PeriodicTick() { gain_multiplier = spellProto->EffectMultipleValue[GetEffIndex()]; - if (Player *modOwner = pCaster->GetSpellModOwner()) + if (Player* modOwner = pCaster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), SPELLMOD_MULTIPLE_VALUE, gain_multiplier); } @@ -7598,14 +7598,14 @@ void Aura::PeriodicTick() uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s energize %s for %u dmg inflicted by %u", - GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); + GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); - if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS) + if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS) break; Powers power = Powers(m_modifier.m_miscvalue); - if(target->GetMaxPower(power) == 0) + if (target->GetMaxPower(power) == 0) break; SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, 0, 0, 0.0f); @@ -7613,7 +7613,7 @@ void Aura::PeriodicTick() int32 gain = target->ModifyPower(power,pdamage); - if(Unit* pCaster = GetCaster()) + if (Unit* pCaster = GetCaster()) target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); break; } @@ -7629,9 +7629,9 @@ void Aura::PeriodicTick() uint32 pdamage = uint32(target->GetMaxPower(POWER_MANA) * amount / 100); DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s energize %s for %u mana inflicted by %u", - GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); + GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId()); - if(target->GetMaxPower(POWER_MANA) == 0) + if (target->GetMaxPower(POWER_MANA) == 0) break; SpellPeriodicAuraLogInfo pInfo(this, pdamage, 0, 0, 0, 0.0f); @@ -7639,7 +7639,7 @@ void Aura::PeriodicTick() int32 gain = target->ModifyPower(POWER_MANA, pdamage); - if(Unit* pCaster = GetCaster()) + if (Unit* pCaster = GetCaster()) target->getHostileRefManager().threatAssist(pCaster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); break; } @@ -7649,19 +7649,19 @@ void Aura::PeriodicTick() if (!target->isAlive()) return; - Unit *pCaster = GetCaster(); - if(!pCaster) + Unit* pCaster = GetCaster(); + if (!pCaster) return; // Check for immune (not use charges) - if(target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) + if (target->IsImmunedToDamage(GetSpellSchoolMask(spellProto))) return; int32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0; Powers powerType = Powers(m_modifier.m_miscvalue); - if(!target->isAlive() || target->getPowerType() != powerType) + if (!target->isAlive() || target->getPowerType() != powerType) return; // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) @@ -7701,7 +7701,7 @@ void Aura::PeriodicTick() return; int32 gain = target->ModifyHealth(m_modifier.m_amount); - if (Unit *caster = GetCaster()) + if (Unit* caster = GetCaster()) target->getHostileRefManager().threatAssist(caster, float(gain) * 0.5f * sSpellMgr.GetSpellThreatMultiplier(spellProto), spellProto); break; } @@ -7712,15 +7712,15 @@ void Aura::PeriodicTick() return; Powers pt = target->getPowerType(); - if(int32(pt) != m_modifier.m_miscvalue) + if (int32(pt) != m_modifier.m_miscvalue) return; - if ( spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED ) + if (spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED) { // eating anim target->HandleEmoteCommand(EMOTE_ONESHOT_EAT); } - else if( GetId() == 20577 ) + else if (GetId() == 20577) { // cannibalize anim target->HandleEmoteCommand(EMOTE_STATE_CANNIBALIZE); @@ -7729,7 +7729,7 @@ void Aura::PeriodicTick() // Anger Management // amount = 1+ 16 = 17 = 3,4*5 = 10,2*5/3 // so 17 is rounded amount for 5 sec tick grow ~ 1 range grow in 3 sec - if(pt == POWER_RAGE) + if (pt == POWER_RAGE) target->ModifyPower(pt, m_modifier.m_amount * 3 / 5); break; } @@ -7758,14 +7758,14 @@ void Aura::PeriodicTick() void Aura::PeriodicDummyTick() { SpellEntry const* spell = GetSpellProto(); - Unit *target = GetTarget(); + Unit* target = GetTarget(); switch (spell->SpellFamilyName) { case SPELLFAMILY_GENERIC: { switch (spell->Id) { - // Forsaken Skills + // Forsaken Skills case 7054: { // Possibly need cast one of them (but @@ -8004,7 +8004,7 @@ void Aura::PeriodicDummyTick() target->CastSpell(target, 53521, true, NULL, this); return; case 55592: // Clean - switch(urand(0,2)) + switch (urand(0,2)) { case 0: target->CastSpell(target, 55731, true); break; case 1: target->CastSpell(target, 55738, true); break; @@ -8085,10 +8085,10 @@ void Aura::PeriodicDummyTick() // Prey on the Weak if (spell->SpellIconID == 2983) { - Unit *victim = target->getVictim(); + Unit* victim = target->getVictim(); if (victim && (target->GetHealth() * 100 / target->GetMaxHealth() > victim->GetHealth() * 100 / victim->GetMaxHealth())) { - if(!target->HasAura(58670)) + if (!target->HasAura(58670)) { int32 basepoints = GetBasePoints(); target->CastCustomSpell(target, 58670, &basepoints, 0, 0, true); @@ -8110,7 +8110,7 @@ void Aura::PeriodicDummyTick() { switch (spell->Id) { - // Frenzied Regeneration + // Frenzied Regeneration case 22842: { // Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health. @@ -8140,7 +8140,7 @@ void Aura::PeriodicDummyTick() { switch (spell->Id) { - // Killing Spree + // Killing Spree case 51690: { if (target->hasUnitState(UNIT_STAT_STUNNED) || target->isFeared()) @@ -8156,7 +8156,7 @@ void Aura::PeriodicDummyTick() Cell::VisitAllObjects(target, checker, radius); } - if(targets.empty()) + if (targets.empty()) return; Spell::UnitList::const_iterator itr = targets.begin(); @@ -8182,15 +8182,15 @@ void Aura::PeriodicDummyTick() } switch (spell->Id) { - // Harpooner's Mark - // case 40084: - // return; - // Feeding Frenzy Rank 1 & 2 + // Harpooner's Mark + // case 40084: + // return; + // Feeding Frenzy Rank 1 & 2 case 53511: case 53512: { Unit* victim = target->getVictim(); - if( victim && victim->GetHealth() * 100 < victim->GetMaxHealth() * 35 ) + if (victim && victim->GetHealth() * 100 < victim->GetMaxHealth() * 35) target->CastSpell(target, spell->Id == 53511 ? 60096 : 60097, true, NULL, this); return; } @@ -8216,7 +8216,7 @@ void Aura::PeriodicDummyTick() // Death and Decay if (spell->SpellFamilyFlags & UI64LIT(0x0000000000000020)) { - if (Unit *caster = GetCaster()) + if (Unit* caster = GetCaster()) caster->CastCustomSpell(target, 52212, &m_modifier.m_amount, NULL, NULL, true, NULL, this); return; } @@ -8227,11 +8227,11 @@ void Aura::PeriodicDummyTick() if (spell->SpellFamilyFlags & UI64LIT(0x0000400000000000)) { // Get 0 effect aura - Aura *slow = target->GetAura(GetId(), EFFECT_INDEX_0); + Aura* slow = target->GetAura(GetId(), EFFECT_INDEX_0); if (slow) { slow->ApplyModifier(false, true); - Modifier *mod = slow->GetModifier(); + Modifier* mod = slow->GetModifier(); mod->m_amount+= m_modifier.m_amount; if (mod->m_amount > 0) mod->m_amount = 0; slow->ApplyModifier(true, true); @@ -8276,11 +8276,11 @@ void Aura::PeriodicDummyTick() void Aura::HandlePreventFleeing(bool apply, bool Real) { - if(!Real) + if (!Real) return; Unit::AuraList const& fearAuras = GetTarget()->GetAurasByType(SPELL_AURA_MOD_FEAR); - if( !fearAuras.empty() ) + if (!fearAuras.empty()) { if (apply) GetTarget()->SetFeared(false, fearAuras.front()->GetCasterGuid()); @@ -8291,19 +8291,19 @@ void Aura::HandlePreventFleeing(bool apply, bool Real) void Aura::HandleManaShield(bool apply, bool Real) { - if(!Real) + if (!Real) return; // prevent double apply bonuses - if(apply && (GetTarget()->GetTypeId()!=TYPEID_PLAYER || !((Player*)GetTarget())->GetSession()->PlayerLoading())) + if (apply && (GetTarget()->GetTypeId()!=TYPEID_PLAYER || !((Player*)GetTarget())->GetSession()->PlayerLoading())) { - if(Unit* caster = GetCaster()) + if (Unit* caster = GetCaster()) { float DoneActualBenefit = 0.0f; - switch(GetSpellProto()->SpellFamilyName) + switch (GetSpellProto()->SpellFamilyName) { case SPELLFAMILY_MAGE: - if(GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000008000)) + if (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000008000)) { // Mana Shield // +50% from +spd bonus @@ -8352,7 +8352,7 @@ void Aura::HandleArenaPreparation(bool apply, bool Real) */ void Aura::HandleAuraControlVehicle(bool apply, bool Real) { - if(!Real) + if (!Real) return; Unit* target = GetTarget(); @@ -8361,7 +8361,7 @@ void Aura::HandleAuraControlVehicle(bool apply, bool Real) // TODO: Check for free seat - Unit *caster = GetCaster(); + Unit* caster = GetCaster(); if (!caster) return; @@ -8396,7 +8396,7 @@ void Aura::HandleAuraAddMechanicAbilities(bool apply, bool Real) uint16 i_OverrideSetId = GetMiscValue(); - const OverrideSpellDataEntry *spellSet = sOverrideSpellDataStore.LookupEntry(i_OverrideSetId); + const OverrideSpellDataEntry* spellSet = sOverrideSpellDataStore.LookupEntry(i_OverrideSetId); if (!spellSet) return; @@ -8422,7 +8422,7 @@ void Aura::HandleAuraAddMechanicAbilities(bool apply, bool Real) void Aura::HandleAuraOpenStable(bool apply, bool Real) { - if(!Real || GetTarget()->GetTypeId() != TYPEID_PLAYER || !GetTarget()->IsInWorld()) + if (!Real || GetTarget()->GetTypeId() != TYPEID_PLAYER || !GetTarget()->IsInWorld()) return; Player* player = (Player*)GetTarget(); @@ -8475,15 +8475,15 @@ void Aura::HandleAuraMirrorImage(bool apply, bool Real) void Aura::HandleAuraConvertRune(bool apply, bool Real) { - if(!Real) + if (!Real) return; - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - Player *plr = (Player*)GetTarget(); + Player* plr = (Player*)GetTarget(); - if(plr->getClass() != CLASS_DEATH_KNIGHT) + if (plr->getClass() != CLASS_DEATH_KNIGHT) return; RuneType runeFrom = RuneType(GetSpellProto()->EffectMiscValue[m_effIndex]); @@ -8491,7 +8491,7 @@ void Aura::HandleAuraConvertRune(bool apply, bool Real) if (apply) { - for(uint32 i = 0; i < MAX_RUNES; ++i) + for (uint32 i = 0; i < MAX_RUNES; ++i) { if (plr->GetCurrentRune(i) == runeFrom && !plr->GetRuneCooldown(i)) { @@ -8502,9 +8502,9 @@ void Aura::HandleAuraConvertRune(bool apply, bool Real) } else { - for(uint32 i = 0; i < MAX_RUNES; ++i) + for (uint32 i = 0; i < MAX_RUNES; ++i) { - if(plr->GetCurrentRune(i) == runeTo && plr->GetBaseRune(i) == runeFrom) + if (plr->GetCurrentRune(i) == runeTo && plr->GetBaseRune(i) == runeFrom) { plr->ConvertRune(i, runeFrom); break; @@ -8515,16 +8515,16 @@ void Aura::HandleAuraConvertRune(bool apply, bool Real) void Aura::HandlePhase(bool apply, bool Real) { - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); // always non stackable - if(apply) + if (apply) { Unit::AuraList const& phases = target->GetAurasByType(SPELL_AURA_PHASE); - if(!phases.empty()) + if (!phases.empty()) target->RemoveAurasDueToSpell(phases.front()->GetId(), GetHolder()); } @@ -8533,18 +8533,18 @@ void Aura::HandlePhase(bool apply, bool Real) if (GetEffIndex() == EFFECT_INDEX_0 && target->GetTypeId() == TYPEID_PLAYER) { SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAuraMapBounds(GetId()); - if(saBounds.first != saBounds.second) + if (saBounds.first != saBounds.second) { uint32 zone, area; target->GetZoneAndAreaId(zone, area); - for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) + for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) { // some auras remove at aura remove - if(!itr->second->IsFitToRequirements((Player*)target, zone, area)) + if (!itr->second->IsFitToRequirements((Player*)target, zone, area)) target->RemoveAurasDueToSpell(itr->second->spellId); // some auras applied at aura apply - else if(itr->second->autocast) + else if (itr->second->autocast) { if (!target->HasAura(itr->second->spellId, EFFECT_INDEX_0)) target->CastSpell(target, itr->second->spellId, true); @@ -8554,19 +8554,19 @@ void Aura::HandlePhase(bool apply, bool Real) } } -void Aura::HandleAuraSafeFall( bool Apply, bool Real ) +void Aura::HandleAuraSafeFall(bool Apply, bool Real) { // implemented in WorldSession::HandleMovementOpcodes // only special case - if(Apply && Real && GetId() == 32474 && GetTarget()->GetTypeId() == TYPEID_PLAYER) + if (Apply && Real && GetId() == 32474 && GetTarget()->GetTypeId() == TYPEID_PLAYER) ((Player*)GetTarget())->ActivateTaxiPathTo(506, GetId()); } bool Aura::IsCritFromAbilityAura(Unit* caster, uint32& damage) { if (!GetSpellProto()->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x100000)) && // Rupture - !caster->HasAffectedAura(SPELL_AURA_ABILITY_PERIODIC_CRIT, GetSpellProto())) + !caster->HasAffectedAura(SPELL_AURA_ABILITY_PERIODIC_CRIT, GetSpellProto())) return false; if (caster->IsSpellCrit(GetTarget(), GetSpellProto(), GetSpellSchoolMask(GetSpellProto()))) @@ -8580,7 +8580,7 @@ bool Aura::IsCritFromAbilityAura(Unit* caster, uint32& damage) void Aura::HandleModTargetArmorPct(bool /*apply*/, bool /*Real*/) { - if(GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; ((Player*)GetTarget())->UpdateArmorPenetration(); @@ -8589,17 +8589,17 @@ void Aura::HandleModTargetArmorPct(bool /*apply*/, bool /*Real*/) void Aura::HandleAuraModAllCritChance(bool apply, bool Real) { // spells required only Real aura add/remove - if(!Real) + if (!Real) return; - Unit *target = GetTarget(); + Unit* target = GetTarget(); - if(target->GetTypeId() != TYPEID_PLAYER) + if (target->GetTypeId() != TYPEID_PLAYER) return; - ((Player*)target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); - ((Player*)target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); - ((Player*)target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float(m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float(m_modifier.m_amount), apply); + ((Player*)target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float(m_modifier.m_amount), apply); // included in Player::UpdateSpellCritChance calculation ((Player*)target)->UpdateAllSpellCritChances(); @@ -8624,19 +8624,19 @@ bool Aura::IsLastAuraOnHolder() bool Aura::HasMechanic(uint32 mechanic) const { return GetSpellProto()->Mechanic == mechanic || - GetSpellProto()->EffectMechanic[m_effIndex] == mechanic; + GetSpellProto()->EffectMechanic[m_effIndex] == mechanic; } -SpellAuraHolder::SpellAuraHolder(SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem) : -m_spellProto(spellproto), m_target(target), m_castItemGuid(castItem ? castItem->GetObjectGuid() : ObjectGuid()), -m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_procCharges(0), -m_stackAmount(1), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), m_timeCla(1000), -m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0) +SpellAuraHolder::SpellAuraHolder(SpellEntry const* spellproto, Unit* target, WorldObject* caster, Item* castItem) : + m_spellProto(spellproto), m_target(target), m_castItemGuid(castItem ? castItem->GetObjectGuid() : ObjectGuid()), + m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_procCharges(0), + m_stackAmount(1), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE), m_timeCla(1000), + m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0) { MANGOS_ASSERT(target); - MANGOS_ASSERT(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element"); + MANGOS_ASSERT(spellproto && spellproto == sSpellStore.LookupEntry(spellproto->Id) && "`info` must be pointer to sSpellStore element"); - if(!caster) + if (!caster) m_casterGuid = target->GetObjectGuid(); else { @@ -8672,7 +8672,7 @@ m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0) // some custom stack values at aura holder create switch (m_spellProto->Id) { - // some auras applied with max stack + // some auras applied with max stack case 24575: // Brittle Armor case 24659: // Unstable Power case 24662: // Restless Strength @@ -8692,7 +8692,7 @@ m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0) m_auras[i] = NULL; } -void SpellAuraHolder::AddAura(Aura *aura, SpellEffectIndex index) +void SpellAuraHolder::AddAura(Aura* aura, SpellEffectIndex index) { m_auras[index] = aura; m_auraFlags |= (1 << index); @@ -8707,7 +8707,7 @@ void SpellAuraHolder::RemoveAura(SpellEffectIndex index) void SpellAuraHolder::ApplyAuraModifiers(bool apply, bool real) { for (int32 i = 0; i < MAX_EFFECT_INDEX && !IsDeleted(); ++i) - if (Aura *aur = GetAuraByEffectIndex(SpellEffectIndex(i))) + if (Aura* aur = GetAuraByEffectIndex(SpellEffectIndex(i))) aur->ApplyModifier(apply, real); } @@ -8715,7 +8715,7 @@ void SpellAuraHolder::_AddSpellAuraHolder() { if (!GetId()) return; - if(!m_target) + if (!m_target) return; // Try find slot for aura @@ -8725,7 +8725,7 @@ void SpellAuraHolder::_AddSpellAuraHolder() if (m_target->GetVisibleAurasCount() < MAX_AURAS) { Unit::VisibleAuraMap const& visibleAuras = m_target->GetVisibleAuras(); - for(uint8 i = 0; i < MAX_AURAS; ++i) + for (uint8 i = 0; i < MAX_AURAS; ++i) { Unit::VisibleAuraMap::const_iterator itr = visibleAuras.find(i); if (itr == visibleAuras.end()) @@ -8741,7 +8741,7 @@ void SpellAuraHolder::_AddSpellAuraHolder() Unit* caster = GetCaster(); // set infinity cooldown state for spells - if(caster && caster->GetTypeId() == TYPEID_PLAYER) + if (caster && caster->GetTypeId() == TYPEID_PLAYER) { if (m_spellProto->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE)) { @@ -8763,8 +8763,8 @@ void SpellAuraHolder::_AddSpellAuraHolder() if (IsNeedVisibleSlot(caster)) { - SetAuraSlot( slot ); - if(slot < MAX_AURAS) // slot found send data to client + SetAuraSlot(slot); + if (slot < MAX_AURAS) // slot found send data to client { SetVisibleAura(false); SendAuraUpdate(false); @@ -8780,7 +8780,7 @@ void SpellAuraHolder::_AddSpellAuraHolder() m_target->SetStandState(UNIT_STAND_STATE_SIT); // register aura diminishing on apply - if (getDiminishGroup() != DIMINISHING_NONE ) + if (getDiminishGroup() != DIMINISHING_NONE) m_target->ApplyDiminishingAura(getDiminishGroup(), true); // Update Seals information @@ -8821,13 +8821,13 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() { // Remove all triggered by aura spells vs unlimited duration // except same aura replace case - if(m_removeMode!=AURA_REMOVE_BY_STACK) + if (m_removeMode!=AURA_REMOVE_BY_STACK) CleanupTriggeredSpells(); Unit* caster = GetCaster(); if (caster && IsPersistent()) - if (DynamicObject *dynObj = caster->GetDynObject(GetId())) + if (DynamicObject* dynObj = caster->GetDynObject(GetId())) dynObj->RemoveAffected(m_target); // remove at-store spell cast items (for all remove modes?) @@ -8843,14 +8843,14 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() uint8 slot = GetAuraSlot(); - if(slot >= MAX_AURAS) // slot not set + if (slot >= MAX_AURAS) // slot not set return; - if(m_target->GetVisibleAura(slot) == 0) + if (m_target->GetVisibleAura(slot) == 0) return; // unregister aura diminishing (and store last time) - if (getDiminishGroup() != DIMINISHING_NONE ) + if (getDiminishGroup() != DIMINISHING_NONE) m_target->ApplyDiminishingAura(getDiminishGroup(), false); SetAuraFlags(AFLAG_NONE); @@ -8868,7 +8868,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() // Update target aura state flag (at last aura remove) //***************************************************** // Enrage aura state - if(m_spellProto->Dispel == DISPEL_ENRAGE) + if (m_spellProto->Dispel == DISPEL_ENRAGE) m_target->ModifyAuraState(AURA_STATE_ENRAGE, false); // Bleeding aura state @@ -8892,7 +8892,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() uint32 removeState = 0; ClassFamilyMask removeFamilyFlag = m_spellProto->SpellFamilyFlags; - switch(m_spellProto->SpellFamilyName) + switch (m_spellProto->SpellFamilyName) { case SPELLFAMILY_PALADIN: if (IsSealSpell(m_spellProto)) @@ -8935,7 +8935,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() Unit::SpellAuraHolderMap const& holders = m_target->GetSpellAuraHolderMap(); for (Unit::SpellAuraHolderMap::const_iterator i = holders.begin(); i != holders.end(); ++i) { - SpellEntry const *auraSpellInfo = (*i).second->GetSpellProto(); + SpellEntry const* auraSpellInfo = (*i).second->GetSpellProto(); if (auraSpellInfo->IsFitToFamily(SpellFamily(m_spellProto->SpellFamilyName), removeFamilyFlag)) { found = true; @@ -8944,12 +8944,12 @@ void SpellAuraHolder::_RemoveSpellAuraHolder() } // this has been last aura - if(!found) + if (!found) m_target->ModifyAuraState(AuraState(removeState), false); } // reset cooldown state for spells - if(caster && caster->GetTypeId() == TYPEID_PLAYER) + if (caster && caster->GetTypeId() == TYPEID_PLAYER) { if (GetSpellProto()->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE)) // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases) @@ -8966,20 +8966,20 @@ void SpellAuraHolder::CleanupTriggeredSpells() continue; uint32 tSpellId = m_spellProto->EffectTriggerSpell[i]; - if(!tSpellId) + if (!tSpellId) continue; SpellEntry const* tProto = sSpellStore.LookupEntry(tSpellId); - if(!tProto) + if (!tProto) continue; - if(GetSpellDuration(tProto) != -1) + if (GetSpellDuration(tProto) != -1) continue; // needed for spell 43680, maybe others // TODO: is there a spell flag, which can solve this in a more sophisticated way? if (m_spellProto->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_TRIGGER_SPELL && - GetSpellDuration(m_spellProto) == int32(m_spellProto->EffectAmplitude[i])) + GetSpellDuration(m_spellProto) == int32(m_spellProto->EffectAmplitude[i])) continue; m_target->RemoveAurasDueToSpell(tSpellId); @@ -9011,8 +9011,8 @@ bool SpellAuraHolder::ModStackAmount(int32 num) void SpellAuraHolder::SetStackAmount(uint32 stackAmount) { - Unit *target = GetTarget(); - Unit *caster = GetCaster(); + Unit* target = GetTarget(); + Unit* caster = GetCaster(); if (!target || !caster) return; @@ -9023,7 +9023,7 @@ void SpellAuraHolder::SetStackAmount(uint32 stackAmount) for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) { - if (Aura *aur = m_auras[i]) + if (Aura* aur = m_auras[i]) { int32 bp = aur->GetBasePoints(); int32 amount = m_stackAmount * caster->CalculateSpellDamage(target, m_spellProto, SpellEffectIndex(i), &bp); @@ -9048,7 +9048,7 @@ void SpellAuraHolder::SetStackAmount(uint32 stackAmount) Unit* SpellAuraHolder::GetCaster() const { - if(GetCasterGuid() == m_target->GetObjectGuid()) + if (GetCasterGuid() == m_target->GetObjectGuid()) return m_target; return ObjectAccessor::GetUnit(*m_target, m_casterGuid);// player will search at any maps @@ -9082,7 +9082,7 @@ bool SpellAuraHolder::IsWeaponBuffCoexistableWith(SpellAuraHolder const* ref) co // Limit to Weapon-Slots if (!castItem->IsEquipped() || - (castItem->GetSlot() != EQUIPMENT_SLOT_MAINHAND && castItem->GetSlot() != EQUIPMENT_SLOT_OFFHAND)) + (castItem->GetSlot() != EQUIPMENT_SLOT_MAINHAND && castItem->GetSlot() != EQUIPMENT_SLOT_OFFHAND)) return false; // form different weapons @@ -9118,12 +9118,12 @@ void SpellAuraHolder::BuildUpdatePacket(WorldPacket& data) const uint32 stackCount = m_procCharges ? m_procCharges*m_stackAmount : m_stackAmount; data << uint8(stackCount <= 255 ? stackCount : 255); - if(!(auraFlags & AFLAG_NOT_CASTER)) + if (!(auraFlags & AFLAG_NOT_CASTER)) { data << GetCasterGuid().WriteAsPacked(); } - if(auraFlags & AFLAG_DURATION) + if (auraFlags & AFLAG_DURATION) { data << uint32(GetAuraMaxDuration()); data << uint32(GetAuraDuration()); @@ -9135,7 +9135,7 @@ void SpellAuraHolder::SendAuraUpdate(bool remove) const WorldPacket data(SMSG_AURA_UPDATE); data << m_target->GetPackGUID(); - if(remove) + if (remove) { data << uint8(GetAuraSlot()); data << uint32(0); @@ -9154,11 +9154,11 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) uint32 spellId3 = 0; uint32 spellId4 = 0; - switch(GetSpellProto()->SpellFamilyName) + switch (GetSpellProto()->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(GetId()) + switch (GetId()) { case 29865: // Deathbloom (10 man) { @@ -9202,7 +9202,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) { // Removal is needed here because the dummy aura handler is applied / removed at stacks change if (!apply) - if(Unit* caster = GetCaster()) + if (Unit* caster = GetCaster()) caster->RemoveAurasDueToSpell(34027); return; } @@ -9235,7 +9235,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) if ((!apply && m_removeMode == AURA_REMOVE_BY_DISPEL) || m_removeMode == AURA_REMOVE_BY_SHIELD_BREAK) { Unit::AuraList const& dummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) { // Shattered Barrier if ((*itr)->GetSpellProto()->SpellIconID == 2945) @@ -9253,11 +9253,11 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) break; } - switch(GetId()) + switch (GetId()) { case 11129: // Combustion (remove triggered aura stack) { - if(!apply) + if (!apply) spellId1 = 28682; else return; @@ -9265,7 +9265,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) } case 28682: // Combustion (remove main aura) { - if(!apply) + if (!apply) spellId1 = 11129; else return; @@ -9305,7 +9305,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) } case SPELLFAMILY_WARRIOR: { - if(!apply) + if (!apply) { // Remove Blood Frenzy only if target no longer has any Deep Wound or Rend (applying is handled by procs) if (GetSpellProto()->Mechanic != MECHANIC_BLEED) @@ -9313,10 +9313,10 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) // If target still has one of Warrior's bleeds, do nothing Unit::AuraList const& PeriodicDamage = m_target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - for(Unit::AuraList::const_iterator i = PeriodicDamage.begin(); i != PeriodicDamage.end(); ++i) - if( (*i)->GetCasterGuid() == GetCasterGuid() && - (*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARRIOR && - (*i)->GetSpellProto()->Mechanic == MECHANIC_BLEED) + for (Unit::AuraList::const_iterator i = PeriodicDamage.begin(); i != PeriodicDamage.end(); ++i) + if ((*i)->GetCasterGuid() == GetCasterGuid() && + (*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARRIOR && + (*i)->GetSpellProto()->Mechanic == MECHANIC_BLEED) return; spellId1 = 30069; // Blood Frenzy (Rank 1) @@ -9329,25 +9329,25 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) // Fear (non stacking) if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000040000000000)) { - if(!apply) + if (!apply) { Unit* caster = GetCaster(); - if(!caster) + if (!caster) return; Unit::AuraList const& dummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) { SpellEntry const* dummyEntry = (*itr)->GetSpellProto(); // Improved Fear if (dummyEntry->SpellFamilyName == SPELLFAMILY_WARLOCK && dummyEntry->SpellIconID == 98) { cast_at_remove = true; - switch((*itr)->GetModifier()->m_amount) + switch ((*itr)->GetModifier()->m_amount) { - // Rank 1 + // Rank 1 case 0: spellId1 = 60946; break; - // Rank 1 + // Rank 1 case 1: spellId1 = 60947; break; } break; @@ -9362,9 +9362,9 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) { // Glyph of Shadowflame Unit* caster; - if(!apply) + if (!apply) spellId1 = 63311; - else if(((caster = GetCaster())) && caster->HasAura(63310)) + else if (((caster = GetCaster())) && caster->HasAura(63310)) spellId1 = 63311; else return; @@ -9381,15 +9381,15 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) if (!apply && m_removeMode == AURA_REMOVE_BY_DISPEL) { Unit* caster = GetCaster(); - if(!caster) + if (!caster) return; Unit::AuraList const& dummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) { // Shadow Affinity if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_PRIEST - && (*itr)->GetSpellProto()->SpellIconID == 178) + && (*itr)->GetSpellProto()->SpellIconID == 178) { // custom cast code int32 basepoints0 = (*itr)->GetModifier()->m_amount * caster->GetCreateMana() / 100; @@ -9405,41 +9405,41 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) else if (apply && m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000001) && m_spellProto->Mechanic == MECHANIC_SHIELD) { Unit* caster = GetCaster(); - if(!caster) + if (!caster) return; // Glyph of Power Word: Shield if (Aura* glyph = caster->GetAura(55672, EFFECT_INDEX_0)) { - Aura *shield = GetAuraByEffectIndex(EFFECT_INDEX_0); + Aura* shield = GetAuraByEffectIndex(EFFECT_INDEX_0); int32 heal = (glyph->GetModifier()->m_amount * shield->GetModifier()->m_amount)/100; caster->CastCustomSpell(m_target, 56160, &heal, NULL, NULL, true, 0, shield); } return; } - switch(GetId()) + switch (GetId()) { - // Abolish Disease (remove 1 more poison effect with Body and Soul) + // Abolish Disease (remove 1 more poison effect with Body and Soul) case 552: { - if(apply) + if (apply) { int chance =0; Unit::AuraList const& dummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) { SpellEntry const* dummyEntry = (*itr)->GetSpellProto(); // Body and Soul (talent ranks) if (dummyEntry->SpellFamilyName == SPELLFAMILY_PRIEST && dummyEntry->SpellIconID == 2218 && - dummyEntry->SpellVisual[0]==0) + dummyEntry->SpellVisual[0]==0) { chance = (*itr)->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_1); break; } } - if(roll_chance_i(chance)) + if (roll_chance_i(chance)) spellId1 = 64134; // Body and Soul (periodic dispel effect) } else @@ -9454,7 +9454,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) default: return; } - break; + break; } case SPELLFAMILY_DRUID: { @@ -9471,10 +9471,10 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) // Sprint (skip non player casted spells by category) if (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000040) && GetSpellProto()->Category == 44) { - if(!apply || m_target->HasAura(58039)) // Glyph of Blurred Speed + if (!apply || m_target->HasAura(58039)) // Glyph of Blurred Speed spellId1 = 61922; // Sprint (waterwalk) else - return; + return; } else return; @@ -9541,9 +9541,9 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) // Freezing Trap Effect if (m_spellProto->SpellFamilyFlags & UI64LIT(0x0000000000000008)) { - if(!apply) + if (!apply) { - Unit *caster = GetCaster(); + Unit* caster = GetCaster(); // Glyph of Freezing Trap if (caster && caster->HasAura(56845)) { @@ -9575,13 +9575,13 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) { if (m_spellProto->Id == 31884) // Avenging Wrath { - if(!apply) + if (!apply) spellId1 = 57318; // Sanctified Wrath (triggered) else { int32 percent = 0; Unit::AuraList const& dummyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr) { if ((*itr)->GetSpellProto()->SpellIconID == 3029) { @@ -9591,7 +9591,7 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) } // apply in special way - if(percent) + if (percent) { spellId1 = 57318; // Sanctified Wrath (triggered) // prevent aura deletion, specially in multi-boost case @@ -9640,11 +9640,11 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) if (apply) { Unit::AuraList const& bloodAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = bloodAuras.begin(); itr != bloodAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = bloodAuras.begin(); itr != bloodAuras.end(); ++itr) { // skip same icon if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && - (*itr)->GetSpellProto()->SpellIconID == 2636) + (*itr)->GetSpellProto()->SpellIconID == 2636) { heal_pct = (*itr)->GetModifier()->m_amount; break; @@ -9667,11 +9667,11 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) if (apply) { Unit::AuraList const& unholyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = unholyAuras.begin(); itr != unholyAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = unholyAuras.begin(); itr != unholyAuras.end(); ++itr) { // skip same icon if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && - (*itr)->GetSpellProto()->SpellIconID == 2633) + (*itr)->GetSpellProto()->SpellIconID == 2633) { power_pct = (*itr)->GetModifier()->m_amount; break; @@ -9691,11 +9691,11 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) if (apply) { Unit::AuraList const& frostAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = frostAuras.begin(); itr != frostAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = frostAuras.begin(); itr != frostAuras.end(); ++itr) { // skip same icon if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && - (*itr)->GetSpellProto()->SpellIconID == 2632) + (*itr)->GetSpellProto()->SpellIconID == 2632) { stamina_pct = (*itr)->GetModifier()->m_amount; break; @@ -9718,11 +9718,11 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) if (apply) { Unit::AuraList const& unholyAuras = m_target->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = unholyAuras.begin(); itr != unholyAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = unholyAuras.begin(); itr != unholyAuras.end(); ++itr) { // skip same icon if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && - (*itr)->GetSpellProto()->SpellIconID == 2633) + (*itr)->GetSpellProto()->SpellIconID == 2633) { power_pct = (*itr)->GetModifier()->m_amount; break; @@ -9845,7 +9845,7 @@ SpellAuraHolder::~SpellAuraHolder() { // note: auras in delete list won't be affected since they clear themselves from holder when adding to deletedAuraslist for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) - if (Aura *aur = m_auras[i]) + if (Aura* aur = m_auras[i]) delete aur; } @@ -9879,14 +9879,14 @@ void SpellAuraHolder::Update(uint32 diff) } for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) - if (Aura *aura = m_auras[i]) + if (Aura* aura = m_auras[i]) aura->UpdateAura(diff); // Channeled aura required check distance from caster - if(IsChanneledSpell(m_spellProto) && GetCasterGuid() != m_target->GetObjectGuid()) + if (IsChanneledSpell(m_spellProto) && GetCasterGuid() != m_target->GetObjectGuid()) { Unit* caster = GetCaster(); - if(!caster) + if (!caster) { m_target->RemoveAurasByCasterSpell(GetId(), GetCasterGuid()); return; @@ -9898,10 +9898,10 @@ void SpellAuraHolder::Update(uint32 diff) // Get spell range float max_range = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellProto->rangeIndex)); - if(Player* modOwner = caster->GetSpellModOwner()) + if (Player* modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(GetId(), SPELLMOD_RANGE, max_range, NULL); - if(!caster->IsWithinDistInMap(m_target, max_range)) + if (!caster->IsWithinDistInMap(m_target, max_range)) { caster->InterruptSpell(CURRENT_CHANNELED_SPELL); return; @@ -9957,7 +9957,7 @@ bool SpellAuraHolder::HasMechanicMask(uint32 mechanicMask) const bool SpellAuraHolder::IsPersistent() const { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) - if (Aura *aur = m_auras[i]) + if (Aura* aur = m_auras[i]) if (aur->IsPersistent()) return true; return false; @@ -9966,7 +9966,7 @@ bool SpellAuraHolder::IsPersistent() const bool SpellAuraHolder::IsAreaAura() const { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) - if (Aura *aur = m_auras[i]) + if (Aura* aur = m_auras[i]) if (aur->IsAreaAura()) return true; return false; @@ -9975,7 +9975,7 @@ bool SpellAuraHolder::IsAreaAura() const bool SpellAuraHolder::IsPositive() const { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) - if (Aura *aur = m_auras[i]) + if (Aura* aur = m_auras[i]) if (!aur->IsPositive()) return false; return true; @@ -9993,7 +9993,7 @@ void SpellAuraHolder::UnregisterSingleCastHolder() { if (IsSingleTarget()) { - if(Unit* caster = GetCaster()) + if (Unit* caster = GetCaster()) caster->GetSingleCastSpellTargets().erase(GetSpellProto()); m_isSingleTarget = false; diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index 1b9460064..96f4d7ccc 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -43,10 +43,10 @@ struct ReapplyAffectedPassiveAurasHelper; class MANGOS_DLL_SPEC SpellAuraHolder { public: - SpellAuraHolder (SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem); + SpellAuraHolder(SpellEntry const* spellproto, Unit* target, WorldObject* caster, Item* castItem); Aura* m_auras[MAX_EFFECT_INDEX]; - void AddAura(Aura *aura, SpellEffectIndex index); + void AddAura(Aura* aura, SpellEffectIndex index); void RemoveAura(SpellEffectIndex index); void ApplyAuraModifiers(bool apply, bool real = false); void _AddSpellAuraHolder(); @@ -93,11 +93,11 @@ class MANGOS_DLL_SPEC SpellAuraHolder void SetInUse(bool state) { - if(state) + if (state) ++m_in_use; else { - if(m_in_use) + if (m_in_use) --m_in_use; } } @@ -205,8 +205,8 @@ typedef void(Aura::*pAuraHandler)(bool Apply, bool Real); class MANGOS_DLL_SPEC Aura { - friend struct ReapplyAffectedPassiveAurasHelper; - friend Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem); + friend struct ReapplyAffectedPassiveAurasHelper; + friend Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster, Item* castItem); public: //aura handlers @@ -384,13 +384,13 @@ class MANGOS_DLL_SPEC Aura int32 GetMiscBValue() const { return m_spellAuraHolder->GetSpellProto()->EffectMiscValueB[m_effIndex]; } SpellEntry const* GetSpellProto() const { return GetHolder()->GetSpellProto(); } - uint32 GetId() const{ return GetHolder()->GetSpellProto()->Id; } + uint32 GetId() const { return GetHolder()->GetSpellProto()->Id; } ObjectGuid const& GetCastItemGuid() const { return GetHolder()->GetCastItemGuid(); } ObjectGuid const& GetCasterGuid() const { return GetHolder()->GetCasterGuid(); } Unit* GetCaster() const { return GetHolder()->GetCaster(); } Unit* GetTarget() const { return GetHolder()->GetTarget(); } - SpellEffectIndex GetEffIndex() const{ return m_effIndex; } + SpellEffectIndex GetEffIndex() const { return m_effIndex; } int32 GetBasePoints() const { return m_currentBasePoints; } int32 GetAuraMaxDuration() const { return GetHolder()->GetAuraMaxDuration(); } @@ -409,7 +409,7 @@ class MANGOS_DLL_SPEC Aura m_modifier.m_amount = damage; m_modifier.periodictime = periodicTime; - if(uint32 maxticks = GetAuraMaxTicks()) + if (uint32 maxticks = GetAuraMaxTicks()) m_periodicTick = maxticks - GetAuraDuration() / m_modifier.periodictime; } @@ -421,11 +421,11 @@ class MANGOS_DLL_SPEC Aura void SetInUse(bool state) { - if(state) + if (state) ++m_in_use; else { - if(m_in_use) + if (m_in_use) --m_in_use; } } @@ -444,8 +444,8 @@ class MANGOS_DLL_SPEC Aura void TriggerSpellWithValue(); ClassFamilyMask const& GetAuraSpellClassMask() const { return m_spellAuraHolder->GetSpellProto()->GetEffectSpellClassMask(m_effIndex); } - bool isAffectedOnSpell(SpellEntry const *spell) const; - bool CanProcFrom(SpellEntry const *spell, uint32 procFlag, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const; + bool isAffectedOnSpell(SpellEntry const* spell) const; + bool CanProcFrom(SpellEntry const* spell, uint32 procFlag, uint32 EventProcEx, uint32 procEx, bool active, bool useClassMask) const; //SpellAuraHolder const* GetHolder() const { return m_spellHolder; } SpellAuraHolder* GetHolder() { return m_spellAuraHolder; } @@ -455,7 +455,7 @@ class MANGOS_DLL_SPEC Aura bool HasMechanic(uint32 mechanic) const; protected: - Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL); + Aura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster = NULL, Item* castItem = NULL); // must be called only from Aura::UpdateAura virtual void Update(uint32 diff); @@ -494,7 +494,7 @@ class MANGOS_DLL_SPEC Aura class MANGOS_DLL_SPEC AreaAura : public Aura { public: - AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL); + AreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster = NULL, Item* castItem = NULL); ~AreaAura(); protected: void Update(uint32 diff); @@ -506,7 +506,7 @@ class MANGOS_DLL_SPEC AreaAura : public Aura class MANGOS_DLL_SPEC PersistentAreaAura : public Aura { public: - PersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL); + PersistentAreaAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster = NULL, Item* castItem = NULL); ~PersistentAreaAura(); protected: void Update(uint32 diff); @@ -514,17 +514,17 @@ class MANGOS_DLL_SPEC PersistentAreaAura : public Aura class MANGOS_DLL_SPEC SingleEnemyTargetAura : public Aura { - friend Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster, Item* castItem); + friend Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster, Item* castItem); public: ~SingleEnemyTargetAura(); Unit* GetTriggerTarget() const; protected: - SingleEnemyTargetAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL); + SingleEnemyTargetAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster = NULL, Item* castItem = NULL); ObjectGuid m_castersTargetGuid; }; -Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32 *currentBasePoints, SpellAuraHolder *holder, Unit *target, Unit *caster = NULL, Item* castItem = NULL); -SpellAuraHolder* CreateSpellAuraHolder(SpellEntry const* spellproto, Unit *target, WorldObject *caster, Item *castItem = NULL); +Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* currentBasePoints, SpellAuraHolder* holder, Unit* target, Unit* caster = NULL, Item* castItem = NULL); +SpellAuraHolder* CreateSpellAuraHolder(SpellEntry const* spellproto, Unit* target, WorldObject* caster, Item* castItem = NULL); #endif diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 2bb3f65c5..a05afc0fd 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -244,18 +244,18 @@ void Spell::EffectUnused(SpellEffectIndex /*eff_idx*/) void Spell::EffectResurrectNew(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->isAlive()) + if (!unitTarget || unitTarget->isAlive()) return; - if(unitTarget->GetTypeId() != TYPEID_PLAYER) + if (unitTarget->GetTypeId() != TYPEID_PLAYER) return; - if(!unitTarget->IsInWorld()) + if (!unitTarget->IsInWorld()) return; Player* pTarget = ((Player*)unitTarget); - if(pTarget->isRessurectRequested()) // already have one active request + if (pTarget->isRessurectRequested()) // already have one active request return; uint32 health = damage; @@ -296,21 +296,21 @@ void Spell::EffectEnvironmentalDMG(SpellEffectIndex eff_idx) m_caster->CalculateDamageAbsorbAndResist(m_caster, GetSpellSchoolMask(m_spellInfo), SPELL_DIRECT_DAMAGE, damage, &absorb, &resist); m_caster->SendSpellNonMeleeDamageLog(m_caster, m_spellInfo->Id, damage, GetSpellSchoolMask(m_spellInfo), absorb, resist, false, 0, false); - if(m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->GetTypeId() == TYPEID_PLAYER) ((Player*)m_caster)->EnvironmentalDamage(DAMAGE_FIRE, damage); } void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) { - if( unitTarget && unitTarget->isAlive()) + if (unitTarget && unitTarget->isAlive()) { - switch(m_spellInfo->SpellFamilyName) + switch (m_spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(m_spellInfo->Id) // better way to check unknown + switch (m_spellInfo->Id) // better way to check unknown { - // Meteor like spells (divided damage to targets) + // Meteor like spells (divided damage to targets) case 24340: case 26558: case 28884: // Meteor case 36837: case 38903: case 41276: // Meteor case 57467: // Meteor @@ -326,8 +326,8 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) case 72624: case 72625: // Ooze Eruption { uint32 count = 0; - for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) - if(ihit->effectMask & (1<effectMask & (1<GetHealth() / 2; - if(damage < 200) + if (damage < 200) damage = 200; break; } @@ -380,7 +380,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) case 67485: damage += uint32(0.5f * m_caster->GetTotalAttackPowerValue(BASE_ATTACK)); break; - //Magic Bane normal (Forge of Souls - Bronjahm) + //Magic Bane normal (Forge of Souls - Bronjahm) case 68793: { damage += uint32(unitTarget->GetMaxPower(POWER_MANA) / 2); @@ -444,14 +444,14 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) { // Incinerate does more dmg (dmg*0.25) if the target have Immolate debuff. // Check aura state for speed but aura state set not only for Immolate spell - if(unitTarget->HasAuraState(AURA_STATE_CONFLAGRATE)) + if (unitTarget->HasAuraState(AURA_STATE_CONFLAGRATE)) { Unit::AuraList const& RejorRegr = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - for(Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) + for (Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) { // Immolate - if((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && - ((*i)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x00000000000004))) + if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && + ((*i)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x00000000000004))) { damage += damage/4; break; @@ -463,25 +463,25 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0001000000000000)) { // Apply DOT part - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 47897: m_caster->CastSpell(unitTarget, 47960, true); break; case 61290: m_caster->CastSpell(unitTarget, 61291, true); break; default: sLog.outError("Spell::EffectDummy: Unhandeled Shadowflame spell rank %u",m_spellInfo->Id); - break; + break; } } // Shadow Bite else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0040000000000000)) { - Unit *owner = m_caster->GetOwner(); + Unit* owner = m_caster->GetOwner(); if (!owner) break; uint32 counter = 0; Unit::AuraList const& dotAuras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - for(Unit::AuraList::const_iterator itr = dotAuras.begin(); itr!=dotAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = dotAuras.begin(); itr!=dotAuras.end(); ++itr) if ((*itr)->GetCasterGuid() == owner->GetObjectGuid()) ++counter; @@ -493,12 +493,12 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) { Aura const* aura = NULL; // found req. aura for damage calculation - Unit::AuraList const &mPeriodic = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - for(Unit::AuraList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i) + Unit::AuraList const& mPeriodic = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); + for (Unit::AuraList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i) { // for caster applied auras only if ((*i)->GetSpellProto()->SpellFamilyName != SPELLFAMILY_WARLOCK || - (*i)->GetCasterGuid() != m_caster->GetObjectGuid()) + (*i)->GetCasterGuid() != m_caster->GetObjectGuid()) continue; // Immolate @@ -536,10 +536,10 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) else if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x00002000))) { Unit::AuraList const& ImprMindBlast = m_caster->GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER); - for(Unit::AuraList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i) + for (Unit::AuraList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i) { if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_PRIEST && - ((*i)->GetSpellProto()->SpellIconID == 95)) + ((*i)->GetSpellProto()->SpellIconID == 95)) { int chance = (*i)->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_1); if (roll_chance_i(chance)) @@ -584,16 +584,16 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) if (m_caster->GetTypeId()==TYPEID_PLAYER && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x800000000))) { // consume from stack dozes not more that have combo-points - if(uint32 combo = ((Player*)m_caster)->GetComboPoints()) + if (uint32 combo = ((Player*)m_caster)->GetComboPoints()) { - Aura *poison = 0; + Aura* poison = 0; // Lookup for Deadly poison (only attacker applied) Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) { if ((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_ROGUE && - ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x10000)) && - (*itr)->GetCasterGuid() == m_caster->GetObjectGuid()) + ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x10000)) && + (*itr)->GetCasterGuid() == m_caster->GetObjectGuid()) { poison = *itr; break; @@ -610,7 +610,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) // Master Poisoner Unit::AuraList const& auraList = ((Player*)m_caster)->GetAurasByType(SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL); - for(Unit::AuraList::const_iterator iter = auraList.begin(); iter!=auraList.end(); ++iter) + for (Unit::AuraList::const_iterator iter = auraList.begin(); iter!=auraList.end(); ++iter) { if ((*iter)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_ROGUE && (*iter)->GetSpellProto()->SpellIconID == 1960) { @@ -636,13 +636,13 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) // Eviscerate else if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x00020000)) && m_caster->GetTypeId()==TYPEID_PLAYER) { - if(uint32 combo = ((Player*)m_caster)->GetComboPoints()) + if (uint32 combo = ((Player*)m_caster)->GetComboPoints()) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); damage += irand(int32(ap * combo * 0.03f), int32(ap * combo * 0.07f)); // Eviscerate and Envenom Bonus Damage (item set effect) - if(m_caster->GetDummyAura(37169)) + if (m_caster->GetDummyAura(37169)) damage += combo*40; } } @@ -679,7 +679,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) else if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x800000000)) && m_spellInfo->SpellIconID==2292) { uint32 debuf_id; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 53733: debuf_id = 53742; break;// Judgement of Corruption -> Blood Corruption case 31804: debuf_id = 31803; break;// Judgement of Vengeance -> Holy Vengeance @@ -694,7 +694,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) // Get stack of Holy Vengeance on the target added by caster uint32 stacks = 0; Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); - for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) { if (((*itr)->GetId() == debuf_id) && (*itr)->GetCasterGuid()==m_caster->GetObjectGuid()) { @@ -703,7 +703,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) } } // + 10% for each application of Holy Vengeance on the target - if(stacks) + if (stacks) damage += damage * stacks * 10 /100; } // Avenger's Shield ($m1+0.07*$SPH+0.07*$AP) - ranged sdb for future @@ -747,7 +747,7 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) } } - if(damage >= 0) + if (damage >= 0) m_damage += damage; } } @@ -758,15 +758,15 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; // selection by spell family - switch(m_spellInfo->SpellFamilyName) + switch (m_spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 3360: // Curse of the Eye { - if(!unitTarget) + if (!unitTarget) return; uint32 spell_id = (unitTarget->getGender() == GENDER_MALE) ? 10651: 10653; @@ -789,7 +789,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; uint32 spell_id = 0; - switch(urand(1,5)) + switch (urand(1,5)) { case 1: spell_id = 8064; break; // Sleepy case 2: spell_id = 8065; break; // Invigorate @@ -806,11 +806,11 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; uint32 spell_id = 0; - switch(urand(1,2)) + switch (urand(1,2)) { - // Flip Out - ninja + // Flip Out - ninja case 1: spell_id = (m_caster->getGender() == GENDER_MALE ? 8219 : 8220); break; - // Yaaarrrr - pirate + // Yaaarrrr - pirate case 2: spell_id = (m_caster->getGender() == GENDER_MALE ? 8221 : 8222); break; } @@ -863,7 +863,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (!m_triggeredByAuraSpell || !unitTarget) return; - switch(m_triggeredByAuraSpell->Id) + switch (m_triggeredByAuraSpell->Id) { case 26467: // Persistent Shield m_caster->CastCustomSpell(unitTarget, 26470, &damage, NULL, NULL, true); @@ -923,7 +923,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; uint32 spell_id = 0; - switch(urand(1, 3)) + switch (urand(1, 3)) { case 1: spell_id = 16595; break; case 2: spell_id = 16593; break; @@ -944,7 +944,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); data << unitTarget->GetObjectGuid(); - ((Player*)caster)->GetSession()->SendPacket( &data ); + ((Player*)caster)->GetSession()->SendPacket(&data); } return; } @@ -954,8 +954,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; uint32 spell_id = roll_chance_i(50) - ? 17269 // Create Resonating Skull - : 17270; // Create Bone Dust + ? 17269 // Create Resonating Skull + : 17270; // Create Bone Dust m_caster->CastSpell(m_caster, spell_id, true, NULL); return; @@ -994,12 +994,12 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) GameObject* pGameObj = new GameObject; - Map *map = unitTarget->GetMap(); + Map* map = unitTarget->GetMap(); if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), 177704, - map, m_caster->GetPhaseMask(), - unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), - unitTarget->GetOrientation())) + map, m_caster->GetPhaseMask(), + unitTarget->GetPositionX(), unitTarget->GetPositionY(), unitTarget->GetPositionZ(), + unitTarget->GetOrientation())) { delete pGameObj; return; @@ -1049,20 +1049,20 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) GameObject* pGameObj = new GameObject; - Map *map = creatureTarget->GetMap(); + Map* map = creatureTarget->GetMap(); // create before death for get proper coordinates if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), 179644, map, m_caster->GetPhaseMask(), - creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), - creatureTarget->GetOrientation()) ) + creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), + creatureTarget->GetOrientation())) { delete pGameObj; return; } pGameObj->SetRespawnTime(creatureTarget->GetRespawnTime()-time(NULL)); - pGameObj->SetOwnerGuid(m_caster->GetObjectGuid() ); - pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel() ); + pGameObj->SetOwnerGuid(m_caster->GetObjectGuid()); + pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); pGameObj->SetSpellId(m_spellInfo->Id); creatureTarget->ForcedDespawn(); @@ -1148,7 +1148,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { uint32 spell_id = 0; - switch(urand(1,4)) + switch (urand(1,4)) { case 1: spell_id = 24924; break; // Larger and Orange case 2: spell_id = 24925; break; // Skeleton @@ -1193,7 +1193,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; case 28006: // Arcane Cloaking { - if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER ) + if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER) // Naxxramas Entry Flag Effect DND m_caster->CastSpell(unitTarget, 29294, true); @@ -1226,8 +1226,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; uint32 spell_id = roll_chance_i(50) - ? 29277 // Summon Purified Helboar Meat - : 29278; // Summon Toxic Helboar Meat + ? 29277 // Summon Purified Helboar Meat + : 29278; // Summon Toxic Helboar Meat m_caster->CastSpell(m_caster,spell_id,true,NULL); return; @@ -1287,7 +1287,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) uint32 spell_id = 0; - switch(urand(1,5)) + switch (urand(1,5)) { case 1: spell_id = 33053; break; // Mr Pinchy's Blessing case 2: spell_id = 33057; break; // Summon Mighty Mr. Pinchy @@ -1311,7 +1311,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) case 35745: // Socrethar's Stone { uint32 spell_id; - switch(m_caster->GetAreaId()) + switch (m_caster->GetAreaId()) { case 3900: spell_id = 35743; break; // Socrethar Portal case 3742: spell_id = 35744; break; // Socrethar Portal @@ -1348,7 +1348,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { // selecting one from Bloodstained Fortune item uint32 newitemid; - switch(urand(1, 20)) + switch (urand(1, 20)) { case 1: newitemid = 32688; break; case 2: newitemid = 32689; break; @@ -1580,14 +1580,14 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) case 45449: // Arcane Prisoner Rescue { uint32 spellId=0; - switch(rand() % 2) + switch (rand() % 2) { case 0: spellId = 45446; break; // Summon Arcane Prisoner - Male case 1: spellId = 45448; break; // Summon Arcane Prisoner - Female } //Spawn m_caster->CastSpell(m_caster, spellId, true); - + if (!unitTarget) return; //Arcane Prisoner Kill Credit unitTarget->CastSpell(m_caster, 45456, true); @@ -1627,7 +1627,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) Cell::VisitGridObjects(unitTarget, checker2, fMaxDist); - for(std::list::iterator iter = lList.begin(); iter != lList.end(); ++iter) + for (std::list::iterator iter = lList.begin(); iter != lList.end(); ++iter) { if (!(*iter)->isSpawned()) { @@ -1668,7 +1668,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { if (m_caster->GetTypeId() == TYPEID_PLAYER && unitTarget) { - if (const SpellEntry *pSpell = sSpellStore.LookupEntry(46022)) + if (const SpellEntry* pSpell = sSpellStore.LookupEntry(46022)) { m_caster->CastSpell(unitTarget, pSpell, true); ((Player*)m_caster)->KilledMonsterCredit(pSpell->EffectMiscValue[EFFECT_INDEX_0]); @@ -1695,7 +1695,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; - if (const SpellEntry *pSpell = sSpellStore.LookupEntry(45991)) + if (const SpellEntry* pSpell = sSpellStore.LookupEntry(45991)) { unitTarget->CastSpell(unitTarget, pSpell, true); ((Creature*)unitTarget)->ForcedDespawn(m_duration); @@ -1718,7 +1718,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) uint32 spellId = 0; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 46167: spellId = 46773; break; case 50918: spellId = 50919; break; @@ -1731,13 +1731,13 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) case 74904: spellId = 74905; break; } - if (const SpellEntry *pSpell = sSpellStore.LookupEntry(spellId)) + if (const SpellEntry* pSpell = sSpellStore.LookupEntry(spellId)) { unitTarget->CastSpell(m_caster, spellId, true); Creature* creatureTarget = (Creature*)unitTarget; - if (const SpellCastTimesEntry *pCastTime = sSpellCastTimesStore.LookupEntry(pSpell->CastingTimeIndex)) + if (const SpellCastTimesEntry* pCastTime = sSpellCastTimesStore.LookupEntry(pSpell->CastingTimeIndex)) creatureTarget->ForcedDespawn(pCastTime->CastTime + 1); } return; @@ -1772,11 +1772,11 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; - if (const SpellEntry *pSpell = sSpellStore.LookupEntry(46486)) + if (const SpellEntry* pSpell = sSpellStore.LookupEntry(46486)) { m_caster->CastSpell(unitTarget, pSpell, true); - if (const SpellEntry *pSpellCredit = sSpellStore.LookupEntry(pSpell->EffectTriggerSpell[EFFECT_INDEX_0])) + if (const SpellEntry* pSpellCredit = sSpellStore.LookupEntry(pSpell->EffectTriggerSpell[EFFECT_INDEX_0])) ((Player*)m_caster)->KilledMonsterCredit(pSpellCredit->EffectMiscValue[EFFECT_INDEX_0]); ((Creature*)unitTarget)->ForcedDespawn(); @@ -1821,7 +1821,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // Spell 47117,47149,47316,47405,50439 exist, are these used to check area/meet requirement // and to cast correct spell in correct area? - switch(m_caster->GetAreaId()) + switch (m_caster->GetAreaId()) { case 4255: spellId = 47381; break; // Reagent Check (Frozen Mojo) case 4209: spellId = 47386; break; // Reagent Check (Zim'Bo's Mojo) @@ -1888,7 +1888,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 47381: // Envision Drakuru @@ -1942,7 +1942,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); // Ram for Alliance, Kodo for Horde - if (((Player *)m_caster)->GetTeam() == ALLIANCE) + if (((Player*)m_caster)->GetTeam() == ALLIANCE) { if (m_caster->GetSpeedRate(MOVE_RUN) >= 2.0f) // 100% Ram @@ -1953,7 +1953,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } else { - if (((Player *)m_caster)->GetSpeedRate(MOVE_RUN) >= 2.0f) + if (((Player*)m_caster)->GetSpeedRate(MOVE_RUN) >= 2.0f) // 100% Kodo m_caster->CastSpell(m_caster, 49379, true); else @@ -1982,7 +1982,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // for sizeof(spellCredit) for (int i = 0; i < 4; ++i) { - const SpellEntry *pSpell = sSpellStore.LookupEntry(spellCredit[i]); + const SpellEntry* pSpell = sSpellStore.LookupEntry(spellCredit[i]); if (pSpell->EffectMiscValue[EFFECT_INDEX_0] == unitTarget->GetEntry()) { @@ -2060,7 +2060,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (!m_originalCaster || !unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 50546: unitTarget->CastSpell(m_originalCaster, 47390, true); break; case 50547: unitTarget->CastSpell(m_originalCaster, 47472, true); break; @@ -2155,7 +2155,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) else { // ...drop banana, orange or papaya - switch(urand(0,2)) + switch (urand(0,2)) { case 0: unitTarget->CastSpell(m_caster, 51836, true); break; case 1: unitTarget->CastSpell(m_caster, 51837, true); break; @@ -2247,7 +2247,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } case 52308: // Take Sputum Sample { - switch(eff_idx) + switch (eff_idx) { case EFFECT_INDEX_0: { @@ -2283,7 +2283,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) Cell::VisitGridObjects(unitTarget, checker, fMaxDist); - for(std::list::iterator iter = lList.begin(); iter != lList.end(); ++iter) + for (std::list::iterator iter = lList.begin(); iter != lList.end(); ++iter) { if (!(*iter)->isSpawned()) { @@ -2313,7 +2313,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); // Ram for Horde, Kodo for Alliance - if (((Player *)m_caster)->GetTeam() == HORDE) + if (((Player*)m_caster)->GetTeam() == HORDE) { if (m_caster->GetSpeedRate(MOVE_RUN) >= 2.0f) // Swift Brewfest Ram, 100% Ram @@ -2324,7 +2324,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } else { - if (((Player *)m_caster)->GetSpeedRate(MOVE_RUN) >= 2.0f) + if (((Player*)m_caster)->GetSpeedRate(MOVE_RUN) >= 2.0f) // Great Brewfest Kodo, 100% Kodo m_caster->CastSpell(m_caster, 49379, true); else @@ -2441,7 +2441,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // unclear how many summon min/max random, best guess below uint32 random = urand(3,5); - for(uint32 i = 0; i < random; ++i) + for (uint32 i = 0; i < random; ++i) m_caster->CastSpell(m_caster, 55528, true); return; @@ -2472,7 +2472,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; uint32 spell_id = 0; - switch(urand(1,3)) + switch (urand(1,3)) { case 1: spell_id = 59645; break; case 2: spell_id = 59831; break; @@ -2516,7 +2516,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { uint32 spell_id = 0; - switch(urand(0, 2)) + switch (urand(0, 2)) { case 0: spell_id = 64982; break; // Summon Vanquished Crusher Tentacle case 1: spell_id = 64983; break; // Summon Vanquished Constrictor Tentacle @@ -2552,7 +2552,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; uint32 spell_id = 0; - switch(m_caster->getClass()) + switch (m_caster->getClass()) { case CLASS_WARRIOR: case CLASS_DEATH_KNIGHT: @@ -2637,7 +2637,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } case SPELLFAMILY_MAGE: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 11958: // Cold Snap { @@ -2645,14 +2645,14 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; // immediately finishes the cooldown on Frost spells - const SpellCooldowns& cm = ((Player *)m_caster)->GetSpellCooldownMap(); + const SpellCooldowns& cm = ((Player*)m_caster)->GetSpellCooldownMap(); for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && - (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) && - spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0) + (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) && + spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0) { ((Player*)m_caster)->RemoveSpellCooldown((itr++)->first, true); } @@ -2684,7 +2684,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) 32819, // Worgen Form 32820 // Sheep Form }; - unitTarget->CastSpell( unitTarget, spell_list[urand(0, 5)], true); + unitTarget->CastSpell(unitTarget, spell_list[urand(0, 5)], true); } return; } @@ -2709,7 +2709,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (item->HasMaxCharges()) return; - unitTarget->CastSpell( unitTarget, m_spellInfo->CalculateSimpleValue(eff_idx), true, m_CastItem); + unitTarget->CastSpell(unitTarget, m_spellInfo->CalculateSimpleValue(eff_idx), true, m_CastItem); return; } break; @@ -2738,7 +2738,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // Glyph of Execution bonus uint32 rage_modified = rage; - if (Aura *aura = m_caster->GetDummyAura(58367)) + if (Aura* aura = m_caster->GetDummyAura(58367)) rage_modified += aura->GetModifier()->m_amount*10; int32 basePoints0 = damage+int32(rage_modified * m_spellInfo->DmgMultiplier[eff_idx] + @@ -2757,7 +2757,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { // saved rage top stored in next affect uint32 lastrage = (*itr)->GetSpellProto()->CalculateSimpleValue(EFFECT_INDEX_1)*10; - if(lastrage < rage) + if (lastrage < rage) rage -= lastrage; break; } @@ -2770,7 +2770,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // Slam if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000200000)) { - if(!unitTarget) + if (!unitTarget) return; // dummy cast itself ignored by client in logs @@ -2784,9 +2784,9 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; } - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { - // Warrior's Wrath + // Warrior's Wrath case 21977: { if (!unitTarget) @@ -2825,8 +2825,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // Improved Life Tap mod Unit::AuraList const& auraDummy = m_caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr) - if((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (*itr)->GetSpellProto()->SpellIconID == 208) + for (Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr) + if ((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (*itr)->GetSpellProto()->SpellIconID == 208) mana = ((*itr)->GetModifier()->m_amount + 100)* mana / 100; m_caster->CastCustomSpell(unitTarget, 31818, &mana, NULL, NULL, true); @@ -2834,9 +2834,9 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // Mana Feed int32 manaFeedVal = 0; Unit::AuraList const& mod = m_caster->GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER); - for(Unit::AuraList::const_iterator itr = mod.begin(); itr != mod.end(); ++itr) + for (Unit::AuraList::const_iterator itr = mod.begin(); itr != mod.end(); ++itr) { - if((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (*itr)->GetSpellProto()->SpellIconID == 1982) + if ((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (*itr)->GetSpellProto()->SpellIconID == 1982) manaFeedVal+= (*itr)->GetModifier()->m_amount; } if (manaFeedVal > 0) @@ -2862,7 +2862,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) int hurt = 0; int heal = 0; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 47540: hurt = 47758; heal = 47757; break; case 53005: hurt = 53001; heal = 52986; break; @@ -2892,9 +2892,9 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (m_spellInfo->IsFitToFamilyMask(UI64LIT(0x0000000000000000), 0x00000100)) { //Shapeshifting into an animal form or mounting cancels the effect. - if(m_caster->GetCreatureType() == CREATURE_TYPE_BEAST || m_caster->IsMounted()) + if (m_caster->GetCreatureType() == CREATURE_TYPE_BEAST || m_caster->IsMounted()) { - if(m_triggeredByAuraSpell) + if (m_triggeredByAuraSpell) m_caster->RemoveAurasDueToSpell(m_triggeredByAuraSpell->Id); return; } @@ -2903,7 +2903,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (m_caster->hasUnitState(UNIT_STAT_NO_FREE_MOVE)) return; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 50286: m_caster->CastSpell(unitTarget, 50288, true); return; case 53196: m_caster->CastSpell(unitTarget, 53191, true); return; @@ -2918,16 +2918,16 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } case SPELLFAMILY_ROGUE: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 5938: // Shiv { if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - Player *pCaster = ((Player*)m_caster); + Player* pCaster = ((Player*)m_caster); - Item *item = pCaster->GetWeaponForAttack(OFF_ATTACK); + Item* item = pCaster->GetWeaponForAttack(OFF_ATTACK); if (!item) return; @@ -2936,7 +2936,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) if (!enchant_id) return; - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; @@ -2961,10 +2961,10 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; //immediately finishes the cooldown on certain Rogue abilities - const SpellCooldowns& cm = ((Player *)m_caster)->GetSpellCooldownMap(); + const SpellCooldowns& cm = ((Player*)m_caster)->GetSpellCooldownMap(); for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (spellInfo->SpellFamilyFlags & UI64LIT(0x0000024000000860))) ((Player*)m_caster)->RemoveSpellCooldown((itr++)->first,true); @@ -2999,7 +2999,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // check dazed affect Unit::AuraList const& decSpeedList = unitTarget->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); - for(Unit::AuraList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter) + for (Unit::AuraList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter) { if ((*iter)->GetSpellProto()->SpellIconID==15 && (*iter)->GetSpellProto()->Dispel==0) { @@ -3018,7 +3018,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { Unit* target = unitTarget; uint32 spellid; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 57635: spellid = 57636; break; // one from creature cases case 61507: spellid = 61508; break; // one from creature cases @@ -3031,7 +3031,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) m_caster->CastSpell(target,spellid,true,NULL); } - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 23989: // Readiness talent { @@ -3042,9 +3042,9 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) const SpellCooldowns& cm = ((Player*)m_caster)->GetSpellCooldownMap(); for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); - if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && GetSpellRecoveryTime(spellInfo) > 0 ) + if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->Id != 23989 && GetSpellRecoveryTime(spellInfo) > 0) ((Player*)m_caster)->RemoveSpellCooldown((itr++)->first,true); else ++itr; @@ -3086,7 +3086,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } case SPELLFAMILY_PALADIN: { - switch(m_spellInfo->SpellIconID) + switch (m_spellInfo->SpellIconID) { case 156: // Holy Shock { @@ -3096,7 +3096,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) int hurt = 0; int heal = 0; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 20473: hurt = 25912; heal = 25914; break; case 20929: hurt = 25911; heal = 25913; break; @@ -3132,7 +3132,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) } } - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 31789: // Righteous Defense (step 1) { @@ -3161,14 +3161,14 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // Righteous Defense (step 2) (in old version 31980 dummy effect) // Clear targets for eff 1 - for(TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) ihit->effectMask &= ~(1<<1); // not empty (checked), copy Unit::AttackerSet attackers = friendTarget->getAttackers(); // selected from list 3 - for(uint32 i = 0; i < std::min(size_t(3),attackers.size()); ++i) + for (uint32 i = 0; i < std::min(size_t(3),attackers.size()); ++i) { Unit::AttackerSet::iterator aItr = attackers.begin(); std::advance(aItr, rand() % attackers.size()); @@ -3185,7 +3185,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; uint32 spell_id = 0; - switch(unitTarget->getClass()) + switch (unitTarget->getClass()) { case CLASS_DRUID: spell_id = 37878; break; case CLASS_PALADIN: spell_id = 37879; break; @@ -3214,7 +3214,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { if (unitTarget) { - if (Unit *owner = m_caster->GetOwner()) + if (Unit* owner = m_caster->GetOwner()) { // spell have SPELL_DAMAGE_CLASS_NONE and not get bonuses from owner, use main spell for bonuses if (m_triggeredBySpellInfo) @@ -3225,13 +3225,13 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // Restorative Totems Unit::AuraList const& mDummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) + for (Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) // only its have dummy with specific icon if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && (*i)->GetSpellProto()->SpellIconID == 338) damage += (*i)->GetModifier()->m_amount * damage / 100; // Glyph of Healing Stream Totem - if (Aura *dummy = owner->GetDummyAura(55456)) + if (Aura* dummy = owner->GetDummyAura(55456)) damage += dummy->GetModifier()->m_amount * damage / 100; } m_caster->CastCustomSpell(unitTarget, 52042, &damage, NULL, NULL, true, 0, 0, m_originalCasterGUID); @@ -3269,8 +3269,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; // Glyph of Mana Tide - if (Unit *owner = m_caster->GetOwner()) - if (Aura *dummy = owner->GetDummyAura(55441)) + if (Unit* owner = m_caster->GetOwner()) + if (Aura* dummy = owner->GetDummyAura(55441)) damage+=dummy->GetModifier()->m_amount; // Regenerate 6% of Total Mana Every 3 secs int32 EffectBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * damage / 100; @@ -3282,16 +3282,16 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { if (m_caster->GetTypeId()!=TYPEID_PLAYER) return; - Item *item = ((Player*)m_caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); + Item* item = ((Player*)m_caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); if (item) { // Damage is increased if your off-hand weapon is enchanted with Flametongue. Unit::AuraList const& auraDummy = m_caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr) + for (Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr) { if ((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_SHAMAN && - ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000200000)) && - (*itr)->GetCastItemGuid() == item->GetObjectGuid()) + ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000200000)) && + (*itr)->GetCastItemGuid() == item->GetObjectGuid()) { m_damage += m_damage * damage / 100; return; @@ -3309,7 +3309,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) return; uint32 triggered_spell_id; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 1535: triggered_spell_id = 8349; break; case 8498: triggered_spell_id = 8502; break; @@ -3362,10 +3362,10 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) { uint32 count = 0; Unit::SpellAuraHolderMap const& auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) + for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) { if (itr->second->GetSpellProto()->Dispel == DISPEL_DISEASE && - itr->second->GetCasterGuid() == m_caster->GetObjectGuid()) + itr->second->GetCasterGuid() == m_caster->GetObjectGuid()) { ++count; // max. 15% @@ -3378,7 +3378,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // Improved Death Strike (percent stored in nonexistent EFFECT_INDEX_2 effect base points) Unit::AuraList const& auraMod = m_caster->GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER); - for(Unit::AuraList::const_iterator iter = auraMod.begin(); iter != auraMod.end(); ++iter) + for (Unit::AuraList::const_iterator iter = auraMod.begin(); iter != auraMod.end(); ++iter) { // only required spell have spellicon for SPELL_AURA_ADD_FLAT_MODIFIER if ((*iter)->GetSpellProto()->SpellIconID == 2751 && (*iter)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT) @@ -3447,9 +3447,9 @@ void Spell::EffectTriggerSpellWithValue(SpellEffectIndex eff_idx) uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[eff_idx]; // normal case - SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id ); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(triggered_spell_id); - if(!spellInfo) + if (!spellInfo) { sLog.outError("EffectTriggerSpellWithValue of spell %u: triggering unknown spell id %i", m_spellInfo->Id,triggered_spell_id); return; @@ -3462,9 +3462,9 @@ void Spell::EffectTriggerSpellWithValue(SpellEffectIndex eff_idx) void Spell::EffectTriggerRitualOfSummoning(SpellEffectIndex eff_idx) { uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[eff_idx]; - SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id ); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(triggered_spell_id); - if(!spellInfo) + if (!spellInfo) { sLog.outError("EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id,triggered_spell_id); return; @@ -3480,7 +3480,7 @@ void Spell::EffectClearQuest(SpellEffectIndex eff_idx) if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - Player *player = (Player*)m_caster; + Player* player = (Player*)m_caster; uint32 quest_id = m_spellInfo->EffectMiscValue[eff_idx]; @@ -3491,7 +3491,7 @@ void Spell::EffectClearQuest(SpellEffectIndex eff_idx) } // remove quest possibly in quest log (is that expected?) - for(uint16 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) + for (uint16 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) { uint32 quest = player->GetQuestSlotQuestId(slot); @@ -3515,7 +3515,7 @@ void Spell::EffectForceCast(SpellEffectIndex eff_idx) uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[eff_idx]; // normal case - SpellEntry const *spellInfo = sSpellStore.LookupEntry(triggered_spell_id); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(triggered_spell_id); if (!spellInfo) { @@ -3531,7 +3531,7 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex) // only unit case known if (!unitTarget) { - if(gameObjTarget || itemTarget) + if (gameObjTarget || itemTarget) sLog.outError("Spell::EffectTriggerSpell (Spell: %u): Unsupported non-unit case!",m_spellInfo->Id); return; } @@ -3539,9 +3539,9 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex) uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effIndex]; // special cases - switch(triggered_spell_id) + switch (triggered_spell_id) { - // Vanish (not exist) + // Vanish (not exist) case 18461: { unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); @@ -3564,15 +3564,15 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex) case 23770: // Sayge's Dark Fortune of * // not exist, common cooldown can be implemented in scripts if need. return; - // Brittle Armor - (need add max stack of 24575 Brittle Armor) + // Brittle Armor - (need add max stack of 24575 Brittle Armor) case 29284: m_caster->CastSpell(unitTarget, 24575, true, m_CastItem, NULL, m_originalCasterGUID); return; - // Mercurial Shield - (need add max stack of 26464 Mercurial Shield) + // Mercurial Shield - (need add max stack of 26464 Mercurial Shield) case 29286: m_caster->CastSpell(unitTarget, 26464, true, m_CastItem, NULL, m_originalCasterGUID); return; - // Righteous Defense + // Righteous Defense case 31980: { m_caster->CastSpell(unitTarget, 31790, true, m_CastItem, NULL, m_originalCasterGUID); @@ -3582,13 +3582,13 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex) case 35729: { Unit::SpellAuraHolderMap& Auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::iterator iter = Auras.begin(); iter != Auras.end(); ++iter) + for (Unit::SpellAuraHolderMap::iterator iter = Auras.begin(); iter != Auras.end(); ++iter) { // Remove all harmful spells on you except positive/passive/physical auras if (!iter->second->IsPositive() && - !iter->second->IsPassive() && - !iter->second->IsDeathPersistent() && - (GetSpellSchoolMask(iter->second->GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) == 0) + !iter->second->IsPassive() && + !iter->second->IsDeathPersistent() && + (GetSpellSchoolMask(iter->second->GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL) == 0) { m_caster->RemoveAurasDueToSpell(iter->second->GetSpellProto()->Id); iter = Auras.begin(); @@ -3599,7 +3599,7 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex) // Priest Shadowfiend (34433) need apply mana gain trigger aura on pet case 41967: { - if (Unit *pet = unitTarget->GetPet()) + if (Unit* pet = unitTarget->GetPet()) pet->CastSpell(pet, 28305, true); return; } @@ -3684,12 +3684,12 @@ void Spell::EffectTriggerMissileSpell(SpellEffectIndex effect_idx) uint32 triggered_spell_id = m_spellInfo->EffectTriggerSpell[effect_idx]; // normal case - SpellEntry const *spellInfo = sSpellStore.LookupEntry( triggered_spell_id ); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(triggered_spell_id); - if(!spellInfo) + if (!spellInfo) { sLog.outError("EffectTriggerMissileSpell of spell %u (eff: %u): triggering unknown spell id %u", - m_spellInfo->Id,effect_idx,triggered_spell_id); + m_spellInfo->Id,effect_idx,triggered_spell_id); return; } @@ -3701,27 +3701,27 @@ void Spell::EffectTriggerMissileSpell(SpellEffectIndex effect_idx) void Spell::EffectJump(SpellEffectIndex eff_idx) { - if(m_caster->IsTaxiFlying()) + if (m_caster->IsTaxiFlying()) return; // Init dest coordinates float x,y,z,o; - if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) + if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { x = m_targets.m_destX; y = m_targets.m_destY; z = m_targets.m_destZ; - if(m_spellInfo->EffectImplicitTargetA[eff_idx] == TARGET_BEHIND_VICTIM) + if (m_spellInfo->EffectImplicitTargetA[eff_idx] == TARGET_BEHIND_VICTIM) { // explicit cast data from client or server-side cast // some spell at client send caster Unit* pTarget = NULL; - if(m_targets.getUnitTarget() && m_targets.getUnitTarget()!=m_caster) + if (m_targets.getUnitTarget() && m_targets.getUnitTarget()!=m_caster) pTarget = m_targets.getUnitTarget(); - else if(unitTarget->getVictim()) + else if (unitTarget->getVictim()) pTarget = m_caster->getVictim(); - else if(m_caster->GetTypeId() == TYPEID_PLAYER) + else if (m_caster->GetTypeId() == TYPEID_PLAYER) pTarget = m_caster->GetMap()->GetUnit(((Player*)m_caster)->GetSelectionGuid()); o = pTarget ? pTarget->GetOrientation() : m_caster->GetOrientation(); @@ -3729,19 +3729,19 @@ void Spell::EffectJump(SpellEffectIndex eff_idx) else o = m_caster->GetOrientation(); } - else if(unitTarget) + else if (unitTarget) { unitTarget->GetContactPoint(m_caster,x,y,z,CONTACT_DISTANCE); o = m_caster->GetOrientation(); } - else if(gameObjTarget) + else if (gameObjTarget) { gameObjTarget->GetContactPoint(m_caster,x,y,z,CONTACT_DISTANCE); o = m_caster->GetOrientation(); } else { - sLog.outError( "Spell::EffectJump - unsupported target mode for spell ID %u", m_spellInfo->Id ); + sLog.outError("Spell::EffectJump - unsupported target mode for spell ID %u", m_spellInfo->Id); return; } @@ -3750,7 +3750,7 @@ void Spell::EffectJump(SpellEffectIndex eff_idx) void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->IsTaxiFlying()) + if (!unitTarget || unitTarget->IsTaxiFlying()) return; // Target dependend on TargetB, if there is none provided, decide dependend on A @@ -3773,15 +3773,15 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) case TARGET_TABLE_X_Y_Z_COORDINATES: { SpellTargetPosition const* st = sSpellMgr.GetSpellTargetPosition(m_spellInfo->Id); - if(!st) + if (!st) { - sLog.outError( "Spell::EffectTeleportUnits - unknown Teleport coordinates for spell ID %u", m_spellInfo->Id ); + sLog.outError("Spell::EffectTeleportUnits - unknown Teleport coordinates for spell ID %u", m_spellInfo->Id); return; } - if(st->target_mapId==unitTarget->GetMapId()) + if (st->target_mapId==unitTarget->GetMapId()) unitTarget->NearTeleportTo(st->target_X,st->target_Y,st->target_Z,st->target_Orientation,unitTarget==m_caster); - else if(unitTarget->GetTypeId()==TYPEID_PLAYER) + else if (unitTarget->GetTypeId()==TYPEID_PLAYER) ((Player*)unitTarget)->TeleportTo(st->target_mapId,st->target_X,st->target_Y,st->target_Z,st->target_Orientation,unitTarget==m_caster ? TELE_TO_SPELL : 0); break; } @@ -3799,15 +3799,15 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) } case TARGET_BEHIND_VICTIM: { - Unit *pTarget = NULL; + Unit* pTarget = NULL; // explicit cast data from client or server-side cast // some spell at client send caster - if(m_targets.getUnitTarget() && m_targets.getUnitTarget()!=unitTarget) + if (m_targets.getUnitTarget() && m_targets.getUnitTarget()!=unitTarget) pTarget = m_targets.getUnitTarget(); - else if(unitTarget->getVictim()) + else if (unitTarget->getVictim()) pTarget = unitTarget->getVictim(); - else if(unitTarget->GetTypeId() == TYPEID_PLAYER) + else if (unitTarget->GetTypeId() == TYPEID_PLAYER) pTarget = unitTarget->GetMap()->GetUnit(((Player*)unitTarget)->GetSelectionGuid()); // Init dest coordinates @@ -3821,9 +3821,9 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) default: { // If not exist data for dest location - return - if(!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) + if (!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) { - sLog.outError( "Spell::EffectTeleportUnits - unknown EffectImplicitTargetB[%u] = %u for spell ID %u", eff_idx, m_spellInfo->EffectImplicitTargetB[eff_idx], m_spellInfo->Id ); + sLog.outError("Spell::EffectTeleportUnits - unknown EffectImplicitTargetB[%u] = %u for spell ID %u", eff_idx, m_spellInfo->EffectImplicitTargetB[eff_idx], m_spellInfo->Id); return; } // Init dest coordinates @@ -3838,15 +3838,15 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) } // post effects for TARGET_TABLE_X_Y_Z_COORDINATES - switch ( m_spellInfo->Id ) + switch (m_spellInfo->Id) { - // Dimensional Ripper - Everlook + // Dimensional Ripper - Everlook case 23442: { int32 r = irand(0, 119); - if ( r >= 70 ) // 7/12 success + if (r >= 70) // 7/12 success { - if ( r < 100 ) // 4/12 evil twin + if (r < 100) // 4/12 evil twin m_caster->CastSpell(m_caster, 23445, true); else // 1/12 fire m_caster->CastSpell(m_caster, 23449, true); @@ -3856,10 +3856,10 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) // Ultrasafe Transporter: Toshley's Station case 36941: { - if ( roll_chance_i(50) ) // 50% success + if (roll_chance_i(50)) // 50% success { int32 rand_eff = urand(1, 7); - switch ( rand_eff ) + switch (rand_eff) { case 1: // soul split - evil @@ -3878,9 +3878,9 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) m_caster->CastSpell(m_caster, 36893, true); break; case 5: - // Transform + // Transform { - if (((Player*)m_caster)->GetTeam() == ALLIANCE ) + if (((Player*)m_caster)->GetTeam() == ALLIANCE) m_caster->CastSpell(m_caster, 36897, true); else m_caster->CastSpell(m_caster, 36899, true); @@ -3901,10 +3901,10 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) // Dimensional Ripper - Area 52 case 36890: { - if ( roll_chance_i(50) ) // 50% success + if (roll_chance_i(50)) // 50% success { int32 rand_eff = urand(1, 4); - switch ( rand_eff ) + switch (rand_eff) { case 1: // soul split - evil @@ -3919,9 +3919,9 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) m_caster->CastSpell(m_caster, 36895, true); break; case 4: - // Transform + // Transform { - if (((Player*)m_caster)->GetTeam() == ALLIANCE ) + if (((Player*)m_caster)->GetTeam() == ALLIANCE) m_caster->CastSpell(m_caster, 36897, true); else m_caster->CastSpell(m_caster, 36899, true); @@ -3936,16 +3936,16 @@ void Spell::EffectTeleportUnits(SpellEffectIndex eff_idx) void Spell::EffectApplyAura(SpellEffectIndex eff_idx) { - if(!unitTarget) + if (!unitTarget) return; // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load) - if ( (!unitTarget->isAlive() && !(IsDeathOnlySpell(m_spellInfo) || IsDeathPersistentSpell(m_spellInfo))) && - (unitTarget->GetTypeId() != TYPEID_PLAYER || !((Player*)unitTarget)->GetSession()->PlayerLoading()) ) + if ((!unitTarget->isAlive() && !(IsDeathOnlySpell(m_spellInfo) || IsDeathPersistentSpell(m_spellInfo))) && + (unitTarget->GetTypeId() != TYPEID_PLAYER || !((Player*)unitTarget)->GetSession()->PlayerLoading())) return; Unit* caster = GetAffectiveCaster(); - if(!caster) + if (!caster) { // FIXME: currently we can't have auras applied explicitly by gameobjects // so for auras from wild gameobjects (no owner) target used @@ -3963,31 +3963,31 @@ void Spell::EffectApplyAura(SpellEffectIndex eff_idx) void Spell::EffectUnlearnSpecialization(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - Player *_player = (Player*)unitTarget; + Player* _player = (Player*)unitTarget; uint32 spellToUnlearn = m_spellInfo->EffectTriggerSpell[eff_idx]; _player->removeSpell(spellToUnlearn); - DEBUG_LOG( "Spell: Player %u has unlearned spell %u from NpcGUID: %u", _player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow() ); + DEBUG_LOG("Spell: Player %u has unlearned spell %u from NpcGUID: %u", _player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow()); } void Spell::EffectPowerDrain(SpellEffectIndex eff_idx) { - if(m_spellInfo->EffectMiscValue[eff_idx] < 0 || m_spellInfo->EffectMiscValue[eff_idx] >= MAX_POWERS) + if (m_spellInfo->EffectMiscValue[eff_idx] < 0 || m_spellInfo->EffectMiscValue[eff_idx] >= MAX_POWERS) return; Powers drain_power = Powers(m_spellInfo->EffectMiscValue[eff_idx]); - if(!unitTarget) + if (!unitTarget) return; - if(!unitTarget->isAlive()) + if (!unitTarget->isAlive()) return; - if(unitTarget->getPowerType() != drain_power) + if (unitTarget->getPowerType() != drain_power) return; - if(damage < 0) + if (damage < 0) return; uint32 curPower = unitTarget->GetPower(drain_power); @@ -4002,7 +4002,7 @@ void Spell::EffectPowerDrain(SpellEffectIndex eff_idx) power -= unitTarget->GetSpellCritDamageReduction(power); int32 new_damage; - if(curPower < power) + if (curPower < power) new_damage = curPower; else new_damage = power; @@ -4010,13 +4010,13 @@ void Spell::EffectPowerDrain(SpellEffectIndex eff_idx) unitTarget->ModifyPower(drain_power,-new_damage); // Don`t restore from self drain - if(drain_power == POWER_MANA && m_caster != unitTarget) + if (drain_power == POWER_MANA && m_caster != unitTarget) { float manaMultiplier = m_spellInfo->EffectMultipleValue[eff_idx]; - if(manaMultiplier==0) + if (manaMultiplier==0) manaMultiplier = 1; - if(Player *modOwner = m_caster->GetSpellModOwner()) + if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, manaMultiplier); int32 gain = int32(new_damage * manaMultiplier); @@ -4057,7 +4057,7 @@ void Spell::EffectPowerBurn(SpellEffectIndex eff_idx) { int32 maxdamage = m_caster->GetMaxPower(powertype) * damage * 2 / 100; damage = unitTarget->GetMaxPower(powertype) * damage / 100; - if(damage > maxdamage) + if (damage > maxdamage) damage = maxdamage; } @@ -4073,7 +4073,7 @@ void Spell::EffectPowerBurn(SpellEffectIndex eff_idx) unitTarget->ModifyPower(powertype, -new_damage); float multiplier = m_spellInfo->EffectMultipleValue[eff_idx]; - if (Player *modOwner = m_caster->GetSpellModOwner()) + if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier); new_damage = int32(new_damage * multiplier); @@ -4085,7 +4085,7 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/) if (unitTarget && unitTarget->isAlive() && damage >= 0) { // Try to get original caster - Unit *caster = GetAffectiveCaster(); + Unit* caster = GetAffectiveCaster(); if (!caster) return; @@ -4106,7 +4106,7 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/) // Amount of heal - depends from stacked Holy Energy int damageAmount = 0; Unit::AuraList const& mDummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) + for (Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) if ((*i)->GetId() == 45062) damageAmount+=(*i)->GetModifier()->m_amount; if (damageAmount) @@ -4122,12 +4122,12 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/) { Unit::AuraList const& RejorRegr = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_HEAL); // find most short by duration - Aura *targetAura = NULL; - for(Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) + Aura* targetAura = NULL; + for (Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) { if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && - // Regrowth or Rejuvenation 0x40 | 0x10 - ((*i)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000050))) + // Regrowth or Rejuvenation 0x40 | 0x10 + ((*i)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000050))) { if (!targetAura || (*i)->GetAuraDuration() < targetAura->GetAuraDuration()) targetAura = *i; @@ -4140,9 +4140,9 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/) return; } int idx = 0; - while(idx < 3) + while (idx < 3) { - if(targetAura->GetSpellProto()->EffectApplyAuraName[idx] == SPELL_AURA_PERIODIC_HEAL) + if (targetAura->GetSpellProto()->EffectApplyAuraName[idx] == SPELL_AURA_PERIODIC_HEAL) break; idx++; } @@ -4191,7 +4191,7 @@ void Spell::EffectHealPct(SpellEffectIndex /*eff_idx*/) if (unitTarget && unitTarget->isAlive() && damage >= 0) { // Try to get original caster - Unit *caster = GetAffectiveCaster(); + Unit* caster = GetAffectiveCaster(); if (!caster) return; @@ -4214,7 +4214,7 @@ void Spell::EffectHealMechanical(SpellEffectIndex /*eff_idx*/) if (unitTarget && unitTarget->isAlive() && damage >= 0) { // Try to get original caster - Unit *caster = GetAffectiveCaster(); + Unit* caster = GetAffectiveCaster(); if (!caster) return; @@ -4241,13 +4241,13 @@ void Spell::EffectHealthLeech(SpellEffectIndex eff_idx) DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "HealthLeech :%i", damage); uint32 curHealth = unitTarget->GetHealth(); - damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, damage ); + damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, damage); if ((int32)curHealth < damage) damage = curHealth; float multiplier = m_spellInfo->EffectMultipleValue[eff_idx]; - if (Player *modOwner = m_caster->GetSpellModOwner()) + if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier); int32 heal = int32(damage*multiplier); @@ -4270,16 +4270,16 @@ void Spell::DoCreateItem(SpellEffectIndex eff_idx, uint32 itemtype) Player* player = (Player*)unitTarget; uint32 newitemid = itemtype; - ItemPrototype const *pProto = ObjectMgr::GetItemPrototype( newitemid ); - if(!pProto) + ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(newitemid); + if (!pProto) { - player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } // bg reward have some special in code work bool bg_mark = false; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case SPELL_WG_MARK_VICTORY: case SPELL_WG_MARK_DEFEAT: @@ -4303,10 +4303,10 @@ void Spell::DoCreateItem(SpellEffectIndex eff_idx, uint32 itemtype) // the maximum number of created additional items uint8 additionalMaxNum=0; // get the chance and maximum number for creating extra items - if ( canCreateExtraItems(player, m_spellInfo->Id, additionalCreateChance, additionalMaxNum) ) + if (canCreateExtraItems(player, m_spellInfo->Id, additionalCreateChance, additionalMaxNum)) { // roll with this chance till we roll not to create or we create the max num - while ( roll_chance_f(additionalCreateChance) && items_count<=additionalMaxNum ) + while (roll_chance_f(additionalCreateChance) && items_count<=additionalMaxNum) ++items_count; } @@ -4316,7 +4316,7 @@ void Spell::DoCreateItem(SpellEffectIndex eff_idx, uint32 itemtype) // can the player store the new item? ItemPosCountVec dest; uint32 no_space = 0; - InventoryResult msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, newitemid, num_to_add, &no_space ); + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, newitemid, num_to_add, &no_space); if (msg != EQUIP_ERR_OK) { // convert to possible store amount @@ -4325,24 +4325,24 @@ void Spell::DoCreateItem(SpellEffectIndex eff_idx, uint32 itemtype) else { // ignore mana gem case (next effect will recharge existing example) - if (eff_idx == EFFECT_INDEX_0 && m_spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_DUMMY ) + if (eff_idx == EFFECT_INDEX_0 && m_spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_DUMMY) return; // if not created by another reason from full inventory or unique items amount limitation - player->SendEquipError( msg, NULL, NULL, newitemid ); + player->SendEquipError(msg, NULL, NULL, newitemid); return; } } - if(num_to_add) + if (num_to_add) { // create the new item and store it - Item* pItem = player->StoreNewItem( dest, newitemid, true, Item::GenerateItemRandomPropertyId(newitemid)); + Item* pItem = player->StoreNewItem(dest, newitemid, true, Item::GenerateItemRandomPropertyId(newitemid)); // was it successful? return error if not - if(!pItem) + if (!pItem) { - player->SendEquipError( EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } @@ -4354,7 +4354,7 @@ void Spell::DoCreateItem(SpellEffectIndex eff_idx, uint32 itemtype) player->SendNewItem(pItem, num_to_add, true, !bg_mark); // we succeeded in creating at least one item, so a levelup is possible - if(!bg_mark) + if (!bg_mark) player->UpdateCraftSkill(m_spellInfo->Id); } } @@ -4379,7 +4379,7 @@ void Spell::EffectCreateItem2(SpellEffectIndex eff_idx) // not explicit loot (with fake item drop if need) if (IsLootCraftingSpell(m_spellInfo)) { - if(item_id) + if (item_id) { if (!player->HasItemCount(item_id, 1)) return; @@ -4418,7 +4418,7 @@ void Spell::EffectPersistentAA(SpellEffectIndex eff_idx) DynamicObject* dynObj = new DynamicObject; if (!dynObj->Create(pCaster->GetMap()->GenerateLocalLowGuid(HIGHGUID_DYNAMICOBJECT), pCaster, m_spellInfo->Id, - eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, m_duration, radius, DYNAMIC_OBJECT_AREA_SPELL)) + eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, m_duration, radius, DYNAMIC_OBJECT_AREA_SPELL)) { delete dynObj; return; @@ -4430,12 +4430,12 @@ void Spell::EffectPersistentAA(SpellEffectIndex eff_idx) void Spell::EffectEnergize(SpellEffectIndex eff_idx) { - if(!unitTarget) + if (!unitTarget) return; - if(!unitTarget->isAlive()) + if (!unitTarget->isAlive()) return; - if(m_spellInfo->EffectMiscValue[eff_idx] < 0 || m_spellInfo->EffectMiscValue[eff_idx] >= MAX_POWERS) + if (m_spellInfo->EffectMiscValue[eff_idx] < 0 || m_spellInfo->EffectMiscValue[eff_idx] >= MAX_POWERS) return; Powers power = Powers(m_spellInfo->EffectMiscValue[eff_idx]); @@ -4481,10 +4481,10 @@ void Spell::EffectEnergize(SpellEffectIndex eff_idx) if (level_diff > 0) damage -= level_multiplier * level_diff; - if(damage < 0) + if (damage < 0) return; - if(unitTarget->GetMaxPower(power) == 0) + if (unitTarget->GetMaxPower(power) == 0) return; m_caster->EnergizeBySpell(unitTarget, m_spellInfo->Id, damage, power); @@ -4495,10 +4495,10 @@ void Spell::EffectEnergize(SpellEffectIndex eff_idx) // find elixirs on target uint32 elixir_mask = 0; Unit::SpellAuraHolderMap& Auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::iterator itr = Auras.begin(); itr != Auras.end(); ++itr) + for (Unit::SpellAuraHolderMap::iterator itr = Auras.begin(); itr != Auras.end(); ++itr) { uint32 spell_id = itr->second->GetId(); - if(uint32 mask = sSpellMgr.GetSpellElixirMask(spell_id)) + if (uint32 mask = sSpellMgr.GetSpellElixirMask(spell_id)) elixir_mask |= mask; } @@ -4508,14 +4508,14 @@ void Spell::EffectEnergize(SpellEffectIndex eff_idx) // get all available elixirs by mask and spell level std::vector elixirs; SpellElixirMap const& m_spellElixirs = sSpellMgr.GetSpellElixirMap(); - for(SpellElixirMap::const_iterator itr = m_spellElixirs.begin(); itr != m_spellElixirs.end(); ++itr) + for (SpellElixirMap::const_iterator itr = m_spellElixirs.begin(); itr != m_spellElixirs.end(); ++itr) { if (itr->second & elixir_mask) { if (itr->second & (ELIXIR_UNSTABLE_MASK | ELIXIR_SHATTRATH_MASK)) continue; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(itr->first); if (spellInfo && (spellInfo->spellLevel < m_spellInfo->spellLevel || spellInfo->spellLevel > unitTarget->getLevel())) continue; @@ -4596,7 +4596,7 @@ void Spell::EffectOpenLock(SpellEffectIndex eff_idx) { if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER) { - DEBUG_LOG( "WORLD: Open Lock - No Player Caster!"); + DEBUG_LOG("WORLD: Open Lock - No Player Caster!"); return; } @@ -4611,11 +4611,11 @@ void Spell::EffectOpenLock(SpellEffectIndex eff_idx) GameObjectInfo const* goInfo = gameObjTarget->GetGOInfo(); // Arathi Basin banner opening ! if ((goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune) || - (goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK)) + (goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK)) { //CanUseBattleGroundObject() already called in CheckCast() // in battleground check - if (BattleGround *bg = player->GetBattleGround()) + if (BattleGround* bg = player->GetBattleGround()) { // check if it's correct bg if (bg->GetTypeID() == BATTLEGROUND_AB || bg->GetTypeID() == BATTLEGROUND_AV) @@ -4627,7 +4627,7 @@ void Spell::EffectOpenLock(SpellEffectIndex eff_idx) { //CanUseBattleGroundObject() already called in CheckCast() // in battleground check - if (BattleGround *bg = player->GetBattleGround()) + if (BattleGround* bg = player->GetBattleGround()) { if (bg->GetTypeID() == BATTLEGROUND_EY) bg->EventPlayerClickedOnFlag(player, gameObjTarget); @@ -4644,7 +4644,7 @@ void Spell::EffectOpenLock(SpellEffectIndex eff_idx) } else { - DEBUG_LOG( "WORLD: Open Lock - No GameObject/Item Target!"); + DEBUG_LOG("WORLD: Open Lock - No GameObject/Item Target!"); return; } @@ -4675,7 +4675,7 @@ void Spell::EffectOpenLock(SpellEffectIndex eff_idx) { // Allow one skill-up until respawned if (!gameObjTarget->IsInSkillupList(player) && - player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue)) + player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue)) gameObjTarget->AddToSkillupList(player); } else if (itemTarget) @@ -4692,7 +4692,7 @@ void Spell::EffectSummonChangeItem(SpellEffectIndex eff_idx) if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - Player *player = (Player*)m_caster; + Player* player = (Player*)m_caster; // applied only to using item if (!m_CastItem) @@ -4718,7 +4718,7 @@ void Spell::EffectProficiency(SpellEffectIndex /*eff_idx*/) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - Player *p_target = (Player*)unitTarget; + Player* p_target = (Player*)unitTarget; uint32 subClassMask = m_spellInfo->EquippedItemSubClassMask; if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask)) @@ -4816,13 +4816,13 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx) } bool summonResult = false; - switch(summon_prop->Group) + switch (summon_prop->Group) { - // faction handled later on, or loaded from template + // faction handled later on, or loaded from template case SUMMON_PROP_GROUP_WILD: case SUMMON_PROP_GROUP_FRIENDLY: { - switch(summon_prop->Title) // better from known way sorting summons by AI types + switch (summon_prop->Title) // better from known way sorting summons by AI types { case UNITNAME_SUMMON_TITLE_NONE: { @@ -4896,7 +4896,7 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx) break; default: sLog.outError("EffectSummonType: Unhandled summon title %u", summon_prop->Title); - break; + break; } break; } @@ -5049,7 +5049,7 @@ bool Spell::DoSummonCritter(CreatureSummonPositions& list, SummonPropertiesEntry //critter->InitLevelupSpellsForLevel(); // none? critter->SelectLevel(critter->GetCreatureInfo()); // some summoned creaters have different from 1 DB data for level/hp critter->SetUInt32Value(UNIT_NPC_FLAGS, critter->GetCreatureInfo()->npcflag); - // some mini-pets have quests + // some mini-pets have quests // set timer for unsummon if (m_duration > 0) critter->SetDuration(m_duration); @@ -5140,7 +5140,7 @@ bool Spell::DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc) // unsummon old totem if (slot < MAX_TOTEM_SLOT) - if (Totem *OldTotem = m_caster->GetTotem(TotemSlot(slot))) + if (Totem* OldTotem = m_caster->GetTotem(TotemSlot(slot))) OldTotem->UnSummon(); // FIXME: Setup near to finish point because GetObjectBoundingRadius set in Create but some Create calls can be dependent from proper position @@ -5299,12 +5299,12 @@ bool Spell::DoSummonPet(SpellEffectIndex eff_idx) } // Summon in dest location - CreatureCreatePos pos (m_caster->GetMap(), m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, -m_caster->GetOrientation(), m_caster->GetPhaseMask()); + CreatureCreatePos pos(m_caster->GetMap(), m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, -m_caster->GetOrientation(), m_caster->GetPhaseMask()); if (!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)) pos = CreatureCreatePos(m_caster, -m_caster->GetOrientation()); - Map *map = m_caster->GetMap(); + Map* map = m_caster->GetMap(); uint32 pet_number = sObjectMgr.GeneratePetNumber(); if (!spawnCreature->Create(map->GenerateLocalLowGuid(HIGHGUID_PET), pos, cInfo, pet_number)) { @@ -5347,7 +5347,7 @@ bool Spell::DoSummonPet(SpellEffectIndex eff_idx) if (m_caster->GetTypeId() == TYPEID_PLAYER) { - spawnCreature->GetCharmInfo()->SetReactState( REACT_DEFENSIVE ); + spawnCreature->GetCharmInfo()->SetReactState(REACT_DEFENSIVE); spawnCreature->SavePetToDB(PET_SAVE_AS_CURRENT); ((Player*)m_caster)->PetSpellInitialize(); } @@ -5373,12 +5373,12 @@ void Spell::EffectLearnSpell(SpellEffectIndex eff_idx) return; } - Player *player = (Player*)unitTarget; + Player* player = (Player*)unitTarget; uint32 spellToLearn = ((m_spellInfo->Id==SPELL_ID_GENERIC_LEARN) || (m_spellInfo->Id==SPELL_ID_GENERIC_LEARN_PET)) ? damage : m_spellInfo->EffectTriggerSpell[eff_idx]; player->learnSpell(spellToLearn, false); - DEBUG_LOG( "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow() ); + DEBUG_LOG("Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow()); } void Spell::EffectDispel(SpellEffectIndex eff_idx) @@ -5391,14 +5391,14 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx) // Create dispel mask by dispel type uint32 dispel_type = m_spellInfo->EffectMiscValue[eff_idx]; - uint32 dispelMask = GetDispellMask( DispelType(dispel_type) ); + uint32 dispelMask = GetDispellMask(DispelType(dispel_type)); Unit::SpellAuraHolderMap const& auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { - SpellAuraHolder *holder = itr->second; + SpellAuraHolder* holder = itr->second; if ((1<GetSpellProto()->Dispel) & dispelMask) { - if(holder->GetSpellProto()->Dispel == DISPEL_MAGIC) + if (holder->GetSpellProto()->Dispel == DISPEL_MAGIC) { bool positive = true; if (!holder->IsPositive()) @@ -5426,7 +5426,7 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx) std::list < uint32 > fail_list; // spell_id // some spells have effect value = 0 and all from its by meaning expect 1 - if(!damage) + if (!damage) damage = 1; // Dispel N = damage buffs (or while exist buffs for dispel) @@ -5436,7 +5436,7 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx) std::list >::iterator dispel_itr = dispel_list.begin(); std::advance(dispel_itr,urand(0, dispel_list.size()-1)); - SpellAuraHolder *holder = dispel_itr->first; + SpellAuraHolder* holder = dispel_itr->first; dispel_itr->second -= 1; @@ -5449,9 +5449,9 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx) // TODO: possible chance depend from spell level?? int32 miss_chance = 0; // Apply dispel mod from aura caster - if (Unit *caster = holder->GetCaster()) + if (Unit* caster = holder->GetCaster()) { - if ( Player* modOwner = caster->GetSpellModOwner() ) + if (Player* modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_RESIST_DISPEL_CHANCE, miss_chance, this); } // Try dispel @@ -5575,14 +5575,14 @@ void Spell::EffectPickPocket(SpellEffectIndex /*eff_idx*/) void Spell::EffectAddFarsight(SpellEffectIndex eff_idx) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; DynamicObject* dynObj = new DynamicObject; // set radius to 0: spell not expected to work as persistent aura - if(!dynObj->Create(m_caster->GetMap()->GenerateLocalLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, - m_spellInfo->Id, eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, m_duration, 0, DYNAMIC_OBJECT_FARSIGHT_FOCUS)) + if (!dynObj->Create(m_caster->GetMap()->GenerateLocalLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, + m_spellInfo->Id, eff_idx, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, m_duration, 0, DYNAMIC_OBJECT_FARSIGHT_FOCUS)) { delete dynObj; return; @@ -5671,7 +5671,7 @@ void Spell::EffectEnchantItemPerm(SpellEffectIndex eff_idx) if (!enchant_id) return; - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; @@ -5699,12 +5699,12 @@ void Spell::EffectEnchantItemPerm(SpellEffectIndex eff_idx) if (!(m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAG_ENCHANT_SCROLL)) p_caster->UpdateCraftSkill(m_spellInfo->Id); - if (item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE) ) + if (item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE)) { sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)", - p_caster->GetName(),p_caster->GetSession()->GetAccountId(), - itemTarget->GetProto()->Name1,itemTarget->GetEntry(), - item_owner->GetName(),item_owner->GetSession()->GetAccountId()); + p_caster->GetName(),p_caster->GetSession()->GetAccountId(), + itemTarget->GetProto()->Name1,itemTarget->GetEntry(), + item_owner->GetName(),item_owner->GetSession()->GetAccountId()); } // remove old enchanting before applying new if equipped @@ -5729,14 +5729,14 @@ void Spell::EffectEnchantItemPrismatic(SpellEffectIndex eff_idx) if (!enchant_id) return; - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; // support only enchantings with add socket in this slot { bool add_socket = false; - for(int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) { if (pEnchant->type[i]==ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET) { @@ -5747,7 +5747,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffectIndex eff_idx) if (!add_socket) { sLog.outError("Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.", - m_spellInfo->Id,SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC,ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET); + m_spellInfo->Id,SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC,ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET); return; } } @@ -5757,12 +5757,12 @@ void Spell::EffectEnchantItemPrismatic(SpellEffectIndex eff_idx) if (!item_owner) return; - if (item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE) ) + if (item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE)) { sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)", - p_caster->GetName(),p_caster->GetSession()->GetAccountId(), - itemTarget->GetProto()->Name1,itemTarget->GetEntry(), - item_owner->GetName(),item_owner->GetSession()->GetAccountId()); + p_caster->GetName(),p_caster->GetSession()->GetAccountId(), + itemTarget->GetProto()->Name1,itemTarget->GetEntry(), + item_owner->GetName(),item_owner->GetSession()->GetAccountId()); } // remove old enchanting before applying new if equipped @@ -5789,17 +5789,17 @@ void Spell::EffectEnchantItemTmp(SpellEffectIndex eff_idx) // enchanting spell selected by calculated damage-per-sec stored in Effect[1] base value // Note: damage calculated (correctly) with rounding int32(float(v)) but // RW enchantments applied damage int32(float(v)+0.5), this create 0..1 difference sometime - switch(damage) + switch (damage) { - // Rank 1 + // Rank 1 case 2: spell_id = 36744; break; // 0% [ 7% == 2, 14% == 2, 20% == 2] - // Rank 2 + // Rank 2 case 4: spell_id = 36753; break; // 0% [ 7% == 4, 14% == 4] case 5: spell_id = 36751; break; // 20% - // Rank 3 + // Rank 3 case 6: spell_id = 36754; break; // 0% [ 7% == 6, 14% == 6] case 7: spell_id = 36755; break; // 20% - // Rank 4 + // Rank 4 case 9: spell_id = 36761; break; // 0% [ 7% == 6] case 10: spell_id = 36758; break; // 14% case 11: spell_id = 36760; break; // 20% @@ -5808,16 +5808,16 @@ void Spell::EffectEnchantItemTmp(SpellEffectIndex eff_idx) return; } - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id); if (!spellInfo) { sLog.outError("Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); return; } - Spell *spell = new Spell(m_caster, spellInfo, true); + Spell* spell = new Spell(m_caster, spellInfo, true); SpellCastTargets targets; - targets.setItemTarget( itemTarget ); + targets.setItemTarget(itemTarget); spell->prepare(&targets); return; } @@ -5833,8 +5833,8 @@ void Spell::EffectEnchantItemTmp(SpellEffectIndex eff_idx) return; } - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!pEnchant) + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + if (!pEnchant) { sLog.outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have nonexistent enchanting id %u ",m_spellInfo->Id,eff_idx,enchant_id); return; @@ -5844,26 +5844,26 @@ void Spell::EffectEnchantItemTmp(SpellEffectIndex eff_idx) uint32 duration; // rogue family enchantments exception by duration - if(m_spellInfo->Id == 38615) + if (m_spellInfo->Id == 38615) duration = 1800; // 30 mins // other rogue family enchantments always 1 hour (some have spell damage=0, but some have wrong data in EffBasePoints) - else if(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE) + else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE) duration = 3600; // 1 hour // shaman family enchantments - else if(m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN) + else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN) duration = 1800; // 30 mins // other cases with this SpellVisual already selected - else if(m_spellInfo->SpellVisual[0] == 215) + else if (m_spellInfo->SpellVisual[0] == 215) duration = 1800; // 30 mins // some fishing pole bonuses - else if(m_spellInfo->SpellVisual[0] == 563) + else if (m_spellInfo->SpellVisual[0] == 563) duration = 600; // 10 mins // shaman rockbiter enchantments - else if(m_spellInfo->SpellVisual[0] == 0) + else if (m_spellInfo->SpellVisual[0] == 0) duration = 1800; // 30 mins - else if(m_spellInfo->Id == 29702) + else if (m_spellInfo->Id == 29702) duration = 300; // 5 mins - else if(m_spellInfo->Id == 37360) + else if (m_spellInfo->Id == 37360) duration = 300; // 5 mins // default case else @@ -5871,15 +5871,15 @@ void Spell::EffectEnchantItemTmp(SpellEffectIndex eff_idx) // item can be in trade slot and have owner diff. from caster Player* item_owner = itemTarget->GetOwner(); - if(!item_owner) + if (!item_owner) return; - if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE) ) + if (item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE)) { sLog.outCommand(p_caster->GetSession()->GetAccountId(),"GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)", - p_caster->GetName(), p_caster->GetSession()->GetAccountId(), - itemTarget->GetProto()->Name1, itemTarget->GetEntry(), - item_owner->GetName(), item_owner->GetSession()->GetAccountId()); + p_caster->GetName(), p_caster->GetSession()->GetAccountId(), + itemTarget->GetProto()->Name1, itemTarget->GetEntry(), + item_owner->GetName(), item_owner->GetSession()->GetAccountId()); } // remove old enchanting before applying new if equipped @@ -5905,7 +5905,7 @@ void Spell::EffectTameCreature(SpellEffectIndex /*eff_idx*/) Pet* pet = new Pet(HUNTER_PET); - if(!pet->CreateBaseAtCreature(creatureTarget)) + if (!pet->CreateBaseAtCreature(creatureTarget)) { delete pet; return; @@ -5963,15 +5963,15 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) { uint32 petentry = m_spellInfo->EffectMiscValue[eff_idx]; - Pet *OldSummon = m_caster->GetPet(); + Pet* OldSummon = m_caster->GetPet(); // if pet requested type already exist - if( OldSummon ) + if (OldSummon) { - if(petentry == 0 || OldSummon->GetEntry() == petentry) + if (petentry == 0 || OldSummon->GetEntry() == petentry) { // pet in corpse state can't be summoned - if( OldSummon->isDead() ) + if (OldSummon->isDead()) return; OldSummon->GetMap()->Remove((Creature*)OldSummon,false); @@ -5982,14 +5982,14 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) OldSummon->Relocate(px, py, pz, OldSummon->GetOrientation()); m_caster->GetMap()->Add((Creature*)OldSummon); - if(m_caster->GetTypeId() == TYPEID_PLAYER && OldSummon->isControlled() ) + if (m_caster->GetTypeId() == TYPEID_PLAYER && OldSummon->isControlled()) { ((Player*)m_caster)->PetSpellInitialize(); } return; } - if(m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->GetTypeId() == TYPEID_PLAYER) OldSummon->Unsummon(OldSummon->getPetType() == HUNTER_PET ? PET_SAVE_AS_DELETED : PET_SAVE_NOT_IN_SLOT, m_caster); else return; @@ -6019,7 +6019,7 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) CreatureCreatePos pos(m_caster, m_caster->GetOrientation()); - Map *map = m_caster->GetMap(); + Map* map = m_caster->GetMap(); uint32 pet_number = sObjectMgr.GeneratePetNumber(); if (!NewSummon->Create(map->GenerateLocalLowGuid(HIGHGUID_PET), pos, cInfo, pet_number)) { @@ -6033,9 +6033,9 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) NewSummon->setPetType(SUMMON_PET); uint32 faction = m_caster->getFaction(); - if(m_caster->GetTypeId() == TYPEID_UNIT) + if (m_caster->GetTypeId() == TYPEID_UNIT) { - if ( ((Creature*)m_caster)->IsTotem() ) + if (((Creature*)m_caster)->IsTotem()) NewSummon->GetCharmInfo()->SetReactState(REACT_AGGRESSIVE); else NewSummon->GetCharmInfo()->SetReactState(REACT_DEFENSIVE); @@ -6053,10 +6053,10 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) NewSummon->GetCharmInfo()->SetPetNumber(pet_number, true); // this enables pet details window (Shift+P) - if(m_caster->IsPvP()) + if (m_caster->IsPvP()) NewSummon->SetPvP(true); - if(m_caster->IsFFAPvP()) + if (m_caster->IsFFAPvP()) NewSummon->SetFFAPvP(true); NewSummon->InitStatsForLevel(petlevel, m_caster); @@ -6087,7 +6087,7 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) m_caster->SetPet(NewSummon); DEBUG_LOG("New Pet has guid %u", NewSummon->GetGUIDLow()); - if(m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->GetTypeId() == TYPEID_PLAYER) { NewSummon->SavePetToDB(PET_SAVE_AS_CURRENT); ((Player*)m_caster)->PetSpellInitialize(); @@ -6096,19 +6096,19 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx) void Spell::EffectLearnPetSpell(SpellEffectIndex eff_idx) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - Player *_player = (Player*)m_caster; + Player* _player = (Player*)m_caster; - Pet *pet = _player->GetPet(); - if(!pet) + Pet* pet = _player->GetPet(); + if (!pet) return; - if(!pet->isAlive()) + if (!pet->isAlive()) return; - SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[eff_idx]); - if(!learn_spellproto) + SpellEntry const* learn_spellproto = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[eff_idx]); + if (!learn_spellproto) return; pet->learnSpell(learn_spellproto->Id); @@ -6140,9 +6140,9 @@ void Spell::EffectTaunt(SpellEffectIndex /*eff_idx*/) void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) { - if(!unitTarget) + if (!unitTarget) return; - if(!unitTarget->isAlive()) + if (!unitTarget->isAlive()) return; // multiple weapon dmg effect workaround @@ -6150,7 +6150,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) // and handle all effects at once for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { - switch(m_spellInfo->Effect[j]) + switch (m_spellInfo->Effect[j]) { case SPELL_EFFECT_WEAPON_DAMAGE: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: @@ -6158,7 +6158,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: if (j < int(eff_idx)) // we must calculate only at last weapon effect return; - break; + break; } } @@ -6171,21 +6171,21 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) int32 spell_bonus = 0; // bonus specific for spell - switch(m_spellInfo->SpellFamilyName) + switch (m_spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { - // for spells with divided damage to targets + // for spells with divided damage to targets case 66765: case 66809: case 67331: // Meteor Fists case 67333: // Meteor Fists case 69055: // Bone Slice case 71021: // Saber Lash { uint32 count = 0; - for(TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) - if(ihit->effectMask & (1<effectMask & (1<SpellVisual[0] == 12295 && m_spellInfo->SpellIconID == 1508) + if (m_spellInfo->SpellVisual[0] == 12295 && m_spellInfo->SpellIconID == 1508) { // Sunder Armor Aura* sunder = unitTarget->GetAura(SPELL_AURA_MOD_RESISTANCE_PCT, SPELLFAMILY_WARRIOR, UI64LIT(0x0000000000004000), 0x00000000, m_caster->GetObjectGuid()); @@ -6219,19 +6219,19 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) case SPELLFAMILY_ROGUE: { // Mutilate (for each hand) - if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x600000000)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x600000000)) { bool found = false; // fast check - if(unitTarget->HasAuraState(AURA_STATE_DEADLY_POISON)) + if (unitTarget->HasAuraState(AURA_STATE_DEADLY_POISON)) found = true; // full aura scan else { Unit::SpellAuraHolderMap const& auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) + for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) { - if(itr->second->GetSpellProto()->Dispel == DISPEL_POISON) + if (itr->second->GetSpellProto()->Dispel == DISPEL_POISON) { found = true; break; @@ -6239,7 +6239,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) } } - if(found) + if (found) totalDamagePercentMod *= 1.2f; // 120% if poisoned } // Fan of Knives @@ -6268,7 +6268,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) case SPELLFAMILY_PALADIN: { // Judgement of Command - receive benefit from Spell Damage and Attack Power - if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x00020000000000)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x00020000000000)) { float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK); int32 holy = m_caster->SpellBaseDamageBonusDone(GetSpellSchoolMask(m_spellInfo)); @@ -6285,7 +6285,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) { // 0.4*RAP added to damage (that is 0.2 if we apply PercentMod (200%) to spell_bonus, too) spellBonusNeedWeaponDamagePercentMod = true; - spell_bonus += int32( 0.2f * m_caster->GetTotalAttackPowerValue(RANGED_ATTACK) ); + spell_bonus += int32(0.2f * m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)); } break; } @@ -6293,13 +6293,13 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) { // Skyshatter Harness item set bonus // Stormstrike - if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x001000000000)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x001000000000)) { Unit::AuraList const& m_OverrideClassScript = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for(Unit::AuraList::const_iterator citr = m_OverrideClassScript.begin(); citr != m_OverrideClassScript.end(); ++citr) + for (Unit::AuraList::const_iterator citr = m_OverrideClassScript.begin(); citr != m_OverrideClassScript.end(); ++citr) { // Stormstrike AP Buff - if ( (*citr)->GetModifier()->m_miscvalue == 5634 ) + if ((*citr)->GetModifier()->m_miscvalue == 5634) { m_caster->CastSpell(m_caster, 38430, true, NULL, *citr); break; @@ -6313,14 +6313,14 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) // Blood Strike, Heart Strike, Obliterate // Blood-Caked Strike if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0002000001400000) || - m_spellInfo->SpellIconID == 1736) + m_spellInfo->SpellIconID == 1736) { uint32 count = 0; Unit::SpellAuraHolderMap const& auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) + for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) { - if(itr->second->GetSpellProto()->Dispel == DISPEL_DISEASE && - itr->second->GetCasterGuid() == m_caster->GetObjectGuid()) + if (itr->second->GetSpellProto()->Dispel == DISPEL_DISEASE && + itr->second->GetCasterGuid() == m_caster->GetObjectGuid()) ++count; } @@ -6330,7 +6330,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) float bonus = count * CalculateDamage(m_spellInfo->SpellIconID == 1736 ? EFFECT_INDEX_0 : EFFECT_INDEX_2, unitTarget) / 100.0f; // Blood Strike, Blood-Caked Strike and Obliterate store bonus*2 if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0002000000400000) || - m_spellInfo->SpellIconID == 1736) + m_spellInfo->SpellIconID == 1736) bonus /= 2.0f; totalDamagePercentMod *= 1.0f + bonus; @@ -6342,24 +6342,24 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) weaponDamagePercentMod /= 2.0f; } // Glyph of Blood Strike - if( m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000400000) && - m_caster->HasAura(59332) && - unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000400000) && + m_caster->HasAura(59332) && + unitTarget->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED)) { totalDamagePercentMod *= 1.2f; // 120% if snared } // Glyph of Death Strike - if( m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000010) && - m_caster->HasAura(59336)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000010) && + m_caster->HasAura(59336)) { int32 rp = m_caster->GetPower(POWER_RUNIC_POWER) / 10; - if(rp > 25) + if (rp > 25) rp = 25; totalDamagePercentMod *= 1.0f + rp / 100.0f; } // Glyph of Plague Strike - if( m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000001) && - m_caster->HasAura(58657) ) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000001) && + m_caster->HasAura(58657)) { totalDamagePercentMod *= 1.2f; } @@ -6370,7 +6370,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) int32 fixed_bonus = 0; for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { - switch(m_spellInfo->Effect[j]) + switch (m_spellInfo->Effect[j]) { case SPELL_EFFECT_WEAPON_DAMAGE: case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL: @@ -6392,17 +6392,17 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) } // apply weaponDamagePercentMod to spell bonus also - if(spellBonusNeedWeaponDamagePercentMod) + if (spellBonusNeedWeaponDamagePercentMod) spell_bonus = int32(spell_bonus*weaponDamagePercentMod); // non-weapon damage int32 bonus = spell_bonus + fixed_bonus; // apply to non-weapon bonus weapon total pct effect, weapon total flat effect included in weapon damage - if(bonus) + if (bonus) { UnitMods unitMod; - switch(m_attackType) + switch (m_attackType) { default: case BASE_ATTACK: unitMod = UNIT_MOD_DAMAGE_MAINHAND; break; @@ -6426,20 +6426,20 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) // Hemorrhage if (m_spellInfo->SpellFamilyName==SPELLFAMILY_ROGUE && (m_spellInfo->SpellFamilyFlags & UI64LIT(0x2000000))) { - if(m_caster->GetTypeId()==TYPEID_PLAYER) + if (m_caster->GetTypeId()==TYPEID_PLAYER) ((Player*)m_caster)->AddComboPoints(unitTarget, 1); } // Mangle (Cat): CP else if (m_spellInfo->IsFitToFamily(SPELLFAMILY_DRUID, UI64LIT(0x0000040000000000))) { - if(m_caster->GetTypeId()==TYPEID_PLAYER) + if (m_caster->GetTypeId()==TYPEID_PLAYER) ((Player*)m_caster)->AddComboPoints(unitTarget, 1); } // take ammo - if(m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER) { - Item *pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK, true, false); + Item* pItem = ((Player*)m_caster)->GetWeaponForAttack(RANGED_ATTACK, true, false); // wands don't have ammo if (!pItem || pItem->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_WAND) @@ -6447,7 +6447,7 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) if (pItem->GetProto()->InventoryType == INVTYPE_THROWN) { - if(pItem->GetMaxStackCount()==1) + if (pItem->GetMaxStackCount()==1) { // decrease durability for non-stackable throw weapon ((Player*)m_caster)->DurabilityPointLossForEquipSlot(EQUIPMENT_SLOT_RANGED); @@ -6456,20 +6456,20 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) { // decrease items amount for stackable throw weapon uint32 count = 1; - ((Player*)m_caster)->DestroyItemCount( pItem, count, true); + ((Player*)m_caster)->DestroyItemCount(pItem, count, true); } } - else if(uint32 ammo = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID)) + else if (uint32 ammo = ((Player*)m_caster)->GetUInt32Value(PLAYER_AMMO_ID)) ((Player*)m_caster)->DestroyItemCount(ammo, 1, true); } } void Spell::EffectThreat(SpellEffectIndex /*eff_idx*/) { - if(!unitTarget || !unitTarget->isAlive() || !m_caster->isAlive()) + if (!unitTarget || !unitTarget->isAlive() || !m_caster->isAlive()) return; - if(!unitTarget->CanHaveThreatList()) + if (!unitTarget->CanHaveThreatList()) return; unitTarget->AddThreat(m_caster, float(damage), false, GetSpellSchoolMask(m_spellInfo), m_spellInfo); @@ -6477,9 +6477,9 @@ void Spell::EffectThreat(SpellEffectIndex /*eff_idx*/) void Spell::EffectHealMaxHealth(SpellEffectIndex /*eff_idx*/) { - if(!unitTarget) + if (!unitTarget) return; - if(!unitTarget->isAlive()) + if (!unitTarget->isAlive()) return; uint32 heal = m_caster->GetMaxHealth(); @@ -6489,9 +6489,9 @@ void Spell::EffectHealMaxHealth(SpellEffectIndex /*eff_idx*/) void Spell::EffectInterruptCast(SpellEffectIndex /*eff_idx*/) { - if(!unitTarget) + if (!unitTarget) return; - if(!unitTarget->isAlive()) + if (!unitTarget->isAlive()) return; // TODO: not all spells that used this effect apply cooldown at school spells @@ -6502,7 +6502,7 @@ void Spell::EffectInterruptCast(SpellEffectIndex /*eff_idx*/) { SpellEntry const* curSpellInfo = spell->m_spellInfo; // check if we can interrupt spell - if ((curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT) && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE ) + if ((curSpellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT) && curSpellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) { unitTarget->ProhibitSpellSchool(GetSpellSchoolMask(curSpellInfo), GetSpellDuration(m_spellInfo)); unitTarget->InterruptSpell(CurrentSpellTypes(i),false); @@ -6518,11 +6518,11 @@ void Spell::EffectSummonObjectWild(SpellEffectIndex eff_idx) GameObject* pGameObj = new GameObject; WorldObject* target = focusObject; - if( !target ) + if (!target) target = m_caster; float x, y, z; - if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) + if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { x = m_targets.m_destX; y = m_targets.m_destY; @@ -6531,10 +6531,10 @@ void Spell::EffectSummonObjectWild(SpellEffectIndex eff_idx) else m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); - Map *map = target->GetMap(); + Map* map = target->GetMap(); - if(!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, - m_caster->GetPhaseMask(), x, y, z, target->GetOrientation())) + if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, + m_caster->GetPhaseMask(), x, y, z, target->GetOrientation())) { delete pGameObj; return; @@ -6549,16 +6549,16 @@ void Spell::EffectSummonObjectWild(SpellEffectIndex eff_idx) // Store the GO to the caster m_caster->AddWildGameObject(pGameObj); - if(pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER) + if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER) { - Player *pl = (Player*)m_caster; - BattleGround* bg = ((Player *)m_caster)->GetBattleGround(); + Player* pl = (Player*)m_caster; + BattleGround* bg = ((Player*)m_caster)->GetBattleGround(); - switch(pGameObj->GetMapId()) + switch (pGameObj->GetMapId()) { case 489: //WS { - if(bg && bg->GetTypeID()==BATTLEGROUND_WS && bg->GetStatus() == STATUS_IN_PROGRESS) + if (bg && bg->GetTypeID()==BATTLEGROUND_WS && bg->GetStatus() == STATUS_IN_PROGRESS) { Team team = pl->GetTeam() == ALLIANCE ? HORDE : ALLIANCE; @@ -6568,7 +6568,7 @@ void Spell::EffectSummonObjectWild(SpellEffectIndex eff_idx) } case 566: //EY { - if(bg && bg->GetTypeID()==BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS) + if (bg && bg->GetTypeID()==BATTLEGROUND_EY && bg->GetStatus() == STATUS_IN_PROGRESS) { ((BattleGroundEY*)bg)->SetDroppedFlagGuid(pGameObj->GetObjectGuid()); } @@ -6589,11 +6589,11 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) { // TODO: we must implement hunter pet summon at login there (spell 6962) - switch(m_spellInfo->SpellFamilyName) + switch (m_spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 8856: // Bending Shinbone { @@ -6601,7 +6601,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; uint32 spell_id = 0; - switch(urand(1, 5)) + switch (urand(1, 5)) { case 1: spell_id = 8854; break; default: spell_id = 8855; break; @@ -6661,10 +6661,10 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) uint8 race = m_caster->getRace(); uint32 spellId = 0; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 24194: - switch(race) + switch (race) { case RACE_HUMAN: spellId = 24105; break; case RACE_DWARF: spellId = 24107; break; @@ -6674,7 +6674,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) } break; case 24195: - switch(race) + switch (race) { case RACE_ORC: spellId = 24104; break; case RACE_UNDEAD: spellId = 24103; break; @@ -6744,7 +6744,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) uint32 spellId = 0; - switch(urand(0, 6)) + switch (urand(0, 6)) { case 0: spellId = unitTarget->getGender() == GENDER_MALE ? 24708 : 24709; @@ -6806,7 +6806,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; uint32 spellid; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 25140: spellid = 32568; break; case 25143: spellid = 32572; break; @@ -6846,7 +6846,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) uint32 spells[4] = {26272, 26157, 26273, 26274}; // check presence - for(int j = 0; j < 4; ++j) + for (int j = 0; j < 4; ++j) if (unitTarget->HasAura(spells[j], EFFECT_INDEX_0)) return; @@ -6962,7 +6962,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) case 29830: // Mirren's Drinking Hat { uint32 item = 0; - switch ( urand(1, 6) ) + switch (urand(1, 6)) { case 1: case 2: @@ -7078,7 +7078,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) Creature* pTarget = (Creature*)unitTarget; - if (const SpellEntry *pSpell = sSpellStore.LookupEntry(m_spellInfo->CalculateSimpleValue(eff_idx))) + if (const SpellEntry* pSpell = sSpellStore.LookupEntry(m_spellInfo->CalculateSimpleValue(eff_idx))) { // if we used item at least once... if (pTarget->IsTemporarySummon() && int32(pTarget->GetEntry()) == pSpell->EffectMiscValue[eff_idx]) @@ -7132,7 +7132,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (!((Creature*)m_caster)->IsTemporarySummon()) return; - if (const SpellEntry *pSpell = sSpellStore.LookupEntry(m_spellInfo->CalculateSimpleValue(eff_idx))) + if (const SpellEntry* pSpell = sSpellStore.LookupEntry(m_spellInfo->CalculateSimpleValue(eff_idx))) { TemporarySummon* pSummon = (TemporarySummon*)m_caster; @@ -7274,7 +7274,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) const CreatureInfo* cTemplate = NULL; - switch(m_caster->GetEntry()) + switch (m_caster->GetEntry()) { case 25342: cTemplate = ObjectMgr::GetCreatureTemplate(25340); break; case 25343: cTemplate = ObjectMgr::GetCreatureTemplate(25341); break; @@ -7306,7 +7306,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) ((Creature*)m_caster)->SetVirtualItem(VIRTUAL_ITEM_SLOT_0, 0); ((Creature*)m_caster)->SetVirtualItem(VIRTUAL_ITEM_SLOT_1, 0); - switch(m_caster->GetDisplayId()) + switch (m_caster->GetDisplayId()) { case 23246: display_id = 23245; break; case 23247: display_id = 23250; break; @@ -7337,7 +7337,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; uint32 spellId = 0; - switch(rand() % 4) + switch (rand() % 4) { case 0: spellId = 46740; break; case 1: spellId = 46739; break; @@ -7374,13 +7374,13 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // cast (workaround can be done with ai script). // Quest - Jormungar Explosion Summon Object - for(int i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) m_caster->CastSpell(m_caster, 47309, true); - for(int i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) m_caster->CastSpell(m_caster, 47924, true); - for(int i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) m_caster->CastSpell(m_caster, 47925, true); return; @@ -7566,7 +7566,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; // determine if and what weapons can be copied - switch(eff_idx) + switch (eff_idx) { case EFFECT_INDEX_1: if (((Player*)m_originalCaster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND)) @@ -7740,7 +7740,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) { uint32 spellId = 0; - switch(m_caster->GetAreaId()) + switch (m_caster->GetAreaId()) { case 4385: spellId = 52954; break; // Bittertide Lake case 4290: spellId = 52958; break; // River's Heart @@ -7771,13 +7771,13 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // cast (workaround can be done with ai script). // Quest - Mammoth Explosion Summon Object - for(int i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) m_caster->CastSpell(m_caster, 54623, true); - for(int i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) m_caster->CastSpell(m_caster, 54627, true); - for(int i = 0; i < 2; ++i) + for (int i = 0; i < 2; ++i) m_caster->CastSpell(m_caster, 54628, true); // Summon Main Mammoth Meat @@ -7837,7 +7837,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) uint32 spellID = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_0); uint32 questID = m_spellInfo->CalculateSimpleValue(EFFECT_INDEX_1); - if (((Player*)unitTarget)->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE && !((Player*)unitTarget)->GetQuestRewardStatus (questID)) + if (((Player*)unitTarget)->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE && !((Player*)unitTarget)->GetQuestRewardStatus(questID)) unitTarget->CastSpell(unitTarget, spellID, true); return; @@ -7911,7 +7911,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) uint32 numStacks = 0; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 62524: numStacks = 2; break; case 62525: numStacks = 10; break; @@ -7974,7 +7974,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) spellId = 66737; // angry else { - switch(rand() % 3) + switch (rand() % 3) { case 0: spellId = 66740; break; // blue case 1: spellId = 66739; break; // tresher @@ -8108,7 +8108,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) } case SPELLFAMILY_WARLOCK: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 6201: // Healthstone creating spells case 6202: @@ -8125,7 +8125,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) uint32 itemtype; uint32 rank = 0; Unit::AuraList const& mDummyAuras = unitTarget->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i) + for (Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) { if ((*i)->GetId() == 18692) { @@ -8151,28 +8151,28 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) {36892, 36893, 36894} // Fel Healthstone }; - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 6201: - itemtype=itypes[0][rank];break; // Minor Healthstone + itemtype=itypes[0][rank]; break; // Minor Healthstone case 6202: - itemtype=itypes[1][rank];break; // Lesser Healthstone + itemtype=itypes[1][rank]; break; // Lesser Healthstone case 5699: - itemtype=itypes[2][rank];break; // Healthstone + itemtype=itypes[2][rank]; break; // Healthstone case 11729: - itemtype=itypes[3][rank];break; // Greater Healthstone + itemtype=itypes[3][rank]; break; // Greater Healthstone case 11730: - itemtype=itypes[4][rank];break; // Major Healthstone + itemtype=itypes[4][rank]; break; // Major Healthstone case 27230: - itemtype=itypes[5][rank];break; // Master Healthstone + itemtype=itypes[5][rank]; break; // Master Healthstone case 47871: - itemtype=itypes[6][rank];break; // Demonic Healthstone + itemtype=itypes[6][rank]; break; // Demonic Healthstone case 47878: - itemtype=itypes[7][rank];break; // Fel Healthstone + itemtype=itypes[7][rank]; break; // Fel Healthstone default: return; } - DoCreateItem( eff_idx, itemtype ); + DoCreateItem(eff_idx, itemtype); return; } case 47193: // Demonic Empowerment @@ -8182,7 +8182,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) uint32 entry = unitTarget->GetEntry(); uint32 spellID; - switch(entry) + switch (entry) { case 416: spellID = 54444; break; // imp case 417: spellID = 54509; break; // fellhunter @@ -8199,13 +8199,13 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) { // Need refresh caster corruption auras on target Unit::SpellAuraHolderMap& suAuras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::iterator itr = suAuras.begin(); itr != suAuras.end(); ++itr) + for (Unit::SpellAuraHolderMap::iterator itr = suAuras.begin(); itr != suAuras.end(); ++itr) { - SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); - if(spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && - (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000002)) && - (*itr).second->GetCasterGuid() == m_caster->GetObjectGuid()) - (*itr).second->RefreshHolder(); + SpellEntry const* spellInfo = (*itr).second->GetSpellProto(); + if (spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && + (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000000002)) && + (*itr).second->GetCasterGuid() == m_caster->GetObjectGuid()) + (*itr).second->RefreshHolder(); } return; } @@ -8222,7 +8222,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) } case SPELLFAMILY_PRIEST: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 47948: // Pain and Suffering { @@ -8231,12 +8231,12 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // Refresh Shadow Word: Pain on target Unit::SpellAuraHolderMap& auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::iterator itr = auras.begin(); itr != auras.end(); ++itr) + for (Unit::SpellAuraHolderMap::iterator itr = auras.begin(); itr != auras.end(); ++itr) { - SpellEntry const *spellInfo = (*itr).second->GetSpellProto(); + SpellEntry const* spellInfo = (*itr).second->GetSpellProto(); if (spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && - (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000008000)) && - (*itr).second->GetCasterGuid() == m_caster->GetObjectGuid()) + (spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000008000)) && + (*itr).second->GetCasterGuid() == m_caster->GetObjectGuid()) { (*itr).second->RefreshHolder(); return; @@ -8251,7 +8251,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) } case SPELLFAMILY_HUNTER: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 53209: // Chimera Shot { @@ -8262,9 +8262,9 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) int32 basePoint = 0; Unit* target = unitTarget; Unit::SpellAuraHolderMap& Auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::iterator i = Auras.begin(); i != Auras.end(); ++i) + for (Unit::SpellAuraHolderMap::iterator i = Auras.begin(); i != Auras.end(); ++i) { - SpellAuraHolder *holder = i->second; + SpellAuraHolder* holder = i->second; if (holder->GetCasterGuid() != m_caster->GetObjectGuid()) continue; @@ -8276,7 +8276,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // Refresh aura duration holder->RefreshHolder(); - Aura *aura = holder->GetAuraByEffectIndex(EFFECT_INDEX_0); + Aura* aura = holder->GetAuraByEffectIndex(EFFECT_INDEX_0); if (!aura) continue; @@ -8334,7 +8334,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) return; Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator i = auras.begin();i != auras.end(); ++i) + for (Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) { // Invigoration (master talent) if ((*i)->GetModifier()->m_miscvalue == 8 && (*i)->GetSpellProto()->SpellIconID == 3487) @@ -8387,13 +8387,13 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // offensive seals have aura dummy in 2 effect Unit::AuraList const& m_dummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = m_dummyAuras.begin(); itr != m_dummyAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = m_dummyAuras.begin(); itr != m_dummyAuras.end(); ++itr) { // search seal (offensive seals have judgement's aura dummy spell id in 2 effect if ((*itr)->GetEffIndex() != EFFECT_INDEX_2 || !IsSealSpell((*itr)->GetSpellProto())) continue; spellId2 = (*itr)->GetModifier()->m_amount; - SpellEntry const *judge = sSpellStore.LookupEntry(spellId2); + SpellEntry const* judge = sSpellStore.LookupEntry(spellId2); if (!judge) continue; break; @@ -8403,7 +8403,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) if (!spellId2) { Unit::AuraList const& procTriggerAuras = m_caster->GetAurasByType(SPELL_AURA_PROC_TRIGGER_SPELL); - for(Unit::AuraList::const_iterator itr = procTriggerAuras.begin(); itr != procTriggerAuras.end(); ++itr) + for (Unit::AuraList::const_iterator itr = procTriggerAuras.begin(); itr != procTriggerAuras.end(); ++itr) { if ((*itr)->GetEffIndex() != EFFECT_INDEX_0 || !IsSealSpell((*itr)->GetSpellProto())) continue; @@ -8424,7 +8424,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) } case SPELLFAMILY_POTION: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 28698: // Dreaming Glory { @@ -8449,7 +8449,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) const uint32 spellid = 28703; // don't overwrite an existing aura - for(uint8 i = 0; i < 5; ++i) + for (uint8 i = 0; i < 5; ++i) if (unitTarget->HasAura(spellid + i, EFFECT_INDEX_0)) return; @@ -8473,7 +8473,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) } case SPELLFAMILY_DEATHKNIGHT: { - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 50842: // Pestilence { @@ -8517,7 +8517,7 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) void Spell::EffectSanctuary(SpellEffectIndex /*eff_idx*/) { - if(!unitTarget) + if (!unitTarget) return; //unitTarget->CombatStop(); @@ -8526,18 +8526,18 @@ void Spell::EffectSanctuary(SpellEffectIndex /*eff_idx*/) // Vanish allows to remove all threat and cast regular stealth so other spells can be used if (m_spellInfo->IsFitToFamily(SPELLFAMILY_ROGUE, UI64LIT(0x0000000000000800))) - ((Player *)m_caster)->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); + ((Player*)m_caster)->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); } void Spell::EffectAddComboPoints(SpellEffectIndex /*eff_idx*/) { - if(!unitTarget) + if (!unitTarget) return; - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - if(damage <= 0) + if (damage <= 0) return; ((Player*)m_caster)->AddComboPoints(unitTarget, damage); @@ -8545,11 +8545,11 @@ void Spell::EffectAddComboPoints(SpellEffectIndex /*eff_idx*/) void Spell::EffectDuel(SpellEffectIndex eff_idx) { - if(!m_caster || !unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!m_caster || !unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - Player *caster = (Player*)m_caster; - Player *target = (Player*)unitTarget; + Player* caster = (Player*)m_caster; + Player* target = (Player*)unitTarget; // caster or target already have requested duel if (caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetObjectGuid())) @@ -8586,8 +8586,8 @@ void Spell::EffectDuel(SpellEffectIndex eff_idx) return; } - pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->getFaction() ); - pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()+1 ); + pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->getFaction()); + pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()+1); pGameObj->SetRespawnTime(m_duration > 0 ? m_duration/IN_MILLISECONDS : 0); pGameObj->SetSpellId(m_spellInfo->Id); @@ -8604,14 +8604,14 @@ void Spell::EffectDuel(SpellEffectIndex eff_idx) target->GetSession()->SendPacket(&data); // create duel-info - DuelInfo *duel = new DuelInfo; + DuelInfo* duel = new DuelInfo; duel->initiator = caster; duel->opponent = target; duel->startTime = 0; duel->startTimer = 0; caster->duel = duel; - DuelInfo *duel2 = new DuelInfo; + DuelInfo* duel2 = new DuelInfo; duel2->initiator = caster; duel2->opponent = caster; duel2->startTime = 0; @@ -8624,10 +8624,10 @@ void Spell::EffectDuel(SpellEffectIndex eff_idx) void Spell::EffectStuck(SpellEffectIndex /*eff_idx*/) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - if(!sWorld.getConfig(CONFIG_BOOL_CAST_UNSTUCK)) + if (!sWorld.getConfig(CONFIG_BOOL_CAST_UNSTUCK)) return; Player* pTarget = (Player*)unitTarget; @@ -8635,15 +8635,15 @@ void Spell::EffectStuck(SpellEffectIndex /*eff_idx*/) DEBUG_LOG("Spell Effect: Stuck"); DETAIL_LOG("Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", pTarget->GetName(), pTarget->GetGUIDLow(), m_caster->GetMapId(), m_caster->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); - if(pTarget->IsTaxiFlying()) + if (pTarget->IsTaxiFlying()) return; // homebind location is loaded always pTarget->TeleportToHomebind(unitTarget==m_caster ? TELE_TO_SPELL : 0); // Stuck spell trigger Hearthstone cooldown - SpellEntry const *spellInfo = sSpellStore.LookupEntry(8690); - if(!spellInfo) + SpellEntry const* spellInfo = sSpellStore.LookupEntry(8690); + if (!spellInfo) return; Spell spell(pTarget, spellInfo, true); spell.SendSpellCooldown(); @@ -8651,11 +8651,11 @@ void Spell::EffectStuck(SpellEffectIndex /*eff_idx*/) void Spell::EffectSummonPlayer(SpellEffectIndex /*eff_idx*/) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; // Evil Twin (ignore player summon, but hide this for summoner) - if(unitTarget->GetDummyAura(23445)) + if (unitTarget->GetDummyAura(23445)) return; float x, y, z; @@ -8683,7 +8683,7 @@ static ScriptInfo generateActivateCommand() void Spell::EffectActivateObject(SpellEffectIndex eff_idx) { - if(!gameObjTarget) + if (!gameObjTarget) return; static ScriptInfo activateCommand = generateActivateCommand(); @@ -8695,19 +8695,19 @@ void Spell::EffectActivateObject(SpellEffectIndex eff_idx) void Spell::EffectApplyGlyph(SpellEffectIndex eff_idx) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - Player *player = (Player*)m_caster; + Player* player = (Player*)m_caster; // apply new one - if(uint32 glyph = m_spellInfo->EffectMiscValue[eff_idx]) + if (uint32 glyph = m_spellInfo->EffectMiscValue[eff_idx]) { - if(GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) + if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyph)) { - if(GlyphSlotEntry const *gs = sGlyphSlotStore.LookupEntry(player->GetGlyphSlot(m_glyphIndex))) + if (GlyphSlotEntry const* gs = sGlyphSlotStore.LookupEntry(player->GetGlyphSlot(m_glyphIndex))) { - if(gp->TypeFlags != gs->TypeFlags) + if (gp->TypeFlags != gs->TypeFlags) { SendCastResult(SPELL_FAILED_INVALID_GLYPH); return; // glyph slot mismatch @@ -8726,37 +8726,37 @@ void Spell::EffectApplyGlyph(SpellEffectIndex eff_idx) void Spell::EffectEnchantHeldItem(SpellEffectIndex eff_idx) { // this is only item spell effect applied to main-hand weapon of target player (players in area) - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; Player* item_owner = (Player*)unitTarget; Item* item = item_owner->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); - if(!item ) + if (!item) return; // must be equipped - if(!item ->IsEquipped()) + if (!item ->IsEquipped()) return; if (m_spellInfo->EffectMiscValue[eff_idx]) { uint32 enchant_id = m_spellInfo->EffectMiscValue[eff_idx]; int32 duration = m_duration; // Try duration index first... - if(!duration) + if (!duration) duration = m_currentBasePoints[eff_idx]; // Base points after... - if(!duration) + if (!duration) duration = 10; // 10 seconds for enchants which don't have listed duration - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!pEnchant) + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + if (!pEnchant) return; // Always go to temp enchantment slot EnchantmentSlot slot = TEMP_ENCHANTMENT_SLOT; // Enchantment will not be applied if a different one already exists - if(item->GetEnchantmentId(slot) && item->GetEnchantmentId(slot) != enchant_id) + if (item->GetEnchantmentId(slot) && item->GetEnchantmentId(slot) != enchant_id) return; // Apply the temporary enchantment @@ -8767,11 +8767,11 @@ void Spell::EffectEnchantHeldItem(SpellEffectIndex eff_idx) void Spell::EffectDisEnchant(SpellEffectIndex /*eff_idx*/) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; Player* p_caster = (Player*)m_caster; - if(!itemTarget || !itemTarget->GetProto()->DisenchantID) + if (!itemTarget || !itemTarget->GetProto()->DisenchantID) return; p_caster->UpdateCraftSkill(m_spellInfo->Id); @@ -8783,10 +8783,10 @@ void Spell::EffectDisEnchant(SpellEffectIndex /*eff_idx*/) void Spell::EffectInebriate(SpellEffectIndex /*eff_idx*/) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - Player *player = (Player*)unitTarget; + Player* player = (Player*)unitTarget; uint16 currentDrunk = player->GetDrunkValue(); uint16 drunkMod = damage * 256; if (currentDrunk + drunkMod > 0xFFFF) @@ -8798,24 +8798,24 @@ void Spell::EffectInebriate(SpellEffectIndex /*eff_idx*/) void Spell::EffectFeedPet(SpellEffectIndex eff_idx) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - Player *_player = (Player*)m_caster; + Player* _player = (Player*)m_caster; Item* foodItem = m_targets.getItemTarget(); - if(!foodItem) + if (!foodItem) return; - Pet *pet = _player->GetPet(); - if(!pet) + Pet* pet = _player->GetPet(); + if (!pet) return; - if(!pet->isAlive()) + if (!pet->isAlive()) return; int32 benefit = pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel); - if(benefit <= 0) + if (benefit <= 0) return; uint32 count = 1; @@ -8827,13 +8827,13 @@ void Spell::EffectFeedPet(SpellEffectIndex eff_idx) void Spell::EffectDismissPet(SpellEffectIndex /*eff_idx*/) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; Pet* pet = m_caster->GetPet(); // not let dismiss dead pet - if(!pet||!pet->isAlive()) + if (!pet||!pet->isAlive()) return; pet->Unsummon(PET_SAVE_NOT_IN_SLOT, m_caster); @@ -8874,9 +8874,9 @@ void Spell::EffectSummonObject(SpellEffectIndex eff_idx) else m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); - Map *map = m_caster->GetMap(); - if(!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, - m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation())) + Map* map = m_caster->GetMap(); + if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, + m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation())) { delete pGameObj; return; @@ -8936,7 +8936,7 @@ void Spell::EffectResurrect(SpellEffectIndex /*eff_idx*/) Player* pTarget = ((Player*)unitTarget); - if(pTarget->isRessurectRequested()) // already have one active request + if (pTarget->isRessurectRequested()) // already have one active request return; uint32 health = pTarget->GetMaxHealth() * damage / 100; @@ -8948,10 +8948,10 @@ void Spell::EffectResurrect(SpellEffectIndex /*eff_idx*/) void Spell::EffectAddExtraAttacks(SpellEffectIndex /*eff_idx*/) { - if(!unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->isAlive()) return; - if( unitTarget->m_extraAttacks ) + if (unitTarget->m_extraAttacks) return; unitTarget->m_extraAttacks = damage; @@ -9001,17 +9001,17 @@ void Spell::EffectLeapBack(SpellEffectIndex eff_idx) void Spell::EffectReputation(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - Player *_player = (Player*)unitTarget; + Player* _player = (Player*)unitTarget; int32 rep_change = m_currentBasePoints[eff_idx]; uint32 faction_id = m_spellInfo->EffectMiscValue[eff_idx]; FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); - if(!factionEntry) + if (!factionEntry) return; rep_change = _player->CalculateReputationGain(REPUTATION_SOURCE_SPELL, rep_change, faction_id); @@ -9025,7 +9025,7 @@ void Spell::EffectQuestComplete(SpellEffectIndex eff_idx) return; // A few spells has additional value from basepoints, check condition here. - switch(m_spellInfo->Id) + switch (m_spellInfo->Id) { case 43458: // Secrets of Nifflevar { @@ -9038,7 +9038,7 @@ void Spell::EffectQuestComplete(SpellEffectIndex eff_idx) // "this spell awards credit for the entire raid (all spell targets as this is area target) if just ONE member has both auras (yes, both effect's basepoints)" //case 72155: // Harvest Blight Specimen //case 72162: // Harvest Blight Specimen - //break; + //break; default: break; } @@ -9049,18 +9049,18 @@ void Spell::EffectQuestComplete(SpellEffectIndex eff_idx) void Spell::EffectSelfResurrect(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->isAlive()) + if (!unitTarget || unitTarget->isAlive()) return; - if(unitTarget->GetTypeId() != TYPEID_PLAYER) + if (unitTarget->GetTypeId() != TYPEID_PLAYER) return; - if(!unitTarget->IsInWorld()) + if (!unitTarget->IsInWorld()) return; uint32 health = 0; uint32 mana = 0; // flat case - if(damage < 0) + if (damage < 0) { health = uint32(-damage); mana = m_spellInfo->EffectMiscValue[eff_idx]; @@ -9069,26 +9069,26 @@ void Spell::EffectSelfResurrect(SpellEffectIndex eff_idx) else { health = uint32(damage/100.0f*unitTarget->GetMaxHealth()); - if(unitTarget->GetMaxPower(POWER_MANA) > 0) + if (unitTarget->GetMaxPower(POWER_MANA) > 0) mana = uint32(damage/100.0f*unitTarget->GetMaxPower(POWER_MANA)); } - Player *plr = ((Player*)unitTarget); + Player* plr = ((Player*)unitTarget); plr->ResurrectPlayer(0.0f); - plr->SetHealth( health ); - plr->SetPower(POWER_MANA, mana ); - plr->SetPower(POWER_RAGE, 0 ); - plr->SetPower(POWER_ENERGY, plr->GetMaxPower(POWER_ENERGY) ); + plr->SetHealth(health); + plr->SetPower(POWER_MANA, mana); + plr->SetPower(POWER_RAGE, 0); + plr->SetPower(POWER_ENERGY, plr->GetMaxPower(POWER_ENERGY)); plr->SpawnCorpseBones(); } void Spell::EffectSkinning(SpellEffectIndex /*eff_idx*/) { - if(unitTarget->GetTypeId() != TYPEID_UNIT ) + if (unitTarget->GetTypeId() != TYPEID_UNIT) return; - if(!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER) + if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER) return; Creature* creature = (Creature*) unitTarget; @@ -9104,7 +9104,7 @@ void Spell::EffectSkinning(SpellEffectIndex /*eff_idx*/) int32 skillValue = ((Player*)m_caster)->GetPureSkillValue(skill); // Double chances for elites - ((Player*)m_caster)->UpdateGatherSkill(skill, skillValue, reqValue, creature->IsElite() ? 2 : 1 ); + ((Player*)m_caster)->UpdateGatherSkill(skill, skillValue, reqValue, creature->IsElite() ? 2 : 1); } void Spell::EffectCharge(SpellEffectIndex /*eff_idx*/) @@ -9118,7 +9118,7 @@ void Spell::EffectCharge(SpellEffectIndex /*eff_idx*/) unitTarget->GetContactPoint(m_caster, x, y, z, 3.666666f); if (unitTarget->GetTypeId() != TYPEID_PLAYER) - ((Creature *)unitTarget)->StopMoving(); + ((Creature*)unitTarget)->StopMoving(); // Only send MOVEMENTFLAG_WALK_MODE, client has strange issues with other move flags m_caster->MonsterMoveWithSpeed(x, y, z, 24.f, true, true); @@ -9138,7 +9138,7 @@ void Spell::EffectCharge2(SpellEffectIndex /*eff_idx*/) z = m_targets.m_destZ; if (unitTarget->GetTypeId() != TYPEID_PLAYER) - ((Creature *)unitTarget)->StopMoving(); + ((Creature*)unitTarget)->StopMoving(); } else if (unitTarget && unitTarget != m_caster) unitTarget->GetContactPoint(m_caster, x, y, z, 3.666666f); @@ -9163,7 +9163,7 @@ void Spell::EffectKnockBack(SpellEffectIndex eff_idx) void Spell::EffectSendTaxi(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; ((Player*)unitTarget)->ActivateTaxiPathTo(m_spellInfo->EffectMiscValue[eff_idx],m_spellInfo->Id); @@ -9189,11 +9189,11 @@ void Spell::EffectDispelMechanic(SpellEffectIndex eff_idx) uint32 mechanic = m_spellInfo->EffectMiscValue[eff_idx]; Unit::SpellAuraHolderMap& Auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next) + for (Unit::SpellAuraHolderMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next) { next = iter; ++next; - SpellEntry const *spell = iter->second->GetSpellProto(); + SpellEntry const* spell = iter->second->GetSpellProto(); if (iter->second->HasMechanic(mechanic)) { unitTarget->RemoveAurasDueToSpell(spell->Id); @@ -9207,22 +9207,22 @@ void Spell::EffectDispelMechanic(SpellEffectIndex eff_idx) void Spell::EffectSummonDeadPet(SpellEffectIndex /*eff_idx*/) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - Player *_player = (Player*)m_caster; - Pet *pet = _player->GetPet(); - if(!pet) + Player* _player = (Player*)m_caster; + Pet* pet = _player->GetPet(); + if (!pet) return; - if(pet->isAlive()) + if (pet->isAlive()) return; - if(damage < 0) + if (damage < 0) return; pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - pet->SetDeathState( ALIVE ); + pet->SetDeathState(ALIVE); pet->clearUnitState(UNIT_STAT_ALL_STATE); - pet->SetHealth( uint32(pet->GetMaxHealth()*(float(damage)/100))); + pet->SetHealth(uint32(pet->GetMaxHealth()*(float(damage)/100))); pet->AIM_Initialize(); @@ -9232,13 +9232,13 @@ void Spell::EffectSummonDeadPet(SpellEffectIndex /*eff_idx*/) void Spell::EffectSummonAllTotems(SpellEffectIndex eff_idx) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; int32 start_button = ACTION_BUTTON_SHAMAN_TOTEMS_BAR + m_spellInfo->EffectMiscValue[eff_idx]; int32 amount_buttons = m_spellInfo->EffectMiscValueB[eff_idx]; - for(int32 slot = 0; slot < amount_buttons; ++slot) + for (int32 slot = 0; slot < amount_buttons; ++slot) if (ActionButton const* actionButton = ((Player*)m_caster)->GetActionButton(start_button+slot)) if (actionButton->GetType()==ACTION_BUTTON_SPELL) if (uint32 spell_id = actionButton->GetAction()) @@ -9248,7 +9248,7 @@ void Spell::EffectSummonAllTotems(SpellEffectIndex eff_idx) void Spell::EffectDestroyAllTotems(SpellEffectIndex /*eff_idx*/) { int32 mana = 0; - for(int slot = 0; slot < MAX_TOTEM_SLOT; ++slot) + for (int slot = 0; slot < MAX_TOTEM_SLOT; ++slot) { if (Totem* totem = m_caster->GetTotem(TotemSlot(slot))) { @@ -9269,7 +9269,7 @@ void Spell::EffectDestroyAllTotems(SpellEffectIndex /*eff_idx*/) m_caster->CastCustomSpell(m_caster, 39104, &mana, NULL, NULL, true); } -void Spell::EffectBreakPlayerTargeting (SpellEffectIndex /* eff_idx */) +void Spell::EffectBreakPlayerTargeting(SpellEffectIndex /* eff_idx */) { if (!unitTarget) return; @@ -9281,56 +9281,56 @@ void Spell::EffectBreakPlayerTargeting (SpellEffectIndex /* eff_idx */) void Spell::EffectDurabilityDamage(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; int32 slot = m_spellInfo->EffectMiscValue[eff_idx]; // FIXME: some spells effects have value -1/-2 // Possibly its mean -1 all player equipped items and -2 all items - if(slot < 0) + if (slot < 0) { ((Player*)unitTarget)->DurabilityPointsLossAll(damage, (slot < -1)); return; } // invalid slot value - if(slot >= INVENTORY_SLOT_BAG_END) + if (slot >= INVENTORY_SLOT_BAG_END) return; - if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + if (Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) ((Player*)unitTarget)->DurabilityPointsLoss(item, damage); } void Spell::EffectDurabilityDamagePCT(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; int32 slot = m_spellInfo->EffectMiscValue[eff_idx]; // FIXME: some spells effects have value -1/-2 // Possibly its mean -1 all player equipped items and -2 all items - if(slot < 0) + if (slot < 0) { ((Player*)unitTarget)->DurabilityLossAll(double(damage)/100.0f, (slot < -1)); return; } // invalid slot value - if(slot >= INVENTORY_SLOT_BAG_END) + if (slot >= INVENTORY_SLOT_BAG_END) return; - if(damage <= 0) + if (damage <= 0) return; - if(Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + if (Item* item = ((Player*)unitTarget)->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) ((Player*)unitTarget)->DurabilityLoss(item, double(damage)/100.0f); } void Spell::EffectModifyThreatPercent(SpellEffectIndex /*eff_idx*/) { - if(!unitTarget) + if (!unitTarget) return; unitTarget->getThreatManager().modifyThreatPercent(m_caster, damage); @@ -9350,14 +9350,14 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx) float fx, fy, fz; - if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) + if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { fx = m_targets.m_destX; fy = m_targets.m_destY; fz = m_targets.m_destZ; } //FIXME: this can be better check for most objects but still hack - else if(m_spellInfo->EffectRadiusIndex[eff_idx] && m_spellInfo->speed==0) + else if (m_spellInfo->EffectRadiusIndex[eff_idx] && m_spellInfo->speed==0) { float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[eff_idx])); m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); @@ -9398,7 +9398,7 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx) m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } - Map *cMap = m_caster->GetMap(); + Map* cMap = m_caster->GetMap(); // if gameobject is summoning object, it should be spawned right on caster's position @@ -9409,8 +9409,8 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx) GameObject* pGameObj = new GameObject; - if(!pGameObj->Create(cMap->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap, - m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation())) + if (!pGameObj->Create(cMap->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap, + m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation())) { delete pGameObj; return; @@ -9418,7 +9418,7 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx) int32 duration = m_duration; - switch(goinfo->type) + switch (goinfo->type) { case GAMEOBJECT_TYPE_FISHINGNODE: { @@ -9428,7 +9428,7 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx) // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo)) // start time == fish-FISHING_BOBBER_READY_TIME (0..GetDuration(m_spellInfo)-FISHING_BOBBER_READY_TIME) int32 lastSec = 0; - switch(urand(0, 3)) + switch (urand(0, 3)) { case 0: lastSec = 3; break; case 1: lastSec = 7; break; @@ -9441,7 +9441,7 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx) } case GAMEOBJECT_TYPE_SUMMONING_RITUAL: { - if(m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->GetTypeId() == TYPEID_PLAYER) { pGameObj->AddUniqueUse((Player*)m_caster); m_caster->AddGameObject(pGameObj); // will removed at spell cancel @@ -9499,7 +9499,7 @@ void Spell::EffectMilling(SpellEffectIndex /*eff_idx*/) Player* p_caster = (Player*)m_caster; - if( sWorld.getConfig(CONFIG_BOOL_SKILL_MILLING)) + if (sWorld.getConfig(CONFIG_BOOL_SKILL_MILLING)) { uint32 SkillValue = p_caster->GetPureSkillValue(SKILL_INSCRIPTION); uint32 reqSkillValue = itemTarget->GetProto()->RequiredSkillRank; @@ -9534,27 +9534,27 @@ void Spell::EffectSpiritHeal(SpellEffectIndex /*eff_idx*/) void Spell::EffectSkinPlayerCorpse(SpellEffectIndex /*eff_idx*/) { DEBUG_LOG("Effect: SkinPlayerCorpse"); - if ( (m_caster->GetTypeId() != TYPEID_PLAYER) || (unitTarget->GetTypeId() != TYPEID_PLAYER) || (unitTarget->isAlive()) ) + if ((m_caster->GetTypeId() != TYPEID_PLAYER) || (unitTarget->GetTypeId() != TYPEID_PLAYER) || (unitTarget->isAlive())) return; - ((Player*)unitTarget)->RemovedInsignia( (Player*)m_caster ); + ((Player*)unitTarget)->RemovedInsignia((Player*)m_caster); } void Spell::EffectStealBeneficialBuff(SpellEffectIndex eff_idx) { DEBUG_LOG("Effect: StealBeneficialBuff"); - if(!unitTarget || unitTarget==m_caster) // can't steal from self + if (!unitTarget || unitTarget==m_caster) // can't steal from self return; typedef std::vector StealList; StealList steal_list; // Create dispel mask by dispel type - uint32 dispelMask = GetDispellMask( DispelType(m_spellInfo->EffectMiscValue[eff_idx]) ); + uint32 dispelMask = GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[eff_idx])); Unit::SpellAuraHolderMap const& auras = unitTarget->GetSpellAuraHolderMap(); - for(Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { - SpellAuraHolder *holder = itr->second; + SpellAuraHolder* holder = itr->second; if (holder && (1<GetSpellProto()->Dispel) & dispelMask) { // Need check for passive? this @@ -9572,15 +9572,15 @@ void Spell::EffectStealBeneficialBuff(SpellEffectIndex eff_idx) for (int32 count=0; count < damage && list_size > 0; ++count) { // Random select buff for dispel - SpellAuraHolder *holder = steal_list[urand(0, list_size-1)]; + SpellAuraHolder* holder = steal_list[urand(0, list_size-1)]; // Not use chance for steal // TODO possible need do it success_list.push_back(SuccessList::value_type(holder->GetId(),holder->GetCasterGuid())); // Remove buff from list for prevent doubles - for (StealList::iterator j = steal_list.begin(); j != steal_list.end(); ) + for (StealList::iterator j = steal_list.begin(); j != steal_list.end();) { - SpellAuraHolder *stealed = *j; + SpellAuraHolder* stealed = *j; if (stealed->GetId() == holder->GetId() && stealed->GetCasterGuid() == holder->GetCasterGuid()) { j = steal_list.erase(j); @@ -9614,7 +9614,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffectIndex eff_idx) void Spell::EffectKillCreditPersonal(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; ((Player*)unitTarget)->KilledMonsterCredit(m_spellInfo->EffectMiscValue[eff_idx]); @@ -9622,7 +9622,7 @@ void Spell::EffectKillCreditPersonal(SpellEffectIndex eff_idx) void Spell::EffectKillCreditGroup(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; ((Player*)unitTarget)->RewardPlayerAndGroupAtEvent(m_spellInfo->EffectMiscValue[eff_idx], unitTarget); @@ -9630,7 +9630,7 @@ void Spell::EffectKillCreditGroup(SpellEffectIndex eff_idx) void Spell::EffectQuestFail(SpellEffectIndex eff_idx) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; ((Player*)unitTarget)->FailQuest(m_spellInfo->EffectMiscValue[eff_idx]); @@ -9638,12 +9638,12 @@ void Spell::EffectQuestFail(SpellEffectIndex eff_idx) void Spell::EffectActivateRune(SpellEffectIndex eff_idx) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - Player *plr = (Player*)m_caster; + Player* plr = (Player*)m_caster; - if(plr->getClass() != CLASS_DEATH_KNIGHT) + if (plr->getClass() != CLASS_DEATH_KNIGHT) return; int32 count = damage; // max amount of reset runes @@ -9658,7 +9658,7 @@ void Spell::EffectTitanGrip(SpellEffectIndex eff_idx) sLog.outError("Spell::EffectTitanGrip: Spell %u has unexpected EffectMiscValue '%u'", m_spellInfo->Id, m_spellInfo->EffectMiscValue[eff_idx]); if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER) { - Player *plr = (Player*)m_caster; + Player* plr = (Player*)m_caster; plr->SetCanTitanGrip(true); if (plr->HasTwoHandWeaponInOneHand() && !plr->HasAura(49152)) plr->CastSpell(plr, 49152, true); @@ -9668,7 +9668,7 @@ void Spell::EffectTitanGrip(SpellEffectIndex eff_idx) void Spell::EffectRenamePet(SpellEffectIndex /*eff_idx*/) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || - !((Creature*)unitTarget)->IsPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET) + !((Creature*)unitTarget)->IsPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET) return; unitTarget->RemoveByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED); @@ -9734,12 +9734,12 @@ void Spell::EffectBind(SpellEffectIndex eff_idx) uint32 area_id; WorldLocation loc; if (m_spellInfo->EffectImplicitTargetA[eff_idx] == TARGET_TABLE_X_Y_Z_COORDINATES || - m_spellInfo->EffectImplicitTargetB[eff_idx] == TARGET_TABLE_X_Y_Z_COORDINATES) + m_spellInfo->EffectImplicitTargetB[eff_idx] == TARGET_TABLE_X_Y_Z_COORDINATES) { SpellTargetPosition const* st = sSpellMgr.GetSpellTargetPosition(m_spellInfo->Id); if (!st) { - sLog.outError( "Spell::EffectBind - unknown Teleport coordinates for spell ID %u", m_spellInfo->Id ); + sLog.outError("Spell::EffectBind - unknown Teleport coordinates for spell ID %u", m_spellInfo->Id); return; } @@ -9759,13 +9759,13 @@ void Spell::EffectBind(SpellEffectIndex eff_idx) player->SetHomebindToLocation(loc,area_id); // binding - WorldPacket data( SMSG_BINDPOINTUPDATE, (4+4+4+4+4) ); + WorldPacket data(SMSG_BINDPOINTUPDATE, (4+4+4+4+4)); data << float(loc.coord_x); data << float(loc.coord_y); data << float(loc.coord_z); data << uint32(loc.mapid); data << uint32(area_id); - player->SendDirectMessage( &data ); + player->SendDirectMessage(&data); DEBUG_LOG("New Home Position X is %f", loc.coord_x); DEBUG_LOG("New Home Position Y is %f", loc.coord_y); @@ -9777,10 +9777,10 @@ void Spell::EffectBind(SpellEffectIndex eff_idx) data.Initialize(SMSG_PLAYERBOUND, 8+4); data << player->GetObjectGuid(); data << uint32(area_id); - player->SendDirectMessage( &data ); + player->SendDirectMessage(&data); } -void Spell::EffectRestoreItemCharges( SpellEffectIndex eff_idx ) +void Spell::EffectRestoreItemCharges(SpellEffectIndex eff_idx) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -9808,13 +9808,13 @@ void Spell::EffectRedirectThreat(SpellEffectIndex eff_idx) return; if (m_spellInfo->Id == 59665) // Vigilance - if (Aura *glyph = unitTarget->GetDummyAura(63326)) // Glyph of Vigilance + if (Aura* glyph = unitTarget->GetDummyAura(63326)) // Glyph of Vigilance damage += glyph->GetModifier()->m_amount; m_caster->getHostileRefManager().SetThreatRedirection(unitTarget->GetObjectGuid(), uint32(damage)); } -void Spell::EffectTeachTaxiNode( SpellEffectIndex eff_idx ) +void Spell::EffectTeachTaxiNode(SpellEffectIndex eff_idx) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -9828,12 +9828,12 @@ void Spell::EffectTeachTaxiNode( SpellEffectIndex eff_idx ) if (player->m_taxi.SetTaximaskNode(taxiNodeId)) { WorldPacket data(SMSG_NEW_TAXI_PATH, 0); - player->SendDirectMessage( &data ); + player->SendDirectMessage(&data); - data.Initialize( SMSG_TAXINODE_STATUS, 9 ); + data.Initialize(SMSG_TAXINODE_STATUS, 9); data << m_caster->GetObjectGuid(); - data << uint8( 1 ); - player->SendDirectMessage( &data ); + data << uint8(1); + player->SendDirectMessage(&data); } } diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index 86355ee21..56dd52d13 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -54,32 +54,32 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (glyphIndex >= MAX_GLYPH_SLOT_INDEX) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } - Item *pItem = pUser->GetItemByPos(bagIndex, slot); + Item* pItem = pUser->GetItemByPos(bagIndex, slot); if (!pItem) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } if (pItem->GetObjectGuid() != itemGuid) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } DETAIL_LOG("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, cast_count: %u, spellid: %u, Item: %u, glyphIndex: %u, unk_flags: %u, data length = %i", bagIndex, slot, cast_count, spellid, pItem->GetEntry(), glyphIndex, unk_flags, (uint32)recvPacket.size()); - ItemPrototype const *proto = pItem->GetProto(); + ItemPrototype const* proto = pItem->GetProto(); if (!proto) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); return; } @@ -87,7 +87,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (proto->InventoryType != INVTYPE_NON_EQUIP && !pItem->IsEquipped()) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); return; } @@ -95,7 +95,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (msg != EQUIP_ERR_OK) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError( msg, pItem, NULL ); + pUser->SendEquipError(msg, pItem, NULL); return; } @@ -103,14 +103,14 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (pItem->IsInTrade()) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); return; } // only allow conjured consumable, bandage, poisons (all should have the 2^21 item flag set in DB) if (proto->Class == ITEM_CLASS_CONSUMABLE && - !(proto->Flags & ITEM_FLAG_USEABLE_IN_ARENA) && - pUser->InArena()) + !(proto->Flags & ITEM_FLAG_USEABLE_IN_ARENA) && + pUser->InArena()) { recvPacket.rpos(recvPacket.wpos()); // prevent spam at not read packet tail pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH,pItem,NULL); @@ -119,9 +119,9 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) if (pUser->isInCombat()) { - for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { - if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(proto->Spells[i].SpellId)) + if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[i].SpellId)) { if (IsNonCombatSpell(spellInfo)) { @@ -142,12 +142,12 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) } // check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory) - if( pItem->GetProto()->Bonding == BIND_WHEN_USE || pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM ) + if (pItem->GetProto()->Bonding == BIND_WHEN_USE || pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM) { if (!pItem->IsSoulBound()) { pItem->SetState(ITEM_CHANGED, pUser); - pItem->SetBinding( true ); + pItem->SetBinding(true); } } @@ -167,7 +167,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) { // for implicit area/coord target spells if (IsPointEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0])) || - IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0]))) + IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0]))) Spell::SendCastResult(_player,spellInfo,cast_count,SPELL_FAILED_NO_VALID_TARGETS); // for explicit target spells else @@ -206,47 +206,47 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (!pUser->IsSelfMover()) return; - Item *pItem = pUser->GetItemByPos(bagIndex, slot); - if(!pItem) + Item* pItem = pUser->GetItemByPos(bagIndex, slot); + if (!pItem) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } - ItemPrototype const *proto = pItem->GetProto(); - if(!proto) + ItemPrototype const* proto = pItem->GetProto(); + if (!proto) { - pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); return; } // locked item uint32 lockId = proto->LockID; - if(lockId && !pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_UNLOCKED)) + if (lockId && !pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_UNLOCKED)) { - LockEntry const *lockInfo = sLockStore.LookupEntry(lockId); + LockEntry const* lockInfo = sLockStore.LookupEntry(lockId); if (!lockInfo) { - pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL ); - sLog.outError( "WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", pItem->GetGUIDLow() , lockId); + pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL); + sLog.outError("WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", pItem->GetGUIDLow() , lockId); return; } // required picklocking - if(lockInfo->Skill[1] || lockInfo->Skill[0]) + if (lockInfo->Skill[1] || lockInfo->Skill[0]) { - pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL ); + pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, pItem, NULL); return; } } if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))// wrapped? { - QueryResult *result = CharacterDatabase.PQuery("SELECT entry, flags FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow()); + QueryResult* result = CharacterDatabase.PQuery("SELECT entry, flags FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow()); if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); uint32 flags = fields[1].GetUInt32(); @@ -272,7 +272,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) pUser->SendLoot(pItem->GetObjectGuid(),LOOT_CORPSE); } -void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data ) +void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recv_data) { ObjectGuid guid; @@ -284,8 +284,8 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data ) if (!_player->IsSelfMover()) return; - GameObject *obj = GetPlayer()->GetMap()->GetGameObject(guid); - if(!obj) + GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid); + if (!obj) return; // Additional check preventing exploits (ie loot despawned chests) @@ -327,7 +327,7 @@ void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket) if (!go) return; - if(!go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) + if (!go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) return; _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT, go->GetEntry()); @@ -350,11 +350,11 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) } DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i", - spellId, cast_count, unk_flags, (uint32)recvPacket.size()); + spellId, cast_count, unk_flags, (uint32)recvPacket.size()); - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + if (!spellInfo) { sLog.outError("WORLD: unknown spell id %u", spellId); recvPacket.rpos(recvPacket.wpos()); // prevent spam at ignore packet @@ -364,7 +364,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) if (mover->GetTypeId()==TYPEID_PLAYER) { // not have spell in spellbook or spell passive and not casted by client - if (!((Player*)mover)->HasActiveSpell (spellId) || IsPassiveSpell(spellInfo)) + if (!((Player*)mover)->HasActiveSpell(spellId) || IsPassiveSpell(spellInfo)) { sLog.outError("World: Player %u casts spell %u which he shouldn't have", mover->GetGUIDLow(), spellId); //cheater? kick? ban? @@ -396,7 +396,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) recvPacket >> Unused(); // unk1, coords? recvPacket >> Unused(); // unk1, coords? recvPacket >> unk1; // >> 1 or 0 - if(unk1) + if (unk1) { ObjectGuid guid; // guid - unused MovementInfo movementInfo; @@ -411,11 +411,11 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) if (Unit* target = targets.getUnitTarget()) { // if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message - if (SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->getLevel())) + if (SpellEntry const* actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(spellInfo, target->getLevel())) spellInfo = actualSpellInfo; } - Spell *spell = new Spell(mover, spellInfo, false); + Spell* spell = new Spell(mover, spellInfo, false); spell->m_cast_count = cast_count; // set count of casts spell->prepare(&targets); } @@ -433,19 +433,19 @@ void WorldSession::HandleCancelCastOpcode(WorldPacket& recvPacket) return; //FIXME: hack, ignore unexpected client cancel Deadly Throw cast - if(spellId==26679) + if (spellId==26679) return; - if(mover->IsNonMeleeSpellCasted(false)) + if (mover->IsNonMeleeSpellCasted(false)) mover->InterruptNonMeleeSpells(false,spellId); } -void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) +void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket) { uint32 spellId; recvPacket >> spellId; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) return; @@ -462,10 +462,10 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) { // except own aura spells bool allow = false; - for(int k = 0; k < MAX_EFFECT_INDEX; ++k) + for (int k = 0; k < MAX_EFFECT_INDEX; ++k) { if (spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS || - spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS_PET) + spellInfo->EffectApplyAuraName[k] == SPELL_AURA_MOD_POSSESS_PET) { allow = true; break; @@ -473,7 +473,7 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) } // this also include case when aura not found - if(!allow) + if (!allow) return; } else @@ -489,7 +489,7 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) return; } - SpellAuraHolder *holder = _player->GetSpellAuraHolder(spellId); + SpellAuraHolder* holder = _player->GetSpellAuraHolder(spellId); // not own area auras can't be cancelled (note: maybe need to check for aura on holder and not general on spell) if (holder && holder->GetCasterGuid() != _player->GetObjectGuid() && HasAreaAuraEffect(holder->GetSpellProto())) @@ -499,7 +499,7 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket) _player->RemoveAurasDueToSpellByCancel(spellId); } -void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket) +void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) { ObjectGuid guid; uint32 spellId; @@ -511,8 +511,8 @@ void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket) if (!_player->IsSelfMover()) return; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId ); - if(!spellInfo) + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); + if (!spellInfo) { sLog.outError("WORLD: unknown PET spell id %u", spellId); return; @@ -543,19 +543,19 @@ void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket) pet->AddCreatureSpellCooldown(spellId); } -void WorldSession::HandleCancelGrowthAuraOpcode( WorldPacket& /*recvPacket*/) +void WorldSession::HandleCancelGrowthAuraOpcode(WorldPacket& /*recvPacket*/) { // nothing do } -void WorldSession::HandleCancelAutoRepeatSpellOpcode( WorldPacket& /*recvPacket*/) +void WorldSession::HandleCancelAutoRepeatSpellOpcode(WorldPacket& /*recvPacket*/) { // cancel and prepare for deleting // do not send SMSG_CANCEL_AUTO_REPEAT! client will send this Opcode again (loop) _player->GetMover()->InterruptSpell(CURRENT_AUTOREPEAT_SPELL, true, false); } -void WorldSession::HandleCancelChanneling( WorldPacket & recv_data) +void WorldSession::HandleCancelChanneling(WorldPacket& recv_data) { recv_data.read_skip(); // spellid, not used @@ -567,7 +567,7 @@ void WorldSession::HandleCancelChanneling( WorldPacket & recv_data) mover->InterruptSpell(CURRENT_CHANNELED_SPELL); } -void WorldSession::HandleTotemDestroyed( WorldPacket& recvPacket) +void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket) { uint8 slotId; @@ -584,21 +584,21 @@ void WorldSession::HandleTotemDestroyed( WorldPacket& recvPacket) totem->UnSummon(); } -void WorldSession::HandleSelfResOpcode( WorldPacket & /*recv_data*/ ) +void WorldSession::HandleSelfResOpcode(WorldPacket& /*recv_data*/) { DEBUG_FILTER_LOG(LOG_FILTER_SPELL_CAST, "WORLD: CMSG_SELF_RES"); // empty opcode - if(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)) + if (_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)); - if(spellInfo) + SpellEntry const* spellInfo = sSpellStore.LookupEntry(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)); + if (spellInfo) _player->CastSpell(_player, spellInfo, false); _player->SetUInt32Value(PLAYER_SELF_RES_SPELL, 0); } } -void WorldSession::HandleSpellClick( WorldPacket & recv_data ) +void WorldSession::HandleSpellClick(WorldPacket& recv_data) { ObjectGuid guid; recv_data >> guid; @@ -606,17 +606,17 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data ) if (_player->isInCombat()) // client prevent click and set different icon at combat state return; - Creature *unit = _player->GetMap()->GetAnyTypeCreature(guid); + Creature* unit = _player->GetMap()->GetAnyTypeCreature(guid); if (!unit || unit->isInCombat()) // client prevent click and set different icon at combat state return; SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(unit->GetEntry()); - for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr) + for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr) { if (itr->second.IsFitToRequirements(_player)) { - Unit *caster = (itr->second.castFlags & 0x1) ? (Unit*)_player : (Unit*)unit; - Unit *target = (itr->second.castFlags & 0x2) ? (Unit*)_player : (Unit*)unit; + Unit* caster = (itr->second.castFlags & 0x1) ? (Unit*)_player : (Unit*)unit; + Unit* target = (itr->second.castFlags & 0x2) ? (Unit*)_player : (Unit*)unit; caster->CastSpell(target, itr->second.spellId, true); } diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index e77ee72f6..025f04e2f 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -31,11 +31,11 @@ bool IsPrimaryProfessionSkill(uint32 skill) { - SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(skill); - if(!pSkill) + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); + if (!pSkill) return false; - if(pSkill->categoryId != SKILL_CATEGORY_PROFESSION) + if (pSkill->categoryId != SKILL_CATEGORY_PROFESSION) return false; return true; @@ -55,27 +55,27 @@ SpellMgr& SpellMgr::Instance() return spellMgr; } -int32 GetSpellDuration(SpellEntry const *spellInfo) +int32 GetSpellDuration(SpellEntry const* spellInfo) { - if(!spellInfo) + if (!spellInfo) return 0; - SpellDurationEntry const *du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex); - if(!du) + SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex); + if (!du) return 0; return (du->Duration[0] == -1) ? -1 : abs(du->Duration[0]); } -int32 GetSpellMaxDuration(SpellEntry const *spellInfo) +int32 GetSpellMaxDuration(SpellEntry const* spellInfo) { - if(!spellInfo) + if (!spellInfo) return 0; - SpellDurationEntry const *du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex); - if(!du) + SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex); + if (!du) return 0; return (du->Duration[2] == -1) ? -1 : abs(du->Duration[2]); } -int32 CalculateSpellDuration(SpellEntry const *spellInfo, Unit const* caster) +int32 CalculateSpellDuration(SpellEntry const* spellInfo, Unit const* caster) { int32 duration = GetSpellDuration(spellInfo); @@ -114,7 +114,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell) return 0; } - SpellCastTimesEntry const *spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex); + SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex); // not all spells have cast time index and this is all is pasiive abilities if (!spellCastTimeEntry) @@ -142,14 +142,14 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell) return (castTime > 0) ? uint32(castTime) : 0; } -uint32 GetSpellCastTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype ) +uint32 GetSpellCastTimeForBonus(SpellEntry const* spellProto, DamageEffectType damagetype) { uint32 CastingTime = !IsChanneledSpell(spellProto) ? GetSpellCastTime(spellProto) : GetSpellDuration(spellProto); if (CastingTime > 7000) CastingTime = 7000; if (CastingTime < 1500) CastingTime = 1500; - if(damagetype == DOT && !IsChanneledSpell(spellProto)) + if (damagetype == DOT && !IsChanneledSpell(spellProto)) CastingTime = 3500; int32 overTime = 0; @@ -179,10 +179,10 @@ uint32 GetSpellCastTimeForBonus( SpellEntry const *spellProto, DamageEffectType case SPELL_AURA_PERIODIC_DAMAGE: case SPELL_AURA_PERIODIC_HEAL: case SPELL_AURA_PERIODIC_LEECH: - if ( GetSpellDuration(spellProto) ) + if (GetSpellDuration(spellProto)) overTime = GetSpellDuration(spellProto); break; - // Penalty for additional effects + // Penalty for additional effects case SPELL_AURA_DUMMY: ++effects; break; @@ -227,10 +227,10 @@ uint32 GetSpellCastTimeForBonus( SpellEntry const *spellProto, DamageEffectType CastingTime /= 2; // 50% for damage and healing spells for leech spells from damage bonus and 0% from healing - for(int j = 0; j < MAX_EFFECT_INDEX; ++j) + for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { if (spellProto->Effect[j] == SPELL_EFFECT_HEALTH_LEECH || - (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH)) + (spellProto->Effect[j] == SPELL_EFFECT_APPLY_AURA && spellProto->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH)) { CastingTime /= 2; break; @@ -247,19 +247,19 @@ uint32 GetSpellCastTimeForBonus( SpellEntry const *spellProto, DamageEffectType uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo) { int32 DotDuration = GetSpellDuration(spellInfo); - if(DotDuration == 0) + if (DotDuration == 0) return 1; // 200% limit - if(DotDuration > 30000) + if (DotDuration > 30000) DotDuration = 30000; for (int j = 0; j < MAX_EFFECT_INDEX; ++j) { if (spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA && ( - spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || - spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_HEAL || - spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH) ) + spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_DAMAGE || + spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_HEAL || + spellInfo->EffectApplyAuraName[j] == SPELL_AURA_PERIODIC_LEECH)) { if (spellInfo->EffectAmplitude[j] != 0) return DotDuration / spellInfo->EffectAmplitude[j]; @@ -282,7 +282,7 @@ uint16 GetSpellAuraMaxTicks(uint32 spellId) return GetSpellAuraMaxTicks(spellInfo); } -float CalculateDefaultCoefficient(SpellEntry const *spellProto, DamageEffectType const damagetype) +float CalculateDefaultCoefficient(SpellEntry const* spellProto, DamageEffectType const damagetype) { // Damage over Time spells bonus calculation float DotFactor = 1.0f; @@ -301,9 +301,9 @@ float CalculateDefaultCoefficient(SpellEntry const *spellProto, DamageEffectType return coeff * DotFactor; } -WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo) +WeaponAttackType GetWeaponAttackType(SpellEntry const* spellInfo) { - if(!spellInfo) + if (!spellInfo) return BASE_ATTACK; switch (spellInfo->DmgClass) @@ -318,7 +318,7 @@ WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo) return RANGED_ATTACK; break; default: - // Wands + // Wands if (spellInfo->HasAttribute(SPELL_ATTR_EX2_AUTOREPEAT_FLAG)) return RANGED_ATTACK; else @@ -329,34 +329,34 @@ WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo) bool IsPassiveSpell(uint32 spellId) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); if (!spellInfo) return false; return IsPassiveSpell(spellInfo); } -bool IsPassiveSpell(SpellEntry const *spellInfo) +bool IsPassiveSpell(SpellEntry const* spellInfo) { return spellInfo->HasAttribute(SPELL_ATTR_PASSIVE); } bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 spellId_2) { - SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1); - SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2); - if(!spellInfo_1 || !spellInfo_2) return false; - if(spellInfo_1->Id == spellId_2) return false; + SpellEntry const* spellInfo_1 = sSpellStore.LookupEntry(spellId_1); + SpellEntry const* spellInfo_2 = sSpellStore.LookupEntry(spellId_2); + if (!spellInfo_1 || !spellInfo_2) return false; + if (spellInfo_1->Id == spellId_2) return false; for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) { for (int32 j = 0; j < MAX_EFFECT_INDEX; ++j) { if (spellInfo_1->Effect[i] == spellInfo_2->Effect[j] - && spellInfo_1->EffectApplyAuraName[i] == spellInfo_2->EffectApplyAuraName[j] - && spellInfo_1->EffectMiscValue[i] == spellInfo_2->EffectMiscValue[j] - && spellInfo_1->EffectItemType[i] == spellInfo_2->EffectItemType[j] - && (spellInfo_1->Effect[i] != 0 || spellInfo_1->EffectApplyAuraName[i] != 0 || - spellInfo_1->EffectMiscValue[i] != 0 || spellInfo_1->EffectItemType[i] != 0)) + && spellInfo_1->EffectApplyAuraName[i] == spellInfo_2->EffectApplyAuraName[j] + && spellInfo_1->EffectMiscValue[i] == spellInfo_2->EffectMiscValue[j] + && spellInfo_1->EffectItemType[i] == spellInfo_2->EffectItemType[j] + && (spellInfo_1->Effect[i] != 0 || spellInfo_1->EffectApplyAuraName[i] != 0 || + spellInfo_1->EffectMiscValue[i] != 0 || spellInfo_1->EffectItemType[i] != 0)) return true; } } @@ -366,9 +366,9 @@ bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 spellId_2) int32 CompareAuraRanks(uint32 spellId_1, uint32 spellId_2) { - SpellEntry const*spellInfo_1 = sSpellStore.LookupEntry(spellId_1); - SpellEntry const*spellInfo_2 = sSpellStore.LookupEntry(spellId_2); - if(!spellInfo_1 || !spellInfo_2) return 0; + SpellEntry const* spellInfo_1 = sSpellStore.LookupEntry(spellId_1); + SpellEntry const* spellInfo_2 = sSpellStore.LookupEntry(spellId_2); + if (!spellInfo_1 || !spellInfo_2) return 0; if (spellId_1 == spellId_2) return 0; for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) @@ -386,11 +386,11 @@ int32 CompareAuraRanks(uint32 spellId_1, uint32 spellId_2) SpellSpecific GetSpellSpecific(uint32 spellId) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); + if (!spellInfo) return SPELL_NORMAL; - switch(spellInfo->SpellFamilyName) + switch (spellInfo->SpellFamilyName) { case SPELLFAMILY_GENERIC: { @@ -399,16 +399,16 @@ SpellSpecific GetSpellSpecific(uint32 spellId) { bool food = false; bool drink = false; - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { - switch(spellInfo->EffectApplyAuraName[i]) + switch (spellInfo->EffectApplyAuraName[i]) { - // Food + // Food case SPELL_AURA_MOD_REGEN: case SPELL_AURA_OBS_MOD_HEALTH: food = true; break; - // Drink + // Drink case SPELL_AURA_MOD_POWER_REGEN: case SPELL_AURA_OBS_MOD_MANA: drink = true; @@ -471,8 +471,8 @@ SpellSpecific GetSpellSpecific(uint32 spellId) { // "Well Fed" buff from Blessed Sunfruit, Blessed Sunfruit Juice, Alterac Spring Water if (spellInfo->HasAttribute(SPELL_ATTR_CASTABLE_WHILE_SITTING) && - (spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK) && - (spellInfo->SpellIconID == 52 || spellInfo->SpellIconID == 79)) + (spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK) && + (spellInfo->SpellIconID == 52 || spellInfo->SpellIconID == 79)) return SPELL_WELL_FED; break; } @@ -528,9 +528,9 @@ SpellSpecific GetSpellSpecific(uint32 spellId) // Tracking spells (exclude Well Fed, some other always allowed cases) if ((IsSpellHaveAura(spellInfo, SPELL_AURA_TRACK_CREATURES) || - IsSpellHaveAura(spellInfo, SPELL_AURA_TRACK_RESOURCES) || - IsSpellHaveAura(spellInfo, SPELL_AURA_TRACK_STEALTHED)) && - (spellInfo->HasAttribute(SPELL_ATTR_EX_UNK17) || spellInfo->HasAttribute(SPELL_ATTR_EX6_UNK12))) + IsSpellHaveAura(spellInfo, SPELL_AURA_TRACK_RESOURCES) || + IsSpellHaveAura(spellInfo, SPELL_AURA_TRACK_STEALTHED)) && + (spellInfo->HasAttribute(SPELL_ATTR_EX_UNK17) || spellInfo->HasAttribute(SPELL_ATTR_EX6_UNK12))) return SPELL_TRACKER; // elixirs can have different families, but potion most ofc. @@ -543,7 +543,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId) // target not allow have more one spell specific from same caster bool IsSingleFromSpellSpecificPerTargetPerCaster(SpellSpecific spellSpec1,SpellSpecific spellSpec2) { - switch(spellSpec1) + switch (spellSpec1) { case SPELL_BLESSING: case SPELL_AURA: @@ -563,7 +563,7 @@ bool IsSingleFromSpellSpecificPerTargetPerCaster(SpellSpecific spellSpec1,SpellS // target not allow have more one ranks from spell from spell specific per target bool IsSingleFromSpellSpecificSpellRanksPerTarget(SpellSpecific spellSpec1,SpellSpecific spellSpec2) { - switch(spellSpec1) + switch (spellSpec1) { case SPELL_BLESSING: case SPELL_AURA: @@ -579,7 +579,7 @@ bool IsSingleFromSpellSpecificSpellRanksPerTarget(SpellSpecific spellSpec1,Spell // target not allow have more one spell specific per target from any caster bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1,SpellSpecific spellSpec2) { - switch(spellSpec1) + switch (spellSpec1) { case SPELL_SEAL: case SPELL_TRACKER: @@ -592,24 +592,24 @@ bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1,SpellSpecific s return spellSpec1==spellSpec2; case SPELL_BATTLE_ELIXIR: return spellSpec2==SPELL_BATTLE_ELIXIR - || spellSpec2==SPELL_FLASK_ELIXIR; + || spellSpec2==SPELL_FLASK_ELIXIR; case SPELL_GUARDIAN_ELIXIR: return spellSpec2==SPELL_GUARDIAN_ELIXIR - || spellSpec2==SPELL_FLASK_ELIXIR; + || spellSpec2==SPELL_FLASK_ELIXIR; case SPELL_FLASK_ELIXIR: return spellSpec2==SPELL_BATTLE_ELIXIR - || spellSpec2==SPELL_GUARDIAN_ELIXIR - || spellSpec2==SPELL_FLASK_ELIXIR; + || spellSpec2==SPELL_GUARDIAN_ELIXIR + || spellSpec2==SPELL_FLASK_ELIXIR; case SPELL_FOOD: return spellSpec2==SPELL_FOOD - || spellSpec2==SPELL_FOOD_AND_DRINK; + || spellSpec2==SPELL_FOOD_AND_DRINK; case SPELL_DRINK: return spellSpec2==SPELL_DRINK - || spellSpec2==SPELL_FOOD_AND_DRINK; + || spellSpec2==SPELL_FOOD_AND_DRINK; case SPELL_FOOD_AND_DRINK: return spellSpec2==SPELL_FOOD - || spellSpec2==SPELL_DRINK - || spellSpec2==SPELL_FOOD_AND_DRINK; + || spellSpec2==SPELL_DRINK + || spellSpec2==SPELL_FOOD_AND_DRINK; default: return false; } @@ -617,9 +617,9 @@ bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1,SpellSpecific s bool IsPositiveTarget(uint32 targetA, uint32 targetB) { - switch(targetA) + switch (targetA) { - // non-positive targets + // non-positive targets case TARGET_CHAIN_DAMAGE: case TARGET_ALL_ENEMY_IN_AREA: case TARGET_ALL_ENEMY_IN_AREA_INSTANT: @@ -629,7 +629,7 @@ bool IsPositiveTarget(uint32 targetA, uint32 targetB) case TARGET_SINGLE_ENEMY: case TARGET_IN_FRONT_OF_CASTER_30: return false; - // positive or dependent + // positive or dependent case TARGET_CASTER_COORDINATES: return (targetB == TARGET_ALL_PARTY || targetB == TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER); default: @@ -643,7 +643,7 @@ bool IsPositiveTarget(uint32 targetA, uint32 targetB) bool IsExplicitPositiveTarget(uint32 targetA) { // positive targets that in target selection code expect target in m_targers, so not that auto-select target by spell data by m_caster and etc - switch(targetA) + switch (targetA) { case TARGET_SINGLE_FRIEND: case TARGET_SINGLE_PARTY: @@ -660,7 +660,7 @@ bool IsExplicitPositiveTarget(uint32 targetA) bool IsExplicitNegativeTarget(uint32 targetA) { // non-positive targets that in target selection code expect target in m_targers, so not that auto-select target by spell data by m_caster and etc - switch(targetA) + switch (targetA) { case TARGET_CHAIN_DAMAGE: case TARGET_CURRENT_ENEMY_COORDINATES: @@ -672,13 +672,13 @@ bool IsExplicitNegativeTarget(uint32 targetA) return false; } -bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) +bool IsPositiveEffect(SpellEntry const* spellproto, SpellEffectIndex effIndex) { - switch(spellproto->Effect[effIndex]) + switch (spellproto->Effect[effIndex]) { case SPELL_EFFECT_DUMMY: // some explicitly required dummy effect sets - switch(spellproto->Id) + switch (spellproto->Id) { case 28441: // AB Effect 000 return false; @@ -690,7 +690,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) break; } break; - // always positive effects (check before target checks that provided non-positive result in some case for positive effects) + // always positive effects (check before target checks that provided non-positive result in some case for positive effects) case SPELL_EFFECT_HEAL: case SPELL_EFFECT_LEARN_SPELL: case SPELL_EFFECT_SKILL_STEP: @@ -703,12 +703,12 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) case SPELL_EFFECT_APPLY_AURA: case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND: { - switch(spellproto->EffectApplyAuraName[effIndex]) + switch (spellproto->EffectApplyAuraName[effIndex]) { case SPELL_AURA_DUMMY: { // dummy aura can be positive or negative dependent from casted spell - switch(spellproto->Id) + switch (spellproto->Id) { case 13139: // net-o-matic special effect case 23445: // evil twin @@ -720,7 +720,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) case 44689: // Relay Race Accept Hidden Debuff - DND case 58600: // Restricted Flight Area return false; - // some spells have unclear target modes for selection, so just make effect positive + // some spells have unclear target modes for selection, so just make effect positive case 27184: case 27190: case 27191: @@ -740,7 +740,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) case SPELL_AURA_MOD_DODGE_PERCENT: case SPELL_AURA_MOD_HEALING_PCT: case SPELL_AURA_MOD_HEALING_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) @@ -751,7 +751,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) case SPELL_AURA_MOD_SPELL_CRIT_CHANCE: case SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT: case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE: - if(spellproto->CalculateSimpleValue(effIndex) > 0) + if (spellproto->CalculateSimpleValue(effIndex) > 0) return true; // some expected positive spells have SPELL_ATTR_EX_NEGATIVE or unclear target modes break; case SPELL_AURA_ADD_TARGET_TRIGGER: @@ -760,18 +760,18 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) if (spellproto->Id != spellproto->EffectTriggerSpell[effIndex]) { uint32 spellTriggeredId = spellproto->EffectTriggerSpell[effIndex]; - SpellEntry const *spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId); + SpellEntry const* spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId); if (spellTriggeredProto) { // non-positive targets of main spell return early - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { // if non-positive trigger cast targeted to positive target this main cast is non-positive // this will place this spell auras as debuffs if (spellTriggeredProto->Effect[i] && - IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[i], spellTriggeredProto->EffectImplicitTargetB[i]) && - !IsPositiveEffect(spellTriggeredProto, SpellEffectIndex(i))) + IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[i], spellTriggeredProto->EffectImplicitTargetB[i]) && + !IsPositiveEffect(spellTriggeredProto, SpellEffectIndex(i))) return false; } } @@ -785,11 +785,11 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) return false; // but all single stun aura spells is negative // Petrification - if(spellproto->Id == 17624) + if (spellproto->Id == 17624) return false; break; case SPELL_AURA_MOD_PACIFY_SILENCE: - switch(spellproto->Id) + switch (spellproto->Id) { case 24740: // Wisp Costume case 47585: // Dispersion @@ -807,14 +807,14 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) 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_SELF || - spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF2) + spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF2) 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_SELF || - spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF2) && - spellproto->SpellFamilyName == SPELLFAMILY_GENERIC) + spellproto->EffectImplicitTargetA[effIndex] == TARGET_SELF2) && + spellproto->SpellFamilyName == SPELLFAMILY_GENERIC) return false; // but not this if this first effect (don't found better check) if (spellproto->HasAttribute(SPELL_ATTR_UNK26) && effIndex == EFFECT_INDEX_0) @@ -822,7 +822,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) break; case SPELL_AURA_TRANSFORM: // some spells negative - switch(spellproto->Id) + switch (spellproto->Id) { case 36897: // Transporter Malfunction (race mutation to horde) case 36899: // Transporter Malfunction (race mutation to alliance) @@ -831,7 +831,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) break; case SPELL_AURA_MOD_SCALE: // some spells negative - switch(spellproto->Id) + switch (spellproto->Id) { case 802: // Mutate Bug, wrongly negative by target modes return true; @@ -845,7 +845,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) case SPELL_AURA_MECHANIC_IMMUNITY: { // non-positive immunities - switch(spellproto->EffectMiscValue[effIndex]) + switch (spellproto->EffectMiscValue[effIndex]) { case MECHANIC_BANDAGE: case MECHANIC_SHIELD: @@ -860,10 +860,10 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) case SPELL_AURA_ADD_PCT_MODIFIER: { // non-positive mods - switch(spellproto->EffectMiscValue[effIndex]) + switch (spellproto->EffectMiscValue[effIndex]) { case SPELLMOD_COST: // dependent from bas point sign (negative -> positive) - if(spellproto->CalculateSimpleValue(effIndex) > 0) + if (spellproto->CalculateSimpleValue(effIndex) > 0) return false; break; default: @@ -892,7 +892,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) } // non-positive targets - if(!IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex],spellproto->EffectImplicitTargetB[effIndex])) + if (!IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex],spellproto->EffectImplicitTargetB[effIndex])) return false; // AttributesEx check @@ -905,14 +905,14 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex) bool IsPositiveSpell(uint32 spellId) { - SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); + SpellEntry const* spellproto = sSpellStore.LookupEntry(spellId); if (!spellproto) return false; return IsPositiveSpell(spellproto); } -bool IsPositiveSpell(SpellEntry const *spellproto) +bool IsPositiveSpell(SpellEntry const* spellproto) { // spells with at least one negative effect are considered negative // some self-applied spells have negative effects but in self casting case negative check ignored. @@ -922,14 +922,14 @@ bool IsPositiveSpell(SpellEntry const *spellproto) return true; } -bool IsSingleTargetSpell(SpellEntry const *spellInfo) +bool IsSingleTargetSpell(SpellEntry const* spellInfo) { // all other single target spells have if it has AttributesEx5 if (spellInfo->HasAttribute(SPELL_ATTR_EX5_SINGLE_TARGET_SPELL)) return true; // TODO - need found Judgements rule - switch(GetSpellSpecific(spellInfo->Id)) + switch (GetSpellSpecific(spellInfo->Id)) { case SPELL_JUDGEMENT: return true; @@ -940,28 +940,28 @@ bool IsSingleTargetSpell(SpellEntry const *spellInfo) // single target triggered spell. // Not real client side single target spell, but it' not triggered until prev. aura expired. // This is allow store it in single target spells list for caster for spell proc checking - if(spellInfo->Id==38324) // Regeneration (triggered by 38299 (HoTs on Heals)) + if (spellInfo->Id==38324) // Regeneration (triggered by 38299 (HoTs on Heals)) return true; return false; } -bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellInfo2) +bool IsSingleTargetSpells(SpellEntry const* spellInfo1, SpellEntry const* spellInfo2) { // TODO - need better check // Equal icon and spellfamily - if( spellInfo1->SpellFamilyName == spellInfo2->SpellFamilyName && - spellInfo1->SpellIconID == spellInfo2->SpellIconID ) + if (spellInfo1->SpellFamilyName == spellInfo2->SpellFamilyName && + spellInfo1->SpellIconID == spellInfo2->SpellIconID) return true; // TODO - need found Judgements rule SpellSpecific spec1 = GetSpellSpecific(spellInfo1->Id); // spell with single target specific types - switch(spec1) + switch (spec1) { case SPELL_JUDGEMENT: case SPELL_MAGE_POLYMORPH: - if(GetSpellSpecific(spellInfo2->Id) == spec1) + if (GetSpellSpecific(spellInfo2->Id) == spec1) return true; break; default: @@ -971,12 +971,12 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI return false; } -SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 form) +SpellCastResult GetErrorAtShapeshiftedCast(SpellEntry const* spellInfo, uint32 form) { // 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 && - (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_LEARN_SPELL) ) + if (GetTalentSpellCost(spellInfo->Id) > 0 && + (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[EFFECT_INDEX_2] == SPELL_EFFECT_LEARN_SPELL)) return SPELL_CAST_OK; uint32 stanceMask = (form ? 1 << (form - 1) : 0); @@ -990,7 +990,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 bool actAsShifted = false; if (form > 0) { - SpellShapeshiftFormEntry const *shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form); + SpellShapeshiftFormEntry const* shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form); if (!shapeInfo) { sLog.outError("GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); @@ -999,7 +999,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells } - if(actAsShifted) + if (actAsShifted) { if (spellInfo->HasAttribute(SPELL_ATTR_NOT_SHAPESHIFT)) // not while shapeshifted return SPELL_FAILED_NOT_SHAPESHIFT; @@ -1009,7 +1009,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 else { // needs shapeshift - if(!spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && spellInfo->Stances != 0) + if (!spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && spellInfo->Stances != 0) return SPELL_FAILED_ONLY_SHAPESHIFT; } @@ -1023,7 +1023,7 @@ void SpellMgr::LoadSpellTargetPositions() uint32 count = 0; // 0 1 2 3 4 5 - QueryResult *result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); + QueryResult* result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); if (!result) { BarGoLink bar(1); @@ -1039,7 +1039,7 @@ void SpellMgr::LoadSpellTargetPositions() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); @@ -1074,7 +1074,7 @@ void SpellMgr::LoadSpellTargetPositions() } bool found = false; - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { if (spellInfo->EffectImplicitTargetA[i]==TARGET_TABLE_X_Y_Z_COORDINATES || spellInfo->EffectImplicitTargetB[i]==TARGET_TABLE_X_Y_Z_COORDINATES) { @@ -1102,7 +1102,8 @@ void SpellMgr::LoadSpellTargetPositions() mSpellTargetPositions[Spell_ID] = st; ++count; - } while( result->NextRow() ); + } + while (result->NextRow()); delete result; @@ -1113,10 +1114,10 @@ void SpellMgr::LoadSpellTargetPositions() template struct SpellRankHelper { - SpellRankHelper(SpellMgr &_mgr, StorageType &_storage): mgr(_mgr), worker(_storage), customRank(0) {} - void RecordRank(EntryType &entry, uint32 spell_id) + SpellRankHelper(SpellMgr& _mgr, StorageType& _storage): mgr(_mgr), worker(_storage), customRank(0) {} + void RecordRank(EntryType& entry, uint32 spell_id) { - const SpellEntry *spell = sSpellStore.LookupEntry(spell_id); + const SpellEntry* spell = sSpellStore.LookupEntry(spell_id); if (!spell) { sLog.outErrorDb("Spell %u listed in `%s` does not exist", spell_id, worker.TableName()); @@ -1126,7 +1127,7 @@ struct SpellRankHelper uint32 first_id = mgr.GetFirstSpellInChain(spell_id); // most spell ranks expected same data - if(first_id) + if (first_id) { firstRankSpells.insert(first_id); @@ -1162,7 +1163,7 @@ struct SpellRankHelper std::set firstRankSpells; std::set firstRankSpellsWithCustomRanks; - SpellMgr &mgr; + SpellMgr& mgr; WorkerType worker; uint32 customRank; }; @@ -1170,7 +1171,7 @@ struct SpellRankHelper struct DoSpellProcEvent { DoSpellProcEvent(SpellProcEventMap& _spe_map) : spe_map(_spe_map), customProc(0), count(0) {} - void operator() (uint32 spell_id) + void operator()(uint32 spell_id) { SpellProcEventEntry const& spe = state->second; // add ranks only for not filled data (some ranks have ppm data different for ranks for example) @@ -1213,7 +1214,7 @@ struct DoSpellProcEvent } const char* TableName() { return "spell_proc_event"; } - bool IsValidCustomRank(SpellProcEventEntry const &spe, uint32 entry, uint32 first_id) + bool IsValidCustomRank(SpellProcEventEntry const& spe, uint32 entry, uint32 first_id) { // let have independent data in table for spells with ppm rates (exist rank dependent ppm rate spells) if (!spe.ppmRate) @@ -1224,7 +1225,7 @@ struct DoSpellProcEvent } return true; } - void AddEntry(SpellProcEventEntry const &spe, SpellEntry const *spell) + void AddEntry(SpellProcEventEntry const& spe, SpellEntry const* spell) { spe_map[spell->Id] = spe; @@ -1260,7 +1261,7 @@ struct DoSpellProcEvent // totally redundant record if (!spe.schoolMask && !spe.procFlags && - !spe.procEx && !spe.ppmRate && !spe.customChance && !spe.cooldown) + !spe.procEx && !spe.ppmRate && !spe.customChance && !spe.cooldown) { bool empty = !spe.spellFamilyName ? true : false; for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) @@ -1297,7 +1298,7 @@ void SpellMgr::LoadSpellProcEvents() mSpellProcEventMap.clear(); // need for reload case // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 - QueryResult *result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMaskA0, SpellFamilyMaskA1, SpellFamilyMaskA2, SpellFamilyMaskB0, SpellFamilyMaskB1, SpellFamilyMaskB2, SpellFamilyMaskC0, SpellFamilyMaskC1, SpellFamilyMaskC2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); + QueryResult* result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMaskA0, SpellFamilyMaskA1, SpellFamilyMaskA2, SpellFamilyMaskB0, SpellFamilyMaskB1, SpellFamilyMaskB2, SpellFamilyMaskC0, SpellFamilyMaskC1, SpellFamilyMaskC2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); if (!result) { BarGoLink bar(1); @@ -1312,7 +1313,7 @@ void SpellMgr::LoadSpellProcEvents() BarGoLink bar(result->GetRowCount()); do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); @@ -1326,8 +1327,8 @@ void SpellMgr::LoadSpellProcEvents() for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { spe.spellFamilyMask[i] = ClassFamilyMask( - (uint64)fields[i+3].GetUInt32() | ((uint64)fields[i+6].GetUInt32()<<32), - fields[i+9].GetUInt32()); + (uint64)fields[i+3].GetUInt32() | ((uint64)fields[i+6].GetUInt32()<<32), + fields[i+9].GetUInt32()); } spe.procFlags = fields[12].GetUInt32(); spe.procEx = fields[13].GetUInt32(); @@ -1337,20 +1338,21 @@ void SpellMgr::LoadSpellProcEvents() rankHelper.RecordRank(spe, entry); - } while (result->NextRow()); + } + while (result->NextRow()); rankHelper.FillHigherRanks(); delete result; sLog.outString(); - sLog.outString( ">> Loaded %u extra spell proc event conditions +%u custom proc (inc. +%u custom ranks)", rankHelper.worker.count, rankHelper.worker.customProc, rankHelper.customRank); + sLog.outString(">> Loaded %u extra spell proc event conditions +%u custom proc (inc. +%u custom ranks)", rankHelper.worker.count, rankHelper.worker.customProc, rankHelper.customRank); } struct DoSpellProcItemEnchant { DoSpellProcItemEnchant(SpellProcItemEnchantMap& _procMap, float _ppm) : procMap(_procMap), ppm(_ppm) {} - void operator() (uint32 spell_id) { procMap[spell_id] = ppm; } + void operator()(uint32 spell_id) { procMap[spell_id] = ppm; } SpellProcItemEnchantMap& procMap; float ppm; @@ -1363,7 +1365,7 @@ void SpellMgr::LoadSpellProcItemEnchant() uint32 count = 0; // 0 1 - QueryResult *result = WorldDatabase.Query("SELECT entry, ppmRate FROM spell_proc_item_enchant"); + QueryResult* result = WorldDatabase.Query("SELECT entry, ppmRate FROM spell_proc_item_enchant"); if (!result) { @@ -1380,7 +1382,7 @@ void SpellMgr::LoadSpellProcItemEnchant() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); @@ -1397,7 +1399,7 @@ void SpellMgr::LoadSpellProcItemEnchant() uint32 first_id = GetFirstSpellInChain(entry); - if ( first_id != entry ) + if (first_id != entry) { sLog.outErrorDb("Spell %u listed in `spell_proc_item_enchant` is not first rank (%u) in chain", entry, first_id); // prevent loading since it won't have an effect anyway @@ -1411,15 +1413,16 @@ void SpellMgr::LoadSpellProcItemEnchant() doForHighRanks(entry,worker); ++count; - } while( result->NextRow() ); + } + while (result->NextRow()); delete result; sLog.outString(); - sLog.outString( ">> Loaded %u proc item enchant definitions", count ); + sLog.outString(">> Loaded %u proc item enchant definitions", count); } -bool IsCastEndProcModifierAura(SpellEntry const *spellInfo, SpellEffectIndex effecIdx, SpellEntry const *procSpell) +bool IsCastEndProcModifierAura(SpellEntry const* spellInfo, SpellEffectIndex effecIdx, SpellEntry const* procSpell) { // modifier auras that can proc on cast end switch (AuraType(spellInfo->EffectApplyAuraName[effecIdx])) @@ -1457,7 +1460,7 @@ bool IsCastEndProcModifierAura(SpellEntry const *spellInfo, SpellEffectIndex eff struct DoSpellBonuses { DoSpellBonuses(SpellBonusMap& _spellBonusMap, SpellBonusEntry const& _spellBonus) : spellBonusMap(_spellBonusMap), spellBonus(_spellBonus) {} - void operator() (uint32 spell_id) { spellBonusMap[spell_id] = spellBonus; } + void operator()(uint32 spell_id) { spellBonusMap[spell_id] = spellBonus; } SpellBonusMap& spellBonusMap; SpellBonusEntry const& spellBonus; @@ -1468,7 +1471,7 @@ void SpellMgr::LoadSpellBonuses() mSpellBonusMap.clear(); // need for reload case uint32 count = 0; // 0 1 2 3 - QueryResult *result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); + QueryResult* result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); if (!result) { BarGoLink bar(1); @@ -1481,7 +1484,7 @@ void SpellMgr::LoadSpellBonuses() BarGoLink bar(result->GetRowCount()); do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); uint32 entry = fields[0].GetUInt32(); @@ -1494,7 +1497,7 @@ void SpellMgr::LoadSpellBonuses() uint32 first_id = GetFirstSpellInChain(entry); - if ( first_id != entry ) + if (first_id != entry) { sLog.outErrorDb("Spell %u listed in `spell_bonus_data` is not first rank (%u) in chain", entry, first_id); // prevent loading since it won't have an effect anyway @@ -1511,7 +1514,7 @@ void SpellMgr::LoadSpellBonuses() bool need_dot = false; bool need_direct = false; uint32 x = 0; // count all, including empty, meaning: not all existing effect is DoTs/HoTs - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { if (!spell->Effect[i]) { @@ -1520,7 +1523,7 @@ void SpellMgr::LoadSpellBonuses() } // DoTs/HoTs - switch(spell->EffectApplyAuraName[i]) + switch (spell->EffectApplyAuraName[i]) { case SPELL_AURA_PERIODIC_DAMAGE: case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: @@ -1548,11 +1551,11 @@ void SpellMgr::LoadSpellBonuses() if (sbe.direct_damage) { bool isHeal = false; - for(int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) { // Heals (Also count Mana Shield and Absorb effects as heals) if (spell->Effect[i] == SPELL_EFFECT_HEAL || spell->Effect[i] == SPELL_EFFECT_HEAL_MAX_HEALTH || - (spell->Effect[i] == SPELL_EFFECT_APPLY_AURA && (spell->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_ABSORB || spell->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL)) ) + (spell->Effect[i] == SPELL_EFFECT_APPLY_AURA && (spell->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_ABSORB || spell->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL))) { isHeal = true; break; @@ -1568,7 +1571,7 @@ void SpellMgr::LoadSpellBonuses() if (sbe.dot_damage) { bool isHeal = false; - for(int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) { // Periodic Heals if (spell->Effect[i] == SPELL_EFFECT_APPLY_AURA && spell->EffectApplyAuraName[i] == SPELL_AURA_PERIODIC_HEAL) @@ -1583,17 +1586,17 @@ void SpellMgr::LoadSpellBonuses() if (direct_diff < 0.02f && !need_dot && !sbe.ap_bonus && !sbe.ap_dot_bonus) sLog.outErrorDb("`spell_bonus_data` entry for spell %u `direct_bonus` not needed (data from table: %f, calculated %f, difference of %f) and `dot_bonus` also not used", - entry, sbe.direct_damage, direct_calc, direct_diff); + entry, sbe.direct_damage, direct_calc, direct_diff); else if (direct_diff < 0.02f && dot_diff < 0.02f && !sbe.ap_bonus && !sbe.ap_dot_bonus) { sLog.outErrorDb("`spell_bonus_data` entry for spell %u `direct_bonus` not needed (data from table: %f, calculated %f, difference of %f) and ", - entry, sbe.direct_damage, direct_calc, direct_diff); + entry, sbe.direct_damage, direct_calc, direct_diff); sLog.outErrorDb(" ... `dot_bonus` not needed (data from table: %f, calculated %f, difference of %f)", - sbe.dot_damage, dot_calc, dot_diff); + sbe.dot_damage, dot_calc, dot_diff); } else if (!need_direct && dot_diff < 0.02f && !sbe.ap_bonus && !sbe.ap_dot_bonus) sLog.outErrorDb("`spell_bonus_data` entry for spell %u `dot_bonus` not needed (data from table: %f, calculated %f, difference of %f) and direct also not used", - entry, sbe.dot_damage, dot_calc, dot_diff); + entry, sbe.dot_damage, dot_calc, dot_diff); else if (!need_direct && sbe.direct_damage) sLog.outErrorDb("`spell_bonus_data` entry for spell %u `direct_bonus` not used (spell not have non-periodic affects)", entry); else if (!need_dot && sbe.dot_damage) @@ -1612,21 +1615,22 @@ void SpellMgr::LoadSpellBonuses() ++count; - } while( result->NextRow() ); + } + while (result->NextRow()); delete result; sLog.outString(); - sLog.outString( ">> Loaded %u extra spell bonus data", count); + sLog.outString(">> Loaded %u extra spell bonus data", count); } -bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const * spellProcEvent, uint32 EventProcFlag, SpellEntry const * procSpell, uint32 procFlags, uint32 procExtra) +bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellEntry const* procSpell, uint32 procFlags, uint32 procExtra) { // No extra req need uint32 procEvent_procEx = PROC_EX_NONE; // check prockFlags for condition - if((procFlags & EventProcFlag) == 0) + if ((procFlags & EventProcFlag) == 0) return false; // Always trigger for this @@ -1642,17 +1646,17 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const * spellP 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; } } @@ -1687,7 +1691,7 @@ void SpellMgr::LoadSpellElixirs() uint32 count = 0; // 0 1 - QueryResult *result = WorldDatabase.Query("SELECT entry, mask FROM spell_elixir"); + QueryResult* result = WorldDatabase.Query("SELECT entry, mask FROM spell_elixir"); if (!result) { @@ -1704,7 +1708,7 @@ void SpellMgr::LoadSpellElixirs() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); @@ -1722,20 +1726,21 @@ void SpellMgr::LoadSpellElixirs() mSpellElixirs[entry] = mask; ++count; - } while( result->NextRow() ); + } + while (result->NextRow()); delete result; sLog.outString(); - sLog.outString( ">> Loaded %u spell elixir definitions", count ); + sLog.outString(">> Loaded %u spell elixir definitions", count); } struct DoSpellThreat { DoSpellThreat(SpellThreatMap& _threatMap) : threatMap(_threatMap), count(0) {} - void operator() (uint32 spell_id) + void operator()(uint32 spell_id) { - SpellThreatEntry const &ste = state->second; + SpellThreatEntry const& ste = state->second; // add ranks only for not filled data (spells adding flat threat are usually different for ranks) SpellThreatMap::const_iterator spellItr = threatMap.find(spell_id); if (spellItr == threatMap.end()) @@ -1750,7 +1755,7 @@ struct DoSpellThreat } } const char* TableName() { return "spell_threat"; } - bool IsValidCustomRank(SpellThreatEntry const &ste, uint32 entry, uint32 first_id) + bool IsValidCustomRank(SpellThreatEntry const& ste, uint32 entry, uint32 first_id) { if (!ste.threat) { @@ -1760,7 +1765,7 @@ struct DoSpellThreat } return true; } - void AddEntry(SpellThreatEntry const &ste, SpellEntry const *spell) + void AddEntry(SpellThreatEntry const& ste, SpellEntry const* spell) { threatMap[spell->Id] = ste; @@ -1768,9 +1773,9 @@ struct DoSpellThreat // effects have same targets, otherwise, we'd need to seperate it by effect index if (ste.threat || ste.ap_bonus != 0.f) { - const uint32 *targetA = spell->EffectImplicitTargetA; + const uint32* targetA = spell->EffectImplicitTargetA; if ((targetA[EFFECT_INDEX_1] && targetA[EFFECT_INDEX_1] != targetA[EFFECT_INDEX_0]) || - (targetA[EFFECT_INDEX_2] && targetA[EFFECT_INDEX_2] != targetA[EFFECT_INDEX_0])) + (targetA[EFFECT_INDEX_2] && targetA[EFFECT_INDEX_2] != targetA[EFFECT_INDEX_0])) sLog.outErrorDb("Spell %u listed in `spell_threat` has effects with different targets, threat may be assigned incorrectly", spell->Id); } ++count; @@ -1788,7 +1793,7 @@ void SpellMgr::LoadSpellThreats() mSpellThreatMap.clear(); // need for reload case // 0 1 2 3 - QueryResult *result = WorldDatabase.Query("SELECT entry, Threat, multiplier, ap_bonus FROM spell_threat"); + QueryResult* result = WorldDatabase.Query("SELECT entry, Threat, multiplier, ap_bonus FROM spell_threat"); if (!result) { BarGoLink bar(1); @@ -1804,7 +1809,7 @@ void SpellMgr::LoadSpellThreats() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); @@ -1817,26 +1822,27 @@ void SpellMgr::LoadSpellThreats() rankHelper.RecordRank(ste, entry); - } while( result->NextRow() ); + } + while (result->NextRow()); rankHelper.FillHigherRanks(); delete result; sLog.outString(); - sLog.outString( ">> Loaded %u spell threat entries", rankHelper.worker.count ); + sLog.outString(">> Loaded %u spell threat entries", rankHelper.worker.count); } -bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const +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; + SpellEntry const* spellInfo_2 = sSpellStore.LookupEntry(spellId_2); + 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::canStackSpellRanksInSpellBook(SpellEntry const *spellInfo) const +bool SpellMgr::canStackSpellRanksInSpellBook(SpellEntry const* spellInfo) const { if (IsPassiveSpell(spellInfo)) // ranked passive spell return false; @@ -1851,7 +1857,7 @@ bool SpellMgr::canStackSpellRanksInSpellBook(SpellEntry const *spellInfo) const // All stance spells. if any better way, change it. for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { - switch(spellInfo->SpellFamilyName) + switch (spellInfo->SpellFamilyName) { case SPELLFAMILY_PALADIN: // Paladin aura Spell @@ -1864,13 +1870,13 @@ bool SpellMgr::canStackSpellRanksInSpellBook(SpellEntry const *spellInfo) const case SPELLFAMILY_DRUID: // Druid form Spell if (spellInfo->Effect[i]==SPELL_EFFECT_APPLY_AURA && - spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT) + spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT) return false; break; case SPELLFAMILY_ROGUE: // Rogue Stealth if (spellInfo->Effect[i]==SPELL_EFFECT_APPLY_AURA && - spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT) + spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT) return false; break; } @@ -1880,8 +1886,8 @@ bool SpellMgr::canStackSpellRanksInSpellBook(SpellEntry const *spellInfo) const bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) const { - SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1); - SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2); + SpellEntry const* spellInfo_1 = sSpellStore.LookupEntry(spellId_1); + SpellEntry const* spellInfo_2 = sSpellStore.LookupEntry(spellId_2); if (!spellInfo_1 || !spellInfo_2) return false; @@ -1898,27 +1904,27 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; // Specific spell family spells - switch(spellInfo_1->SpellFamilyName) + switch (spellInfo_1->SpellFamilyName) { case SPELLFAMILY_GENERIC: - switch(spellInfo_2->SpellFamilyName) + switch (spellInfo_2->SpellFamilyName) { case SPELLFAMILY_GENERIC: // same family case { // Thunderfury if ((spellInfo_1->Id == 21992 && spellInfo_2->Id == 27648) || - (spellInfo_2->Id == 21992 && spellInfo_1->Id == 27648)) + (spellInfo_2->Id == 21992 && spellInfo_1->Id == 27648)) return false; // Lightning Speed (Mongoose) and Fury of the Crashing Waves (Tsunami Talisman) if ((spellInfo_1->Id == 28093 && spellInfo_2->Id == 42084) || - (spellInfo_2->Id == 28093 && spellInfo_1->Id == 42084)) + (spellInfo_2->Id == 28093 && spellInfo_1->Id == 42084)) return false; // Soulstone Resurrection and Twisting Nether (resurrector) if (spellInfo_1->SpellIconID == 92 && spellInfo_2->SpellIconID == 92 && ( - (spellInfo_1->SpellVisual[0] == 99 && spellInfo_2->SpellVisual[0] == 0) || - (spellInfo_2->SpellVisual[0] == 99 && spellInfo_1->SpellVisual[0] == 0))) + (spellInfo_1->SpellVisual[0] == 99 && spellInfo_2->SpellVisual[0] == 0) || + (spellInfo_2->SpellVisual[0] == 99 && spellInfo_1->SpellVisual[0] == 0))) return false; // Heart of the Wild, Agility and various Idol Triggers @@ -1935,37 +1941,37 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons // Brood Affliction: Bronze if ((spellInfo_1->Id == 23170 && spellInfo_2->Id == 23171) || - (spellInfo_2->Id == 23170 && spellInfo_1->Id == 23171)) + (spellInfo_2->Id == 23170 && spellInfo_1->Id == 23171)) return false; // Male Shadowy Disguise if ((spellInfo_1->Id == 32756 && spellInfo_2->Id == 38080) || - (spellInfo_2->Id == 32756 && spellInfo_1->Id == 38080)) - return false; + (spellInfo_2->Id == 32756 && spellInfo_1->Id == 38080)) + return false; // Female Shadowy Disguise if ((spellInfo_1->Id == 32756 && spellInfo_2->Id == 38081) || - (spellInfo_2->Id == 32756 && spellInfo_1->Id == 38081)) - return false; + (spellInfo_2->Id == 32756 && spellInfo_1->Id == 38081)) + return false; // Cool Down (See PeriodicAuraTick()) if ((spellInfo_1->Id == 52441 && spellInfo_2->Id == 52443) || - (spellInfo_2->Id == 52441 && spellInfo_1->Id == 52443)) + (spellInfo_2->Id == 52441 && spellInfo_1->Id == 52443)) return false; // See Chapel Invisibility and See Noth Invisibility if ((spellInfo_1->Id == 52950 && spellInfo_2->Id == 52707) || - (spellInfo_2->Id == 52950 && spellInfo_1->Id == 52707)) + (spellInfo_2->Id == 52950 && spellInfo_1->Id == 52707)) return false; // Regular and Night Elf Ghost if ((spellInfo_1->Id == 8326 && spellInfo_2->Id == 20584) || - (spellInfo_2->Id == 8326 && spellInfo_1->Id == 20584)) - return false; + (spellInfo_2->Id == 8326 && spellInfo_1->Id == 20584)) + return false; // Aura of Despair auras if ((spellInfo_1->Id == 64848 && spellInfo_2->Id == 62692) || - (spellInfo_2->Id == 64848 && spellInfo_1->Id == 62692)) + (spellInfo_2->Id == 64848 && spellInfo_1->Id == 62692)) return false; // Blood Fury and Rage of the Unraveller @@ -1982,7 +1988,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons // Unstable Sphere Timer and Unstable Sphere Passive if ((spellInfo_1->Id == 50758 && spellInfo_2->Id == 50756) || - (spellInfo_2->Id == 50758 && spellInfo_1->Id == 50756)) + (spellInfo_2->Id == 50758 && spellInfo_1->Id == 50756)) return false; break; @@ -2053,20 +2059,20 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons } } // Dragonmaw Illusion, Blood Elf Illusion, Human Illusion, Illidari Agent Illusion, Scarlet Crusade Disguise - if(spellInfo_1->SpellIconID == 1691 && spellInfo_2->SpellIconID == 1691) + if (spellInfo_1->SpellIconID == 1691 && spellInfo_2->SpellIconID == 1691) return false; break; case SPELLFAMILY_MAGE: - if( spellInfo_2->SpellFamilyName == SPELLFAMILY_MAGE ) + if (spellInfo_2->SpellFamilyName == SPELLFAMILY_MAGE) { // Blizzard & Chilled (and some other stacked with blizzard spells if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x80)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x100000))) || - ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x80)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x100000)))) + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x80)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x100000)))) return false; // Blink & Improved Blink if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x0000000000010000)) && (spellInfo_2->SpellVisual[0] == 72 && spellInfo_2->SpellIconID == 1499)) || - ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x0000000000010000)) && (spellInfo_1->SpellVisual[0] == 72 && spellInfo_1->SpellIconID == 1499))) + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x0000000000010000)) && (spellInfo_1->SpellVisual[0] == 72 && spellInfo_1->SpellIconID == 1499))) return false; // Fingers of Frost effects @@ -2075,12 +2081,12 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons // Living Bomb & Ignite (Dots) if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x2000000000000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x8000000))) || - ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x2000000000000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x8000000)))) + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x2000000000000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x8000000)))) return false; // Fireball & Pyroblast (Dots) if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x1)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x400000))) || - ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x1)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x400000)))) + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x1)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x400000)))) return false; } // Detect Invisibility and Mana Shield (multi-family check) @@ -2101,33 +2107,33 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons { // Siphon Life and Drain Life if ((spellInfo_1->SpellIconID == 152 && spellInfo_2->SpellIconID == 546) || - (spellInfo_2->SpellIconID == 152 && spellInfo_1->SpellIconID == 546)) + (spellInfo_2->SpellIconID == 152 && spellInfo_1->SpellIconID == 546)) return false; //Corruption & Seed of corruption if ((spellInfo_1->SpellIconID == 313 && spellInfo_2->SpellIconID == 1932) || - (spellInfo_2->SpellIconID == 313 && spellInfo_1->SpellIconID == 1932)) - if(spellInfo_1->SpellVisual[0] != 0 && spellInfo_2->SpellVisual[0] != 0) + (spellInfo_2->SpellIconID == 313 && spellInfo_1->SpellIconID == 1932)) + if (spellInfo_1->SpellVisual[0] != 0 && spellInfo_2->SpellVisual[0] != 0) return true; // can't be stacked // Corruption and Unstable Affliction if ((spellInfo_1->SpellIconID == 313 && spellInfo_2->SpellIconID == 2039) || - (spellInfo_2->SpellIconID == 313 && spellInfo_1->SpellIconID == 2039)) + (spellInfo_2->SpellIconID == 313 && spellInfo_1->SpellIconID == 2039)) return false; // (Corruption or Unstable Affliction) and (Curse of Agony or Curse of Doom) if (((spellInfo_1->SpellIconID == 313 || spellInfo_1->SpellIconID == 2039) && (spellInfo_2->SpellIconID == 544 || spellInfo_2->SpellIconID == 91)) || - ((spellInfo_2->SpellIconID == 313 || spellInfo_2->SpellIconID == 2039) && (spellInfo_1->SpellIconID == 544 || spellInfo_1->SpellIconID == 91))) + ((spellInfo_2->SpellIconID == 313 || spellInfo_2->SpellIconID == 2039) && (spellInfo_1->SpellIconID == 544 || spellInfo_1->SpellIconID == 91))) return false; // Shadowflame and Curse of Agony - if( spellInfo_1->SpellIconID == 544 && spellInfo_2->SpellIconID == 3317 || - spellInfo_2->SpellIconID == 544 && spellInfo_1->SpellIconID == 3317 ) + if (spellInfo_1->SpellIconID == 544 && spellInfo_2->SpellIconID == 3317 || + spellInfo_2->SpellIconID == 544 && spellInfo_1->SpellIconID == 3317) return false; // Shadowflame and Curse of Doom - if( spellInfo_1->SpellIconID == 91 && spellInfo_2->SpellIconID == 3317 || - spellInfo_2->SpellIconID == 91 && spellInfo_1->SpellIconID == 3317 ) + if (spellInfo_1->SpellIconID == 91 && spellInfo_2->SpellIconID == 3317 || + spellInfo_2->SpellIconID == 91 && spellInfo_1->SpellIconID == 3317) return false; // Metamorphosis, diff effects @@ -2143,22 +2149,22 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons { // Rend and Deep Wound if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x1000000000))) || - ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x1000000000)))) + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x1000000000)))) return false; // Battle Shout and Rampage if ((spellInfo_1->SpellIconID == 456 && spellInfo_2->SpellIconID == 2006) || - (spellInfo_2->SpellIconID == 456 && spellInfo_1->SpellIconID == 2006)) + (spellInfo_2->SpellIconID == 456 && spellInfo_1->SpellIconID == 2006)) return false; // Glyph of Revenge (triggered), and Sword and Board (triggered) if ((spellInfo_1->SpellIconID == 856 && spellInfo_2->SpellIconID == 2780) || - (spellInfo_2->SpellIconID == 856 && spellInfo_1->SpellIconID == 2780)) + (spellInfo_2->SpellIconID == 856 && spellInfo_1->SpellIconID == 2780)) return false; // Defensive/Berserker/Battle stance aura can not stack (needed for dummy auras) if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x800000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x800000))) || - ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x800000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x800000)))) + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x800000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x800000)))) return true; } @@ -2180,17 +2186,17 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons { //Devouring Plague and Shadow Vulnerability if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x2000000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x800000000))) || - ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x2000000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x800000000)))) + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x2000000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x800000000)))) return false; //StarShards and Shadow Word: Pain if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x8000))) || - ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x8000)))) + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x200000)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x8000)))) return false; // Dispersion if ((spellInfo_1->Id == 47585 && spellInfo_2->Id == 60069) || - (spellInfo_2->Id == 47585 && spellInfo_1->Id == 60069)) + (spellInfo_2->Id == 47585 && spellInfo_1->Id == 60069)) return false; } break; @@ -2199,17 +2205,17 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons { //Omen of Clarity and Blood Frenzy if (((spellInfo_1->SpellFamilyFlags == UI64LIT(0x0) && spellInfo_1->SpellIconID == 108) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20000000000000))) || - ((spellInfo_2->SpellFamilyFlags == UI64LIT(0x0) && spellInfo_2->SpellIconID == 108) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20000000000000)))) + ((spellInfo_2->SpellFamilyFlags == UI64LIT(0x0) && spellInfo_2->SpellIconID == 108) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20000000000000)))) return false; // Tree of Life (Shapeshift) and 34123 Tree of Life (Passive) if ((spellId_1 == 33891 && spellId_2 == 34123) || - (spellId_2 == 33891 && spellId_1 == 34123)) + (spellId_2 == 33891 && spellId_1 == 34123)) return false; // Lifebloom and Wild Growth if ((spellInfo_1->SpellIconID == 2101 && spellInfo_2->SpellIconID == 2864) || - (spellInfo_2->SpellIconID == 2101 && spellInfo_1->SpellIconID == 2864)) + (spellInfo_2->SpellIconID == 2101 && spellInfo_1->SpellIconID == 2864)) return false; // Innervate and Glyph of Innervate and some other spells @@ -2218,22 +2224,22 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons // Wrath of Elune and Nature's Grace if ((spellInfo_1->Id == 16886 && spellInfo_2->Id == 46833) || - (spellInfo_2->Id == 16886 && spellInfo_1->Id == 46833)) + (spellInfo_2->Id == 16886 && spellInfo_1->Id == 46833)) return false; // Bear Rage (Feral T4 (2)) and Omen of Clarity if ((spellInfo_1->Id == 16864 && spellInfo_2->Id == 37306) || - (spellInfo_2->Id == 16864 && spellInfo_1->Id == 37306)) + (spellInfo_2->Id == 16864 && spellInfo_1->Id == 37306)) return false; // Cat Energy (Feral T4 (2)) and Omen of Clarity if ((spellInfo_1->Id == 16864 && spellInfo_2->Id == 37311) || - (spellInfo_2->Id == 16864 && spellInfo_1->Id == 37311)) + (spellInfo_2->Id == 16864 && spellInfo_1->Id == 37311)) return false; // Survival Instincts and Survival Instincts if ((spellInfo_1->Id == 61336 && spellInfo_2->Id == 50322) || - (spellInfo_2->Id == 61336 && spellInfo_1->Id == 50322)) + (spellInfo_2->Id == 61336 && spellInfo_1->Id == 50322)) return false; // Savage Roar and Savage Roar (triggered) @@ -2242,7 +2248,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons // Frenzied Regeneration and Savage Defense if ((spellInfo_1->Id == 22842 && spellInfo_2->Id == 62606) || - (spellInfo_2->Id == 22842 && spellInfo_1->Id == 62606)) + (spellInfo_2->Id == 22842 && spellInfo_1->Id == 62606)) return false; } @@ -2251,7 +2257,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons return false; // Dragonmaw Illusion (multi-family check) - if (spellId_1 == 42016 && spellId_2 == 40216 ) + if (spellId_1 == 42016 && spellId_2 == 40216) return false; break; @@ -2260,13 +2266,13 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons { // Master of Subtlety if ((spellId_1 == 31665 && spellId_2 == 31666) || - (spellId_1 == 31666 && spellId_2 == 31665)) + (spellId_1 == 31666 && spellId_2 == 31665)) return false; // Sprint & Sprint (waterwalk) if (spellInfo_1->SpellIconID == 516 && spellInfo_2->SpellIconID == 516 && - ((spellInfo_1->Category == 44 && spellInfo_2->Category == 0) || - (spellInfo_2->Category == 44 && spellInfo_1->Category == 0))) + ((spellInfo_1->Category == 44 && spellInfo_2->Category == 0) || + (spellInfo_2->Category == 44 && spellInfo_1->Category == 0))) return false; } @@ -2283,12 +2289,12 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons { // Rapid Fire & Quick Shots if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x20000000000))) || - ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20000000000))) ) + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x20)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x20000000000)))) return false; // Serpent Sting & (Immolation/Explosive Trap Effect) if (((spellInfo_1->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_2->SpellFamilyFlags & UI64LIT(0x00000004000))) || - ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x00000004000)))) + ((spellInfo_2->SpellFamilyFlags & UI64LIT(0x4)) && (spellInfo_1->SpellFamilyFlags & UI64LIT(0x00000004000)))) return false; // Deterrence @@ -2321,7 +2327,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons // Swift Retribution / Improved Devotion Aura (talents) and Paladin Auras if ((spellInfo_1->IsFitToFamilyMask(UI64LIT(0x0), 0x00000020) && (spellInfo_2->SpellIconID == 291 || spellInfo_2->SpellIconID == 3028)) || - (spellInfo_2->IsFitToFamilyMask(UI64LIT(0x0), 0x00000020) && (spellInfo_1->SpellIconID == 291 || spellInfo_1->SpellIconID == 3028))) + (spellInfo_2->IsFitToFamilyMask(UI64LIT(0x0), 0x00000020) && (spellInfo_1->SpellIconID == 291 || spellInfo_1->SpellIconID == 3028))) return false; // Beacon of Light and Light's Beacon @@ -2342,7 +2348,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons // Blood Corruption, Holy Vengeance, Righteous Vengeance if ((spellInfo_1->SpellIconID == 2292 && spellInfo_2->SpellIconID == 3025) || - (spellInfo_2->SpellIconID == 2292 && spellInfo_1->SpellIconID == 3025)) + (spellInfo_2->SpellIconID == 2292 && spellInfo_1->SpellIconID == 3025)) return false; } @@ -2367,7 +2373,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons { // Windfury weapon if (spellInfo_1->SpellIconID==220 && spellInfo_2->SpellIconID==220 && - !spellInfo_1->IsFitToFamilyMask(spellInfo_2->SpellFamilyFlags)) + !spellInfo_1->IsFitToFamilyMask(spellInfo_2->SpellFamilyFlags)) return false; // Ghost Wolf @@ -2408,15 +2414,15 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons // more generic checks if (spellInfo_1->SpellIconID == spellInfo_2->SpellIconID && - spellInfo_1->SpellIconID != 0 && spellInfo_2->SpellIconID != 0) + spellInfo_1->SpellIconID != 0 && spellInfo_2->SpellIconID != 0) { bool isModifier = false; for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { if (spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_ADD_FLAT_MODIFIER || - spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_ADD_PCT_MODIFIER || - spellInfo_2->EffectApplyAuraName[i] == SPELL_AURA_ADD_FLAT_MODIFIER || - spellInfo_2->EffectApplyAuraName[i] == SPELL_AURA_ADD_PCT_MODIFIER ) + spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_ADD_PCT_MODIFIER || + spellInfo_2->EffectApplyAuraName[i] == SPELL_AURA_ADD_FLAT_MODIFIER || + spellInfo_2->EffectApplyAuraName[i] == SPELL_AURA_ADD_PCT_MODIFIER) isModifier = true; } @@ -2437,9 +2443,9 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { if (spellInfo_1->Effect[i] != spellInfo_2->Effect[i] || - spellInfo_1->EffectItemType[i] != spellInfo_2->EffectItemType[i] || - spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i] || - spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]) + spellInfo_1->EffectItemType[i] != spellInfo_2->EffectItemType[i] || + spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i] || + spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]) return false; // ignore dummy only spells @@ -2454,8 +2460,8 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); + if (!spellInfo) return false; if (spellInfo->Effect[EFFECT_INDEX_1] != SPELL_EFFECT_SKILL) @@ -2468,8 +2474,8 @@ bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId) bool SpellMgr::IsProfessionSpell(uint32 spellId) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); + if (!spellInfo) return false; if (spellInfo->Effect[EFFECT_INDEX_1] != SPELL_EFFECT_SKILL) @@ -2482,8 +2488,8 @@ bool SpellMgr::IsProfessionSpell(uint32 spellId) bool SpellMgr::IsPrimaryProfessionSpell(uint32 spellId) { - SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); - if(!spellInfo) + SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId); + if (!spellInfo) return false; if (spellInfo->Effect[EFFECT_INDEX_1] != SPELL_EFFECT_SKILL) @@ -2497,7 +2503,8 @@ bool SpellMgr::IsPrimaryProfessionSpell(uint32 spellId) uint32 SpellMgr::GetProfessionSpellMinLevel(uint32 spellId) { uint32 s2l[8][3] = - { // 0 - gather 1 - non-gather 2 - fish + { + // 0 - gather 1 - non-gather 2 - fish /*0*/ { 0, 5, 5 }, /*1*/ { 0, 5, 5 }, /*2*/ { 0, 10, 10 }, @@ -2539,9 +2546,9 @@ bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const { SkillLineAbilityMapBounds bounds = GetSkillLineAbilityMapBounds(spellId); - for(SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) + for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) { - SkillLineAbilityEntry const *pAbility = _spell_idx->second; + SkillLineAbilityEntry const* pAbility = _spell_idx->second; if (!pAbility || pAbility->learnOnGetSkill != ABILITY_LEARNED_ON_GET_PROFESSION_SKILL) continue; @@ -2563,15 +2570,15 @@ SpellEntry const* SpellMgr::SelectAuraRankForLevel(SpellEntry const* spellInfo, return spellInfo; bool needRankSelection = false; - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { // for simple aura in check apply to any non caster based targets, in rank search mode to any explicit targets if (((spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA && - (IsExplicitPositiveTarget(spellInfo->EffectImplicitTargetA[i]) || - IsAreaEffectPossitiveTarget(Targets(spellInfo->EffectImplicitTargetA[i])))) || - spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY || - spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID) && - IsPositiveEffect(spellInfo, SpellEffectIndex(i))) + (IsExplicitPositiveTarget(spellInfo->EffectImplicitTargetA[i]) || + IsAreaEffectPossitiveTarget(Targets(spellInfo->EffectImplicitTargetA[i])))) || + spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY || + spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID) && + IsPositiveEffect(spellInfo, SpellEffectIndex(i))) { needRankSelection = true; break; @@ -2582,9 +2589,9 @@ SpellEntry const* SpellMgr::SelectAuraRankForLevel(SpellEntry const* spellInfo, if (!needRankSelection || GetSpellRank(spellInfo->Id) == 0) return spellInfo; - for(uint32 nextSpellId = spellInfo->Id; nextSpellId != 0; nextSpellId = GetPrevSpellInChain(nextSpellId)) + for (uint32 nextSpellId = spellInfo->Id; nextSpellId != 0; nextSpellId = GetPrevSpellInChain(nextSpellId)) { - SpellEntry const *nextSpellInfo = sSpellStore.LookupEntry(nextSpellId); + SpellEntry const* nextSpellInfo = sSpellStore.LookupEntry(nextSpellId); if (!nextSpellInfo) break; @@ -2674,7 +2681,7 @@ void SpellMgr::LoadSpellChains() // load known data for talents for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) { - TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); if (!talentInfo) continue; @@ -2708,7 +2715,7 @@ void SpellMgr::LoadSpellChains() { // we can calculate ranks only after full data generation AbilitySpellPrevMap prevRanks; - for(SkillLineAbilityMap::const_iterator ab_itr = mSkillLineAbilityMap.begin(); ab_itr != mSkillLineAbilityMap.end(); ++ab_itr) + for (SkillLineAbilityMap::const_iterator ab_itr = mSkillLineAbilityMap.begin(); ab_itr != mSkillLineAbilityMap.end(); ++ab_itr) { uint32 spell_id = ab_itr->first; @@ -2781,7 +2788,7 @@ void SpellMgr::LoadSpellChains() } // load custom case - QueryResult *result = WorldDatabase.Query("SELECT spell_id, prev_spell, first_spell, rank, req_spell FROM spell_chain"); + QueryResult* result = WorldDatabase.Query("SELECT spell_id, prev_spell, first_spell, rank, req_spell FROM spell_chain"); if (!result) { BarGoLink bar(1); @@ -2801,7 +2808,7 @@ void SpellMgr::LoadSpellChains() do { bar.step(); - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 spell_id = fields[0].GetUInt32(); @@ -2823,21 +2830,21 @@ void SpellMgr::LoadSpellChains() if (chain_itr->second.rank != node.rank) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` expected rank %u by DBC data.", - spell_id,node.prev,node.first,node.rank,node.req,chain_itr->second.rank); + spell_id,node.prev,node.first,node.rank,node.req,chain_itr->second.rank); continue; } if (chain_itr->second.prev != node.prev) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` expected prev %u by DBC data.", - spell_id,node.prev,node.first,node.rank,node.req,chain_itr->second.prev); + spell_id,node.prev,node.first,node.rank,node.req,chain_itr->second.prev); continue; } if (chain_itr->second.first != node.first) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` expected first %u by DBC data.", - spell_id,node.prev,node.first,node.rank,node.req,chain_itr->second.first); + spell_id,node.prev,node.first,node.rank,node.req,chain_itr->second.first); continue; } @@ -2851,64 +2858,64 @@ void SpellMgr::LoadSpellChains() // in other case redundant sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) already added (talent or spell ability with forward) and non need in `spell_chain`", - spell_id,node.prev,node.first,node.rank,node.req); + spell_id,node.prev,node.first,node.rank,node.req); continue; } if (node.prev != 0 && !sSpellStore.LookupEntry(node.prev)) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has nonexistent previous rank spell.", - spell_id,node.prev,node.first,node.rank,node.req); + spell_id,node.prev,node.first,node.rank,node.req); continue; } - if(!sSpellStore.LookupEntry(node.first)) + if (!sSpellStore.LookupEntry(node.first)) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has not existing first rank spell.", - spell_id,node.prev,node.first,node.rank,node.req); + spell_id,node.prev,node.first,node.rank,node.req); continue; } // check basic spell chain data integrity (note: rank can be equal 0 or 1 for first/single spell) - if( (spell_id == node.first) != (node.rank <= 1) || - (spell_id == node.first) != (node.prev == 0) || - (node.rank <= 1) != (node.prev == 0) ) + if ((spell_id == node.first) != (node.rank <= 1) || + (spell_id == node.first) != (node.prev == 0) || + (node.rank <= 1) != (node.prev == 0)) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has not compatible chain data.", - spell_id,node.prev,node.first,node.rank,node.req); + spell_id,node.prev,node.first,node.rank,node.req); continue; } - if(node.req!=0 && !sSpellStore.LookupEntry(node.req)) + if (node.req!=0 && !sSpellStore.LookupEntry(node.req)) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has not existing required spell.", - spell_id,node.prev,node.first,node.rank,node.req); + spell_id,node.prev,node.first,node.rank,node.req); continue; } // talents not required data in spell chain for work, but must be checked if present for integrity - if(TalentSpellPos const* pos = GetTalentSpellPos(spell_id)) + if (TalentSpellPos const* pos = GetTalentSpellPos(spell_id)) { - if(node.rank!=pos->rank+1) + if (node.rank!=pos->rank+1) { sLog.outErrorDb("Talent %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has wrong rank.", - spell_id,node.prev,node.first,node.rank,node.req); + spell_id,node.prev,node.first,node.rank,node.req); continue; } - if(TalentEntry const* talentEntry = sTalentStore.LookupEntry(pos->talent_id)) + if (TalentEntry const* talentEntry = sTalentStore.LookupEntry(pos->talent_id)) { - if(node.first!=talentEntry->RankID[0]) + if (node.first!=talentEntry->RankID[0]) { sLog.outErrorDb("Talent %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has wrong first rank spell.", - spell_id,node.prev,node.first,node.rank,node.req); + spell_id,node.prev,node.first,node.rank,node.req); continue; } - if(node.rank > 1 && node.prev != talentEntry->RankID[node.rank-1-1]) + if (node.rank > 1 && node.prev != talentEntry->RankID[node.rank-1-1]) { sLog.outErrorDb("Talent %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has wrong prev rank spell.", - spell_id,node.prev,node.first,node.rank,node.req); + spell_id,node.prev,node.first,node.rank,node.req); continue; } @@ -2931,14 +2938,14 @@ void SpellMgr::LoadSpellChains() if (bounds.first == bounds.second) { SkillLineAbilityMapBounds prev_bounds = mSkillLineAbilityMap.equal_range(node.prev); - for(SkillLineAbilityMap::const_iterator ab_itr = prev_bounds.first; ab_itr != prev_bounds.second; ++ab_itr) + for (SkillLineAbilityMap::const_iterator ab_itr = prev_bounds.first; ab_itr != prev_bounds.second; ++ab_itr) { // spell listed as forward and not listed as ability // this is marker for removed ranks if (ab_itr->second->forward_spellid == spell_id) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` is removed rank by DBC data.", - spell_id, node.prev, node.first, node.rank, node.req); + spell_id, node.prev, node.first, node.rank, node.req); skip = true; break; } @@ -2952,73 +2959,74 @@ void SpellMgr::LoadSpellChains() mSpellChains[spell_id] = node; ++new_count; - } while( result->NextRow() ); + } + while (result->NextRow()); delete result; // additional integrity checks - for(SpellChainMap::const_iterator i = mSpellChains.begin(); i != mSpellChains.end(); ++i) + for (SpellChainMap::const_iterator i = mSpellChains.begin(); i != mSpellChains.end(); ++i) { - if(i->second.prev) + if (i->second.prev) { SpellChainMap::const_iterator i_prev = mSpellChains.find(i->second.prev); - if(i_prev == mSpellChains.end()) + if (i_prev == mSpellChains.end()) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has not found previous rank spell in table.", - i->first,i->second.prev,i->second.first,i->second.rank,i->second.req); + i->first,i->second.prev,i->second.first,i->second.rank,i->second.req); } - else if( i_prev->second.first != i->second.first ) + else if (i_prev->second.first != i->second.first) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has different first spell in chain compared to previous rank spell (prev: %u, first: %u, rank: %d, req: %u).", - i->first,i->second.prev,i->second.first,i->second.rank,i->second.req, - i_prev->second.prev,i_prev->second.first,i_prev->second.rank,i_prev->second.req); + i->first,i->second.prev,i->second.first,i->second.rank,i->second.req, + i_prev->second.prev,i_prev->second.first,i_prev->second.rank,i_prev->second.req); } - else if( i_prev->second.rank+1 != i->second.rank ) + else if (i_prev->second.rank+1 != i->second.rank) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has different rank compared to previous rank spell (prev: %u, first: %u, rank: %d, req: %u).", - i->first,i->second.prev,i->second.first,i->second.rank,i->second.req, - i_prev->second.prev,i_prev->second.first,i_prev->second.rank,i_prev->second.req); + i->first,i->second.prev,i->second.first,i->second.rank,i->second.req, + i_prev->second.prev,i_prev->second.first,i_prev->second.rank,i_prev->second.req); } } - if(i->second.req) + if (i->second.req) { SpellChainMap::const_iterator i_req = mSpellChains.find(i->second.req); - if(i_req == mSpellChains.end()) + if (i_req == mSpellChains.end()) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has not found required rank spell in table.", - i->first,i->second.prev,i->second.first,i->second.rank,i->second.req); + i->first,i->second.prev,i->second.first,i->second.rank,i->second.req); } - else if( i_req->second.first == i->second.first ) + else if (i_req->second.first == i->second.first) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has required rank spell from same spell chain (prev: %u, first: %u, rank: %d, req: %u).", - i->first,i->second.prev,i->second.first,i->second.rank,i->second.req, - i_req->second.prev,i_req->second.first,i_req->second.rank,i_req->second.req); + i->first,i->second.prev,i->second.first,i->second.rank,i->second.req, + i_req->second.prev,i_req->second.first,i_req->second.rank,i_req->second.req); } - else if( i_req->second.req ) + else if (i_req->second.req) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has required rank spell with required spell (prev: %u, first: %u, rank: %d, req: %u).", - i->first,i->second.prev,i->second.first,i->second.rank,i->second.req, - i_req->second.prev,i_req->second.first,i_req->second.rank,i_req->second.req); + i->first,i->second.prev,i->second.first,i->second.rank,i->second.req, + i_req->second.prev,i_req->second.first,i_req->second.rank,i_req->second.req); } } } // fill next rank cache - for(SpellChainMap::const_iterator i = mSpellChains.begin(); i != mSpellChains.end(); ++i) + for (SpellChainMap::const_iterator i = mSpellChains.begin(); i != mSpellChains.end(); ++i) { uint32 spell_id = i->first; SpellChainNode const& node = i->second; - if(node.prev) + if (node.prev) mSpellChainsNext.insert(SpellChainMapNext::value_type(node.prev,spell_id)); - if(node.req) + if (node.req) mSpellChainsNext.insert(SpellChainMapNext::value_type(node.req,spell_id)); } // check single rank redundant cases (single rank talents/spell abilities not added by default so this can be only custom cases) - for(SpellChainMap::const_iterator i = mSpellChains.begin(); i != mSpellChains.end(); ++i) + for (SpellChainMap::const_iterator i = mSpellChains.begin(); i != mSpellChains.end(); ++i) { // skip non-first ranks, and spells with additional reqs if (i->second.rank > 1 || i->second.req) @@ -3027,12 +3035,12 @@ void SpellMgr::LoadSpellChains() if (mSpellChainsNext.find(i->first) == mSpellChainsNext.end()) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has single rank data, so redundant.", - i->first,i->second.prev,i->second.first,i->second.rank,i->second.req); + i->first,i->second.prev,i->second.first,i->second.rank,i->second.req); } } sLog.outString(); - sLog.outString( ">> Loaded %u spell chain records (%u from DBC data with %u req field updates, and %u loaded from table)", dbc_count+new_count, dbc_count, req_count, new_count); + sLog.outString(">> Loaded %u spell chain records (%u from DBC data with %u req field updates, and %u loaded from table)", dbc_count+new_count, dbc_count, req_count, new_count); } void SpellMgr::LoadSpellLearnSkills() @@ -3079,7 +3087,7 @@ void SpellMgr::LoadSpellLearnSpells() mSpellLearnSpells.clear(); // need for reload case // 0 1 2 - QueryResult *result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell"); + QueryResult* result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell"); if (!result) { BarGoLink bar(1); @@ -3097,7 +3105,7 @@ void SpellMgr::LoadSpellLearnSpells() do { bar.step(); - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 spell_id = fields[0].GetUInt32(); @@ -3127,22 +3135,23 @@ void SpellMgr::LoadSpellLearnSpells() mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spell_id,node)); ++count; - } while (result->NextRow()); + } + while (result->NextRow()); delete result; // search auto-learned spells and add its to map also for use in unlearn spells/talents uint32 dbc_count = 0; - for(uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell) + for (uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell) { SpellEntry const* entry = sSpellStore.LookupEntry(spell); if (!entry) continue; - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++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]; @@ -3160,12 +3169,12 @@ void SpellMgr::LoadSpellLearnSpells() SpellLearnSpellMapBounds db_node_bounds = GetSpellLearnSpellMapBounds(spell); bool found = false; - for(SpellLearnSpellMap::const_iterator itr = db_node_bounds.first; itr != db_node_bounds.second; ++itr) + for (SpellLearnSpellMap::const_iterator itr = db_node_bounds.first; itr != db_node_bounds.second; ++itr) { if (itr->second.spell == dbc_node.spell) { sLog.outErrorDb("Spell %u auto-learn spell %u in spell.dbc then the record in `spell_learn_spell` is redundant, please fix DB.", - spell,dbc_node.spell); + spell,dbc_node.spell); found = true; break; } @@ -3181,7 +3190,7 @@ void SpellMgr::LoadSpellLearnSpells() } sLog.outString(); - sLog.outString( ">> Loaded %u spell learn spells + %u found in DBC", count, dbc_count ); + sLog.outString(">> Loaded %u spell learn spells + %u found in DBC", count, dbc_count); } void SpellMgr::LoadSpellScriptTarget() @@ -3190,7 +3199,7 @@ void SpellMgr::LoadSpellScriptTarget() uint32 count = 0; - QueryResult *result = WorldDatabase.Query("SELECT entry,type,targetEntry FROM spell_script_target"); + QueryResult* result = WorldDatabase.Query("SELECT entry,type,targetEntry FROM spell_script_target"); if (!result) { @@ -3207,7 +3216,7 @@ void SpellMgr::LoadSpellScriptTarget() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); uint32 spellId = fields[0].GetUInt32(); @@ -3225,18 +3234,18 @@ void SpellMgr::LoadSpellScriptTarget() bool targetfound = false; for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { - if( spellProto->EffectImplicitTargetA[i] == TARGET_SCRIPT || - spellProto->EffectImplicitTargetB[i] == TARGET_SCRIPT || - spellProto->EffectImplicitTargetA[i] == TARGET_SCRIPT_COORDINATES || - spellProto->EffectImplicitTargetB[i] == TARGET_SCRIPT_COORDINATES || - spellProto->EffectImplicitTargetA[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT || - spellProto->EffectImplicitTargetB[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT || - spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_INSTANT || - spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_INSTANT || - spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_CUSTOM || - spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_CUSTOM || - spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_GO_AROUND_DEST || - spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_GO_AROUND_DEST) + if (spellProto->EffectImplicitTargetA[i] == TARGET_SCRIPT || + spellProto->EffectImplicitTargetB[i] == TARGET_SCRIPT || + spellProto->EffectImplicitTargetA[i] == TARGET_SCRIPT_COORDINATES || + spellProto->EffectImplicitTargetB[i] == TARGET_SCRIPT_COORDINATES || + spellProto->EffectImplicitTargetA[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT || + spellProto->EffectImplicitTargetB[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT || + spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_INSTANT || + spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_INSTANT || + spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_CUSTOM || + spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_CUSTOM || + spellProto->EffectImplicitTargetA[i] == TARGET_AREAEFFECT_GO_AROUND_DEST || + spellProto->EffectImplicitTargetB[i] == TARGET_AREAEFFECT_GO_AROUND_DEST) { targetfound = true; break; @@ -3294,7 +3303,8 @@ void SpellMgr::LoadSpellScriptTarget() mSpellScriptTarget.insert(SpellScriptTarget::value_type(spellId,SpellTargetEntry(SpellTargetType(type),targetEntry))); ++count; - } while (result->NextRow()); + } + while (result->NextRow()); delete result; @@ -3334,7 +3344,7 @@ void SpellMgr::LoadSpellPetAuras() uint32 count = 0; // 0 1 2 3 - QueryResult *result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras"); + QueryResult* result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras"); if (!result) { @@ -3351,7 +3361,7 @@ void SpellMgr::LoadSpellPetAuras() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); @@ -3367,7 +3377,7 @@ void SpellMgr::LoadSpellPetAuras() } SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell<<8) + eff); - if(itr != mSpellPetAuraMap.end()) + if (itr != mSpellPetAuraMap.end()) { itr->second.AddAura(pet, aura); } @@ -3381,8 +3391,8 @@ void SpellMgr::LoadSpellPetAuras() } if (spellInfo->Effect[eff] != SPELL_EFFECT_DUMMY && - (spellInfo->Effect[eff] != SPELL_EFFECT_APPLY_AURA || - spellInfo->EffectApplyAuraName[eff] != SPELL_AURA_DUMMY)) + (spellInfo->Effect[eff] != SPELL_EFFECT_APPLY_AURA || + spellInfo->EffectApplyAuraName[eff] != SPELL_AURA_DUMMY)) { sLog.outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell); continue; @@ -3400,12 +3410,13 @@ void SpellMgr::LoadSpellPetAuras() } ++count; - } while( result->NextRow() ); + } + while (result->NextRow()); delete result; sLog.outString(); - sLog.outString( ">> Loaded %u spell pet auras", count ); + sLog.outString(">> Loaded %u spell pet auras", count); } void SpellMgr::LoadPetLevelupSpellMap() @@ -3415,29 +3426,29 @@ void SpellMgr::LoadPetLevelupSpellMap() for (uint32 i = 0; i < sCreatureFamilyStore.GetNumRows(); ++i) { - CreatureFamilyEntry const *creatureFamily = sCreatureFamilyStore.LookupEntry(i); - if(!creatureFamily) // not exist + CreatureFamilyEntry const* creatureFamily = sCreatureFamilyStore.LookupEntry(i); + if (!creatureFamily) // not exist continue; for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) { - SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); - if( !skillLine ) + SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j); + if (!skillLine) continue; if (skillLine->skillId!=creatureFamily->skillLine[0] && - (!creatureFamily->skillLine[1] || skillLine->skillId!=creatureFamily->skillLine[1])) + (!creatureFamily->skillLine[1] || skillLine->skillId!=creatureFamily->skillLine[1])) 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 + SpellEntry const* spell = sSpellStore.LookupEntry(skillLine->spellId); + if (!spell) // not exist continue; PetLevelupSpellSet& spellSet = mPetLevelupSpellMap[creatureFamily->ID]; - if(spellSet.empty()) + if (spellSet.empty()) ++family_count; spellSet.insert(PetLevelupSpellSet::value_type(spell->spellLevel,spell->Id)); @@ -3446,33 +3457,33 @@ void SpellMgr::LoadPetLevelupSpellMap() } sLog.outString(); - sLog.outString( ">> Loaded %u pet levelup and default spells for %u families", count, family_count ); + sLog.outString(">> Loaded %u pet levelup and default spells for %u families", count, family_count); } bool SpellMgr::LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefaultSpellsEntry& petDefSpells) { // skip empty list; bool have_spell = false; - for(int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) + for (int 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 ? GetPetLevelupSpellList(cInfo->family) : NULL) + if (PetLevelupSpellSet const* levelupSpells = cInfo->family ? GetPetLevelupSpellList(cInfo->family) : NULL) { - for(int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) + for (int 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) + for (PetLevelupSpellSet::const_iterator itr = levelupSpells->begin(); itr != levelupSpells->end(); ++itr) { if (itr->second == petDefSpells.spellid[j]) { @@ -3485,9 +3496,9 @@ bool SpellMgr::LoadPetDefaultSpells_helper(CreatureInfo const* cInfo, PetDefault // skip empty list; have_spell = false; - for(int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) + for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) { - if(petDefSpells.spellid[j]) + if (petDefSpells.spellid[j]) { have_spell = true; break; @@ -3506,26 +3517,26 @@ 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(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; PetDefaultSpellsEntry petDefSpells; - for(int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j) + for (int 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; @@ -3533,35 +3544,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 < MAX_EFFECT_INDEX; ++k) + for (int k = 0; k < MAX_EFFECT_INDEX; ++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(creature_id); - if(!cInfo) + 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 (int 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; @@ -3571,27 +3582,27 @@ void SpellMgr::LoadPetDefaultSpells() } sLog.outString(); - sLog.outString( ">> Loaded addition spells for %u pet spell data entries and %u summonable creature templates", countData, countCreature ); + sLog.outString(">> Loaded addition spells for %u pet spell data entries and %u summonable creature templates", countData, countCreature); } /// 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) { // not exist - if(!spellInfo) + if (!spellInfo) return false; bool need_check_reagents = false; // check effects - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { - switch(spellInfo->Effect[i]) + switch (spellInfo->Effect[i]) { case SPELL_EFFECT_NONE: continue; - // craft spell for crafting nonexistent item (break client recipes list show) + // craft spell for crafting nonexistent item (break client recipes list show) case SPELL_EFFECT_CREATE_ITEM: case SPELL_EFFECT_CREATE_ITEM_2: { @@ -3600,9 +3611,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); @@ -3612,11 +3623,11 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) } // also possible IsLootCraftingSpell case but fake item must exist anyway - else if (!ObjectMgr::GetItemPrototype( spellInfo->EffectItemType[i] )) + else if (!ObjectMgr::GetItemPrototype(spellInfo->EffectItemType[i])) { - if(msg) + if (msg) { - if(pl) + if (pl) ChatHandler(pl).PSendSysMessage("Craft spell %u create item (Entry: %u) but item does not exist in item_template.",spellInfo->Id,spellInfo->EffectItemType[i]); else sLog.outErrorDb("Craft spell %u create item (Entry: %u) but item does not exist in item_template.",spellInfo->Id,spellInfo->EffectItemType[i]); @@ -3630,11 +3641,11 @@ 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) ) + 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]); @@ -3646,15 +3657,15 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg) } } - if(need_check_reagents) + if (need_check_reagents) { - for(int j = 0; j < MAX_SPELL_REAGENTS; ++j) + for (int j = 0; j < MAX_SPELL_REAGENTS; ++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 requires reagent item (Entry: %u) but item does not exist in item_template.",spellInfo->Id,spellInfo->Reagent[j]); else sLog.outErrorDb("Craft spell %u requires reagent item (Entry: %u) but item does not exist in item_template.",spellInfo->Id,spellInfo->Reagent[j]); @@ -3678,7 +3689,7 @@ void SpellMgr::LoadSpellAreas() uint32 count = 0; // 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"); + QueryResult* result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, aura_spell, racemask, gender, autocast FROM spell_area"); if (!result) { @@ -3695,7 +3706,7 @@ void SpellMgr::LoadSpellAreas() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); @@ -3875,7 +3886,8 @@ void SpellMgr::LoadSpellAreas() mSpellAreaForAuraMap.insert(SpellAreaForAuraMap::value_type(abs(spellArea.auraSpell),sa)); ++count; - } while (result->NextRow()); + } + while (result->NextRow()); delete result; @@ -3883,7 +3895,7 @@ void SpellMgr::LoadSpellAreas() sLog.outString(">> Loaded %u spell area requirements", count); } -SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player) +SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const* spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player) { // normal case int32 areaGroupId = spellInfo->AreaGroupId; @@ -3927,9 +3939,9 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell SpellAreaMapBounds saBounds = GetSpellAreaMapBounds(spellInfo->Id); if (saBounds.first != saBounds.second) { - for(SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) + 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; @@ -3941,7 +3953,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell // - with SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA flag // - with greater than 10 min CD if (spellInfo->HasAttribute(SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA) || - (GetSpellRecoveryTime(spellInfo) > 10 * MINUTE * IN_MILLISECONDS && !spellInfo->HasAttribute(SPELL_ATTR_EX4_USABLE_IN_ARENA))) + (GetSpellRecoveryTime(spellInfo) > 10 * MINUTE * IN_MILLISECONDS && !spellInfo->HasAttribute(SPELL_ATTR_EX4_USABLE_IN_ARENA))) if (player && player->InArena()) return SPELL_FAILED_NOT_IN_ARENA; @@ -3950,9 +3962,9 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell if (!player || !player->InBattleGround()) return SPELL_FAILED_ONLY_BATTLEGROUNDS; - switch(spellInfo->Id) + switch (spellInfo->Id) { - // a trinket in alterac valley allows to teleport to the boss + // a trinket in alterac valley allows to teleport to the boss case 22564: // recall case 22563: // recall { @@ -3960,7 +3972,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell return SPELL_FAILED_REQUIRES_AREA; BattleGround* bg = player->GetBattleGround(); return map_id == 30 && bg - && bg->GetStatus() != STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA; + && bg->GetStatus() != STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA; } case 23333: // Warsong Flag case 23335: // Silverwing Flag @@ -4033,8 +4045,8 @@ void SpellMgr::LoadSkillLineAbilityMap() for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i) { bar.step(); - SkillLineAbilityEntry const *SkillInfo = sSkillLineAbilityStore.LookupEntry(i); - if(!SkillInfo) + SkillLineAbilityEntry const* SkillInfo = sSkillLineAbilityStore.LookupEntry(i); + if (!SkillInfo) continue; mSkillLineAbilityMap.insert(SkillLineAbilityMap::value_type(SkillInfo->spellId,SkillInfo)); @@ -4055,7 +4067,7 @@ void SpellMgr::LoadSkillRaceClassInfoMap() for (uint32 i = 0; i < sSkillRaceClassInfoStore.GetNumRows(); ++i) { bar.step(); - SkillRaceClassInfoEntry const *skillRCInfo = sSkillRaceClassInfoStore.LookupEntry(i); + SkillRaceClassInfoEntry const* skillRCInfo = sSkillRaceClassInfoStore.LookupEntry(i); if (!skillRCInfo) continue; @@ -4078,7 +4090,7 @@ void SpellMgr::CheckUsedSpells(char const* table) uint32 countMasks = 0; // 0 1 2 3 4 5 6 7 8 9 10 11 - QueryResult *result = WorldDatabase.PQuery("SELECT spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMaskB,SpellIcon,SpellVisual,SpellCategory,EffectType,EffectAura,EffectIdx,Name,Code FROM %s",table); + QueryResult* result = WorldDatabase.PQuery("SELECT spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMaskB,SpellIcon,SpellVisual,SpellCategory,EffectType,EffectAura,EffectIdx,Name,Code FROM %s",table); if (!result) { @@ -4095,7 +4107,7 @@ void SpellMgr::CheckUsedSpells(char const* table) do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bar.step(); @@ -4161,12 +4173,12 @@ void SpellMgr::CheckUsedSpells(char const* table) // now checks of requirements - if(spell) + if (spell) { ++countSpells; SpellEntry const* spellEntry = sSpellStore.LookupEntry(spell); - if(!spellEntry) + if (!spellEntry) { sLog.outError("Spell %u '%s' not exist but used in %s.",spell,name.c_str(),code.c_str()); continue; @@ -4178,14 +4190,14 @@ void SpellMgr::CheckUsedSpells(char const* table) continue; } - if(familyMaskA != UI64LIT(0xFFFFFFFFFFFFFFFF) || familyMaskB != 0xFFFFFFFF) + if (familyMaskA != UI64LIT(0xFFFFFFFFFFFFFFFF) || familyMaskB != 0xFFFFFFFF) { - if(familyMaskA == UI64LIT(0x0000000000000000) && familyMaskB == 0x00000000) + if (familyMaskA == UI64LIT(0x0000000000000000) && familyMaskB == 0x00000000) { if (spellEntry->SpellFamilyFlags) { sLog.outError("Spell %u '%s' not fit to (" I64FMT "," I32FMT ") but used in %s.", - spell, name.c_str(), familyMaskA, familyMaskB, code.c_str()); + spell, name.c_str(), familyMaskA, familyMaskB, code.c_str()); continue; } @@ -4254,7 +4266,7 @@ void SpellMgr::CheckUsedSpells(char const* table) ++countMasks; bool found = false; - for(uint32 spellId = 1; spellId < sSpellStore.GetNumRows(); ++spellId) + for (uint32 spellId = 1; spellId < sSpellStore.GetNumRows(); ++spellId) { SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId); if (!spellEntry) @@ -4265,7 +4277,7 @@ void SpellMgr::CheckUsedSpells(char const* table) if (familyMaskA != UI64LIT(0xFFFFFFFFFFFFFFFF) || familyMaskB != 0xFFFFFFFF) { - if(familyMaskA == UI64LIT(0x0000000000000000) && familyMaskB == 0x00000000) + if (familyMaskA == UI64LIT(0x0000000000000000) && familyMaskB == 0x00000000) { if (spellEntry->SpellFamilyFlags) continue; @@ -4311,35 +4323,36 @@ void SpellMgr::CheckUsedSpells(char const* table) { if (effectIdx >= 0) sLog.outError("Spells '%s' not found for family %i (" I64FMT "," I32FMT ") icon(%i) visual(%i) category(%i) effect%d(%i) aura%d(%i) but used in %s", - name.c_str(),family,familyMaskA,familyMaskB,spellIcon,spellVisual,category,effectIdx+1,effectType,effectIdx+1,auraType,code.c_str()); + name.c_str(),family,familyMaskA,familyMaskB,spellIcon,spellVisual,category,effectIdx+1,effectType,effectIdx+1,auraType,code.c_str()); else sLog.outError("Spells '%s' not found for family %i (" I64FMT "," I32FMT ") icon(%i) visual(%i) category(%i) effect(%i) aura(%i) but used in %s", - name.c_str(),family,familyMaskA,familyMaskB,spellIcon,spellVisual,category,effectType,auraType,code.c_str()); + name.c_str(),family,familyMaskA,familyMaskB,spellIcon,spellVisual,category,effectType,auraType,code.c_str()); continue; } } - } while( result->NextRow() ); + } + while (result->NextRow()); delete result; sLog.outString(); - sLog.outString( ">> Checked %u spells and %u spell masks", countSpells, countMasks ); + sLog.outString(">> Checked %u spells and %u spell masks", countSpells, countMasks); } 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 - if (spellproto->Mechanic == MECHANIC_TURN) + if (spellproto->Mechanic == MECHANIC_TURN) return DIMINISHING_NONE; break; case SPELLFAMILY_MAGE: // Dragon's Breath - if (spellproto->SpellIconID == 1548) + if (spellproto->SpellIconID == 1548) return DIMINISHING_DISORIENT; break; case SPELLFAMILY_ROGUE: @@ -4358,7 +4371,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto case SPELLFAMILY_HUNTER: { // Freezing Trap & Freezing Arrow & Wyvern Sting - if (spellproto->SpellIconID == 180 || spellproto->SpellIconID == 1721) + if (spellproto->SpellIconID == 180 || spellproto->SpellIconID == 1721) return DIMINISHING_DISORIENT; break; } @@ -4443,11 +4456,11 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto) { - if(!IsDiminishingReturnsGroupDurationLimited(group)) + if (!IsDiminishingReturnsGroupDurationLimited(group)) return 0; // Explicit diminishing duration - switch(spellproto->SpellFamilyName) + switch (spellproto->SpellFamilyName) { case SPELLFAMILY_HUNTER: { @@ -4479,7 +4492,7 @@ int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry cons bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group) { - switch(group) + switch (group) { case DIMINISHING_CONTROL_STUN: case DIMINISHING_TRIGGER_STUN: @@ -4501,7 +4514,7 @@ bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group) DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group) { - switch(group) + switch (group) { case DIMINISHING_CYCLONE: case DIMINISHING_TRIGGER_STUN: diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index ad5d13317..2085238da 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -76,39 +76,39 @@ enum SpellSpecific SpellSpecific GetSpellSpecific(uint32 spellId); // Different spell properties -inline float GetSpellRadius(SpellRadiusEntry const *radius) { return (radius ? radius->Radius : 0); } +inline float GetSpellRadius(SpellRadiusEntry const* radius) { return (radius ? radius->Radius : 0); } uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell = NULL); -uint32 GetSpellCastTimeForBonus( SpellEntry const *spellProto, DamageEffectType damagetype ); -float CalculateDefaultCoefficient(SpellEntry const *spellProto, DamageEffectType const damagetype); -inline float GetSpellMinRange(SpellRangeEntry const *range, bool friendly = false) +uint32 GetSpellCastTimeForBonus(SpellEntry const* spellProto, DamageEffectType damagetype); +float CalculateDefaultCoefficient(SpellEntry const* spellProto, DamageEffectType const damagetype); +inline float GetSpellMinRange(SpellRangeEntry const* range, bool friendly = false) { - if(!range) + if (!range) return 0; return (friendly ? range->minRangeFriendly : range->minRange); } -inline float GetSpellMaxRange(SpellRangeEntry const *range, bool friendly = false) +inline float GetSpellMaxRange(SpellRangeEntry const* range, bool friendly = false) { - if(!range) + if (!range) return 0; return (friendly ? range->maxRangeFriendly : range->maxRange); } -inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo) { return spellInfo->RecoveryTime > spellInfo->CategoryRecoveryTime ? spellInfo->RecoveryTime : spellInfo->CategoryRecoveryTime; } -int32 GetSpellDuration(SpellEntry const *spellInfo); -int32 GetSpellMaxDuration(SpellEntry const *spellInfo); -int32 CalculateSpellDuration(SpellEntry const *spellInfo, Unit const* caster = NULL); +inline uint32 GetSpellRecoveryTime(SpellEntry const* spellInfo) { return spellInfo->RecoveryTime > spellInfo->CategoryRecoveryTime ? spellInfo->RecoveryTime : spellInfo->CategoryRecoveryTime; } +int32 GetSpellDuration(SpellEntry const* spellInfo); +int32 GetSpellMaxDuration(SpellEntry const* spellInfo); +int32 CalculateSpellDuration(SpellEntry const* spellInfo, Unit const* caster = NULL); uint16 GetSpellAuraMaxTicks(SpellEntry const* spellInfo); uint16 GetSpellAuraMaxTicks(uint32 spellId); -WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo); +WeaponAttackType GetWeaponAttackType(SpellEntry const* spellInfo); -inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect) +inline bool IsSpellHaveEffect(SpellEntry const* spellInfo, SpellEffects effect) { - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) - if(SpellEffects(spellInfo->Effect[i])==effect) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + if (SpellEffects(spellInfo->Effect[i])==effect) return true; return false; } -inline bool IsAuraApplyEffect(SpellEntry const *spellInfo, SpellEffectIndex effecIdx) +inline bool IsAuraApplyEffect(SpellEntry const* spellInfo, SpellEffectIndex effecIdx) { switch (spellInfo->Effect[effecIdx]) { @@ -124,9 +124,9 @@ inline bool IsAuraApplyEffect(SpellEntry const *spellInfo, SpellEffectIndex effe return false; } -inline bool IsSpellAppliesAura(SpellEntry const *spellInfo, uint32 effectMask = ((1 << EFFECT_INDEX_0) | (1 << EFFECT_INDEX_1) | (1 << EFFECT_INDEX_2))) +inline bool IsSpellAppliesAura(SpellEntry const* spellInfo, uint32 effectMask = ((1 << EFFECT_INDEX_0) | (1 << EFFECT_INDEX_1) | (1 << EFFECT_INDEX_2))) { - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) if (effectMask & (1 << i)) if (IsAuraApplyEffect(spellInfo, SpellEffectIndex(i))) return true; @@ -134,7 +134,7 @@ inline bool IsSpellAppliesAura(SpellEntry const *spellInfo, uint32 effectMask = return false; } -inline bool IsEffectHandledOnDelayedSpellLaunch(SpellEntry const *spellInfo, SpellEffectIndex effecIdx) +inline bool IsEffectHandledOnDelayedSpellLaunch(SpellEntry const* spellInfo, SpellEffectIndex effecIdx) { switch (spellInfo->Effect[effecIdx]) { @@ -149,7 +149,7 @@ inline bool IsEffectHandledOnDelayedSpellLaunch(SpellEntry const *spellInfo, Spe } } -inline bool IsPeriodicRegenerateEffect(SpellEntry const *spellInfo, SpellEffectIndex effecIdx) +inline bool IsPeriodicRegenerateEffect(SpellEntry const* spellInfo, SpellEffectIndex effecIdx) { switch (AuraType(spellInfo->EffectApplyAuraName[effecIdx])) { @@ -162,54 +162,54 @@ inline bool IsPeriodicRegenerateEffect(SpellEntry const *spellInfo, SpellEffectI } } -bool IsCastEndProcModifierAura(SpellEntry const *spellInfo, SpellEffectIndex effecIdx, SpellEntry const *procSpell); +bool IsCastEndProcModifierAura(SpellEntry const* spellInfo, SpellEffectIndex effecIdx, SpellEntry const* procSpell); -inline bool IsSpellHaveAura(SpellEntry const *spellInfo, AuraType aura) +inline bool IsSpellHaveAura(SpellEntry const* spellInfo, AuraType aura) { - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) - if(AuraType(spellInfo->EffectApplyAuraName[i])==aura) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + if (AuraType(spellInfo->EffectApplyAuraName[i])==aura) return true; return false; } -inline bool IsSpellLastAuraEffect(SpellEntry const *spellInfo, SpellEffectIndex effecIdx) +inline bool IsSpellLastAuraEffect(SpellEntry const* spellInfo, SpellEffectIndex effecIdx) { - for(int i = effecIdx+1; i < MAX_EFFECT_INDEX; ++i) - if(spellInfo->EffectApplyAuraName[i]) + for (int i = effecIdx+1; i < MAX_EFFECT_INDEX; ++i) + if (spellInfo->EffectApplyAuraName[i]) return false; return true; } bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 spellId_2); -inline bool IsSealSpell(SpellEntry const *spellInfo) +inline bool IsSealSpell(SpellEntry const* spellInfo) { //Collection of all the seal family flags. No other paladin spell has any of those. return spellInfo->IsFitToFamily(SPELLFAMILY_PALADIN, UI64LIT(0x26000C000A000000)) && - // avoid counting target triggered effect as seal for avoid remove it or seal by it. - spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0] == TARGET_SELF; + // avoid counting target triggered effect as seal for avoid remove it or seal by it. + spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0] == TARGET_SELF; } -inline bool IsElementalShield(SpellEntry const *spellInfo) +inline bool IsElementalShield(SpellEntry const* spellInfo) { // family flags 10 (Lightning), 42 (Earth), 37 (Water), proc shield from T2 8 pieces bonus return (spellInfo->SpellFamilyFlags & UI64LIT(0x42000000400)) || spellInfo->Id == 23552; } -inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo) +inline bool IsExplicitDiscoverySpell(SpellEntry const* spellInfo) { return (((spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_RANDOM_ITEM - || spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_ITEM_2) - && spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_SCRIPT_EFFECT) - || spellInfo->Id == 64323); // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data) + || spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_ITEM_2) + && spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_SCRIPT_EFFECT) + || spellInfo->Id == 64323); // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data) } -inline bool IsLootCraftingSpell(SpellEntry const *spellInfo) +inline bool IsLootCraftingSpell(SpellEntry const* spellInfo) { return (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_RANDOM_ITEM || - // different random cards from Inscription (121==Virtuoso Inking Set category) r without explicit item - (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_ITEM_2 && - (spellInfo->TotemCategory[0] != 0 || spellInfo->EffectItemType[0]==0))); + // different random cards from Inscription (121==Virtuoso Inking Set category) r without explicit item + (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_ITEM_2 && + (spellInfo->TotemCategory[0] != 0 || spellInfo->EffectItemType[0]==0))); } int32 CompareAuraRanks(uint32 spellId_1, uint32 spellId_2); @@ -224,7 +224,7 @@ bool IsPassiveSpell(SpellEntry const* spellProto); inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto) { - if(!IsPassiveSpell(spellProto)) + if (!IsPassiveSpell(spellProto)) return false; return !IsSpellHaveEffect(spellProto,SPELL_EFFECT_APPLY_AURA); @@ -233,44 +233,44 @@ inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto) inline bool IsSpellRemoveAllMovementAndControlLossEffects(SpellEntry const* spellProto) { return spellProto->EffectApplyAuraName[EFFECT_INDEX_0] == SPELL_AURA_MECHANIC_IMMUNITY && - spellProto->EffectMiscValue[EFFECT_INDEX_0] == 1 && - spellProto->EffectApplyAuraName[EFFECT_INDEX_1] == 0 && - spellProto->EffectApplyAuraName[EFFECT_INDEX_2] == 0 && - spellProto->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)/* && -- all above selected spells have SPELL_ATTR_EX5_* mask + spellProto->EffectMiscValue[EFFECT_INDEX_0] == 1 && + spellProto->EffectApplyAuraName[EFFECT_INDEX_1] == 0 && + spellProto->EffectApplyAuraName[EFFECT_INDEX_2] == 0 && + spellProto->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)/* && -- all above selected spells have SPELL_ATTR_EX5_* mask ((spellProto->AttributesEx5 & (SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED|SPELL_ATTR_EX5_USABLE_WHILE_FEARED|SPELL_ATTR_EX5_USABLE_WHILE_STUNNED)) == (SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED|SPELL_ATTR_EX5_USABLE_WHILE_FEARED|SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))*/; } -inline bool IsDeathOnlySpell(SpellEntry const *spellInfo) +inline bool IsDeathOnlySpell(SpellEntry const* spellInfo) { return spellInfo->HasAttribute(SPELL_ATTR_EX3_CAST_ON_DEAD) || spellInfo->Id == 2584; } -inline bool IsDeathPersistentSpell(SpellEntry const *spellInfo) +inline bool IsDeathPersistentSpell(SpellEntry const* spellInfo) { return spellInfo->HasAttribute(SPELL_ATTR_EX3_DEATH_PERSISTENT); } -inline bool IsNonCombatSpell(SpellEntry const *spellInfo) +inline bool IsNonCombatSpell(SpellEntry const* spellInfo) { return spellInfo->HasAttribute(SPELL_ATTR_CANT_USED_IN_COMBAT); } bool IsPositiveSpell(uint32 spellId); -bool IsPositiveSpell(SpellEntry const *spellproto); -bool IsPositiveEffect(SpellEntry const *spellInfo, SpellEffectIndex effIndex); +bool IsPositiveSpell(SpellEntry const* spellproto); +bool IsPositiveEffect(SpellEntry const* spellInfo, SpellEffectIndex effIndex); bool IsPositiveTarget(uint32 targetA, uint32 targetB); bool IsExplicitPositiveTarget(uint32 targetA); bool IsExplicitNegativeTarget(uint32 targetA); -bool IsSingleTargetSpell(SpellEntry const *spellInfo); -bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellInfo2); +bool IsSingleTargetSpell(SpellEntry const* spellInfo); +bool IsSingleTargetSpells(SpellEntry const* spellInfo1, SpellEntry const* spellInfo2); inline bool IsCasterSourceTarget(uint32 target) { - switch (target ) + switch (target) { case TARGET_SELF: case TARGET_PET: @@ -300,25 +300,25 @@ inline bool IsCasterSourceTarget(uint32 target) inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo) { - for(int i = 0; i < MAX_EFFECT_INDEX; ++i) + for (int i = 0; i < MAX_EFFECT_INDEX; ++i) { uint32 targetA = spellInfo->EffectImplicitTargetA[i]; - if(targetA && !IsCasterSourceTarget(targetA)) + if (targetA && !IsCasterSourceTarget(targetA)) return false; uint32 targetB = spellInfo->EffectImplicitTargetB[i]; - if(targetB && !IsCasterSourceTarget(targetB)) + if (targetB && !IsCasterSourceTarget(targetB)) return false; - if(!targetA && !targetB) + if (!targetA && !targetB) return false; } return true; } -inline bool IsPointEffectTarget( Targets target ) +inline bool IsPointEffectTarget(Targets target) { - switch (target ) + switch (target) { case TARGET_INNKEEPER_COORDINATES: case TARGET_TABLE_X_Y_Z_COORDINATES: @@ -342,9 +342,9 @@ inline bool IsPointEffectTarget( Targets target ) return false; } -inline bool IsAreaEffectPossitiveTarget( Targets target ) +inline bool IsAreaEffectPossitiveTarget(Targets target) { - switch (target ) + switch (target) { case TARGET_ALL_PARTY_AROUND_CASTER: case TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER: @@ -361,9 +361,9 @@ inline bool IsAreaEffectPossitiveTarget( Targets target ) return false; } -inline bool IsAreaEffectTarget( Targets target ) +inline bool IsAreaEffectTarget(Targets target) { - switch (target ) + switch (target) { case TARGET_AREAEFFECT_INSTANT: case TARGET_AREAEFFECT_CUSTOM: @@ -388,30 +388,30 @@ inline bool IsAreaEffectTarget( Targets target ) return false; } -inline bool IsAreaOfEffectSpell(SpellEntry const *spellInfo) +inline bool IsAreaOfEffectSpell(SpellEntry const* spellInfo) { - if(IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[EFFECT_INDEX_0]))) + if (IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_0])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[EFFECT_INDEX_0]))) return true; - if(IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_1])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[EFFECT_INDEX_1]))) + if (IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_1])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[EFFECT_INDEX_1]))) return true; - if(IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_2])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[EFFECT_INDEX_2]))) + if (IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[EFFECT_INDEX_2])) || IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetB[EFFECT_INDEX_2]))) return true; return false; } inline bool IsAreaAuraEffect(uint32 effect) { - if( effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY || - effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID || - effect == SPELL_EFFECT_APPLY_AREA_AURA_FRIEND || - effect == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY || - effect == SPELL_EFFECT_APPLY_AREA_AURA_PET || - effect == SPELL_EFFECT_APPLY_AREA_AURA_OWNER) + if (effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY || + effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID || + effect == SPELL_EFFECT_APPLY_AREA_AURA_FRIEND || + effect == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY || + effect == SPELL_EFFECT_APPLY_AREA_AURA_PET || + effect == SPELL_EFFECT_APPLY_AREA_AURA_OWNER) return true; return false; } -inline bool HasAreaAuraEffect(SpellEntry const *spellInfo) +inline bool HasAreaAuraEffect(SpellEntry const* spellInfo) { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) if (IsAreaAuraEffect(spellInfo->Effect[i])) @@ -419,11 +419,11 @@ inline bool HasAreaAuraEffect(SpellEntry const *spellInfo) return false; } -inline bool HasAuraWithTriggerEffect(SpellEntry const *spellInfo) +inline bool HasAuraWithTriggerEffect(SpellEntry const* spellInfo) { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) { - switch(spellInfo->Effect[i]) + switch (spellInfo->Effect[i]) { case SPELL_AURA_PERIODIC_TRIGGER_SPELL: case SPELL_AURA_PROC_TRIGGER_SPELL: @@ -435,7 +435,7 @@ inline bool HasAuraWithTriggerEffect(SpellEntry const *spellInfo) return false; } -inline bool IsDispelSpell(SpellEntry const *spellInfo) +inline bool IsDispelSpell(SpellEntry const* spellInfo) { return IsSpellHaveEffect(spellInfo, SPELL_EFFECT_DISPEL); } @@ -455,7 +455,7 @@ inline bool IsSpellRequiresRangedAP(SpellEntry const* spellInfo) return (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->DmgClass != SPELL_DAMAGE_CLASS_MELEE); } -SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 form); +SpellCastResult GetErrorAtShapeshiftedCast(SpellEntry const* spellInfo, uint32 form); inline bool IsChanneledSpell(SpellEntry const* spellInfo) { @@ -709,7 +709,7 @@ class PetAura } PetAura(uint32 petEntry, uint32 aura, bool _removeOnChangePet, int _damage) : - removeOnChangePet(_removeOnChangePet), damage(_damage) + removeOnChangePet(_removeOnChangePet), damage(_damage) { auras[petEntry] = aura; } @@ -717,12 +717,12 @@ class PetAura uint32 GetAura(uint32 petEntry) const { std::map::const_iterator itr = auras.find(petEntry); - if(itr != auras.end()) + if (itr != auras.end()) return itr->second; else { std::map::const_iterator itr2 = auras.find(0); - if(itr2 != auras.end()) + if (itr2 != auras.end()) return itr2->second; else return 0; @@ -842,16 +842,16 @@ inline bool IsProfessionOrRidingSkill(uint32 skill) class SpellMgr { - friend struct DoSpellBonuses; - friend struct DoSpellProcEvent; - friend struct DoSpellProcItemEnchant; + friend struct DoSpellBonuses; + friend struct DoSpellProcEvent; + friend struct DoSpellProcItemEnchant; - // Constructors + // Constructors public: SpellMgr(); ~SpellMgr(); - // Accessors (const or static functions) + // Accessors (const or static functions) public: SpellElixirMap const& GetSpellElixirMap() const { return mSpellElixirs; } @@ -859,7 +859,7 @@ class SpellMgr uint32 GetSpellElixirMask(uint32 spellid) const { SpellElixirMap::const_iterator itr = mSpellElixirs.find(spellid); - if(itr==mSpellElixirs.end()) + if (itr==mSpellElixirs.end()) return 0x0; return itr->second; @@ -868,13 +868,13 @@ class SpellMgr SpellSpecific GetSpellElixirSpecific(uint32 spellid) const { uint32 mask = GetSpellElixirMask(spellid); - if((mask & ELIXIR_FLASK_MASK)==ELIXIR_FLASK_MASK) + if ((mask & ELIXIR_FLASK_MASK)==ELIXIR_FLASK_MASK) return SPELL_FLASK_ELIXIR; - else if(mask & ELIXIR_BATTLE_MASK) + else if (mask & ELIXIR_BATTLE_MASK) return SPELL_BATTLE_ELIXIR; - else if(mask & ELIXIR_GUARDIAN_MASK) + else if (mask & ELIXIR_GUARDIAN_MASK) return SPELL_GUARDIAN_ELIXIR; - else if(mask & ELIXIR_WELL_FED) + else if (mask & ELIXIR_WELL_FED) return SPELL_WELL_FED; else return SPELL_NORMAL; @@ -889,12 +889,12 @@ class SpellMgr return NULL; } - float GetSpellThreatMultiplier(SpellEntry const *spellInfo) const + float GetSpellThreatMultiplier(SpellEntry const* spellInfo) const { if (!spellInfo) return 1.0f; - if (SpellThreatEntry const *entry = GetSpellThreatEntry(spellInfo->Id)) + if (SpellThreatEntry const* entry = GetSpellThreatEntry(spellInfo->Id)) return entry->multiplier; return 1.0f; @@ -904,7 +904,7 @@ class SpellMgr SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const { SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId); - if( itr != mSpellProcEventMap.end( ) ) + if (itr != mSpellProcEventMap.end()) return &itr->second; return NULL; } @@ -913,20 +913,20 @@ class SpellMgr float GetItemEnchantProcChance(uint32 spellid) const { SpellProcItemEnchantMap::const_iterator itr = mSpellProcItemEnchantMap.find(spellid); - if(itr==mSpellProcItemEnchantMap.end()) + if (itr==mSpellProcItemEnchantMap.end()) return 0.0f; return itr->second; } - static bool IsSpellProcEventCanTriggeredBy( SpellProcEventEntry const * spellProcEvent, uint32 EventProcFlag, SpellEntry const * procSpell, uint32 procFlags, uint32 procExtra); + static bool IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellEntry const* procSpell, uint32 procFlags, uint32 procExtra); // Spell bonus data SpellBonusEntry const* GetSpellBonusData(uint32 spellId) const { // Lookup data SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId); - if( itr != mSpellBonusMap.end( ) ) + if (itr != mSpellBonusMap.end()) return &itr->second; return NULL; @@ -935,8 +935,8 @@ class SpellMgr // Spell target coordinates SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id) const { - SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find( spell_id ); - if( itr != mSpellTargetPositions.end( ) ) + SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(spell_id); + if (itr != mSpellTargetPositions.end()) return &itr->second; return NULL; } @@ -945,7 +945,7 @@ class SpellMgr SpellChainNode const* GetSpellChainNode(uint32 spell_id) const { SpellChainMap::const_iterator itr = mSpellChains.find(spell_id); - if(itr == mSpellChains.end()) + if (itr == mSpellChains.end()) return NULL; return &itr->second; @@ -953,7 +953,7 @@ class SpellMgr uint32 GetFirstSpellInChain(uint32 spell_id) const { - if(SpellChainNode const* node = GetSpellChainNode(spell_id)) + if (SpellChainNode const* node = GetSpellChainNode(spell_id)) return node->first; return spell_id; @@ -961,7 +961,7 @@ class SpellMgr uint32 GetPrevSpellInChain(uint32 spell_id) const { - if(SpellChainNode const* node = GetSpellChainNode(spell_id)) + if (SpellChainNode const* node = GetSpellChainNode(spell_id)) return node->prev; return 0; @@ -973,7 +973,7 @@ class SpellMgr void doForHighRanks(uint32 spellid, Worker& worker) { SpellChainMapNext const& nextMap = GetSpellChainNext(); - for(SpellChainMapNext::const_iterator itr = nextMap.lower_bound(spellid); itr != nextMap.upper_bound(spellid); ++itr) + for (SpellChainMapNext::const_iterator itr = nextMap.lower_bound(spellid); itr != nextMap.upper_bound(spellid); ++itr) { worker(itr->second); doForHighRanks(itr->second,worker); @@ -984,7 +984,7 @@ class SpellMgr // Use IsHighRankOfSpell instead uint8 GetSpellRank(uint32 spell_id) const { - if(SpellChainNode const* node = GetSpellChainNode(spell_id)) + if (SpellChainNode const* node = GetSpellChainNode(spell_id)) return node->rank; return 0; @@ -997,21 +997,21 @@ class SpellMgr uint32 rank2 = GetSpellRank(spell2); // not ordered correctly by rank value - if(itr == mSpellChains.end() || !rank2 || itr->second.rank <= rank2) + if (itr == mSpellChains.end() || !rank2 || itr->second.rank <= rank2) return false; // check present in same rank chain - for(; itr != mSpellChains.end(); itr = mSpellChains.find(itr->second.prev)) - if(itr->second.prev==spell2) + for (; itr != mSpellChains.end(); itr = mSpellChains.find(itr->second.prev)) + if (itr->second.prev==spell2) return true; return false; } - bool IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const; + bool IsRankSpellDueToSpell(SpellEntry const* spellInfo_1,uint32 spellId_2) const; bool IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) const; - bool canStackSpellRanksInSpellBook(SpellEntry const *spellInfo) const; - bool IsRankedSpellNonStackableInSpellBook(SpellEntry const *spellInfo) const + bool canStackSpellRanksInSpellBook(SpellEntry const* spellInfo) const; + bool IsRankedSpellNonStackableInSpellBook(SpellEntry const* spellInfo) const { return !canStackSpellRanksInSpellBook(spellInfo) && GetSpellRank(spellInfo->Id) != 0; } @@ -1022,7 +1022,7 @@ class SpellMgr SpellLearnSkillNode const* GetSpellLearnSkill(uint32 spell_id) const { SpellLearnSkillMap::const_iterator itr = mSpellLearnSkills.find(spell_id); - if(itr != mSpellLearnSkills.end()) + if (itr != mSpellLearnSkills.end()) return &itr->second; else return NULL; @@ -1041,7 +1041,7 @@ class SpellMgr bool IsSpellLearnToSpell(uint32 spell_id1,uint32 spell_id2) const { SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1); - for(SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i) + for (SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i) if (i->second.spell==spell_id2) return true; return false; @@ -1063,7 +1063,7 @@ class SpellMgr } // Spell correctness for client using - static bool IsSpellValid(SpellEntry const * spellInfo, Player* pl = NULL, bool msg = true); + static bool IsSpellValid(SpellEntry const* spellInfo, Player* pl = NULL, bool msg = true); SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const { @@ -1078,7 +1078,7 @@ class SpellMgr PetAura const* GetPetAura(uint32 spell_id, SpellEffectIndex eff) { SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id<<8) + eff); - if(itr != mSpellPetAuraMap.end()) + if (itr != mSpellPetAuraMap.end()) return &itr->second; else return NULL; @@ -1087,7 +1087,7 @@ class SpellMgr PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const { PetLevelupSpellMap::const_iterator itr = mPetLevelupSpellMap.find(petFamily); - if(itr != mPetLevelupSpellMap.end()) + if (itr != mPetLevelupSpellMap.end()) return &itr->second; else return NULL; @@ -1097,12 +1097,12 @@ class SpellMgr PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const { PetDefaultSpellsMap::const_iterator itr = mPetDefaultSpellsMap.find(id); - if(itr != mPetDefaultSpellsMap.end()) + if (itr != mPetDefaultSpellsMap.end()) return &itr->second; return NULL; } - SpellCastResult GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = NULL); + SpellCastResult GetSpellAllowedInLocationError(SpellEntry const* spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = NULL); SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const { @@ -1132,7 +1132,7 @@ class SpellMgr return mSpellAreaForAreaMap.equal_range(area_id); } - // Modifiers + // Modifiers public: static SpellMgr& Instance(); diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index 2aacac482..7616fe8bd 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -31,7 +31,7 @@ bool Player::UpdateStats(Stats stat) { - if(stat > STAT_SPIRIT) + if (stat > STAT_SPIRIT) return false; // value = ((base_value * base_pct) + total_value) * total_pct @@ -39,14 +39,14 @@ bool Player::UpdateStats(Stats stat) SetStat(stat, int32(value)); - if(stat == STAT_STAMINA || stat == STAT_INTELLECT) + if (stat == STAT_STAMINA || stat == STAT_INTELLECT) { - Pet *pet = GetPet(); - if(pet) + Pet* pet = GetPet(); + if (pet) pet->UpdateStats(stat); } - switch(stat) + switch (stat) { case STAT_STRENGTH: UpdateShieldBlockValue(); @@ -79,7 +79,7 @@ bool Player::UpdateStats(Stats stat) // Update ratings in exist SPELL_AURA_MOD_RATING_FROM_STAT and only depends from stat uint32 mask = 0; AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT); - for(AuraList::const_iterator i = modRatingFromStat.begin();i != modRatingFromStat.end(); ++i) + for (AuraList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i) if (Stats((*i)->GetMiscBValue()) == stat) mask |= (*i)->GetMiscValue(); if (mask) @@ -97,7 +97,7 @@ void Player::ApplySpellPowerBonus(int32 amount, bool apply) // For speed just update for client ApplyModUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, amount, apply); - for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) + for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, amount, apply);; } @@ -108,7 +108,7 @@ void Player::UpdateSpellDamageAndHealingBonus() // Get healing bonus for all schools SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL)); // Get damage bonus for all schools - for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) + for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i))); } @@ -125,7 +125,7 @@ bool Player::UpdateAllStats() UpdateAttackPowerAndDamage(true); UpdateMaxHealth(); - for(int i = POWER_MANA; i < MAX_POWERS; ++i) + for (int i = POWER_MANA; i < MAX_POWERS; ++i) UpdateMaxPower(Powers(i)); UpdateAllRatings(); @@ -146,13 +146,13 @@ bool Player::UpdateAllStats() void Player::UpdateResistances(uint32 school) { - if(school > SPELL_SCHOOL_NORMAL) + if (school > SPELL_SCHOOL_NORMAL) { float value = GetTotalAuraModValue(UnitMods(UNIT_MOD_RESISTANCE_START + school)); SetResistance(SpellSchools(school), int32(value)); - Pet *pet = GetPet(); - if(pet) + Pet* pet = GetPet(); + if (pet) pet->UpdateResistances(school); } else @@ -171,10 +171,10 @@ void Player::UpdateArmor() //add dynamic flat mods AuraList const& mResbyIntellect = GetAurasByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT); - for(AuraList::const_iterator i = mResbyIntellect.begin();i != mResbyIntellect.end(); ++i) + for (AuraList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i) { Modifier* mod = (*i)->GetModifier(); - if(mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) + if (mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) value += int32(GetStat(Stats((*i)->GetMiscBValue())) * mod->m_amount / 100.0f); } @@ -182,8 +182,8 @@ void Player::UpdateArmor() SetArmor(int32(value)); - Pet *pet = GetPet(); - if(pet) + Pet* pet = GetPet(); + if (pet) pet->UpdateArmor(); UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR @@ -244,7 +244,7 @@ void Player::ApplyFeralAPBonus(int32 amount, bool apply) UpdateAttackPowerAndDamage(); } -void Player::UpdateAttackPowerAndDamage(bool ranged ) +void Player::UpdateAttackPowerAndDamage(bool ranged) { float val2 = 0.0f; float level = float(getLevel()); @@ -255,19 +255,19 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) uint16 index_mod = UNIT_FIELD_ATTACK_POWER_MODS; uint16 index_mult = UNIT_FIELD_ATTACK_POWER_MULTIPLIER; - if(ranged) + if (ranged) { index = UNIT_FIELD_RANGED_ATTACK_POWER; index_mod = UNIT_FIELD_RANGED_ATTACK_POWER_MODS; index_mult = UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER; - switch(getClass()) + switch (getClass()) { case CLASS_HUNTER: val2 = level * 2.0f + GetStat(STAT_AGILITY) - 10.0f; break; case CLASS_ROGUE: val2 = level + GetStat(STAT_AGILITY) - 10.0f; break; case CLASS_WARRIOR:val2 = level + GetStat(STAT_AGILITY) - 10.0f; break; case CLASS_DRUID: - switch(GetShapeshiftForm()) + switch (GetShapeshiftForm()) { case FORM_CAT: case FORM_BEAR: @@ -282,7 +282,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) } else { - switch(getClass()) + switch (getClass()) { case CLASS_WARRIOR: val2 = level*3.0f + GetStat(STAT_STRENGTH)*2.0f - 20.0f; break; case CLASS_PALADIN: val2 = level*3.0f + GetStat(STAT_STRENGTH)*2.0f - 20.0f; break; @@ -296,7 +296,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) //Check if Predatory Strikes is skilled float mLevelBonus = 0.0f; float mBonusWeaponAtt = 0.0f; - switch(form) + switch (form) { case FORM_CAT: case FORM_BEAR: @@ -304,9 +304,9 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) case FORM_MOONKIN: { Unit::AuraList const& mDummy = GetAurasByType(SPELL_AURA_DUMMY); - for(Unit::AuraList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr) + for (Unit::AuraList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr) { - if((*itr)->GetSpellProto()->SpellIconID != 1563) + if ((*itr)->GetSpellProto()->SpellIconID != 1563) continue; // Predatory Strikes (effect 0) @@ -324,7 +324,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) default: break; } - switch(form) + switch (form) { case FORM_CAT: val2 = GetStat(STAT_STRENGTH)*2.0f + GetStat(STAT_AGILITY) - 20.0f + mLevelBonus + m_baseFeralAP + mBonusWeaponAtt; break; @@ -350,23 +350,23 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE); //add dynamic flat mods - if( ranged ) + if (ranged) { if ((getClassMask() & CLASSMASK_WAND_USERS)==0) { AuraList const& mRAPbyStat = GetAurasByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT); - for(AuraList::const_iterator i = mRAPbyStat.begin();i != mRAPbyStat.end(); ++i) + for (AuraList::const_iterator i = mRAPbyStat.begin(); i != mRAPbyStat.end(); ++i) attPowerMod += int32(GetStat(Stats((*i)->GetModifier()->m_miscvalue)) * (*i)->GetModifier()->m_amount / 100.0f); } } else { AuraList const& mAPbyStat = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT); - for(AuraList::const_iterator i = mAPbyStat.begin();i != mAPbyStat.end(); ++i) + for (AuraList::const_iterator i = mAPbyStat.begin(); i != mAPbyStat.end(); ++i) attPowerMod += int32(GetStat(Stats((*i)->GetModifier()->m_miscvalue)) * (*i)->GetModifier()->m_amount / 100.0f); AuraList const& mAPbyArmor = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR); - for(AuraList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter) + for (AuraList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter) // always: ((*i)->GetModifier()->m_miscvalue == 1 == SPELL_SCHOOL_MASK_NORMAL) attPowerMod += int32(GetArmor() / (*iter)->GetModifier()->m_amount); } @@ -378,18 +378,18 @@ void Player::UpdateAttackPowerAndDamage(bool ranged ) SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field //automatically update weapon damage after attack power modification - if(ranged) + if (ranged) { UpdateDamagePhysical(RANGED_ATTACK); - Pet *pet = GetPet(); //update pet's AP - if(pet) + Pet* pet = GetPet(); //update pet's AP + if (pet) pet->UpdateAttackPowerAndDamage(); } else { UpdateDamagePhysical(BASE_ATTACK); - if(CanDualWield() && haveOffhandWeapon()) //allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon + if (CanDualWield() && haveOffhandWeapon()) //allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon UpdateDamagePhysical(OFF_ATTACK); } } @@ -404,7 +404,7 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, fl UnitMods unitMod; UnitMods attPower; - switch(attType) + switch (attType) { case BASE_ATTACK: default: @@ -462,7 +462,7 @@ void Player::UpdateDamagePhysical(WeaponAttackType attType) CalculateMinMaxDamage(attType,false,mindamage,maxdamage); - switch(attType) + switch (attType) { case BASE_ATTACK: default: @@ -491,7 +491,7 @@ void Player::UpdateBlockPercentage() { // No block float value = 0.0f; - if(CanBlock()) + if (CanBlock()) { // Base value value = 5.0f; @@ -512,7 +512,7 @@ void Player::UpdateCritPercentage(WeaponAttackType attType) uint16 index; CombatRating cr; - switch(attType) + switch (attType) { case OFF_ATTACK: modGroup = OFFHAND_CRIT_PERCENTAGE; @@ -571,17 +571,17 @@ void Player::UpdateParryPercentage() { const float parry_cap[MAX_CLASSES] = { - 47.003525f, // Warrior - 47.003525f, // Paladin + 47.003525f, // Warrior + 47.003525f, // Paladin 145.560408f, // Hunter 145.560408f, // Rogue - 0.0f, // Priest - 47.003525f, // DK + 0.0f, // Priest + 47.003525f, // DK 145.560408f, // Shaman - 0.0f, // Mage - 0.0f, // Warlock - 0.0f, // ?? - 0.0f // Druid + 0.0f, // Mage + 0.0f, // Warlock + 0.0f, // ?? + 0.0f // Druid }; // No parry @@ -600,7 +600,7 @@ void Player::UpdateParryPercentage() nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT); // apply diminishing formula to diminishing parry chance value = nondiminishing + diminishing * parry_cap[pclass] / - (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]); + (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]); value = value < 0.0f ? 0.0f : value; } SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value); @@ -610,16 +610,16 @@ void Player::UpdateDodgePercentage() { const float dodge_cap[MAX_CLASSES] = { - 88.129021f, // Warrior - 88.129021f, // Paladin + 88.129021f, // Warrior + 88.129021f, // Paladin 145.560408f, // Hunter 145.560408f, // Rogue 150.375940f, // Priest - 88.129021f, // DK + 88.129021f, // DK 145.560408f, // Shaman 150.375940f, // Mage 150.375940f, // Warlock - 0.0f, // ?? + 0.0f, // ?? 116.890707f // Druid }; @@ -644,7 +644,7 @@ void Player::UpdateDodgePercentage() void Player::UpdateSpellCritChance(uint32 school) { // For normal school set zero crit chance - if(school == SPELL_SCHOOL_NORMAL) + if (school == SPELL_SCHOOL_NORMAL) { SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1, 0.0f); return; @@ -692,28 +692,28 @@ void Player::UpdateAllSpellCritChances() void Player::UpdateExpertise(WeaponAttackType attack) { - if(attack==RANGED_ATTACK) + if (attack==RANGED_ATTACK) return; int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE)); - Item *weapon = GetWeaponForAttack(attack); + Item* weapon = GetWeaponForAttack(attack); AuraList const& expAuras = GetAurasByType(SPELL_AURA_MOD_EXPERTISE); - for(AuraList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr) + for (AuraList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr) { // item neutral spell - if((*itr)->GetSpellProto()->EquippedItemClass == -1) + if ((*itr)->GetSpellProto()->EquippedItemClass == -1) expertise += (*itr)->GetModifier()->m_amount; // item dependent spell - else if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) + else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) expertise += (*itr)->GetModifier()->m_amount; } - if(expertise < 0) + if (expertise < 0) expertise = 0; - switch(attack) + switch (attack) { case BASE_ATTACK: SetUInt32Value(PLAYER_EXPERTISE, expertise); break; case OFF_ATTACK: SetUInt32Value(PLAYER_OFFHAND_EXPERTISE, expertise); break; @@ -726,20 +726,20 @@ void Player::UpdateArmorPenetration() m_armorPenetrationPct = GetRatingBonusValue(CR_ARMOR_PENETRATION); AuraList const& armorAuras = GetAurasByType(SPELL_AURA_MOD_TARGET_ARMOR_PCT); - for(AuraList::const_iterator itr = armorAuras.begin(); itr != armorAuras.end(); ++itr) + for (AuraList::const_iterator itr = armorAuras.begin(); itr != armorAuras.end(); ++itr) { // affects all weapons - if((*itr)->GetSpellProto()->EquippedItemClass == -1) + if ((*itr)->GetSpellProto()->EquippedItemClass == -1) { m_armorPenetrationPct += (*itr)->GetModifier()->m_amount; continue; } // dependent on weapon class - for(uint8 i = 0; i < MAX_ATTACK; ++i) + for (uint8 i = 0; i < MAX_ATTACK; ++i) { - Item *weapon = GetWeaponForAttack(WeaponAttackType(i)); - if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) + Item* weapon = GetWeaponForAttack(WeaponAttackType(i)); + if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto())) { m_armorPenetrationPct += (*itr)->GetModifier()->m_amount; break; @@ -767,7 +767,7 @@ void Player::UpdateManaRegen() // Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura AuraList const& regenAura = GetAurasByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT); - for(AuraList::const_iterator i = regenAura.begin();i != regenAura.end(); ++i) + for (AuraList::const_iterator i = regenAura.begin(); i != regenAura.end(); ++i) { Modifier* mod = (*i)->GetModifier(); power_regen_mp5 += GetStat(Stats(mod->m_miscvalue)) * mod->m_amount / 500.0f; @@ -822,10 +822,10 @@ bool Creature::UpdateAllStats() UpdateMaxHealth(); UpdateAttackPowerAndDamage(); - for(int i = POWER_MANA; i < MAX_POWERS; ++i) + for (int i = POWER_MANA; i < MAX_POWERS; ++i) UpdateMaxPower(Powers(i)); - for(int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) + for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) UpdateResistances(i); return true; @@ -833,7 +833,7 @@ bool Creature::UpdateAllStats() void Creature::UpdateResistances(uint32 school) { - if(school > SPELL_SCHOOL_NORMAL) + if (school > SPELL_SCHOOL_NORMAL) { float value = GetTotalAuraModValue(UnitMods(UNIT_MOD_RESISTANCE_START + school)); SetResistance(SpellSchools(school), int32(value)); @@ -926,28 +926,28 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType) bool Pet::UpdateStats(Stats stat) { - if(stat > STAT_SPIRIT) + if (stat > STAT_SPIRIT) return false; // value = ((base_value * base_pct) + total_value) * total_pct float value = GetTotalStatValue(stat); - Unit *owner = GetOwner(); - if ( stat == STAT_STAMINA ) + Unit* owner = GetOwner(); + if (stat == STAT_STAMINA) { - if(owner) + if (owner) value += float(owner->GetStat(stat)) * 0.3f; } - //warlock's and mage's pets gain 30% of owner's intellect - else if ( stat == STAT_INTELLECT && getPetType() == SUMMON_PET ) + //warlock's and mage's pets gain 30% of owner's intellect + else if (stat == STAT_INTELLECT && getPetType() == SUMMON_PET) { - if(owner && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE) ) + if (owner && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)) value += float(owner->GetStat(stat)) * 0.3f; } SetStat(stat, int32(value)); - switch(stat) + switch (stat) { case STAT_STRENGTH: UpdateAttackPowerAndDamage(); break; case STAT_AGILITY: UpdateArmor(); break; @@ -966,7 +966,7 @@ bool Pet::UpdateAllStats() for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) UpdateStats(Stats(i)); - for(int i = POWER_MANA; i < MAX_POWERS; ++i) + for (int i = POWER_MANA; i < MAX_POWERS; ++i) UpdateMaxPower(Powers(i)); for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) @@ -977,13 +977,13 @@ bool Pet::UpdateAllStats() void Pet::UpdateResistances(uint32 school) { - if(school > SPELL_SCHOOL_NORMAL) + if (school > SPELL_SCHOOL_NORMAL) { float value = GetTotalAuraModValue(UnitMods(UNIT_MOD_RESISTANCE_START + school)); - Unit *owner = GetOwner(); + Unit* owner = GetOwner(); // hunter and warlock pets gain 40% of owner's resistance - if(owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK))) + if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK))) value += float(owner->GetResistance(SpellSchools(school))) * 0.4f; SetResistance(SpellSchools(school), int32(value)); @@ -998,9 +998,9 @@ void Pet::UpdateArmor() float bonus_armor = 0.0f; UnitMods unitMod = UNIT_MOD_ARMOR; - Unit *owner = GetOwner(); + Unit* owner = GetOwner(); // hunter and warlock pets gain 35% of owner's armor value - if(owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK))) + if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK))) bonus_armor = 0.35f * float(owner->GetArmor()); value = GetModifierValue(unitMod, BASE_VALUE); @@ -1041,44 +1041,44 @@ void Pet::UpdateMaxPower(Powers power) void Pet::UpdateAttackPowerAndDamage(bool ranged) { - if(ranged) + if (ranged) return; float val = 0.0f; float bonusAP = 0.0f; UnitMods unitMod = UNIT_MOD_ATTACK_POWER; - if(GetEntry() == 416) // imp's attack power + if (GetEntry() == 416) // imp's attack power val = GetStat(STAT_STRENGTH) - 10.0f; else val = 2 * GetStat(STAT_STRENGTH) - 20.0f; Unit* owner = GetOwner(); - if( owner && owner->GetTypeId()==TYPEID_PLAYER) + if (owner && owner->GetTypeId()==TYPEID_PLAYER) { - if(getPetType() == HUNTER_PET) //hunter pets benefit from owner's attack power + if (getPetType() == HUNTER_PET) //hunter pets benefit from owner's attack power { bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f; - SetBonusDamage( int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f)); + SetBonusDamage(int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f)); } //demons benefit from warlocks shadow or fire damage - else if(getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK) + else if (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK) { int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE); int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW); int32 maximum = (fire > shadow) ? fire : shadow; - if(maximum < 0) + if (maximum < 0) maximum = 0; - SetBonusDamage( int32(maximum * 0.15f)); + SetBonusDamage(int32(maximum * 0.15f)); bonusAP = maximum * 0.57f; } //water elementals benefit from mage's frost damage - else if(getPetType() == SUMMON_PET && owner->getClass() == CLASS_MAGE) + else if (getPetType() == SUMMON_PET && owner->getClass() == CLASS_MAGE) { int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST); - if(frost < 0) + if (frost < 0) frost = 0; - SetBonusDamage( int32(frost * 0.4f)); + SetBonusDamage(int32(frost * 0.4f)); } } @@ -1102,7 +1102,7 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged) void Pet::UpdateDamagePhysical(WeaponAttackType attType) { - if(attType > BASE_ATTACK) + if (attType > BASE_ATTACK) return; UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND; @@ -1123,7 +1123,7 @@ void Pet::UpdateDamagePhysical(WeaponAttackType attType) // Pet's base damage changes depending on happiness if (getPetType() == HUNTER_PET && attType == BASE_ATTACK) { - switch(GetHappinessState()) + switch (GetHappinessState()) { case HAPPY: // 125% of normal damage