Adding debug lines for sanity, for now
This commit is contained in:
parent
915e8006f4
commit
3c44eb7e0b
@ -3,12 +3,15 @@
|
||||
#include "World.h"
|
||||
#include "Player.h"
|
||||
#include "WorldSessionMgr.h"
|
||||
#include "Log.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
bool sEnabled = true;
|
||||
uint32 sIntervalIdle = 200u;
|
||||
uint32 sIntervalActive = 10u;
|
||||
uint32 sCurrentInterval = 0u;
|
||||
uint32 sPrintTimer = 0u;
|
||||
|
||||
void ApplyInterval()
|
||||
{
|
||||
@ -17,14 +20,20 @@ namespace
|
||||
|
||||
bool hasRealPlayer = sWorldSessionMgr->GetActiveAndQueuedSessionCount() > 0;
|
||||
uint32 newInterval = hasRealPlayer ? sIntervalActive : sIntervalIdle;
|
||||
sWorld->setIntConfig(CONFIG_INTERVAL_MAPUPDATE, newInterval);
|
||||
|
||||
if (newInterval != sCurrentInterval)
|
||||
{
|
||||
sCurrentInterval = newInterval;
|
||||
sWorld->setIntConfig(CONFIG_INTERVAL_MAPUPDATE, newInterval);
|
||||
LOG_INFO("server.idler", "ServerIdler: MapUpdateInterval changed to {}", newInterval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ServerIdler_WorldScript : public WorldScript
|
||||
{
|
||||
public:
|
||||
ServerIdler_WorldScript() : WorldScript("ServerIdler_WorldScript") {}
|
||||
ServerIdler_WorldScript() : WorldScript("ServerIdler_WorldScript") { }
|
||||
|
||||
void OnAfterConfigLoad(bool) override
|
||||
{
|
||||
@ -39,12 +48,26 @@ public:
|
||||
|
||||
ApplyInterval();
|
||||
}
|
||||
|
||||
void OnUpdate(uint32 diff) override
|
||||
{
|
||||
if (!sEnabled)
|
||||
return;
|
||||
|
||||
sPrintTimer += diff;
|
||||
if (sPrintTimer >= 30000u)
|
||||
{
|
||||
sPrintTimer = 0u;
|
||||
uint32 current = sWorld->getIntConfig(CONFIG_INTERVAL_MAPUPDATE);
|
||||
LOG_INFO("server.idler", "ServerIdler: MapUpdateInterval current value {}", current);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class ServerIdler_PlayerScript : public PlayerScript
|
||||
{
|
||||
public:
|
||||
ServerIdler_PlayerScript() : PlayerScript("ServerIdler_PlayerScript") {}
|
||||
ServerIdler_PlayerScript() : PlayerScript("ServerIdler_PlayerScript") { }
|
||||
|
||||
void OnPlayerLogin(Player*) override
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user