diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 2064 |
1 files changed, 1043 insertions, 1021 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index f90b835de9..e90a81b6e4 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -46,10 +46,17 @@ std::string GetScriptsTableNameByType(ScriptsType type) std::string res = ""; switch (type) { - case SCRIPTS_SPELL: res = "spell_scripts"; break; - case SCRIPTS_EVENT: res = "event_scripts"; break; - case SCRIPTS_WAYPOINT: res = "waypoint_scripts"; break; - default: break; + case SCRIPTS_SPELL: + res = "spell_scripts"; + break; + case SCRIPTS_EVENT: + res = "event_scripts"; + break; + case SCRIPTS_WAYPOINT: + res = "waypoint_scripts"; + break; + default: + break; } return res; } @@ -59,10 +66,17 @@ ScriptMapMap* GetScriptsMapByType(ScriptsType type) ScriptMapMap* res = nullptr; switch (type) { - case SCRIPTS_SPELL: res = &sSpellScripts; break; - case SCRIPTS_EVENT: res = &sEventScripts; break; - case SCRIPTS_WAYPOINT: res = &sWaypointScripts; break; - default: break; + case SCRIPTS_SPELL: + res = &sSpellScripts; + break; + case SCRIPTS_EVENT: + res = &sEventScripts; + break; + case SCRIPTS_WAYPOINT: + res = &sWaypointScripts; + break; + default: + break; } return res; } @@ -72,41 +86,95 @@ std::string GetScriptCommandName(ScriptCommands command) std::string res = ""; switch (command) { - case SCRIPT_COMMAND_TALK: res = "SCRIPT_COMMAND_TALK"; break; - case SCRIPT_COMMAND_EMOTE: res = "SCRIPT_COMMAND_EMOTE"; break; - case SCRIPT_COMMAND_FIELD_SET: res = "SCRIPT_COMMAND_FIELD_SET"; break; - case SCRIPT_COMMAND_MOVE_TO: res = "SCRIPT_COMMAND_MOVE_TO"; break; - case SCRIPT_COMMAND_FLAG_SET: res = "SCRIPT_COMMAND_FLAG_SET"; break; - case SCRIPT_COMMAND_FLAG_REMOVE: res = "SCRIPT_COMMAND_FLAG_REMOVE"; break; - case SCRIPT_COMMAND_TELEPORT_TO: res = "SCRIPT_COMMAND_TELEPORT_TO"; break; - case SCRIPT_COMMAND_QUEST_EXPLORED: res = "SCRIPT_COMMAND_QUEST_EXPLORED"; break; - case SCRIPT_COMMAND_KILL_CREDIT: res = "SCRIPT_COMMAND_KILL_CREDIT"; break; - case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: res = "SCRIPT_COMMAND_RESPAWN_GAMEOBJECT"; break; - case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE: res = "SCRIPT_COMMAND_TEMP_SUMMON_CREATURE"; break; - case SCRIPT_COMMAND_OPEN_DOOR: res = "SCRIPT_COMMAND_OPEN_DOOR"; break; - case SCRIPT_COMMAND_CLOSE_DOOR: res = "SCRIPT_COMMAND_CLOSE_DOOR"; break; - case SCRIPT_COMMAND_ACTIVATE_OBJECT: res = "SCRIPT_COMMAND_ACTIVATE_OBJECT"; break; - case SCRIPT_COMMAND_REMOVE_AURA: res = "SCRIPT_COMMAND_REMOVE_AURA"; break; - case SCRIPT_COMMAND_CAST_SPELL: res = "SCRIPT_COMMAND_CAST_SPELL"; break; - case SCRIPT_COMMAND_PLAY_SOUND: res = "SCRIPT_COMMAND_PLAY_SOUND"; break; - case SCRIPT_COMMAND_CREATE_ITEM: res = "SCRIPT_COMMAND_CREATE_ITEM"; break; - case SCRIPT_COMMAND_DESPAWN_SELF: res = "SCRIPT_COMMAND_DESPAWN_SELF"; break; - case SCRIPT_COMMAND_LOAD_PATH: res = "SCRIPT_COMMAND_LOAD_PATH"; break; - case SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT: res = "SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT"; break; - case SCRIPT_COMMAND_KILL: res = "SCRIPT_COMMAND_KILL"; break; + case SCRIPT_COMMAND_TALK: + res = "SCRIPT_COMMAND_TALK"; + break; + case SCRIPT_COMMAND_EMOTE: + res = "SCRIPT_COMMAND_EMOTE"; + break; + case SCRIPT_COMMAND_FIELD_SET: + res = "SCRIPT_COMMAND_FIELD_SET"; + break; + case SCRIPT_COMMAND_MOVE_TO: + res = "SCRIPT_COMMAND_MOVE_TO"; + break; + case SCRIPT_COMMAND_FLAG_SET: + res = "SCRIPT_COMMAND_FLAG_SET"; + break; + case SCRIPT_COMMAND_FLAG_REMOVE: + res = "SCRIPT_COMMAND_FLAG_REMOVE"; + break; + case SCRIPT_COMMAND_TELEPORT_TO: + res = "SCRIPT_COMMAND_TELEPORT_TO"; + break; + case SCRIPT_COMMAND_QUEST_EXPLORED: + res = "SCRIPT_COMMAND_QUEST_EXPLORED"; + break; + case SCRIPT_COMMAND_KILL_CREDIT: + res = "SCRIPT_COMMAND_KILL_CREDIT"; + break; + case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: + res = "SCRIPT_COMMAND_RESPAWN_GAMEOBJECT"; + break; + case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE: + res = "SCRIPT_COMMAND_TEMP_SUMMON_CREATURE"; + break; + case SCRIPT_COMMAND_OPEN_DOOR: + res = "SCRIPT_COMMAND_OPEN_DOOR"; + break; + case SCRIPT_COMMAND_CLOSE_DOOR: + res = "SCRIPT_COMMAND_CLOSE_DOOR"; + break; + case SCRIPT_COMMAND_ACTIVATE_OBJECT: + res = "SCRIPT_COMMAND_ACTIVATE_OBJECT"; + break; + case SCRIPT_COMMAND_REMOVE_AURA: + res = "SCRIPT_COMMAND_REMOVE_AURA"; + break; + case SCRIPT_COMMAND_CAST_SPELL: + res = "SCRIPT_COMMAND_CAST_SPELL"; + break; + case SCRIPT_COMMAND_PLAY_SOUND: + res = "SCRIPT_COMMAND_PLAY_SOUND"; + break; + case SCRIPT_COMMAND_CREATE_ITEM: + res = "SCRIPT_COMMAND_CREATE_ITEM"; + break; + case SCRIPT_COMMAND_DESPAWN_SELF: + res = "SCRIPT_COMMAND_DESPAWN_SELF"; + break; + case SCRIPT_COMMAND_LOAD_PATH: + res = "SCRIPT_COMMAND_LOAD_PATH"; + break; + case SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT: + res = "SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT"; + break; + case SCRIPT_COMMAND_KILL: + res = "SCRIPT_COMMAND_KILL"; + break; // AzerothCore only - case SCRIPT_COMMAND_ORIENTATION: res = "SCRIPT_COMMAND_ORIENTATION"; break; - case SCRIPT_COMMAND_EQUIP: res = "SCRIPT_COMMAND_EQUIP"; break; - case SCRIPT_COMMAND_MODEL: res = "SCRIPT_COMMAND_MODEL"; break; - case SCRIPT_COMMAND_CLOSE_GOSSIP: res = "SCRIPT_COMMAND_CLOSE_GOSSIP"; break; - case SCRIPT_COMMAND_PLAYMOVIE: res = "SCRIPT_COMMAND_PLAYMOVIE"; break; - default: - { - char sz[32]; - sprintf(sz, "Unknown command: %d", command); - res = sz; + case SCRIPT_COMMAND_ORIENTATION: + res = "SCRIPT_COMMAND_ORIENTATION"; break; - } + case SCRIPT_COMMAND_EQUIP: + res = "SCRIPT_COMMAND_EQUIP"; + break; + case SCRIPT_COMMAND_MODEL: + res = "SCRIPT_COMMAND_MODEL"; + break; + case SCRIPT_COMMAND_CLOSE_GOSSIP: + res = "SCRIPT_COMMAND_CLOSE_GOSSIP"; + break; + case SCRIPT_COMMAND_PLAYMOVIE: + res = "SCRIPT_COMMAND_PLAYMOVIE"; + break; + default: + { + char sz[32]; + sprintf(sz, "Unknown command: %d", command); + res = sz; + break; + } } return res; } @@ -124,8 +192,8 @@ bool normalizePlayerName(std::string& name) return false; if (name.find(" ") != std::string::npos) - return false; - + return false; + std::wstring tmp; if (!Utf8toWStr(name, tmp)) return false; @@ -265,7 +333,7 @@ ObjectMgr::~ObjectMgr() _cacheTrainerSpellStore.clear(); - for (DungeonEncounterContainer::iterator itr =_dungeonEncounterStore.begin(); itr != _dungeonEncounterStore.end(); ++itr) + for (DungeonEncounterContainer::iterator itr = _dungeonEncounterStore.begin(); itr != _dungeonEncounterStore.end(); ++itr) for (DungeonEncounterList::iterator encounterItr = itr->second.begin(); encounterItr != itr->second.end(); ++encounterItr) delete *encounterItr; @@ -396,19 +464,19 @@ void ObjectMgr::LoadCreatureTemplates() // 0 1 2 3 4 5 6 7 8 QueryResult result = WorldDatabase.Query("SELECT entry, difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, " - // 9 10 11 12 13 14 15 16 17 18 19 20 21 - "modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, " - // 22 23 24 25 26 27 28 29 30 31 32 33 - "scale, `rank`, mindmg, maxdmg, dmgschool, attackpower, DamageModifier, BaseAttackTime, RangeAttackTime, unit_class, unit_flags, unit_flags2, " - // 34 35 36 37 38 39 40 41 42 43 - "dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, " - // 44 45 46 47 48 49 50 51 52 53 54 - "type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, " - // 55 56 57 58 59 60 61 62 63 64 65 66 67 - "spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, " - // 68 69 70 71 72 73 74 75 76 77 78 - "InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName " - "FROM creature_template;"); + // 9 10 11 12 13 14 15 16 17 18 19 20 21 + "modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction, npcflag, speed_walk, speed_run, " + // 22 23 24 25 26 27 28 29 30 31 32 33 + "scale, `rank`, mindmg, maxdmg, dmgschool, attackpower, DamageModifier, BaseAttackTime, RangeAttackTime, unit_class, unit_flags, unit_flags2, " + // 34 35 36 37 38 39 40 41 42 43 + "dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, " + // 44 45 46 47 48 49 50 51 52 53 54 + "type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, " + // 55 56 57 58 59 60 61 62 63 64 65 66 67 + "spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, " + // 68 69 70 71 72 73 74 75 76 77 78 + "InhabitType, HoverHeight, HealthModifier, ManaModifier, ArmorModifier, RacialLeader, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName " + "FROM creature_template;"); if (!result) { @@ -478,7 +546,7 @@ void ObjectMgr::LoadCreatureTemplates() creatureTemplate.SkinLootId = fields[46].GetUInt32(); for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - creatureTemplate.resistance[i] = fields[47 + i -1].GetInt16(); + creatureTemplate.resistance[i] = fields[47 + i - 1].GetInt16(); for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) creatureTemplate.spells[i] = fields[53 + i].GetUInt32(); @@ -502,8 +570,7 @@ void ObjectMgr::LoadCreatureTemplates() creatureTemplate.ScriptID = GetScriptId(fields[77].GetCString()); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); // pussywizard: { @@ -514,7 +581,7 @@ void ObjectMgr::LoadCreatureTemplates() if (max) { _creatureTemplateStoreFast.clear(); - _creatureTemplateStoreFast.resize(max+1, nullptr); + _creatureTemplateStoreFast.resize(max + 1, nullptr); for (CreatureTemplateContainer::iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) _creatureTemplateStoreFast[itr->first] = &(itr->second); } @@ -596,8 +663,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() } ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -619,7 +685,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (!difficultyInfo) { sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.", - cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]); + cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]); continue; } @@ -630,7 +696,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (_difficultyEntries[diff2].find(cInfo->Entry) != _difficultyEntries[diff2].end()) { sLog->outErrorDb("Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.", - cInfo->Entry, diff2 + 1, cInfo->DifficultyEntry[diff], diff + 1); + cInfo->Entry, diff2 + 1, cInfo->DifficultyEntry[diff], diff + 1); continue; } @@ -643,7 +709,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (_hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _hasDifficultyEntries[diff2].end()) { sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.", - cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1); + cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1); continue; } ok2 = true; @@ -654,19 +720,19 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (cInfo->expansion > difficultyInfo->expansion) { sLog->outErrorDb("Creature (Entry: %u, expansion %u) has different `expansion` in difficulty %u mode (Entry: %u, expansion %u).", - cInfo->Entry, cInfo->expansion, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->expansion); + cInfo->Entry, cInfo->expansion, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->expansion); } if (cInfo->faction != difficultyInfo->faction) { sLog->outErrorDb("Creature (Entry: %u, faction %u) has different `faction` in difficulty %u mode (Entry: %u, faction %u).", - cInfo->Entry, cInfo->faction, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->faction); + cInfo->Entry, cInfo->faction, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->faction); } if (cInfo->unit_class != difficultyInfo->unit_class) { sLog->outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).", - cInfo->Entry, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class); + cInfo->Entry, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class); continue; } @@ -679,7 +745,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (cInfo->family != difficultyInfo->family) { sLog->outErrorDb("Creature (Entry: %u, family %u) has different `family` in difficulty %u mode (Entry: %u, family %u).", - cInfo->Entry, cInfo->family, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->family); + cInfo->Entry, cInfo->family, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->family); } if (cInfo->trainer_class != difficultyInfo->trainer_class) @@ -709,13 +775,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (cInfo->type != difficultyInfo->type) { sLog->outErrorDb("Creature (Entry: %u, type %u) has different `type` in difficulty %u mode (Entry: %u, type %u).", - cInfo->Entry, cInfo->type, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->type); + cInfo->Entry, cInfo->type, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->type); } if (!cInfo->VehicleId && difficultyInfo->VehicleId) { sLog->outErrorDb("Creature (Entry: %u, VehicleId %u) has different `VehicleId` in difficulty %u mode (Entry: %u, VehicleId %u).", - cInfo->Entry, cInfo->VehicleId, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->VehicleId); + cInfo->Entry, cInfo->VehicleId, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->VehicleId); } // Xinef: check dmg school @@ -727,14 +793,14 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (!difficultyInfo->AIName.empty()) { sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.", - cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (difficultyInfo->ScriptID) { sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.", - cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } @@ -829,7 +895,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) } } - if (!cInfo->unit_class || ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0) + if (!cInfo->unit_class || ((1 << (cInfo->unit_class - 1)) & CLASSMASK_ALL_CREATURES) == 0) { sLog->outErrorDb("Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class); const_cast<CreatureTemplate*>(cInfo)->unit_class = UNIT_CLASS_WARRIOR; @@ -892,8 +958,8 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId); if (!vehId) { - sLog->outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId); - const_cast<CreatureTemplate*>(cInfo)->VehicleId = 0; + sLog->outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId); + const_cast<CreatureTemplate*>(cInfo)->VehicleId = 0; } } @@ -908,7 +974,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) { if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j])) { - sLog->outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]); + sLog->outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j + 1, cInfo->spells[j]); const_cast<CreatureTemplate*>(cInfo)->spells[j] = 0; } } @@ -1016,8 +1082,7 @@ void ObjectMgr::LoadCreatureAddons() } ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -1069,8 +1134,7 @@ void ObjectMgr::LoadGameObjectAddons() } ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u gameobject addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -1179,30 +1243,29 @@ void ObjectMgr::LoadEquipmentTemplates() if (!item) { sLog->outErrorDb("Unknown item (ID=%u) in creature_equip_template.ItemID%u for CreatureID = %u and ID = %u, forced to 0.", - equipmentInfo.ItemEntry[i], i+1, entry, id); + equipmentInfo.ItemEntry[i], i + 1, entry, id); equipmentInfo.ItemEntry[i] = 0; continue; } if (item->InventoryType != INVTYPE_WEAPON && - item->InventoryType != INVTYPE_SHIELD && - item->InventoryType != INVTYPE_RANGED && - item->InventoryType != INVTYPE_2HWEAPON && - item->InventoryType != INVTYPE_WEAPONMAINHAND && - item->InventoryType != INVTYPE_WEAPONOFFHAND && - item->InventoryType != INVTYPE_HOLDABLE && - item->InventoryType != INVTYPE_THROWN && - item->InventoryType != INVTYPE_RANGEDRIGHT) + item->InventoryType != INVTYPE_SHIELD && + item->InventoryType != INVTYPE_RANGED && + item->InventoryType != INVTYPE_2HWEAPON && + item->InventoryType != INVTYPE_WEAPONMAINHAND && + item->InventoryType != INVTYPE_WEAPONOFFHAND && + item->InventoryType != INVTYPE_HOLDABLE && + item->InventoryType != INVTYPE_THROWN && + item->InventoryType != INVTYPE_RANGEDRIGHT) { sLog->outErrorDb("Item (ID=%u) in creature_equip_template.ItemID%u for CreatureID = %u and ID = %u is not equipable in a hand, forced to 0.", - equipmentInfo.ItemEntry[i], i+1, entry, id); + equipmentInfo.ItemEntry[i], i + 1, entry, id); equipmentInfo.ItemEntry[i] = 0; } } ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -1319,8 +1382,7 @@ void ObjectMgr::LoadCreatureModelInfo() modelInfo.combat_reach = DEFAULT_COMBAT_REACH; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -1354,159 +1416,158 @@ void ObjectMgr::LoadLinkedRespawn() switch (linkType) { case CREATURE_TO_CREATURE: - { - const CreatureData* slave = GetCreatureData(guidLow); - if (!slave) { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow); - error = true; - break; - } + const CreatureData* slave = GetCreatureData(guidLow); + if (!slave) + { + sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow); + error = true; + break; + } - const CreatureData* master = GetCreatureData(linkedGuidLow); - if (!master) - { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow); - error = true; - break; - } + const CreatureData* master = GetCreatureData(linkedGuidLow); + if (!master) + { + sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow); + error = true; + break; + } - const MapEntry* const map = sMapStore.LookupEntry(master->mapid); - if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) - { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); - error = true; - break; - } + const MapEntry* const map = sMapStore.LookupEntry(master->mapid); + if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) + { + sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + error = true; + break; + } - if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) - { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); - error = true; + if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) + { + sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + error = true; + break; + } + + guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_UNIT); + linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_UNIT); break; } - - guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_UNIT); - linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_UNIT); - break; - } case CREATURE_TO_GO: - { - const CreatureData* slave = GetCreatureData(guidLow); - if (!slave) { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow); - error = true; - break; - } + const CreatureData* slave = GetCreatureData(guidLow); + if (!slave) + { + sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow); + error = true; + break; + } - const GameObjectData* master = GetGOData(linkedGuidLow); - if (!master) - { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); - error = true; - break; - } + const GameObjectData* master = GetGOData(linkedGuidLow); + if (!master) + { + sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); + error = true; + break; + } - const MapEntry* const map = sMapStore.LookupEntry(master->mapid); - if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) - { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); - error = true; - break; - } + const MapEntry* const map = sMapStore.LookupEntry(master->mapid); + if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) + { + sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + error = true; + break; + } - if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) - { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); - error = true; + if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) + { + sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + error = true; + break; + } + + guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_UNIT); + linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_GAMEOBJECT); break; } - - guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_UNIT); - linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_GAMEOBJECT); - break; - } case GO_TO_GO: - { - const GameObjectData* slave = GetGOData(guidLow); - if (!slave) { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow); - error = true; - break; - } + const GameObjectData* slave = GetGOData(guidLow); + if (!slave) + { + sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow); + error = true; + break; + } - const GameObjectData* master = GetGOData(linkedGuidLow); - if (!master) - { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); - error = true; - break; - } + const GameObjectData* master = GetGOData(linkedGuidLow); + if (!master) + { + sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); + error = true; + break; + } - const MapEntry* const map = sMapStore.LookupEntry(master->mapid); - if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) - { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); - error = true; - break; - } + const MapEntry* const map = sMapStore.LookupEntry(master->mapid); + if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) + { + sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + error = true; + break; + } - if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) - { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); - error = true; + if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) + { + sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + error = true; + break; + } + + guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_GAMEOBJECT); + linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_GAMEOBJECT); break; } - - guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_GAMEOBJECT); - linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_GAMEOBJECT); - break; - } case GO_TO_CREATURE: - { - const GameObjectData* slave = GetGOData(guidLow); - if (!slave) { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow); - error = true; - break; - } + const GameObjectData* slave = GetGOData(guidLow); + if (!slave) + { + sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow); + error = true; + break; + } - const CreatureData* master = GetCreatureData(linkedGuidLow); - if (!master) - { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow); - error = true; - break; - } + const CreatureData* master = GetCreatureData(linkedGuidLow); + if (!master) + { + sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow); + error = true; + break; + } - const MapEntry* const map = sMapStore.LookupEntry(master->mapid); - if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) - { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); - error = true; - break; - } + const MapEntry* const map = sMapStore.LookupEntry(master->mapid); + if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) + { + sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + error = true; + break; + } - if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) - { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); - error = true; + if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) + { + sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + error = true; + break; + } + + guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_GAMEOBJECT); + linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_UNIT); break; } - - guid = MAKE_NEW_GUID(guidLow, slave->id, HIGHGUID_GAMEOBJECT); - linkedGuid = MAKE_NEW_GUID(linkedGuidLow, master->id, HIGHGUID_UNIT); - break; - } } if (!error) _linkedRespawnStore[guid] = linkedGuid; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -1523,7 +1584,7 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) if (!linkedGuidLow) // we're removing the linking { _linkedRespawnStore.erase(guid); - PreparedStatement *stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CRELINKED_RESPAWN); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_DEL_CRELINKED_RESPAWN); stmt->setUInt32(0, guidLow); WorldDatabase.Execute(stmt); return true; @@ -1552,7 +1613,7 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) uint64 linkedGuid = MAKE_NEW_GUID(linkedGuidLow, slave->id, HIGHGUID_UNIT); _linkedRespawnStore[guid] = linkedGuid; - PreparedStatement *stmt = WorldDatabase.GetPreparedStatement(WORLD_REP_CREATURE_LINKED_RESPAWN); + PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_REP_CREATURE_LINKED_RESPAWN); stmt->setUInt32(0, guidLow); stmt->setUInt32(1, linkedGuidLow); WorldDatabase.Execute(stmt); @@ -1651,11 +1712,11 @@ void ObjectMgr::LoadCreatures() // 0 1 2 3 4 5 6 7 8 9 10 QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, wander_distance, " - // 11 12 13 14 15 16 17 18 19 20 21 - "currentwaypoint, curhealth, curmana, MovementType, spawnMask, phaseMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags " - "FROM creature " - "LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid " - "LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid"); + // 11 12 13 14 15 16 17 18 19 20 21 + "currentwaypoint, curhealth, curmana, MovementType, spawnMask, phaseMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags " + "FROM creature " + "LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid " + "LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid"); if (!result) { @@ -1719,8 +1780,8 @@ void ObjectMgr::LoadCreatures() } // pussywizard: 7 days means no reaspawn, so set it to 14 days, because manual id reset may be late - if (mapEntry->IsRaid() && data.spawntimesecs >= 7*DAY && data.spawntimesecs < 14*DAY) - data.spawntimesecs = 14*DAY; + if (mapEntry->IsRaid() && data.spawntimesecs >= 7 * DAY && data.spawntimesecs < 14 * DAY) + data.spawntimesecs = 14 * DAY; // Skip spawnMask check for transport maps if (!_transportMaps.count(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid]) @@ -1732,7 +1793,7 @@ void ObjectMgr::LoadCreatures() if (_difficultyEntries[diff].find(data.id) != _difficultyEntries[diff].end()) { sLog->outErrorDb("Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.", - guid, diff + 1, data.id); + guid, diff + 1, data.id); ok = false; } } @@ -1983,10 +2044,10 @@ void ObjectMgr::LoadGameobjects() // 0 1 2 3 4 5 6 QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, id, map, position_x, position_y, position_z, orientation, " - // 7 8 9 10 11 12 13 14 15 16 17 - "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, phaseMask, eventEntry, pool_entry " - "FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid " - "LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid"); + // 7 8 9 10 11 12 13 14 15 16 17 + "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, phaseMask, eventEntry, pool_entry " + "FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid " + "LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid"); if (!result) { @@ -2180,7 +2241,7 @@ uint64 ObjectMgr::GetPlayerGUIDByName(std::string const& name) const return 0; } -bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string &name) const +bool ObjectMgr::GetPlayerNameByGUID(uint64 guid, std::string& name) const { // Get data from global storage if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid))) @@ -2258,36 +2319,36 @@ void ObjectMgr::LoadItemTemplates() // 0 1 2 3 4 5 6 7 8 9 10 11 12 QueryResult result = WorldDatabase.Query("SELECT entry, class, subclass, SoundOverrideSubclass, name, displayid, Quality, Flags, FlagsExtra, BuyCount, BuyPrice, SellPrice, InventoryType, " - // 13 14 15 16 17 18 19 20 - "AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, " - // 21 22 23 24 25 26 27 28 - "RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, maxcount, stackable, ContainerSlots, StatsCount, stat_type1, " - // 29 30 31 32 33 34 35 36 37 38 - "stat_value1, stat_type2, stat_value2, stat_type3, stat_value3, stat_type4, stat_value4, stat_type5, stat_value5, stat_type6, " - // 39 40 41 42 43 44 45 46 47 - "stat_value6, stat_type7, stat_value7, stat_type8, stat_value8, stat_type9, stat_value9, stat_type10, stat_value10, " - // 48 49 50 51 52 53 54 55 56 57 58 - "ScalingStatDistribution, ScalingStatValue, dmg_min1, dmg_max1, dmg_type1, dmg_min2, dmg_max2, dmg_type2, armor, holy_res, fire_res, " - // 59 60 61 62 63 64 65 66 67 68 - "nature_res, frost_res, shadow_res, arcane_res, delay, ammo_type, RangedModRange, spellid_1, spelltrigger_1, spellcharges_1, " - // 69 70 71 72 73 74 75 - "spellppmRate_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1, spellid_2, spelltrigger_2, spellcharges_2, " - // 76 77 78 79 80 81 82 - "spellppmRate_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, spellid_3, spelltrigger_3, spellcharges_3, " - // 83 84 85 86 87 88 89 - "spellppmRate_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3, spellid_4, spelltrigger_4, spellcharges_4, " - // 90 91 92 93 94 95 96 - "spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, spellid_5, spelltrigger_5, spellcharges_5, " - // 97 98 99 100 101 102 103 104 105 - "spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, bonding, description, PageText, LanguageID, PageMaterial, " - // 106 107 108 109 110 111 112 113 114 115 116 117 - "startquest, lockid, Material, sheath, RandomProperty, RandomSuffix, block, itemset, MaxDurability, area, Map, BagFamily, " - // 118 119 120 121 122 123 124 125 - "TotemCategory, socketColor_1, socketContent_1, socketColor_2, socketContent_2, socketColor_3, socketContent_3, socketBonus, " - // 126 127 128 129 130 131 132 133 - "GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, duration, ItemLimitCategory, HolidayId, ScriptName, DisenchantID, " - // 134 135 136 - "FoodType, minMoneyLoot, maxMoneyLoot, flagsCustom FROM item_template"); + // 13 14 15 16 17 18 19 20 + "AllowableClass, AllowableRace, ItemLevel, RequiredLevel, RequiredSkill, RequiredSkillRank, requiredspell, requiredhonorrank, " + // 21 22 23 24 25 26 27 28 + "RequiredCityRank, RequiredReputationFaction, RequiredReputationRank, maxcount, stackable, ContainerSlots, StatsCount, stat_type1, " + // 29 30 31 32 33 34 35 36 37 38 + "stat_value1, stat_type2, stat_value2, stat_type3, stat_value3, stat_type4, stat_value4, stat_type5, stat_value5, stat_type6, " + // 39 40 41 42 43 44 45 46 47 + "stat_value6, stat_type7, stat_value7, stat_type8, stat_value8, stat_type9, stat_value9, stat_type10, stat_value10, " + // 48 49 50 51 52 53 54 55 56 57 58 + "ScalingStatDistribution, ScalingStatValue, dmg_min1, dmg_max1, dmg_type1, dmg_min2, dmg_max2, dmg_type2, armor, holy_res, fire_res, " + // 59 60 61 62 63 64 65 66 67 68 + "nature_res, frost_res, shadow_res, arcane_res, delay, ammo_type, RangedModRange, spellid_1, spelltrigger_1, spellcharges_1, " + // 69 70 71 72 73 74 75 + "spellppmRate_1, spellcooldown_1, spellcategory_1, spellcategorycooldown_1, spellid_2, spelltrigger_2, spellcharges_2, " + // 76 77 78 79 80 81 82 + "spellppmRate_2, spellcooldown_2, spellcategory_2, spellcategorycooldown_2, spellid_3, spelltrigger_3, spellcharges_3, " + // 83 84 85 86 87 88 89 + "spellppmRate_3, spellcooldown_3, spellcategory_3, spellcategorycooldown_3, spellid_4, spelltrigger_4, spellcharges_4, " + // 90 91 92 93 94 95 96 + "spellppmRate_4, spellcooldown_4, spellcategory_4, spellcategorycooldown_4, spellid_5, spelltrigger_5, spellcharges_5, " + // 97 98 99 100 101 102 103 104 105 + "spellppmRate_5, spellcooldown_5, spellcategory_5, spellcategorycooldown_5, bonding, description, PageText, LanguageID, PageMaterial, " + // 106 107 108 109 110 111 112 113 114 115 116 117 + "startquest, lockid, Material, sheath, RandomProperty, RandomSuffix, block, itemset, MaxDurability, area, Map, BagFamily, " + // 118 119 120 121 122 123 124 125 + "TotemCategory, socketColor_1, socketContent_1, socketColor_2, socketContent_2, socketColor_3, socketContent_3, socketBonus, " + // 126 127 128 129 130 131 132 133 + "GemProperties, RequiredDisenchantSkill, ArmorDamageModifier, duration, ItemLimitCategory, HolidayId, ScriptName, DisenchantID, " + // 134 135 136 + "FoodType, minMoneyLoot, maxMoneyLoot, flagsCustom FROM item_template"); if (!result) { @@ -2338,8 +2399,8 @@ void ObjectMgr::LoadItemTemplates() for (uint8 i = 0; i < itemTemplate.StatsCount; ++i) { - itemTemplate.ItemStat[i].ItemStatType = uint32(fields[28 + i*2].GetUInt8()); - itemTemplate.ItemStat[i].ItemStatValue = int32(fields[29 + i*2].GetInt16()); + itemTemplate.ItemStat[i].ItemStatType = uint32(fields[28 + i * 2].GetUInt8()); + itemTemplate.ItemStat[i].ItemStatValue = int32(fields[29 + i * 2].GetInt16()); } itemTemplate.ScalingStatDistribution = uint32(fields[48].GetUInt16()); @@ -2347,9 +2408,9 @@ void ObjectMgr::LoadItemTemplates() for (uint8 i = 0; i < MAX_ITEM_PROTO_DAMAGES; ++i) { - itemTemplate.Damage[i].DamageMin = fields[50 + i*3].GetFloat(); - itemTemplate.Damage[i].DamageMax = fields[51 + i*3].GetFloat(); - itemTemplate.Damage[i].DamageType = uint32(fields[52 + i*3].GetUInt8()); + itemTemplate.Damage[i].DamageMin = fields[50 + i * 3].GetFloat(); + itemTemplate.Damage[i].DamageMax = fields[51 + i * 3].GetFloat(); + itemTemplate.Damage[i].DamageType = uint32(fields[52 + i * 3].GetUInt8()); } itemTemplate.Armor = uint32(fields[56].GetUInt16()); @@ -2365,13 +2426,13 @@ void ObjectMgr::LoadItemTemplates() for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { - itemTemplate.Spells[i].SpellId = fields[66 + i*7 ].GetInt32(); - itemTemplate.Spells[i].SpellTrigger = uint32(fields[67 + i*7].GetUInt8()); - itemTemplate.Spells[i].SpellCharges = int32(fields[68 + i*7].GetInt16()); - itemTemplate.Spells[i].SpellPPMRate = fields[69 + i*7].GetFloat(); - itemTemplate.Spells[i].SpellCooldown = fields[70 + i*7].GetInt32(); - itemTemplate.Spells[i].SpellCategory = uint32(fields[71 + i*7].GetUInt16()); - itemTemplate.Spells[i].SpellCategoryCooldown = fields[72 + i*7].GetInt32(); + itemTemplate.Spells[i].SpellId = fields[66 + i * 7 ].GetInt32(); + itemTemplate.Spells[i].SpellTrigger = uint32(fields[67 + i * 7].GetUInt8()); + itemTemplate.Spells[i].SpellCharges = int32(fields[68 + i * 7].GetInt16()); + itemTemplate.Spells[i].SpellPPMRate = fields[69 + i * 7].GetFloat(); + itemTemplate.Spells[i].SpellCooldown = fields[70 + i * 7].GetInt32(); + itemTemplate.Spells[i].SpellCategory = uint32(fields[71 + i * 7].GetUInt16()); + itemTemplate.Spells[i].SpellCategoryCooldown = fields[72 + i * 7].GetInt32(); } itemTemplate.Bonding = uint32(fields[101].GetUInt8()); @@ -2395,8 +2456,8 @@ void ObjectMgr::LoadItemTemplates() for (uint8 i = 0; i < MAX_ITEM_PROTO_SOCKETS; ++i) { - itemTemplate.Socket[i].Color = uint32(fields[119 + i*2].GetUInt8()); - itemTemplate.Socket[i].Content = fields[120 + i*2].GetUInt32(); + itemTemplate.Socket[i].Color = uint32(fields[119 + i * 2].GetUInt8()); + itemTemplate.Socket[i].Content = fields[120 + i * 2].GetUInt32(); } itemTemplate.socketBonus = fields[125].GetUInt32(); @@ -2437,18 +2498,18 @@ void ObjectMgr::LoadItemTemplates() if (FactionEntry const* faction = sFactionStore.LookupEntry(HORDE)) if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0) sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", - entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_HORDE_ONLY); + entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_HORDE_ONLY); if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) sLog->outErrorDb("Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.", - entry, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY); + entry, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY); } else if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) { if (FactionEntry const* faction = sFactionStore.LookupEntry(ALLIANCE)) if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0) sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", - entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY); + entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY); } if (itemTemplate.BuyCount <= 0) @@ -2547,7 +2608,7 @@ void ObjectMgr::LoadItemTemplates() // for ItemStatValue != 0 if (itemTemplate.ItemStat[j].ItemStatValue && itemTemplate.ItemStat[j].ItemStatType >= MAX_ITEM_MOD) { - sLog->outErrorDb("Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); + sLog->outErrorDb("Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j + 1, itemTemplate.ItemStat[j].ItemStatType); itemTemplate.ItemStat[j].ItemStatType = 0; } @@ -2555,7 +2616,7 @@ void ObjectMgr::LoadItemTemplates() { case ITEM_MOD_SPELL_HEALING_DONE: case ITEM_MOD_SPELL_DAMAGE_DONE: - sLog->outErrorDb("Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j+1, itemTemplate.ItemStat[j].ItemStatType); + sLog->outErrorDb("Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j + 1, itemTemplate.ItemStat[j].ItemStatType); break; default: break; @@ -2566,7 +2627,7 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Damage[j].DamageType >= MAX_SPELL_SCHOOL) { - sLog->outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j+1, itemTemplate.Damage[j].DamageType); + sLog->outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j + 1, itemTemplate.Damage[j].DamageType); itemTemplate.Damage[j].DamageType = 0; } } @@ -2577,7 +2638,7 @@ void ObjectMgr::LoadItemTemplates() // spell_1 if (itemTemplate.Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0+1, itemTemplate.Spells[0].SpellTrigger); + sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0 + 1, itemTemplate.Spells[0].SpellTrigger); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[0].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; itemTemplate.Spells[1].SpellId = 0; @@ -2587,14 +2648,14 @@ void ObjectMgr::LoadItemTemplates() // spell_2 have learning spell if (itemTemplate.Spells[1].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1+1, itemTemplate.Spells[1].SpellTrigger); + sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1 + 1, itemTemplate.Spells[1].SpellTrigger); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (!itemTemplate.Spells[1].SpellId) { - sLog->outErrorDb("Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1+1); + sLog->outErrorDb("Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1 + 1); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -2603,7 +2664,7 @@ void ObjectMgr::LoadItemTemplates() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId); if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, nullptr)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); + sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1 + 1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -2611,7 +2672,7 @@ void ObjectMgr::LoadItemTemplates() // allowed only in special format else if ((itemTemplate.Spells[1].SpellId == 483) || (itemTemplate.Spells[1].SpellId == 55884)) { - sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); + sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1 + 1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -2623,13 +2684,13 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Spells[j].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); + sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j + 1, itemTemplate.Spells[j].SpellTrigger); itemTemplate.Spells[j].SpellId = 0; itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (itemTemplate.Spells[j].SpellId != 0) { - sLog->outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j+1, itemTemplate.Spells[j].SpellId); + sLog->outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j + 1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } } @@ -2641,7 +2702,7 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || itemTemplate.Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j+1, itemTemplate.Spells[j].SpellTrigger); + sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j + 1, itemTemplate.Spells[j].SpellTrigger); itemTemplate.Spells[j].SpellId = 0; itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -2651,13 +2712,13 @@ void ObjectMgr::LoadItemTemplates() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId); if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, nullptr)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); + sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j + 1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } // allowed only in special format else if ((itemTemplate.Spells[j].SpellId == 483) || (itemTemplate.Spells[j].SpellId == 55884)) { - sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); + sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j + 1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } } @@ -2713,13 +2774,13 @@ void ObjectMgr::LoadItemTemplates() if (itemTemplate.BagFamily) { // check bits - for (uint32 j = 0; j < sizeof(itemTemplate.BagFamily)*8; ++j) + for (uint32 j = 0; j < sizeof(itemTemplate.BagFamily) * 8; ++j) { uint32 mask = 1 << j; if ((itemTemplate.BagFamily & mask) == 0) continue; - ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j+1); + ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j + 1); if (!bf) { sLog->outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry); @@ -2746,7 +2807,7 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Socket[j].Color && (itemTemplate.Socket[j].Color & SOCKET_COLOR_ALL) != itemTemplate.Socket[j].Color) { - sLog->outErrorDb("Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j+1, itemTemplate.Socket[j].Color); + sLog->outErrorDb("Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j + 1, itemTemplate.Socket[j].Color); itemTemplate.Socket[j].Color = 0; } } @@ -2794,8 +2855,7 @@ void ObjectMgr::LoadItemTemplates() } ++count; - } - while (result->NextRow()); + } while (result->NextRow()); // pussywizard: { @@ -2806,7 +2866,7 @@ void ObjectMgr::LoadItemTemplates() if (max) { _itemTemplateStoreFast.clear(); - _itemTemplateStoreFast.resize(max+1, nullptr); + _itemTemplateStoreFast.resize(max + 1, nullptr); for (ItemTemplateContainer::iterator itr = _itemTemplateStore.begin(); itr != _itemTemplateStore.end(); ++itr) _itemTemplateStoreFast[itr->first] = &(itr->second); } @@ -2922,7 +2982,7 @@ void ObjectMgr::LoadItemSetNames() continue; } - ItemSetNameEntry &data = _itemSetNameStore[entry]; + ItemSetNameEntry& data = _itemSetNameStore[entry]; data.name = fields[1].GetString(); uint32 invType = fields[2].GetUInt8(); @@ -2948,7 +3008,7 @@ void ObjectMgr::LoadItemSetNames() if (pProto) { sLog->outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry); - ItemSetNameEntry &data = _itemSetNameStore[entry]; + ItemSetNameEntry& data = _itemSetNameStore[entry]; data.name = pProto->Name1; data.InventoryType = pProto->InventoryType; ++count; @@ -2989,7 +3049,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() int8 uiSeat = int8(fields[2].GetInt8()); bool bMinion = fields[3].GetBool(); uint8 uiSummonType = fields[4].GetUInt8(); - uint32 uiSummonTimer= fields[5].GetUInt32(); + uint32 uiSummonTimer = fields[5].GetUInt32(); if (!sObjectMgr->GetCreatureTemplate(uiEntry)) { @@ -3012,8 +3072,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() _vehicleTemplateAccessoryStore[uiEntry].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion, uiSummonType, uiSummonTimer)); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -3046,7 +3105,7 @@ void ObjectMgr::LoadVehicleAccessories() int8 uiSeat = int8(fields[2].GetInt16()); bool bMinion = fields[3].GetBool(); uint8 uiSummonType = fields[4].GetUInt8(); - uint32 uiSummonTimer= fields[5].GetUInt32(); + uint32 uiSummonTimer = fields[5].GetUInt32(); if (!sObjectMgr->GetCreatureTemplate(uiAccessory)) { @@ -3057,8 +3116,7 @@ void ObjectMgr::LoadVehicleAccessories() _vehicleAccessoryStore[uiGUID].push_back(VehicleAccessory(uiAccessory, uiSeat, bMinion, uiSummonType, uiSummonTimer)); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -3117,21 +3175,20 @@ void ObjectMgr::LoadPetLevelInfo() pInfoMapEntry = new PetLevelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)]; // data for level 1 stored in [0] array element, ... - PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level-1]; + PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level - 1]; pLevelInfo->health = fields[2].GetUInt16(); pLevelInfo->mana = fields[3].GetUInt16(); pLevelInfo->armor = fields[9].GetUInt32(); - pLevelInfo->min_dmg= fields[10].GetUInt16(); - pLevelInfo->max_dmg= fields[11].GetUInt16(); + pLevelInfo->min_dmg = fields[10].GetUInt16(); + pLevelInfo->max_dmg = fields[11].GetUInt16(); for (int i = 0; i < MAX_STATS; i++) { - pLevelInfo->stats[i] = fields[i+4].GetUInt16(); + pLevelInfo->stats[i] = fields[i + 4].GetUInt16(); } ++count; - } - while (result->NextRow()); + } while (result->NextRow()); // Fill gaps and check integrity for (PetLevelInfoContainer::iterator itr = _petInfoStore.begin(); itr != _petInfoStore.end(); ++itr) @@ -3169,7 +3226,7 @@ PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) if (itr == _petInfoStore.end()) return nullptr; - return &itr->second[level-1]; // data for level 1 stored in [0] array element, ... + return &itr->second[level - 1]; // data for level 1 stored in [0] array element, ... } void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count) @@ -3287,8 +3344,7 @@ void ObjectMgr::LoadPlayerInfo() _playerInfo[current_race][current_class] = info; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -3358,8 +3414,7 @@ void ObjectMgr::LoadPlayerInfo() PlayerCreateInfoAddItemHelper(current_race, current_class, item_id, amount); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -3422,8 +3477,7 @@ void ObjectMgr::LoadPlayerInfo() } } } - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -3468,8 +3522,7 @@ void ObjectMgr::LoadPlayerInfo() info->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt16(), fields[3].GetUInt32(), fields[4].GetUInt16())); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -3525,8 +3578,7 @@ void ObjectMgr::LoadPlayerInfo() levelInfo.basemana = fields[3].GetUInt16(); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); // Fill gaps and check integrity for (int class_ = 0; class_ < MAX_CLASSES; ++class_) @@ -3620,8 +3672,7 @@ void ObjectMgr::LoadPlayerInfo() } ++count; - } - while (result->NextRow()); + } while (result->NextRow()); // Fill gaps and check integrity for (int race = 0; race < MAX_RACES; ++race) @@ -3715,8 +3766,7 @@ void ObjectMgr::LoadPlayerInfo() //PlayerXPperLevel _playerXPperLevel[current_level] = current_xp; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); // fill level gaps for (uint8 level = 1; level < sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); ++level) @@ -3743,7 +3793,7 @@ void ObjectMgr::GetPlayerClassLevelInfo(uint32 class_, uint8 level, PlayerClassL if (level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) level = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL); - *info = pInfo->levelInfo[level-1]; + *info = pInfo->levelInfo[level - 1]; } void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, PlayerLevelInfo* info) const @@ -3756,7 +3806,7 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, Play return; if (level <= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) - *info = pInfo->levelInfo[level-1]; + *info = pInfo->levelInfo[level - 1]; else BuildPlayerLevelInfo(race, class_, level, info); } @@ -3764,75 +3814,75 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, Play void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, PlayerLevelInfo* info) const { // base data (last known level) - *info = _playerInfo[race][_class]->levelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)-1]; + *info = _playerInfo[race][_class]->levelInfo[sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) - 1]; // if conversion from uint32 to uint8 causes unexpected behaviour, change lvl to uint32 - for (uint8 lvl = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)-1; lvl < level; ++lvl) + for (uint8 lvl = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL) - 1; lvl < level; ++lvl) { switch (_class) { case CLASS_WARRIOR: - info->stats[STAT_STRENGTH] += (lvl > 23 ? 2: (lvl > 1 ? 1: 0)); - info->stats[STAT_STAMINA] += (lvl > 23 ? 2: (lvl > 1 ? 1: 0)); - info->stats[STAT_AGILITY] += (lvl > 36 ? 1: (lvl > 6 && (lvl%2) ? 1: 0)); - info->stats[STAT_INTELLECT] += (lvl > 9 && !(lvl%2) ? 1: 0); - info->stats[STAT_SPIRIT] += (lvl > 9 && !(lvl%2) ? 1: 0); + info->stats[STAT_STRENGTH] += (lvl > 23 ? 2 : (lvl > 1 ? 1 : 0)); + info->stats[STAT_STAMINA] += (lvl > 23 ? 2 : (lvl > 1 ? 1 : 0)); + info->stats[STAT_AGILITY] += (lvl > 36 ? 1 : (lvl > 6 && (lvl % 2) ? 1 : 0)); + info->stats[STAT_INTELLECT] += (lvl > 9 && !(lvl % 2) ? 1 : 0); + info->stats[STAT_SPIRIT] += (lvl > 9 && !(lvl % 2) ? 1 : 0); break; case CLASS_PALADIN: - info->stats[STAT_STRENGTH] += (lvl > 3 ? 1: 0); - info->stats[STAT_STAMINA] += (lvl > 33 ? 2: (lvl > 1 ? 1: 0)); - info->stats[STAT_AGILITY] += (lvl > 38 ? 1: (lvl > 7 && !(lvl%2) ? 1: 0)); - info->stats[STAT_INTELLECT] += (lvl > 6 && (lvl%2) ? 1: 0); - info->stats[STAT_SPIRIT] += (lvl > 7 ? 1: 0); + info->stats[STAT_STRENGTH] += (lvl > 3 ? 1 : 0); + info->stats[STAT_STAMINA] += (lvl > 33 ? 2 : (lvl > 1 ? 1 : 0)); + info->stats[STAT_AGILITY] += (lvl > 38 ? 1 : (lvl > 7 && !(lvl % 2) ? 1 : 0)); + info->stats[STAT_INTELLECT] += (lvl > 6 && (lvl % 2) ? 1 : 0); + info->stats[STAT_SPIRIT] += (lvl > 7 ? 1 : 0); break; case CLASS_HUNTER: - info->stats[STAT_STRENGTH] += (lvl > 4 ? 1: 0); - info->stats[STAT_STAMINA] += (lvl > 4 ? 1: 0); - info->stats[STAT_AGILITY] += (lvl > 33 ? 2: (lvl > 1 ? 1: 0)); - info->stats[STAT_INTELLECT] += (lvl > 8 && (lvl%2) ? 1: 0); - info->stats[STAT_SPIRIT] += (lvl > 38 ? 1: (lvl > 9 && !(lvl%2) ? 1: 0)); + info->stats[STAT_STRENGTH] += (lvl > 4 ? 1 : 0); + info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0); + info->stats[STAT_AGILITY] += (lvl > 33 ? 2 : (lvl > 1 ? 1 : 0)); + info->stats[STAT_INTELLECT] += (lvl > 8 && (lvl % 2) ? 1 : 0); + info->stats[STAT_SPIRIT] += (lvl > 38 ? 1 : (lvl > 9 && !(lvl % 2) ? 1 : 0)); break; case CLASS_ROGUE: - info->stats[STAT_STRENGTH] += (lvl > 5 ? 1: 0); - info->stats[STAT_STAMINA] += (lvl > 4 ? 1: 0); - info->stats[STAT_AGILITY] += (lvl > 16 ? 2: (lvl > 1 ? 1: 0)); - info->stats[STAT_INTELLECT] += (lvl > 8 && !(lvl%2) ? 1: 0); - info->stats[STAT_SPIRIT] += (lvl > 38 ? 1: (lvl > 9 && !(lvl%2) ? 1: 0)); + info->stats[STAT_STRENGTH] += (lvl > 5 ? 1 : 0); + info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0); + info->stats[STAT_AGILITY] += (lvl > 16 ? 2 : (lvl > 1 ? 1 : 0)); + info->stats[STAT_INTELLECT] += (lvl > 8 && !(lvl % 2) ? 1 : 0); + info->stats[STAT_SPIRIT] += (lvl > 38 ? 1 : (lvl > 9 && !(lvl % 2) ? 1 : 0)); break; case CLASS_PRIEST: - info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl%2) ? 1: 0); - info->stats[STAT_STAMINA] += (lvl > 5 ? 1: 0); - info->stats[STAT_AGILITY] += (lvl > 38 ? 1: (lvl > 8 && (lvl%2) ? 1: 0)); - info->stats[STAT_INTELLECT] += (lvl > 22 ? 2: (lvl > 1 ? 1: 0)); - info->stats[STAT_SPIRIT] += (lvl > 3 ? 1: 0); + info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0); + info->stats[STAT_STAMINA] += (lvl > 5 ? 1 : 0); + info->stats[STAT_AGILITY] += (lvl > 38 ? 1 : (lvl > 8 && (lvl % 2) ? 1 : 0)); + info->stats[STAT_INTELLECT] += (lvl > 22 ? 2 : (lvl > 1 ? 1 : 0)); + info->stats[STAT_SPIRIT] += (lvl > 3 ? 1 : 0); break; case CLASS_SHAMAN: - info->stats[STAT_STRENGTH] += (lvl > 34 ? 1: (lvl > 6 && (lvl%2) ? 1: 0)); - info->stats[STAT_STAMINA] += (lvl > 4 ? 1: 0); - info->stats[STAT_AGILITY] += (lvl > 7 && !(lvl%2) ? 1: 0); - info->stats[STAT_INTELLECT] += (lvl > 5 ? 1: 0); - info->stats[STAT_SPIRIT] += (lvl > 4 ? 1: 0); + info->stats[STAT_STRENGTH] += (lvl > 34 ? 1 : (lvl > 6 && (lvl % 2) ? 1 : 0)); + info->stats[STAT_STAMINA] += (lvl > 4 ? 1 : 0); + info->stats[STAT_AGILITY] += (lvl > 7 && !(lvl % 2) ? 1 : 0); + info->stats[STAT_INTELLECT] += (lvl > 5 ? 1 : 0); + info->stats[STAT_SPIRIT] += (lvl > 4 ? 1 : 0); break; case CLASS_MAGE: - info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl%2) ? 1: 0); - info->stats[STAT_STAMINA] += (lvl > 5 ? 1: 0); - info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl%2) ? 1: 0); - info->stats[STAT_INTELLECT] += (lvl > 24 ? 2: (lvl > 1 ? 1: 0)); - info->stats[STAT_SPIRIT] += (lvl > 33 ? 2: (lvl > 2 ? 1: 0)); + info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0); + info->stats[STAT_STAMINA] += (lvl > 5 ? 1 : 0); + info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl % 2) ? 1 : 0); + info->stats[STAT_INTELLECT] += (lvl > 24 ? 2 : (lvl > 1 ? 1 : 0)); + info->stats[STAT_SPIRIT] += (lvl > 33 ? 2 : (lvl > 2 ? 1 : 0)); break; case CLASS_WARLOCK: - info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl%2) ? 1: 0); - info->stats[STAT_STAMINA] += (lvl > 38 ? 2: (lvl > 3 ? 1: 0)); - info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl%2) ? 1: 0); - info->stats[STAT_INTELLECT] += (lvl > 33 ? 2: (lvl > 2 ? 1: 0)); - info->stats[STAT_SPIRIT] += (lvl > 38 ? 2: (lvl > 3 ? 1: 0)); + info->stats[STAT_STRENGTH] += (lvl > 9 && !(lvl % 2) ? 1 : 0); + info->stats[STAT_STAMINA] += (lvl > 38 ? 2 : (lvl > 3 ? 1 : 0)); + info->stats[STAT_AGILITY] += (lvl > 9 && !(lvl % 2) ? 1 : 0); + info->stats[STAT_INTELLECT] += (lvl > 33 ? 2 : (lvl > 2 ? 1 : 0)); + info->stats[STAT_SPIRIT] += (lvl > 38 ? 2 : (lvl > 3 ? 1 : 0)); break; case CLASS_DRUID: - info->stats[STAT_STRENGTH] += (lvl > 38 ? 2: (lvl > 6 && (lvl%2) ? 1: 0)); - info->stats[STAT_STAMINA] += (lvl > 32 ? 2: (lvl > 4 ? 1: 0)); - info->stats[STAT_AGILITY] += (lvl > 38 ? 2: (lvl > 8 && (lvl%2) ? 1: 0)); - info->stats[STAT_INTELLECT] += (lvl > 38 ? 3: (lvl > 4 ? 1: 0)); - info->stats[STAT_SPIRIT] += (lvl > 38 ? 3: (lvl > 5 ? 1: 0)); + info->stats[STAT_STRENGTH] += (lvl > 38 ? 2 : (lvl > 6 && (lvl % 2) ? 1 : 0)); + info->stats[STAT_STAMINA] += (lvl > 32 ? 2 : (lvl > 4 ? 1 : 0)); + info->stats[STAT_AGILITY] += (lvl > 38 ? 2 : (lvl > 8 && (lvl % 2) ? 1 : 0)); + info->stats[STAT_INTELLECT] += (lvl > 38 ? 3 : (lvl > 4 ? 1 : 0)); + info->stats[STAT_SPIRIT] += (lvl > 38 ? 3 : (lvl > 5 ? 1 : 0)); } } } @@ -3842,40 +3892,40 @@ void ObjectMgr::LoadQuests() uint32 oldMSTime = getMSTime(); // For reload case - for (QuestMap::const_iterator itr=_questTemplates.begin(); itr != _questTemplates.end(); ++itr) + for (QuestMap::const_iterator itr = _questTemplates.begin(); itr != _questTemplates.end(); ++itr) delete itr->second; _questTemplates.clear(); mExclusiveQuestGroups.clear(); QueryResult result = WorldDatabase.Query("SELECT " - //0 1 2 3 4 5 6 7 8 - "ID, QuestType, QuestLevel, MinLevel, QuestSortID, QuestInfoID, SuggestedGroupNum, TimeAllowed, AllowableRaces," - // 9 10 11 12 - "RequiredFactionId1, RequiredFactionId2, RequiredFactionValue1, RequiredFactionValue2, " - // 13 14 15 16 17 18 19 20 - "RewardNextQuest, RewardXPDifficulty, RewardMoney, RewardBonusMoney, RewardDisplaySpell, RewardSpell, RewardHonor, RewardKillHonor, " - // 21 22 23 24 25 26 - "StartItem, Flags, RewardTitle, RequiredPlayerKills, RewardTalents, RewardArenaPoints, " - // 27 28 29 30 31 32 33 34 - "RewardItem1, RewardAmount1, RewardItem2, RewardAmount2, RewardItem3, RewardAmount3, RewardItem4, RewardAmount4, " - // 35 36 37 38 39 40 41 42 43 44 45 46 - "RewardChoiceItemID1, RewardChoiceItemQuantity1, RewardChoiceItemID2, RewardChoiceItemQuantity2, RewardChoiceItemID3, RewardChoiceItemQuantity3, RewardChoiceItemID4, RewardChoiceItemQuantity4, RewardChoiceItemID5, RewardChoiceItemQuantity5, RewardChoiceItemID6, RewardChoiceItemQuantity6, " - // 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 - "RewardFactionID1, RewardFactionValue1, RewardFactionOverride1, RewardFactionID2, RewardFactionValue2, RewardFactionOverride2, RewardFactionID3, RewardFactionValue3, RewardFactionOverride3, RewardFactionID4, RewardFactionValue4, RewardFactionOverride4, RewardFactionID5, RewardFactionValue5, RewardFactionOverride5," - // 62 63 64 65 - "POIContinent, POIx, POIy, POIPriority, " - // 66 67 68 69 70 - "LogTitle, LogDescription, QuestDescription, AreaDescription, QuestCompletionLog, " - // 71 72 73 74 75 76 77 78 - "RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4, RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4, " - // 79 80 81 82 83 84 85 86 - "ItemDrop1, ItemDrop2, ItemDrop3, ItemDrop4, ItemDropQuantity1, ItemDropQuantity2, ItemDropQuantity3, ItemDropQuantity4, " - // 87 88 89 90 91 92 93 94 95 96 97 98 - "RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6, RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6, " - // 99 100 101 102 103 - "Unknown0, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4" - " FROM quest_template"); + //0 1 2 3 4 5 6 7 8 + "ID, QuestType, QuestLevel, MinLevel, QuestSortID, QuestInfoID, SuggestedGroupNum, TimeAllowed, AllowableRaces," + // 9 10 11 12 + "RequiredFactionId1, RequiredFactionId2, RequiredFactionValue1, RequiredFactionValue2, " + // 13 14 15 16 17 18 19 20 + "RewardNextQuest, RewardXPDifficulty, RewardMoney, RewardBonusMoney, RewardDisplaySpell, RewardSpell, RewardHonor, RewardKillHonor, " + // 21 22 23 24 25 26 + "StartItem, Flags, RewardTitle, RequiredPlayerKills, RewardTalents, RewardArenaPoints, " + // 27 28 29 30 31 32 33 34 + "RewardItem1, RewardAmount1, RewardItem2, RewardAmount2, RewardItem3, RewardAmount3, RewardItem4, RewardAmount4, " + // 35 36 37 38 39 40 41 42 43 44 45 46 + "RewardChoiceItemID1, RewardChoiceItemQuantity1, RewardChoiceItemID2, RewardChoiceItemQuantity2, RewardChoiceItemID3, RewardChoiceItemQuantity3, RewardChoiceItemID4, RewardChoiceItemQuantity4, RewardChoiceItemID5, RewardChoiceItemQuantity5, RewardChoiceItemID6, RewardChoiceItemQuantity6, " + // 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 + "RewardFactionID1, RewardFactionValue1, RewardFactionOverride1, RewardFactionID2, RewardFactionValue2, RewardFactionOverride2, RewardFactionID3, RewardFactionValue3, RewardFactionOverride3, RewardFactionID4, RewardFactionValue4, RewardFactionOverride4, RewardFactionID5, RewardFactionValue5, RewardFactionOverride5," + // 62 63 64 65 + "POIContinent, POIx, POIy, POIPriority, " + // 66 67 68 69 70 + "LogTitle, LogDescription, QuestDescription, AreaDescription, QuestCompletionLog, " + // 71 72 73 74 75 76 77 78 + "RequiredNpcOrGo1, RequiredNpcOrGo2, RequiredNpcOrGo3, RequiredNpcOrGo4, RequiredNpcOrGoCount1, RequiredNpcOrGoCount2, RequiredNpcOrGoCount3, RequiredNpcOrGoCount4, " + // 79 80 81 82 83 84 85 86 + "ItemDrop1, ItemDrop2, ItemDrop3, ItemDrop4, ItemDropQuantity1, ItemDropQuantity2, ItemDropQuantity3, ItemDropQuantity4, " + // 87 88 89 90 91 92 93 94 95 96 97 98 + "RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6, RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6, " + // 99 100 101 102 103 + "Unknown0, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4" + " FROM quest_template"); if (!result) { sLog->outErrorDb(">> Loaded 0 quests definitions. DB table `quest_template` is empty."); @@ -3903,7 +3953,7 @@ void ObjectMgr::LoadQuests() if (max) { _questTemplatesFast.clear(); - _questTemplatesFast.resize(max+1, nullptr); + _questTemplatesFast.resize(max + 1, nullptr); for (QuestMap::iterator itr = _questTemplates.begin(); itr != _questTemplates.end(); ++itr) _questTemplatesFast[itr->first] = itr->second; } @@ -3986,13 +4036,17 @@ void ObjectMgr::LoadQuests() // Load `quest_template_addon` // 0 1 2 3 4 5 6 7 8 result = WorldDatabase.Query("SELECT ID, MaxLevel, AllowableClasses, SourceSpellID, PrevQuestID, NextQuestID, ExclusiveGroup, RewardMailTemplateID, RewardMailDelay, " - //9 10 11 12 13 14 15 16 17 - "RequiredSkillID, RequiredSkillPoints, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, ProvidedItemCount, RewardMailSenderEntry, SpecialFlags FROM quest_template_addon LEFT JOIN quest_mail_sender ON Id=QuestId"); + //9 10 11 12 13 14 15 16 17 + "RequiredSkillID, RequiredSkillPoints, RequiredMinRepFaction, RequiredMaxRepFaction, RequiredMinRepValue, RequiredMaxRepValue, ProvidedItemCount, RewardMailSenderEntry, SpecialFlags FROM quest_template_addon LEFT JOIN quest_mail_sender ON Id=QuestId"); - if (!result) { - sLog->outError(">> Loaded 0 quest template addons. DB table `quest_template_addon` is empty."); - } else { - do { + if (!result) + { + sLog->outError(">> Loaded 0 quest template addons. DB table `quest_template_addon` is empty."); + } + else + { + do + { Field* fields = result->Fetch(); uint32 questId = fields[0].GetUInt32(); @@ -4000,7 +4054,7 @@ void ObjectMgr::LoadQuests() if (itr != _questTemplates.end()) itr->second->LoadQuestTemplateAddon(fields); else - sLog->outError("Table `quest_template_addon` has data for quest %u but such quest does not exist", questId); + sLog->outError("Table `quest_template_addon` has data for quest %u but such quest does not exist", questId); } while (result->NextRow()); } @@ -4011,7 +4065,7 @@ void ObjectMgr::LoadQuests() if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, nullptr)) continue; - Quest * qinfo = iter->second; + Quest* qinfo = iter->second; // additional quest integrity checks (GO, creature_template and item_template must be loaded already) @@ -4021,7 +4075,7 @@ void ObjectMgr::LoadQuests() if (qinfo->SpecialFlags & ~QUEST_SPECIAL_FLAGS_DB_ALLOWED) { sLog->outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u", - qinfo->GetQuestId(), qinfo->SpecialFlags, QUEST_SPECIAL_FLAGS_DB_ALLOWED); + qinfo->GetQuestId(), qinfo->SpecialFlags, QUEST_SPECIAL_FLAGS_DB_ALLOWED); qinfo->SpecialFlags &= QUEST_SPECIAL_FLAGS_DB_ALLOWED; } @@ -4066,7 +4120,7 @@ void ObjectMgr::LoadQuests() if (uint32 id = qinfo->RewardChoiceItemId[j]) { sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_TRACKING.", - qinfo->GetQuestId(), j+1, id, j+1); + qinfo->GetQuestId(), j + 1, id, j + 1); // no changes, quest ignore this data } } @@ -4078,7 +4132,7 @@ void ObjectMgr::LoadQuests() if (!sAreaTableStore.LookupEntry(qinfo->ZoneOrSort)) { sLog->outErrorDb("Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.", - qinfo->GetQuestId(), qinfo->ZoneOrSort); + qinfo->GetQuestId(), qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client } } @@ -4089,7 +4143,7 @@ void ObjectMgr::LoadQuests() if (!qSort) { sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", - qinfo->GetQuestId(), qinfo->ZoneOrSort); + qinfo->GetQuestId(), qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check) } //check for proper RequiredSkillId value (skill case) @@ -4098,7 +4152,7 @@ void ObjectMgr::LoadQuests() if (qinfo->RequiredSkillId != skill_id) { sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).", - qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id); + qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id); //override, and force proper value here? } } @@ -4110,25 +4164,25 @@ void ObjectMgr::LoadQuests() if (!(qinfo->RequiredClasses & CLASSMASK_ALL_PLAYABLE)) { sLog->outErrorDb("Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses); - qinfo->RequiredClasses = 0; + qinfo->RequiredClasses = 0; } } // AllowableRaces, can be 0/RACEMASK_ALL_PLAYABLE to allow any race if (qinfo->AllowableRaces) - { + { if (!(qinfo->AllowableRaces & RACEMASK_ALL_PLAYABLE)) - { - sLog->outErrorDb("Quest %u does not contain any playable races in `AllowableRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->AllowableRaces); - qinfo->AllowableRaces = 0; - } + { + sLog->outErrorDb("Quest %u does not contain any playable races in `AllowableRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->AllowableRaces); + qinfo->AllowableRaces = 0; } + } // RequiredSkillId, can be 0 if (qinfo->RequiredSkillId) { if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkillId)) { sLog->outErrorDb("Quest %u has `RequiredSkillId` = %u but this skill does not exist", - qinfo->GetQuestId(), qinfo->RequiredSkillId); + qinfo->GetQuestId(), qinfo->RequiredSkillId); } } @@ -4137,7 +4191,7 @@ void ObjectMgr::LoadQuests() if (qinfo->RequiredSkillPoints > sWorld->GetConfigMaxSkillValue()) { sLog->outErrorDb("Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.", - qinfo->GetQuestId(), qinfo->RequiredSkillPoints, sWorld->GetConfigMaxSkillValue()); + qinfo->GetQuestId(), qinfo->RequiredSkillPoints, sWorld->GetConfigMaxSkillValue()); // no changes, quest can't be done for this requirement } } @@ -4146,77 +4200,77 @@ void ObjectMgr::LoadQuests() if (qinfo->RequiredFactionId2 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId2)) { sLog->outErrorDb("Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.", - qinfo->GetQuestId(), qinfo->RequiredFactionId2, qinfo->RequiredFactionId2); + qinfo->GetQuestId(), qinfo->RequiredFactionId2, qinfo->RequiredFactionId2); // no changes, quest can't be done for this requirement } if (qinfo->RequiredFactionId1 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId1)) { sLog->outErrorDb("Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.", - qinfo->GetQuestId(), qinfo->RequiredFactionId1, qinfo->RequiredFactionId1); + qinfo->GetQuestId(), qinfo->RequiredFactionId1, qinfo->RequiredFactionId1); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction)) { sLog->outErrorDb("Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.", - qinfo->GetQuestId(), qinfo->RequiredMinRepFaction, qinfo->RequiredMinRepFaction); + qinfo->GetQuestId(), qinfo->RequiredMinRepFaction, qinfo->RequiredMinRepFaction); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction)) { sLog->outErrorDb("Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.", - qinfo->GetQuestId(), qinfo->RequiredMaxRepFaction, qinfo->RequiredMaxRepFaction); + qinfo->GetQuestId(), qinfo->RequiredMaxRepFaction, qinfo->RequiredMaxRepFaction); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap) { sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.", - qinfo->GetQuestId(), qinfo->RequiredMinRepValue, ReputationMgr::Reputation_Cap); + qinfo->GetQuestId(), qinfo->RequiredMinRepValue, ReputationMgr::Reputation_Cap); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue) { sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.", - qinfo->GetQuestId(), qinfo->RequiredMaxRepValue, qinfo->RequiredMinRepValue); + qinfo->GetQuestId(), qinfo->RequiredMaxRepValue, qinfo->RequiredMinRepValue); // no changes, quest can't be done for this requirement } if (!qinfo->RequiredFactionId1 && qinfo->RequiredFactionValue1 != 0) { sLog->outErrorDb("Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect", - qinfo->GetQuestId(), qinfo->RequiredFactionValue1); + qinfo->GetQuestId(), qinfo->RequiredFactionValue1); // warning } if (!qinfo->RequiredFactionId2 && qinfo->RequiredFactionValue2 != 0) { sLog->outErrorDb("Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect", - qinfo->GetQuestId(), qinfo->RequiredFactionValue2); + qinfo->GetQuestId(), qinfo->RequiredFactionValue2); // warning } if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue != 0) { sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect", - qinfo->GetQuestId(), qinfo->RequiredMinRepValue); + qinfo->GetQuestId(), qinfo->RequiredMinRepValue); // warning } if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue != 0) { sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect", - qinfo->GetQuestId(), qinfo->RequiredMaxRepValue); + qinfo->GetQuestId(), qinfo->RequiredMaxRepValue); // warning } if (qinfo->RewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->RewardTitleId)) { sLog->outErrorDb("Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", - qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId()); + qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId()); qinfo->RewardTitleId = 0; // quest can't reward this title } @@ -4226,20 +4280,20 @@ void ObjectMgr::LoadQuests() if (!sObjectMgr->GetItemTemplate(qinfo->StartItem)) { sLog->outErrorDb("Quest %u has `StartItem` = %u but item with entry %u does not exist, quest can't be done.", - qinfo->GetQuestId(), qinfo->StartItem, qinfo->StartItem); + qinfo->GetQuestId(), qinfo->StartItem, qinfo->StartItem); qinfo->StartItem = 0; // quest can't be done for this requirement } else if (qinfo->StartItemCount == 0) { sLog->outErrorDb("Quest %u has `StartItem` = %u but `StartItemCount` = 0, set to 1 but need fix in DB.", - qinfo->GetQuestId(), qinfo->StartItem); + qinfo->GetQuestId(), qinfo->StartItem); qinfo->StartItemCount = 1; // update to 1 for allow quest work for backward compatibility with DB } } else if (qinfo->StartItemCount > 0) { sLog->outErrorDb("Quest %u has `StartItem` = 0 but `StartItemCount` = %u, useless value.", - qinfo->GetQuestId(), qinfo->StartItemCount); + qinfo->GetQuestId(), qinfo->StartItemCount); qinfo->StartItemCount = 0; // no quest work changes in fact } @@ -4249,13 +4303,13 @@ void ObjectMgr::LoadQuests() if (!spellInfo) { sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.", - qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); + qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); qinfo->SourceSpellid = 0; // quest can't be done for this requirement } else if (!SpellMgr::ComputeIsSpellValid(spellInfo)) { sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.", - qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); + qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); qinfo->SourceSpellid = 0; // quest can't be done for this requirement } } @@ -4268,7 +4322,7 @@ void ObjectMgr::LoadQuests() if (qinfo->RequiredItemCount[j] == 0) { sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.", - qinfo->GetQuestId(), j+1, id, j+1); + qinfo->GetQuestId(), j + 1, id, j + 1); // no changes, quest can't be done for this requirement } @@ -4277,14 +4331,14 @@ void ObjectMgr::LoadQuests() if (!sObjectMgr->GetItemTemplate(id)) { sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.", - qinfo->GetQuestId(), j+1, id, id); + qinfo->GetQuestId(), j + 1, id, id); qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } } - else if (qinfo->RequiredItemCount[j]>0) + else if (qinfo->RequiredItemCount[j] > 0) { sLog->outErrorDb("Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.", - qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredItemCount[j]); + qinfo->GetQuestId(), j + 1, j + 1, qinfo->RequiredItemCount[j]); qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } } @@ -4297,16 +4351,16 @@ void ObjectMgr::LoadQuests() if (!sObjectMgr->GetItemTemplate(id)) { sLog->outErrorDb("Quest %u has `ItemDrop%d` = %u but item with entry %u does not exist, quest can't be done.", - qinfo->GetQuestId(), j+1, id, id); + qinfo->GetQuestId(), j + 1, id, id); // no changes, quest can't be done for this requirement } } else { - if (qinfo->ItemDropQuantity[j]>0) + if (qinfo->ItemDropQuantity[j] > 0) { sLog->outErrorDb("Quest %u has `ItemDrop%d` = 0 but `ItemDropQuantity%d` = %u.", - qinfo->GetQuestId(), j+1, j+1, qinfo->ItemDropQuantity[j]); + qinfo->GetQuestId(), j + 1, j + 1, qinfo->ItemDropQuantity[j]); // no changes, quest ignore this data } } @@ -4318,14 +4372,14 @@ void ObjectMgr::LoadQuests() if (id < 0 && !sObjectMgr->GetGameObjectTemplate(-id)) { sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.", - qinfo->GetQuestId(), j+1, id, uint32(-id)); + qinfo->GetQuestId(), j + 1, id, uint32(-id)); qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement } if (id > 0 && !sObjectMgr->GetCreatureTemplate(id)) { sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.", - qinfo->GetQuestId(), j+1, id, uint32(id)); + qinfo->GetQuestId(), j + 1, id, uint32(id)); qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement } @@ -4338,14 +4392,14 @@ void ObjectMgr::LoadQuests() if (!qinfo->RequiredNpcOrGoCount[j]) { sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.", - qinfo->GetQuestId(), j+1, id, j+1); + qinfo->GetQuestId(), j + 1, id, j + 1); // no changes, quest can be incorrectly done, but we already report this } } - else if (qinfo->RequiredNpcOrGoCount[j]>0) + else if (qinfo->RequiredNpcOrGoCount[j] > 0) { sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.", - qinfo->GetQuestId(), j+1, j+1, qinfo->RequiredNpcOrGoCount[j]); + qinfo->GetQuestId(), j + 1, j + 1, qinfo->RequiredNpcOrGoCount[j]); // no changes, quest ignore this data } } @@ -4358,21 +4412,21 @@ void ObjectMgr::LoadQuests() if (!sObjectMgr->GetItemTemplate(id)) { sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", - qinfo->GetQuestId(), j+1, id, id); + qinfo->GetQuestId(), j + 1, id, id); qinfo->RewardChoiceItemId[j] = 0; // no changes, quest will not reward this } if (!qinfo->RewardChoiceItemCount[j]) { sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.", - qinfo->GetQuestId(), j+1, id, j+1); + qinfo->GetQuestId(), j + 1, id, j + 1); // no changes, quest can't be done } } - else if (qinfo->RewardChoiceItemCount[j]>0) + else if (qinfo->RewardChoiceItemCount[j] > 0) { sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.", - qinfo->GetQuestId(), j+1, j+1, qinfo->RewardChoiceItemCount[j]); + qinfo->GetQuestId(), j + 1, j + 1, qinfo->RewardChoiceItemCount[j]); // no changes, quest ignore this data } } @@ -4385,21 +4439,21 @@ void ObjectMgr::LoadQuests() if (!sObjectMgr->GetItemTemplate(id)) { sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", - qinfo->GetQuestId(), j+1, id, id); + qinfo->GetQuestId(), j + 1, id, id); qinfo->RewardItemId[j] = 0; // no changes, quest will not reward this item } if (!qinfo->RewardItemIdCount[j]) { sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.", - qinfo->GetQuestId(), j+1, id, j+1); + qinfo->GetQuestId(), j + 1, id, j + 1); // no changes } } - else if (qinfo->RewardItemIdCount[j]>0) + else if (qinfo->RewardItemIdCount[j] > 0) { sLog->outErrorDb("Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.", - qinfo->GetQuestId(), j+1, j+1, qinfo->RewardItemIdCount[j]); + qinfo->GetQuestId(), j + 1, j + 1, qinfo->RewardItemIdCount[j]); // no changes, quest ignore this data } } @@ -4410,11 +4464,11 @@ void ObjectMgr::LoadQuests() { if (abs(qinfo->RewardFactionValueId[j]) > 9) { - sLog->outErrorDb("Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j+1, qinfo->RewardFactionValueId[j]); + sLog->outErrorDb("Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j + 1, qinfo->RewardFactionValueId[j]); } if (!sFactionStore.LookupEntry(qinfo->RewardFactionId[j])) { - sLog->outErrorDb("Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j+1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]); + sLog->outErrorDb("Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j + 1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]); qinfo->RewardFactionId[j] = 0; // quest will not reward this } } @@ -4422,7 +4476,7 @@ void ObjectMgr::LoadQuests() else if (qinfo->RewardFactionValueIdOverride[j] != 0) { sLog->outErrorDb("Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.", - qinfo->GetQuestId(), j+1, j+1, qinfo->RewardFactionValueIdOverride[j]); + qinfo->GetQuestId(), j + 1, j + 1, qinfo->RewardFactionValueIdOverride[j]); // no changes, quest ignore this data } } @@ -4434,21 +4488,21 @@ void ObjectMgr::LoadQuests() if (!spellInfo) { sLog->outErrorDb("Quest %u has `RewardDisplaySpell` = %u but spell %u does not exist, spell removed as display reward.", - qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell); + qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell); qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest } else if (!SpellMgr::ComputeIsSpellValid(spellInfo)) { sLog->outErrorDb("Quest %u has `RewardDisplaySpell` = %u but spell %u is broken, quest will not have a spell reward.", - qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell); + qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell); qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest } else if (GetTalentSpellCost(qinfo->RewardDisplaySpell)) { sLog->outErrorDb("Quest %u has `RewardDisplaySpell` = %u but spell %u is talent, quest will not have a spell reward.", - qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell); + qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell); qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest } } @@ -4460,21 +4514,21 @@ void ObjectMgr::LoadQuests() if (!spellInfo) { sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u does not exist, quest will not have a spell reward.", - qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); + qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell will be casted on player } else if (!SpellMgr::ComputeIsSpellValid(spellInfo)) { sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.", - qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); + qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell will be casted on player } else if (GetTalentSpellCost(qinfo->RewardSpell)) { sLog->outErrorDb("Quest %u has `RewardDisplaySpell` = %u but spell %u is talent, quest will not have a spell reward.", - qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); + qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell will be casted on player } } @@ -4484,7 +4538,7 @@ void ObjectMgr::LoadQuests() if (!sMailTemplateStore.LookupEntry(qinfo->RewardMailTemplateId)) { sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", - qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId); + qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId); qinfo->RewardMailTemplateId = 0; // no mail will send to player qinfo->RewardMailDelay = 0; // no mail will send to player qinfo->RewardMailSenderEntry = 0; @@ -4493,7 +4547,7 @@ void ObjectMgr::LoadQuests() { std::map<uint32, uint32>::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewardMailTemplateId); sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.", - qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second); + qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second); qinfo->RewardMailTemplateId = 0; // no mail will send to player qinfo->RewardMailDelay = 0; // no mail will send to player qinfo->RewardMailSenderEntry = 0; @@ -4508,7 +4562,7 @@ void ObjectMgr::LoadQuests() if (qNextItr == _questTemplates.end()) { sLog->outErrorDb("Quest %u has `RewardNextQuest` = %u but quest %u does not exist, quest chain will not work.", - qinfo->GetQuestId(), qinfo->RewardNextQuest, qinfo->RewardNextQuest); + qinfo->GetQuestId(), qinfo->RewardNextQuest, qinfo->RewardNextQuest); qinfo->RewardNextQuest = 0; } else @@ -4674,248 +4728,248 @@ void ObjectMgr::LoadScripts(ScriptsType type) switch (tmp.command) { case SCRIPT_COMMAND_TALK: - { - if (tmp.Talk.ChatType > CHAT_TYPE_WHISPER && tmp.Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER) - { - sLog->outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", - tableName.c_str(), tmp.Talk.ChatType, tmp.id); - continue; - } - if (!tmp.Talk.TextID) { - sLog->outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", - tableName.c_str(), tmp.Talk.TextID, tmp.id); - continue; + if (tmp.Talk.ChatType > CHAT_TYPE_WHISPER && tmp.Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER) + { + sLog->outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", + tableName.c_str(), tmp.Talk.ChatType, tmp.id); + continue; + } + if (!tmp.Talk.TextID) + { + sLog->outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", + tableName.c_str(), tmp.Talk.TextID, tmp.id); + continue; + } + break; } - break; - } case SCRIPT_COMMAND_EMOTE: - { - if (!sEmotesStore.LookupEntry(tmp.Emote.EmoteID)) { - sLog->outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", - tableName.c_str(), tmp.Emote.EmoteID, tmp.id); - continue; + if (!sEmotesStore.LookupEntry(tmp.Emote.EmoteID)) + { + sLog->outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", + tableName.c_str(), tmp.Emote.EmoteID, tmp.id); + continue; + } + break; } - break; - } case SCRIPT_COMMAND_TELEPORT_TO: - { - if (!sMapStore.LookupEntry(tmp.TeleportTo.MapID)) { - sLog->outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", - tableName.c_str(), tmp.TeleportTo.MapID, tmp.id); - continue; - } + if (!sMapStore.LookupEntry(tmp.TeleportTo.MapID)) + { + sLog->outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", + tableName.c_str(), tmp.TeleportTo.MapID, tmp.id); + continue; + } - if (!acore::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation)) - { - sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", - tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id); - continue; + if (!acore::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation)) + { + sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", + tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id); + continue; + } + break; } - break; - } case SCRIPT_COMMAND_QUEST_EXPLORED: - { - Quest const* quest = GetQuestTemplate(tmp.QuestExplored.QuestID); - if (!quest) { - sLog->outErrorDb("Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", - tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id); - continue; - } + Quest const* quest = GetQuestTemplate(tmp.QuestExplored.QuestID); + if (!quest) + { + sLog->outErrorDb("Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", + tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id); + continue; + } - if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) - { - sLog->outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have specialflag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", - tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id); + if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) + { + sLog->outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have specialflag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", + tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id); - // this will prevent quest completing without objective - const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT); + // this will prevent quest completing without objective + const_cast<Quest*>(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT); - // continue; - quest objective requirement set and command can be allowed - } + // continue; - quest objective requirement set and command can be allowed + } - 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.c_str(), tmp.QuestExplored.Distance, tmp.id); - continue; - } + 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.c_str(), 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.c_str(), tmp.QuestExplored.Distance, tmp.id, DEFAULT_VISIBILITY_DISTANCE); - 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.c_str(), 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.c_str(), tmp.QuestExplored.Distance, tmp.id, INTERACTION_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.c_str(), tmp.QuestExplored.Distance, tmp.id, INTERACTION_DISTANCE); + continue; + } - break; - } + break; + } case SCRIPT_COMMAND_KILL_CREDIT: - { - if (!GetCreatureTemplate(tmp.KillCredit.CreatureEntry)) { - sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", - tableName.c_str(), tmp.KillCredit.CreatureEntry, tmp.id); - continue; + if (!GetCreatureTemplate(tmp.KillCredit.CreatureEntry)) + { + sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", + tableName.c_str(), tmp.KillCredit.CreatureEntry, tmp.id); + continue; + } + break; } - break; - } case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: - { - GameObjectData const* data = GetGOData(tmp.RespawnGameobject.GOGuid); - if (!data) { - sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", - tableName.c_str(), tmp.RespawnGameobject.GOGuid, tmp.id); - continue; - } + GameObjectData const* data = GetGOData(tmp.RespawnGameobject.GOGuid); + if (!data) + { + sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + tableName.c_str(), tmp.RespawnGameobject.GOGuid, tmp.id); + continue; + } - GameObjectTemplate const* info = GetGameObjectTemplate(data->id); - if (!info) - { - sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", - tableName.c_str(), tmp.RespawnGameobject.GOGuid, data->id, tmp.id); - continue; - } + GameObjectTemplate const* info = GetGameObjectTemplate(data->id); + if (!info) + { + sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + tableName.c_str(), tmp.RespawnGameobject.GOGuid, data->id, tmp.id); + continue; + } - 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) - { - sLog->outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", - tableName.c_str(), info->entry, tmp.id); - continue; + 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) + { + sLog->outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + tableName.c_str(), info->entry, tmp.id); + continue; + } + break; } - break; - } case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE: - { - if (!acore::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation)) { - sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", - tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id); - continue; - } + if (!acore::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation)) + { + sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", + tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id); + continue; + } - uint32 entry = tmp.TempSummonCreature.CreatureEntry; - if (!GetCreatureTemplate(entry)) - { - sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", - tableName.c_str(), tmp.TempSummonCreature.CreatureEntry, tmp.id); - continue; + uint32 entry = tmp.TempSummonCreature.CreatureEntry; + if (!GetCreatureTemplate(entry)) + { + sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", + tableName.c_str(), tmp.TempSummonCreature.CreatureEntry, tmp.id); + continue; + } + break; } - break; - } case SCRIPT_COMMAND_OPEN_DOOR: case SCRIPT_COMMAND_CLOSE_DOOR: - { - GameObjectData const* data = GetGOData(tmp.ToggleDoor.GOGuid); - if (!data) { - sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", - tableName.c_str(), tmp.ToggleDoor.GOGuid, GetScriptCommandName(tmp.command).c_str(), tmp.id); - continue; - } + GameObjectData const* data = GetGOData(tmp.ToggleDoor.GOGuid); + if (!data) + { + sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", + tableName.c_str(), tmp.ToggleDoor.GOGuid, GetScriptCommandName(tmp.command).c_str(), tmp.id); + continue; + } - GameObjectTemplate const* info = GetGameObjectTemplate(data->id); - if (!info) - { - sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", - tableName.c_str(), tmp.ToggleDoor.GOGuid, data->id, GetScriptCommandName(tmp.command).c_str(), tmp.id); - continue; - } + GameObjectTemplate const* info = GetGameObjectTemplate(data->id); + if (!info) + { + sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", + tableName.c_str(), tmp.ToggleDoor.GOGuid, data->id, GetScriptCommandName(tmp.command).c_str(), tmp.id); + continue; + } - if (info->type != GAMEOBJECT_TYPE_DOOR) - { - sLog->outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u", - tableName.c_str(), info->entry, GetScriptCommandName(tmp.command).c_str(), tmp.id); - continue; - } + if (info->type != GAMEOBJECT_TYPE_DOOR) + { + sLog->outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u", + tableName.c_str(), info->entry, GetScriptCommandName(tmp.command).c_str(), tmp.id); + continue; + } - break; - } + break; + } case SCRIPT_COMMAND_REMOVE_AURA: - { - if (!sSpellMgr->GetSpellInfo(tmp.RemoveAura.SpellID)) { - sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", - tableName.c_str(), tmp.RemoveAura.SpellID, tmp.id); - continue; - } - if (tmp.RemoveAura.Flags & ~0x1) // 1 bits (0, 1) - { - sLog->outErrorDb("Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", - tableName.c_str(), tmp.RemoveAura.Flags, tmp.id); - continue; + if (!sSpellMgr->GetSpellInfo(tmp.RemoveAura.SpellID)) + { + sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", + tableName.c_str(), tmp.RemoveAura.SpellID, tmp.id); + continue; + } + if (tmp.RemoveAura.Flags & ~0x1) // 1 bits (0, 1) + { + sLog->outErrorDb("Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", + tableName.c_str(), tmp.RemoveAura.Flags, tmp.id); + continue; + } + break; } - break; - } case SCRIPT_COMMAND_CAST_SPELL: - { - if (!sSpellMgr->GetSpellInfo(tmp.CastSpell.SpellID)) - { - sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", - tableName.c_str(), tmp.CastSpell.SpellID, tmp.id); - continue; - } - if (tmp.CastSpell.Flags > 4) // targeting type - { - sLog->outErrorDb("Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", - tableName.c_str(), tmp.CastSpell.Flags, tmp.id); - continue; - } - if (tmp.CastSpell.Flags != 4 && tmp.CastSpell.CreatureEntry & ~0x1) // 1 bit (0, 1) { - sLog->outErrorDb("Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", - tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id); - continue; - } - else if (tmp.CastSpell.Flags == 4 && !GetCreatureTemplate(tmp.CastSpell.CreatureEntry)) - { - sLog->outErrorDb("Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", - tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id); - continue; + if (!sSpellMgr->GetSpellInfo(tmp.CastSpell.SpellID)) + { + sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + tableName.c_str(), tmp.CastSpell.SpellID, tmp.id); + continue; + } + if (tmp.CastSpell.Flags > 4) // targeting type + { + sLog->outErrorDb("Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + tableName.c_str(), tmp.CastSpell.Flags, tmp.id); + continue; + } + if (tmp.CastSpell.Flags != 4 && tmp.CastSpell.CreatureEntry & ~0x1) // 1 bit (0, 1) + { + sLog->outErrorDb("Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id); + continue; + } + else if (tmp.CastSpell.Flags == 4 && !GetCreatureTemplate(tmp.CastSpell.CreatureEntry)) + { + sLog->outErrorDb("Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id); + continue; + } + break; } - break; - } case SCRIPT_COMMAND_CREATE_ITEM: - { - if (!GetItemTemplate(tmp.CreateItem.ItemEntry)) - { - sLog->outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", - tableName.c_str(), 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.c_str(), tmp.CreateItem.Amount, tmp.id); - continue; + if (!GetItemTemplate(tmp.CreateItem.ItemEntry)) + { + sLog->outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", + tableName.c_str(), 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.c_str(), tmp.CreateItem.Amount, tmp.id); + continue; + } + break; } - break; - } default: break; } @@ -4928,8 +4982,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) (*scripts)[tmp.id].insert(std::pair<uint32, ScriptInfo>(tmp.delay, tmp)); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -4997,7 +5050,7 @@ void ObjectMgr::LoadEventScripts() std::set<uint32>::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 or any spell effect %u", - itr->first, SPELL_EFFECT_SEND_EVENT); + itr->first, SPELL_EFFECT_SEND_EVENT); } } @@ -5022,8 +5075,7 @@ void ObjectMgr::LoadWaypointScripts() uint32 action = fields[0].GetUInt32(); actionSet.erase(action); - } - while (result->NextRow()); + } while (result->NextRow()); } for (std::set<uint32>::iterator itr = actionSet.begin(); itr != actionSet.end(); ++itr) @@ -5053,7 +5105,7 @@ void ObjectMgr::LoadSpellScriptNames() Field* fields = result->Fetch(); int32 spellId = fields[0].GetInt32(); - const char *scriptName = fields[1].GetCString(); + const char* scriptName = fields[1].GetCString(); bool allRanks = false; if (spellId <= 0) @@ -5085,8 +5137,7 @@ void ObjectMgr::LoadSpellScriptNames() else _spellScriptsStore.insert(SpellScriptsContainer::value_type(spellInfo->Id, GetScriptId(scriptName))); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -5108,11 +5159,11 @@ void ObjectMgr::ValidateSpellScripts() for (SpellScriptsContainer::iterator itr = _spellScriptsStore.begin(); itr != _spellScriptsStore.end();) { SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->first); - std::vector<std::pair<SpellScriptLoader *, SpellScriptsContainer::iterator> > SpellScriptLoaders; + std::vector<std::pair<SpellScriptLoader*, SpellScriptsContainer::iterator> > SpellScriptLoaders; sScriptMgr->CreateSpellScriptLoaders(itr->first, SpellScriptLoaders); itr = _spellScriptsStore.upper_bound(itr->first); - for (std::vector<std::pair<SpellScriptLoader *, SpellScriptsContainer::iterator> >::iterator sitr = SpellScriptLoaders.begin(); sitr != SpellScriptLoaders.end(); ++sitr) + for (std::vector<std::pair<SpellScriptLoader*, SpellScriptsContainer::iterator> >::iterator sitr = SpellScriptLoaders.begin(); sitr != SpellScriptLoaders.end(); ++sitr) { SpellScript* spellScript = sitr->first->GetSpellScript(); AuraScript* auraScript = sitr->first->GetAuraScript(); @@ -5153,7 +5204,7 @@ void ObjectMgr::ValidateSpellScripts() void ObjectMgr::InitializeSpellInfoPrecomputedData() { uint32 limit = sSpellStore.GetNumRows(); - for(uint32 i=0; i<=limit; ++i) + for(uint32 i = 0; i <= limit; ++i) if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i)) { const_cast<SpellInfo*>(spellInfo)->SetStackableWithRanks(spellInfo->ComputeIsStackableWithRanks()); @@ -5187,8 +5238,7 @@ void ObjectMgr::LoadPageTexts() pageText.NextPage = fields[2].GetUInt32(); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); for (PageTextContainer::const_iterator itr = _pageTextStore.begin(); itr != _pageTextStore.end(); ++itr) { @@ -5280,8 +5330,7 @@ void ObjectMgr::LoadInstanceTemplate() _instanceTemplateStore[mapID] = instanceTemplate; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -5346,27 +5395,27 @@ void ObjectMgr::LoadInstanceEncounters() switch (creditType) { case ENCOUNTER_CREDIT_KILL_CREATURE: - { - CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry); - if (!creatureInfo) { - sLog->outErrorDb("Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); - continue; + CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry); + if (!creatureInfo) + { + sLog->outErrorDb("Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); + continue; + } + const_cast<CreatureTemplate*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS; + break; } - const_cast<CreatureTemplate*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS; - break; - } case ENCOUNTER_CREDIT_CAST_SPELL: - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(creditEntry); - if (!spellInfo) { - sLog->outErrorDb("Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); - continue; + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(creditEntry); + if (!spellInfo) + { + sLog->outErrorDb("Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); + continue; + } + const_cast<SpellInfo*>(spellInfo)->AttributesCu |= SPELL_ATTR0_CU_ENCOUNTER_REWARD; + break; } - const_cast<SpellInfo*>(spellInfo)->AttributesCu |= SPELL_ATTR0_CU_ENCOUNTER_REWARD; - break; - } default: sLog->outErrorDb("Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]); continue; @@ -5394,15 +5443,15 @@ void ObjectMgr::LoadGossipText() uint32 oldMSTime = getMSTime(); QueryResult result = WorldDatabase.Query("SELECT ID, " - "text0_0, text0_1, BroadcastTextID0, lang0, Probability0, em0_0, em0_1, em0_2, em0_3, em0_4, em0_5, " - "text1_0, text1_1, BroadcastTextID1, lang1, Probability1, em1_0, em1_1, em1_2, em1_3, em1_4, em1_5, " - "text2_0, text2_1, BroadcastTextID2, lang2, Probability2, em2_0, em2_1, em2_2, em2_3, em2_4, em2_5, " - "text3_0, text3_1, BroadcastTextID3, lang3, Probability3, em3_0, em3_1, em3_2, em3_3, em3_4, em3_5, " - "text4_0, text4_1, BroadcastTextID4, lang4, Probability4, em4_0, em4_1, em4_2, em4_3, em4_4, em4_5, " - "text5_0, text5_1, BroadcastTextID5, lang5, Probability5, em5_0, em5_1, em5_2, em5_3, em5_4, em5_5, " - "text6_0, text6_1, BroadcastTextID6, lang6, Probability6, em6_0, em6_1, em6_2, em6_3, em6_4, em6_5, " - "text7_0, text7_1, BroadcastTextID7, lang7, Probability7, em7_0, em7_1, em7_2, em7_3, em7_4, em7_5 " - "FROM npc_text"); + "text0_0, text0_1, BroadcastTextID0, lang0, Probability0, em0_0, em0_1, em0_2, em0_3, em0_4, em0_5, " + "text1_0, text1_1, BroadcastTextID1, lang1, Probability1, em1_0, em1_1, em1_2, em1_3, em1_4, em1_5, " + "text2_0, text2_1, BroadcastTextID2, lang2, Probability2, em2_0, em2_1, em2_2, em2_3, em2_4, em2_5, " + "text3_0, text3_1, BroadcastTextID3, lang3, Probability3, em3_0, em3_1, em3_2, em3_3, em3_4, em3_5, " + "text4_0, text4_1, BroadcastTextID4, lang4, Probability4, em4_0, em4_1, em4_2, em4_3, em4_4, em4_5, " + "text5_0, text5_1, BroadcastTextID5, lang5, Probability5, em5_0, em5_1, em5_2, em5_3, em5_4, em5_5, " + "text6_0, text6_1, BroadcastTextID6, lang6, Probability6, em6_0, em6_1, em6_2, em6_3, em6_4, em6_5, " + "text7_0, text7_1, BroadcastTextID7, lang7, Probability7, em7_0, em7_1, em7_2, em7_3, em7_4, em7_5 " + "FROM npc_text"); if (!result) { @@ -5474,9 +5523,9 @@ void ObjectMgr::LoadNpcTextLocales() _npcTextLocaleStore.clear(); // need for reload case QueryResult result = WorldDatabase.Query("SELECT ID, Locale, " - // 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 - "Text0_0, Text0_1, Text1_0, Text1_1, Text2_0, Text2_1, Text3_0, Text3_1, Text4_0, Text4_1, Text5_0, Text5_1, Text6_0, Text6_1, Text7_0, Text7_1 " - "FROM npc_text_locale"); + // 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 + "Text0_0, Text0_1, Text1_0, Text1_1, Text2_0, Text2_1, Text3_0, Text3_1, Text4_0, Text4_1, Text5_0, Text5_1, Text6_0, Text6_1, Text7_0, Text7_1 " + "FROM npc_text_locale"); if (!result) return; @@ -5622,8 +5671,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) CharacterDatabase.Execute(stmt); delete m; ++deletedCount; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -5810,7 +5858,7 @@ void ObjectMgr::LoadAreaTriggerScripts() Field* fields = result->Fetch(); uint32 Trigger_ID = fields[0].GetUInt32(); - const char *scriptName = fields[1].GetCString(); + const char* scriptName = fields[1].GetCString(); AreaTrigger const* atEntry = GetAreaTrigger(Trigger_ID); if (!atEntry) @@ -5839,7 +5887,7 @@ uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, ui continue; uint8 field = (uint8)((i - 1) / 32); - uint32 submask = 1<<((i-1)%32); + uint32 submask = 1 << ((i - 1) % 32); // skip not taxi network nodes #ifndef ELUNA @@ -5849,7 +5897,7 @@ uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, ui #endif continue; - float dist2 = (node->x - x)*(node->x - x)+(node->y - y)*(node->y - y)+(node->z - z)*(node->z - z); + float dist2 = (node->x - x) * (node->x - x) + (node->y - y) * (node->y - y) + (node->z - z) * (node->z - z); if (found) { if (dist2 < dist) @@ -5869,7 +5917,7 @@ uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, ui return id; } -void ObjectMgr::GetTaxiPath(uint32 source, uint32 destination, uint32 &path, uint32 &cost) +void ObjectMgr::GetTaxiPath(uint32 source, uint32 destination, uint32& path, uint32& cost) { TaxiPathSetBySource::iterator src_i = sTaxiPathSetBySource.find(source); if (src_i == sTaxiPathSetBySource.end()) @@ -6186,7 +6234,7 @@ AreaTriggerTeleport const* ObjectMgr::GetMapEntranceTrigger(uint32 Map) const // xinef: no need to check, already done at loading //AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(itr->first); //if (atEntry) - return &itr->second; + return &itr->second; } } return nullptr; @@ -6196,12 +6244,12 @@ void ObjectMgr::SetHighestGuids() { QueryResult result = CharacterDatabase.Query("SELECT MAX(guid) FROM characters"); if (result) - _hiCharGuid = (*result)[0].GetUInt32()+1; + _hiCharGuid = (*result)[0].GetUInt32() + 1; result = WorldDatabase.Query("SELECT MAX(guid) FROM creature"); if (result) { - _hiCreatureGuid = (*result)[0].GetUInt32()+1; + _hiCreatureGuid = (*result)[0].GetUInt32() + 1; _hiCreatureRecycledGuid = _hiCreatureGuid; _hiCreatureRecycledGuidMax = _hiCreatureRecycledGuid + 10000; _hiCreatureGuid = _hiCreatureRecycledGuidMax + 1; @@ -6209,7 +6257,7 @@ void ObjectMgr::SetHighestGuids() result = CharacterDatabase.Query("SELECT MAX(guid) FROM item_instance"); if (result) - _hiItemGuid = (*result)[0].GetUInt32()+1; + _hiItemGuid = (*result)[0].GetUInt32() + 1; // Cleanup other tables from not existed guids ( >= _hiItemGuid) CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '%u'", _hiItemGuid); // One-time query @@ -6220,7 +6268,7 @@ void ObjectMgr::SetHighestGuids() result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject"); if (result) { - _hiGoGuid = (*result)[0].GetUInt32()+1; + _hiGoGuid = (*result)[0].GetUInt32() + 1; _hiGoRecycledGuid = _hiGoGuid; _hiGoRecycledGuidMax = _hiGoRecycledGuid + 1; _hiGoGuid = _hiGoRecycledGuidMax + 1; @@ -6228,23 +6276,23 @@ void ObjectMgr::SetHighestGuids() result = WorldDatabase.Query("SELECT MAX(guid) FROM transports"); if (result) - _hiMoTransGuid = (*result)[0].GetUInt32()+1; + _hiMoTransGuid = (*result)[0].GetUInt32() + 1; result = CharacterDatabase.Query("SELECT MAX(id) FROM auctionhouse"); if (result) - _auctionId = (*result)[0].GetUInt32()+1; + _auctionId = (*result)[0].GetUInt32() + 1; result = CharacterDatabase.Query("SELECT MAX(id) FROM mail"); if (result) - _mailId = (*result)[0].GetUInt32()+1; + _mailId = (*result)[0].GetUInt32() + 1; result = CharacterDatabase.Query("SELECT MAX(corpseGuid) FROM corpse"); if (result) - _hiCorpseGuid = (*result)[0].GetUInt32()+1; + _hiCorpseGuid = (*result)[0].GetUInt32() + 1; result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team"); if (result) - sArenaTeamMgr->SetNextArenaTeamId((*result)[0].GetUInt32()+1); + sArenaTeamMgr->SetNextArenaTeamId((*result)[0].GetUInt32() + 1); result = CharacterDatabase.Query("SELECT MAX(fight_id) FROM log_arena_fights"); if (result) @@ -6252,11 +6300,11 @@ void ObjectMgr::SetHighestGuids() result = CharacterDatabase.Query("SELECT MAX(setguid) FROM character_equipmentsets"); if (result) - _equipmentSetGuid = (*result)[0].GetUInt64()+1; + _equipmentSetGuid = (*result)[0].GetUInt64() + 1; result = CharacterDatabase.Query("SELECT MAX(guildId) FROM guild"); if (result) - sGuildMgr->SetNextGuildId((*result)[0].GetUInt32()+1); + sGuildMgr->SetNextGuildId((*result)[0].GetUInt32() + 1); } uint32 ObjectMgr::GenerateAuctionID() @@ -6295,58 +6343,58 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) switch (guidhigh) { case HIGHGUID_ITEM: - { - ASSERT(_hiItemGuid < 0xFFFFFFFE && "Item guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiItemGuidMutex); - return _hiItemGuid++; - } + { + ASSERT(_hiItemGuid < 0xFFFFFFFE && "Item guid overflow!"); + ACORE_GUARD(ACE_Thread_Mutex, _hiItemGuidMutex); + return _hiItemGuid++; + } case HIGHGUID_UNIT: - { - ASSERT(_hiCreatureGuid < 0x00FFFFFE && "Creature guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiCreatureGuidMutex); - return _hiCreatureGuid++; - } + { + ASSERT(_hiCreatureGuid < 0x00FFFFFE && "Creature guid overflow!"); + ACORE_GUARD(ACE_Thread_Mutex, _hiCreatureGuidMutex); + return _hiCreatureGuid++; + } case HIGHGUID_PET: - { - ASSERT(_hiPetGuid < 0x00FFFFFE && "Pet guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiPetGuidMutex); - return _hiPetGuid++; - } + { + ASSERT(_hiPetGuid < 0x00FFFFFE && "Pet guid overflow!"); + ACORE_GUARD(ACE_Thread_Mutex, _hiPetGuidMutex); + return _hiPetGuid++; + } case HIGHGUID_VEHICLE: - { - ASSERT(_hiVehicleGuid < 0x00FFFFFF && "Vehicle guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiVehicleGuidMutex); - return _hiVehicleGuid++; - } + { + ASSERT(_hiVehicleGuid < 0x00FFFFFF && "Vehicle guid overflow!"); + ACORE_GUARD(ACE_Thread_Mutex, _hiVehicleGuidMutex); + return _hiVehicleGuid++; + } case HIGHGUID_PLAYER: - { - ASSERT(_hiCharGuid < 0xFFFFFFFE && "Player guid overflow!"); - return _hiCharGuid++; - } + { + ASSERT(_hiCharGuid < 0xFFFFFFFE && "Player guid overflow!"); + return _hiCharGuid++; + } case HIGHGUID_GAMEOBJECT: - { - ASSERT(_hiGoGuid < 0x00FFFFFE && "Gameobject guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiGoGuidMutex); - return _hiGoGuid++; - } + { + ASSERT(_hiGoGuid < 0x00FFFFFE && "Gameobject guid overflow!"); + ACORE_GUARD(ACE_Thread_Mutex, _hiGoGuidMutex); + return _hiGoGuid++; + } case HIGHGUID_CORPSE: - { - ASSERT(_hiCorpseGuid < 0xFFFFFFFE && "Corpse guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiCorpseGuidMutex); - return _hiCorpseGuid++; - } + { + ASSERT(_hiCorpseGuid < 0xFFFFFFFE && "Corpse guid overflow!"); + ACORE_GUARD(ACE_Thread_Mutex, _hiCorpseGuidMutex); + return _hiCorpseGuid++; + } case HIGHGUID_DYNAMICOBJECT: - { - ASSERT(_hiDoGuid < 0xFFFFFFFE && "DynamicObject guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiDoGuidMutex); - return _hiDoGuid++; - } + { + ASSERT(_hiDoGuid < 0xFFFFFFFE && "DynamicObject guid overflow!"); + ACORE_GUARD(ACE_Thread_Mutex, _hiDoGuidMutex); + return _hiDoGuid++; + } case HIGHGUID_MO_TRANSPORT: - { - ASSERT(_hiMoTransGuid < 0xFFFFFFFE && "MO Transport guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiMoTransGuidMutex); - return _hiMoTransGuid++; - } + { + ASSERT(_hiMoTransGuid < 0xFFFFFFFE && "MO Transport guid overflow!"); + ACORE_GUARD(ACE_Thread_Mutex, _hiMoTransGuidMutex); + return _hiMoTransGuid++; + } default: ASSERT(false && "ObjectMgr::GenerateLowGuid - Unknown HIGHGUID type"); return 0; @@ -6358,19 +6406,19 @@ uint32 ObjectMgr::GenerateRecycledLowGuid(HighGuid guidHigh) switch (guidHigh) { case HIGHGUID_UNIT: - { - ASSERT(_hiCreatureRecycledGuid < 0x00FFFFFE && "Creature recycled guid overflow!"); - if (_hiCreatureRecycledGuid < _hiCreatureRecycledGuidMax) - return _hiCreatureRecycledGuid++; - break; - } + { + ASSERT(_hiCreatureRecycledGuid < 0x00FFFFFE && "Creature recycled guid overflow!"); + if (_hiCreatureRecycledGuid < _hiCreatureRecycledGuidMax) + return _hiCreatureRecycledGuid++; + break; + } case HIGHGUID_GAMEOBJECT: - { - ASSERT(_hiGoRecycledGuid < 0x00FFFFFE && "Gameobject recycled guid overflow!"); - if (_hiGoRecycledGuid < _hiGoRecycledGuidMax) - return _hiGoRecycledGuid++; - break; - } + { + ASSERT(_hiGoRecycledGuid < 0x00FFFFFE && "Gameobject recycled guid overflow!"); + if (_hiGoRecycledGuid < _hiGoRecycledGuidMax) + return _hiGoRecycledGuid++; + break; + } default: // Default case is not handled by the recycler break; } @@ -6417,7 +6465,7 @@ inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 return; sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.", - goInfo->entry, goInfo->type, N, goInfo->door.lockId, goInfo->door.lockId); + goInfo->entry, goInfo->type, N, goInfo->door.lockId, goInfo->door.lockId); } inline void CheckGOLinkedTrapId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6426,7 +6474,7 @@ inline void CheckGOLinkedTrapId(GameObjectTemplate const* goInfo, uint32 dataN, { if (trapInfo->type != GAMEOBJECT_TYPE_TRAP) sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.", - goInfo->entry, goInfo->type, N, dataN, dataN, GAMEOBJECT_TYPE_TRAP); + goInfo->entry, goInfo->type, N, dataN, dataN, GAMEOBJECT_TYPE_TRAP); } } @@ -6436,16 +6484,16 @@ inline void CheckGOSpellId(GameObjectTemplate const* goInfo, uint32 dataN, uint3 return; sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.", - goInfo->entry, goInfo->type, N, dataN, dataN); + goInfo->entry, goInfo->type, N, dataN, dataN); } inline void CheckAndFixGOChairHeightId(GameObjectTemplate const* goInfo, uint32 const& dataN, uint32 N) { - if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR)) + if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR - UNIT_STAND_STATE_SIT_LOW_CHAIR)) return; sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.", - goInfo->entry, goInfo->type, N, dataN, UNIT_STAND_STATE_SIT_HIGH_CHAIR-UNIT_STAND_STATE_SIT_LOW_CHAIR); + goInfo->entry, goInfo->type, N, dataN, UNIT_STAND_STATE_SIT_HIGH_CHAIR - UNIT_STAND_STATE_SIT_LOW_CHAIR); // prevent client and server unexpected work const_cast<uint32&>(dataN) = 0; @@ -6467,7 +6515,7 @@ inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, ui return; sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.", - goInfo->entry, goInfo->type, N, dataN); + goInfo->entry, goInfo->type, N, dataN); } void ObjectMgr::LoadGameObjectTemplate() @@ -6476,11 +6524,11 @@ void ObjectMgr::LoadGameObjectTemplate() // 0 1 2 3 4 5 6 7 QueryResult result = WorldDatabase.Query("SELECT entry, type, displayId, name, IconName, castBarCaption, unk1, size, " - // 8 9 10 11 12 13 14 15 16 17 18 19 20 - "Data0, Data1, Data2, Data3, Data4, Data5, Data6, Data7, Data8, Data9, Data10, Data11, Data12, " - // 21 22 23 24 25 26 27 28 29 30 31 32 33 - "Data13, Data14, Data15, Data16, Data17, Data18, Data19, Data20, Data21, Data22, Data23, AIName, ScriptName " - "FROM gameobject_template"); + // 8 9 10 11 12 13 14 15 16 17 18 19 20 + "Data0, Data1, Data2, Data3, Data4, Data5, Data6, Data7, Data8, Data9, Data10, Data11, Data12, " + // 21 22 23 24 25 26 27 28 29 30 31 32 33 + "Data13, Data14, Data15, Data16, Data17, Data18, Data19, Data20, Data21, Data22, Data23, AIName, ScriptName " + "FROM gameobject_template"); if (!result) { @@ -6520,137 +6568,136 @@ void ObjectMgr::LoadGameObjectTemplate() switch (got.type) { case GAMEOBJECT_TYPE_DOOR: //0 - { - if (got.door.lockId) - CheckGOLockId(&got, got.door.lockId, 1); - CheckGONoDamageImmuneId(&got, got.door.noDamageImmune, 3); - break; - } + { + if (got.door.lockId) + CheckGOLockId(&got, got.door.lockId, 1); + CheckGONoDamageImmuneId(&got, got.door.noDamageImmune, 3); + break; + } case GAMEOBJECT_TYPE_BUTTON: //1 - { - if (got.button.lockId) - CheckGOLockId(&got, got.button.lockId, 1); - CheckGONoDamageImmuneId(&got, got.button.noDamageImmune, 4); - break; - } + { + if (got.button.lockId) + CheckGOLockId(&got, got.button.lockId, 1); + CheckGONoDamageImmuneId(&got, got.button.noDamageImmune, 4); + break; + } case GAMEOBJECT_TYPE_QUESTGIVER: //2 - { - if (got.questgiver.lockId) - CheckGOLockId(&got, got.questgiver.lockId, 0); - CheckGONoDamageImmuneId(&got, got.questgiver.noDamageImmune, 5); - break; - } + { + if (got.questgiver.lockId) + CheckGOLockId(&got, got.questgiver.lockId, 0); + CheckGONoDamageImmuneId(&got, got.questgiver.noDamageImmune, 5); + break; + } case GAMEOBJECT_TYPE_CHEST: //3 - { - if (got.chest.lockId) - CheckGOLockId(&got, got.chest.lockId, 0); + { + if (got.chest.lockId) + CheckGOLockId(&got, got.chest.lockId, 0); - CheckGOConsumable(&got, got.chest.consumable, 3); + CheckGOConsumable(&got, got.chest.consumable, 3); - if (got.chest.linkedTrapId) // linked trap - CheckGOLinkedTrapId(&got, got.chest.linkedTrapId, 7); - break; - } + if (got.chest.linkedTrapId) // linked trap + CheckGOLinkedTrapId(&got, got.chest.linkedTrapId, 7); + break; + } case GAMEOBJECT_TYPE_TRAP: //6 - { - if (got.trap.lockId) - CheckGOLockId(&got, got.trap.lockId, 0); - break; - } + { + if (got.trap.lockId) + CheckGOLockId(&got, got.trap.lockId, 0); + break; + } case GAMEOBJECT_TYPE_CHAIR: //7 CheckAndFixGOChairHeightId(&got, got.chair.height, 1); break; case GAMEOBJECT_TYPE_SPELL_FOCUS: //8 - { - if (got.spellFocus.focusId) { - if (!sSpellFocusObjectStore.LookupEntry(got.spellFocus.focusId)) - sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.", - entry, got.type, got.spellFocus.focusId, got.spellFocus.focusId); - } + if (got.spellFocus.focusId) + { + if (!sSpellFocusObjectStore.LookupEntry(got.spellFocus.focusId)) + sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.", + entry, got.type, got.spellFocus.focusId, got.spellFocus.focusId); + } - if (got.spellFocus.linkedTrapId) // linked trap - CheckGOLinkedTrapId(&got, got.spellFocus.linkedTrapId, 2); - break; - } + if (got.spellFocus.linkedTrapId) // linked trap + CheckGOLinkedTrapId(&got, got.spellFocus.linkedTrapId, 2); + break; + } case GAMEOBJECT_TYPE_GOOBER: //10 - { - if (got.goober.lockId) - CheckGOLockId(&got, got.goober.lockId, 0); + { + if (got.goober.lockId) + CheckGOLockId(&got, got.goober.lockId, 0); - CheckGOConsumable(&got, got.goober.consumable, 3); + CheckGOConsumable(&got, got.goober.consumable, 3); - if (got.goober.pageId) // pageId - { - if (!GetPageText(got.goober.pageId)) - sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.", - entry, got.type, got.goober.pageId, got.goober.pageId); + if (got.goober.pageId) // pageId + { + if (!GetPageText(got.goober.pageId)) + sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.", + entry, got.type, got.goober.pageId, got.goober.pageId); + } + CheckGONoDamageImmuneId(&got, got.goober.noDamageImmune, 11); + if (got.goober.linkedTrapId) // linked trap + CheckGOLinkedTrapId(&got, got.goober.linkedTrapId, 12); + break; } - CheckGONoDamageImmuneId(&got, got.goober.noDamageImmune, 11); - if (got.goober.linkedTrapId) // linked trap - CheckGOLinkedTrapId(&got, got.goober.linkedTrapId, 12); - break; - } case GAMEOBJECT_TYPE_AREADAMAGE: //12 - { - if (got.areadamage.lockId) - CheckGOLockId(&got, got.areadamage.lockId, 0); - break; - } + { + if (got.areadamage.lockId) + CheckGOLockId(&got, got.areadamage.lockId, 0); + break; + } case GAMEOBJECT_TYPE_CAMERA: //13 - { - if (got.camera.lockId) - CheckGOLockId(&got, got.camera.lockId, 0); - break; - } + { + if (got.camera.lockId) + CheckGOLockId(&got, got.camera.lockId, 0); + break; + } case GAMEOBJECT_TYPE_MO_TRANSPORT: //15 - { - if (got.moTransport.taxiPathId) { - if (got.moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[got.moTransport.taxiPathId].empty()) - sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.", - entry, got.type, got.moTransport.taxiPathId, got.moTransport.taxiPathId); + if (got.moTransport.taxiPathId) + { + if (got.moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[got.moTransport.taxiPathId].empty()) + sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.", + entry, got.type, got.moTransport.taxiPathId, got.moTransport.taxiPathId); + } + if (uint32 transportMap = got.moTransport.mapID) + _transportMaps.insert(transportMap); + break; } - if (uint32 transportMap = got.moTransport.mapID) - _transportMaps.insert(transportMap); - break; - } case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18 break; case GAMEOBJECT_TYPE_SPELLCASTER: //22 - { - // always must have spell - CheckGOSpellId(&got, got.spellcaster.spellId, 0); - break; - } + { + // always must have spell + CheckGOSpellId(&got, got.spellcaster.spellId, 0); + break; + } case GAMEOBJECT_TYPE_FLAGSTAND: //24 - { - if (got.flagstand.lockId) - CheckGOLockId(&got, got.flagstand.lockId, 0); - CheckGONoDamageImmuneId(&got, got.flagstand.noDamageImmune, 5); - break; - } + { + if (got.flagstand.lockId) + CheckGOLockId(&got, got.flagstand.lockId, 0); + CheckGONoDamageImmuneId(&got, got.flagstand.noDamageImmune, 5); + break; + } case GAMEOBJECT_TYPE_FISHINGHOLE: //25 - { - if (got.fishinghole.lockId) - CheckGOLockId(&got, got.fishinghole.lockId, 4); - break; - } + { + if (got.fishinghole.lockId) + CheckGOLockId(&got, got.fishinghole.lockId, 4); + break; + } case GAMEOBJECT_TYPE_FLAGDROP: //26 - { - if (got.flagdrop.lockId) - CheckGOLockId(&got, got.flagdrop.lockId, 0); - CheckGONoDamageImmuneId(&got, got.flagdrop.noDamageImmune, 3); - break; - } + { + if (got.flagdrop.lockId) + CheckGOLockId(&got, got.flagdrop.lockId, 0); + CheckGONoDamageImmuneId(&got, got.flagdrop.noDamageImmune, 3); + break; + } case GAMEOBJECT_TYPE_BARBER_CHAIR: //32 CheckAndFixGOChairHeightId(&got, got.barberChair.chairheight, 0); break; } - ++count; - } - while (result->NextRow()); + ++count; + } while (result->NextRow()); sLog->outString(">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -6681,8 +6728,8 @@ void ObjectMgr::LoadGameObjectTemplateAddons() if (!got) { sLog->outErrorDb( - "GameObject template (Entry: %u) does not exist but has a record in `gameobject_template_addon`", - entry); + "GameObject template (Entry: %u) does not exist but has a record in `gameobject_template_addon`", + entry); continue; } @@ -6695,8 +6742,8 @@ void ObjectMgr::LoadGameObjectTemplateAddons() // checks if (gameObjectAddon.faction && !sFactionTemplateStore.LookupEntry(gameObjectAddon.faction)) sLog->outErrorDb( - "GameObject (Entry: %u) has invalid faction (%u) defined in `gameobject_template_addon`.", - entry, gameObjectAddon.faction); + "GameObject (Entry: %u) has invalid faction (%u) defined in `gameobject_template_addon`.", + entry, gameObjectAddon.faction); if (gameObjectAddon.maxgold > 0) { @@ -6707,15 +6754,14 @@ void ObjectMgr::LoadGameObjectTemplateAddons() break; default: sLog->outErrorDb( - "GameObject (Entry %u GoType: %u) cannot be looted but has maxgold set in `gameobject_template_addon`.", - entry, got->type); + "GameObject (Entry %u GoType: %u) cannot be looted but has maxgold set in `gameobject_template_addon`.", + entry, got->type); break; } } ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u game object template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -6743,8 +6789,7 @@ void ObjectMgr::LoadExplorationBaseXP() uint32 basexp = fields[1].GetInt32(); _baseXPTable[level] = basexp; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -6788,8 +6833,7 @@ void ObjectMgr::LoadPetNames() else _petHalfName0[entry].push_back(word); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -6803,17 +6847,17 @@ void ObjectMgr::LoadPetNumber() if (result) { Field* fields = result->Fetch(); - _hiPetNumber = fields[0].GetUInt32()+1; + _hiPetNumber = fields[0].GetUInt32() + 1; } - sLog->outString(">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(">> Loaded the max pet number: %d in %u ms", _hiPetNumber - 1, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } std::string ObjectMgr::GeneratePetName(uint32 entry) { - StringVector & list0 = _petHalfName0[entry]; - StringVector & list1 = _petHalfName1[entry]; + StringVector& list0 = _petHalfName0[entry]; + StringVector& list1 = _petHalfName1[entry]; if (list0.empty() || list1.empty()) { @@ -6825,7 +6869,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry) return std::string(petname); } - return *(list0.begin()+urand(0, list0.size()-1)) + *(list1.begin()+urand(0, list1.size()-1)); + return *(list0.begin() + urand(0, list0.size() - 1)) + *(list1.begin() + urand(0, list1.size() - 1)); } uint32 ObjectMgr::GeneratePetNumber() @@ -6867,8 +6911,7 @@ void ObjectMgr::LoadCorpses() sObjectAccessor->AddCorpse(corpse); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -6956,8 +6999,7 @@ void ObjectMgr::LoadReputationRewardRate() _repRewardRateStore[factionId] = repRate; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -6973,9 +7015,9 @@ void ObjectMgr::LoadReputationOnKill() // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT creature_id, RewOnKillRepFaction1, RewOnKillRepFaction2, " - // 3 4 5 6 7 8 9 - "IsTeamAward1, MaxStanding1, RewOnKillRepValue1, IsTeamAward2, MaxStanding2, RewOnKillRepValue2, TeamDependent " - "FROM creature_onkill_reputation"); + // 3 4 5 6 7 8 9 + "IsTeamAward1, MaxStanding1, RewOnKillRepValue1, IsTeamAward2, MaxStanding2, RewOnKillRepValue2, TeamDependent " + "FROM creature_onkill_reputation"); if (!result) { @@ -7141,8 +7183,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() _repSpilloverTemplateStore[factionId] = repTemplate; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -7321,8 +7362,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() _spellClickInfoStore.insert(SpellClickInfoContainer::value_type(npc_entry, info)); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); // all spellclick data loaded, now we check if there are creatures with NPC_FLAG_SPELLCLICK but with no data // NOTE: It *CAN* be the other way around: no spellclick flag but with spellclick data, in case of creature-only vehicle accessories @@ -7496,7 +7536,7 @@ void ObjectMgr::LoadReservedPlayersNames() do { fields = result->Fetch(); - std::string name= fields[0].GetString(); + std::string name = fields[0].GetString(); std::wstring wstr; if (!Utf8toWStr (name, wstr)) @@ -7509,8 +7549,7 @@ void ObjectMgr::LoadReservedPlayersNames() _reservedNamesStore.insert(wstr); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -7519,7 +7558,7 @@ void ObjectMgr::LoadReservedPlayersNames() bool ObjectMgr::IsReservedName(const std::string& name) const { // pussywizard - if (name.size() >= 2 && (name[name.size()-2] == 'G' || name[name.size()-2] == 'g') && (name[name.size()-1] == 'M' || name[name.size()-1] == 'm')) + if (name.size() >= 2 && (name[name.size() - 2] == 'G' || name[name.size() - 2] == 'g') && (name[name.size() - 1] == 'M' || name[name.size() - 1] == 'm')) return true; std::wstring wstr; @@ -7623,7 +7662,7 @@ uint8 ObjectMgr::CheckPlayerName(const std::string& name, bool create) wstrToLower(wname); for (size_t i = 2; i < wname.size(); ++i) - if (wname[i] == wname[i-1] && wname[i] == wname[i-2]) + if (wname[i] == wname[i - 1] && wname[i] == wname[i - 2]) return CHAR_NAME_THREE_CONSECUTIVE; return CHAR_NAME_SUCCESS; @@ -7706,45 +7745,45 @@ void ObjectMgr::LoadGameObjectForQuests() ++count; break; case GAMEOBJECT_TYPE_CHEST: - { - // scan GO chest with loot including quest items - uint32 loot_id = (itr->second.GetLootId()); - - // find quest loot for GO - if (itr->second.chest.questId || LootTemplates_Gameobject.HaveQuestLootFor(loot_id)) { - itr->second.IsForQuests = true; - ++count; + // scan GO chest with loot including quest items + uint32 loot_id = (itr->second.GetLootId()); + + // find quest loot for GO + if (itr->second.chest.questId || LootTemplates_Gameobject.HaveQuestLootFor(loot_id)) + { + itr->second.IsForQuests = true; + ++count; + } + break; } - break; - } case GAMEOBJECT_TYPE_GENERIC: - { - if (itr->second._generic.questID > 0) //quests objects { - itr->second.IsForQuests = true; - ++count; + if (itr->second._generic.questID > 0) //quests objects + { + itr->second.IsForQuests = true; + ++count; + } + break; } - break; - } case GAMEOBJECT_TYPE_SPELL_FOCUS: - { - if (itr->second.spellFocus.questID > 0) //quests objects { - itr->second.IsForQuests = true; - ++count; + if (itr->second.spellFocus.questID > 0) //quests objects + { + itr->second.IsForQuests = true; + ++count; + } + break; } - break; - } case GAMEOBJECT_TYPE_GOOBER: - { - if (itr->second.goober.questId > 0) //quests objects { - itr->second.IsForQuests = true; - ++count; + if (itr->second.goober.questId > 0) //quests objects + { + itr->second.IsForQuests = true; + ++count; + } + break; } - break; - } default: break; } @@ -7835,8 +7874,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() _fishingBaseForAreaStore[entry] = skill; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -7872,7 +7910,7 @@ bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& n if (!Utf8toWStr(names.name[i], wname)) return false; - if (mainpart != GetMainPartOfName(wname, i+1)) + if (mainpart != GetMainPartOfName(wname, i + 1)) x = false; if (w_ownname != wname) @@ -7884,7 +7922,7 @@ bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& n uint32 ObjectMgr::GetAreaTriggerScriptId(uint32 trigger_id) { AreaTriggerScriptContainer::const_iterator i = _areaTriggerScriptStore.find(trigger_id); - if (i!= _areaTriggerScriptStore.end()) + if (i != _areaTriggerScriptStore.end()) return i->second; return 0; } @@ -7901,14 +7939,14 @@ int32 ObjectMgr::GetBaseReputationOf(FactionEntry const* factionEntry, uint8 rac return 0; uint32 raceMask = (1 << (race - 1)); - uint32 classMask = (1 << (playerClass-1)); + uint32 classMask = (1 << (playerClass - 1)); for (int i = 0; i < 4; i++) { if ((!factionEntry->BaseRepClassMask[i] || - factionEntry->BaseRepClassMask[i] & classMask) && - (!factionEntry->BaseRepRaceMask[i] || - factionEntry->BaseRepRaceMask[i] & raceMask)) + factionEntry->BaseRepClassMask[i] & classMask) && + (!factionEntry->BaseRepRaceMask[i] || + factionEntry->BaseRepRaceMask[i] & raceMask)) return factionEntry->BaseRepValue[i]; } @@ -7998,8 +8036,7 @@ void ObjectMgr::LoadGameTele() _gameTeleStore[id] = gt; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -8143,8 +8180,7 @@ void ObjectMgr::LoadMailLevelRewards() _mailLevelRewardStore[level].push_back(MailLevelReward(raceMask, mailTemplateId, senderEntry)); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -8209,7 +8245,7 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, trainerSpell.learnedSpell[0] = 0; // player must be able to cast spell on himself if (spellinfo->Effects[i].TargetA.GetTarget() != 0 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ALLY - && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER) + && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER) { sLog->outErrorDb("Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry); continue; @@ -8236,8 +8272,8 @@ void ObjectMgr::LoadTrainerSpell() _cacheTrainerSpellStore.clear(); QueryResult result = WorldDatabase.Query("SELECT b.ID, a.SpellID, a.MoneyCost, a.ReqSkillLine, a.ReqSkillRank, a.ReqLevel FROM npc_trainer AS a " - "INNER JOIN npc_trainer AS b ON a.ID = -(b.SpellID) " - "UNION SELECT * FROM npc_trainer WHERE SpellID > 0"); + "INNER JOIN npc_trainer AS b ON a.ID = -(b.SpellID) " + "UNION SELECT * FROM npc_trainer WHERE SpellID > 0"); if (!result) { @@ -8262,14 +8298,13 @@ void ObjectMgr::LoadTrainerSpell() AddSpellToTrainer(entry, spell, spellCost, reqSkill, reqSkillValue, reqLevel); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } -int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors) +int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32>* skip_vendors) { // find all items from the reference vendor PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_NPC_VENDOR_REF); @@ -8353,8 +8388,7 @@ void ObjectMgr::LoadVendors() vList.AddItem(item_id, maxcount, incrtime, ExtendedCost); ++count; } - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -8405,9 +8439,9 @@ void ObjectMgr::LoadGossipMenuItems() _gossipMenuItemsStore.clear(); QueryResult result = WorldDatabase.Query( - // 0 1 2 3 4 5 6 7 8 9 10 11 12 - "SELECT MenuID, OptionID, OptionIcon, OptionText, OptionBroadcastTextID, OptionType, OptionNpcFlag, ActionMenuID, ActionPoiID, BoxCoded, BoxMoney, BoxText, BoxBroadcastTextID " - "FROM gossip_menu_option ORDER BY MenuID, OptionID"); + // 0 1 2 3 4 5 6 7 8 9 10 11 12 + "SELECT MenuID, OptionID, OptionIcon, OptionText, OptionBroadcastTextID, OptionType, OptionNpcFlag, ActionMenuID, ActionPoiID, BoxCoded, BoxMoney, BoxText, BoxBroadcastTextID " + "FROM gossip_menu_option ORDER BY MenuID, OptionID"); if (!result) { @@ -8598,29 +8632,29 @@ void ObjectMgr::LoadScriptNames() _scriptNamesStore.push_back(""); QueryResult result = WorldDatabase.Query( - "SELECT DISTINCT(ScriptName) FROM achievement_criteria_data WHERE ScriptName <> '' AND type = 11 " - "UNION " - "SELECT DISTINCT(ScriptName) FROM battleground_template WHERE ScriptName <> '' " - "UNION " - "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 areatrigger_scripts WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM spell_script_names WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM transports WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM game_weather WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM conditions WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(ScriptName) FROM outdoorpvp_template WHERE ScriptName <> '' " - "UNION " - "SELECT DISTINCT(script) FROM instance_template WHERE script <> ''"); + "SELECT DISTINCT(ScriptName) FROM achievement_criteria_data WHERE ScriptName <> '' AND type = 11 " + "UNION " + "SELECT DISTINCT(ScriptName) FROM battleground_template WHERE ScriptName <> '' " + "UNION " + "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 areatrigger_scripts WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM spell_script_names WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM transports WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM game_weather WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM conditions WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(ScriptName) FROM outdoorpvp_template WHERE ScriptName <> '' " + "UNION " + "SELECT DISTINCT(script) FROM instance_template WHERE script <> ''"); if (!result) { @@ -8635,15 +8669,14 @@ void ObjectMgr::LoadScriptNames() { _scriptNamesStore.push_back((*result)[0].GetString()); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end()); sLog->outString(">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } -uint32 ObjectMgr::GetScriptId(const char *name) +uint32 ObjectMgr::GetScriptId(const char* name) { // use binary search to find the script name in the sorted vector // assume "" is the first element @@ -8737,8 +8770,7 @@ void ObjectMgr::LoadBroadcastTexts() } _broadcastTextStore[bct.Id] = bct; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded " SZFMTD " broadcast texts in %u ms", _broadcastTextStore.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -8780,8 +8812,7 @@ void ObjectMgr::LoadBroadcastTextLocales() AddLocaleString(MaleText, locale, bct->second.MaleText); AddLocaleString(FemaleText, locale, bct->second.FemaleText); - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u Broadcast Text Locales in %u ms", uint32(_broadcastTextStore.size()), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -8880,8 +8911,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() _creatureBaseStatsStore[MAKE_PAIR16(Level, Class)] = stats; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates(); for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr) @@ -8927,8 +8957,7 @@ void ObjectMgr::LoadFactionChangeAchievements() FactionChangeAchievements[alliance] = horde; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -8964,8 +8993,7 @@ void ObjectMgr::LoadFactionChangeItems() FactionChangeItems[alliance] = horde; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -9001,8 +9029,7 @@ void ObjectMgr::LoadFactionChangeQuests() FactionChangeQuests[alliance] = horde; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u faction change quest pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -9038,8 +9065,7 @@ void ObjectMgr::LoadFactionChangeReputations() FactionChangeReputation[alliance] = horde; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -9075,8 +9101,7 @@ void ObjectMgr::LoadFactionChangeSpells() FactionChangeSpells[alliance] = horde; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -9111,8 +9136,7 @@ void ObjectMgr::LoadFactionChangeTitles() FactionChangeTitles[alliance] = horde; ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u faction change title pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); @@ -9206,8 +9230,7 @@ void ObjectMgr::LoadGameObjectQuestItems() _gameObjectQuestItemStore[entry].push_back(item); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u gameobject quest items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } @@ -9236,8 +9259,7 @@ void ObjectMgr::LoadCreatureQuestItems() _creatureQuestItemStore[entry].push_back(item); ++count; - } - while (result->NextRow()); + } while (result->NextRow()); sLog->outString(">> Loaded %u creature quest items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } |