private void TryBalanceTeams(Room room, bool isBotMode) { if (room.autobalans != 1 || isBotMode) { return; } int TeamIdx = AllUtils.getBalanceTeamIdx(room, false, -1); if (TeamIdx == -1) { return; } int[] teamArray = TeamIdx == 1 ? room.RED_TEAM : room.BLUE_TEAM; SLOT LastSlot = null; for (int i = teamArray.Length - 1; i >= 0; i--) { SLOT slot = room._slots[teamArray[i]]; if ((int)slot.state == 8 && room._leader != slot._id) { LastSlot = slot; break; } } Account player; if (LastSlot != null && room.getPlayerBySlot(LastSlot,out player)) { AllUtils.TryBalancePlayer(room,player,false,ref LastSlot); } }
private void TryBalanceTeams(Room room, bool isBotMode) { if (room.autobalans != 1 | isBotMode) { return; } int[] numArray1; switch (AllUtils.getBalanceTeamIdx(room, false, -1)) { case -1: return; case 1: numArray1 = room.RED_TEAM; break; default: numArray1 = room.BLUE_TEAM; break; } int[] numArray2 = numArray1; SLOT mySlot = (SLOT)null; for (int index = numArray2.Length - 1; index >= 0; --index) { SLOT slot = room._slots[numArray2[index]]; if (slot.state == SLOT_STATE.READY && room._leader != slot._id) { mySlot = slot; break; } } Account player; if (mySlot == null || !room.getPlayerBySlot(mySlot,out player)) { return; } AllUtils.TryBalancePlayer(room,player,false,ref mySlot); }