示例#1
0
        public void AskGearUp(RocketPlayer from = null, Kit kit = null) {
            if ((Available > DateTime.Now) && from == null && !Player.HasPermission("gearup.admin")) {
                string notReadyMsg = TDict["not_ready"].Replace("%S", ((int)(Available - DateTime.Now).TotalSeconds).ToString());
                Say(Player, notReadyMsg, Config.ErrorColor);
                } else {
                // got here because:
                // Available  OR  from someone else  OR  admin

                // is VIP, cooldown not -1, not admin
                if (Player.HasPermission("gearup.vip") && Config.VIPCooldown != -1 && !Player.HasPermission("gearup.admin"))
                    Available = DateTime.Now.AddSeconds(Config.VIPCooldown);
                else if (Player.HasPermission("gearup.admin"))
                    Available = DateTime.Now;
                else
                    Available = DateTime.Now.AddSeconds(Config.Cooldown);

                GiveGear(from, kit);
                }
            }
示例#2
0
        private void GiveGear(RocketPlayer from = null, Kit kit = null) {
            if (kit == null)
                kit = Config.DefaultKit;

            foreach (Item g in kit.Items) {
                if (Player.GiveItem(g.ID, g.Amount) == false) {
                    LogError($"GearUp> Failed to give {Player.CharacterName} item {g.ID} x{g.Amount}.");
                    Say(from, TDict["error_message"], Config.ErrorColor);
                    }
                }

            if (from == null) {
                Say(Player, TDict["gear_given"], Config.SuccessColor);
                } else {
                Say(Player, TDict["gear_gift"].Replace("%P", from.CharacterName), Config.SuccessColor);
                Say(from, TDict["gear_gift_success"].Replace("%P", Player.CharacterName), Config.SuccessColor);
                }
            }