virtual void List(Session& ses) const { ServerInstanceInfo srv(ses); bool serverIsUp = GameModules[GAME_NAME]->IsUp(srv.Id); ses.NewElem(); if (serverIsUp) { ses.AddChildNode("name", "server_online"); ses.AddChildNode("status", "on"); } else { ses.AddChildNode("name", "server_offline"); ses.AddChildNode("status", "off"); } AddRow(ses, "ip", srv.GetIp()); AddRow(ses, "port", str::Str(srv.GetPort())); AddRow(ses, "players_online", serverIsUp?str::Str(GameModules[GAME_NAME]->PlayersOnline(srv.Id)):"-"); }
void AddRow(Session & ses, const string & name, const string & value) const { ses.NewElem(); ses.AddChildNode("name", name); ses.AddChildNode("value", value); }