// This is a client download and should be used with the Havoc mod to reflect
// the true status of a vehicle.  It assigns keys for ejection seats and
// for switching bomb load types.  It also has the weapons reticles for the
// new weapons

$HavocClientVersion = 1.07;

//--------------------------------------------------------------------------
// This asks for the server to change the server password
function ChangePassword(%Password)
{
   commandToServer('ChangePassword', %Password);
}

// This asks for the server to send back in the message HUD the server password
function GetPassword(%Password)
{
   commandToServer('GetPassword', %Password);
}

function SuperSAD(%Password)
{
   commandToServer('SuperSAD', %Password);
}

function MasterSAD(%Password)
{
   commandToServer('MasterSAD', %Password);
}

function clientCmdGetSettings()
{
   exec("Prefs/HavocClientPrefs.cs");

   // If not defined, then we do that now
   if ($ClientSetting::Help $= "")
      $ClientSetting::Help = true;

   if ($ClientSetting::VehicleChat $= "")
      $ClientSetting::VehicleChat = false;

   if ($ClientSetting::ChooseTeleport $= "")
      $ClientSetting::ChooseTeleport = 1;

   commandToServer('SetClientHelp', $ClientSetting::Help);
   commandToServer('SetVehicleChat', $ClientSetting::VehicleChat);
   commandToServer('SetChooseTeleport', $ClientSetting::ChooseTeleport);

   SaveHavocClientSettings();
}

function SaveHavocClientSettings()
{
   export("$ClientSetting::*", "prefs/havocclientprefs.cs", false);
}

function clientCmdGetClientVersion()
{
   commandToServer('ClientVersion', $HavocClientVersion);
}

function clientCmdSetHelp(%OnOff)
{
   // Set the Help as on or off
   $ClientSetting::Help = %OnOff;

   // Save this as the preference
   SaveHavocClientSettings();
}

function clientCmdSetVehicleChat(%OnOff)
{
   // Set the Help as on or off
   $ClientSetting::VehicleChat = %OnOff;

   // Save this as the preference
   SaveHavocClientSettings();
}

function clientCmdSetChooseTeleport(%OnOff)
{
   // Set the Help as on or off
   $ClientSetting::ChooseTeleport = %OnOff;

   // Save this as the preference
   SaveHavocClientSettings();
}

function clientCmdSetWeaponsHudActive(%slot)
{
   weaponsHud.setActiveWeapon(%slot);
   switch$($WeaponNames[%slot])
   {
      case "Blaster":
         reticleHud.setBitmap("gui/ret_blaster");
         reticleFrameHud.setVisible(true);
      case "Plasma":
         reticleHud.setBitmap("gui/ret_plasma");
         reticleFrameHud.setVisible(true);
      case "Chaingun":
         reticleHud.setBitmap("gui/ret_chaingun");
         reticleFrameHud.setVisible(true);
      case "Disc":  
         reticleHud.setBitmap("gui/ret_disc");
         reticleFrameHud.setVisible(true);
      case "GrenadeLauncher":
         reticleHud.setBitmap("gui/ret_grenade");
         reticleFrameHud.setVisible(true);
      case "SniperRifle":
         reticleHud.setBitmap("gui/hud_ret_sniper");
         reticleFrameHud.setVisible(false);
      case "ELFGun":
         reticleHud.setBitmap("gui/ret_elf");
         reticleFrameHud.setVisible(true);
      case "Mortar":
         reticleHud.setBitmap("gui/ret_mortor");
         reticleFrameHud.setVisible(true);
      case "MissileLauncher":
         reticleHud.setBitmap("gui/ret_missile");
         reticleFrameHud.setVisible(true);
      case "ShockLance":
         reticleHud.setBitmap("gui/hud_ret_shocklance");
         reticleFrameHud.setVisible(false);
      case "TargetingLaser":
         reticleHud.setBitmap("gui/hud_ret_targlaser");
         reticleFrameHud.setVisible(false);
      case "ShotGun":
         reticleHud.setBitmap("gui/ret_chaingun");
         reticleFrameHud.setVisible(true);
      case "Rifle":
         reticleHud.setBitmap("gui/hud_ret_sniper");
         reticleFrameHud.setVisible(false);
      case "ParticleCannon":
         reticleHud.setBitmap("gui/ret_plasma");
         reticleFrameHud.setVisible(true);
   }
}

$InventoryHudData[0, bitmapName]   = "gui/hud_handgren";
$InventoryHudData[0, itemDataName] = Grenade;
$InventoryHudData[0, ammoDataName] = Grenade;
$InventoryHudData[0, slot]         = 0;
$InventoryHudData[1, bitmapName]   = "gui/hud_mine";
$InventoryHudData[1, itemDataName] = Mine;
$InventoryHudData[1, ammoDataName] = Mine;
$InventoryHudData[1, slot]         = 1;
$InventoryHudData[2, bitmapName]   = "gui/hud_medpack";
$InventoryHudData[2, itemDataName] = RepairKit;
$InventoryHudData[2, ammoDataName] = RepairKit;
$InventoryHudData[2, slot]         = 3;
$InventoryHudData[3, bitmapName]   = "gui/hud_handgren";
$InventoryHudData[3, itemDataName] = FlashGrenade;
$InventoryHudData[3, ammoDataName] = FlashGrenade;
$InventoryHudData[3, slot]         = 0;
$InventoryHudData[4, bitmapName]   = "gui/hud_handgren";
$InventoryHudData[4, itemDataName] = ConcussionGrenade;
$InventoryHudData[4, ammoDataName] = ConcussionGrenade;
$InventoryHudData[4, slot]         = 0;
$InventoryHudData[5, bitmapName]   = "gui/hud_handgren";
$InventoryHudData[5, itemDataName] = FlareGrenade;
$InventoryHudData[5, ammoDataName] = FlareGrenade;
$InventoryHudData[5, slot]         = 0;
$InventoryHudData[6, bitmapName]   = "gui/hud_handgren";
$InventoryHudData[6, itemDataName] = CameraGrenade;
$InventoryHudData[6, ammoDataName] = CameraGrenade;
$InventoryHudData[6, slot]         = 0;
$InventoryHudData[7, bitmapName]   = "gui/hud_beacon";
$InventoryHudData[7, itemDataName] = Beacon;
$InventoryHudData[7, ammoDataName] = Beacon;
$InventoryHudData[7, slot]         = 2;
$InventoryHudData[8, bitmapName]   = "gui/hud_handgren";
$InventoryHudData[8, itemDataName] = EMPGrenade;
$InventoryHudData[8, ammoDataName] = EMPGrenade;
$InventoryHudData[8, slot]         = 0;
$InventoryHudData[9, bitmapName]   = "gui/hud_handgren";
$InventoryHudData[9, itemDataName] = PlasticExplosive;
$InventoryHudData[9, ammoDataName] = PlasticExplosive;
$InventoryHudData[9, slot]         = 0;
$InventoryHudData[10, bitmapName]   = "gui/hud_handgren";
$InventoryHudData[10, itemDataName] = IncendiaryGrenade;
$InventoryHudData[10, ammoDataName] = IncendiaryGrenade;
$InventoryHudData[10, slot]         = 0;
$InventoryHudData[11, bitmapName]   = "gui/hud_mine";
$InventoryHudData[11, itemDataName] = EMPMine;
$InventoryHudData[11, ammoDataName] = EMPMine;
$InventoryHudData[11, slot]         = 1;
$InventoryHudData[12, bitmapName]   = "gui/hud_mine";
$InventoryHudData[12, itemDataName] = IncendiaryMine;
$InventoryHudData[12, ammoDataName] = IncendiaryMine;
$InventoryHudData[12, slot]         = 1;
$InventoryHudData[13, bitmapName]   = "gui/hud_mine";
$InventoryHudData[13, itemDataName] = ConcussionMine;
$InventoryHudData[13, ammoDataName] = ConcussionMine;
$InventoryHudData[13, slot]         = 1;
$InventoryHudData[14, bitmapName]   = "gui/hud_mine";
$InventoryHudData[14, itemDataName] = StunMine;
$InventoryHudData[14, ammoDataName] = StunMine;
$InventoryHudData[14, slot]         = 1;

$InventoryHudCount = 15;

$BackpackHudData[0, itemDataName] = "AmmoPack";
$BackpackHudData[0, bitmapName] = "gui/hud_new_packammo";
$BackpackHudData[1, itemDataName] = "CloakingPack";
$BackpackHudData[1, bitmapName] = "gui/hud_new_packcloak";
$BackpackHudData[2, itemDataName] = "EnergyPack";
$BackpackHudData[2, bitmapName] = "gui/hud_new_packenergy";
$BackpackHudData[3, itemDataName] = "RepairPack";
$BackpackHudData[3, bitmapName] = "gui/hud_new_packrepair";
$BackpackHudData[4, itemDataName] = "SatchelCharge";
$BackpackHudData[4, bitmapName] = "gui/hud_new_packsatchel";
$BackpackHudData[5, itemDataName] = "ShieldPack";
$BackpackHudData[5, bitmapName] = "gui/hud_new_packshield";
$BackpackHudData[6, itemDataName] = "InventoryDeployable";
$BackpackHudData[6, bitmapName] = "gui/hud_new_packinventory";
$BackpackHudData[7, itemDataName] = "MotionSensorDeployable";
$BackpackHudData[7, bitmapName] = "gui/hud_new_packmotionsens";
$BackpackHudData[8, itemDataName] = "PulseSensorDeployable";
$BackpackHudData[8, bitmapName] = "gui/hud_new_packradar";
$BackpackHudData[9, itemDataName] = "TurretOutdoorDeployable";
$BackpackHudData[9, bitmapName] = "gui/hud_new_packturretout";
$BackpackHudData[10, itemDataName] = "TurretIndoorDeployable";
$BackpackHudData[10, bitmapName] = "gui/hud_new_packturretin";
$BackpackHudData[11, itemDataName] = "SensorJammerPack";
$BackpackHudData[11, bitmapName] = "gui/hud_new_packsensjam";
$BackpackHudData[12, itemDataName] = "AABarrelPack";
$BackpackHudData[12, bitmapName] = "gui/hud_new_packturret";
$BackpackHudData[13, itemDataName] = "FusionBarrelPack";
$BackpackHudData[13, bitmapName] = "gui/hud_new_packturret";
$BackpackHudData[14, itemDataName] = "MissileBarrelPack";
$BackpackHudData[14, bitmapName] = "gui/hud_new_packturret";
$BackpackHudData[15, itemDataName] = "PlasmaBarrelPack";
$BackpackHudData[15, bitmapName] = "gui/hud_new_packturret";
$BackpackHudData[16, itemDataName] = "ELFBarrelPack";
$BackpackHudData[16, bitmapName] = "gui/hud_new_packturret";
$BackpackHudData[17, itemDataName] = "MortarBarrelPack";
$BackpackHudData[17, bitmapName] = "gui/hud_new_packturret";
$BackpackHudData[18, itemDataName] = "DepthChargeBarrelPack";
$BackpackHudData[18, bitmapName] = "gui/hud_new_packturret";
$BackpackHudData[19, itemDataName] = "DeployableSensorJammerPack";
$BackpackHudData[19, bitmapName] = "gui/hud_new_packsensjam";
$BackpackHudData[20, itemDataName] = "ForceFieldDeployable";
$BackpackHudData[20, bitmapName] = "gui/hud_new_packradar";
$BackpackHudData[21, itemDataName] = "AutoRocketPack";
$BackpackHudData[21, bitmapName] = "gui/hud_missiles.png";

$BackpackHudCount = 22;

$ControlObjectReticle[DepthChargeBarrelLarge, bitmap] = "ret_mortor";
$ControlObjectReticle[DepthChargeBarrelLarge, frame] = true;
