示例#1
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (p.money < Price)
            {
                Player.Message(p, "&cYou don't have enough &3" + ServerConfig.Currency + "&c to buy a " + Name + "."); return;
            }
            if (!p.Game.Infected)
            {
                Player.Message(p, "You are already a human."); return;
            }
            if (!Server.zombie.Running || !Server.zombie.RoundInProgress)
            {
                Player.Message(p, "You can only buy an revive potion " +
                               "when a round of zombie survival is in progress."); return;
            }

            DateTime end = Server.zombie.RoundEnd;

            if (DateTime.UtcNow.AddSeconds(ZSConfig.ReviveNoTime) > end)
            {
                Player.Message(p, ZSConfig.ReviveNoTimeMessage); return;
            }
            int count = Server.zombie.Infected.Count;

            if (count < ZSConfig.ReviveFewZombies)
            {
                Player.Message(p, ZSConfig.ReviveFewZombiesMessage); return;
            }
            if (p.Game.RevivesUsed >= ZSConfig.ReviveTimes)
            {
                Player.Message(p, "You cannot buy any more revive potions."); return;
            }
            if (p.Game.TimeInfected.AddSeconds(ZSConfig.ReviveTooSlow) < DateTime.UtcNow)
            {
                Player.Message(p, "&cYou can only revive within the first {0} seconds after you were infected.",
                               ZSConfig.ReviveTooSlow); return;
            }

            int chance = new Random().Next(1, 101);

            if (chance <= ZSConfig.ReviveChance)
            {
                Server.zombie.DisinfectPlayer(p);
                Server.zombie.Map.ChatLevel(p.ColoredName + " %S" + ZSConfig.ReviveSuccessMessage);
            }
            else
            {
                Server.zombie.Map.ChatLevel(p.ColoredName + " %S" + ZSConfig.ReviveFailureMessage);
            }
            Economy.MakePurchase(p, Price, "%3Revive:");
            p.Game.RevivesUsed++;
        }
示例#2
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (args.Length < 3)
            {
                OnStoreCommand(p); return;
            }
            LevelPreset preset = FindPreset(args[1]);

            if (preset == null)
            {
                Player.Message(p, "%cThat isn't a level preset"); return;
            }

            if (p.money < preset.price)
            {
                Player.Message(p, "%cYou don't have enough %3" + Server.moneys + "%c to buy that map"); return;
            }
            string name = p.name + "_" + args[2];

            try {
                Command.all.Find("newlvl").Use(null, name + " " + preset.x + " " + preset.y + " " + preset.z + " " + preset.type);
                Player.Message(p, "%aCreating level: '%f" + name + "%a' . . .");

                CmdLoad.LoadLevel(null, name);
                Level level = LevelInfo.FindExact(name);
                if (level.permissionbuild > p.Rank)
                {
                    level.permissionbuild = p.Rank;
                }
                if (level.permissionvisit > p.Rank)
                {
                    level.permissionvisit = p.Rank;
                }
                PlayerActions.ChangeMap(p, name);

                Player.Message(p, "%aSuccessfully created your map: '%f" + name + "%a'");
                try {
                    Level.Zone zn = default(Level.Zone);
                    zn.bigX  = (ushort)(level.Width - 1);
                    zn.bigY  = (ushort)(level.Height - 1);
                    zn.bigZ  = (ushort)(level.Length - 1);
                    zn.Owner = p.name;
                    level.ZoneList.Add(zn);
                    LevelDB.CreateZone(level.name, zn);
                    Player.Message(p, "%aZoning Succesful");
                } catch { Player.Message(p, "%cZoning Failed"); }
            } catch {
                Player.Message(p, "%cSomething went wrong, Money untouched"); return;
            }
            Economy.MakePurchase(p, preset.price, "%3Map: %f" + preset.name);
        }
示例#3
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (p.money < Price)
            {
                p.Message("%WYou don't have enough &3{1} %Wto buy a {0}.", Name, ServerConfig.Currency); return;
            }
            if (!ZSGame.Instance.Running || !ZSGame.Instance.RoundInProgress)
            {
                p.Message("You can only buy an invisiblity potion " +
                          "when a round of zombie survival is in progress."); return;
            }

            ZSData data = ZSGame.Get(p);

            if (data.Invisible)
            {
                p.Message("You are already invisible."); return;
            }
            if (data.InvisibilityPotions >= MaxPotions)
            {
                p.Message("You cannot buy any more invisibility potions this round."); return;
            }
            if (ForHumans && data.Infected)
            {
                p.Message("Use %T/Buy zinvisibility %Sfor buying invisibility when you are a zombie."); return;
            }
            if (!ForHumans && !data.Infected)
            {
                p.Message("Use %T/Buy invisibility %Sfor buying invisibility when you are a human."); return;
            }

            DateTime end = ZSGame.Instance.RoundEnd;

            if (DateTime.UtcNow.AddSeconds(60) > end)
            {
                p.Message("You cannot buy an invisibility potion " +
                          "during the last minute of a round."); return;
            }

            data.Invisible       = true;
            data.InvisibilityEnd = DateTime.UtcNow.AddSeconds(Duration);
            data.InvisibilityPotions++;
            int left = MaxPotions - data.InvisibilityPotions;

            p.Message("Lasts for &a{0} %Sseconds. You can buy &a{1} %Smore this round.", Duration, left);
            ZSGame.Instance.Map.Message(p.ColoredName + " %Svanished. &a*POOF*");
            Entities.GlobalDespawn(p, false, false);
            Economy.MakePurchase(p, Price, "%3Invisibility: " + Duration);
        }
示例#4
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            if (ZSGame.Instance.Picker.QueuedMap != null)
            {
                p.Message("Someone else has already queued a level."); return;
            }
            string map = Matcher.FindMaps(p, args[1]);

            if (map == null)
            {
                return;
            }

            UseCommand(p, "Queue", "level " + map);
            Economy.MakePurchase(p, Price, "%3QueueLevel: " + map);
        }
示例#5
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            if (Server.zombie.QueuedLevel != null)
            {
                Player.Message(p, "Someone else has already queued a level."); return;
            }
            string map = LevelInfo.FindMapMatches(p, args[1]);

            if (map == null)
            {
                return;
            }

            Command.all.Find("queue").Use(p, "level " + map);
            Economy.MakePurchase(p, Price, "%3QueueLevel: " + map);
        }
示例#6
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            byte count = 1;

            if (args.Length >= 2 && !byte.TryParse(args[1], out count) || count == 0 || count > 10)
            {
                Player.Message(p, "Number of groups of 10 blocks to buy must be an integer between 1 and 10."); return;
            }
            if (p.money < Price * count)
            {
                Player.Message(p, "&cYou don't have enough &3{2} &cto buy {1} {0}.",
                               Name, count * 10, Server.moneys); return;
            }

            p.Game.BlocksLeft += 10 * count;
            Economy.MakePurchase(p, Price * count, "%310Blocks: " + (10 * count));
        }
示例#7
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (p.money < Price)
            {
                Player.Message(p, "%cYou don't have enough &3{1} &c to buy a {0}.", Name, Server.moneys); return;
            }
            if (p.Game.Invisible)
            {
                Player.Message(p, "You are already invisible."); return;
            }
            if (p.Game.InvisibilityPotions >= MaxPotions)
            {
                Player.Message(p, "You cannot buy any more invisibility potions this round."); return;
            }
            if (ForHumans && p.Game.Infected)
            {
                Player.Message(p, "Use %T/buy zinvisibility %Sfor buying invisibility when you are a zombie."); return;
            }
            if (!ForHumans && !p.Game.Infected)
            {
                Player.Message(p, "Use %T/buy invisibility %Sfor buying invisibility when you are a human."); return;
            }

            if (!Server.zombie.Running || !Server.zombie.RoundInProgress)
            {
                Player.Message(p, "You can only buy an invisiblity potion " +
                               "when a round of zombie survival is in progress."); return;
            }

            DateTime end = Server.zombie.RoundEnd;

            if (DateTime.UtcNow.AddSeconds(60) > end)
            {
                Player.Message(p, "You cannot buy an invisibility potion " +
                               "during the last minute of a round."); return;
            }
            p.Game.Invisible       = true;
            p.Game.InvisibilityEnd = DateTime.UtcNow.AddSeconds(Duration);
            p.Game.InvisibilityPotions++;
            int left = MaxPotions - p.Game.InvisibilityPotions;

            Player.Message(p, "Lasts for &a{0} %Sseconds. You can buy &a{1} %Smore this round.", Duration, left);
            Server.zombie.CurLevel.ChatLevel(p.ColoredName + " %Svanished. &a*POOF*");
            Entities.GlobalDespawn(p, false);
            Economy.MakePurchase(p, Price, "%3Invisibility: " + Duration);
        }
示例#8
0
        protected internal override void OnPurchase(Player p, string args)
        {
            if (!CheckPrice(p, Price, "a revive potion"))
            {
                return;
            }
            if (!ZSGame.Instance.Running || !ZSGame.Instance.RoundInProgress)
            {
                p.Message("You can only buy a revive potion " +
                          "when a round of zombie survival is in progress."); return;
            }

            ZSData data = ZSGame.Get(p);

            if (!p.infected)
            {
                p.Message("You are already a human."); return;
            }

            DateTime end = ZSGame.Instance.RoundEnd;

            if (DateTime.UtcNow.AddSeconds(ZSGame.Config.ReviveNoTime) > end)
            {
                p.Message(ZSGame.Config.ReviveNoTimeMessage); return;
            }
            int count = ZSGame.Instance.Infected.Count;

            if (count < ZSGame.Config.ReviveFewZombies)
            {
                p.Message(ZSGame.Config.ReviveFewZombiesMessage); return;
            }
            if (data.RevivesUsed >= ZSGame.Config.ReviveTimes)
            {
                p.Message("You cannot buy any more revive potions."); return;
            }
            if (data.TimeInfected.AddSeconds(ZSGame.Config.ReviveTooSlow) < DateTime.UtcNow)
            {
                p.Message("&WYou can only revive within the first {0} seconds after you were infected.",
                          ZSGame.Config.ReviveTooSlow); return;
            }

            ZSGame.Instance.AttemptRevive(p);
            data.RevivesUsed++;
            Economy.MakePurchase(p, Price, "%3Revive:");
        }
示例#9
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (p.money < Price)
            {
                p.Message("%WYou don't have enough &3" + Server.Config.Currency + "%W to buy a " + Name + "."); return;
            }
            if (!ZSGame.Instance.Running || !ZSGame.Instance.RoundInProgress)
            {
                p.Message("You can only buy an revive potion " +
                          "when a round of zombie survival is in progress."); return;
            }

            ZSData data = ZSGame.Get(p);

            if (!data.Infected)
            {
                p.Message("You are already a human."); return;
            }

            DateTime end = ZSGame.Instance.RoundEnd;

            if (DateTime.UtcNow.AddSeconds(ZSGame.Config.ReviveNoTime) > end)
            {
                p.Message(ZSGame.Config.ReviveNoTimeMessage); return;
            }
            int count = ZSGame.Instance.Infected.Count;

            if (count < ZSGame.Config.ReviveFewZombies)
            {
                p.Message(ZSGame.Config.ReviveFewZombiesMessage); return;
            }
            if (data.RevivesUsed >= ZSGame.Config.ReviveTimes)
            {
                p.Message("You cannot buy any more revive potions."); return;
            }
            if (data.TimeInfected.AddSeconds(ZSGame.Config.ReviveTooSlow) < DateTime.UtcNow)
            {
                p.Message("%WYou can only revive within the first {0} seconds after you were infected.",
                          ZSGame.Config.ReviveTooSlow); return;
            }

            ZSGame.Instance.AttemptRevive(p);
            data.RevivesUsed++;
            Economy.MakePurchase(p, Price, "%3Revive:");
        }
示例#10
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            string color = Matcher.FindColor(p, args[1]);

            if (color == null)
            {
                return;
            }
            string colName = Colors.Name(color);

            if (color == p.color)
            {
                Player.Message(p, "%cYou already have a " + color + colName + "%c color"); return;
            }

            Command.all.FindByName("Color").Use(null, p.name + " " + colName);
            Economy.MakePurchase(p, Price, "%3Color: " + color + colName);
        }
示例#11
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            string color = Matcher.FindColor(p, args[1]);

            if (color == null)
            {
                return;
            }
            string colName = Colors.Name(color);

            if (color == p.color)
            {
                p.Message("%WYour color is already " + color + colName); return;
            }

            UseCommand(p, "Color", "-own " + colName);
            Economy.MakePurchase(p, Price, "%3Color: " + color + colName);
        }
示例#12
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            if (!args[1].StartsWith("&") || !args[1].StartsWith("%"))
            {
                args[1] = Colors.Parse(args[1]);
                if (args[1] == "")
                {
                    Player.Message(p, "%cThat wasn't a color"); return;
                }
            }
            if (args[1] == p.color)
            {
                Player.Message(p, "%cYou already have a " + args[1] + Colors.Name(args[1]) + "%c color"); return;
            }

            Command.all.Find("color").Use(null, p.name + " " + Colors.Name(args[1]));
            Economy.MakePurchase(p, Price, "%3Color: " + args[1] + Colors.Name(args[1]));
        }
示例#13
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (p.money < Price)
            {
                p.Message("%WYou don't have enough &3{1} %Wto buy an {0}.", Name, Server.Config.Currency); return;
            }
            if (!ZSGame.Instance.Running || !ZSGame.Instance.RoundInProgress)
            {
                p.Message("You can only buy an invisiblity potion " +
                          "when a round of zombie survival is in progress."); return;
            }

            ZSData data = ZSGame.Get(p);

            if (data.Invisible)
            {
                p.Message("You are already invisible."); return;
            }
            ZSConfig cfg = ZSGame.Config;

            int maxPotions = data.Infected ? cfg.ZombieInvisibilityPotions : cfg.InvisibilityPotions;

            if (data.InvisibilityPotions >= maxPotions)
            {
                p.Message("You cannot buy any more invisibility potions this round."); return;
            }

            DateTime end = ZSGame.Instance.RoundEnd;

            if (DateTime.UtcNow.AddSeconds(60) > end)
            {
                p.Message("You cannot buy an invisibility potion during the last minute of a round."); return;
            }

            int duration = data.Infected ? cfg.ZombieInvisibilityDuration : cfg.InvisibilityDuration;

            data.InvisibilityPotions++;
            int left = maxPotions - data.InvisibilityPotions;

            p.Message("Lasts for &a{0} %Sseconds. You can buy &a{1} %Smore this round.", duration, left);
            ZSGame.Instance.GoInvisible(p, duration);
            Economy.MakePurchase(p, Price, "%3Invisibility: " + duration);
        }
示例#14
0
        protected internal override void OnPurchase(Player p, string args)
        {
            if (!CheckPrice(p, Price, "an invisibility potion"))
            {
                return;
            }
            if (!ZSGame.Instance.Running || !ZSGame.Instance.RoundInProgress)
            {
                p.Message("You can only buy an invisiblity potion " +
                          "when a round of zombie survival is in progress."); return;
            }

            ZSData data = ZSGame.Get(p);

            if (data.Invisible)
            {
                p.Message("You are already invisible."); return;
            }
            ZSConfig cfg = ZSGame.Config;

            int maxPotions = p.infected ? cfg.ZombieInvisibilityPotions : cfg.InvisibilityPotions;

            if (data.InvisibilityPotions >= maxPotions)
            {
                p.Message("You cannot buy any more invisibility potions this round."); return;
            }

            DateTime end = ZSGame.Instance.RoundEnd;

            if (DateTime.UtcNow.AddSeconds(60) > end)
            {
                p.Message("You cannot buy an invisibility potion during the last minute of a round."); return;
            }

            int duration = p.infected ? cfg.ZombieInvisibilityDuration : cfg.InvisibilityDuration;

            data.InvisibilityPotions++;
            int left = maxPotions - data.InvisibilityPotions;

            p.Message("Lasts for &a{0} &Sseconds. You can buy &a{1} &Smore this round.", duration, left);
            ZSGame.Instance.GoInvisible(p, duration);
            Economy.MakePurchase(p, Price, "%3Invisibility: " + duration);
        }
示例#15
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            byte         count = 1;
            const string group = "Number of groups of 10 blocks";

            if (args.Length >= 2 && !CommandParser.GetByte(p, args[1], group, ref count, 0, 10))
            {
                return;
            }

            if (p.money < Price * count)
            {
                Player.Message(p, "&cYou don't have enough &3{2} &cto buy {1} {0}.",
                               Name, count * 10, ServerConfig.Currency); return;
            }

            p.Game.BlocksLeft += 10 * count;
            Economy.MakePurchase(p, Price * count, "%310Blocks: " + (10 * count));
        }
示例#16
0
        protected internal override void OnPurchase(Player p, string args)
        {
            int          count = 1;
            const string group = "Number of groups of 10 blocks";

            if (args.Length > 0 && !CommandParser.GetInt(p, args, group, ref count, 0, 10))
            {
                return;
            }

            if (!CheckPrice(p, count * Price, (count * 10) + " blocks"))
            {
                return;
            }

            ZSData data = ZSGame.Get(p);

            data.BlocksLeft += 10 * count;
            Economy.MakePurchase(p, Price * count, "%310Blocks: " + (10 * count));
        }
示例#17
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (args.Length >= 2)
            {
                Player.Message(p, "%cYou cannot provide a rank name, use %a/buy rank %cto buy the NEXT rank."); return;
            }
            if (p.Rank >= MaxRank)
            {
                Player.Message(p, "%cYou cannot buy anymore ranks, as you are at or past the max buyable rank of {0}",
                               Group.GetColoredName(MaxRank));
                return;
            }
            if (p.money < NextRank(p).price)
            {
                Player.Message(p, "%cYou don't have enough %3" + ServerConfig.Currency + "%c to buy the next rank"); return;
            }

            Command.all.FindByName("SetRank").Use(null, "+up " + p.name);
            Player.Message(p, "You bought the rank " + p.group.ColoredName);
            Economy.MakePurchase(p, FindRank(p.group.Name).price, "%3Rank: " + p.group.ColoredName);
        }
示例#18
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            if (args.Length == 1)
            {
                UseCommand(p, "Nick", "-own");
                p.Message("&aYour nickname was removed for free."); return;
            }

            string nick = message.SplitSpaces(2)[1]; // keep spaces this way

            if (nick == p.DisplayName)
            {
                p.Message("%WYou already have that nickname."); return;
            }
            if (nick.Length >= 30)
            {
                p.Message("%WNicknames must be under 30 characters."); return;
            }

            UseCommand(p, "Nick", "-own " + nick);
            Economy.MakePurchase(p, Price, "%3Nickname: %f" + nick);
        }
示例#19
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            if (args.Length == 1)
            {
                UseCommand(p, "Title", "-own");
                p.Message("&aYour title was removed for free."); return;
            }

            string title = message.SplitSpaces(2)[1]; // keep spaces this way

            if (title == p.title)
            {
                p.Message("%WYou already have that title."); return;
            }
            if (title.Length >= 20)
            {
                p.Message("%WTitles must be under 20 characters."); return;
            }

            UseCommand(p, "Title", "-own " + title);
            Economy.MakePurchase(p, Price, "%3Title: %f" + title);
        }
示例#20
0
        protected internal override void OnPurchase(Player p, string args)
        {
            if (ZSGame.Instance.Picker.QueuedMap != null)
            {
                p.Message("Someone else has already queued a level."); return;
            }

            if (args.Length == 0)
            {
                OnStoreCommand(p); return;
            }
            if (!CheckPrice(p))
            {
                return;
            }

            if (!ZSGame.Instance.SetQueuedLevel(p, args))
            {
                return;
            }
            Economy.MakePurchase(p, Price, "%3QueueLevel: " + args);
        }
示例#21
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (args.Length >= 2)
            {
                Player.Message(p, "%cYou cannot provide a rank name, use %a/buy rank %cto buy the NEXT rank."); return;
            }
            Group maxrank = Group.Find(MaxRank);

            if (p.Rank >= maxrank.Permission)
            {
                Player.Message(p, "%cYou cannot buy anymore ranks, because you passed the max buyable rank: " + maxrank.color + maxrank.name);
                return;
            }
            if (p.money < NextRank(p).price)
            {
                Player.Message(p, "%cYou don't have enough %3" + Server.moneys + "%c to buy the next rank"); return;
            }

            Command.all.Find("setrank").Use(null, "+up " + p.name);
            Player.Message(p, "You bought the rank " + p.group.ColoredName);
            Economy.MakePurchase(p, FindRank(p.group.name).price, "%3Rank: " + p.group.ColoredName);
        }
示例#22
0
        protected internal override void OnPurchase(Player p, string title)
        {
            if (title.Length == 0)
            {
                PlayerOperations.SetTitle(p, p.name, "");
                p.Message("&aYour title was removed for free."); return;
            }

            if (!CheckPrice(p))
            {
                return;
            }
            if (title == p.title)
            {
                p.Message("&WYou already have that title."); return;
            }

            if (!PlayerOperations.SetTitle(p, p.name, title))
            {
                return;
            }
            Economy.MakePurchase(p, Price, "%3Title: %f" + title);
        }
示例#23
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            if (args.Length == 1)
            {
                Command.all.Find("logoutmessage").Use(null, p.name + " disconnected");
                Player.Message(p, "%aYour logout message was removed for free.");
                return;
            }

            string text = message.SplitSpaces(2)[1]; // keep spaces this way

            if (text == PlayerDB.GetLogoutMessage(p))
            {
                Player.Message(p, "%cYou already have that logout message."); return;
            }
            if (text.Length > 64)
            {
                Player.Message(p, "%cLogin message must be 64 characters or less."); return;
            }
            Command.all.Find("logoutmessage").Use(null, p.name + " " + text);
            Player.Message(p, "%aYour logout message was changed to: %f" + text);
            Economy.MakePurchase(p, Price, "%3LogoutMessage: %f" + text);
        }
示例#24
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            if (args.Length == 1)
            {
                PlayerDB.SetLogoutMessage(p.name, "");
                p.Message("&aYour logout message was removed for free.");
                return;
            }

            string msg = message.SplitSpaces(2)[1]; // keep spaces this way

            if (msg == PlayerDB.GetLogoutMessage(p))
            {
                p.Message("%WYou already have that logout message."); return;
            }
            if (msg.Length > NetUtils.StringSize)
            {
                p.Message("%WLogin message must be 64 characters or less."); return;
            }

            UseCommand(p, "LogoutMessage", "-own " + msg);
            Economy.MakePurchase(p, Price, "%3LogoutMessage: %f" + msg);
        }
示例#25
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            if (args.Length == 1)
            {
                Command.all.Find("nick").Use(null, p.name);
                Player.Message(p, "%aYour nickname was removed for free."); return;
            }

            string nick = message.SplitSpaces(2)[1]; // keep spaces this way

            if (nick == p.DisplayName)
            {
                Player.Message(p, "%cYou already have that nickname."); return;
            }
            if (nick.Length >= 30)
            {
                Player.Message(p, "%cNicknames must be under 30 characters."); return;
            }

            Command.all.Find("nick").Use(null, p.name + " " + nick);
            Player.Message(p, "%aYour nickname was changed to [" + p.color + nick + "%a]");
            Economy.MakePurchase(p, Price, "%3Nickname: %f" + nick);
        }
示例#26
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            if (args.Length == 1)
            {
                Command.all.Find("title").Use(null, p.name);
                Player.Message(p, "%aYour title was removed for free."); return;
            }

            string title = message.SplitSpaces(2)[1]; // keep spaces this way

            if (title == p.title)
            {
                Player.Message(p, "%cYou already have that title."); return;
            }
            if (title.Length >= 20)
            {
                Player.Message(p, "%cTitles must be under 20 characters."); return;
            }

            Command.all.Find("title").Use(null, p.name + " " + title);
            Player.Message(p, "%aYour title was changed to [" + p.titlecolor + title + "%a]");
            Economy.MakePurchase(p, Price, "%3Title: %f" + title);
        }
示例#27
0
        protected internal override void OnPurchase(Player p, string msg)
        {
            if (msg.Length == 0)
            {
                OnStoreCommand(p); return;
            }
            bool hasAToken = false;

            for (int i = 0; i < msg.Length; i++)
            {
                if (!CheckEscape(msg, i, ref hasAToken))
                {
                    p.Message("You can only use {0} and {1} for tokens in infect messages."); return;
                }
            }
            if (!hasAToken)
            {
                p.Message("You need to include a \"{0}\" (placeholder for zombie player) " +
                          "and/or a \"{1}\" (placeholder for human player) in the infect message."); return;
            }

            if (!CheckPrice(p))
            {
                return;
            }
            ZSData data = ZSGame.Get(p);

            if (data.InfectMessages == null)
            {
                data.InfectMessages = new List <string>();
            }
            data.InfectMessages.Add(msg);

            ZSConfig.AppendPlayerInfectMessage(p.name, msg);
            p.Message("&aAdded infect message: &f" + msg);
            Economy.MakePurchase(p, Price, "%3InfectMessage: " + msg);
        }
示例#28
0
        protected internal override void OnPurchase(Player p, string nick)
        {
            if (nick.Length == 0)
            {
                UseCommand(p, "Nick", "-own");
                p.Message("&aYour nickname was removed for free."); return;
            }

            if (!CheckPrice(p))
            {
                return;
            }
            if (nick == p.DisplayName)
            {
                p.Message("&WYou already have that nickname."); return;
            }
            if (nick.Length >= 30)
            {
                p.Message("&WNicknames must be under 30 characters."); return;
            }

            UseCommand(p, "Nick", "-own " + nick);
            Economy.MakePurchase(p, Price, "%3Nickname: %f" + nick);
        }
示例#29
0
        protected internal override void OnPurchase(Player p, string title)
        {
            if (title.Length == 0)
            {
                UseCommand(p, "Title", "-own");
                p.Message("&aYour title was removed for free."); return;
            }

            if (!CheckPrice(p))
            {
                return;
            }
            if (title == p.title)
            {
                p.Message("&WYou already have that title."); return;
            }
            if (title.Length >= 20)
            {
                p.Message("&WTitles must be under 20 characters."); return;
            }

            UseCommand(p, "Title", "-own " + title);
            Economy.MakePurchase(p, Price, "%3Title: %f" + title);
        }
示例#30
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (args.Length >= 2)
            {
                p.Message("%WYou cannot provide a rank name, use %T/Buy rank %Wto buy the NEXT rank."); return;
            }

            RankEntry nextRank = NextRank(p);

            if (nextRank == null)
            {
                p.Message("%WYou are already at or past the max buyable rank"); return;
            }
            if (p.money < nextRank.Price)
            {
                p.Message("%WYou don't have enough &3" + Server.Config.Currency + " %Wto buy the next rank"); return;
            }

            Group rank = Group.Find(nextRank.Perm); // TODO: What if null reference happens here

            Command.Find("SetRank").Use(Player.Console, p.name + " " + rank.Name);
            p.Message("You bought the rank " + rank.ColoredName);
            Economy.MakePurchase(p, nextRank.Price, "&3Rank: " + rank.ColoredName);
        }