Esempio n. 1
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            ushort ammoAmountToSpawn = (ushort)0;
            bool   EnteredAmount     = false;

            SDG.Unturned.ItemGunAsset currentWeapon;
            SDG.Unturned.ItemAsset    currentEquiped;
            UnturnedPlayer            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 != SDG.Unturned.EItemType.GUN)
            {
                UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("no_gun_equipped"));
                return;
            }

            //UnturnedChat.Say(caller, " your current equipped item is \" id: " + currentEquiped + " / " + "name: " + currentEquiped.name);
            //UnturnedChat.Say(caller, "item type: " + item.GetType().ToString());

            currentWeapon = (SDG.Unturned.ItemGunAsset)currentEquiped;
            if (currentWeapon == null)
            {
                UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("gun_asset_not_found"));
                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((ushort)1, caller, currentWeapon, Uplayer, command);
            }
        }
Esempio n. 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("------------------------------------");
        }