#library "UACEliteOfficerScripts.acs"
#include "zcommon.acs"
#import "CustomFunctions.acs"
#import "PickupScripts.acs"

Script "UACEliteOfficerClass_AmmoPickupSystem" (void)
{  
   int plr = PlayerNumber();

  SetInventory("PickedUp", 0);
 
  int multiplyammo;
  multiplyammo = 1;
  if((GameSkill() == 4) || (GetCVAR("sv_doubleammo") == 1))
  multiplyammo = 2;

  
     switch(ammonumbersave[plr])
  {
  
   case 1: //Clip
   if((CheckInventory("GD9MMAmmo")) == (GetAmmoCapacity("GD9MMAmmo"))&& (CheckInventory("GDMinigunAmmo")) == (GetAmmoCapacity("GDMinigunAmmo"))) { terminate; }
	   GiveInventory("GD9MMAmmo", 10*ammomultiplysave[plr]/ammodividesave[plr]);
	   GiveInventory("GDMinigunAmmo", 10*ammomultiplysave[plr]/ammodividesave[plr]);
   message[plr] = strparam(s:"9MM Ammo +", i:((10*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo), s:" & Minigun Ammo  +", i:((10*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   case 2: //Shell
   if((CheckInventory("GDBuckshot")) == (GetAmmoCapacity("GDBuckshot"))) { terminate; }
	   GiveInventory("GDBuckshot", 2*ammomultiplysave[plr]/ammodividesave[plr]);
   message[plr] = strparam(s:"Heavy Buckshot Shells +", i:((2*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   case 3: //Rocket
   if((CheckInventory("GDMissiles")) == (GetAmmoCapacity("GDMissiles"))) { terminate; }
	   GiveInventory("GDMissiles", 1*ammomultiplysave[plr]/ammodividesave[plr]);
   message[plr] = strparam(s:"HEAT Missiles +", i:((1*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
  case 4: //Cell 
   if((CheckInventory("GDAutoShells")) == (GetAmmoCapacity("GDAutoShells")) && (CheckInventory("GDBFGEnergyCells")) == (GetAmmoCapacity("GDBFGEnergyCells"))) { terminate; }
   GiveInventory("GDAutoShells", 20*ammomultiplysave[plr]/ammodividesave[plr]);
   GiveInventory("GDBFGEnergyCells", 20*ammomultiplysave[plr]/ammodividesave[plr]);
   message[plr] = strparam(s:"AutoShells +", i:((20*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo), s:" & Prototype Energy Cells +", i:((20*ammomultiplysave[plr]/ammodividesave[plr])*multiplyammo));
   break;
   }
   GiveInventory("PickupBlend", 1);
   PlaySound(0, "AMMO", 4);
   ACS_NamedExecuteWithResult("PostLog", 0, 0, 0, 0);
}

Script "UACEliteOfficerClass_PistolStart" (void)
{ 
	TakeInventory("GD2Chainsaw", 1);
	TakeInventory("GD2Shotgun", 1);
	TakeInventory("GD2SuperShotgun",1);
	TakeInventory("GDBuckshot", 0);
	TakeInventory("GD2DoubleChaingun", 1);
	TakeInventory("GDDualPistols", 1);
	GiveInventory("GD2Pistol", 1);
	GiveInventory("GD2Chaingun", 1);
	SetInventory("GD9MMAmmo",100);
	SetInventory("GDMinigunAmmo",250);
	TakeInventory("GD2RocketLauncher", 1);
	TakeInventory("GDMissiles", 0);
	TakeInventory("GD2ImprovedShotgun", 1);
	TakeInventory("GDAutoShells", 0);
	TakeInventory("GD2BFG9000", 1);
	TakeInventory("GDBFGEnergyCells", 0);
}

Script "UACEliteOfficerClass_PickupSystem" (void)
{ 
   
   int plr = PlayerNumber();
   
   GiveInventory("PickupBlend", 1);
   PlaySound(0, "DSWPNUP", 4);
   
     switch(weaponnumbersave[plr])
  {
   case 1: GiveInventory("GD2Chainsaw", 1);  print(s:"\cfGot the Heavy Chainsaw! This thing is better than the normal Chainsaw!"); ; SetInventory("HasChainsaw", 1); break;
   case 2: GiveInventory("GD2Shotgun", 1);  print(s:"\cfGot the Heavy Shotgun! A hard hitter of a shotgun!"); SetInventory("HasShotgun", 1); break;
   case 3: GiveInventory("GD2SuperShotgun",1); print(s:"\cfGot the Heavy Double Shotgun! It's slow, but it hits hard!");  SetInventory("HasSuperShotgun", 1); break;
   case 4: GiveInventory("GD2DoubleChaingun",1); GiveInventory("GDDualPistols",1); Takeinventory("GD2Chaingun",1); Takeinventory("GD2Pistol",1);  print(s:"\cfGot an extra handgun and minigun! Double the killing power!"); SetInventory("HasChaingun", 1); break;
   case 5: GiveInventory("GD2RocketLauncher", 1);  print(s:"\cfGot the HEAT Missile Launcher! The explosives can even damage Cyberdemons!"); SetInventory("HasRocketLauncher", 1); break;
   case 6: GiveInventory("GD2ImprovedShotgun", 1); print(s:"\cfGot the Automatic Shotgun! The perfect weapon for killing hordes of demons!"); SetInventory("HasPlasmaRifle", 1); break;
   case 7: GiveInventory("GD2BFG9000", 1); print(s:"\cfGot the Protoype BFG Type X! A devastating explosive weapon!"); SetInventory("HasBFG9000", 1); break;
   }
   
}