diff options
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index c52622bd966..aec1bba1e65 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1857,8 +1857,7 @@ void ObjectMgr::LoadCreatures() if (data.phaseid) { - PhaseEntry const* phase = sPhaseStore.LookupEntry(data.phaseid); - if (!phase) + if (!sPhaseStore.LookupEntry(data.phaseid)) { TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: " UI64FMTD " Entry: %u) with `phaseid` %u does not exist, set to 0", guid, data.id, data.phaseid); data.phaseid = 0; @@ -2144,8 +2143,7 @@ void ObjectMgr::LoadGameobjects() if (data.phaseid) { - PhaseEntry const* phase = sPhaseStore.LookupEntry(data.phaseid); - if (!phase) + if (!sPhaseStore.LookupEntry(data.phaseid)) { TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: " UI64FMTD " Entry: %u) with `phaseid` %u does not exist, set to 0", guid, data.id, data.phaseid); data.phaseid = 0; @@ -2626,13 +2624,13 @@ void ObjectMgr::LoadItemTemplates() for (auto itr = sItemSparseStore.begin(); itr != sItemSparseStore.end(); ++itr) { - ItemSparseEntry const* sparse = itr->second; - ItemEntry const* db2Data = sItemStore.LookupEntry(itr->first); + ItemSparseEntry const* sparse = itr.Data(); + ItemEntry const* db2Data = sItemStore.LookupEntry(itr.ID()); if (!db2Data) continue; - ItemTemplate& itemTemplate = _itemTemplateStore[itr->first]; - itemTemplate.Id = itr->first; + ItemTemplate& itemTemplate = _itemTemplateStore[itr.ID()]; + itemTemplate.Id = itr.ID(); itemTemplate.BasicData = db2Data; itemTemplate.ExtendedData = sparse; @@ -5284,7 +5282,7 @@ void ObjectMgr::LoadInstanceEncounters() } uint32 count = 0; - std::map<uint32, DungeonEncounterEntry const*> dungeonLastBosses; + std::map<uint32, std::pair<uint32, DungeonEncounterEntry const*>> dungeonLastBosses; do { Field* fields = result->Fetch(); @@ -5301,20 +5299,22 @@ void ObjectMgr::LoadInstanceEncounters() if (lastEncounterDungeon && !sLFGMgr->GetLFGDungeonEntry(lastEncounterDungeon)) { - TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->Name_lang, lastEncounterDungeon); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", + entry, dungeonEncounter->Name->Str[sWorld->GetDefaultDbcLocale()], lastEncounterDungeon); continue; } - std::map<uint32, DungeonEncounterEntry const*>::const_iterator itr = dungeonLastBosses.find(lastEncounterDungeon); + std::map<uint32, std::pair<uint32, DungeonEncounterEntry const*>>::const_iterator itr = dungeonLastBosses.find(lastEncounterDungeon); if (lastEncounterDungeon) { if (itr != dungeonLastBosses.end()) { - TC_LOG_ERROR("sql.sql", "Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->Name_lang, itr->second->ID, itr->second->Name_lang); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", + entry, dungeonEncounter->Name->Str[sWorld->GetDefaultDbcLocale()], itr->second.first, itr->second.second->Name->Str[sWorld->GetDefaultDbcLocale()]); continue; } - dungeonLastBosses[lastEncounterDungeon] = dungeonEncounter; + dungeonLastBosses[lastEncounterDungeon] = std::make_pair(entry, dungeonEncounter); } switch (creditType) @@ -5324,7 +5324,8 @@ void ObjectMgr::LoadInstanceEncounters() CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry); if (!creatureInfo) { - TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->Name_lang); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", + creditEntry, entry, dungeonEncounter->Name->Str[sWorld->GetDefaultDbcLocale()]); continue; } const_cast<CreatureTemplate*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS; @@ -5333,12 +5334,14 @@ void ObjectMgr::LoadInstanceEncounters() case ENCOUNTER_CREDIT_CAST_SPELL: if (!sSpellMgr->GetSpellInfo(creditEntry)) { - TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->Name_lang); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", + creditEntry, entry, dungeonEncounter->Name->Str[sWorld->GetDefaultDbcLocale()]); continue; } break; default: - TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->Name_lang); + TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", + creditType, entry, dungeonEncounter->Name->Str[sWorld->GetDefaultDbcLocale()]); continue; } @@ -6894,7 +6897,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry) if (!cinfo) return std::string(); - char const* petname = GetCreatureFamilyPetName(cinfo->family, sWorld->GetDefaultDbcLocale()); + char const* petname = DB2Manager::GetCreatureFamilyPetName(cinfo->family, sWorld->GetDefaultDbcLocale()); if (petname) return std::string(petname); else @@ -9025,8 +9028,7 @@ void ObjectMgr::LoadTerrainPhaseInfo() uint32 phaseId = fields[0].GetUInt32(); - PhaseEntry const* phase = sPhaseStore.LookupEntry(phaseId); - if (!phase) + if (!sPhaseStore.LookupEntry(phaseId)) { TC_LOG_ERROR("sql.sql", "Phase %u defined in `terrain_phase_info` does not exist, skipped.", phaseId); continue; |