/* * public static void Update(Clan clan, int type) * { * foreach (GameServerModel gs in ServersXML._servers) * { * if (gs._serverId == 0 || gs._serverId == ConfigGS.serverId) * continue; * * using (SendGPacket pk = new SendGPacket()) * { * pk.writeH(22); * pk.writeC((byte)type); * if (type == 0) * pk.writeQ(clan.owner_id); * else if (type == 1) * { * pk.writeC((byte)(clan._name.Length + 1)); * pk.writeS(clan._name, clan._name.Length + 1); * } * else if (type == 2) * pk.writeC((byte)clan._name_color); * Game_SyncNet.SendPacket(pk.mstream.ToArray(), gs._syncConn); * } * } * } */ // send to game public static void Load(Clan clan, int type) { foreach (GameServerModel gs in ServersXML._servers) { if (gs._serverId == 0 || gs._serverId == ConfigGS.serverId) { continue; } using (SendGPacket pk = new SendGPacket()) { pk.writeH(21); pk.writeC((byte)type); pk.writeD(clan._id); if (type == 0) { pk.writeQ(clan.owner_id); pk.writeD(clan.creationDate); pk.writeC((byte)(clan._name.Length + 1)); pk.writeS(clan._name, clan._name.Length + 1); pk.writeC((byte)(clan._info.Length + 1)); pk.writeS(clan._info, clan._info.Length + 1); } Game_SyncNet.SendPacket(pk.mstream.ToArray(), gs._syncConn); } } }
/// <summary> /// /// </summary> /// <param name="player">Conta principal</param> /// <param name="friend">Amigo que será adicionado/atualizado..</param> /// <param name="type">0=Adicionar|1=Atualizar|2=Deletar</param> /// // send to Game or sync public static void Load(Account player, Friend friend, int type) { if (player == null) { return; } GameServerModel gs = Game_SyncNet.GetServer(player._status); if (gs == null) { return; } using (SendGPacket pk = new SendGPacket()) { pk.writeH(17); pk.writeQ(player.player_id); pk.writeC((byte)type); pk.writeQ(friend.player_id); if (type != 2) { pk.writeC((byte)friend.state); } Game_SyncNet.SendPacket(pk.mstream.ToArray(), gs._syncConn); } }
public static void sendBlock(string ip, string descricao, int gravidade) { // codigo de operação - 1 byte // ipSize - 1 byte // descSize - 1 byte // ip // descricao // Gravivade - 1 Byte (0=grave|1=perigo|2=Suspeito) UdpClient udpClient = new UdpClient("127.0.0.1", 1911); SendGPacket pk = new SendGPacket(); pk.writeC(0); pk.writeC((byte)ip.Length); pk.writeC((byte)descricao.Length); pk.writeB(Encoding.ASCII.GetBytes(ip)); pk.writeB(Encoding.ASCII.GetBytes(descricao)); pk.writeC((byte)gravidade); try { udpClient.Send(pk.mstream.ToArray(), pk.mstream.ToArray().Length); } catch (Exception ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[Firewall] Fatal Error!"); } }
public static void LoadItem(Account player, ItemsModel item) { if (player == null || player._status.serverId == 0) { return; } GameServerModel gs = Game_SyncNet.GetServer(player._status); if (gs == null) { return; } using (SendGPacket pk = new SendGPacket()) { pk.writeH(18); pk.writeQ(player.player_id); pk.writeQ(item._objId); pk.writeD(item._id); pk.writeC((byte)item._equip); pk.writeC((byte)item._category); pk.writeD(item._count); Game_SyncNet.SendPacket(pk.mstream.ToArray(), gs._syncConn); } }
private static void WriteCharaInfo(SendGPacket pk,Room room,SLOT slot,CupomEffects effects) { int id = room.room_type == (byte)7 || room.room_type == (byte)12 ? (room.rodada == 1 && slot._team == 1 || room.rodada == 2 && slot._team == 0 ? (room.rodada == 2 ? slot._equip._red : slot._equip._blue) : (room.TRex != slot._id ? slot._equip._dino : -1)) : (slot._team == 0 ? slot._equip._red : slot._equip._blue); int num = 0; if (effects.HasFlag((System.Enum)CupomEffects.Ketupat)) { num += 10; } if (effects.HasFlag((System.Enum)CupomEffects.HP5)) { num += 5; } if (effects.HasFlag((System.Enum)CupomEffects.HP10)) { num += 10; } if (id == -1) { pk.writeC(byte.MaxValue); pk.writeH(ushort.MaxValue); } else { pk.writeC((byte)ComDiv.getIdStatics(id,2)); pk.writeH((short)ComDiv.getIdStatics(id,4)); } pk.writeC((byte)num); pk.writeC(effects.HasFlag((System.Enum)CupomEffects.C4SpeedKit)); }
public static void Load(Clan clan, int type) { foreach (GameServerModel server in ServersXML._servers) { if (server._id != 0 && server._id != ConfigGS.serverId) { using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)21); sendGpacket.writeC((byte)type); sendGpacket.writeD(clan._id); if (type == 0) { sendGpacket.writeQ(clan.owner_id); sendGpacket.writeD(clan.creationDate); sendGpacket.writeC((byte)(clan._name.Length + 1)); sendGpacket.writeS(clan._name, clan._name.Length + 1); sendGpacket.writeC((byte)(clan._info.Length + 1)); sendGpacket.writeS(clan._info, clan._info.Length + 1); } Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), server.Connection); } } } }
public static void Load(Account player, Friend friend, int type) { if (player == null) { return; } GameServerModel server = Game_SyncNet.GetServer(player._status); if (server == null) { return; } using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)17); sendGpacket.writeQ(player.player_id); sendGpacket.writeC((byte)type); sendGpacket.writeQ(friend.player_id); if (type != 2) { sendGpacket.writeC((byte)friend.state); sendGpacket.writeC(friend.removed); } Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), server.Connection); } }
public static void Update(Clan clan, int type) { foreach (GameServerModel server in ServersXML._servers) { if (server._id != 0 && server._id != ConfigGS.serverId) { using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)22); sendGpacket.writeC((byte)type); switch (type) { case 0: sendGpacket.writeQ(clan.owner_id); break; case 1: sendGpacket.writeC((byte)(clan._name.Length + 1)); sendGpacket.writeS(clan._name, clan._name.Length + 1); break; case 2: sendGpacket.writeC((byte)clan._name_color); break; } Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), server.Connection); } } } }
private void WriteSlotInfo(SLOT s,Account p,string client,SendGPacket pk) { pk.writeC((byte)s._id); pk.writeD(s._equip._red); pk.writeD(s._equip._blue); pk.writeD(s._equip._helmet); pk.writeD(s._equip._beret); pk.writeD(s._equip._dino); pk.writeD(s._equip._primary); pk.writeD(s._equip._secondary); pk.writeD(s._equip._melee); pk.writeD(s._equip._grenade); pk.writeD(s._equip._special); pk.writeD(0); if (p != null) { pk.writeC((byte)p._titles.Equiped1); pk.writeC((byte)p._titles.Equiped2); pk.writeC((byte)p._titles.Equiped3); } else { pk.writeB(new byte[3]); } if (!(client == "1.15.42")) { return; } pk.writeD(0); }
public static void sendAllow(string ip) { // codigo de operação - 1 byte // ipSize - 1 byte // ip UdpClient udpClient = new UdpClient("127.0.0.1", 1911); SendGPacket pk = new SendGPacket(); pk.writeC(23); pk.writeC((byte)ip.Length); pk.writeB(Encoding.ASCII.GetBytes(ip)); try { udpClient.Send(pk.mstream.ToArray(), pk.mstream.ToArray().Length); } catch (Exception ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[Firewall] Fatal Error!"); } }
private static void WriteItemsData(GoodItem good, SendGPacket p) { p.writeD(good._item._id); p.writeC((byte)good.auth_type); p.writeC((byte)good.buy_type2); p.writeC((byte)good.buy_type3); p.writeC((byte)good.title); }
private void WriteData(Account member, SendGPacket p) { p.writeQ(member.player_id); p.writeS(member.player_name, 33); p.writeC((byte)member._rank); p.writeC((byte)member.clanAccess); p.writeQ(ComDiv.GetClanStatus(member._status, member._isOnline)); p.writeD(member.clanDate); p.writeC((byte)member.name_color); }
private static void WriteGoodsData(GoodItem good, SendGPacket p) { p.writeD(good.id); p.writeC(1); p.writeC((byte)(good.visibility == 4 ? 4 : 1)); //Flag1 = Show icon + Buy option | Flag2 = UNK | Flag4 = Show icon + No buy option p.writeD(good.price_gold); p.writeD(good.price_cash); p.writeC((byte)good.tag); }
private void WriteRoomData(Room room, SendGPacket p) { int num = 0; p.writeD(room._roomId); p.writeS(room.name, 23); p.writeH((short)room.mapId); p.writeC(room.stage4v4); p.writeC(room.room_type); p.writeC((byte)room._state); p.writeC((byte)room.getAllPlayers().Count); p.writeC((byte)room.getSlotCount()); p.writeC((byte)room._ping); p.writeC(room.weaponsFlag); if (room.random_map > (byte)0) { num += 2; } if (room.password.Length > 0) { num += 4; } if (room.limit > (byte)0 && room._state > RoomState.Ready) { num += 128; } p.writeC((byte)num); p.writeC(room.special); }
private void WriteRoomData(Room room, SendGPacket p) { int restrictions = 0; p.writeD(room._roomId); p.writeS(room.name, 23); p.writeH((short)room.mapId); p.writeC(room.stage4v4); p.writeC(room.room_type); p.writeC((byte)room._state); p.writeC((byte)room.getAllPlayers().Count); p.writeC((byte)room.getSlotCount()); p.writeC((byte)room._ping); p.writeC(room.weaponsFlag); if (room.random_map > 0) { restrictions += 2; } if (room.password.Length > 0) { restrictions += 4; } if (room.limit > 0 && (int)room._state > 0) { restrictions += 128; } p.writeC((byte)restrictions); p.writeC(room.special); }
private void WriteData(Clan clan, SendGPacket p) { p.writeD(clan._id); p.writeS(clan._name, 17); p.writeC((byte)clan._rank); p.writeC((byte)PlayerManager.getClanPlayers(clan._id)); p.writeC((byte)clan.maxPlayers); p.writeD(clan.creationDate); p.writeD(clan._logo); p.writeC((byte)clan._name_color); }
public static void SendRefreshPacket(int type, long playerId, long memberId, bool isConnect, GameServerModel gs) { using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)11); sendGpacket.writeC((byte)type); sendGpacket.writeC(isConnect); sendGpacket.writeQ(playerId); sendGpacket.writeQ(memberId); Auth_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), gs.Connection); } }
private void WritePlayerData(Account pl, SendGPacket p) { Clan clan = ClanManager.getClan(pl.clanId); p.writeD(pl.getSessionId()); p.writeD(clan._logo); p.writeS(clan._name, 17); p.writeH((short)pl.getRank()); p.writeS(pl.player_name, 33); p.writeC((byte)pl.name_color); p.writeC((byte)31); }
public static void SendRefreshPacket(int type, long playerId, long memberId, bool isConnect, GameServerModel gs) { using (SendGPacket pk = new SendGPacket()) { pk.writeH(11); pk.writeC((byte)type); pk.writeC(isConnect); pk.writeQ(playerId); pk.writeQ(memberId); Auth_SyncNet.SendPacket(pk.mstream.ToArray(), gs._syncConn); } }
private static void WriteCharaInfo(SendGPacket pk,Room room,SLOT slot,CupomEffects effects) { int charaId = 0; if ((RoomType)room.room_type == RoomType.Boss || (RoomType)room.room_type == RoomType.Cross_Counter) { if (room.rodada == 1 && slot._team == 1 || room.rodada == 2 && slot._team == 0) { charaId = room.rodada == 2 ? slot._equip._red : slot._equip._blue; } else if (room.TRex == slot._id) { charaId = -1; } else { charaId = slot._equip._dino; } } else { charaId = slot._team == 0 ? slot._equip._red : slot._equip._blue; } int HPBonus = 0; if (effects.HasFlag(CupomEffects.Ketupat)) { HPBonus += 10; } if (effects.HasFlag(CupomEffects.HP5)) { HPBonus += 5; } if (effects.HasFlag(CupomEffects.HP10)) { HPBonus += 10; } if (charaId == -1) { pk.writeC(255); pk.writeH(65535); } else { pk.writeC((byte)ComDiv.getIdStatics(charaId,2)); pk.writeH((short)ComDiv.getIdStatics(charaId,4)); } pk.writeC((byte)HPBonus); pk.writeC(effects.HasFlag(CupomEffects.C4SpeedKit)); }
public static void SendUDPPlayerLeave(Room room, int slotId) { if (room == null) { return; } int playingPlayers = room.getPlayingPlayers(2, SLOT_STATE.BATTLE, 0, slotId); using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)2); sendGpacket.writeD(room.UniqueRoomId); sendGpacket.writeD(room.mapId * 16 + (int)room.room_type); sendGpacket.writeC((byte)slotId); sendGpacket.writeC((byte)playingPlayers); Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), room.UDPServer.Connection); } }
public static void SendUDPPlayerLeave(Room room, int slotId) { if (room == null) { return; } int count = room.getPlayingPlayers(2, SLOT_STATE.BATTLE, 0, slotId); using (SendGPacket pk = new SendGPacket()) { pk.writeH(2); pk.writeD(room.UniqueRoomId); pk.writeD((room.mapId * 16) + room.room_type); pk.writeC((byte)slotId); pk.writeC((byte)count); Game_SyncNet.SendPacket(pk.mstream.ToArray(), room.UDPServer._battleSyncConn); } }
// Send To battle public static void SendUDPRoundSync(Room room) { using (SendGPacket pk = new SendGPacket()) { pk.writeH(3); pk.writeD(room.UniqueRoomId); pk.writeD((room.mapId * 16) + room.room_type); pk.writeC((byte)room.rodada); SendPacket(pk.mstream.ToArray(),room.UDPServer._battleSyncConn); } }
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 Load(Account pl, Account member, int type) { if (pl == null) { return; } GameServerModel server = Game_SyncNet.GetServer(pl._status); if (server == null) { return; } using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)16); sendGpacket.writeQ(pl.player_id); sendGpacket.writeC((byte)type); switch (type) { case 1: sendGpacket.writeQ(member.player_id); sendGpacket.writeC((byte)(member.player_name.Length + 1)); sendGpacket.writeS(member.player_name, member.player_name.Length + 1); sendGpacket.writeB(member._status.buffer); sendGpacket.writeC((byte)member._rank); break; case 2: sendGpacket.writeQ(member.player_id); break; case 3: sendGpacket.writeD(pl.clanId); sendGpacket.writeC((byte)pl.clanAccess); break; } Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), server.Connection); } }
/// <summary> /// /// </summary> /// <param name="pl">Conta principal</param> /// <param name="member"></param> /// <param name="type">0=Zerar players e clanId|1=Adicionar|2=Remover|3=att clanid e aux</param> public static void Load(Account pl, Account member, int type) { if (pl == null) { return; } GameServerModel gs = Game_SyncNet.GetServer(pl._status); if (gs == null) { return; } using (SendGPacket pk = new SendGPacket()) { pk.writeH(16); pk.writeQ(pl.player_id); pk.writeC((byte)type); if (type == 1) //adicionar { pk.writeQ(member.player_id); pk.writeC((byte)(member.player_name.Length + 1)); pk.writeS(member.player_name, member.player_name.Length + 1); pk.writeB(member._status.buffer); pk.writeC((byte)member._rank); } else if (type == 2) //remover { pk.writeQ(member.player_id); } else if (type == 3) //atualizar id do clã e aux { pk.writeD(pl.clanId); pk.writeC((byte)pl.clanAccess); } Game_SyncNet.SendPacket(pk.mstream.ToArray(), gs._syncConn); } }
public static void LoadGoldCash(Account player) { if (player == null) { return; } GameServerModel server = Game_SyncNet.GetServer(player._status); if (server == null) { return; } using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)19); sendGpacket.writeQ(player.player_id); sendGpacket.writeC((byte)0); sendGpacket.writeC((byte)player._rank); sendGpacket.writeD(player._gp); sendGpacket.writeD(player._money); Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), server.Connection); } }
public static void LoadItem(Account player, ItemsModel item) { if (player == null || player._status.serverId == (byte)0) { return; } GameServerModel server = Game_SyncNet.GetServer(player._status); if (server == null) { return; } using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)18); sendGpacket.writeQ(player.player_id); sendGpacket.writeQ(item._objId); sendGpacket.writeD(item._id); sendGpacket.writeC((byte)item._equip); sendGpacket.writeC((byte)item._category); sendGpacket.writeD(item._count); Game_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), server.Connection); } }
/// <summary> /// Atualiza 'gp', 'money', 'rank'. /// </summary> /// <param name="player"></param> public static void LoadGoldCash(Account player) { if (player == null) { return; } GameServerModel gs = Game_SyncNet.GetServer(player._status); if (gs == null) { return; } using (SendGPacket pk = new SendGPacket()) { pk.writeH(19); pk.writeQ(player.player_id); pk.writeC(0); pk.writeC((byte)player._rank); pk.writeD(player._gp); pk.writeD(player._money); Game_SyncNet.SendPacket(pk.mstream.ToArray(), gs._syncConn); } }