Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
opps... forgot to update CommandDropAmmo.cs
  • Loading branch information
sharkbound committed Jul 6, 2016
1 parent 385cf0f commit cfb2b04
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions CommandDropAmmo.cs
Expand Up @@ -71,16 +71,16 @@ public void Execute(IRocketPlayer caller, string[] command)
{
if (EasyAmmo.Instance.Configuration.Instance.ClipLimitEnabled)
{
DropMagsWithLimit(ammoAmountToSpawn, caller, currentWeapon, Uplayer);
DropMagsWithLimit(ammoAmountToSpawn, caller, currentWeapon, Uplayer, command);
}
else
{
DropMags(ammoAmountToSpawn, caller, currentWeapon, Uplayer);
DropMags(ammoAmountToSpawn, caller, currentWeapon, Uplayer, command);
}
}
else
{
DropMags((ushort)1, caller, currentWeapon, Uplayer);
DropMags((ushort)1, caller, currentWeapon, Uplayer, command);
}
}

Expand All @@ -104,25 +104,25 @@ public string Syntax
get { return "(amount of ammo)"; }
}

public void DropMags(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer)
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)).Name, GetMagId(Uplayer, currentWeapon).ToString()));
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 (currentWeapon.magazineID, true), Uplayer.Position, true, true, true);
}
}

public void DropMagsWithLimit(ushort ammoAmountToSpawn, IRocketPlayer caller, SDG.Unturned.ItemGunAsset currentWeapon, UnturnedPlayer Uplayer)
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)).Name, GetMagId(Uplayer, currentWeapon).ToString()));
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), true), Uplayer.Position, true, true, true);
ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true);
}
}
else
Expand All @@ -131,19 +131,38 @@ public void DropMagsWithLimit(ushort ammoAmountToSpawn, IRocketPlayer caller, SD
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)).Name, GetMagId(Uplayer, currentWeapon).ToString()));
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), true), Uplayer.Position, true, true, true);
ItemManager.dropItem(new Item(GetMagId(Uplayer, currentWeapon, command), true), Uplayer.Position, true, true, true);
}

}
}

public ushort GetMagId(UnturnedPlayer player, SDG.Unturned.ItemGunAsset gun)
public ushort GetMagId(UnturnedPlayer player, SDG.Unturned.ItemGunAsset gun, string[] command)
{
ushort magId = player.Player.equipment.state[8];
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.magazineID;
Expand Down

0 comments on commit cfb2b04

Please sign in to comment.