public ushort GetMagId(UnturnedPlayer player, SDG.Unturned.ItemGunAsset gun, string[] command) { ushort magId = 0; if (command.Length == 2 || command.Length == 1) { if (command.Length == 1) { if (command[0].ToLower() == "c") { magId = player.Player.equipment.state[8]; } } else if (command.Length == 2) { if (command[1].ToLower() == "c") { magId = player.Player.equipment.state[8]; } } } if (magId == 0 || UnturnedItems.GetItemAssetById(magId).type != EItemType.MAGAZINE) { magId = gun.getMagazineID(); } return(magId); }
public void DropMags(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command) { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("dropping_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).name, GetMagId(Uplayer, currentWeapon, command).ToString())); for (int ii = 0; ii < (int)ammoAmountToSpawn; ii++) { ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true); } }
public void SpawnMags(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command) { if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn)) { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("giving_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).name, GetMagId(Uplayer, currentWeapon, command).ToString())); } else { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags")); } }
public decimal GetCost(bool Negative, int amount, SDG.Unturned.ItemGunAsset gun, SDG.Unturned.ItemMagazineAsset magazine) { decimal cost; if (EasyAmmo.Instance.Configuration.Instance.ScaleCostByWeaponDamage) { cost = (decimal)(gun.playerDamageMultiplier.damage * amount) * EasyAmmo.Instance.Configuration.Instance.WeaponDamageCostMultiplier; } else { cost = (decimal)(magazine.amount * amount) * EasyAmmo.Instance.Configuration.Instance.PerBulletCostMultiplier; } if (Negative) { cost = -cost; } //Logger.Log(cost.ToString()); return(cost); }
public override void grantReward(Player player, bool shouldSend) { if (!Provider.isServer) { return; } Item item; if (this.sight > 0 || this.tactical > 0 || this.grip > 0 || this.barrel > 0 || this.magazine > 0) { ItemGunAsset itemGunAsset = Assets.find(EAssetType.ITEM, this.id) as ItemGunAsset; byte[] state = itemGunAsset.getState((this.sight <= 0) ? itemGunAsset.sightID : this.sight, (this.tactical <= 0) ? itemGunAsset.tacticalID : this.tactical, (this.grip <= 0) ? itemGunAsset.gripID : this.grip, (this.barrel <= 0) ? itemGunAsset.barrelID : this.barrel, (this.magazine <= 0) ? itemGunAsset.getMagazineID() : this.magazine, (this.ammo <= 0) ? itemGunAsset.ammoMax : this.ammo); item = new Item(this.id, 1, 100, state); } else { item = new Item(this.id, EItemOrigin.CRAFT); } for (byte b = 0; b < this.amount; b += 1) { player.inventory.forceAddItem(item, false, false); } }
public void SpawnMagsWithLimit_Uconomy(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command) { int costMultiplier = EasyAmmo.Instance.Configuration.Instance.PerBulletCostMultiplier; SDG.Unturned.ItemMagazineAsset magazine = (SDG.Unturned.ItemMagazineAsset)UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)); if (ammoAmountToSpawn <= (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit || caller.HasPermission("easyammo.bypasslimit")) { if (Uconomy.Instance.Database.GetBalance(caller.Id) >= GetCost(false, ammoAmountToSpawn, currentWeapon, magazine)) { if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn)) { Uconomy.Instance.Database.IncreaseBalance(caller.Id, GetCost(true, ammoAmountToSpawn, currentWeapon, magazine)); UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("giving_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).name, GetMagId(Uplayer, currentWeapon, command).ToString())); UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("balance", Uconomy.Instance.Database.GetBalance(caller.Id))); } else { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags")); } } else { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("not_enough_funds", Uconomy.Instance.Configuration.Instance.MoneyName, ammoAmountToSpawn, magazine.itemName, GetCost(false, ammoAmountToSpawn, currentWeapon, magazine).ToString())); } } else { ushort amountoverlimit = ammoAmountToSpawn; ammoAmountToSpawn = (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit; if (Uconomy.Instance.Database.GetBalance(caller.Id) >= GetCost(false, ammoAmountToSpawn, currentWeapon, magazine)) { if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn)) { Uconomy.Instance.Database.IncreaseBalance(caller.Id, GetCost(true, ammoAmountToSpawn, currentWeapon, magazine)); UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("over_clip_spawn_limit_giving", amountoverlimit.ToString(), EasyAmmo.Instance.Configuration.Instance.ClipLimit, UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).name, GetMagId(Uplayer, currentWeapon, command).ToString())); UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("balance", Uconomy.Instance.Database.GetBalance(caller.Id))); } else { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags")); } } else { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("not_enough_funds", Uconomy.Instance.Configuration.Instance.MoneyName, ammoAmountToSpawn, magazine.itemName, GetCost(false, ammoAmountToSpawn, currentWeapon, magazine).ToString())); } } }
public void SpawnMagsWithLimit(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command) { if (ammoAmountToSpawn <= (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit || caller.HasPermission("easyammo.bypasslimit")) { if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn)) { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("giving_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).name, GetMagId(Uplayer, currentWeapon, command).ToString())); } else { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags")); } } else { ushort amountoverlimit = ammoAmountToSpawn; ammoAmountToSpawn = (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit; if (Uplayer.GiveItem(GetMagId(Uplayer, currentWeapon, command), (byte)ammoAmountToSpawn)) { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("over_clip_spawn_limit_giving", amountoverlimit.ToString(), EasyAmmo.Instance.Configuration.Instance.ClipLimit, UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).name, GetMagId(Uplayer, currentWeapon, command).ToString())); } else { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("failed_to_spawn_mags")); } } }
// Token: 0x060018F3 RID: 6387 RVA: 0x0008BC36 File Offset: 0x0008A036 public void updateGun(ItemGunAsset newGunAsset, SkinAsset newSkinAsset) { this._gunAsset = newGunAsset; this._skinAsset = newSkinAsset; }
public void DropMagsWithLimit(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer, string[] command) { if (ammoAmountToSpawn <= (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit || caller.HasPermission("easyammo.bypasslimit")) { UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("dropping_mags", ammoAmountToSpawn.ToString(), UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).name, GetMagId(Uplayer, currentWeapon, command).ToString())); for (int ii = 0; ii < (int)ammoAmountToSpawn; ii++) { ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true); } } else { UnturnedItems.GetItemAssetById(1); ushort amountoverlimit = ammoAmountToSpawn; ammoAmountToSpawn = (ushort)EasyAmmo.Instance.Configuration.Instance.ClipLimit; UnturnedChat.Say(caller, EasyAmmo.Instance.Translate("over_clip_spawn_limit_dropping", amountoverlimit.ToString(), EasyAmmo.Instance.Configuration.Instance.ClipLimit, UnturnedItems.GetItemAssetById(GetMagId(Uplayer, currentWeapon, command)).name, GetMagId(Uplayer, currentWeapon, command).ToString())); for (int ii = 0; ii < (int)ammoAmountToSpawn; ii++) { ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true); } } }