//Resets player and map settings from the game public static void RevertGame() { lock (PropHuntPlayers) { foreach (Player p in PropHuntPlayers) { p.IsPlayingPropHunt = false; if (!p.IsPropHuntSeeker) { p.IsSolidBlock = false; p.Model = "steve"; } if (p.IsPropHuntTagged) { p.IsPropHuntTagged = false; } p.IsPropHuntSeeker = false; } } IsOn = false; _world.gameMode = GameMode.NULL; _world = null; Instance = null; _task.Stop(); }
public void VoteCheck() { if (!VoteIsOn) { return; } if (Voted1 > Voted2 || Voted1 > Voted3) { _winningWorld = World1; } else if (Voted2 > Voted1 || Voted2 > Voted3) { _winningWorld = World2; } else if (Voted3 > Voted1 || Voted3 > Voted2) { _winningWorld = World3; } else if (!Voted.Any()) { Logger.Log(LogType.Warning, "There we no votes. Voting will restart."); Server.Message("&WThere were no votes. Voting will restart."); _votingRestarting = true; TakeVote(); return; } Server.Players.Message("&S--------------------------------------------------------------"); Server.Players.Message("&SThe results are in! &A{0}&S:&C {1}, &A{2}&S:&C {3}, &A{4}&S:&C {5}", World1.ClassyName, Voted1, World2.ClassyName, Voted2, World3.ClassyName, Voted3); Server.Players.Message("&SThe next map is: {0}", _winningWorld.ClassyName); Server.Players.Message("&S--------------------------------------------------------------"); VoteIsOn = false; foreach (Player p in Voted) { p.HasVoted = false; } foreach (Player p in PropHuntPlayers) { #if DEBUG p.Message("Joining new world."); #endif p.JoinWorld(_winningWorld); } var game = new PropHunt(_winningWorld); Voted1 = 0; Voted2 = 0; Voted3 = 0; game.Start(); _restartGame = true; }
private static void GameHandler(Player player, Command cmd) { string GameMode = cmd.Next(); string Option = cmd.Next(); World world = player.World; if (PropHunt.StartMode != Game.StartMode.None) { player.Message("&cThere is already a game running!"); return; } if (GameMode == null) { CdGame.PrintUsage(player); return; } if (GameMode.ToLower() == "zombie") { if (Option.ToLower() == "start") { ZombieSurvival game = new ZombieSurvival(player.World); //move to world game.Start(); return; } else if (Option.ToLower() == "stop") { ZombieSurvival.Stop(player); Server.Message("{0} &cended the game of zombie survival in the world {1}", player.ClassyName, world.ClassyName); return; } } if (GameMode.ToLower() == "minefield") { if (Option == null) { player.Message("&cYou must choose an option! &astart/stop"); return; } else if (Option.ToLower() == "start") { if (WorldManager.FindWorldExact("Minefield") != null) { player.Message("&WA game of Minefield is currently running and must first be stopped"); return; } else { MineField.GetInstance(); MineField.Start(player); return; } } else if (Option.ToLower() == "stop") { if (WorldManager.FindWorldExact("Minefield") == null) { player.Message("&WA game of Minefield is currently not running"); return; } MineField.Stop(player, false); return; } } if (GameMode.ToLower() == "prophunt") { if (Option == null) { player.Message("&cYou must choose an option! &astart/stop"); return; } if (Option.ToLower() == "start") { PropHunt game = new PropHunt(player.World); //move to world game.Start(); } } else { CdGame.PrintUsage(player); return; } }