mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 07:38:36 +00:00
Add client and zone subscriptions
This commit is contained in:
+86
-1
@@ -29,10 +29,13 @@
|
||||
#include "../common/packet_dump.h"
|
||||
#include "../common/misc.h"
|
||||
#include "../common/misc_functions.h"
|
||||
#include "../common/json/json.h"
|
||||
#include "web_interface.h"
|
||||
#include "wguild_mgr.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
extern WebInterfaceList web_interface;
|
||||
|
||||
extern ZSList zoneserver_list;
|
||||
uint32 numplayers = 0; //this really wants to be a member variable of ClientList...
|
||||
|
||||
@@ -40,6 +43,8 @@ ClientList::ClientList()
|
||||
: CLStale_timer(45000)
|
||||
{
|
||||
NextCLEID = 1;
|
||||
|
||||
m_tick.reset(new EQ::Timer(1000, true, std::bind(&ClientList::OnTick, this, std::placeholders::_1)));
|
||||
}
|
||||
|
||||
ClientList::~ClientList() {
|
||||
@@ -1358,3 +1363,83 @@ void ClientList::SendClientVersionSummary(const char *Name)
|
||||
ClientTitaniumCount, ClientSoFCount, ClientSoDCount, ClientUnderfootCount, ClientRoFCount, ClientRoF2Count);
|
||||
}
|
||||
|
||||
void ClientList::OnTick(EQ::Timer *t)
|
||||
{
|
||||
Json::Value out;
|
||||
out["event"] = "EQW::ClientUpdate";
|
||||
out["data"] = Json::Value();
|
||||
|
||||
LinkedListIterator<ClientListEntry*> Iterator(clientlist);
|
||||
|
||||
Iterator.Reset();
|
||||
|
||||
while (Iterator.MoreElements())
|
||||
{
|
||||
ClientListEntry* cle = Iterator.GetData();
|
||||
|
||||
Json::Value outclient;
|
||||
|
||||
outclient["Online"] = cle->Online();
|
||||
outclient["ID"] = cle->GetID();
|
||||
outclient["IP"] = cle->GetIP();
|
||||
outclient["LSID"] = cle->LSID();
|
||||
outclient["LSAccountID"] = cle->LSAccountID();
|
||||
outclient["LSName"] = cle->LSName();
|
||||
outclient["WorldAdmin"] = cle->WorldAdmin();
|
||||
|
||||
outclient["AccountID"] = cle->AccountID();
|
||||
outclient["AccountName"] = cle->AccountName();
|
||||
outclient["Admin"] = cle->Admin();
|
||||
|
||||
auto server = cle->Server();
|
||||
if (server) {
|
||||
outclient["Server"]["CAddress"] = server->GetCAddress();
|
||||
outclient["Server"]["CLocalAddress"] = server->GetCLocalAddress();
|
||||
outclient["Server"]["CompileTime"] = server->GetCompileTime();
|
||||
outclient["Server"]["CPort"] = server->GetCPort();
|
||||
outclient["Server"]["ID"] = server->GetID();
|
||||
outclient["Server"]["InstanceID"] = server->GetInstanceID();
|
||||
outclient["Server"]["IP"] = server->GetIP();
|
||||
outclient["Server"]["LaunchedName"] = server->GetLaunchedName();
|
||||
outclient["Server"]["LaunchName"] = server->GetLaunchName();
|
||||
outclient["Server"]["Port"] = server->GetPort();
|
||||
outclient["Server"]["PrevZoneID"] = server->GetPrevZoneID();
|
||||
outclient["Server"]["UUID"] = server->GetUUID();
|
||||
outclient["Server"]["ZoneID"] = server->GetZoneID();
|
||||
outclient["Server"]["ZoneLongName"] = server->GetZoneLongName();
|
||||
outclient["Server"]["ZoneName"] = server->GetZoneName();
|
||||
outclient["Server"]["ZoneOSProcessID"] = server->GetZoneOSProcessID();
|
||||
outclient["Server"]["NumPlayers"] = server->NumPlayers();
|
||||
outclient["Server"]["BootingUp"] = server->IsBootingUp();
|
||||
outclient["Server"]["StaticZone"] = server->IsStaticZone();
|
||||
}
|
||||
else {
|
||||
outclient["Server"] = Json::Value();
|
||||
}
|
||||
|
||||
outclient["CharID"] = cle->CharID();
|
||||
outclient["name"] = cle->name();
|
||||
outclient["zone"] = cle->zone();
|
||||
outclient["instance"] = cle->instance();
|
||||
outclient["level"] = cle->level();
|
||||
outclient["class_"] = cle->class_();
|
||||
outclient["race"] = cle->race();
|
||||
outclient["Anon"] = cle->Anon();
|
||||
|
||||
outclient["TellsOff"] = cle->TellsOff();
|
||||
outclient["GuildID"] = cle->GuildID();
|
||||
outclient["LFG"] = cle->LFG();
|
||||
outclient["GM"] = cle->GetGM();
|
||||
outclient["LocalClient"] = cle->IsLocalClient();
|
||||
outclient["LFGFromLevel"] = cle->GetLFGFromLevel();
|
||||
outclient["LFGToLevel"] = cle->GetLFGToLevel();
|
||||
outclient["LFGMatchFilter"] = cle->GetLFGMatchFilter();
|
||||
outclient["LFGComments"] = cle->GetLFGComments();
|
||||
outclient["ClientVersion"] = cle->GetClientVersion();
|
||||
out["data"].append(outclient);
|
||||
|
||||
Iterator.Advance();
|
||||
}
|
||||
|
||||
web_interface.SendEvent(out);
|
||||
}
|
||||
Reference in New Issue
Block a user