|
|
|
@@ -701,7 +701,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
|
|
|
|
|
else if (!displayScaleEntry)
|
|
|
|
|
displayScaleEntry = displayEntry;
|
|
|
|
|
|
|
|
|
|
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2);;
|
|
|
|
|
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2);
|
|
|
|
|
if (!modelInfo)
|
|
|
|
|
sLog->outErrorDb("No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry);
|
|
|
|
|
}
|
|
|
|
@@ -733,7 +733,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
|
|
|
|
|
else if (!displayScaleEntry)
|
|
|
|
|
displayScaleEntry = displayEntry;
|
|
|
|
|
|
|
|
|
|
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4);;
|
|
|
|
|
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4);
|
|
|
|
|
if (!modelInfo)
|
|
|
|
|
sLog->outErrorDb("No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry);
|
|
|
|
|
}
|
|
|
|
@@ -1071,25 +1071,25 @@ void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcfl
|
|
|
|
|
|
|
|
|
|
CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* displayID)
|
|
|
|
|
{
|
|
|
|
|
CreatureModelInfo const* minfo = GetCreatureModelInfo(*displayID);
|
|
|
|
|
if (!minfo)
|
|
|
|
|
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(*displayID);
|
|
|
|
|
if (!modelInfo)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
// If a model for another gender exists, 50% chance to use it
|
|
|
|
|
if (minfo->modelid_other_gender != 0 && urand(0, 1) == 0)
|
|
|
|
|
if (modelInfo->modelid_other_gender != 0 && urand(0, 1) == 0)
|
|
|
|
|
{
|
|
|
|
|
CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(minfo->modelid_other_gender);
|
|
|
|
|
CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender);
|
|
|
|
|
if (!minfo_tmp)
|
|
|
|
|
sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, minfo->modelid_other_gender);
|
|
|
|
|
sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Model ID changed
|
|
|
|
|
*displayID = minfo->modelid_other_gender;
|
|
|
|
|
*displayID = modelInfo->modelid_other_gender;
|
|
|
|
|
return minfo_tmp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return minfo;
|
|
|
|
|
return modelInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ObjectMgr::LoadCreatureModelInfo()
|
|
|
|
@@ -1327,7 +1327,6 @@ void ObjectMgr::LoadLinkedRespawn()
|
|
|
|
|
|
|
|
|
|
if (!error)
|
|
|
|
|
_linkedRespawnStore[guid] = linkedGuid;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
while (result->NextRow());
|
|
|
|
|
|
|
|
|
@@ -1821,7 +1820,6 @@ void ObjectMgr::LoadGameobjects()
|
|
|
|
|
if (gameEvent == 0 && PoolId == 0) // if not this is to be managed by GameEvent System or Pool system
|
|
|
|
|
AddGameobjectToGrid(guid, &data);
|
|
|
|
|
++count;
|
|
|
|
|
|
|
|
|
|
} while (result->NextRow());
|
|
|
|
|
|
|
|
|
|
sLog->outString(">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
|
|
|
|
@@ -2628,7 +2626,7 @@ void ObjectMgr::LoadItemTemplates()
|
|
|
|
|
|
|
|
|
|
uint32 item_id = entry->ItemId[j];
|
|
|
|
|
|
|
|
|
|
if (!sObjectMgr->GetItemTemplate(item_id))
|
|
|
|
|
if (!GetItemTemplate(item_id))
|
|
|
|
|
notFoundOutfit.insert(item_id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -3131,7 +3129,7 @@ void ObjectMgr::LoadPlayerInfo()
|
|
|
|
|
|
|
|
|
|
uint32 item_id = fields[2].GetUInt32();
|
|
|
|
|
|
|
|
|
|
if (!sObjectMgr->GetItemTemplate(item_id))
|
|
|
|
|
if (!GetItemTemplate(item_id))
|
|
|
|
|
{
|
|
|
|
|
sLog->outErrorDb("Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class);
|
|
|
|
|
continue;
|
|
|
|
@@ -3694,7 +3692,7 @@ void ObjectMgr::LoadQuests()
|
|
|
|
|
{
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
|
|
|
|
|
Quest * newQuest = new Quest(fields);
|
|
|
|
|
Quest* newQuest = new Quest(fields);
|
|
|
|
|
_questTemplates[newQuest->GetQuestId()] = newQuest;
|
|
|
|
|
} while (result->NextRow());
|
|
|
|
|
|
|
|
|
@@ -3712,9 +3710,7 @@ void ObjectMgr::LoadQuests()
|
|
|
|
|
// additional quest integrity checks (GO, creature_template and item_template must be loaded already)
|
|
|
|
|
|
|
|
|
|
if (qinfo->GetQuestMethod() >= 3)
|
|
|
|
|
{
|
|
|
|
|
sLog->outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (qinfo->Flags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED)
|
|
|
|
|
{
|
|
|
|
@@ -4401,7 +4397,6 @@ void ObjectMgr::LoadScripts(ScriptsType type)
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
ScriptInfo tmp;
|
|
|
|
|
tmp.type = type;
|
|
|
|
@@ -4810,8 +4805,8 @@ 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)
|
|
|
|
@@ -5164,7 +5159,6 @@ void ObjectMgr::LoadGossipText()
|
|
|
|
|
int count = 0;
|
|
|
|
|
if (!result)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
sLog->outString(">> Loaded %u npc texts", count);
|
|
|
|
|
sLog->outString();
|
|
|
|
|
return;
|
|
|
|
@@ -5299,7 +5293,6 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
|
|
|
|
uint32 returnedCount = 0;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
Mail* m = new Mail;
|
|
|
|
|
m->messageID = fields[0].GetUInt32();
|
|
|
|
@@ -5618,7 +5611,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// minfo is not actually used but the mount_id was updated
|
|
|
|
|
sObjectMgr->GetCreatureModelRandomGender(&mount_id);
|
|
|
|
|
GetCreatureModelRandomGender(&mount_id);
|
|
|
|
|
|
|
|
|
|
return mount_id;
|
|
|
|
|
}
|
|
|
|
@@ -5766,10 +5759,10 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
|
|
|
|
|
if (MapId != entry->map_id)
|
|
|
|
|
{
|
|
|
|
|
// if find graveyard at different map from where entrance placed (or no entrance data), use any first
|
|
|
|
|
if (!mapEntry ||
|
|
|
|
|
mapEntry->entrance_map < 0 ||
|
|
|
|
|
uint32(mapEntry->entrance_map) != entry->map_id ||
|
|
|
|
|
(mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0))
|
|
|
|
|
if (!mapEntry
|
|
|
|
|
|| mapEntry->entrance_map < 0
|
|
|
|
|
|| uint32(mapEntry->entrance_map) != entry->map_id
|
|
|
|
|
|| (mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0))
|
|
|
|
|
{
|
|
|
|
|
// not have any corrdinates for check distance anyway
|
|
|
|
|
entryFar = entry;
|
|
|
|
@@ -5914,8 +5907,6 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool
|
|
|
|
|
|
|
|
|
|
WorldDatabase.Execute(stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ObjectMgr::LoadAreaTriggerTeleports()
|
|
|
|
@@ -6019,7 +6010,7 @@ void ObjectMgr::LoadAccessRequirements()
|
|
|
|
|
|
|
|
|
|
if (ar.item)
|
|
|
|
|
{
|
|
|
|
|
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ar.item);
|
|
|
|
|
ItemTemplate const* pProto = GetItemTemplate(ar.item);
|
|
|
|
|
if (!pProto)
|
|
|
|
|
{
|
|
|
|
|
sLog->outError("Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item, mapid, difficulty);
|
|
|
|
@@ -6029,7 +6020,7 @@ void ObjectMgr::LoadAccessRequirements()
|
|
|
|
|
|
|
|
|
|
if (ar.item2)
|
|
|
|
|
{
|
|
|
|
|
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ar.item2);
|
|
|
|
|
ItemTemplate const* pProto = GetItemTemplate(ar.item2);
|
|
|
|
|
if (!pProto)
|
|
|
|
|
{
|
|
|
|
|
sLog->outError("Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item2, mapid, difficulty);
|
|
|
|
@@ -6136,10 +6127,10 @@ void ObjectMgr::SetHighestGuids()
|
|
|
|
|
_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
|
|
|
|
|
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '%u'", _hiItemGuid); // One-time query
|
|
|
|
|
CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '%u'", _hiItemGuid); // One-time query
|
|
|
|
|
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", _hiItemGuid); // One-time query
|
|
|
|
|
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '%u'", _hiItemGuid);
|
|
|
|
|
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '%u'", _hiItemGuid);
|
|
|
|
|
CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '%u'", _hiItemGuid);
|
|
|
|
|
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", _hiItemGuid);
|
|
|
|
|
|
|
|
|
|
result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject");
|
|
|
|
|
if (result)
|
|
|
|
@@ -6416,14 +6407,10 @@ void ObjectMgr::LoadGameObjectTemplate()
|
|
|
|
|
got.size = fields[9].GetFloat();
|
|
|
|
|
|
|
|
|
|
for (uint8 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
|
|
|
|
|
{
|
|
|
|
|
got.questItems[i] = fields[10 + i].GetUInt32();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i)
|
|
|
|
|
{
|
|
|
|
|
got.raw.data[i] = fields[16 + i].GetUInt32();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
got.AIName = fields[40].GetString();
|
|
|
|
|
got.ScriptId = GetScriptId(fields[41].GetCString());
|
|
|
|
@@ -6584,7 +6571,6 @@ void ObjectMgr::LoadExplorationBaseXP()
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
uint8 level = fields[0].GetUInt8();
|
|
|
|
|
uint32 basexp = fields[1].GetUInt32();
|
|
|
|
@@ -6626,7 +6612,6 @@ void ObjectMgr::LoadPetNames()
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
std::string word = fields[0].GetString();
|
|
|
|
|
uint32 entry = fields[1].GetUInt32();
|
|
|
|
@@ -6739,7 +6724,6 @@ void ObjectMgr::LoadReputationRewardRate()
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
|
|
|
|
|
uint32 factionId = fields[0].GetUInt32();
|
|
|
|
@@ -6877,7 +6861,6 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
|
|
|
|
|
uint32 factionId = fields[0].GetUInt32();
|
|
|
|
@@ -7051,7 +7034,6 @@ void ObjectMgr::LoadQuestPOI()
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
fields = points->Fetch();
|
|
|
|
|
|
|
|
|
|
uint32 questId = fields[0].GetUInt32();
|
|
|
|
@@ -7176,7 +7158,7 @@ void ObjectMgr::SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t
|
|
|
|
|
_creatureRespawnTimesMutex.release();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN);
|
|
|
|
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN);
|
|
|
|
|
stmt->setUInt32(0, loguid);
|
|
|
|
|
stmt->setUInt64(1, uint64(t));
|
|
|
|
|
stmt->setUInt32(2, instance);
|
|
|
|
@@ -7330,7 +7312,6 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
uint32 id = result->Fetch()[0].GetUInt32();
|
|
|
|
|
uint32 quest = result->Fetch()[1].GetUInt32();
|
|
|
|
|
uint32 poolId = result->Fetch()[2].GetUInt32();
|
|
|
|
@@ -7653,7 +7634,7 @@ void ObjectMgr::LoadGameObjectForQuests()
|
|
|
|
|
sLog->outString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max_value)
|
|
|
|
|
bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value)
|
|
|
|
|
{
|
|
|
|
|
uint32 oldMSTime = getMSTime();
|
|
|
|
|
|
|
|
|
@@ -7695,7 +7676,6 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max
|
|
|
|
|
|
|
|
|
|
if (!result)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings
|
|
|
|
|
sLog->outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
|
|
|
|
|
else
|
|
|
|
@@ -7783,7 +7763,6 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
uint32 entry = fields[0].GetUInt32();
|
|
|
|
|
int32 skill = fields[1].GetInt32();
|
|
|
|
@@ -7813,7 +7792,7 @@ bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& n
|
|
|
|
|
bool y = true;
|
|
|
|
|
|
|
|
|
|
// check declined names
|
|
|
|
|
for (uint8 i =0; i < MAX_DECLINED_NAME_CASES; ++i)
|
|
|
|
|
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
|
|
|
|
|
{
|
|
|
|
|
std::wstring wname;
|
|
|
|
|
if (!Utf8toWStr(names.name[i], wname))
|
|
|
|
@@ -7892,7 +7871,6 @@ void ObjectMgr::LoadGameTele()
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
|
|
|
|
|
uint32 id = fields[0].GetUInt32();
|
|
|
|
@@ -7935,7 +7913,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
|
|
|
|
|
// explicit name case
|
|
|
|
|
std::wstring wname;
|
|
|
|
|
if (!Utf8toWStr(name, wname))
|
|
|
|
|
return false;
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
// converting string that we try to find to lower case
|
|
|
|
|
wstrToLower(wname);
|
|
|
|
@@ -8033,7 +8011,6 @@ void ObjectMgr::LoadMailLevelRewards()
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
|
|
|
|
|
uint8 level = fields[0].GetUInt8();
|
|
|
|
@@ -8177,7 +8154,6 @@ void ObjectMgr::LoadTrainerSpell()
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
|
|
|
|
|
uint32 entry = fields[0].GetUInt32();
|
|
|
|
@@ -8189,8 +8165,7 @@ void ObjectMgr::LoadTrainerSpell()
|
|
|
|
|
|
|
|
|
|
AddSpellToTrainer(entry, spell, spellCost, reqSkill, reqSkillValue, reqLevel);
|
|
|
|
|
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
|
|
++count;
|
|
|
|
|
}
|
|
|
|
|
while (result->NextRow());
|
|
|
|
|
|
|
|
|
@@ -8229,7 +8204,6 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s
|
|
|
|
|
vList.AddItem(item_id, maxcount, incrtime, ExtendedCost);
|
|
|
|
|
++count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} while (result->NextRow());
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
@@ -8280,7 +8254,6 @@ void ObjectMgr::LoadVendors()
|
|
|
|
|
vList.AddItem(item_id, maxcount, incrtime, ExtendedCost);
|
|
|
|
|
++count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
while (result->NextRow());
|
|
|
|
|
|
|
|
|
@@ -8307,7 +8280,6 @@ void ObjectMgr::LoadGossipMenu()
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Field* fields = result->Fetch();
|
|
|
|
|
|
|
|
|
|
GossipMenus gMenu;
|
|
|
|
@@ -8626,7 +8598,7 @@ void ObjectMgr::LoadDbScriptStrings()
|
|
|
|
|
sLog->outErrorDb("Table `db_script_string` has unused string id %u", *itr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool LoadTrinityStrings(char const* table, int32 start_value, int32 end_value)
|
|
|
|
|
bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value)
|
|
|
|
|
{
|
|
|
|
|
// MAX_DB_SCRIPT_STRING_ID is max allowed negative value for scripts (scrpts can use only more deep negative values
|
|
|
|
|
// start/end reversed for negative values
|
|
|
|
|