The /mapset command now allows setting 'pillaring' and 'buildtype' for zombie survival maps.

This commit is contained in:
UnknownShadow200 2016-03-21 13:43:15 +11:00
parent 3646407eef
commit 5f4ecc792d
4 changed files with 35 additions and 8 deletions

View File

@ -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.");
}
}
}

View File

@ -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) {

View File

@ -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

View File

@ -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 != "")