fix(Scripts/Commands): Re-spawn pool quests after reload quest starters (#24696)
Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
This commit is contained in:
parent
504f5a186e
commit
7fc57744d9
4 changed files with 319 additions and 0 deletions
|
|
@ -1038,6 +1038,20 @@ void PoolMgr::ChangeWeeklyQuests()
|
|||
SaveQuestsToDB(false, true, false);
|
||||
}
|
||||
|
||||
void PoolMgr::ReSpawnPoolQuests()
|
||||
{
|
||||
for (auto& [questId, poolId] : mQuestSearchMap)
|
||||
{
|
||||
if (IsSpawnedObject<Quest>(questId))
|
||||
{
|
||||
PoolObject tempObj(questId, 0.0f);
|
||||
auto it = mPoolQuestGroups.find(poolId);
|
||||
if (it != mPoolQuestGroups.end())
|
||||
it->second.Spawn1Object(&tempObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Call to spawn a pool, if cache if true the method will spawn only if cached entry is different
|
||||
// If it's same, the creature is respawned only (added back to map)
|
||||
template<>
|
||||
|
|
|
|||
|
|
@ -130,10 +130,12 @@ public:
|
|||
|
||||
void ChangeDailyQuests();
|
||||
void ChangeWeeklyQuests();
|
||||
void ReSpawnPoolQuests();
|
||||
|
||||
PooledQuestRelation mQuestCreatureRelation;
|
||||
PooledQuestRelation mQuestGORelation;
|
||||
|
||||
friend class PoolQuestReloadFixTest;
|
||||
private:
|
||||
template<typename T>
|
||||
void SpawnPool(uint32 pool_id, uint32 db_guid_or_pool_id);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "MapMgr.h"
|
||||
#include "MotdMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "PoolMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ServerMailMgr.h"
|
||||
#include "SkillDiscovery.h"
|
||||
|
|
@ -270,6 +271,7 @@ public:
|
|||
|
||||
LOG_INFO("server.loading", "Reloading Quests Relations...");
|
||||
sObjectMgr->LoadQuestStartersAndEnders();
|
||||
sPoolMgr->ReSpawnPoolQuests();
|
||||
handler->SendGlobalGMSysMessage("DB tables `*_queststarter` and `*_questender` reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
|
@ -490,6 +492,7 @@ public:
|
|||
{
|
||||
LOG_INFO("server.loading", "Loading Quests Relations... (`creature_queststarter`)");
|
||||
sObjectMgr->LoadCreatureQuestStarters();
|
||||
sPoolMgr->ReSpawnPoolQuests();
|
||||
handler->SendGlobalGMSysMessage("DB table `creature_queststarter` reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
|
@ -532,6 +535,7 @@ public:
|
|||
{
|
||||
LOG_INFO("server.loading", "Loading Quests Relations... (`gameobject_queststarter`)");
|
||||
sObjectMgr->LoadGameobjectQuestStarters();
|
||||
sPoolMgr->ReSpawnPoolQuests();
|
||||
handler->SendGlobalGMSysMessage("DB table `gameobject_queststarter` reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue