Beispiel #1
0
        public KitItem(ushort id, byte durability, byte amount)
        {
            Id         = id;
            Durability = durability;
            Amount     = amount;

            ItemUtil.GetItem(id).IfPresent(asset => Metadata = asset.getState());
        }
Beispiel #2
0
        public KitItem(ushort id, byte durability, byte amount)
        {
            Preconditions.CheckState(
                Assets.find(EAssetType.ITEM, id) != null, EssLang.Translate("INVALID_ITEM_ID", id));

            Id         = id;
            Durability = durability;
            Amount     = amount;

            ItemUtil.GetItem(id).IfPresent(ass => Metadata = ass.getState());
        }
Beispiel #3
0
        public bool CastSeraphEmbrace()
        {
            var seraph = ItemUtil.GetItem(3040);

            if (!seraph.IsOwned() || !seraph.IsReady())
            {
                return(false);
            }

            seraph.Cast();

            return(true);
        }
Beispiel #4
0
        public bool CastZhonya()
        {
            var zhonya = ItemUtil.GetItem(ItemId.Zhonyas_Hourglass);

            if (!zhonya.IsOwned() || !zhonya.IsReady())
            {
                return(false);
            }

            zhonya.Cast();

            return(true);
        }
Beispiel #5
0
        public bool CastYomumu()
        {
            var yomumu = ItemUtil.GetItem(ItemId.Youmuus_Ghostblade);

            if (!yomumu.IsOwned() || !yomumu.IsReady())
            {
                return(false);
            }

            yomumu.Cast();

            return(true);
        }
Beispiel #6
0
        public bool CastBtrk(Obj_AI_Base target)
        {
            var bilgewaterBtrk = ItemUtil.GetItem(ItemId.Bilgewater_Cutlass);

            if (bilgewaterBtrk.IsOwned() && bilgewaterBtrk.IsReady())
            {
                bilgewaterBtrk.Cast(target);
                return(true);
            }

            bilgewaterBtrk = ItemUtil.GetItem(ItemId.Blade_of_the_Ruined_King);

            if (!bilgewaterBtrk.IsOwned() || !bilgewaterBtrk.IsReady())
            {
                return(false);
            }

            bilgewaterBtrk.Cast(target);

            return(true);
        }
Beispiel #7
0
        public bool CastTiamatHydra()
        {
            var tiamatHydra = ItemUtil.GetItem(ItemId.Tiamat_Melee_Only);

            if (tiamatHydra.IsOwned() && tiamatHydra.IsReady())
            {
                tiamatHydra.Cast();
                return(true);
            }

            tiamatHydra = ItemUtil.GetItem(ItemId.Ravenous_Hydra_Melee_Only);

            if (!tiamatHydra.IsOwned() || !tiamatHydra.IsReady())
            {
                return(false);
            }

            tiamatHydra.Cast();

            return(true);
        }
Beispiel #8
0
        public override void Execute(ICommandContext context)
        {
            if (args.IsEmpty || (args.Length < 5 && src.IsConsole))
            {
                return(CommandResult.ShowUsage());
            }

            var     rawId     = args[0].ToString();
            var     rawAmount = args.Length >= 2 ? args[1].ToString() : "1";
            Vector3 pos;

            if (args.Length == 5)
            {
                var argPos = args.GetVector3(2);

                if (!argPos.HasValue)
                {
                    return(CommandResult.LangError("INVALID_COORDS", args[2], args[3], args[4]));
                }

                pos = argPos.Value;
            }
            else
            {
                pos = src.ToPlayer().Position;
            }

            if (!ushort.TryParse(rawAmount, out var amount))
            {
                return(CommandResult.LangError("INVALID_NUMBER", rawAmount));
            }

            var itemAsset = ItemUtil.GetItem(rawId);

            if (itemAsset.IsAbsent)
            {
                return(CommandResult.LangError("INVALID_ITEM_ID", rawId));
            }

            if (UEssentials.Config.GiveItemBlacklist.Contains(itemAsset.Value.id) &&
                !src.HasPermission("essentials.bypass.blacklist.item"))
            {
                return(CommandResult.LangError("BLACKLISTED_ITEM",
                                               $"{itemAsset.Value.itemName} ({itemAsset.Value.id})"));
            }

            var item = new Item(itemAsset.Value.id, true);

            if (itemAsset.Value is ItemFuelAsset)
            {
                ItemUtil.Refuel(item);
            }

            for (var i = 0; i < amount; i++)
            {
                ItemManager.dropItem(item, pos, true, true, true);
            }

            if (args.Length == 5)
            {
                context.User.SendLocalizedMessage(Translations, "SPAWNED_ITEM_AT", amount, itemAsset.Value.itemName, pos.x, pos.y, pos.z);
            }
            else
            {
                context.User.SendLocalizedMessage(Translations, "SPAWNED_ITEM", amount, itemAsset.Value.itemName);
            }

            return(CommandResult.Success());
        }
        public bool CastHextechGunBlade(Obj_AI_Base target)
        {
            if (target == null || !target.IsValidTarget() || target.IsStructure() || target.IsMinion())
            {
                return(false);
            }

            var Hextech = _itemUtil.GetItem(ItemId.Hextech_Gunblade, 700);

            if (Hextech.IsOwned() && Hextech.IsReady() && Hextech.IsInRange(target) && Hextech.Cast(target))
            {
                return(true);
            }

            return(false);
        }
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.Length < 2)
            {
                return(CommandResult.ShowUsage());
            }

            var kitManager = KitModule.Instance.KitManager;
            var kitName    = args[0].ToString();

            if (!kitManager.Contains(kitName))
            {
                return(CommandResult.Lang("KIT_NOT_EXIST", kitName));
            }

            var kit = kitManager.GetByName(kitName);

            switch (args[1].ToLowerString)
            {
            case "view":
                src.SendMessage($"Name: {kit.Name}");
                src.SendMessage($"Cooldown: {kit.Cooldown}");
                src.SendMessage($"Cost: {kit.Cost}");
                src.SendMessage($"ResetCooldownWhenDie: {kit.ResetCooldownWhenDie}");
                src.SendMessage(string.Empty);
                src.SendMessage("Items:");

                var index = 0;

                kit.Items.ForEach(i => {
                    src.SendMessage(i.ToString().Insert(0, $" [{(index++) + 1}] "));
                });
                break;

            /* ekit name additem normal id amount durability */
            case "additem":
                if (args.Length < 3)
                {
                    return(CommandResult.InvalidArgs("Use /ekit [kit] additem [type] [id] [amount] [durability]"));
                }

                byte durability = 100;
                byte amount     = 1;

                if (args.Length >= 5)
                {
                    if (!args[4].IsInt)
                    {
                        return(CommandResult.Lang("INVALID_NUMBER", args[4]));
                    }

                    var argAsInt = args[4].ToInt;

                    if (argAsInt < 0 || argAsInt > 255)
                    {
                        return(CommandResult.Lang("NEGATIVE_OR_LARGE"));
                    }

                    amount = (byte)args[4].ToInt;
                }

                if (args.Length >= 6)
                {
                    if (!args[5].IsInt)
                    {
                        return(CommandResult.Lang("INVALID_NUMBER", args[5]));
                    }

                    var argAsInt = args[5].ToInt;

                    if (argAsInt < 0 || argAsInt > 255)
                    {
                        return(CommandResult.Lang("NEGATIVE_OR_LARGE"));
                    }

                    durability = (byte)args[5].ToInt;
                }

                switch (args[2].ToLowerString)
                {
                case "normal":
                    if (args.Length < 4)
                    {
                        return(CommandResult.InvalidArgs("Use /ekit [kit] additem " +
                                                         "[type] [id] [amount] [durability]"));
                    }

                    var optAsset = ItemUtil.GetItem(args[3].ToString());

                    if (optAsset.IsAbsent)
                    {
                        return(CommandResult.Lang("INVALID_ITEM_ID_NAME", args[3]));
                    }

                    kit.Items.Add(new KitItem(optAsset.Value.id, durability, amount));
                    src.SendMessage($"Added Id: {optAsset.Value.id}, Amount: {amount}, " +
                                    $"Durability: {durability}");
                    break;

                case "vehicle":
                    if (args.Length != 4)
                    {
                        return(CommandResult.InvalidArgs("Use /ekit [kit] additem vehicle [id]"));
                    }

                    if (!args[3].IsInt)
                    {
                        return(CommandResult.Lang("INVALID_NUMBER", args[3]));
                    }

                    var argAsInt = args[3].ToInt;

                    if (argAsInt < 0 || argAsInt > ushort.MaxValue)
                    {
                        return(CommandResult.Lang("NEGATIVE_OR_LARGE"));
                    }

                    var vehicleAsset = Assets.find(EAssetType.VEHICLE, (ushort)argAsInt);

                    if (vehicleAsset == null)
                    {
                        return(CommandResult.Lang("INVALID_VEHICLE_ID", argAsInt));
                    }

                    kit.Items.Add(new KitItemVehicle((ushort)argAsInt));
                    src.SendMessage($"Added Vehicle item. Id: {argAsInt}");
                    break;

                case "xp":
                    if (args.Length != 4)
                    {
                        return(CommandResult.InvalidArgs("Use /ekit [kit] additem xp [amount]"));
                    }

                    if (!args[3].IsInt)
                    {
                        return(CommandResult.Lang("INVALID_NUMBER", args[3]));
                    }

                    if (args[3].ToInt < 0)
                    {
                        return(CommandResult.Lang("MUST_POSITIVE"));
                    }

                    kit.Items.Add(new KitItemExperience(args[3].ToUInt));
                    src.SendMessage($"Added Xp item. Amount: {amount}");
                    break;

                default:
                    return(CommandResult.Error("Invalid type '{args[2]}'. Valid types are: 'normal', 'vehicle' and 'xp'"));
                }
                break;

            /* ekit name delitem [itemindex] */
            case "delitem":
                if (args.Length != 3)
                {
                    src.SendMessage("Use '/ekit [kit] delitem [itemIndex]'");
                    src.SendMessage("Use '/ekit [kit] view' to view valid indexes.");

                    return(CommandResult.InvalidArgs());
                }

                if (!args[2].IsInt)
                {
                    return(CommandResult.Lang("INVALID_NUMBER", args[2]));
                }

                var argAsInt2 = args[2].ToInt;

                if (argAsInt2 <= 0)
                {
                    return(CommandResult.Lang("MUST_POSITIVE"));
                }

                /* 1 to kitItems.Count */
                if ((argAsInt2 - 1) > kit.Items.Count)
                {
                    src.SendMessage($"Invalid index, index must be between 1 and {kit.Items.Count}");
                    src.SendMessage("Use '/ekit [kit] view' to view valid indexes.");

                    return(CommandResult.InvalidArgs());
                }

                kit.Items.RemoveAt(argAsInt2 - 1);
                src.SendMessage($"Removed item at index {argAsInt2}");
                break;

            case "set":
                if (args.Length < 3)
                {
                    src.SendMessage("Use /ekit [kit] set [option] [value]");
                    src.SendMessage("nm  = Name");
                    src.SendMessage("cst = Cost");
                    src.SendMessage("cd  = Cooldown");
                    src.SendMessage("rwd = ResetCooldownWhenDie");

                    return(CommandResult.InvalidArgs());
                }

                switch (args[2].ToLowerString)
                {
                case "cost":
                case "cst":
                    if (!args[3].IsDouble)
                    {
                        return(CommandResult.Lang("INVALID_NUMBER", args[3]));
                    }

                    kit.Cost = (decimal)args[3].ToDouble;
                    src.SendMessage("Cost set to " + kit.Cost);
                    break;

                case "name":
                case "nm":
                    kit.Name = args[3].ToString();
                    src.SendMessage("Name set to " + kit.Name);
                    break;

                case "cooldown":
                case "cd":
                    if (!args[3].IsInt)
                    {
                        return(CommandResult.Lang("INVALID_NUMBER", args[3]));
                    }

                    if (args[3].ToInt < 0)
                    {
                        return(CommandResult.Lang("MUST_POSITIVE"));
                    }

                    kit.Cooldown = args[3].ToUInt;
                    src.SendMessage("Cooldown set to " + kit.Cooldown);
                    break;

                case "resetcooldownwhendie":
                case "rwd":
                    if (!args[3].IsBool)
                    {
                        return(CommandResult.Lang("INVALID_BOOLEAN", args[3]));
                    }

                    kit.ResetCooldownWhenDie = args[3].ToBool;
                    src.SendMessage("ResetCooldownWhenDie set to " + kit.ResetCooldownWhenDie);
                    break;

                default:
                    src.SendMessage("nm  = Name");
                    src.SendMessage("cd  = Cooldown");
                    src.SendMessage("cst = Cost");
                    src.SendMessage("rwd = ResetCooldownWhenDie");
                    return(CommandResult.InvalidArgs());
                }
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            kitManager.SaveKits();
            kitManager.LoadKits();

            return(CommandResult.Success());
        }
Beispiel #11
0
        private static void GiveItem(ICommandSource src, UPlayer target, ICommandArgument itemArg,
                                     ICommandArgument amountArg, bool allPlayers = false)
        {
            if (!src.HasPermission("essentials.command.item.other") && target != src)
            {
                EssLang.Send(src, "COMMAND_NO_PERMISSION");
                return;
            }

            var optAsset = ItemUtil.GetItem(itemArg.ToString());

            if (optAsset.IsAbsent)
            {
                EssLang.Send(src, "ITEM_NOT_FOUND", itemArg);
                return;
            }

            if (UEssentials.Config.GiveItemBlacklist.Contains(optAsset.Value.id) &&
                !src.HasPermission("essentials.bypass.blacklist.item"))
            {
                EssLang.Send(src, "BLACKLISTED_ITEM", $"{optAsset.Value.itemName} ({optAsset.Value.id})");
                return;
            }

            ushort amt = 1;

            if (amountArg != null)
            {
                if (!amountArg.IsShort)
                {
                    EssLang.Send(src, "INVALID_NUMBER", amountArg);
                }
                else if (amountArg.ToShort <= 0)
                {
                    EssLang.Send(src, "MUST_POSITIVE");
                }
                else
                {
                    amt = amountArg.ToUShort;
                    goto give;
                }
                return;
            }

give:
            var asset = optAsset.Value;
            var playersToReceive = new List <UPlayer>();
            var item             = new Item(asset.id, true);

            if (asset is ItemFuelAsset)
            {
                ItemUtil.Refuel(item);
            }

            if (!src.HasPermission("essentials.bypass.itemlimit") && amt > UEssentials.Config.ItemSpawnLimit)
            {
                amt = UEssentials.Config.ItemSpawnLimit;
                EssLang.Send(src, "ITEM_LIMIT", amt);
            }

            if (allPlayers)
            {
                UServer.Players.ForEach(playersToReceive.Add);
                EssLang.Send(src, "GIVEN_ITEM_ALL", amt, asset.itemName, asset.id);
            }
            else
            {
                playersToReceive.Add(target);

                if (!src.IsConsole && src.ToPlayer() == target)
                {
                    goto give2;
                }

                EssLang.Send(src, "GIVEN_ITEM", amt, asset.itemName, asset.id, target.CharacterName);
            }

give2:
            playersToReceive.ForEach(p => {
                var success = p.GiveItem(item, amt, true);

                EssLang.Send(p, "RECEIVED_ITEM", amt, asset.itemName, asset.id);

                if (!success)
                {
                    EssLang.Send(p, "INVENTORY_FULL");
                }
            });
        }
Beispiel #12
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.Length < 2)
            {
                src.SendMessage(UsageMessage);
                src.SendMessage("SubCommands' Usage:");
                src.SendMessage(" - additem [type(normal|vehicle|xp)] ...");
                src.SendMessage("  * To add a vehicle: additem vehicle [id]");
                src.SendMessage("  * To add a item: additem normal [id] [amount] [durability]");
                src.SendMessage("  * To add a xp: additem xp [amount]");
                src.SendMessage("  * To add a money: additem money [amount]");
                src.SendMessage(" - delitem [itemIndex]");
                src.SendMessage("  * Use '/ekit [kit] view' to list valid indexes.");
                src.SendMessage(" - set [option] [value]");
                src.SendMessage("  * Valid options:");
                src.SendMessage("   - nm = Name | Accepts a string");
                src.SendMessage("   - cst = Cost | Accepts a Number");
                src.SendMessage("   - cd  = Cooldown | Accepts a Number");
                src.SendMessage("   - rwd = ResetCooldownWhenDie | Accepts a Boolean (true or false)");
                return(CommandResult.InvalidArgs());
            }

            var kitManager = KitModule.Instance.KitManager;
            var kitName    = args[0].ToString();

            if (!kitManager.Contains(kitName))
            {
                return(CommandResult.LangError("KIT_NOT_EXIST", kitName));
            }

            var kit = kitManager.GetByName(kitName);

            switch (args[1].ToLowerString)
            {
            case "view":
                src.SendMessage($"Name: {kit.Name}");
                src.SendMessage($"Cooldown: {kit.Cooldown}");
                src.SendMessage($"Cost: {kit.Cost}");
                src.SendMessage($"ResetCooldownWhenDie: {kit.ResetCooldownWhenDie}");
                src.SendMessage(string.Empty);

                if (kit.Items.Count > 0)
                {
                    src.SendMessage("Items:");

                    var index = 0;
                    kit.Items.ForEach(item => src.SendMessage(item.ToString().Insert(0, $" [{(++index)}] ")));
                }
                else
                {
                    src.SendMessage("This kit has no items.");
                }
                return(CommandResult.Success());

            /* ekit name additem normal id amount durability */
            case "additem":
                if (args.Length < 3)
                {
                    return(CommandResult.InvalidArgs("Use /ekit [kit] additem [type] [id] [amount] [durability]"));
                }

                byte?durability = null;
                byte?amount     = null;

                // Try to convert 'amount'
                if (args.Length >= 5 && args[4].TryConvertToByte(out amount, out var error))
                {
                    return(error);
                }

                // Try to convert 'durability'
                if (args.Length >= 6 && args[5].TryConvertToByte(out durability, out error))
                {
                    return(error);
                }

                switch (args[2].ToLowerString)
                {
                case "normal":
                    if (args.Length < 4)
                    {
                        return(CommandResult.InvalidArgs("Use /ekit [kit] additem normal [id] [amount] [durability]"));
                    }

                    var optAsset = ItemUtil.GetItem(args[3].ToString());

                    if (optAsset.IsAbsent)
                    {
                        return(CommandResult.LangError("INVALID_ITEM_ID_NAME", args[3]));
                    }

                    kit.Items.Add(new KitItem(optAsset.Value.id, durability ?? 100, amount ?? 1));
                    src.SendMessage($"Added Id: {optAsset.Value.id}, Amount: {amount}, " +
                                    $"Durability: {durability}");
                    break;

                case "vehicle":
                    if (args.Length != 4)
                    {
                        return(CommandResult.InvalidArgs("Use /ekit [kit] additem vehicle [id]"));
                    }

                    if (!args[3].IsInt)
                    {
                        return(CommandResult.LangError("INVALID_NUMBER", args[3]));
                    }

                    var argAsInt = args[3].ToInt;

                    if (argAsInt < 0 || argAsInt > ushort.MaxValue)
                    {
                        return(CommandResult.LangError("NEGATIVE_OR_LARGE"));
                    }

                    var vehicleAsset = Assets.find(EAssetType.VEHICLE, (ushort)argAsInt);

                    if (vehicleAsset == null)
                    {
                        return(CommandResult.LangError("INVALID_VEHICLE_ID", argAsInt));
                    }

                    kit.Items.Add(new KitItemVehicle((ushort)argAsInt));
                    src.SendMessage($"Added Vehicle item. Id: {argAsInt}");
                    break;

                case "money":
                    if (args.Length != 4)
                    {
                        return(CommandResult.InvalidArgs("Use /ekit [kit] additem money [amount]"));
                    }

                    if (!args[3].IsInt)
                    {
                        return(CommandResult.LangError("INVALID_NUMBER", args[3]));
                    }

                    if (args[3].ToInt < 0)
                    {
                        return(CommandResult.LangError("MUST_POSITIVE"));
                    }

                    var moneyAmount = args[3].ToUInt;
                    kit.Items.Add(new KitItemMoney(moneyAmount));
                    src.SendMessage($"Added money item. Amount: {moneyAmount}");
                    break;

                case "xp":
                    if (args.Length != 4)
                    {
                        return(CommandResult.InvalidArgs("Use /ekit [kit] additem xp [amount]"));
                    }

                    if (!args[3].IsInt)
                    {
                        return(CommandResult.LangError("INVALID_NUMBER", args[3]));
                    }

                    if (args[3].ToInt < 0)
                    {
                        return(CommandResult.LangError("MUST_POSITIVE"));
                    }

                    var expAmount = args[3].ToUInt;

                    kit.Items.Add(new KitItemExperience(expAmount));
                    src.SendMessage($"Added Xp item. Experience Amount: {expAmount}");
                    break;

                default:
                    return(CommandResult.Error($"Invalid type '{args[2]}'. Valid types are: 'normal', 'money', 'vehicle' and 'xp'"));
                }
                break;

            /* ekit name delitem [itemindex] */
            case "delitem":
                if (args.Length != 3)
                {
                    src.SendMessage("Use '/ekit [kit] delitem [itemIndex]'");
                    src.SendMessage("Use '/ekit [kit] view' to view valid indexes.");

                    return(CommandResult.InvalidArgs());
                }

                if (!args[2].IsInt)
                {
                    return(CommandResult.LangError("INVALID_NUMBER", args[2]));
                }

                var argAsInt2 = args[2].ToInt;

                if (argAsInt2 <= 0)
                {
                    return(CommandResult.LangError("MUST_POSITIVE"));
                }

                /* 1 to kitItems.Count */
                if ((argAsInt2 - 1) > kit.Items.Count)
                {
                    src.SendMessage($"Invalid index, index must be between 1 and {kit.Items.Count}");
                    src.SendMessage("Use '/ekit [kit] view' to view valid indexes.");

                    return(CommandResult.InvalidArgs());
                }

                kit.Items.RemoveAt(argAsInt2 - 1);
                src.SendMessage($"Removed item at index {argAsInt2}");
                break;

            case "set":
                if (args.Length < 3)
                {
                    src.SendMessage("Use /ekit [kit] set [option] [value]");
                    src.SendMessage("nm  = Name");
                    src.SendMessage("cst = Cost");
                    src.SendMessage("cd  = Cooldown");
                    src.SendMessage("rwd = ResetCooldownWhenDie");

                    return(CommandResult.InvalidArgs());
                }

                switch (args[2].ToLowerString)
                {
                case "cost":
                case "cst":
                    if (!args[3].IsDouble)
                    {
                        return(CommandResult.LangError("INVALID_NUMBER", args[3]));
                    }

                    kit.Cost = (decimal)args[3].ToDouble;
                    src.SendMessage("Cost set to " + kit.Cost);
                    break;

                case "name":
                case "nm":
                    kit.Name = args[3].ToString();
                    src.SendMessage("Name set to " + kit.Name);
                    break;

                case "cooldown":
                case "cd":
                    if (!args[3].IsInt)
                    {
                        return(CommandResult.LangError("INVALID_NUMBER", args[3]));
                    }

                    if (args[3].ToInt < 0)
                    {
                        return(CommandResult.LangError("MUST_POSITIVE"));
                    }

                    kit.Cooldown = args[3].ToUInt;
                    src.SendMessage("Cooldown set to " + kit.Cooldown);
                    break;

                case "resetcooldownwhendie":
                case "rwd":
                    if (!args[3].IsBool)
                    {
                        return(CommandResult.LangError("INVALID_BOOLEAN", args[3]));
                    }

                    kit.ResetCooldownWhenDie = args[3].ToBool;
                    src.SendMessage("ResetCooldownWhenDie set to " + kit.ResetCooldownWhenDie);
                    break;

                default:
                    src.SendMessage("nm  = Name");
                    src.SendMessage("cd  = Cooldown");
                    src.SendMessage("cst = Cost");
                    src.SendMessage("rwd = ResetCooldownWhenDie");
                    return(CommandResult.InvalidArgs());
                }
                break;

            default:
                return(CommandResult.ShowUsage());
            }

            kitManager.SaveKits();
            kitManager.LoadKits();

            return(CommandResult.Success());
        }
Beispiel #13
0
        void InitVariables()
        {
            _itemUtil = new ItemUtil();

            #region Summoners

            flash = SpellsUtil.GetSkillshotSpell(SpellsUtil.Summoners.Flash);

            ignite  = SpellsUtil.GetTargettedSpell(SpellsUtil.Summoners.Ignite);
            exhaust = SpellsUtil.GetTargettedSpell(SpellsUtil.Summoners.Exhaust);
            smite   = SpellsUtil.GetTargettedSpell(SpellsUtil.Summoners.Smite);

            heal    = SpellsUtil.GetActiveSpell(SpellsUtil.Summoners.Heal);
            barrier = SpellsUtil.GetActiveSpell(SpellsUtil.Summoners.Barrier);
            ghost   = SpellsUtil.GetActiveSpell(SpellsUtil.Summoners.Ghost);
            cleanse = SpellsUtil.GetActiveSpell(SpellsUtil.Summoners.Cleanse);

            #endregion

            #region Offensives

            hextech    = _itemUtil.GetItem(ItemId.Hextech_Gunblade, 700);
            botrk      = _itemUtil.GetItem(ItemId.Blade_of_the_Ruined_King, 550);
            bilgewater = _itemUtil.GetItem(ItemId.Bilgewater_Cutlass, 550);
            tiamat     = _itemUtil.GetItem(ItemId.Tiamat_Melee_Only, 325);         //range = 400
            hydra      = _itemUtil.GetItem(ItemId.Ravenous_Hydra_Melee_Only, 325); //range = 400
            titanic    = _itemUtil.GetItem(3053, 75);                              //range = 150
            youmuus    = _itemUtil.GetItem(ItemId.Youmuus_Ghostblade);

            #endregion

            #region Defensives

            faceMountain = _itemUtil.GetItem(ItemId.Face_of_the_Mountain, 600);
            mikael       = _itemUtil.GetItem(ItemId.Mikaels_Crucible, 600);
            solari       = _itemUtil.GetItem(ItemId.Locket_of_the_Iron_Solari, 600);
            randuin      = _itemUtil.GetItem(ItemId.Randuins_Omen, 450);//range = 500
            scimitar     = _itemUtil.GetItem(ItemId.Mercurial_Scimitar);
            qss          = _itemUtil.GetItem(ItemId.Quicksilver_Sash);
            seraph       = _itemUtil.GetItem(3040);
            zhonya       = _itemUtil.GetItem(ItemId.Zhonyas_Hourglass);

            #endregion

            #region Speed

            talisma        = _itemUtil.GetItem(ItemId.Talisman_of_Ascension);
            righteousGlory = _itemUtil.GetItem(ItemId.Righteous_Glory, 600);

            #endregion

            #region Potions

            healthPotion     = _itemUtil.GetItem(ItemId.Health_Potion);
            biscuitPotion    = _itemUtil.GetItem(2010);
            corruptingPotion = _itemUtil.GetItem(2033);
            huntersPotion    = _itemUtil.GetItem(2032);
            refillablePotion = _itemUtil.GetItem(2031);

            #endregion

            _itens     = new ItemController();
            _summoners = new SummonersController();
        }
Beispiel #14
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty || (args.Length < 5 && src.IsConsole))
            {
                return(CommandResult.ShowUsage());
            }

            var     rawId     = args[0].ToString();
            var     rawAmount = args.Length >= 2 ? args[1].ToString() : "1";
            Vector3 pos;

            if (args.Length == 5)
            {
                var argPos = args.GetVector3(2);

                if (!argPos.HasValue)
                {
                    return(CommandResult.Lang(EssLang.INVALID_COORDS, args[2], args[3], args[4]));
                }

                pos = argPos.Value;
            }
            else
            {
                pos = src.ToPlayer().Position;
            }

            ushort amount;

            if (!ushort.TryParse(rawAmount, out amount))
            {
                return(CommandResult.Lang(EssLang.INVALID_NUMBER, rawAmount));
            }

            var itemAsset = ItemUtil.GetItem(rawId);

            if (itemAsset.IsAbsent)
            {
                return(CommandResult.Lang(EssLang.INVALID_ITEM_ID, rawId));
            }

            var item = new Item(itemAsset.Value.id, true);

            if (itemAsset.Value is ItemFuelAsset)
            {
                item.Metadata[0] = 1;
            }

            for (var i = 0; i < amount; i++)
            {
                ItemManager.dropItem(item, pos, true, true, true);
            }

            if (args.Length == 5)
            {
                EssLang.SPAWNED_ITEM_AT.SendTo(src, amount, itemAsset.Value.Name, pos.x, pos.y, pos.z);
            }
            else
            {
                EssLang.SPAWNED_ITEM.SendTo(src, amount, itemAsset.Value.Name);
            }

            return(CommandResult.Success());
        }
Beispiel #15
0
        public override CommandResult OnExecute(ICommandSource src, ICommandArgs args)
        {
            if (args.IsEmpty || (args.Length < 5 && src.IsConsole))
            {
                return(CommandResult.ShowUsage());
            }

            var     rawId     = args[0].ToString();
            var     rawAmount = args.Length >= 2 ? args[1].ToString() : "1";
            Vector3 pos;

            if (args.Length == 5)
            {
                var argPos = args.GetVector3(2);

                if (!argPos.HasValue)
                {
                    return(CommandResult.Lang("INVALID_COORDS", args[2], args[3], args[4]));
                }

                pos = argPos.Value;
            }
            else
            {
                pos = src.ToPlayer().Position;
            }

            ushort amount;

            if (!ushort.TryParse(rawAmount, out amount))
            {
                return(CommandResult.Lang("INVALID_NUMBER", rawAmount));
            }

            var itemAsset = ItemUtil.GetItem(rawId);

            if (itemAsset.IsAbsent)
            {
                return(CommandResult.Lang("INVALID_ITEM_ID", rawId));
            }

            if (UEssentials.Config.GiveItemBlacklist.Contains(itemAsset.Value.id) &&
                !src.HasPermission("essentials.bypass.blacklist.item"))
            {
                return(CommandResult.Lang("BLACKLISTED_ITEM", $"{itemAsset.Value.itemName} ({itemAsset.Value.Id})"));
            }

            var item = new Item(itemAsset.Value.id, true);

            if (item.id == 28)   // Gas can
            {
                item.Metadata[0] = 244;
                item.Metadata[1] = 1;
            }

            for (var i = 0; i < amount; i++)
            {
                ItemManager.dropItem(item, pos, true, true, true);
            }

            if (args.Length == 5)
            {
                EssLang.Send(src, "SPAWNED_ITEM_AT", amount, itemAsset.Value.Name, pos.x, pos.y, pos.z);
            }
            else
            {
                EssLang.Send(src, "SPAWNED_ITEM", amount, itemAsset.Value.Name);
            }

            return(CommandResult.Success());
        }
Beispiel #16
0
        /*
         * Wards
         * _wardingTotem, _stealthWard, VisionWard _pinkWard, _sightstone, _rubySightstone,
         * _tracersKnife, _eyeWatchers, _eyeOasis, _eyeEquinox,
         */

        public ItemManager()
        {
            //Initializing all items

            _itemUtil = new ItemUtil();

            #region Offensives

            hextech    = _itemUtil.GetItem(ItemId.Hextech_Gunblade, 700);
            botrk      = _itemUtil.GetItem(ItemId.Blade_of_the_Ruined_King, 550);
            bilgewater = _itemUtil.GetItem(ItemId.Bilgewater_Cutlass, 550);
            tiamat     = _itemUtil.GetItem(ItemId.Tiamat_Melee_Only, 325);         //range = 400
            hydra      = _itemUtil.GetItem(ItemId.Ravenous_Hydra_Melee_Only, 325); //range = 400
            titanic    = _itemUtil.GetItem(ItemId.Titanic_Hydra, 100);             //range = 150
            youmuus    = _itemUtil.GetItem(ItemId.Youmuus_Ghostblade);

            #endregion

            #region Defensives

            faceMountain = _itemUtil.GetItem(ItemId.Face_of_the_Mountain, 600);
            mikael       = _itemUtil.GetItem(ItemId.Mikaels_Crucible, 600);
            solari       = _itemUtil.GetItem(ItemId.Locket_of_the_Iron_Solari, 600);
            randuin      = _itemUtil.GetItem(ItemId.Randuins_Omen, 450);//range = 500
            scimitar     = _itemUtil.GetItem(ItemId.Mercurial_Scimitar);
            qss          = _itemUtil.GetItem(ItemId.Quicksilver_Sash);
            seraph       = _itemUtil.GetItem(3040);
            zhonya       = _itemUtil.GetItem(ItemId.Zhonyas_Hourglass);

            #endregion

            #region Speed

            talisma        = _itemUtil.GetItem(ItemId.Talisman_of_Ascension);
            righteousGlory = _itemUtil.GetItem(ItemId.Righteous_Glory, 600);

            #endregion

            #region Potions

            healthPotion     = _itemUtil.GetItem(ItemId.Health_Potion);
            biscuitPotion    = _itemUtil.GetItem(2010);
            corruptingPotion = _itemUtil.GetItem(2033);
            huntersPotion    = _itemUtil.GetItem(2032);
            refillablePotion = _itemUtil.GetItem(2031);

            #endregion
        }