diff --git a/MCGalaxy/Commands/Fun/ZombieSurvival/CmdQueue.cs b/MCGalaxy/Commands/Fun/ZombieSurvival/CmdQueue.cs index 2b676276e..ddce4c490 100644 --- a/MCGalaxy/Commands/Fun/ZombieSurvival/CmdQueue.cs +++ b/MCGalaxy/Commands/Fun/ZombieSurvival/CmdQueue.cs @@ -32,21 +32,9 @@ namespace MCGalaxy.Commands.Fun { string value = args[1]; if (args[0].CaselessEq("zombie")) { - Player who = PlayerInfo.FindMatches(p, value); - if (who == null) return; - - p.Message(value + " was queued."); - ZSGame.Instance.QueuedZombie = who.name; - if (ZSGame.Instance.Map != null) - ZSGame.Instance.Map.Message(who.ColoredName + " &Swas queued as the next zombie."); + ZSGame.Instance.SetQueuedZombie(p, value); } else if (args[0].CaselessEq("level")) { - string map = Matcher.FindMaps(p, value); - if (map == null) return; - - p.Message(map + " was queued."); - ZSGame.Instance.Picker.QueuedMap = map.ToLower(); - if (ZSGame.Instance.Map != null) - ZSGame.Instance.Map.Message(map + " was queued as the next map."); + ZSGame.Instance.SetQueuedLevel(p, value); } else { Help(p); } diff --git a/MCGalaxy/Economy/Item.cs b/MCGalaxy/Economy/Item.cs index 85ea806d1..1da15b7e9 100644 --- a/MCGalaxy/Economy/Item.cs +++ b/MCGalaxy/Economy/Item.cs @@ -89,13 +89,6 @@ namespace MCGalaxy.Eco { } } - protected static void UseCommand(Player p, string cmd, string args) { - CommandData data = default(CommandData); - data.Rank = LevelPermission.Nobody; - data.Context = CommandContext.Purchase; - Command.Find(cmd).Use(p, args, data); - } - protected static bool CheckPrice(Player p, int price, string item) { if (p.money < price) { p.Message("&WYou don't have enough &3{1} &Wto buy {0}.", item, Server.Config.Currency); diff --git a/MCGalaxy/Economy/ZombieItems.cs b/MCGalaxy/Economy/ZombieItems.cs index ea647a3f8..58bf50ef5 100644 --- a/MCGalaxy/Economy/ZombieItems.cs +++ b/MCGalaxy/Economy/ZombieItems.cs @@ -66,12 +66,10 @@ namespace MCGalaxy.Eco { } 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); + + if (!ZSGame.Instance.SetQueuedLevel(p, args)) return; + Economy.MakePurchase(p, Price, "%3QueueLevel: " + args); } protected internal override void OnStoreCommand(Player p) { diff --git a/MCGalaxy/Games/ZombieSurvival/ZSGame.cs b/MCGalaxy/Games/ZombieSurvival/ZSGame.cs index 572dd999f..38127d545 100644 --- a/MCGalaxy/Games/ZombieSurvival/ZSGame.cs +++ b/MCGalaxy/Games/ZombieSurvival/ZSGame.cs @@ -298,5 +298,28 @@ namespace MCGalaxy.Games { string state = ", you are " + (Get(p).Infected ? "&cdead" : "&aalive"); return money + state; } + + + public bool SetQueuedZombie(Player p, string name) { + Player target = PlayerInfo.FindMatches(p, name); + if (target == null) return false; + + p.Message("{0} was queued.", p.FormatNick(target)); + QueuedZombie = target.name; + + if (Map != null) Map.Message(target.ColoredName + " &Swas queued as the next zombie."); + return true; + } + + public bool SetQueuedLevel(Player p, string name) { + string map = Matcher.FindMaps(p, name); + if (map == null) return false; + + p.Message(map + " was queued."); + Picker.QueuedMap = map.ToLower(); + + if (Map != null) Map.Message(map + " was queued as the next map."); + return true; + } } }