public static void SendUDPRoundSync(Room room) { using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)3); sendGpacket.writeD(room.UniqueRoomId); sendGpacket.writeD(room.mapId * 16 + (int)room.room_type); sendGpacket.writeC((byte)room.rodada); Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(),room.UDPServer.Connection); } }
public static void SendUDPPlayerSync(Room room, SLOT slot,CupomEffects effects,int type) { using (SendGPacket pk = new SendGPacket()) { pk.writeH((short)1); pk.writeD(room.UniqueRoomId); pk.writeD(room.mapId * 16 + (int)room.room_type); pk.writeQ(room.StartTick); pk.writeC((byte)type); pk.writeC((byte)room.rodada); pk.writeC((byte)slot._id); pk.writeC((byte)slot.spawnsCount); pk.writeC(BitConverter.GetBytes(slot._playerId)[0]); if (type == 0 || type == 2) { Game_SyncNet.WriteCharaInfo(pk,room,slot,effects); } Game_SyncNet.SendPacket(pk.mstream.ToArray(),room.UDPServer.Connection); } }
public static void SendCompleteBytes(long playerId,byte[] buffer,int serverId) { if (buffer.Length == 0) { return; } GameServerModel server = Game_SyncNet.GetServer(serverId); if (server == null) { return; } using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)13); sendGpacket.writeQ(playerId); sendGpacket.writeC((byte)1); sendGpacket.writeH((ushort)buffer.Length); sendGpacket.writeB(buffer); Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(),server.Connection); } }
public static void SendBytes(long playerId,SendPacket sp,int serverId) { if (sp == null) { return; } GameServerModel server = Game_SyncNet.GetServer(serverId); if (server == null) { return; } byte[] bytes = sp.GetBytes("Game_SyncNet.SendBytes"); using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)13); sendGpacket.writeQ(playerId); sendGpacket.writeC((byte)0); sendGpacket.writeH((ushort)bytes.Length); sendGpacket.writeB(bytes); Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(),server.Connection); } }
public static void UpdateGSCount(int serverId) { try { if ((DateTime.Now - Game_SyncNet.LastSyncCount).TotalSeconds < 2.5) { return; } Game_SyncNet.LastSyncCount = DateTime.Now; int num = 0; foreach (Channel channel in ChannelsXML._channels) { num += channel._players.Count; } foreach (GameServerModel server in ServersXML._servers) { if (server._id == serverId) { server._LastCount = num; } else { using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)15); sendGpacket.writeD(serverId); sendGpacket.writeD(num); Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(),server.Connection); } } } } catch (Exception ex) { Logger.warning("[Game_SyncNet.UpdateGSCount] " + ex.ToString()); } }