public void Execute(IRocketPlayer caller, string[] command)
        {
            ushort    ammoAmountToSpawn = 0;
            bool      enteredAmount     = false;
            ItemAsset currentEquiped;
            var       uPlayer = (UnturnedPlayer)caller;

            if (command.Length >= 1)
            {
                if (ushort.TryParse(command[0], out ammoAmountToSpawn))
                {
                    enteredAmount = true;
                }
            }

            currentEquiped = uPlayer.Player.equipment.asset;
            if (currentEquiped == null)
            {
                UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("nothing_equipped"));
                return;
            }

            if (currentEquiped.type != EItemType.GUN)
            {
                UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("no_gun_equipped"));
                return;
            }

            //debug prints
            //UnturnedChat.Say(caller, " your current equipped item is \" id: " + currentEquiped + " / " + "name: " + currentEquiped.name);
            //UnturnedChat.Say(caller, "item type: " + item.GetType().ToString());
            if (!(currentEquiped is ItemGunAsset currentWeapon))
            {
                return;
            }

            if (EasyAmmo.CheckIfBlacklisted(caller, currentWeapon))
            {
                return;
            }

            if (enteredAmount && caller.HasPermission("dropammo.amount"))
            {
                if (EasyAmmo.Instance.Configuration.Instance.ClipLimitEnabled)
                {
                    DropMagsWithLimit(ammoAmountToSpawn, caller, currentWeapon, uPlayer, command);
                }
                else
                {
                    DropMags(ammoAmountToSpawn, caller, currentWeapon, uPlayer, command);
                }
            }
            else
            {
                DropMags(ammoAmountToSpawn: 1, caller, currentWeapon, uPlayer, command);
            }
        }
示例#2
0
        protected override void Load()
        {
            Instance = this;

            Logger.LogWarning("--------------EasyAmmo--------------");
            Logger.Log("EasyAmmo loaded!");
            Logger.Log("ClipLimitEnabled : " + Instance.Configuration.Instance.ClipLimitEnabled);
            Logger.Log("ClipLimit : " + Instance.Configuration.Instance.ClipLimit.ToString());
            Logger.Log("UconomySupportEnabled : " + Instance.Configuration.Instance.UconomySupportEnabled.ToString());
            Logger.Log("BulletCostMultiplier : " + Instance.Configuration.Instance.PerBulletCostMultiplier);
            Logger.Log(
                "ScaleCostByWeaponDamage : " + Instance.Configuration.Instance.ScaleCostByWeaponDamage.ToString());
            Logger.Log("WeaponDamageCostMultiplier : " +
                       Instance.Configuration.Instance.WeaponDamageCostMultiplier.ToString());
            Logger.LogWarning("------------------------------------");
        }