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); } }
public static void UpdateGSCount(int serverId) { try { if ((DateTime.Now - Auth_SyncNet.LastSyncCount).TotalSeconds < 2.5) { return; } Auth_SyncNet.LastSyncCount = DateTime.Now; int count = LoginManager._socketList.Count; foreach (GameServerModel server in ServersXML._servers) { if (server._id == serverId) { server._LastCount = count; } else { using (SendGPacket sendGpacket = new SendGPacket()) { sendGpacket.writeH((short)15); sendGpacket.writeD(serverId); sendGpacket.writeD(count); Auth_SyncNet.SendPacket(sendGpacket.mstream.ToArray(), server.Connection); } } } } catch (Exception ex) { Logger.warning(ex.ToString()); } }
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 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); } } }
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); }
// 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); } }
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 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); } }
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); }
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 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 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); }
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); } }
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); } }
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); }
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 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 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()); } }
/// <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); } }
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); } }
private void WriteData(ClanInvite invite, SendGPacket p) { p.writeQ(invite.player_id); Account pl = AccountManager.getAccount(invite.player_id, 0); if (pl != null) { p.writeS(pl.player_name, 33); p.writeC((byte)pl._rank); } else { p.writeB(new byte[34]); } p.writeD(invite.inviteDate); }
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); } }
private static void WriteMatchData(GoodItem good, SendGPacket p) { p.writeD(good.id); p.writeD(good._item._id); p.writeD(good._item._count); }
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); }