public static void EndRound(Room room,byte winner) { room.swapRound = true; if (winner == 0) { room.red_rounds++; } else if (winner == 1) { room.blue_rounds++; } AllUtils.BattleEndRound(room,winner,RoundEndType.Normal); }
public static void EndBattleByDeath(Room room,SLOT killer,bool isBotMode,bool isSuicide) { if ((room.room_type == 1 || room.room_type == 8 || room.room_type == 13) && !isBotMode) { AllUtils.BattleEndKills(room,isBotMode); } else if (!killer.specGM && (room.room_type == 2 || room.room_type == 4)) //Destruição e Supressão { int redDeaths,blueDeaths,allRed,allBlue,winner = 0; room.getPlayingPlayers(true,out allRed,out allBlue,out redDeaths,out blueDeaths); if (redDeaths == allRed && killer._team == 0 && isSuicide && !room.C4_actived) { winner = 1; room.blue_rounds++; AllUtils.BattleEndRound(room,winner,true); } else if (blueDeaths == allBlue && killer._team == 1) { room.red_rounds++; AllUtils.BattleEndRound(room,winner,true); } else if (redDeaths == allRed && killer._team == 1) { if (!room.C4_actived) { winner = 1; room.blue_rounds++; } else if (isSuicide) { room.red_rounds++; } AllUtils.BattleEndRound(room,winner,false); } else if (blueDeaths == allBlue && killer._team == 0) { if (!isSuicide || !room.C4_actived) { room.red_rounds++; } else { winner = 1; room.blue_rounds++; } AllUtils.BattleEndRound(room,winner,true); } } }
public static void EndRound(Room room,byte winner) { room.swapRound = true; switch (winner) { case 0: ++room.red_rounds; break; case 1: ++room.blue_rounds; break; } AllUtils.BattleEndRound(room,(int)winner,RoundEndType.Normal); }
public static void UninstallBomb(Room room,SLOT slot) { if (!room.C4_actived) { return; } using (BATTLE_MISSION_BOMB_UNINSTALL_PAK packet = new BATTLE_MISSION_BOMB_UNINSTALL_PAK(slot._id)) room.SendPacketToPlayers(packet,SLOT_STATE.BATTLE,0); if (room.room_type != 10) { slot.objetivos++; room.blue_rounds++; AllUtils.CompleteMission(room,slot,MISSION_TYPE.C4_DEFUSE,0); AllUtils.BattleEndRound(room,1,RoundEndType.Uninstall); } }
public static void EndBattleByDeath(Room room,SLOT killer,bool isBotMode,bool isSuicide) { if ((room.room_type == (byte)1 || room.room_type == (byte)8 || room.room_type == (byte)13) && !isBotMode) { AllUtils.BattleEndKills(room,isBotMode); } else { if (killer.specGM || room.room_type != (byte)2 && room.room_type != (byte)4) { return; } int winner1 = 0; int RedPlayers; int BluePlayers; int RedDeaths; int BlueDeaths; room.getPlayingPlayers(true,out RedPlayers,out BluePlayers,out RedDeaths,out BlueDeaths); if (((RedDeaths != RedPlayers ? 0 : (killer._team == 0 ? 1 : 0)) & (isSuicide ? 1 : 0)) != 0 && !room.C4_actived) { int winner2 = 1; ++room.blue_rounds; AllUtils.BattleEndRound(room,winner2,true); } else if (BlueDeaths == BluePlayers && killer._team == 1) { ++room.red_rounds; AllUtils.BattleEndRound(room,winner1,true); } else if (RedDeaths == RedPlayers && killer._team == 1) { if (!room.C4_actived) { winner1 = 1; ++room.blue_rounds; } else if (isSuicide) { ++room.red_rounds; } AllUtils.BattleEndRound(room,winner1,false); } else { if (BlueDeaths != BluePlayers || killer._team != 0) { return; } if (!isSuicide || !room.C4_actived) { ++room.red_rounds; } else { winner1 = 1; ++room.blue_rounds; } AllUtils.BattleEndRound(room,winner1,true); } } }
private void EndRound(Room room,bool isBotMode) { try { room.swapRound = true; if (room.room_type == (byte)7 || room.room_type == (byte)12) { if (room.rodada == 1) { room.rodada = 2; for (int index = 0; index < 16; ++index) { SLOT slot = room._slots[index]; if (slot.state == SLOT_STATE.BATTLE) { slot.killsOnLife = 0; slot.lastKillState = 0; slot.repeatLastState = false; } } List <int> dinossaurs = AllUtils.getDinossaurs(room,true,-2); using (BATTLE_ROUND_WINNER_PAK battleRoundWinnerPak = new BATTLE_ROUND_WINNER_PAK(room,2,RoundEndType.TimeOut)) { using (BATTLE_ROUND_RESTART_PAK battleRoundRestartPak = new BATTLE_ROUND_RESTART_PAK(room,dinossaurs,isBotMode)) room.SendPacketToPlayers((SendPacket)battleRoundWinnerPak,(SendPacket)battleRoundRestartPak,SLOT_STATE.BATTLE,0); } room.round.StartJob(5250,(TimerCallback)(callbackState => { if (room._state == RoomState.Battle) { room.BattleStart = DateTime.Now.AddSeconds(5.0); using (BATTLE_TIMERSYNC_PAK battleTimersyncPak = new BATTLE_TIMERSYNC_PAK(room)) room.SendPacketToPlayers((SendPacket)battleTimersyncPak,SLOT_STATE.BATTLE,0); } room.swapRound = false; lock (callbackState) room.round.Timer = (Timer)null; })); } else { if (room.rodada != 2) { return; } AllUtils.EndBattle(room,isBotMode); } } else if (room.thisModeHaveRounds()) { int winner = 1; if (room.room_type != (byte)3) { ++room.blue_rounds; } else if (room.Bar1 > room.Bar2) { ++room.red_rounds; winner = 0; } else if (room.Bar1 < room.Bar2) { ++room.blue_rounds; } else { winner = 2; } AllUtils.BattleEndRound(room,winner,RoundEndType.TimeOut); } else { List <Account> allPlayers = room.getAllPlayers(SLOT_STATE.READY,1); if (allPlayers.Count != 0) { TeamResultType winnerTeam = AllUtils.GetWinnerTeam(room); room.CalculateResult(winnerTeam,isBotMode); using (BATTLE_ROUND_WINNER_PAK battleRoundWinnerPak = new BATTLE_ROUND_WINNER_PAK(room,winnerTeam,RoundEndType.TimeOut)) { ushort result1; ushort result2; byte[] data; AllUtils.getBattleResult(room,out result1,out result2,out data); byte[] completeBytes = battleRoundWinnerPak.GetCompleteBytes("BATTLE_TIMERSYNC_REC"); foreach (Account p in allPlayers) { if (room._slots[p._slotId].state == SLOT_STATE.BATTLE) { p.SendCompletePacket(completeBytes); } p.SendPacket((SendPacket) new BATTLE_ENDBATTLE_PAK(p,winnerTeam,result2,result1,isBotMode,data)); } } } AllUtils.resetBattleInfo(room); } } catch (Exception ex) { if (room != null) { Logger.error("[!] Crash no BATTLE_TIMERSYNC_REC, Sala: " + (object)room._roomId + ";" + (object)room._channelId + ";" + (object)room.room_type); } Logger.error("[BATTLE_TIMERSYNC_REC2] " + ex.ToString()); } }
private void EndRound(Room room,bool isBotMode) { try { room.swapRound = true; if (room.room_type == 7 || room.room_type == 12) { if (room.rodada == 1) { room.rodada = 2; for (int i = 0; i < 16; i++) { SLOT slot = room._slots[i]; if (slot.state == SLOT_STATE.BATTLE) { slot.killsOnLife = 0; slot.lastKillState = 0; slot.repeatLastState = false; } } List <int> dinos = AllUtils.getDinossaurs(room,true,-2); using (BATTLE_ROUND_WINNER_PAK packet = new BATTLE_ROUND_WINNER_PAK(room,2,RoundEndType.TimeOut)) using (BATTLE_ROUND_RESTART_PAK packet2 = new BATTLE_ROUND_RESTART_PAK(room,dinos,isBotMode)) room.SendPacketToPlayers(packet,packet2,SLOT_STATE.BATTLE,0); room.round.StartJob(5250,(callbackState) => { if (room._state == RoomState.Battle) { room.BattleStart = DateTime.Now.AddSeconds(5); using (BATTLE_TIMERSYNC_PAK packet = new BATTLE_TIMERSYNC_PAK(room)) room.SendPacketToPlayers(packet,SLOT_STATE.BATTLE,0); } room.swapRound = false; lock (callbackState) { room.round.Timer = null; } }); } else if (room.rodada == 2) { AllUtils.EndBattle(room,isBotMode); } } else if (room.thisModeHaveRounds()) { int winner = 1; if (room.room_type != 3) { room.blue_rounds++; } else { if (room.Bar1 > room.Bar2) { room.red_rounds++; winner = 0; } else if (room.Bar1 < room.Bar2) { room.blue_rounds++; } else { winner = 2; } } AllUtils.BattleEndRound(room,winner,RoundEndType.TimeOut); } else { List <Account> players = room.getAllPlayers(SLOT_STATE.READY,1); if (players.Count == 0) { goto EndLabel; } TeamResultType winnerTeam = AllUtils.GetWinnerTeam(room); room.CalculateResult(winnerTeam,isBotMode); using (BATTLE_ROUND_WINNER_PAK packet = new BATTLE_ROUND_WINNER_PAK(room,winnerTeam,RoundEndType.TimeOut)) { ushort inBattle,missionCompletes; byte[] a1; AllUtils.getBattleResult(room,out missionCompletes,out inBattle,out a1); byte[] data = packet.GetCompleteBytes(); foreach (Account pR in players) { if (room._slots[pR._slotId].state == SLOT_STATE.BATTLE) { pR.SendCompletePacket(data); } pR.SendPacket(new BATTLE_ENDBATTLE_PAK(pR,winnerTeam,inBattle,missionCompletes,isBotMode,a1)); } } EndLabel: AllUtils.resetBattleInfo(room); } } catch (Exception ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[BATTLE_TIMERSYNC_REC2.EndRound] Erro fatal!"); if (room != null) { SaveLog.fatal("[!] Crash no BATTLE_TIMERSYNC_REC, Sala: " + room._roomId + ";" + room._channelId + ";" + room.room_type); } } }