public override void OnPlayerListChange(Server server, List <Player> players) { var packet = new ServerInfoPacketType() { ServerId = server.ServerId.ToString(), Players = players.Where(p => p != null && p.ClientId != 0 && p.NickId != null) .Select(p => new PlayerPacketType() { NickId = p.NickId.ToString(), CountryId = p.Country?.Id ?? 0, Ping = p.Ping, Status = p.Status.ToString(), }) .ToArray() }; var json = Json.Serialize(packet); using (var webClient = new WebClientBase()) { webClient.Timeout = 9000; webClient.ContentType = ContentType.JsonUTF8; webClient.KeepAlive = false; webClient.SetCookie("srvtoken", this.Token, DOMAIN); webClient.Upload(PLAYERURL, json); } }
public override void OnServerLogStart(Server server) { var packet = new ServerInfoPacketType() { Type = 9999, Server = server }; this.AddToQueue(packet); }
private void AddGameObjectsToQueue() { var packet = new ServerInfoPacketType() { Token = this.Token, Type = 9998, ObjectInfo = GameInfo.ObjectsClassification.Select( pair => new ObjectInfoPacketType() { ObjectId = GuidUtility.Create(GuidUtility.IsoOidNamespace, pair.Key), Name = pair.Key, Class = pair.Value.Classification.ToString("g"), Purpose = pair.Value.Purpose }).ToArray() }; this.AddToQueue(packet); }