diff options
author | 天鹭 <18535853+PkllonG@users.noreply.github.com> | 2025-07-29 20:11:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-29 09:11:25 -0300 |
commit | 0abb99852932d6e7a1b04d8ad8fc0e3902a1f5f1 (patch) | |
tree | ee89631a13dbf8ef4e9d0f5d35b8c68cc98d779d /src/server/game/Globals/ObjectMgr.cpp | |
parent | 57dacae38b37f1230fa6bea03252d345cb7cf4dd (diff) |
refactor(Core): Clean (#22583)
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 911749df0c..d3c07ed21f 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -871,7 +871,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() uint32 entry = fields[0].Get<uint32>(); - if (!sObjectMgr->GetCreatureTemplate(entry)) + if (!GetCreatureTemplate(entry)) { LOG_ERROR("sql.sql", "Creature template (Entry: {}) does not exist but has a record in `creature_template_addon`", entry); continue; @@ -1501,7 +1501,7 @@ void ObjectMgr::LoadEquipmentTemplates() uint32 entry = fields[0].Get<uint32>(); - if (!sObjectMgr->GetCreatureTemplate(entry)) + if (!GetCreatureTemplate(entry)) { LOG_ERROR("sql.sql", "Creature template (CreatureID: {}) does not exist but has a record in `creature_equip_template`", entry); continue; @@ -2455,7 +2455,7 @@ void ObjectMgr::LoadCreatureSparring() ObjectGuid::LowType spawnId = fields[0].Get<uint32>(); float sparringHealthPct = fields[1].Get<float>(); - if (!sObjectMgr->GetCreatureData(spawnId)) + if (!GetCreatureData(spawnId)) { LOG_ERROR("sql.sql", "Entry {} has a record in `creature_sparring` but doesn't exist in `creatures` table"); continue; @@ -2535,7 +2535,7 @@ ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, fl // We use spawn coords to spawn if (!map->Instanceable() && map->IsGridLoaded(x, y)) { - GameObject* go = sObjectMgr->IsGameObjectStaticTransport(data.id) ? new StaticTransport() : new GameObject(); + GameObject* go = IsGameObjectStaticTransport(data.id) ? new StaticTransport() : new GameObject(); if (!go->LoadGameObjectFromDB(spawnId, map)) { LOG_ERROR("sql.sql", "AddGOData: cannot add gameobject entry {} to map", entry); @@ -3012,7 +3012,7 @@ void ObjectMgr::LoadItemTemplates() itemTemplate.Duration = fields[129].Get<uint32>(); itemTemplate.ItemLimitCategory = uint32(fields[130].Get<int16>()); itemTemplate.HolidayId = fields[131].Get<uint32>(); - itemTemplate.ScriptId = sObjectMgr->GetScriptId(fields[132].Get<std::string>()); + itemTemplate.ScriptId = GetScriptId(fields[132].Get<std::string>()); itemTemplate.DisenchantID = fields[133].Get<uint32>(); itemTemplate.FoodType = uint32(fields[134].Get<uint8>()); itemTemplate.MinMoneyLoot = fields[135].Get<uint32>(); @@ -3570,7 +3570,7 @@ void ObjectMgr::LoadItemSetNames() { uint32 entry = *itr; // add data from item_template if available - pProto = sObjectMgr->GetItemTemplate(entry); + pProto = GetItemTemplate(entry); if (pProto) { LOG_ERROR("sql.sql", "Item set part (Entry: {}) does not have entry in `item_set_names`, adding data from `item_template`.", entry); @@ -3617,13 +3617,13 @@ void ObjectMgr::LoadVehicleTemplateAccessories() uint8 uiSummonType = fields[4].Get<uint8>(); uint32 uiSummonTimer = fields[5].Get<uint32>(); - if (!sObjectMgr->GetCreatureTemplate(uiEntry)) + if (!GetCreatureTemplate(uiEntry)) { LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry {} does not exist.", uiEntry); continue; } - if (!sObjectMgr->GetCreatureTemplate(uiAccessory)) + if (!GetCreatureTemplate(uiAccessory)) { LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: Accessory {} does not exist.", uiAccessory); continue; @@ -3673,7 +3673,7 @@ void ObjectMgr::LoadVehicleAccessories() uint8 uiSummonType = fields[4].Get<uint8>(); uint32 uiSummonTimer = fields[5].Get<uint32>(); - if (!sObjectMgr->GetCreatureTemplate(uiAccessory)) + if (!GetCreatureTemplate(uiAccessory)) { LOG_ERROR("sql.sql", "Table `vehicle_accessory`: Accessory {} does not exist.", uiAccessory); continue; @@ -3765,7 +3765,7 @@ void ObjectMgr::LoadPetLevelInfo() Field* fields = result->Fetch(); uint32 creature_id = fields[0].Get<uint32>(); - if (!sObjectMgr->GetCreatureTemplate(creature_id)) + if (!GetCreatureTemplate(creature_id)) { LOG_ERROR("sql.sql", "Wrong creature id {} in `pet_levelstats` table, ignoring.", creature_id); continue; @@ -4998,7 +4998,7 @@ void ObjectMgr::LoadQuests() if (qinfo->StartItem) { - if (!sObjectMgr->GetItemTemplate(qinfo->StartItem)) + if (!GetItemTemplate(qinfo->StartItem)) { LOG_ERROR("sql.sql", "Quest {} has `StartItem` = {} but item with entry {} does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->StartItem, qinfo->StartItem); @@ -5049,7 +5049,7 @@ void ObjectMgr::LoadQuests() qinfo->SetSpecialFlag(QUEST_SPECIAL_FLAGS_DELIVER); - if (!sObjectMgr->GetItemTemplate(id)) + if (!GetItemTemplate(id)) { LOG_ERROR("sql.sql", "Quest {} has `RequiredItemId{}` = {} but item with entry {} does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, id); @@ -5069,7 +5069,7 @@ void ObjectMgr::LoadQuests() uint32 id = qinfo->ItemDrop[j]; if (id) { - if (!sObjectMgr->GetItemTemplate(id)) + if (!GetItemTemplate(id)) { LOG_ERROR("sql.sql", "Quest {} has `ItemDrop{}` = {} but item with entry {} does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, id); @@ -5090,14 +5090,14 @@ void ObjectMgr::LoadQuests() for (uint8 j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { int32 id = qinfo->RequiredNpcOrGo[j]; - if (id < 0 && !sObjectMgr->GetGameObjectTemplate(-id)) + if (id < 0 && !GetGameObjectTemplate(-id)) { LOG_ERROR("sql.sql", "Quest {} has `RequiredNpcOrGo{}` = {} but gameobject {} does not exist, quest can't be done.", 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)) + if (id > 0 && !GetCreatureTemplate(id)) { LOG_ERROR("sql.sql", "Quest {} has `RequiredNpcOrGo{}` = {} but creature with entry {} does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, uint32(id)); @@ -5130,7 +5130,7 @@ void ObjectMgr::LoadQuests() uint32 id = qinfo->RewardChoiceItemId[j]; if (id) { - if (!sObjectMgr->GetItemTemplate(id)) + if (!GetItemTemplate(id)) { LOG_ERROR("sql.sql", "Quest {} has `RewardChoiceItemId{}` = {} but item with entry {} does not exist, quest will not reward this item.", qinfo->GetQuestId(), j + 1, id, id); @@ -5176,7 +5176,7 @@ void ObjectMgr::LoadQuests() uint32 id = qinfo->RewardItemId[j]; if (id) { - if (!sObjectMgr->GetItemTemplate(id)) + if (!GetItemTemplate(id)) { LOG_ERROR("sql.sql", "Quest {} has `RewardItemId{}` = {} but item with entry {} does not exist, quest will not reward this item.", qinfo->GetQuestId(), j + 1, id, id); @@ -5760,7 +5760,7 @@ void ObjectMgr::LoadEventScripts() std::set<uint32> evt_scripts; // Load all possible script entries from gameobjects - GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates(); + GameObjectTemplateContainer const* gotc = GetGameObjectTemplates(); for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr) if (uint32 eventId = itr->second.GetEventScriptId()) evt_scripts.insert(eventId); @@ -6069,7 +6069,7 @@ void ObjectMgr::LoadInstanceTemplate() instanceTemplate.AllowMount = fields[3].Get<bool>(); instanceTemplate.Parent = uint32(fields[1].Get<uint16>()); - instanceTemplate.ScriptId = sObjectMgr->GetScriptId(fields[2].Get<std::string>()); + instanceTemplate.ScriptId = GetScriptId(fields[2].Get<std::string>()); _instanceTemplateStore[mapID] = instanceTemplate; @@ -6515,14 +6515,14 @@ void ObjectMgr::LoadQuestGreetings() switch (type) { case 0: // Creature - if (!sObjectMgr->GetCreatureTemplate(id)) + if (!GetCreatureTemplate(id)) { LOG_ERROR("sql.sql", "Table `quest_greeting`: creature template entry {} does not exist.", id); continue; } break; case 1: // GameObject - if (!sObjectMgr->GetGameObjectTemplate(id)) + if (!GetGameObjectTemplate(id)) { LOG_ERROR("sql.sql", "Table `quest_greeting`: gameobject template entry {} does not exist.", id); continue; @@ -6568,14 +6568,14 @@ void ObjectMgr::LoadQuestGreetingsLocales() switch (type) { case 0: // Creature - if (!sObjectMgr->GetCreatureTemplate(id)) + if (!GetCreatureTemplate(id)) { LOG_ERROR("sql.sql", "Table `quest_greeting_locale`: creature template entry {} does not exist.", id); continue; } break; case 1: // GameObject - if (!sObjectMgr->GetGameObjectTemplate(id)) + if (!GetGameObjectTemplate(id)) { LOG_ERROR("sql.sql", "Table `quest_greeting_locale`: gameobject template entry {} does not exist.", id); continue; @@ -7577,7 +7577,7 @@ void ObjectMgr::LoadGameObjectTemplateAddons() uint32 entry = fields[0].Get<uint32>(); - GameObjectTemplate const* got = sObjectMgr->GetGameObjectTemplate(entry); + GameObjectTemplate const* got = GetGameObjectTemplate(entry); if (!got) { LOG_ERROR("sql.sql", @@ -8222,7 +8222,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() // 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 - CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates(); + CreatureTemplateContainer const* ctc = GetCreatureTemplates(); for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr) { if ((itr->second.npcflag & UNIT_NPC_FLAG_SPELLCLICK) && _spellClickInfoStore.find(itr->second.Entry) == _spellClickInfoStore.end()) @@ -8747,7 +8747,7 @@ void ObjectMgr::LoadGameObjectForQuests() { uint32 oldMSTime = getMSTime(); - if (sObjectMgr->GetGameObjectTemplates()->empty()) + if (GetGameObjectTemplates()->empty()) { LOG_WARN("server.loading", ">> Loaded 0 GameObjects for quests"); LOG_INFO("server.loading", " "); @@ -8757,7 +8757,7 @@ void ObjectMgr::LoadGameObjectForQuests() uint32 count = 0; // collect GO entries for GO that must activated - GameObjectTemplateContainer* gotc = const_cast<GameObjectTemplateContainer*>(sObjectMgr->GetGameObjectTemplates()); + GameObjectTemplateContainer* gotc = const_cast<GameObjectTemplateContainer*>(GetGameObjectTemplates()); for (GameObjectTemplateContainer::iterator itr = gotc->begin(); itr != gotc->end(); ++itr) { itr->second.IsForQuests = false; @@ -9666,7 +9666,7 @@ bool ObjectMgr::RemoveVendorItem(uint32 entry, uint32 item, bool persist /*= tru bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* player, std::set<uint32>* /*skip_vendors*/, uint32 /*ORnpcflag*/) const { /* - CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry); + CreatureTemplate const* cInfo = GetCreatureTemplate(vendor_entry); if (!cInfo) { if (player) @@ -10040,7 +10040,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() ++count; } while (result->NextRow()); - CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates(); + CreatureTemplateContainer const* ctc = GetCreatureTemplates(); for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr) { for (uint16 lvl = itr->second.minlevel; lvl <= itr->second.maxlevel; ++lvl) @@ -10148,9 +10148,9 @@ void ObjectMgr::LoadFactionChangeQuests() uint32 alliance = fields[0].Get<uint32>(); uint32 horde = fields[1].Get<uint32>(); - if (!sObjectMgr->GetQuestTemplate(alliance)) + if (!GetQuestTemplate(alliance)) LOG_ERROR("sql.sql", "Quest {} (alliance_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", alliance); - else if (!sObjectMgr->GetQuestTemplate(horde)) + else if (!GetQuestTemplate(horde)) LOG_ERROR("sql.sql", "Quest {} (horde_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", horde); else FactionChangeQuests[alliance] = horde; |