594 TC_LOG_INFO(
"server.loading",
">> Loaded 0 object pools. DB table `pool_template` is empty.");
601 Field* fields = result->Fetch();
610 while (result->NextRow());
617 TC_LOG_INFO(
"server.loading",
"Loading Creatures Pooling Data...");
626 TC_LOG_INFO(
"server.loading",
">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
633 Field* fields = result->Fetch();
637 float chance = fields[2].
GetFloat();
642 TC_LOG_ERROR(
"sql.sql",
"`pool_creature` has a non existing creature spawn (GUID: " UI64FMTD ") defined for pool id (%u), skipped.", guid, pool_id);
647 TC_LOG_ERROR(
"sql.sql",
"`pool_creature` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
650 if (chance < 0 || chance > 100)
652 TC_LOG_ERROR(
"sql.sql",
"`pool_creature` has an invalid chance (%f) for creature guid (" UI64FMTD ") in pool id (%u), skipped.", chance, guid, pool_id);
665 while (result->NextRow());
673 TC_LOG_INFO(
"server.loading",
"Loading Gameobject Pooling Data...");
682 TC_LOG_INFO(
"server.loading",
">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
689 Field* fields = result->Fetch();
693 float chance = fields[2].
GetFloat();
698 TC_LOG_ERROR(
"sql.sql",
"`pool_gameobject` has a non existing gameobject spawn (GUID: " UI64FMTD ") defined for pool id (%u), skipped.", guid, pool_id);
707 TC_LOG_ERROR(
"sql.sql",
"`pool_gameobject` has a not lootable gameobject spawn (GUID: " UI64FMTD ", type: %u) defined for pool id (%u), skipped.", guid, goinfo->
type, pool_id);
713 TC_LOG_ERROR(
"sql.sql",
"`pool_gameobject` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
717 if (chance < 0 || chance > 100)
719 TC_LOG_ERROR(
"sql.sql",
"`pool_gameobject` has an invalid chance (%f) for gameobject guid (" UI64FMTD ") in pool id (%u), skipped.", chance, guid, pool_id);
733 while (result->NextRow());
741 TC_LOG_INFO(
"server.loading",
"Loading Mother Pooling Data...");
750 TC_LOG_INFO(
"server.loading",
">> Loaded 0 pools in pools");
757 Field* fields = result->Fetch();
761 float chance = fields[2].
GetFloat();
765 TC_LOG_ERROR(
"sql.sql",
"`pool_pool` mother_pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", mother_pool_id);
770 TC_LOG_ERROR(
"sql.sql",
"`pool_pool` included pool_id (%u) is out of range compared to max pool id in `pool_template`, skipped.", child_pool_id);
773 if (mother_pool_id == child_pool_id)
775 TC_LOG_ERROR(
"sql.sql",
"`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id);
778 if (chance < 0 || chance > 100)
780 TC_LOG_ERROR(
"sql.sql",
"`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id);
793 while (result->NextRow());
798 std::set<uint32> checkedPools;
801 checkedPools.insert(poolItr->first);
802 if (checkedPools.find(poolItr->second) != checkedPools.end())
804 std::ostringstream ss;
806 for (std::set<uint32>::const_iterator itr=checkedPools.begin(); itr != checkedPools.end(); ++itr)
808 ss <<
"create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool "
809 << poolItr->first <<
" and child pool " << poolItr->second;
823 TC_LOG_INFO(
"server.loading",
"Loading Quest Pooling Data...");
832 TC_LOG_INFO(
"server.loading",
">> Loaded 0 quests in pools");
846 std::map<uint32, int32> poolTypeMap;
850 Field* fields = result->Fetch();
858 TC_LOG_ERROR(
"sql.sql",
"`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id);
862 if (pool_id > max_pool_id)
864 TC_LOG_ERROR(
"sql.sql",
"`pool_quest` pool id (%u) is out of range compared to max pool id in `pool_template`, skipped.", pool_id);
870 TC_LOG_ERROR(
"sql.sql",
"`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id);
874 if (poolTypeMap[pool_id] == QUEST_NONE)
875 poolTypeMap[pool_id] = quest->
IsDaily() ? QUEST_DAILY : QUEST_WEEKLY;
877 int32 currType = quest->
IsDaily() ? QUEST_DAILY : QUEST_WEEKLY;
879 if (poolTypeMap[pool_id] != currType)
881 TC_LOG_ERROR(
"sql.sql",
"`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.",
882 entry, currType == QUEST_DAILY ?
"QUEST_DAILY" :
"QUEST_WEEKLY", pool_id, poolTypeMap[pool_id] == QUEST_DAILY ?
"QUEST_DAILY" :
"QUEST_WEEKLY");
889 if (creBounds.first == creBounds.second && goBounds.first == goBounds.second)
891 TC_LOG_ERROR(
"sql.sql",
"`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id);
905 while (result->NextRow());
912 TC_LOG_INFO(
"server.loading",
"Starting objects pooling system...");
917 " LEFT JOIN game_event_pool ON pool_template.entry=game_event_pool.pool_entry"
918 " LEFT JOIN pool_pool ON pool_template.entry=pool_pool.pool_id WHERE game_event_pool.pool_entry IS NULL");
922 TC_LOG_INFO(
"server.loading",
">> Pool handling system initialized, 0 pools spawned.");
929 Field* fields = result->Fetch();
938 TC_LOG_ERROR(
"sql.sql",
"Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32());
940 TC_LOG_ERROR(
"sql.sql",
"Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry);
951 while (result->NextRow());
PooledQuestRelation mQuestGORelation
Definition: PoolMgr.h:137
Definition: Creature.h:287
std::shared_ptr< PreparedResultSet > PreparedQueryResult
Definition: QueryResult.h:107
uint64 GetUInt64() const
Definition: Field.h:184
SearchMap mCreatureSearchMap
Definition: PoolMgr.h:157
Definition: QuestDef.h:279
float GetFloat() const
Definition: Field.h:222
SearchMap mGameobjectSearchMap
Definition: PoolMgr.h:158
uint32 max_pool_id
Definition: PoolMgr.h:143
Class used to access individual fields of database query result.
Definition: Field.h:56
PooledQuestRelation mQuestCreatureRelation
Definition: PoolMgr.h:136
uint32 getMSTime()
Definition: Timer.h:24
Definition: GameObject.h:34
PoolGroupPoolMap mPoolPoolGroups
Definition: PoolMgr.h:155
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition: DatabaseEnv.cpp:20
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
PoolGroupQuestMap mPoolQuestGroups
Definition: PoolMgr.h:156
Definition: WorldDatabase.h:32
bool IsDaily() const
Definition: QuestDef.h:375
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: PreparedStatement.h:74
#define UI64FMTD
Definition: Define.h:137
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
void AddEntry(PoolObject &poolitem, uint32 maxentries)
Definition: PoolMgr.cpp:137
uint64_t uint64
Definition: Define.h:149
std::shared_ptr< ResultSet > QueryResult
Definition: QueryResult.h:61
uint32 id
Definition: GameObject.h:838
PoolTemplateDataMap mPoolTemplate
Definition: PoolMgr.h:152
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: SharedDefines.h:2090
Definition: GameObject.h:833
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
QueryResult Query(const char *sql, T *connection=nullptr)
Definition: DatabaseWorkerPool.cpp:113
Definition: SharedDefines.h:2075
std::pair< PooledQuestRelation::const_iterator, PooledQuestRelation::const_iterator > PooledQuestRelationBounds
Definition: PoolMgr.h:101
uint32 GetUInt32() const
Definition: Field.h:146
uint32 MaxLimit
Definition: PoolMgr.h:29
Definition: SharedDefines.h:2068
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
std::pair< uint64, uint32 > SearchPair
Definition: PoolMgr.h:149
PoolGroupCreatureMap mPoolCreatureGroups
Definition: PoolMgr.h:153
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void SpawnPool(uint32 pool_id)
Definition: PoolMgr.cpp:1058
void SetPoolId(uint32 pool_id)
Definition: PoolMgr.h:74
PoolGroupGameObjectMap mPoolGameobjectGroups
Definition: PoolMgr.h:154
SearchMap mQuestSearchMap
Definition: PoolMgr.h:160
SearchMap mPoolSearchMap
Definition: PoolMgr.h:159
bool CheckPool(uint32 pool_id) const
Definition: PoolMgr.cpp:1083
uint32 type
Definition: GameObject.h:37
bool IsDailyOrWeekly() const
Definition: QuestDef.h:379