Add /mapauthors command for zombie and lava survival.

This commit is contained in:
UnknownShadow200 2016-03-21 07:57:09 +11:00
parent 446560bf4f
commit 2e1aa7055d
7 changed files with 57 additions and 2 deletions

View File

@ -0,0 +1,44 @@
/*
Copyright 2015 MCGalaxy
Dual-licensed under the Educational Community License, Version 2.0 and
the GNU General Public License, Version 3 (the "Licenses"); you may
not use this file except in compliance with the Licenses. You may
obtain a copy of the Licenses at
http://www.opensource.org/licenses/ecl2.php
http://www.gnu.org/licenses/gpl-3.0.html
Unless required by applicable law or agreed to in writing,
software distributed under the Licenses are distributed on an "AS IS"
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the Licenses for the specific language governing
permissions and limitations under the Licenses.
*/
using System;
using System.Collections.Generic;
using System.Threading;
namespace MCGalaxy.Commands {
public sealed class CmdMapAuthor : Command {
public override string name { get { return "mapauthors"; } }
public override string shortcut { get { return "authors"; } }
public override string type { get { return CommandTypes.Games; } }
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; } }
public override void Use(Player p, string message) {
if (p == null) { MessageInGameOnly(p); return; }
p.level.Authors = message;
Player.SendMessage(p, "Sets the authors of the map to: " + message.Replace(" ", "%S, "));
}
public override void Help(Player p) {
Player.SendMessage(p, "%T/mapauthors [name1] <name2>...");
Player.SendMessage(p, "%HSets the authors of the current map. " +
"This is shown to players at the start of rounds in various games.");
}
}
}

View File

@ -21,7 +21,7 @@ using System.Threading;
namespace MCGalaxy.Commands {
public sealed class MapLikeCmd : Command {
public sealed class CmdMapLike : Command {
public override string name { get { return "maplike"; } }
public override string shortcut { get { return "like"; } }
public override string type { get { return CommandTypes.Games; } }
@ -43,7 +43,7 @@ namespace MCGalaxy.Commands {
}
}
public sealed class MapDislikeCmd : Command {
public sealed class CmdMapDislike : Command {
public override string name { get { return "mapdislike"; } }
public override string shortcut { get { return "dislike"; } }
public override string type { get { return CommandTypes.Games; } }

View File

@ -302,6 +302,7 @@ namespace MCGalaxy.Games
{
Player[] online = PlayerInfo.Online.Items;
foreach (Player pl in online) {
pl.ratedMap = false;
if (pl.level == oldMap)
{
if (sendAfkMain && Server.afkset.Contains(pl.name)) Command.all.Find("main").Use(pl, "");

View File

@ -111,6 +111,8 @@ namespace MCGalaxy.Games {
p.SendMessage("%a" + (int)startLeft + " %Sseconds left until the round starts. %aRun!");
p.SendMessage("This map has &a" + CurrentLevel.Likes +
" likes %Sand &c" + CurrentLevel.Dislikes + " dislikes");
if (CurrentLevel.Authors != "")
p.SendMessage("It was created by " + CurrentLevel.Authors.Replace(" ", "%S, "));
p.SendCpeMessage(CpeMessageType.BottomRight1, "%SYou have &a" + p.money + " %S" + Server.moneys);
UpdatePlayerStatus(p);
return;

View File

@ -61,6 +61,7 @@ namespace MCGalaxy.Levels.IO {
writer.WriteLine("Unload = " + level.unload);
writer.WriteLine("WorldChat = " + level.worldChat);
writer.WriteLine();
writer.WriteLine("PerBuild = " + GetName(level.permissionbuild));
writer.WriteLine("PerVisit = " + GetName(level.permissionvisit));
writer.WriteLine("PerBuildMax = " + GetName(level.perbuildmax));
@ -68,6 +69,7 @@ namespace MCGalaxy.Levels.IO {
writer.WriteLine("Buildable = " + level.Buildable);
writer.WriteLine("Deletable = " + level.Deletable);
writer.WriteLine();
writer.WriteLine("Guns = " + level.guns);
writer.WriteLine("LoadOnGoto = " + level.loadOnGoto);
writer.WriteLine("LeafDecay = " + level.leafDecay);
@ -77,8 +79,10 @@ namespace MCGalaxy.Levels.IO {
writer.WriteLine("Texture = " + level.terrainUrl);
writer.WriteLine("TexturePack = " + level.texturePackUrl);
writer.WriteLine();
writer.WriteLine("Likes = " + level.Likes);
writer.WriteLine("Dislikes = " + level.Dislikes);
writer.WriteLine("Authors = " + level.Authors);
}
static string GetName(LevelPermission perm) {
@ -219,6 +223,8 @@ namespace MCGalaxy.Levels.IO {
level.Likes = int.Parse(value); break;
case "dislikes":
level.Dislikes = int.Parse(value); break;
case "authors":
level.Authors = value; break;
}
}

View File

@ -205,6 +205,7 @@ namespace MCGalaxy
public List<C4.C4s> C4list = new List<C4.C4s>();
public int Likes, Dislikes;
public string Authors = "";
public Level(string n, ushort x, ushort y, ushort z, string type, int seed = 0, bool useSeed = false)
{

View File

@ -182,6 +182,7 @@
<Compile Include="Commands\Fun\CmdFlipHeads.cs" />
<Compile Include="Commands\Fun\CmdGun.cs" />
<Compile Include="Commands\Fun\CmdLavaSurvival.cs" />
<Compile Include="Commands\Fun\CmdMapAuthors.cs" />
<Compile Include="Commands\Fun\CmdMissile.cs" />
<Compile Include="Commands\Fun\CmdSlap.cs" />
<Compile Include="Commands\Fun\CmdTeam.cs" />