diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rwxr-xr-x | src/server/game/Globals/ObjectMgr.cpp | 86 |
1 files changed, 44 insertions, 42 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 61c47779c85..63a02378787 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1171,6 +1171,7 @@ void ObjectMgr::LoadLinkedRespawn() uint32 oldMSTime = getMSTime(); _linkedRespawnStore.clear(); + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT guid, linkedGuid, linkType FROM linked_respawn ORDER BY guid ASC"); if (!result) @@ -2730,7 +2731,8 @@ void ObjectMgr::LoadItemSetNames() if (setEntry->itemId[i]) itemSetItems.insert(setEntry->itemId[i]); } - + + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT `entry`, `name`, `InventoryType` FROM `item_set_names`"); if (!result) @@ -2757,7 +2759,7 @@ void ObjectMgr::LoadItemSetNames() ItemSetNameEntry &data = _itemSetNameStore[entry]; data.name = fields[1].GetString(); - uint32 invType = fields[2].GetUInt32(); + uint32 invType = fields[2].GetUInt8(); if (invType >= MAX_INVTYPE) { sLog->outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType); @@ -2899,7 +2901,7 @@ void ObjectMgr::LoadPetLevelInfo() uint32 oldMSTime = getMSTime(); // 0 1 2 3 4 5 6 7 8 9 - QueryResult result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats"); + QueryResult result = WorldDatabase.Query("SELECT creature_entry, level, hp, mana, str, agi, sta, inte, spi, armor FROM pet_levelstats"); if (!result) { @@ -2921,7 +2923,7 @@ void ObjectMgr::LoadPetLevelInfo() continue; } - uint32 current_level = fields[1].GetUInt32(); + uint32 current_level = fields[1].GetUInt8(); if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum @@ -2949,7 +2951,7 @@ void ObjectMgr::LoadPetLevelInfo() pLevelInfo->health = fields[2].GetUInt16(); pLevelInfo->mana = fields[3].GetUInt16(); - pLevelInfo->armor = fields[9].GetUInt16(); + pLevelInfo->armor = fields[9].GetUInt32(); for (int i = 0; i < MAX_STATS; i++) { @@ -3045,7 +3047,7 @@ void ObjectMgr::LoadPlayerInfo() // Load playercreate { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 6 + // 0 1 2 3 4 5 6 QueryResult result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z, orientation FROM playercreateinfo"); if (!result) @@ -3062,10 +3064,10 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_race = fields[0].GetUInt32(); - uint32 current_class = fields[1].GetUInt32(); - uint32 mapId = fields[2].GetUInt32(); - uint32 areaId = fields[3].GetUInt32(); + uint32 current_race = fields[0].GetUInt8(); + uint32 current_class = fields[1].GetUInt8(); + uint32 mapId = fields[2].GetUInt16(); + uint32 areaId = fields[3].GetUInt32(); // zone float positionX = fields[4].GetFloat(); float positionY = fields[5].GetFloat(); float positionZ = fields[6].GetFloat(); @@ -3150,14 +3152,14 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_race = fields[0].GetUInt32(); + uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { sLog->outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race); continue; } - uint32 current_class = fields[1].GetUInt32(); + uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { sLog->outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class); @@ -3172,7 +3174,7 @@ void ObjectMgr::LoadPlayerInfo() continue; } - int32 amount = fields[3].GetInt32(); + int32 amount = fields[3].GetInt8(); if (!amount) { @@ -3207,11 +3209,8 @@ void ObjectMgr::LoadPlayerInfo() { uint32 oldMSTime = getMSTime(); - QueryResult result = QueryResult(NULL); - if (sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS)) - result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom"); - else - result = WorldDatabase.Query("SELECT race, class, Spell FROM playercreateinfo_spell"); + std::string tableName = sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"; + QueryResult result = WorldDatabase.PQuery("SELECT race, class, Spell FROM %s", tableName); if (!result) { @@ -3226,14 +3225,14 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_race = fields[0].GetUInt32(); + uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { sLog->outErrorDb("Wrong race %u in `playercreateinfo_spell` table, ignoring.", current_race); continue; } - uint32 current_class = fields[1].GetUInt32(); + uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { sLog->outErrorDb("Wrong class %u in `playercreateinfo_spell` table, ignoring.", current_class); @@ -3283,14 +3282,14 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_race = fields[0].GetUInt32(); + uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { sLog->outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race); continue; } - uint32 current_class = fields[1].GetUInt32(); + uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { sLog->outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class); @@ -3298,7 +3297,7 @@ void ObjectMgr::LoadPlayerInfo() } PlayerInfo* pInfo = &_playerInfo[current_race][current_class]; - pInfo->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt8(), fields[3].GetUInt32(), fields[4].GetUInt8())); + pInfo->action.push_back(PlayerCreateInfoAction(fields[2].GetUInt16(), fields[3].GetUInt32(), fields[4].GetUInt16())); ++count; } @@ -3330,7 +3329,7 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_class = fields[0].GetUInt32(); + uint32 current_class = fields[0].GetUInt8(); if (current_class >= MAX_CLASSES) { sLog->outErrorDb("Wrong class %u in `player_classlevelstats` table, ignoring.", current_class); @@ -3411,21 +3410,21 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_race = fields[0].GetUInt32(); + uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { sLog->outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.", current_race); continue; } - uint32 current_class = fields[1].GetUInt32(); + uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { sLog->outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.", current_class); continue; } - uint32 current_level = fields[2].GetUInt32(); + uint32 current_level = fields[2].GetUInt8(); if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum @@ -3529,7 +3528,7 @@ void ObjectMgr::LoadPlayerInfo() { Field* fields = result->Fetch(); - uint32 current_level = fields[0].GetUInt32(); + uint32 current_level = fields[0].GetUInt8(); uint32 current_xp = fields[1].GetUInt32(); if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) @@ -4419,9 +4418,8 @@ void ObjectMgr::LoadScripts(ScriptsType type) scripts->clear(); // need for reload support bool isSpellScriptTable = (type == SCRIPTS_SPELL); - char buff[125]; - sprintf(buff, "SELECT id, delay, command, datalong, datalong2, dataint, x, y, z, o%s FROM %s", isSpellScriptTable ? ", effIndex" : "", tableName.c_str()); - QueryResult result = WorldDatabase.Query(buff); + // 0 1 2 3 4 5 6 7 8 9 + QueryResult result = WorldDatabase.PQuery("SELECT id, delay, command, datalong, datalong2, dataint, x, y, z, o%s FROM %s", isSpellScriptTable ? ", effIndex" : "", tableName.c_str()); if (!result) { @@ -4976,6 +4974,7 @@ void ObjectMgr::LoadPageTexts() { uint32 oldMSTime = getMSTime(); + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT entry, text, next_page FROM page_text"); if (!result) @@ -4993,7 +4992,7 @@ void ObjectMgr::LoadPageTexts() PageText& pageText = _pageTextStore[fields[0].GetUInt32()]; pageText.Text = fields[1].GetString(); - pageText.NextPage = fields[2].GetInt16(); + pageText.NextPage = fields[2].GetUInt32(); ++count; } @@ -5054,6 +5053,7 @@ void ObjectMgr::LoadInstanceTemplate() { uint32 oldMSTime = getMSTime(); + // 0 1 2 4 QueryResult result = WorldDatabase.Query("SELECT map, parent, script, allowMount FROM instance_template"); if (!result) @@ -5105,6 +5105,7 @@ void ObjectMgr::LoadInstanceEncounters() { uint32 oldMSTime = getMSTime(); + // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters"); if (!result) { @@ -5121,7 +5122,7 @@ void ObjectMgr::LoadInstanceEncounters() uint32 entry = fields[0].GetUInt32(); uint8 creditType = fields[1].GetUInt8(); uint32 creditEntry = fields[2].GetUInt32(); - uint32 lastEncounterDungeon = fields[3].GetUInt32(); + uint32 lastEncounterDungeon = fields[3].GetUInt16(); DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry); if (!dungeonEncounter) { @@ -5227,13 +5228,13 @@ void ObjectMgr::LoadGossipText() gText.Options[i].Text_0 = fields[cic++].GetString(); gText.Options[i].Text_1 = fields[cic++].GetString(); - gText.Options[i].Language = fields[cic++].GetUInt32(); + gText.Options[i].Language = fields[cic++].GetUInt8(); gText.Options[i].Probability = fields[cic++].GetFloat(); for (uint8 j=0; j < MAX_GOSSIP_TEXT_EMOTES; ++j) { - gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt32(); - gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt32(); + gText.Options[i].Emotes[j]._Delay = fields[cic++].GetUInt16(); + gText.Options[i].Emotes[j]._Emote = fields[cic++].GetUInt16(); } } } while (result->NextRow()); @@ -6638,7 +6639,7 @@ uint32 ObjectMgr::GetXPForLevel(uint8 level) void ObjectMgr::LoadPetNames() { uint32 oldMSTime = getMSTime(); - + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT word, entry, half FROM pet_name_generation"); if (!result) @@ -7003,7 +7004,7 @@ void ObjectMgr::LoadPointsOfInterest() uint32 count = 0; - // 0 1 2 3 4 5 6 + // 0 1 2 3 4 5 6 QueryResult result = WorldDatabase.Query("SELECT entry, x, y, icon, flags, data, icon_name FROM points_of_interest"); if (!result) @@ -7155,7 +7156,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() if (userType >= SPELL_CLICK_USER_MAX) sLog->outErrorDb("Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType)); - uint8 castFlags = fields[2].GetUInt8(); + uint8 castFlags = fields[2].GetUInt16(); SpellClickInfo info; info.spellId = spellid; info.castFlags = castFlags; @@ -8039,6 +8040,7 @@ void ObjectMgr::LoadMailLevelRewards() _mailLevelRewardStore.clear(); // for reload case + // 0 1 2 3 QueryResult result = WorldDatabase.Query("SELECT level, raceMask, mailTemplateId, senderEntry FROM mail_level_reward"); if (!result) @@ -8200,9 +8202,9 @@ void ObjectMgr::LoadTrainerSpell() uint32 entry = fields[0].GetUInt32(); uint32 spell = fields[1].GetUInt32(); uint32 spellCost = fields[2].GetUInt32(); - uint32 reqSkill = fields[3].GetUInt32(); - uint32 reqSkillValue = fields[4].GetUInt32(); - uint32 reqLevel = fields[5].GetUInt32(); + uint32 reqSkill = fields[3].GetUInt16(); + uint32 reqSkillValue = fields[4].GetUInt16(); + uint32 reqLevel = fields[5].GetUInt8(); AddSpellToTrainer(entry, spell, spellCost, reqSkill, reqSkillValue, reqLevel); |