public SLOT changeTeam(Account player,int team) { SLOT roomSlotByPlayer = this.getRoomSlotByPlayer(player); int[] array = (team == 0) ? this.RED_TEAM : this.BLUE_TEAM; SLOT result; for (int i = 0; i < array.Length; i++) { int num = array[i]; SLOT sLOT = this._slots[num]; bool flag = player.Equals(sLOT.getPlayer()) || sLOT.getState() == SLOT_STATE.SLOT_STATE_NORMAL; if (flag) { roomSlotByPlayer.setPlayer(null); roomSlotByPlayer.setState(SLOT_STATE.SLOT_STATE_NORMAL); sLOT.setPlayer(player); sLOT.setState(SLOT_STATE.SLOT_STATE_NORMAL); result = sLOT; return(result); } } result = null; return(result); }
public void RoomTask(Room room) { int num = 0; foreach (Account current in room.getReadyPlayerList()) { SLOT roomSlotByPlayer = room.getRoomSlotByPlayer(current); bool flag = roomSlotByPlayer.state > SLOT_STATE.SLOT_STATE_READY && roomSlotByPlayer.state < SLOT_STATE.SLOT_STATE_BATTLE_READY; if (flag) { num++; } } SLOT roomSlotByPlayer2 = room.getRoomSlotByPlayer(room.getLeader()); bool flag2 = roomSlotByPlayer2.state < SLOT_STATE.SLOT_STATE_BATTLE; if (flag2) { bool flag3 = num == 0; if (flag3) { bool flag4 = roomSlotByPlayer2.state < SLOT_STATE.SLOT_STATE_BATTLE; if (flag4) { foreach (Account current2 in room.getReadyPlayerList()) { SLOT roomSlotByPlayer3 = room.getRoomSlotByPlayer(current2); bool flag5 = roomSlotByPlayer3.state == SLOT_STATE.SLOT_STATE_BATTLE_READY; if (flag5) { roomSlotByPlayer3.setState(SLOT_STATE.SLOT_STATE_BATTLE); current2.getClient().sendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(current2)); foreach (Account current3 in room.getReadyPlayerList()) { bool flag6 = !current3.Equals(current2); if (flag6) { SLOT roomSlotByPlayer4 = room.getRoomSlotByPlayer(current3); bool flag7 = roomSlotByPlayer4.state > SLOT_STATE.SLOT_STATE_PRESTART; if (flag7) { current2.getClient().sendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(current3)); } } } current2.getClient().sendPacket(new PROTOCOL_BATTLE_MISSION_ROUND_START_ACK(room)); } } } } } else { foreach (Account current4 in room.getReadyPlayerList()) { SLOT roomSlotByPlayer5 = room.getRoomSlotByPlayer(current4); bool flag8 = roomSlotByPlayer5.state == SLOT_STATE.SLOT_STATE_BATTLE_READY; if (flag8) { current4.getClient().sendPacket(new PROTOCOL_BATTLE_AI_COLLISION_ACK(room)); roomSlotByPlayer5.setState(SLOT_STATE.SLOT_STATE_BATTLE); current4.getClient().sendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(current4)); foreach (Account current5 in room.getReadyPlayerList()) { SLOT sLOT = room._slots[current5.getSlot()]; bool flag9 = sLOT.state == SLOT_STATE.SLOT_STATE_BATTLE && !current4.Equals(current5); if (flag9) { current5.getClient().sendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(current4)); current4.getClient().sendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(current5)); } } current4.getClient().sendPacket(new PROTOCOL_BATTLE_MISSION_ROUND_START_ACK(room)); } } } foreach (Account current6 in room.getReadyPlayerList()) { current6.getClient().sendPacket(new PROTOCOL_ROOM_GET_SLOTINFO_ACK(room)); } CLogger.getInstance().info("State= " + roomSlotByPlayer2.state); }