Exemplo n.º 1
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;
            }
            string map = Matcher.FindMaps(p, args);

            if (map == null)
            {
                return;
            }

            if (!CheckPrice(p))
            {
                return;
            }
            UseCommand(p, "Queue", "level " + map);
            Economy.MakePurchase(p, Price, "%3QueueLevel: " + map);
        }
Exemplo n.º 2
0
        protected internal override void OnPurchase(Player p, string nick)
        {
            if (nick.Length == 0)
            {
                PlayerOperations.SetNick(p, p.name, "");
                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;
            }

            if (!PlayerOperations.SetNick(p, p.name, nick))
            {
                return;
            }
            Economy.MakePurchase(p, Price, "%3Nickname: %f" + nick);
        }
Exemplo n.º 3
0
        protected internal override void OnPurchase(Player p, string msg)
        {
            if (msg.Length == 0)
            {
                PlayerDB.SetLogoutMessage(p.name, "");
                p.Message("&aYour logout message was removed for free.");
                return;
            }

            if (!CheckPrice(p))
            {
                return;
            }
            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);
        }
Exemplo n.º 4
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)
            {
                p.Message("%WThat isn't a level preset"); return;
            }

            if (p.money < preset.price)
            {
                p.Message("%WYou don't have enough &3" + ServerConfig.Currency + "%W to buy that map"); return;
            }
            string name = p.name + "_" + args[2];

            p.Message("&aCreating level: '&f" + name + "&a' . . .");
            UseCommand(p, "NewLvl", name + " " + preset.x + " " + preset.y + " " + preset.z + " " + preset.type);

            Level level = LevelActions.Load(Player.Console, name, true);

            CmdOverseer.SetPerms(p, level);
            Level.SaveSettings(level);
            PlayerActions.ChangeMap(p, name);

            p.Message("&aSuccessfully created your map: '&f" + name + "&a'");
            Economy.MakePurchase(p, preset.price, "%3Map: %f" + preset.name);
        }
Exemplo n.º 5
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" + ServerConfig.Currency + "%c to buy that map"); return;
            }
            string name = p.name + "_" + args[2];

            try {
                Command.all.FindByName("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);
                CmdOverseer.SetPerms(p, level);
                Level.SaveSettings(level);
                PlayerActions.ChangeMap(p, name);

                Player.Message(p, "%aSuccessfully created your map: '%f" + name + "%a'");
            } catch {
                Player.Message(p, "%cSomething went wrong, Money untouched"); return;
            }
            Economy.MakePurchase(p, preset.price, "%3Map: %f" + preset.name);
        }
Exemplo n.º 6
0
        protected internal override void OnPurchase(Player p, string args)
        {
            if (args.Length == 0)
            {
                OnStoreCommand(p); return;
            }
            string color = Matcher.FindColor(p, args);

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

            if (!CheckPrice(p))
            {
                return;
            }

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

            if (!PlayerOperations.SetColor(p, p.name, name))
            {
                return;
            }
            Economy.MakePurchase(p, Price, "%3Color: " + color + name);
        }
Exemplo n.º 7
0
        protected override void DoPurchase(Player p, string message, string[] args)
        {
            string text      = message.SplitSpaces(2)[1]; // keep spaces this way
            bool   hasAToken = false;

            for (int i = 0; i < text.Length; i++)
            {
                if (!CheckEscape(text, 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;
            }

            ZSData data = ZSGame.Get(p);

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

            ZSConfig.AppendPlayerInfectMessage(p.name, text);
            p.Message("&aAdded infect message: &f" + text);
            Economy.MakePurchase(p, Price, "%3InfectMessage: " + message);
        }
Exemplo n.º 8
0
        protected internal override void OnPurchase(Player p, string args)
        {
            if (args.Length == 0)
            {
                OnStoreCommand(p); return;
            }
            string color = Matcher.FindColor(p, args);

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

            if (!CheckPrice(p))
            {
                return;
            }

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

            UseCommand(p, "TColor", "-own " + colName);
            Economy.MakePurchase(p, Price, "%3Titlecolor: " + color + colName);
        }
Exemplo n.º 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;
            }

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

            if (chance <= ZSGame.Config.ReviveChance)
            {
                ZSGame.Instance.DisinfectPlayer(p);
                ZSGame.Instance.Map.Message(p.ColoredName + " %Sused a revive potion. &aIt was super effective!");
            }
            else
            {
                ZSGame.Instance.Map.Message(p.ColoredName + " %Stried using a revive potion. &cIt was not very effective..");
            }
            Economy.MakePurchase(p, Price, "%3Revive:");
            data.RevivesUsed++;
        }
Exemplo n.º 10
0
        protected internal override void OnBuyCommand(Player p, string message, string[] args)
        {
            if (args.Length < 2)
            {
                OnStoreCommand(p); return;
            }
            LevelPreset preset = FindPreset(args[1]);

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

            if (p.money < preset.price)
            {
                p.Message("%WYou don't have enough &3" + Server.Config.Currency + "%W to buy that map"); return;
            }

            string name = null;

            if (args.Length >= 3)
            {
                name = p.name + "_" + args[2];
            }
            else
            {
                // use a numbered map by default
                for (int i = 1; i < 100; i++)
                {
                    name = p.name + "_" + i;
                    if (!LevelInfo.MapExists(name))
                    {
                        break;
                    }
                }
            }

            if (LevelInfo.MapExists(name))
            {
                p.Message("%WLevel \"{0}\" already exists", name); return;
            }

            p.Message("&aCreating level: '&f" + name + "&a' . . .");
            UseCommand(p, "NewLvl", name + " " + preset.x + " " + preset.y + " " + preset.z + " " + preset.type);

            Level level = LevelActions.Load(Player.Console, name, true);

            CmdOverseer.SetPerms(p, level);
            level.SaveSettings();
            PlayerActions.ChangeMap(p, name);

            p.Message("&aSuccessfully created your map: '&f" + name + "&a'");
            Economy.MakePurchase(p, preset.price, "%3Map: %f" + preset.name);
        }
Exemplo n.º 11
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++;
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 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 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);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
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);
        }
Exemplo n.º 17
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));
        }
Exemplo n.º 18
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 (!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:");
        }
Exemplo n.º 19
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]));
        }
Exemplo n.º 20
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);
        }
Exemplo n.º 21
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);
        }
Exemplo n.º 22
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);
        }
Exemplo n.º 23
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));
        }
Exemplo n.º 24
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);
        }
Exemplo n.º 25
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));
        }
Exemplo n.º 26
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);
        }
Exemplo n.º 27
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);
        }
Exemplo n.º 28
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);
        }
Exemplo n.º 29
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);
        }
Exemplo n.º 30
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);
        }