From 5f4ecc792dcf0a4ac2928877934568af5b971345 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 21 Mar 2016 13:43:15 +1100 Subject: [PATCH] The /mapset command now allows setting 'pillaring' and 'buildtype' for zombie survival maps. --- Commands/Fun/CmdMapSet.cs | 37 +++++++++++++++++++++---- Commands/Fun/ZombieSurvival/CmdHuman.cs | 2 +- Games/ZombieSurvival/ZombieGame.Core.cs | 2 +- Games/ZombieSurvival/ZombieGame.Game.cs | 2 +- 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Commands/Fun/CmdMapSet.cs b/Commands/Fun/CmdMapSet.cs index b78e40327..c1fb044a2 100644 --- a/Commands/Fun/CmdMapSet.cs +++ b/Commands/Fun/CmdMapSet.cs @@ -28,16 +28,41 @@ namespace MCGalaxy.Commands { public override bool museumUsable { get { return true; } } public override LevelPermission defaultRank { get { return LevelPermission.Operator; } } public override bool Enabled { get { return Server.ZombieModeOn || Server.lava.active; } } + static char[] trimChars = {' '}; public override void Use(Player p, string message) { if (p == null) { MessageInGameOnly(p); return; } if (message == "") { - Player.SendMessage(p, "Map authors: " + p.level.Authors); - Player.SendMessage(p, "Pillaring allowed: " + p.level.Pillaring); - Player.SendMessage(p, "Build type: " + p.level.BuildType); + Player.SendMessage(p, "Map authors: " + p.level.Authors); + Player.SendMessage(p, "Pillaring allowed: " + p.level.Pillaring); + Player.SendMessage(p, "Build type: " + p.level.BuildType); + return; } - p.level.Authors = message.Replace(" ", "%S, "); - Player.SendMessage(p, "Sets the authors of the map to: " + message); + + string[] args = message.Split(trimChars, 2); + if (args.Length == 1) { Player.SendMessage(p, "You need to provide a value."); return; } + + if (args[0].CaselessEq("author") || args[0].CaselessEq("authors")) { + p.level.Authors = args[1].Replace(" ", "%S, "); + Player.SendMessage(p, "Sets the authors of the map to: " + args[1]; + } else if (args[0].CaselessEq("pillar") || args[0].CaselessEq("pillaring")) { + bool value; + if (!bool.TryParse(args[1], out value)) { + Player.SendMessage(p, "Value must be 'true' or 'false'"); return; + } + p.level.Pillaring = value; + Player.SendMessage(p, "Set pillaring allowed to: " + value); + } else if (args[0].CaselessEq("build") || args[0].CaselessEq("buildtype")) { + BuildType value; + if (!Enum.TryParse(args[1], true, out value)) { + Player.SendMessage(p, "Value must be 'normal', 'modifyonly', or 'momodify'"); return; + } + p.level.BuildType = value; + Player.SendMessage(p, "Set build type to: " + value); + } else { + Player.SendMessage(p, "Unrecognised property \"" + args[0] + "\"."); return; + } + Level.SaveSettings(p.level); } public override void Help(Player p) { @@ -46,6 +71,8 @@ namespace MCGalaxy.Commands { "This is shown to players at the start of rounds in various games."); Player.SendMessage(p, "%T/mapset pillaring [true/false]"); Player.SendMessage(p, "%HSets whether players can pillar on this map in various games."); + Player.SendMessage(p, "%T/mapset build [normal/modifyonly/nomodify]"); + Player.SendMessage(p, "%HSets how players are allowed to change blocks."); } } } diff --git a/Commands/Fun/ZombieSurvival/CmdHuman.cs b/Commands/Fun/ZombieSurvival/CmdHuman.cs index e0fc4ad2c..a829fad7e 100644 --- a/Commands/Fun/ZombieSurvival/CmdHuman.cs +++ b/Commands/Fun/ZombieSurvival/CmdHuman.cs @@ -36,7 +36,7 @@ namespace MCGalaxy.Commands { p.pledgeSurvive = true; Server.zombie.CurrentLevel - .ChatLevel(p.FullName + " %Spledges that they will not succumb to the infection!"); + .ChatLevel(p.color + p.DisplayName + " %Spledges that they will not succumb to the infection!"); } public override void Help(Player p) { diff --git a/Games/ZombieSurvival/ZombieGame.Core.cs b/Games/ZombieSurvival/ZombieGame.Core.cs index 721cec675..de4c471a7 100644 --- a/Games/ZombieSurvival/ZombieGame.Core.cs +++ b/Games/ZombieSurvival/ZombieGame.Core.cs @@ -313,7 +313,7 @@ namespace MCGalaxy.Games { } void ChooseNextLevel() { - if (queLevel) { ChangeLevel(nextLevel); return; } // TODO: show global message of 'x level was queued' + if (queLevel) { ChangeLevel(nextLevel); return; } if (!ChangeLevels) return; try diff --git a/Games/ZombieSurvival/ZombieGame.Game.cs b/Games/ZombieSurvival/ZombieGame.Game.cs index dc64ad4fa..042afeb5f 100644 --- a/Games/ZombieSurvival/ZombieGame.Game.cs +++ b/Games/ZombieSurvival/ZombieGame.Game.cs @@ -141,7 +141,7 @@ namespace MCGalaxy.Games { p.SendMessage("This map has &a" + CurrentLevel.Likes + " likes %Sand &c" + CurrentLevel.Dislikes + " dislikes"); p.SendCpeMessage(CpeMessageType.Status2, - "%SPillaring " + (CurrentLevel.Pillaring ? "&aAllowed" : "&cForbidden") + + "%SPillaring " + (CurrentLevel.Pillaring ? "&aYes" : "&cNo") + "%S, Type is &a" + CurrentLevel.BuildType); if (CurrentLevel.Authors != "")