public override void Use(Player p, string message, CommandData data) { if (p.Game.PledgeSurvive) { p.Message("You cannot un-pledge that you will be infected."); return; } if (ZSGame.Get(p).Infected) { p.Message("You cannot use &T/human &Sas you are currently infected."); return; } if (Economy.Enabled && p.money < 5) { p.Message("You need to have at least 5 &3" + Server.Config.Currency + " &Sto pledge that you will not be infected."); return; } if (!ZSGame.Instance.RoundInProgress) { p.Message("Can only use &T/human &Swhen a round is in progress."); return; } TimeSpan delta = ZSGame.Instance.RoundEnd - DateTime.UtcNow; if (delta < TimeSpan.FromMinutes(3)) { p.Message("Cannot use &T/human &Sin last three minutes of a round."); return; } p.Game.PledgeSurvive = true; ZSGame.Instance.Map .Message(p.ColoredName + " &Spledges that they will not succumb to the infection!"); }
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); }
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++; }
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); }
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:"); }
public override void Use(Player p, string message, CommandData data) { Player who = message.Length == 0 ? p : PlayerInfo.FindMatches(p, message); if (who == null) { return; } if (!ZSGame.Instance.RoundInProgress || ZSGame.Get(who).Infected) { p.Message("Cannot infect player"); } else if (!who.Game.Referee) { ZSGame.Instance.InfectPlayer(who, p); Chat.MessageFrom(who, "λNICK &Swas infected."); } }
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); }
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); }
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)); }
public override void Use(Player p, string message, CommandData data) { ZSData data_ = ZSGame.Get(p); data_.AkaMode = !data_.AkaMode; Player[] players = PlayerInfo.Online.Items; p.Message("AKA mode is now: " + (data_.AkaMode ? "&aOn" : "&cOff")); foreach (Player other in players) { if (other.level != p.level || p == other || !p.CanSeeEntity(other)) { continue; } Entities.Despawn(p, other); Entities.Spawn(p, other); } TabList.Add(p, p, Entities.SelfID); }
protected override void DoPurchase(Player p, string message, string[] args) { int count = 1; const string group = "Number of groups of 10 blocks"; if (args.Length >= 2 && !CommandParser.GetInt(p, args[1], group, ref count, 0, 10)) { return; } if (p.money < Price * count) { p.Message("%WYou don't have enough &3{2} %Wto buy {1} {0}.", Name, count * 10, Server.Config.Currency); return; } ZSData data = ZSGame.Get(p); data.BlocksLeft += 10 * count; Economy.MakePurchase(p, Price * count, "%310Blocks: " + (10 * count)); }
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); }