public override void WriteImpl() { WriteH(0xf45); WriteD(playerSlot.getId()); WriteC((byte)playerSlot.getState()); WriteH((byte)playerSlot.getPlayer().getRank()); WriteB(new byte[8]); if (playerSlot.getPlayer().getClanID() == 0) { WriteC(0xff); WriteC(0xff); WriteC(0xff); WriteC(0xff); WriteC(0); WriteS("",0x16); } else { WriteC((byte)playerSlot.getPlayer().getClan().getLogo1()); WriteC((byte)playerSlot.getPlayer().getClan().getLogo2()); WriteC((byte)playerSlot.getPlayer().getClan().getLogo3()); WriteC((byte)playerSlot.getPlayer().getClan().getLogo4()); WriteC((byte)playerSlot.getPlayer().getClan().getColor()); WriteS(playerSlot.getPlayer().getClan().getName(),Clan.CLAN_NAME_SIZE); } WriteC((byte)playerSlot.getId()); WriteC((byte)playerSlot.getPlayer().PlayerName.Length); WriteC(0); WriteH((byte)(playerSlot.getPlayer().PlayerName.Length + 1)); WriteS(playerSlot.getPlayer().PlayerName,Player.MAX_NAME_SIZE); WriteC(0); }
public override void RunImpl() { Room room = getClient().getPlayer().getChannel().getRoom(roomId); if (room == null) { getClient().SendPacket(new PROTOCOL_LOBBY_JOIN_ROOM_ACK(null, 0, 0x80001004)); return; } if (room.getPassword() != null & room.getPassword() != password) { getClient().SendPacket(new PROTOCOL_LOBBY_ROOM_PASSWORD_ERROR_ACK()); return; } getClient().getPlayer().setRoom(room); room.addPlayer(getClient().getPlayer()); SLOT roomSlot = room.getRoomSlotByPlayer(getClient().getPlayer()); if (roomSlot == null) { getClient().SendPacket(new PROTOCOL_LOBBY_JOIN_ROOM_ACK(null, 0, 0x80001004)); } foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new PROTOCOL_ROOM_PLAYER_ENTER_ACK(roomSlot)); } getClient().getPlayer().getChannel().removePlayer(getClient().getPlayer()); getClient().SendPacket(new PROTOCOL_LOBBY_JOIN_ROOM_ACK(room, roomSlot.getId(), 0)); BattleHandler.AddPlayer(getClient().getPlayer()); }
public override void RunImpl() { Player player = getClient().getPlayer(); Room room = player.getRoom(); SLOT slot = room.getRoomSlotByPlayer(getClient().getPlayer()); if (room == null) { return; } Player leader = player.getRoom().getLeader(); room.getRoomSlotByPlayer(player).setState(SLOT_STATE.SLOT_STATE_PRESTART); getClient().SendPacket(new PROTOCOL_BATTLE_PRESTARTBATTLE_ACK(room, player)); if (player.PlayerID != leader.PlayerID) { leader.getClient().SendPacket(new PROTOCOL_BATTLE_PRESTARTBATTLE_ACK(room, player)); // лидер } Logger.Info("PRESTART {0}", slot.getState()); if (Array.BinarySearch(Room.RED_TEAM, slot.getId()) >= 0) { room.redTeamCount = room.redTeamCount + 1; } else { room.blueTeamCount = room.blueTeamCount + 1; } if (!room.getLeader().Equals(player) && (int)room.getRoomSlotByPlayer(room.getLeader()).getState() > 8) { BattleHandler.AddPlayer(player); } foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room)); } }
public override void WriteImpl() { WriteH(0xF25); WriteC(0); WriteC((byte)leaderSlot.getId()); WriteC(1);//(byte)slotcount if (slotcount > 1) { foreach (int slot in Room.RED_TEAM) { SLOT oldSlot = room.getRoomSlots()[slot]; SLOT newSlot = room.getRoomSlots()[slot + 1]; SLOT_STATE oldState = oldSlot.getState(); oldSlot.setState(newSlot.getState()); newSlot.setState(oldState); Player oldPlayer = oldSlot.getPlayer(); oldSlot.setPlayer(newSlot.getPlayer()); newSlot.setPlayer(oldPlayer); WriteC((byte)oldSlot.getId()); WriteC((byte)newSlot.getId()); WriteC((byte)(int)oldSlot.getState()); WriteC((byte)(int)newSlot.getState()); } } else { SLOT oldSlot = room.getRoomSlotByPlayer(sender); SLOT newSlot = room.changeTeam(sender,newTeam); WriteC((byte)oldSlot.getId()); WriteC((byte)newSlot.getId()); WriteC((byte)(int)oldSlot.getState()); WriteC((byte)(int)newSlot.getState()); } }
public override void RunImpl() { Channel channel = getClient().getPlayer().getChannel(); int roomsCount = 0; int slotID = 0; foreach (var room in channel.getRooms().ToArray()) { roomsCount = roomsCount + 1; } if (roomsCount == 0) { getClient().SendPacket(new PROTOCOL_LOBBY_QUICKJOIN_ACK()); } else { if (roomsCount == 1) { Room oneRoom = channel.getRoom(1 - 1); int State = 0; foreach (var slot in oneRoom.getRoomSlots().ToArray()) { if (slot.getState() == SLOT_STATE.SLOT_STATE_EMPTY) { slotID = slot.getId(); getClient().getPlayer().setRoom(oneRoom); oneRoom.addPlayer(getClient().getPlayer()); SLOT playerSlot = oneRoom.getRoomSlotByPlayer(getClient().getPlayer()); if (playerSlot == null) { getClient().SendPacket(new PROTOCOL_LOBBY_JOIN_ROOM_ACK(null, slotID, 0x80001004)); getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(oneRoom)); return; } foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new PROTOCOL_ROOM_PLAYER_ENTER_ACK(playerSlot)); } getClient().getPlayer().getChannel().removePlayer(getClient().getPlayer()); getClient().SendPacket(new PROTOCOL_LOBBY_JOIN_ROOM_ACK(oneRoom, playerSlot.getId(), 0)); foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(oneRoom)); } BattleHandler.AddPlayer(getClient().getPlayer()); State = 1; } } if (State == 0) { getClient().SendPacket(new PROTOCOL_LOBBY_QUICKJOIN_ACK()); } } else { Room rndRoom = channel.getRoomInId(new Random().Next(1, roomsCount)); getClient().getPlayer().setRoom(rndRoom); rndRoom.addPlayer(getClient().getPlayer()); SLOT playerSlot = rndRoom.getRoomSlotByPlayer(getClient().getPlayer()); if (playerSlot == null) { getClient().SendPacket(new PROTOCOL_LOBBY_JOIN_ROOM_ACK(null, slotID, 0x80001004)); getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(rndRoom)); return; } foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new PROTOCOL_ROOM_PLAYER_ENTER_ACK(playerSlot)); } getClient().getPlayer().getChannel().removePlayer(getClient().getPlayer()); getClient().SendPacket(new PROTOCOL_LOBBY_JOIN_ROOM_ACK(rndRoom, playerSlot.getId(), 0)); foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(rndRoom)); } BattleHandler.AddPlayer(getClient().getPlayer()); } } }