public static TntWarsGame GetTntWarsGame(Player p) { TntWarsGame it = TntWarsGame.Find(p.level); if (it != null) { return(it); } it = FindFromGameNumber(p.CurrentTntGameNumber); return(it); }
public override void Use(Player p, string message) { if (message != "") { Help(p); return; } ushort x = (ushort)((0.5 + p.level.spawnx) * 32); ushort y = (ushort)((1 + p.level.spawny) * 32); ushort z = (ushort)((0.5 + p.level.spawnz) * 32); if (!p.referee) { if (!p.infected && Server.zombie.GameInProgess()) { Server.zombie.InfectPlayer(p); } } if (p.PlayingTntWars) { TntWarsGame it = TntWarsGame.GetTntWarsGame(p); if (it.GameMode == TntWarsGame.TntWarsGameMode.TDM && it.GameStatus != TntWarsGame.TntWarsGameStatus.WaitingForPlayers && it.GameStatus != TntWarsGame.TntWarsGameStatus.Finished && it.RedSpawn != null && it.BlueSpawn != null) { unchecked { p.SendPos((byte)-1, (ushort)((0.5 + (it.FindPlayer(p).Blue ? it.BlueSpawn[0] : it.RedSpawn[0]) * 32)), (ushort)((1 + (it.FindPlayer(p).Blue ? it.BlueSpawn[1] : it.RedSpawn[1]) * 32)), (ushort)((0.5 + (it.FindPlayer(p).Blue ? it.BlueSpawn[2] : it.RedSpawn[2]) * 32)), (byte)(it.FindPlayer(p).Blue ? it.BlueSpawn[3] : it.RedSpawn[3]), (byte)(it.FindPlayer(p).Blue ? it.BlueSpawn[4] : it.RedSpawn[4])); return; } } } unchecked { p.SendPos((byte)-1, x, y, z, p.level.rotx, p.level.roty); } }
public override void Use(Player p, string message) { string[] text = new string[5]; text[0] = ""; text[1] = ""; text[2] = ""; text[3] = ""; text[4] = ""; try { text[0] = message.ToLower().Split(' ')[0]; text[1] = message.ToLower().Split(' ')[1]; text[2] = message.ToLower().Split(' ')[2]; text[3] = message.ToLower().Split(' ')[3]; text[4] = message.ToLower().Split(' ')[4]; } catch { } switch (text[0]) { case "list": case "levels": case "l": if (TntWarsGame.GameList.Count <= 0) { Player.SendMessage(p, "There aren't any " + c.red + "TNT Wars " + Server.DefaultColor + "currently running!"); return; } else { Player.SendMessage(p, "Currently running " + c.red + "TNT Wars" + Server.DefaultColor + ":"); foreach (TntWarsGame T in TntWarsGame.GameList) { string msg = ""; if (T.GameMode == TntWarsGame.TntWarsGameMode.FFA) msg += "FFA on "; if (T.GameMode == TntWarsGame.TntWarsGameMode.TDM) msg += "TDM on "; msg += T.lvl.name + " "; if (T.GameDifficulty == TntWarsGame.TntWarsDifficulty.Easy) msg += "(Easy)"; if (T.GameDifficulty == TntWarsGame.TntWarsDifficulty.Normal) msg += "(Normal)"; if (T.GameDifficulty == TntWarsGame.TntWarsDifficulty.Hard) msg += "(Hard)"; if (T.GameDifficulty == TntWarsGame.TntWarsDifficulty.Extreme) msg += "(Extreme)"; msg += " "; if (T.GameStatus == TntWarsGame.TntWarsGameStatus.WaitingForPlayers) msg += "(Waiting For Players)"; if (T.GameStatus == TntWarsGame.TntWarsGameStatus.AboutToStart) msg += "(Starting)"; if (T.GameStatus == TntWarsGame.TntWarsGameStatus.GracePeriod) msg += "(Started)"; if (T.GameStatus == TntWarsGame.TntWarsGameStatus.InProgress) msg += "(In Progress)"; if (T.GameStatus == TntWarsGame.TntWarsGameStatus.Finished) msg += "(Finished)"; Player.SendMessage(p, msg); } } break; case "join": if (p.PlayingTntWars == true || (TntWarsGame.GetTntWarsGame(p) != null && TntWarsGame.GetTntWarsGame(p).Players.Contains(TntWarsGame.GetTntWarsGame(p).FindPlayer(p)))) { Player.SendMessage(p, "TNT Wars Error: You have already joined a game!"); return; } else { TntWarsGame it; bool add = true; if (text[1] == "red" || text[1] == "r" || text[1] == "1" || text[1] == "blue" || text[1] == "b" || text[1] == "2" || text[1] == "auto" || text[1] == "a" || text[1] == "") { it = TntWarsGame.Find(p.level); if (it == null) { Player.SendMessage(p, "TNT Wars Error: There isn't a game on your current level!"); return; } } else { Level lvl = Level.Find(text[1]); if (lvl == null) { Player.SendMessage(p, "TNT Wars Error: Couldn't find level '" + text[1] + "'"); return; } else { it = TntWarsGame.Find(lvl); if (it == null) { Player.SendMessage(p, "TNT Wars Error: There isn't a game on that level!"); return; } else { text[1] = text[2]; //so the switch later on still works } } } TntWarsGame.player pl = new TntWarsGame.player(p); if (it.GameStatus == TntWarsGame.TntWarsGameStatus.AboutToStart || it.GameStatus == TntWarsGame.TntWarsGameStatus.GracePeriod || it.GameStatus == TntWarsGame.TntWarsGameStatus.InProgress) { pl.spec = true; } if (it.GameMode == TntWarsGame.TntWarsGameMode.TDM) { int Red = it.RedTeam(); int Blue = it.BlueTeam(); switch (text[1]) { case "red": case "r": case "1": if (it.BalanceTeams) { if (Red > Blue) { add = false; Player.SendMessage(p, "TNT Wars Error: Red has too many players!"); return; } } pl.Red = true; break; case "blue": case "b": case "2": if (it.BalanceTeams) { if (Blue > Red) { add = false; Player.SendMessage(p, "TNT Wars Error: Blue has too many players!"); return; } } pl.Blue = true; break; case "auto": case "a": default: if (Blue > Red) { pl.Red = true; break; } else if (Red > Blue) { pl.Blue = true; break; } else if (it.RedScore > it.BlueScore) { pl.Blue = true; break; } else if (it.BlueScore > it.RedScore) { pl.Red = true; break; } else { pl.Red = true; break; } } } else { pl.Red = false; pl.Blue = false; } if (add) { it.Players.Add(pl); TntWarsGame.SetTitlesAndColor(pl); p.CurrentTntGameNumber = it.GameNumber; string msg = p.color + p.name + Server.DefaultColor + " " + "joined TNT Wars on '" + it.lvl.name + "'"; if (pl.Red) { msg += " on the " + c.red + "red team"; } if (pl.Blue) { msg += " on the " + c.blue + "blue team"; } if (pl.spec) { msg += Server.DefaultColor + " (as a spectator)"; } Player.GlobalMessage(msg); } } break; case "leave": case "exit": p.canBuild = true; TntWarsGame game = TntWarsGame.GetTntWarsGame(p); game.Players.Remove(game.FindPlayer(p)); game.SendAllPlayersMessage("TNT Wars: " + p.color + p.name + Server.DefaultColor + " left the TNT Wars game!"); TntWarsGame.SetTitlesAndColor(game.FindPlayer(p), true); Player.SendMessage(p, "TNT Wars: You left the game"); break; case "rules": case "rule": case "r": switch (text[1]) { case "all": case "a": case "everyone": if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1)) { foreach (Player who in Player.players) { Player.SendMessage(who, "TNT Wars Rules: (sent to all players by " + p.color + p.name + Server.DefaultColor + " )"); Player.SendMessage(who, "The aim of the game is to blow up people using TNT!"); Player.SendMessage(who, "To place tnt simply place a TNT block and after a short delay it shall explode!"); Player.SendMessage(who, "During the game the amount of TNT placable at one time may be limited!"); Player.SendMessage(who, "You are not allowed to use hacks of any sort during the game!"); } Player.SendMessage(p, "TNT Wars: Sent rules to all players"); return; } break; case "level": case "l": case "lvl": case "map": case "m": if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1)) { foreach (Player who in p.level.players) { Player.SendMessage(who, "TNT Wars Rules: (sent to all players in map by " + p.color + p.name + Server.DefaultColor + " )"); Player.SendMessage(who, "The aim of the game is to blow up people using TNT!"); Player.SendMessage(who, "To place tnt simply place a TNT block and after a short delay it shall explode!"); Player.SendMessage(who, "During the game the amount of TNT placable at one time may be limited!"); Player.SendMessage(who, "You are not allowed to use hacks of any sort during the game!"); } Player.SendMessage(p, "TNT Wars: Sent rules to all current players in map"); return; } break; case "players": case "pls": case "pl": case "p": if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1)) { TntWarsGame gm = TntWarsGame.GetTntWarsGame(p); if (gm == null) { Player.SendMessage(p, "TNT Wars Error: You aren't in a TNT Wars game!"); return; } else { foreach (TntWarsGame.player who in gm.Players) { Player.SendMessage(who.p, "TNT Wars Rules: (sent to all current players by " + p.color + p.name + Server.DefaultColor + " )"); Player.SendMessage(who.p, "The aim of the game is to blow up people using TNT!"); Player.SendMessage(who.p, "To place tnt simply place a TNT block and after a short delay it shall explode!"); Player.SendMessage(who.p, "During the game the amount of TNT placable at one time may be limited!"); Player.SendMessage(who.p, "You are not allowed to use hacks of any sort during the game!"); } Player.SendMessage(p, "TNT Wars: Sent rules to all current players"); return; } } break; default: if (text[1] != null && (int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1)) { Player who = Player.Find(text[1]); if (who != null) { Player.SendMessage(who, "TNT Wars Rules: (sent to you by " + p.color + p.name + Server.DefaultColor + " )"); Player.SendMessage(who, "The aim of the game is to blow up people using TNT!"); Player.SendMessage(who, "To place tnt simply place a TNT block and after a short delay it shall explode!"); Player.SendMessage(who, "During the game the amount of TNT placable at one time may be limited!"); Player.SendMessage(who, "You are not allowed to use hacks of any sort during the game!"); Player.SendMessage(p, "TNT Wars: Sent rules to " + who.color + who.name); return; } else { Player.SendMessage(p, "TNT Wars Error: Couldn't find player '" + text[1] + "' to send rules to!"); return; } } else { Player.SendMessage(p, "TNT Wars Rules:"); Player.SendMessage(p, "The aim of the game is to blow up people using TNT!"); Player.SendMessage(p, "To place tnt simply place a TNT block and after a short delay it shall explode!"); Player.SendMessage(p, "During the game the amount of TNT placable at one time may be limited!"); Player.SendMessage(p, "You are not allowed to use hacks of any sort during the game!"); return; } break; } break; case "score": case "scores": case "leaderboard": case "board": TntWarsGame tntwrs = TntWarsGame.GetTntWarsGame(p); switch (text[1]) { case "top": case "leaders": if (tntwrs.GameStatus == TntWarsGame.TntWarsGameStatus.InProgress) { int max = 5; if (tntwrs.PlayingPlayers() < 5) { max = tntwrs.PlayingPlayers(); } var pls = from pla in tntwrs.Players orderby pla.Score descending select pla; //LINQ FTW int count = 1; foreach (var pl in pls) { Player.SendMessage(p, count.ToString() + ": " + pl.p.name + " - " + pl.Score.ToString()); if (count >= max) { break; } count++; Thread.Sleep(500); //Maybe, not sure (250??) } } else { Player.SendMessage(p, "TNT Wars Error: Can't display scores - game not in progress!"); } break; case "teams": case "team": case "t": case "red": case "blue": if (tntwrs.GameStatus == TntWarsGame.TntWarsGameStatus.InProgress) { if (tntwrs.GameMode == TntWarsGame.TntWarsGameMode.TDM) { Player.SendMessage(p, "TNT Wars Scores:"); Player.SendMessage(p, c.red + "RED: " + c.white + tntwrs.RedScore + " " + c.red + "(" + (tntwrs.ScoreLimit - tntwrs.RedScore).ToString() + " needed)"); Player.SendMessage(p, c.blue + "BLUE: " + c.white + tntwrs.BlueScore + " " + c.red + "(" + (tntwrs.ScoreLimit - tntwrs.BlueScore).ToString() + " needed)"); } else { Player.SendMessage(p, "TNT Wars Error: Can't display team scores as this isn't team deathmatch!"); } } else { Player.SendMessage(p, "TNT Wars Error: Can't display scores - game not in progress!"); } break; case "me": case "mine": case "score": case "i": default: if (tntwrs.GameStatus == TntWarsGame.TntWarsGameStatus.InProgress) { Player.SendMessage(p, "TNT Wars: Your Score: " + c.white + TntWarsGame.GetTntWarsGame(p).FindPlayer(p).Score); } else { Player.SendMessage(p, "TNT Wars Error: Can't display scores - game not in progress!"); } break; } return; case "players": case "player": case "ps": case "pl": case "p": Player.SendMessage(p, "TNT Wars: People playing TNT Wars on '" + TntWarsGame.GetTntWarsGame(p).lvl.name + "':"); foreach (TntWarsGame.player pl in TntWarsGame.GetTntWarsGame(p).Players) { if (TntWarsGame.GetTntWarsGame(p).GameMode == TntWarsGame.TntWarsGameMode.TDM) { if (pl.Red && pl.spec) Player.SendMessage(p, pl.p.color + pl.p.name + Server.DefaultColor + " - " + c.red + "RED" + Server.DefaultColor + " (spectator)"); else if (pl.Blue && pl.spec) Player.SendMessage(p, pl.p.color + pl.p.name + Server.DefaultColor + " - " + c.blue + "BLUE" + Server.DefaultColor + " (spectator)"); else if (pl.Red) Player.SendMessage(p, pl.p.color + pl.p.name + Server.DefaultColor + " - " + c.red + "RED" + Server.DefaultColor); else if (pl.Blue) Player.SendMessage(p, pl.p.color + pl.p.name + Server.DefaultColor + " - " + c.blue + "BLUE" + Server.DefaultColor); } else { if (pl.spec) Player.SendMessage(p, pl.p.color + pl.p.name + Server.DefaultColor + " (spectator)"); else Player.SendMessage(p, pl.p.color + pl.p.name); } } break; case "health": case "heal": case "hp": case "hlth": if (TntWarsGame.GetTntWarsGame(p).GameStatus == TntWarsGame.TntWarsGameStatus.InProgress) { Player.SendMessage(p, "TNT Wars: You have " + p.TntWarsHealth.ToString() + " health left"); } else { Player.SendMessage(p, "TNT Wars Error: Can't display health - game not in progress!"); return; } break; case "setup": case "s": if ((int)p.group.Permission >= CommandOtherPerms.GetPerm(this, 1)) { bool justcreated = false; TntWarsGame it = TntWarsGame.FindFromGameNumber(p.CurrentTntGameNumber); if (it == null) { if (text[1] != "new" && text[1] != "n") { Player.SendMessage(p, "TNT Wars Error: You must create a new game by typing '/tntwars setup new'"); return; } } if (it != null) { if (it.GameStatus == TntWarsGame.TntWarsGameStatus.InProgress || it.GameStatus == TntWarsGame.TntWarsGameStatus.GracePeriod || it.GameStatus == TntWarsGame.TntWarsGameStatus.AboutToStart) { if (text[1] != "stop" && text[1] != "s" && text[1] != "" && text[1] != "status" && text[1] != "ready" && text[1] != "check" && text[1] != "info" && text[1] != "r" && text[1] != "c") { Player.SendMessage(p, "TNT Wars Error: Cannot edit current game because it is currently running!"); return; } } } switch (text[1]) { case "new": case "n": if (it != null) { if (it.FindPlayer(p) != null) { Player.SendMessage(p, "TNT Wars Error: Please leave the current game first!"); return; } } if (it == null || it.lvl != p.level) { it = new TntWarsGame(p.level); it.GameNumber = TntWarsGame.GameList.Count + 1; TntWarsGame.GameList.Add(it); p.CurrentTntGameNumber = it.GameNumber; Player.SendMessage(p, "TNT Wars: Created New TNT Wars game on '" + p.level.name + "'"); justcreated = true; return; } else if (justcreated == false) { Player.SendMessage(p, "TNT Wars Error: Please delete the current game first!"); return; } break; case "delete": case "remove": if (it.GameStatus != TntWarsGame.TntWarsGameStatus.Finished && it.GameStatus != TntWarsGame.TntWarsGameStatus.WaitingForPlayers) { Player.SendMessage(p, "Please stop the game first!"); return; } else { foreach (TntWarsGame.player pl in it.Players) { pl.p.CurrentTntGameNumber = -1; Player.SendMessage(pl.p, "TNT Wars: The TNT Wars game you are currently playing has been deleted!"); pl.p.PlayingTntWars = false; pl.p.canBuild = true; TntWarsGame.SetTitlesAndColor(pl, true); } Player.SendMessage(p, "TNT Wars: Game deleted"); TntWarsGame.GameList.Remove(it); return; } break; case "reset": case "r": if (it.GameStatus != TntWarsGame.TntWarsGameStatus.Finished) { Player.SendMessage(p, "TNT Wars Error: The game has to have finished to be reset!"); return; } else { it.GameStatus = TntWarsGame.TntWarsGameStatus.WaitingForPlayers; Command.all.Find("restore").Use(null, it.BackupNumber + it.lvl.name); it.RedScore = 0; it.BlueScore = 0; foreach (TntWarsGame.player pl in it.Players) { pl.Score = 0; pl.spec = false; pl.p.TntWarsKillStreak = 0; pl.p.TNTWarsLastKillStreakAnnounced = 0; pl.p.CurrentAmountOfTnt = 0; pl.p.CurrentTntGameNumber = it.GameNumber; pl.p.PlayingTntWars = false; pl.p.canBuild = true; pl.p.TntWarsHealth = 2; pl.p.TntWarsScoreMultiplier = 1f; pl.p.inTNTwarsMap = true; pl.p.HarmedBy = null; } Player.SendMessage(p, "TNT Wars: Reset TNT Wars"); } break; case "start": if (it.GameStatus == TntWarsGame.TntWarsGameStatus.WaitingForPlayers) { if (it.CheckAllSetUp(p, true) == true) { if (it.PlayingPlayers() >= 2) { if (it.lvl.overload < 2500) { it.lvl.overload = 2501; Player.SendMessage(p, "TNT Wars: Increasing physics overload to 2500"); Server.s.Log("TNT Wars: Increasing physics overload to 2500"); } Thread t = new Thread(it.Start); t.Start(); } else { Player.SendMessage(p, "TNT Wars Error: Not Enough Players (2 or more needed)"); return; } } } else if (it.GameStatus == TntWarsGame.TntWarsGameStatus.Finished) { Player.SendMessage(p, "TNT Wars Error: Please use '/tntwars setup reset' to reset the game before starting!"); return; } else { Player.SendMessage(p, "TNT Wars Error: Game already in progress!!"); } return; case "stop": if (it.GameStatus == TntWarsGame.TntWarsGameStatus.Finished || it.GameStatus == TntWarsGame.TntWarsGameStatus.WaitingForPlayers) { Player.SendMessage(p, "TNT Wars Error: Game already ended / not started!"); return; } else { foreach (TntWarsGame.player pl in it.Players) { pl.p.canBuild = true; pl.p.PlayingTntWars = false; pl.p.CurrentAmountOfTnt = 0; } it.GameStatus = TntWarsGame.TntWarsGameStatus.Finished; it.SendAllPlayersMessage("TNT Wars: Game has been stopped!"); } break; case "spawn": case "spawns": case "sp": case "teamspawns": case "teamspawn": case "ts": case "teams": case "tspawn": case "tspawns": if (it.GameMode == TntWarsGame.TntWarsGameMode.FFA) { Player.SendMessage(p, "TNT Wars Error: Cannot set spawns because you are on Team Deathmatch!"); return; } switch (text[2]) { case "red": case "r": case "1": it.RedSpawn = new ushort[5]; it.RedSpawn[0] = (ushort)(p.pos[0] / 32); it.RedSpawn[1] = (ushort)(p.pos[1] / 32); it.RedSpawn[2] = (ushort)(p.pos[2] / 32); it.RedSpawn[3] = p.rot[0]; it.RedSpawn[4] = p.rot[1]; Player.SendMessage(p, "TNT Wars: Set " + c.red + "Red" + Server.DefaultColor + " spawn"); break; case "blue": case "b": case "2": it.BlueSpawn = new ushort[5]; it.BlueSpawn[0] = (ushort)(p.pos[0] / 32); it.BlueSpawn[1] = (ushort)(p.pos[1] / 32); it.BlueSpawn[2] = (ushort)(p.pos[2] / 32); it.BlueSpawn[3] = p.rot[0]; it.BlueSpawn[4] = p.rot[1]; Player.SendMessage(p, "TNT Wars: Set " + c.blue + "Blue" + Server.DefaultColor + " spawn"); break; } break; case "level": case "l": case "lvl": if (text[2] == "") { it.lvl = p.level; } else { it.lvl = Level.Find(text[2]); if (it.lvl == null) { Player.SendMessage(p, "TNT Wars Error: '" + text[2] + "' is not a level!"); return; } } Player.SendMessage(p, "TNT Wars: Level is now '" + it.lvl.name + "'"); it.RedSpawn = null; it.BlueSpawn = null; it.NoTNTplacableZones.Clear(); it.NoBlockDeathZones.Clear(); it.CheckAllSetUp(p); break; case "tntatatime": case "tnt": case "t": int number = 1; try { number = int.Parse(text[2]); } catch { Player.SendMessage(p, "TNT Wars Error: '" + text[2] + "' is not a number!"); return; } if (number >= 0) { it.TntPerPlayerAtATime = number; if (number == 0) { Player.SendMessage(p, "TNT Wars: Number of TNTs placeable by a player at a time is now unlimited"); } else { Player.SendMessage(p, "TNT Wars: Number of TNTs placeable by a player at a time is now " + number.ToString()); } it.CheckAllSetUp(p); } break; case "grace": case "g": case "graceperiod": if (text[1] == "grace" || text[1] == "g") { if (text[2] == "time" || text[2] == "t") { text[1] = "gt"; text[2] = text[3]; break; } } string msg; if (text[2] != "") { switch (text[2]) { case "true": case "yes": case "t": case "y": case "enable": case "e": case "on": it.GracePeriod = true; Player.SendMessage(p, "TNT Wars: Grace period is now enabled"); return; case "false": case "no": case "f": case "n": case "disable": case "d": case "off": it.GracePeriod = false; Player.SendMessage(p, "TNT Wars: Grace period is now disabled"); return; case "check": case "current": case "c": case "now": case "ATM": if (it.GracePeriod == true) msg = "enabled"; else msg = "disabled"; Player.SendMessage(p, "TNT Wars: Grace Period is currently " + msg); return; default: it.GracePeriod = !it.GracePeriod; break; } } else { it.GracePeriod = !it.GracePeriod; } { if (it.GracePeriod == true) msg = "enabled"; else msg = "disabled"; Player.SendMessage(p, "TNT Wars: Grace Period is now " + msg); } it.CheckAllSetUp(p); break; case "gracetime": case "gt": case "gtime": case "gracet": case "graceperiodtime": switch (text[2]) { case "check": case "current": case "now": case "ATM": case "c": case "t": Player.SendMessage(p, "TNT Wars: Current grace time is " + it.GracePeriodSecs.ToString() + " seconds long!"); break; default: if (text[2] == "set" || text[2] == "s" || text[2] == "change") { text[2] = text[3]; } int numb = -1; if (int.TryParse(text[2], out numb) == false) { Player.SendMessage(p, "TNT Wars Error: Invalid number '" + text[2] + "'"); return; } if (numb <= -1) { Player.SendMessage(p, "TNT Wars Error: Invalid number '" + text[2] + "'"); return; } if (numb >= (60 * 5)) { Player.SendMessage(p, "TNT Wars Error: Grace time cannot be above 5 minutes!!"); return; } if (numb <= 9) { Player.SendMessage(p, "TNT Wars Error: Grace time cannot be lower than 10 seconds!!"); return; } else { it.GracePeriodSecs = numb; Player.SendMessage(p, "TNT Wars: Grace period is now " + numb.ToString() + " seconds long!"); return; } break; } it.CheckAllSetUp(p); break; case "mode": case "game": case "gamemode": case "m": switch (text[2]) { case "check": case "current": case "mode": case "now": case "ATM": case "m": case "c": if (it.GameMode == TntWarsGame.TntWarsGameMode.FFA) Player.SendMessage(p, "TNT Wars: The current game mode is Free For All"); if (it.GameMode == TntWarsGame.TntWarsGameMode.TDM) Player.SendMessage(p, "TNT Wars: The current game mode is Team Deathmatch"); break; case "tdm": case "team": case "teamdeathmatch": case "deathmatch": case "teams": case "t": case "td": case "dm": case "death": case "match": if (it.GameMode == TntWarsGame.TntWarsGameMode.FFA) { it.GameMode = TntWarsGame.TntWarsGameMode.TDM; if (!it.Players.Contains(it.FindPlayer(p))) { Player.SendMessage(p, "TNT Wars: Changed gamemode to Team Deathmatch"); } foreach (TntWarsGame.player pl in it.Players) { { Player.SendMessage(pl.p, "TNT Wars: Changed gamemode to Team Deathmatch"); pl.Red = false; pl.Blue = false; if (it.BlueTeam() > it.RedTeam()) { pl.Red = true; } else if (it.RedTeam() > it.BlueTeam()) { pl.Blue = true; } else if (it.RedScore > it.BlueScore) { pl.Blue = true; } else if (it.BlueScore > it.RedScore) { pl.Red = true; } else { pl.Red = true; } } { string mesg = pl.p.color + pl.p.name + Server.DefaultColor + " " + "is now"; if (pl.Red) { mesg += " on the " + c.red + "red team"; } if (pl.Blue) { mesg += " on the " + c.blue + "blue team"; } if (pl.spec) { mesg += Server.DefaultColor + " (as a spectator)"; } Player.GlobalMessage(mesg); } } if (it.ScoreLimit == TntWarsGame.Properties.DefaultFFAmaxScore) { it.ScoreLimit = TntWarsGame.Properties.DefaultTDMmaxScore; Player.SendMessage(p, "TNT Wars: Score limit is now " + it.ScoreLimit.ToString() + " points!"); } else { Player.SendMessage(p, "TNT Wars: Score limit is still " + it.ScoreLimit.ToString() + " points!"); } } else { Player.SendMessage(p, "TNT Wars Error: Gamemode is already Team Deathmatch!"); return; } break; case "ffa": case "all": case "free": case "man": case "himself": case "allvall": case "allvsall": case "allv": case "allvs": case "a": case "f": case "ff": case "fa": if (it.GameMode == TntWarsGame.TntWarsGameMode.TDM) { it.GameMode = TntWarsGame.TntWarsGameMode.FFA; if (!it.Players.Contains(it.FindPlayer(p))) { Player.SendMessage(p, "TNT Wars: Changed gamemode to Free For All"); } it.SendAllPlayersMessage("TNT Wars: Changed gamemode to Free For All"); if (it.ScoreLimit == TntWarsGame.Properties.DefaultTDMmaxScore) { it.ScoreLimit = TntWarsGame.Properties.DefaultFFAmaxScore; Player.SendMessage(p, "TNT Wars: Score limit is now " + it.ScoreLimit.ToString() + " points!"); } else { Player.SendMessage(p, "TNT Wars: Score limit is still " + it.ScoreLimit.ToString() + " points!"); } foreach (TntWarsGame.player pl in it.Players) { pl.p.color = pl.OldColor; pl.p.SetPrefix(); } } else { Player.SendMessage(p, "TNT Wars Error: Gamemode is already Free For All!"); return; } break; case "swap": case "s": case "change": case "edit": case "switch": default: { if (it.GameMode == TntWarsGame.TntWarsGameMode.FFA) { it.GameMode = TntWarsGame.TntWarsGameMode.TDM; if (!it.Players.Contains(it.FindPlayer(p))) { Player.SendMessage(p, "TNT Wars: Changed gamemode to Team Deathmatch"); } int Red = it.RedTeam(); int Blue = it.BlueTeam(); foreach (TntWarsGame.player pl in it.Players) { { Player.SendMessage(pl.p, "TNT Wars: Changed gamemode to Team Deathmatch"); pl.Red = false; pl.Blue = false; if (Blue > Red) { pl.Red = true; } else if (Red > Blue) { pl.Blue = true; } else if (it.RedScore > it.BlueScore) { pl.Blue = true; } else if (it.BlueScore > it.RedScore) { pl.Red = true; } else { pl.Red = true; } } string mesg = p.color + p.name + Server.DefaultColor + " " + "is now"; if (pl.Red) { mesg += " on the " + c.red + "red team"; } if (pl.Blue) { mesg += " on the " + c.blue + "blue team"; } if (pl.spec) { mesg += Server.DefaultColor + " (as a spectator)"; } Player.GlobalMessage(mesg); } if (it.ScoreLimit == TntWarsGame.Properties.DefaultFFAmaxScore) { it.ScoreLimit = TntWarsGame.Properties.DefaultTDMmaxScore; Player.SendMessage(p, "TNT Wars: Score limit is now " + it.ScoreLimit.ToString() + " points!"); } else { Player.SendMessage(p, "TNT Wars: Score limit is still " + it.ScoreLimit.ToString() + " points!"); } } else { it.GameMode = TntWarsGame.TntWarsGameMode.FFA; if (!it.Players.Contains(it.FindPlayer(p))) { Player.SendMessage(p, "TNT Wars: Changed gamemode to Free For All"); } it.SendAllPlayersMessage("TNT Wars: Changed gamemode to Free For All"); if (it.ScoreLimit == TntWarsGame.Properties.DefaultTDMmaxScore) { it.ScoreLimit = TntWarsGame.Properties.DefaultFFAmaxScore; Player.SendMessage(p, "TNT Wars: Score limit is now " + it.ScoreLimit.ToString() + " points!"); } else { Player.SendMessage(p, "TNT Wars: Score limit is still " + it.ScoreLimit.ToString() + " points!"); } } } break; } it.CheckAllSetUp(p); break; case "difficulty": case "d": case "dif": case "diff": case "difficult": switch (text[2]) { case "easy": case "e": case "easiest": case "1": case "1st": if (it.GameDifficulty == TntWarsGame.TntWarsDifficulty.Easy) Player.SendMessage(p, "TNT Wars Error: Already on easy difficulty!"); else { it.GameDifficulty = TntWarsGame.TntWarsDifficulty.Easy; if (!it.Players.Contains(it.FindPlayer(p))) Player.SendMessage(p, "TNT Wars: Changed difficulty to easy"); it.SendAllPlayersMessage("TNT Wars: Changed difficulty to easy!"); if (it.TeamKills == true) { Player.SendMessage(p, "TNT Wars: Team killing is now off"); it.TeamKills = false; } } break; case "normal": case "n": case "medium": case "m": case "2": case "2nd": default: if (it.GameDifficulty == TntWarsGame.TntWarsDifficulty.Normal) Player.SendMessage(p, "TNT Wars Error: Already on normal difficulty!"); else { it.GameDifficulty = TntWarsGame.TntWarsDifficulty.Normal; if (!it.Players.Contains(it.FindPlayer(p))) Player.SendMessage(p, "TNT Wars: Changed difficulty to normal"); it.SendAllPlayersMessage("TNT Wars: Changed difficulty to normal!"); if (it.TeamKills == true) { Player.SendMessage(p, "TNT Wars: Team killing is now off"); it.TeamKills = false; } } break; case "hard": case "h": case "difficult": case "d": case "3": case "3rd": if (it.GameDifficulty == TntWarsGame.TntWarsDifficulty.Hard) Player.SendMessage(p, "TNT Wars Error: Already on hard difficulty!"); else { it.GameDifficulty = TntWarsGame.TntWarsDifficulty.Hard; if (!it.Players.Contains(it.FindPlayer(p))) Player.SendMessage(p, "TNT Wars: Changed difficulty to hard"); it.SendAllPlayersMessage("TNT Wars: Changed difficulty to hard!"); if (it.TeamKills == false) { Player.SendMessage(p, "TNT Wars: Team killing is now on"); it.TeamKills = true; } } break; case "extreme": case "ex": case "hardest": case "impossible": case "ultimate": case "i": case "u": case "4": case "4th": if (it.GameDifficulty == TntWarsGame.TntWarsDifficulty.Extreme) Player.SendMessage(p, "TNT Wars Error: Already on extreme difficulty!"); else { it.GameDifficulty = TntWarsGame.TntWarsDifficulty.Extreme; if (!it.Players.Contains(it.FindPlayer(p))) Player.SendMessage(p, "TNT Wars: Changed difficulty to extreme"); it.SendAllPlayersMessage("TNT Wars: Changed difficulty to extreme!"); if (it.TeamKills == false) { Player.SendMessage(p, "TNT Wars: Team killing is now on"); it.TeamKills = true; } } break; } it.CheckAllSetUp(p); break; case "score": case "scores": case "scoring": switch (text[2]) { case "max": case "m": case "maximum": case "limit": case "top": case "goal": case "maxscore": case "maximumscore": case "scorelimit": switch (text[3]) { case "check": case "current": case "now": case "ATM": case "c": case "t": Player.SendMessage(p, "TNT Wars: Score limit is " + it.ScoreLimit.ToString() + " points!"); break; default: if (text[3] == "set" || text[3] == "s" || text[3] == "change") { text[3] = text[4]; } int numb = -1; if (int.TryParse(text[3], out numb) == false) { Player.SendMessage(p, "TNT Wars Error: Invalid number '" + text[3] + "'"); return; } if (numb <= it.ScorePerKill) { Player.SendMessage(p, "TNT Wars Error: Minimum score limit of " + it.ScorePerKill.ToString() + " points"); return; } else { it.ScoreLimit = numb; Player.SendMessage(p, "TNT Wars: Score limit is now " + numb.ToString() + " points!"); return; } break; } it.CheckAllSetUp(p); break; case "streaks": case "streak": case "s": switch (text[3]) { case "on": case "enable": if (it.Streaks == true) { Player.SendMessage(p, "TNT Wars Error: Streaks are already enabled"); return; } else { it.Streaks = true; Player.SendMessage(p, "TNT Wars: Streaks are now enabled"); } break; case "off": case "disable": if (it.Streaks == false) { Player.SendMessage(p, "TNT Wars Error: Streaks are already disabled"); return; } else { it.Streaks = false; Player.SendMessage(p, "TNT Wars: Streaks are now disabled"); } break; case "check": case "current": case "now": case "ATM": case "c": case "t": if (it.Streaks == true) { Player.SendMessage(p, "TNT Wars: Streaks are currently enabled"); return; } else if (it.Streaks == false) { Player.SendMessage(p, "TNT Wars: Streaks are currently disabled"); return; } break; default: if (it.Streaks == false) { it.Streaks = true; Player.SendMessage(p, "TNT Wars: Streaks are now enabled"); return; } else if (it.Streaks == true) { it.Streaks = false; Player.SendMessage(p, "TNT Wars: Streaks are now disabled"); return; } break; } it.CheckAllSetUp(p); break; case "multi": case "multikills": case "multiples": case "multiplekills": case "multis": case "doublekill": case "double": case "triplekill": case "triple": case "mk": case "d": case "t": switch (text[3]) { case "on": case "enable": if (it.MultiKillBonus > 0) { Player.SendMessage(p, "TNT Wars Error: Multikill bonuses are already enabled (at " + it.MultiKillBonus.ToString() + " points!"); return; } else { it.MultiKillBonus = TntWarsGame.Properties.DefaultMultiKillBonus; Player.SendMessage(p, "TNT Wars: Multikill bonuses are now enabled at " + it.MultiKillBonus.ToString() + " points!"); } break; case "off": case "disable": if (it.MultiKillBonus == 0) { Player.SendMessage(p, "TNT Wars Error: Multikill bonuses are already disabled!"); return; } else { it.MultiKillBonus = 0; Player.SendMessage(p, "TNT Wars: Multikill bonuses are now disabled!"); } break; case "switch": if (it.MultiKillBonus == 0) { it.MultiKillBonus = TntWarsGame.Properties.DefaultMultiKillBonus; Player.SendMessage(p, "TNT Wars: Multikill bonuses are now enabled at " + it.MultiKillBonus.ToString() + " points!"); return; } else { it.MultiKillBonus = 0; Player.SendMessage(p, "TNT Wars: Multikill bonuses are now disabled!"); } break; case "check": case "current": case "now": case "ATM": case "c": case "t": Player.SendMessage(p, "TNT Wars: Mulitkill bonus per extra kill is " + it.MultiKillBonus.ToString() + " points!"); break; default: if (text[3] == "set" || text[3] == "s" || text[3] == "change") { text[3] = text[4]; } int numb = -1; if (int.TryParse(text[2], out numb) == false) { Player.SendMessage(p, "TNT Wars Error: Invalid number '" + text[3] + "'"); return; } if (numb <= -1) { Player.SendMessage(p, "TNT Wars Error: Invalid number '" + text[3] + "'"); return; } else { it.MultiKillBonus = numb; Player.SendMessage(p, "TNT Wars: Mulitkill bonus per extra kill is now " + numb.ToString() + " points!"); return; } break; } it.CheckAllSetUp(p); break; case "scorekill": case "kill": case "killscore": case "k": switch (text[3]) { case "check": case "current": case "now": case "ATM": case "c": case "t": Player.SendMessage(p, "TNT Wars: Score per kill is " + it.ScorePerKill.ToString() + " points!"); break; default: if (text[3] == "set" || text[3] == "s" || text[3] == "change") { text[3] = text[4]; } int numb = -1; if (int.TryParse(text[2], out numb) == false) { Player.SendMessage(p, "TNT Wars Error: Invalid number '" + text[3] + "'"); return; } if (numb <= -1) { Player.SendMessage(p, "TNT Wars Error: Invalid number '" + text[3] + "'"); return; } else { it.ScorePerKill = numb; Player.SendMessage(p, "TNT Wars: Score per kill is now " + numb.ToString() + " points!"); return; } break; } it.CheckAllSetUp(p); break; case "assistkill": case "assist": case "assists": case "assistscore": case "a": switch (text[3]) { case "on": case "enable": if (it.ScorePerAssist > 0) { Player.SendMessage(p, "TNT Wars Error: Assist bonuses are already enabled (at " + it.ScorePerAssist.ToString() + " points!"); return; } else { it.ScorePerAssist = TntWarsGame.Properties.DefaultAssistScore; Player.SendMessage(p, "TNT Wars: Assist bonuses are now enabled at " + it.ScorePerAssist.ToString() + " points!"); } break; case "off": case "disable": if (it.ScorePerAssist == 0) { Player.SendMessage(p, "TNT Wars Error: Assist bonuses are already disabled!"); return; } else { it.ScorePerAssist = 0; Player.SendMessage(p, "TNT Wars: Assist bonuses are now disabled!"); } break; case "switch": if (it.ScorePerAssist == 0) { it.ScorePerAssist = TntWarsGame.Properties.DefaultAssistScore; Player.SendMessage(p, "TNT Wars: Assist bonuses are now enabled at " + it.ScorePerAssist.ToString() + " points!"); return; } else { it.ScorePerAssist = 0; Player.SendMessage(p, "TNT Wars: Assist bonuses are now disabled!"); } break; case "check": case "current": case "now": case "ATM": case "c": case "t": Player.SendMessage(p, "TNT Wars: Score per assist is " + it.ScorePerAssist.ToString() + " points!"); break; default: if (text[3] == "set" || text[3] == "s" || text[3] == "change") { text[3] = text[4]; } int numb = -1; if (int.TryParse(text[2], out numb) == false) { Player.SendMessage(p, "TNT Wars Error: Invalid number '" + text[3] + "'"); return; } if (numb <= -1) { Player.SendMessage(p, "TNT Wars Error: Invalid number '" + text[3] + "'"); return; } else { it.ScorePerAssist = numb; Player.SendMessage(p, "TNT Wars: Score per assist is now " + numb.ToString() + " points!"); return; } break; } it.CheckAllSetUp(p); break; case "help": case "h": default: Player.SendMessage(p, "TNT Wars Setup Scoring Help:"); Player.SendMessage(p, "/tw s score maximum {m} [check/set] <value> - set the score limit (or check it)"); Player.SendMessage(p, "/tw s score streaks {s} [on/off/check] - enable/disable streaks (or check it)"); Player.SendMessage(p, "/tw s score multi {mk} [on/off/switch/check/set] - enable/disable/switch multikills or set the score bonus per multikill (or check it)"); Player.SendMessage(p, "/tw s score scorekill {k} [check/set] <value> - set the score per kill (or check it)"); Player.SendMessage(p, "/tw s score assistkill {a} [check/set] <value> - set the score per assist (or check it)"); break; } break; case "balance": case "balanceteams": case "bt": case "b": switch (text[2]) { case "on": case "enable": if (it.BalanceTeams == true) { Player.SendMessage(p, "TNT Wars Error: Team balancing is already enabled"); return; } else { it.BalanceTeams = true; Player.SendMessage(p, "TNT Wars: Team balancing is now enabled"); } break; case "off": case "disable": if (it.BalanceTeams == false) { Player.SendMessage(p, "TNT Wars Error: Team balancing is already disabled"); return; } else { it.BalanceTeams = false; Player.SendMessage(p, "TNT Wars: Team balancing is now disabled"); } break; case "check": case "current": case "now": case "ATM": case "c": case "t": if (it.BalanceTeams == true) { Player.SendMessage(p, "TNT Wars: Team balancing is currently enabled"); return; } else if (it.BalanceTeams == false) { Player.SendMessage(p, "TNT Wars: Team balancing is currently disabled"); return; } break; default: if (it.BalanceTeams == false) { it.BalanceTeams = true; Player.SendMessage(p, "TNT Wars: Team balancing is now enabled"); return; } else if (it.BalanceTeams == true) { it.BalanceTeams = false; Player.SendMessage(p, "TNT Wars: Team balancing is now disabled"); return; } break; } it.CheckAllSetUp(p); break; case "teamkill": case "tk": case "tkill": case "teamk": case "friendly": case "friendlyfire": case "ff": case "friendlyf": case "ffire": switch (text[2]) { case "on": case "enable": if (it.TeamKills == true) { Player.SendMessage(p, "TNT Wars Error: Team killing is already enabled"); return; } else { it.TeamKills = true; Player.SendMessage(p, "TNT Wars: Team killing is now enabled"); } break; case "off": case "disable": if (it.TeamKills == false) { Player.SendMessage(p, "TNT Wars Error: Team killing is already disabled"); return; } else { it.TeamKills = false; Player.SendMessage(p, "TNT Wars: Team killing is now disabled"); } break; case "check": case "current": case "now": case "ATM": case "c": case "t": if (it.TeamKills == true) { Player.SendMessage(p, "TNT Wars: Team killing is currently enabled"); return; } else if (it.TeamKills == false) { Player.SendMessage(p, "TNT Wars: Team killing is currently disabled"); return; } break; default: if (it.TeamKills == false) { it.TeamKills = true; Player.SendMessage(p, "TNT Wars: Team killing is now enabled"); return; } else if (it.TeamKills == true) { it.TeamKills = false; Player.SendMessage(p, "TNT Wars: Team killing is now disabled"); return; } break; } it.CheckAllSetUp(p); break; case "zone": case "zones": case "z": case "zn": case "zns": case "zs": CatchPos cpos; cpos.x = 0; cpos.y = 0; cpos.z = 0; p.blockchangeObject = cpos; switch (text[2]) { case "notnt": case "tnt": case "no": case "none": case "nothing": case "blocktnt": case "blockt": case "bt": case "nt": NoTntZone = true; DeleteZone = false; CheckZone = false; switch (text[3]) { case "add": case "a": case "new": DeleteZone = false; CheckZone = false; Player.SendMessage(p, "TNT Wars: Place 2 blocks to create the zone for no TNT!"); //p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); break; case "delete": case "d": case "remove": case "r": if (text[4] == "all" || text[4] == "a") { it.NoTNTplacableZones.Clear(); Player.SendMessage(p, "TNT Wars: Deleted all zones for no blocks deleted on explosions!"); return; } DeleteZone = true; CheckZone = false; Player.SendMessage(p, "TNT Wars: Place a block to delete the zone for no TNT!"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); break; case "check": case "c": DeleteZone = false; CheckZone = true; Player.SendMessage(p, "TNT Wars: Place a block to check for no TNT zones!"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); break; } break; case "noexplosion": case "nodeleteblocks": case "deleteblocks": case "nd": case "nb": case "ne": case "neb": case "ndb": NoTntZone = false; DeleteZone = false; CheckZone = false; switch (text[3]) { case "add": case "a": case "new": DeleteZone = false; CheckZone = false; Player.SendMessage(p, "TNT Wars: Place 2 blocks to create the zone for no blocks deleted on explosions!"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); break; case "delete": case "d": case "remove": case "r": if (text[4] == "all" || text[4] == "a") { it.NoBlockDeathZones.Clear(); Player.SendMessage(p, "TNT Wars: Deleted all zones for no blocks deleted on explosions!"); return; } DeleteZone = true; CheckZone = false; Player.SendMessage(p, "TNT Wars: Place a block to delete the zone for no blocks deleted on explosions!"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); break; case "check": case "c": DeleteZone = false; CheckZone = true; Player.SendMessage(p, "TNT Wars: Place a block to check for no blocks deleted on explosions!"); p.ClearBlockchange(); p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); break; } break; } break; case "help": case "h": int SleepAmount = 500; Player.SendMessage(p, "TNT Wars Setup Help:"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s new {n}/delete - create/delete a game"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s start/stop/reset {r} - start/stop/reset the current game"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s level {l} - change the level for the game"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s teamsspawns {ts} [red/blue] - set the spawns for red/blue"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s tnt {t} - change the amount of tnt per player at a time"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s graceperiod {g} [on/off/check] - enable/disable the grace period (or check it)"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s gracetime {gt} [set/check] <amount> - set the grace period time (in seconds) (or check it)"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s gamemode {m} [check/tdm/ffa] - change the gamemode to FFA or TDM (or check it)"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s difficulty {d} [1/2/3/4] - change the difficulty (easy/normal/hard/extreme)"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s balanceteams {b} [on/off/check] - enable/disable balancing teams (or check it)"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s teamkill {tk} [on/off/check] - enable/disable teamkills (or check it)"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s zone {z} [notnt {nt}/noexplodeblocks {neb}] [add {a}/delete {d} <all>/check {c}]- create zones (No TNT zones or zones where explosions do not delete blocks"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s score - scoring setup (use '/tntwars setup scoring help' for more info)"); Thread.Sleep(SleepAmount); Player.SendMessage(p, "/tw s status {s} - view the status of setup"); break; default: case "status": case "s": case "ready": case "check": case "info": case "c": Player.SendMessage(p, "TNT Wars: Current Setup:"); //1 if (it.lvl == null) { Player.SendMessage(p, "Level: " + c.red + "NONE"); } else { Player.SendMessage(p, "Level: " + c.green + it.lvl.name); } //2 if (it.GameMode == TntWarsGame.TntWarsGameMode.FFA) { Player.SendMessage(p, "Gamemode: " + c.green + "FFA"); } if (it.GameMode == TntWarsGame.TntWarsGameMode.TDM) { Player.SendMessage(p, "Gamemode: " + c.green + "TDM"); } //3 if (it.GameDifficulty == TntWarsGame.TntWarsDifficulty.Easy) { Player.SendMessage(p, "Game difficulty: " + c.green + "Easy"); } if (it.GameDifficulty == TntWarsGame.TntWarsDifficulty.Normal) { Player.SendMessage(p, "Game difficulty: " + c.green + "Normal"); } if (it.GameDifficulty == TntWarsGame.TntWarsDifficulty.Hard) { Player.SendMessage(p, "Game difficulty: " + c.green + "Hard"); } if (it.GameDifficulty == TntWarsGame.TntWarsDifficulty.Extreme) { Player.SendMessage(p, "Game difficulty: " + c.green + "Extreme"); } //4 if (it.TntPerPlayerAtATime >= 1) { Player.SendMessage(p, "TNT per player at a time: " + c.green + it.TntPerPlayerAtATime.ToString()); } else if (it.TntPerPlayerAtATime == 0) { Player.SendMessage(p, "TNT per player at a time: " + c.green + "unlimited"); } //5 if (it.GracePeriod) { Player.SendMessage(p, "Grace period: " + c.green + "enabled"); } if (!it.GracePeriod) { Player.SendMessage(p, "Grace period: " + c.green + "disabled"); } //6 Player.SendMessage(p, "Grace period time: " + c.green + it.GracePeriodSecs.ToString() + " seconds"); //7 if (it.BalanceTeams) { Player.SendMessage(p, "Balance teams: " + c.green + "enabled"); } if (!it.BalanceTeams) { Player.SendMessage(p, "Balance teams: " + c.green + "disabled"); } //8 Player.SendMessage(p, "Score limit: " + c.green + it.ScoreLimit.ToString() + " points"); //9 if (it.Streaks) { Player.SendMessage(p, "Streaks: " + c.green + "enabled"); } if (!it.Streaks) { Player.SendMessage(p, "Streaks: " + c.green + "disabled"); } //10 if (it.MultiKillBonus == 0) { Player.SendMessage(p, "Multikill bonus: " + c.green + "disabled"); } if (it.MultiKillBonus != 0) { Player.SendMessage(p, "Multikill bonus: " + c.green + "enabled"); } //11 Player.SendMessage(p, "Score per kill: " + c.green + it.ScorePerKill.ToString() + " points"); //12 if (it.ScorePerAssist == 0) { Player.SendMessage(p, "Assists: " + c.green + "disabled"); } if (it.ScorePerAssist != 0) { Player.SendMessage(p, "Assists : " + c.green + "enabled (at " + it.ScorePerAssist.ToString() + " points)"); } //13 if (it.TeamKills) { Player.SendMessage(p, "Team killing: " + c.green + "enabled"); } if (!it.TeamKills) { Player.SendMessage(p, "Team killing: " + c.green + "disabled"); } //14 it.CheckAllSetUp(p); //15 break; } } else { Player.SendMessage(p, "Sorry, you aren't a high enough rank for that!"); } break; default: Help(p); return; } }
public override void Use(Player p, string message) { if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; } if (message == "") { Help(p); return; } try { Level foundLevel = Level.Find(message); if (foundLevel != null) { Level startLevel = p.level; GC.Collect(); if (p.level == foundLevel) { Player.SendMessage(p, "You are already in \"" + foundLevel.name + "\"."); return; } if (!p.ignorePermission) { if (p.group.Permission < foundLevel.permissionvisit) { Player.SendMessage(p, "You're not allowed to go to " + foundLevel.name + "."); return; } } if (!p.ignorePermission) { if (p.group.Permission > foundLevel.pervisitmax) { if (!p.group.CanExecute(Command.all.Find("pervisitmax"))) { Player.SendMessage(p, "Your rank must be " + foundLevel.pervisitmax + " or lower to go there!"); } return; } } { if (!File.Exists("text/lockdown/map/" + message + "")) { p.Loading = true; foreach (Player pl in Player.players) { if (p.level == pl.level && p != pl) { p.SendDie(pl.id); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (p.level == b.level) { p.SendDie(b.id); } } Player.GlobalDie(p, true); p.level = foundLevel; p.SendUserMOTD(); p.SendMap(); GC.Collect(); ushort x = (ushort)((0.5 + foundLevel.spawnx) * 32); ushort y = (ushort)((1 + foundLevel.spawny) * 32); ushort z = (ushort)((0.5 + foundLevel.spawnz) * 32); if (!p.hidden) { Player.GlobalSpawn(p, x, y, z, foundLevel.rotx, foundLevel.roty, true, ""); } else { unchecked { p.SendPos((byte)-1, x, y, z, foundLevel.rotx, foundLevel.roty); } } foreach (Player pl in Player.players) { if (pl.level == p.level && p != pl && !pl.hidden) { p.SendSpawn(pl.id, pl.color + pl.name, pl.pos[0], pl.pos[1], pl.pos[2], pl.rot[0], pl.rot[1]); } } foreach (PlayerBot b in PlayerBot.playerbots) { if (b.level == p.level) { p.SendSpawn(b.id, b.color + b.name, b.pos[0], b.pos[1], b.pos[2], b.rot[0], b.rot[1]); } } if (!p.hidden) { Player.GlobalChat(p, p.color + "*" + p.name + Server.DefaultColor + " went to &b" + foundLevel.name, false); } p.Loading = false; bool skipUnload = false; if (startLevel.unload && !startLevel.name.Contains("&cMuseum ")) { foreach (Player pl in Player.players) { if (pl.level == startLevel) { skipUnload = true; break; } } if (!skipUnload && Server.AutoLoad) { startLevel.Unload(true); } } if (Server.lava.active && !Server.lava.sendingPlayers && Server.lava.map == foundLevel) { if (Server.lava.roundActive) { Server.lava.AnnounceRoundInfo(p); Server.lava.AnnounceTimeLeft(!Server.lava.flooded, true, p); } else { Player.SendMessage(p, "Vote for the next map!"); Player.SendMessage(p, "Choices: " + Server.lava.VoteString); } } if (Server.zombie.GameInProgess()) { if (p.level.name == Server.zombie.currentLevelName) { Server.zombie.InfectedPlayerLogin(p); } } if (p.level.name != Server.zombie.currentLevelName) { if (ZombieGame.alive.Contains(p)) { ZombieGame.alive.Remove(p); } if (ZombieGame.infectd.Contains(p)) { ZombieGame.infectd.Remove(p); } } if (p.inTNTwarsMap) { p.canBuild = true; } if (TntWarsGame.Find(p.level) != null) { if (TntWarsGame.Find(p.level).GameStatus != TntWarsGame.TntWarsGameStatus.Finished && TntWarsGame.Find(p.level).GameStatus != TntWarsGame.TntWarsGameStatus.WaitingForPlayers) { p.canBuild = false; Player.SendMessage(p, "TNT Wars: Disabled your building because you are in a TNT Wars map!"); } p.inTNTwarsMap = true; } } else { Player.SendMessage(p, "The level " + message + " is locked."); } } } else if (Server.AutoLoad) { if (!File.Exists("levels/" + message + ".lvl")) { Player.SendMessage(p, "Level \"" + message + "\" doesn't exist!"); } else if (Level.Find(message) != null || Level.CheckLoadOnGoto(message)) { Command.all.Find("load").Use(p, message); foundLevel = Level.Find(message); if (foundLevel != null) { Use(p, message); } } else { Player.SendMessage(p, "Level \"" + message + "\" cannot be loaded using /goto!"); } } else { Player.SendMessage(p, "There is no level \"" + message + "\" loaded."); } GC.Collect(); GC.WaitForPendingFinalizers(); } catch (Exception e) { Server.ErrorLog(e); } }