Skip to content

Commit c8b5214

Browse files
committed
Core/ObjectMgr : Remove 'CreatureTrainers'
1 parent 4b9f469 commit c8b5214

File tree

3 files changed

+0
-55
lines changed

3 files changed

+0
-55
lines changed

src/server/game/Globals/ObjectMgr.cpp

-51
Original file line numberDiff line numberDiff line change
@@ -9146,57 +9146,6 @@ void ObjectMgr::LoadTrainers()
91469146
TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " Trainers in %u ms", _trainers.size(), GetMSTimeDiffToNow(oldMSTime));
91479147
}
91489148

9149-
void ObjectMgr::LoadCreatureTrainers()
9150-
{
9151-
uint32 oldMSTime = getMSTime();
9152-
9153-
_creatureDefaultTrainers.clear();
9154-
9155-
if (QueryResult result = WorldDatabase.Query("SELECT CreatureId, TrainerId, MenuId, OptionIndex FROM creature_trainer"))
9156-
{
9157-
do
9158-
{
9159-
Field* fields = result->Fetch();
9160-
uint32 creatureId = fields[0].GetUInt32();
9161-
uint32 trainerId = fields[1].GetUInt32();
9162-
uint32 gossipMenuId = fields[2].GetUInt32();
9163-
uint32 gossipOptionIndex = fields[3].GetUInt32();
9164-
9165-
if (!GetCreatureTemplate(creatureId))
9166-
{
9167-
TC_LOG_ERROR("sql.sql", "Table `creature_trainer` references non-existing creature template (CreatureId: %u), ignoring", creatureId);
9168-
continue;
9169-
}
9170-
9171-
if (!GetTrainer(trainerId))
9172-
{
9173-
TC_LOG_ERROR("sql.sql", "Table `creature_trainer` references non-existing trainer (TrainerId: %u) for CreatureId %u MenuId %u OptionIndex %u, ignoring",
9174-
trainerId, creatureId, gossipMenuId, gossipOptionIndex);
9175-
continue;
9176-
}
9177-
9178-
if (gossipMenuId || gossipOptionIndex)
9179-
{
9180-
Trinity::IteratorPair<GossipMenuItemsContainer::const_iterator> gossipMenuItems = GetGossipMenuItemsMapBounds(gossipMenuId);
9181-
auto gossipOptionItr = std::find_if(gossipMenuItems.begin(), gossipMenuItems.end(), [gossipOptionIndex](std::pair<uint32 const, GossipMenuItems> const& entry)
9182-
{
9183-
return entry.second.OptionIndex == gossipOptionIndex;
9184-
});
9185-
if (gossipOptionItr == gossipMenuItems.end())
9186-
{
9187-
TC_LOG_ERROR("sql.sql", "Table `creature_trainer` references non-existing gossip menu option (MenuId %u OptionIndex %u) for CreatureId %u and TrainerId %u, ignoring",
9188-
gossipMenuId, gossipOptionIndex, creatureId, trainerId);
9189-
continue;
9190-
}
9191-
}
9192-
9193-
_creatureDefaultTrainers[std::make_tuple(creatureId, gossipMenuId, gossipOptionIndex)] = trainerId;
9194-
} while (result->NextRow());
9195-
}
9196-
9197-
TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " default trainers in %u ms", _creatureDefaultTrainers.size(), GetMSTimeDiffToNow(oldMSTime));
9198-
}
9199-
92009149
void ObjectMgr::LoadCreatureSummonerEntry()
92019150
{
92029151
uint32 oldMSTime = getMSTime();

src/server/game/Globals/ObjectMgr.h

-1
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,6 @@ class TC_GAME_API ObjectMgr
13621362

13631363

13641364
void LoadTrainers();
1365-
void LoadCreatureTrainers();
13661365

13671366
void LoadCreatureSummonerEntry();
13681367

src/server/game/World/World.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -2013,9 +2013,6 @@ void World::SetInitialWorldSettings()
20132013
TC_LOG_INFO("server.loading", "Loading Gossip menu options...");
20142014
sObjectMgr->LoadGossipMenuItems();
20152015

2016-
TC_LOG_INFO("server.loading", "Loading Creature trainers...");
2017-
sObjectMgr->LoadCreatureTrainers(); // must be after LoadGossipMenuItems
2018-
20192016
TC_LOG_INFO("server.loading", "Loading Vendors...");
20202017
sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
20212018

0 commit comments

Comments
 (0)