mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 06:36:24 +00:00
refactor(Core/ObjectMgr): Load Creatures.CustomIDs into stores (#14835)
This commit is contained in:
@@ -841,6 +841,21 @@ void ObjectMgr::LoadCreatureTemplateAddons()
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Load config option Creatures.CustomIDs into Store
|
||||
*/
|
||||
void ObjectMgr::LoadCreatureCustomIDs()
|
||||
{
|
||||
// Hack for modules
|
||||
std::string stringCreatureIds = sConfigMgr->GetOption<std::string>("Creatures.CustomIDs", "");
|
||||
std::vector<std::string_view> CustomCreatures = Acore::Tokenize(stringCreatureIds, ',', false);
|
||||
|
||||
for (auto itr : CustomCreatures)
|
||||
{
|
||||
_creatureCustomIDsStore.push_back(Acore::StringTo<uint32>(itr).value());
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
|
||||
{
|
||||
if (!cInfo)
|
||||
@@ -1183,15 +1198,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
|
||||
const_cast<CreatureTemplate*>(cInfo)->DamageModifier *= Creature::_GetDamageMod(cInfo->rank);
|
||||
|
||||
// Hack for modules
|
||||
std::vector<uint32> CustomCreatures;
|
||||
std::string stringCreatureIds(sConfigMgr->GetOption<std::string>("Creatures.CustomIDs", ""));
|
||||
for (std::string_view id : Acore::Tokenize(stringCreatureIds, ',', false))
|
||||
{
|
||||
uint32 entry = Acore::StringTo<uint32>(id).value_or(0);
|
||||
CustomCreatures.emplace_back(entry);
|
||||
}
|
||||
|
||||
for (auto const& itr : CustomCreatures)
|
||||
for (auto itr : _creatureCustomIDsStore)
|
||||
{
|
||||
if (cInfo->Entry == itr)
|
||||
return;
|
||||
|
||||
@@ -672,6 +672,8 @@ typedef std::unordered_map<uint32, VendorItemData> CacheVendorItemContainer;
|
||||
typedef std::unordered_map<uint32, TrainerSpellData> CacheTrainerSpellContainer;
|
||||
typedef std::unordered_map<uint32, ServerMail> ServerMailContainer;
|
||||
|
||||
typedef std::vector<uint32> CreatureCustomIDsContainer;
|
||||
|
||||
enum SkillRangeType
|
||||
{
|
||||
SKILL_RANGE_LANGUAGE, // 300..300
|
||||
@@ -1020,6 +1022,7 @@ public:
|
||||
void LoadCreatureTemplateAddons();
|
||||
void LoadCreatureTemplateResistances();
|
||||
void LoadCreatureTemplateSpells();
|
||||
void LoadCreatureCustomIDs();
|
||||
void CheckCreatureTemplate(CreatureTemplate const* cInfo);
|
||||
void CheckCreatureMovement(char const* table, uint64 id, CreatureMovementData& creatureMovement);
|
||||
void LoadGameObjectQuestItems();
|
||||
@@ -1555,6 +1558,7 @@ private:
|
||||
CellObjectGuids _emptyCellObjectGuids;
|
||||
CreatureDataContainer _creatureDataStore;
|
||||
CreatureTemplateContainer _creatureTemplateStore;
|
||||
CreatureCustomIDsContainer _creatureCustomIDsStore;
|
||||
std::vector<CreatureTemplate*> _creatureTemplateStoreFast; // pussywizard
|
||||
CreatureModelContainer _creatureModelStore;
|
||||
CreatureAddonContainer _creatureAddonStore;
|
||||
|
||||
@@ -1697,6 +1697,9 @@ void World::SetInitialWorldSettings()
|
||||
LOG_INFO("server.loading", "Loading Creature Model Based Info Data...");
|
||||
sObjectMgr->LoadCreatureModelInfo();
|
||||
|
||||
LOG_INFO("server.loading", "Loading Creature Custom IDs Config...");
|
||||
sObjectMgr->LoadCreatureCustomIDs();
|
||||
|
||||
LOG_INFO("server.loading", "Loading Creature Templates...");
|
||||
sObjectMgr->LoadCreatureTemplates();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user