feat(Core/Packets): rework HandleWhoOpcode (#8863)

This commit is contained in:
Kargatum
2021-11-07 15:51:36 +07:00
committed by GitHub
parent 430fa147fd
commit c0728f6e2d
10 changed files with 271 additions and 211 deletions

View File

@@ -86,7 +86,7 @@
#include "WardenCheckMgr.h"
#include "WaypointMovementGenerator.h"
#include "WeatherMgr.h"
#include "WhoListCache.h"
#include "WhoListCacheMgr.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include <boost/asio/ip/address.hpp>
@@ -1990,6 +1990,8 @@ void World::SetInitialWorldSettings()
// our speed up
m_timers[WUPDATE_5_SECS].SetInterval(5 * IN_MILLISECONDS);
m_timers[WUPDATE_WHO_LIST].SetInterval(5 * IN_MILLISECONDS); // update who list cache every 5 seconds
mail_expire_check_timer = time(nullptr) + 6 * 3600;
///- Initilize static helper structures
@@ -2237,14 +2239,19 @@ void World::Update(uint32 diff)
// moved here from HandleCharEnumOpcode
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS);
CharacterDatabase.Execute(stmt);
// copy players hashmapholder to avoid mutex
WhoListCacheMgr::Update();
}
///- Update the game time and check for shutdown time
_UpdateGameTime();
///- Update Who List Cache
if (m_timers[WUPDATE_WHO_LIST].Passed())
{
METRIC_TIMER("world_update_time", METRIC_TAG("type", "Update who list"));
m_timers[WUPDATE_WHO_LIST].Reset();
sWhoListCacheMgr->Update();
}
{
METRIC_TIMER("world_update_time", METRIC_TAG("type", "Check quest reset times"));

View File

@@ -69,6 +69,7 @@ enum WorldTimers
WUPDATE_MAILBOXQUEUE,
WUPDATE_PINGDB,
WUPDATE_5_SECS,
WUPDATE_WHO_LIST,
WUPDATE_COUNT
};