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 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()); } } }