Adding debug lines for sanity, for now
This commit is contained in:
parent
915e8006f4
commit
3c44eb7e0b
@ -3,12 +3,15 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "WorldSessionMgr.h"
|
#include "WorldSessionMgr.h"
|
||||||
|
#include "Log.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
bool sEnabled = true;
|
bool sEnabled = true;
|
||||||
uint32 sIntervalIdle = 200u;
|
uint32 sIntervalIdle = 200u;
|
||||||
uint32 sIntervalActive = 10u;
|
uint32 sIntervalActive = 10u;
|
||||||
|
uint32 sCurrentInterval = 0u;
|
||||||
|
uint32 sPrintTimer = 0u;
|
||||||
|
|
||||||
void ApplyInterval()
|
void ApplyInterval()
|
||||||
{
|
{
|
||||||
@ -17,14 +20,20 @@ namespace
|
|||||||
|
|
||||||
bool hasRealPlayer = sWorldSessionMgr->GetActiveAndQueuedSessionCount() > 0;
|
bool hasRealPlayer = sWorldSessionMgr->GetActiveAndQueuedSessionCount() > 0;
|
||||||
uint32 newInterval = hasRealPlayer ? sIntervalActive : sIntervalIdle;
|
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
|
class ServerIdler_WorldScript : public WorldScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServerIdler_WorldScript() : WorldScript("ServerIdler_WorldScript") {}
|
ServerIdler_WorldScript() : WorldScript("ServerIdler_WorldScript") { }
|
||||||
|
|
||||||
void OnAfterConfigLoad(bool) override
|
void OnAfterConfigLoad(bool) override
|
||||||
{
|
{
|
||||||
@ -39,12 +48,26 @@ public:
|
|||||||
|
|
||||||
ApplyInterval();
|
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
|
class ServerIdler_PlayerScript : public PlayerScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServerIdler_PlayerScript() : PlayerScript("ServerIdler_PlayerScript") {}
|
ServerIdler_PlayerScript() : PlayerScript("ServerIdler_PlayerScript") { }
|
||||||
|
|
||||||
void OnPlayerLogin(Player*) override
|
void OnPlayerLogin(Player*) override
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user