Jump to content
7erra

[Release] Virtual Arsenal Shop System

Recommended Posts

On 10/5/2018 at 2:55 AM, 7erra said:

You no longer can buy undefined items or shop unrelated items

 

 

This is good!  I noticed on the previous version if a player used Personal Arsenal, by default everything not defined was there for free.

Share this post


Link to post
Share on other sites

Hello. This script is very close to what I'm looking for: a qucik and easy shop I can plug into any mission I feel like.

I did some scripting on my own. I managed to create a script that reads a content of boxes synched with an logic and create arrays of items and magazines that then you can use as a source for the shop.

I noticed that your shop does not have generic prices for stuff that is not defined, so here's a function I made for my script that tries to find a specific price, but failing that it will return a prace based off the type of the weapon. Feel free to use it.
https://pastebin.com/EbR4VKKW

Share this post


Link to post
Share on other sites
1 hour ago, taro8 said:

Hello. This script is very close to what I'm looking for: a qucik and easy shop I can plug into any mission I feel like.

I did some scripting on my own. I managed to create a script that reads a content of boxes synched with an logic and create arrays of items and magazines that then you can use as a source for the shop.

I noticed that your shop does not have generic prices for stuff that is not defined, so here's a function I made for my script that tries to find a specific price, but failing that it will return a prace based off the type of the weapon. Feel free to use it.
https://pastebin.com/EbR4VKKW

Thanks for that :) I was thinking about adding the option to automatically calculate prices too but the thing is that you'd need a function which can set a price for every item, not only weapons. The function will work via the config, just as you did in the example tough it first will have to determine the type of the item with BIS_fnc_itemType to get the correct config and apply the right costs. I found some price calculation in the Ravage mod and will probably go a similar way.

Share this post


Link to post
Share on other sites

I made this script for one of my projects that counts price for all items. Or at least that's what it's supposed to do :) It still probably needs some work and I will improve it later when I get the time but here's the script if anyone needs:

Spoiler

countWeaponDamage =
{
private ["_maxHit"];
params ["_weapon"];

// Count max damage for this weapon
_maxHit = 0;

 _mags = getarray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
 {
  _ammo = getText (configfile >> "CfgMagazines" >> _x >> "ammo");
  _hit = getNumber(configfile >> "CfgAmmo" >> _ammo >> "hit");
  
  if(_maxHit < _hit) then
  {
   _maxHit = _hit;
  };
 } forEach _mags;
 
 _maxHit
};

getWeaponAmmo =
{
private ["_ammo","_mag","_mags","_ammoCfg"];
params ["_weapon"];

 _mags = getarray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
 _mag = _mags select 0;
 
 _ammo = getText(configfile >> "CfgMagazines" >> _mag >> "ammo");
 _ammoCfg = (configfile >> "CfgAmmo" >> _ammo); 
 
 _ammoCfg
};

hasWeaponAmmoAttribute =
{
private ["_ammo","_mag","_mags","_ammoCfg"];
params ["_weapon","_attr"];
_ret = false; 

 _mags = getarray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
 {
 _mag = _x;
 _ammo = getText(configfile >> "CfgMagazines" >> _mag >> "ammo");
 _ammoCfg = (configfile >> "CfgAmmo" >> _ammo); 
 
 if(getNumber (_ammoCfg >> _attr) > 0) exitwith { _ret = true; };
 
 } forEach _mags;
 _ret
};

getItemCost =
{
//private _item = _this;
params ["_item"];
private ["_cost","_itemType","_mainType","_childType"];

_itemType = _item call BIS_fnc_itemType;
_mainType = _itemType select 0;
_childType = _itemType select 1;

_cost = 0;

switch (_mainType) do
{
 case "Weapon":
 {
  _dam = _item call countWeaponDamage;
  _ammo = _item call getWeaponAmmo;
  
  _addCost = 0;
  
  // https://community.bistudio.com/wiki/A3_Targeting_config_reference
  
  _isAA = false;
  if([_item,"airLock"] call hasWeaponAmmoAttribute) then
  {
   _isAA = true;
   _addCost = 500;
  };
  _autoSeek = false;
  if([_item,"autoSeekTarget"] call hasWeaponAmmoAttribute) then
  {
   _autoSeek = true;
   _addCost = 500;
  };
  _irlock = false;
  if([_item,"irLock"] call hasWeaponAmmoAttribute) then
  {
   _irlock = true;
   _addCost = 500;
  };
  _laserLock = false;
  if([_item,"laserLock"] call hasWeaponAmmoAttribute) then
  {
   _laserLock = true;
   _addCost = 250;
  };  
  if([_item,"manualControl"] call hasWeaponAmmoAttribute) then
  {
   _laserLock = true;
   _addCost = 300;
  };
   
  //diag_log format["????? %1 %2 %3 %4 %5 %6",_item,_childType,_isAA,_autoSeek,_irlock,_laserLock];
  

   if(_childType in ["RocketLauncher","MissileLauncher"]) then
   {
    if(!_isAA) then
    {
    //diag_log format[">>> %1 %2 %3",_item,_childType,_dam];
	
    _addCost = _addCost + (_dam * 0.25);
	};
   }
   else
   {
    //diag_log format["))) %1 %2 %3 %4",_item,_childType,_dam,(_dam * 25)];
	
    _addCost = _addCost + (_dam * 25);
   };
   
  
  if(_childType == "AssaultRifle") then
  {
   _cost = 1000;
  }; 
  if(_childType == "MachineGun") then
  {
   _cost = 1500;
  }; 
  if(_childType == "SniperRifle") then
  {
   _cost = 2500;
  };
  if(_childType == "RocketLauncher") then
  {
  //diag_log format[" %1 %2 %3 %4 %5 %6",_item,_childType,_isAA,_autoSeek,_irlock,_laserLock];
  
   _cost = 2000;
  };
  if(_childType == "MissileLauncher") then
  {
   //diag_log format[" %1 %2 %3 %4 %5 %6",_item,_childType,_isAA,_autoSeek,_irlock,_laserLock];
   
   _cost = 2000;
  };

  _cost = _cost + _addCost;
 };
 case "Magazine": 
 {
  if(_childType == "Bullet") then
  {
   _cost = 70;
  };
  if(_childType == "Missile") then
  {
   _cost = 500;
  };
  if(_childType in ["Grenade","SmokeShell","Shell","Flare"]) then
  {
   _cost = 50;
  };
  
  if(_item == "Laserbatteries") then // childtype is "UnknownMagazine"
  {
   _cost = 55;
  };
 };
 case "Equipment":
 {
  if(_childType == "Glasses") then
  {
   _cost = 10;
  };
  if(_childType == "Headgear") then
  {
   _cost = 250;
  };
  if(_childType == "Vest") then
  {
   _cost = 500;
  };
  if(_childType == "Backpack") then
  {
   _cost = 250;
  };
  if(_childType == "Uniform") then
  {
   _cost = 50;
  };
 };
 case "Item":
 {
  //_cost = 77;
  if(_childType in ["AccessorySights","AccessoryMuzzle","AccessoryPointer","AccessoryBipod"]) then
  {
   _cost = 150;
  };
  if(_childType == "LaserDesignator") then { _cost = 300; };
  if(_childType == "Binocular") then { _cost = 30; };
  if(_childType == "FirstAidKit") then { _cost = 100; };
  if(_childType == "Compass") then { _cost = 30; };
  if(_childType == "Toolkit") then { _cost = 100; };
  
  if(_childType == "GPS") then { _cost = 150; };
  if(_childType == "Map") then { _cost = 10; };
  if(_childType == "Medikit") then { _cost = 300; };
  if(_childType == "MineDetector") then { _cost = 250; };
  if(_childType == "NVGoggles") then { _cost = 500; };
  if(_childType == "Radio") then { _cost = 100; };
  if(_childType == "UAVTerminal") then { _cost = 750; };
  if(_childType == "Watch") then { _cost = 20; };
  
 };
};

if(_cost == 0) then { player sidechat format["Unknown item category %1 >> %2", _item, _itemType]; };


_cost
};

 

 

 

To run it just have:

 

primaryweapon player call getItemCost

 

or

 

handgunweapon player call getItemCost

 

Share this post


Link to post
Share on other sites

@7erra I have been working on script that lists all items from specific side to the arsenal with prices but there is something strange going on how the weapons are listed. Everything else seems to work fine but the weapons that get listed some have zero price and some have the 10 I put for testing purposes.

 

Here's my script (from config.sqf):

Spoiler

_costArray = [];

_addUnique =
{
 params ["_item"];
 if(count _item == 0) exitWith {};
 
 _item = tolower _item;
  if( (_costArray find _item) < 0 ) then
  {
  _costArray pushback _item;
  _costArray pushback 10;
  };
};

_sideIndex = 0;

{
   _manConf = _x;

   _manSide = getNumber(_manConf >> "side");
   
  if(_manSide == _sideIndex) then
  {
   _manWeapons = getArray (_manConf >> "weapons");
   
  {
   _wname = _x;
   _wcfg = configfile >> "CfgWeapons" >> _wname;
   if(isclass _wcfg && (getNumber (_wcfg >> 'scope')) > 0 && !((tolower _wname) in ["throw","put"])) then
   {
	_wname call _addUnique; // <---------- Wierd results from this!
   };
	
	_mags = getArray (configfile >> "CfgWeapons" >> _x >> "magazines");
	{
	 _x call _addUnique;
	} foreach _mags;
    
  } foreach _manWeapons;
  
  {
   _x call _addUnique;
  } foreach (getArray (_manConf >> "linkedItems"));
  
   (getText (_manConf >> "backpack")) call _addUnique;
   
   (getText (_manConf >> "uniformClass")) call _addUnique;
   
  // diag_log format["backpack: %1", (getText (_manConf >> "backpack"))];
  };
   
} foreach ("(configname _x) isKindof 'man' && (getNumber (_x >> 'scope')) > 0" configClasses (configfile >> "CfgVehicles"));

 

 

Like I said everything else is listen normally except weapons. Can't figure it out why...

Share this post


Link to post
Share on other sites

Well I isolated the problem to this small piece of code. Have to say I never had problem like this before, it seems that the isKindOf command is to blame. I don't know if this is some kind of conflict or what but just cant figure it out...

Spoiler

_costArray = [];

_addUnique =
{
 params ["_item"];
 if(count _item == 0) exitWith {};
 
 _item = tolower _item;
  if( (_costArray find _item) < 0 ) then
  {
  _costArray pushback _item;
  _costArray pushback 10;
  
  diag_log format["_item %1", _item];
  };
};

listhmm = [];
_weapsConf = configfile >> "CfgWeapons";
for "_i" from 0 to (count _weapsConf - 1) do
{
 _w = _weapsConf select _i;
 listhmm pushback (configname _w);
 
 //(configname _w) call _addUnique;
};


_sideIndex = 0;

_vehsConf = configfile >> "CfgVehicles";
for "_i" from 0 to (count _vehsConf - 1) do
{
 _manConf = _vehsConf select _i; // _x;
 
 if(isclass _manConf) then
 {
  _manType = configname _manConf;
 
  if(_manType isKindOf "man") then // Comment this out and it works!
  { 
   (selectRandom listhmm) call _addUnique;
  };
};
};

 

 

Share this post


Link to post
Share on other sites
1 hour ago, gc8 said:

isKindOf command

Now that you mention it i had the same problem when trying my approach. the kindOf command doesn't seem to work this way with weapon classnames but that is really weird. Trying 

"weaponClass" isKindOf "Rifle"

didn't do what it was supposed to do...

Share this post


Link to post
Share on other sites

@7erra Weird, I wasn't trying it with weapons but with man

Share this post


Link to post
Share on other sites

I think I found a bug in the item loading code. I quickly put together this array of weapons but when it's loaded the weapons appear in the arsenal but all prices are zero.

 

Here's the array from config.sqf:

 

_costArray = 
[
	"arifle_ctar_blk_flash_f",100,
	"arifle_arx_hex_dms_pointer_snds_bipod_f",50,
	"srifle_gm6_ghex_lrps_f",75,
	"arifle_ctar_blk_arco_pointer_f",20,
	"arifle_mx_khk_hamr_pointer_snds_f",10,
	"arifle_mx_gl_khk_aco_f",5,
	"srifle_dmr_04_ns_lp_f",25,
	"arifle_katiba_pointer_f",17,
	"hgun_rook40_f",17,
	"srifle_ebr_mrco_lp_bi_f",77
];

 

Oddly only the rook has price set, 17

Share this post


Link to post
Share on other sites

Ah I can see where the problem lies. The array contains weapons which have attachements while the cost array requires you to add the base weapons (there are no weapons with attachements in the arsenal). I will implement this in the next update.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Right, guess the arsenal should not have weapons with attachments since you can add the attachments manually in the arsenal.

Share this post


Link to post
Share on other sites

If someone could upload a demomission with included equipment and prices would be helpful.

And btw is it possible to divide bluefor and opfor equipment ?

Share this post


Link to post
Share on other sites
9 minutes ago, Muecke said:

If someone could upload a demomission with included equipment and prices would be helpful.

 

There is demo. 1) download the zip from github (See first post). 2) create new mission folder. 3) drop the files from the zip in there. 4) Create init.sqf and put this line in there:

[player] call TER_fnc_addArsenal

Now you can start the mission and open arsenal via mouse scroll and middle mouse button

 

To add your own items in arsenal edit the config.sqf file in the arsenalShop folder.

  • Like 2

Share this post


Link to post
Share on other sites
29 minutes ago, Muecke said:

And btw is it possible to divide bluefor and opfor equipment ?

If you are okay with having two seperate boxes then yes. You can use the BIS_fnc_addVirutalItemCargo (and similar) to add specific items to the designated box

Share this post


Link to post
Share on other sites

Found another bug. Backpacks cant be added. From this array only one (UAV) bag is added:

 

_costArray =
[
"B_Carryall_ghex_OTAHAT_F",15,
"B_Carryall_cbr_AHAT",15,
"B_FieldPack_ghex_OTHAT_F",15,
"B_FieldPack_cbr_HAT",15,
"G_FieldPack_LAT2",15,
"B_TacticalPack_ocamo_AT_F",15,
"B_TacticalPack_ocamo_AA_F",15,
"B_FieldPack_ocamo_LAT_F",15,
"B_AssaultPack_ocamo_Medic_F",15,
"B_FieldPack_cbr_Ammo_F",15,
"B_Carryall_ghex_Mine",15,
"B_Carryall_ocamo_Mine",15,
"O_UAV_06_medical_backpack_F",15,
"B_FieldPack_ghex_OTRPG_AT_F",15,
"B_FieldPack_ghex_OTReconMedic_F",15,
"B_Carryall_ghex_OTReconExp_F",15,
"B_FieldPack_blk_DiverExp",15
];

 

Share this post


Link to post
Share on other sites
2 minutes ago, gc8 said:

Found another bug. Backpacks cant be added

Yeah those are not the base classes. Eg: "B_FieldPack_blk_DiverExp" has to be added as "B_FieldPack_blk". Those special attibutes tell the game which items should be in the backpack. I had the same problem: https://github.com/7erra/Arsenal-Shop/issues/2

Share this post


Link to post
Share on other sites

(pre-release) v1.5 - Automatic Cost Calculation (17.10.2018)

! SEPERATE BRANCH !

 

I finally got a function which can handle all arsenal items. The only problem is that I have yet to find the right balance between price, money and multipliers. If someone wants to help me out then s/he can modify the fn_automaticCostTable.sqf so that it gets you realistic prices. It would be nice to have some kind of library where you can choose from. I am still onto fixing other outstanding issues. Also thanks to @gc8, I've reused some of your code.

 

@foxhound please don't release this yet since it is WIP :)

  • Like 1

Share this post


Link to post
Share on other sites

Thanks @7erra

I also made script that adds items to the arsenal depending on which side uses the items. So in this code items from east side units are added:

 

Spoiler

params ["_typeInit",["_didJIP",true]];
/* Config part, change to your liking */
if (_typeInit == "postInit") exitWith {
	TER_moneyNamespace = player; // where the money variable is saved
	TER_moneyVariable = "money"; // name of the money variable
	TER_moneyUnit = "$"; // added behind all numbers which represent currency (duh)
	//eg >player getVariable "TER_money";< will return the current amount of money the (local) player has
	//>TER_moneyNameSpace getVariable TER_moneyVariable;< will do the same
};

/*
_costArray = 
[
	"arifle_ctar_blk_flash_f",100,
	"arifle_arx_hex_dms_pointer_snds_bipod_f",50,
	"srifle_gm6_ghex_lrps_f",75,
	"arifle_ctar_blk_arco_pointer_f",20,
	"arifle_mx_khk_hamr_pointer_snds_f",10,
	"arifle_mx_gl_khk_aco_f",5,
	"srifle_dmr_04_ns_lp_f",25,
	"arifle_katiba_pointer_f",17,
	"hgun_rook40_f",17,
	"srifle_ebr_mrco_lp_bi_f",77
];
*/


_scr = compile preprocessFileLineNumbers "prices.sqf";
call _scr;


_sides = [0]; // 0 = East, 1 = West, 2 = Res


_costArray = [];

_addUnique =
{
 params ["_item"];
 if(count _item == 0) exitWith {};
 
 _item = tolower _item;
  if( (_costArray find _item) < 0 ) then
  {
  _costArray pushback _item;
  _costArray pushback (_item call getItemCost);
  };
};

{
 _manConf = _x;
 
 if(isclass _manConf) then
 {
  _manType = configname _manConf;
  
   //if((_manType isKindOf "man") && ((getNumber (_manConf >> "scope")) > 0)) then
   
   _manSide = getNumber(_manConf >> "side");
   
  if(_manSide in _sides) then
  {
   _manWeapons = getArray (_manConf >> "weapons");
   
  {
   _wname = _x;
   _wcfg = configfile >> "CfgWeapons" >> _wname;
   if(isclass _wcfg && (getNumber (_wcfg >> 'scope')) > 0) then
   {
    if(!((tolower _wname) in ["throw","put"])) then
	{
	_wname call _addUnique;
    };
	
	_mags = getArray (configfile >> "CfgWeapons" >> _x >> "magazines");
	{
	 _x call _addUnique;
	} foreach _mags;
    
	_witems = _wname call BIS_fnc_compatibleItems;
	
	{
	 _x call _addUnique;
	} foreach _witems;
   };
  } foreach _manWeapons;
  
  {
   _a = getArray (_manConf >> _x);
   {
   _x call _addUnique;
   } foreach _a;
  } foreach ["magazines","items","linkedItems"];
  
   //(getText (_manConf >> "backpack")) call _addUnique;
   
   //diag_log format["bag: %1", (getText (_manConf >> "backpack"))];
   
   (getText (_manConf >> "uniformClass")) call _addUnique;
   
  // diag_log format["backpack: %1", (getText (_manConf >> "backpack"))];
  
  };
  
 };
} foreach ("(configname _x) isKindof 'man' && (getNumber (_x >> 'scope')) > 0" configClasses (configfile >> "CfgVehicles"));

// Get all backpacks
{
 _bagname = configname _x;

 _bagname call _addUnique;

} foreach ("(configname _x) isKindof 'Bag_Base' && (getNumber (_x >> 'scope')) > 0" configClasses (configfile >> "CfgVehicles"));



_autoCalc = false; //if you want to automatically calculate the cost of the table set this to true
// take a look into "arsenalShop\fnc\fn_autoCostTable.sqf" too. There you can adjust the cost of item groups.

_lockArray = false; //determine wether the cost array can be changed during the mission

//_costArray = [];

/* end of config */

  ///////////////////////////////////////////////////////////////////////////////
 ////			 		Set up system, pls dont change 						////
///////////////////////////////////////////////////////////////////////////////
// automatic cost calculation
if (_autoCalc) then {
	_costArray = [_costArray] call compile preprocessFileLineNumbers "arsenalShop\fnc\fn_autoCostTable.sqf";
};
// adjust the cost table so you can find items regardless of capitalization
_costArray = _costArray +["",0];
_costArray = _costArray apply {
	if (_x isEqualType "STRING") then {
		toLower _x
	} else {
		_x
	};
};
TER_costArray = if (_lockArray) then {
	compileFinal str _costArray;//make unchangeable
} else {
	compile str _costArray;// keep changeable
};
// this is where the magic happens:
TER_fnc_arsenalEH = compile preprocessFileLineNumbers "arsenalShop\ui\arsenalEH.sqf";
TER_arsenalOpenedEHID = [missionNamespace, "arsenalOpened", TER_fnc_arsenalEH] call BIS_fnc_addScriptedEventHandler;

 

 

And the link to prices.sqf

 

The problem with this code is however that some weapons don't have price. I still need to figure a way to fix this :)

 

 

 

Edited by gc8
code updated

Share this post


Link to post
Share on other sites

Hi @7erra. I noticed that if I try to add non base class weapon like this:

 

_costArray = ["LMG_Zafir_pointer_F", 77];

 

The base class "LMG_Zafir_F" is actually what get's added into arsenal. This is good but the price is still zero

Share this post


Link to post
Share on other sites

compiled this about 5 years ago, adds everything and i mean everything into arrays with prices, weapons prices seem all right still but I never put the same time into getting veh right.

Spoiler



private ["_price","_displayName","_item","_infoType","_foreachIndex","_ammo","_magname","_magnames","_linkedOptics","_linkedMuzzle","_linkedAccs","_speed","_type","_weap","_weapons","_magazines","_linkedItems","_Items","_priceIron","_mag","_armor","_mapSize","_mags","_count"];
SQU_FilledBackpack = []; SQU_FilledBackpackItems = [];		

SQU_backpacksCfg = [];SQU_backpacks = [];
SQU_backpacksCfgE = [];SQU_backpacksE = [];
SQU_backpacksCfgW = [];SQU_backpacksW = [];

SQU_clothesCfg = []; SQU_clothes = [];
SQU_clothesCfgE = []; SQU_clothesE = [];
SQU_clothesCfgW = []; SQU_clothesW = [];

SQU_vestsCfg = []; SQU_vests = []; 
SQU_handWeaponsCfg = []; SQU_handWeapons =[];
SQU_RiflesCfg = []; SQU_Rifles = [];
SQU_LaunchersCfg = []; SQU_Launchers = [];

SQU_accessoriesCfg = [];	SQU_accessories = [];
SQU_accessoriesCfgE = [];	SQU_accessoriesE = [];
SQU_accessoriesCfgW = [];	SQU_accessoriesW = [];

SQU_magazinesCfg = [];SQU_magazines = [];
SQU_gernadesCfg = []; SQU_gernades = [];

SQU_soldiersCfgE = []; SQU_soldiersE = []; 
SQU_Soft_InfE = [];
SQU_Armour_InfE = [];		
SQU_Air_InfE = [];
SQU_soldiersCfgW = []; SQU_soldiersW = []; 
SQU_Soft_InfW = [];
SQU_Armour_InfW = [];		
SQU_Air_InfW = [];

SQU_carsCfgE = []; SQU_carsE = [];
SQU_Soft_CarE = [];
SQU_Armour_CarE = [];		
SQU_Air_CarE = [];
SQU_Trans_CarE = [];
SQU_carsCfgW = []; SQU_carsW = [];
SQU_Soft_CarW = [];
SQU_Armour_CarW = [];		
SQU_Air_CarW = [];
SQU_Trans_CarW = [];

SQU_TanksCfgE = []; SQU_TanksE = [];
SQU_Soft_TankE = [];
SQU_Armour_TankE = [];		
SQU_Air_TankE = [];
SQU_Trans_TankE = [];
SQU_TanksCfgW = []; SQU_TanksW = [];
SQU_Soft_TankW = [];
SQU_Armour_TankW = [];		
SQU_Air_TankW = [];
SQU_Trans_TankW = [];

SQU_AirCraftCfgE = []; SQU_AirCraftE = [];
SQU_Soft_AirE = [];
SQU_Armour_AirE = [];		
SQU_Air_AirE = [];
SQU_Trans_AirE = [];
SQU_AirCraftCfgW = []; SQU_AirCraftW = [];
SQU_Soft_AirW = [];
SQU_Armour_AirW = [];		
SQU_Air_AirW = [];
SQU_Trans_AirW = [];

SQU_ShipsCfgE = []; SQU_ShipsE = [];
SQU_Soft_ShipE = [];
SQU_Armour_ShipE = [];		
SQU_Air_ShipE = [];
SQU_Trans_ShipE  = [];
SQU_ShipsCfgW = []; SQU_ShipsW = [];
SQU_Soft_ShipW = [];
SQU_Armour_ShipW = [];		
SQU_Air_ShipW = [];
SQU_Trans_ShipW  = [];

SQU_StaticsCfgE = []; SQU_StaticsE = [];
SQU_StaticsCfgW = []; SQU_StaticsW = [];



// Backpacks
_count =  count (configFile >> "CfgVehicles");
for "_x" from 0 to (_count-1) do
{
  _item=((configFile >> "CfgVehicles") select _x);
  if (isClass _item) then
  {
    if ((getNumber (_item >> "scope") == 2) || ((configName _item) == "B_Kitbag_Base")) then  
    {
      if (getText (_item >> "vehicleClass") == "Backpacks") then  
      {
      	_displayName = getText (_item >> "displayName");
       	_price = getNumber (_item >> "maximumLoad");
       	if(_price == 0)then{ _price = getNumber (_item >> "mass")}; 
       	_array = toArray (configName _item); 
       	if ((_array select 0 == 79 ) || (_array select 0 == 111 ))then
       	{
    	    SQU_backpacksE = SQU_backpacksE + [configName _item];
    	    SQU_backpacksCfgE = SQU_backpacksCfgE + [[_price, configName _item]];         		
       	};
       	if ((_array select 0 == 98 ) || (_array select 0 == 66 ))then
       	{
    	    SQU_backpacksW = SQU_backpacksW + [configName _item];
    	    SQU_backpacksCfgW = SQU_backpacksCfgW + [[_price, configName _item]];         		
       	};       	  	
        SQU_backpacks = SQU_backpacks + [configName _item];
        SQU_backpacksCfg = SQU_backpacksCfg + [[_price, configName _item]];        
			};
		};
	};
};

// Glasses
_count =  count (configFile >> "CfgGlasses");
for "_x" from 0 to (_count-1) do
{
	_item=((configFile >> "CfgGlasses") select _x);
	if (isClass _item) then
	{
		if (getnumber (_item >> "scope") == 2) then  // public
		{
			_price = 10;
     	_array = toArray (configName _item); 
     	
     	if ((_array select 2 == 79 ) || ((_array select(count _array - 1)) == 79 ))then
     	{
	    SQU_clothesE = SQU_clothesE + [configName _item];
	    SQU_clothesCfgE = SQU_clothesCfgE + [[_price, configName _item]];         		
  	 	};

     	if ((_array select 2 == 66 ) || ((_array select(count _array - 1)) == 66 ))then
     	{
	    SQU_clothesW = SQU_clothesW + [configName _item];
	    SQU_clothesCfgW = SQU_clothesCfgW + [[_price, configName _item]];         		
     	};   			
			SQU_clothes = SQU_clothes + [configName _item];			
			SQU_clothesCfg = SQU_clothesCFG + [[_price, configName _item]];
		};
	};
};

// SQU_accessoriesCfg
_count =  count (configFile >> "CfgWeapons");
for "_x" from 0 to (_count-1) do
{
  _item=((configFile >> "CfgWeapons") select _x);
  if (isClass _item) then
  {
    if (getnumber (_item >> "scope") == 2) then  // public
    {
  	 	if("Binocular" == configName _item  )then
  		{
  			
		  	_price = (getNumber (_item >> "WeaponSlotsInfo" >> "mass")*10);
	  		SQU_accessories = SQU_accessories + [configName _item];    				
	  		SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]]; 	
    	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
    	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
    	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
    	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];    		  		    			
  		};  
  	 	if("Rangefinder" == configName _item  )then
  		{
  			
		  	_price = (getNumber (_item >> "WeaponSlotsInfo" >> "mass")*10);
	  		SQU_accessories = SQU_accessories + [configName _item];    				
	  		SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]]; 
    	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
    	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
    	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
    	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];    		  			    			
  		}; 		
  	 	if("Laserdesignator" == configName _item  )then
  		{
  			
		  	_price = (getNumber (_item >> "WeaponSlotsInfo" >> "mass")*10);
	  		SQU_accessories = SQU_accessories + [configName _item];    				
	  		SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]]; 
    	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
    	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
    	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
    	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];    		  			    			
  		}; 	 
  	 	if("NVGoggles_OPFOR" == configName _item  )then
  		{
		  	_price = (getNumber (_item >> "WeaponSlotsInfo" >> "mass")*10);
	  		SQU_accessories = SQU_accessories + [configName _item];    				
	  		SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]]; 
    	  SQU_accessoriesE = SQU_accessoriesE + [configName _item];
    	  SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
  		}; 	 		
  	  if (isClass (_item >> "ItemInfo")) then
  	   {
  	   	
    		if("MineDetector" == configName _item  )then
    		{
 			  	_price = (getNumber (_item >> "ItemInfo" >> "mass")*10);
		  		SQU_accessories = SQU_accessories + [configName _item];    				
		  		SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]]; 	
    	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
    	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
    	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
    	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];    			  		    			
    		};  
    		if("FirstAidKit" == configName _item  )then
    		{
 			  	_price = (getNumber (_item >> "ItemInfo" >> "mass")*10);
		  		SQU_accessories = SQU_accessories + [configName _item];    				
		  		SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]]; 
    	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
    	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
    	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
    	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];    			  			    			
    		};
    		if("Medikit" == configName _item  )then
    		{
 			  	_price = (getNumber (_item >> "ItemInfo" >> "mass")*10);
		  		SQU_accessories = SQU_accessories + [configName _item];    				
		  		SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]]; 
    	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
    	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
    	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
    	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];    			  			    			
    		};
    		if("ToolKit" == configName _item  )then
    		{
 			  	_price = (getNumber (_item >> "ItemInfo" >> "mass")*10);
		  		SQU_accessories = SQU_accessories + [configName _item];    				
		  		SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]];
    	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
    	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
    	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
    	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];    		  		 	    			
    		};
    		    		    		    			  
    		_infoType = (getNumber (_item >> "ItemInfo" >> "Type"));
    		_displayName = getText (_item >> "displayName");
    		_price = 0;
    		switch (_infoType) do
    		{
    			case 201://"optic"
    			 { 
    			 		_price = (getnumber (_item >> "ItemInfo" >> "mass")*20);
    			 		if(getnumber (_item >> "ItemInfo" >> "opticType") == 1)then{_price = (_price * 3)};
    			 		SQU_accessories = SQU_accessories + [configName _item];
    					SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]];
        	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
        	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
        	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
        	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];        					
    			 }; 
    			case 101://"muzzle"
    			 {
    			 		_price = (getnumber (_item >> "ItemInfo" >> "mass")*10);
    			 		SQU_accessories = SQU_accessories + [configName _item];    			 	
    					SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]];
        	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
        	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
        	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
        	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];        					
    			 };
    			case 301: //"acc"
    			 {
    			  	_price = (getnumber (_item >> "ItemInfo" >> "mass")*10);
    			  	SQU_accessories = SQU_accessories + [configName _item];    				
    			  	SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]];
        	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
        	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
        	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
        	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];        			  	
    			 }; 
/*    			case 605://"head"
    			 {
    			  	_price = (getnumber (_item >> "ItemInfo" >> "mass")*5);
             	_array = toArray (configName _item); 
             	
             	if ((_array select 2 == 79 ) || ((_array select(count _array - 1)) == 79 ) || ((_array select(count _array - 5)) == 111 ))then
             	{
          	    SQU_clothesE = SQU_clothesE + [configName _item];
          	    SQU_clothesCfgE = SQU_clothesCfgE + [[_price, configName _item]];         		
             	};
    			   	if ((_array select 2 == 66 ) || ((_array select(count _array - 1)) == 66 ) || ((_array select(count _array - 5)) == 109 ) || ((_array select 8) == 66  ))then
             	{
          	    SQU_clothesW = SQU_clothesW + [configName _item];
          	    SQU_clothesCfgW = SQU_clothesCfgW + [[_price, configName _item]];         		
             	};
             	if(count _array >= 13)then
             	{
             		if((_array select 12) == 66 )then
             		{
          	 	  	SQU_clothesW = SQU_clothesW + [configName _item];
          		    SQU_clothesCfgW = SQU_clothesCfgW + [[_price, configName _item]];               			
             		};
             	};              	     			  	
    			  	SQU_clothes = SQU_clothes + [configName _item];       			 	
    			 		SQU_clothesCfg = SQU_clothesCfg + [[_price, configName _item]];
    			 }; */
    			case 621://"UavTerminal"
    			 {
    			  	_price = (getnumber (_item >> "ItemInfo" >> "mass")*100);
    			  	_array = toArray (configName _item); 
    			  	if (_array select 0 == 79 )then
             	{
          	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
          	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]];         		
             	};
             	if (_array select 0 == 66 )then
             	{
          	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
          	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];         		
             	}; 
		  				SQU_accessories = SQU_accessories + [configName _item];    				
		  				SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]]; 
    			 };     			 
    			case 801://"uniform"
    			 {
    			  	_price = (getnumber (_item >> "ItemInfo" >> "mass")*2);
             	_array = toArray (configName _item); 
             	
             	if ((_array select 2 == 79 ) || ((_array select(count _array - 1)) == 79 ))then
             	{
          	    SQU_clothesE = SQU_clothesE + [configName _item];
          	    SQU_clothesCfgE = SQU_clothesCfgE + [[_price, configName _item]];         		
             	};
             	if ((_array select 2 == 66 ) || ((_array select(count _array - 1)) == 66 ))then
             	{
          	    SQU_clothesW = SQU_clothesW + [configName _item];
          	    SQU_clothesCfgW = SQU_clothesCfgW + [[_price, configName _item]];         		
             	};     			  	
    			  	SQU_clothes = SQU_clothes + [configName _item];       			 	
    			 		SQU_clothesCfg = SQU_clothesCfg + [[_price, configName _item]];
    			 }; 
    			case 701://"vest"
    			 {
     			  	_price = (getnumber (_item >> "ItemInfo" >> "mass")*2);
    			  	SQU_vests = SQU_vests + [configName _item];     			 	
    			 		SQU_vestsCfg = SQU_vestsCfg + [[_price, configName _item]];
    			 }; 
    			 default 
    			 {

    			 		if(getText(_item >> "simulation") == configName _item) then
    			 		{
       			  	_price = (getNumber (_item >> "ItemInfo" >> "mass")*10);
		  					SQU_accessories = SQU_accessories + [configName _item];    				
		  					SQU_accessoriesCfg = SQU_accessoriesCfg + [[_price, configName _item]];        			  	
          	    SQU_accessoriesE = SQU_accessoriesE + [configName _item];
          	    SQU_accessoriesCfgE = SQU_accessoriesCfgE + [[_price, configName _item]]; 
          	    SQU_accessoriesW = SQU_accessoriesW + [configName _item];
          	    SQU_accessoriesCfgW = SQU_accessoriesCfgW + [[_price, configName _item]];          	    			 			
    			 		};
    			 };
    		}; 
  	  };
  	};
	};
};

// Rifles
_count =  count (configFile >> "CfgWeapons");
for "_x" from 0 to (_count-1) do
{
  _item=((configFile >> "CfgWeapons") select _x);
  if (isClass _item) then
  {
    if (getnumber (_item >> "scope") == 2) then  // public
    {
      if (count(getarray (_item >> "magazines")) !=0 ) then  //WeaponHardMounted
      {    	
        if (getnumber (_item >> "type") == 1) then  //WeaponSlotPrimary
        {
        	_price = 0;
        	_displayName = getText (_item >> "displayName");
        	_magname = (getArray(_item >> "magazines"))select 0;
        	_magnames = (getArray(_item >> "magazines"));
        	_linkedOptics = (getText(_item >> "LinkedItems" >> "LinkedItemsOptic" >> "item" ));
        	_linkedMuzzle = (getText(_item >> "LinkedItems" >> "LinkedItemsMuzzle" >> "item" ));        	
        	_linkedAccs = (getText(_item >> "LinkedItems" >> "LinkedItemsAcc" >> "item" ));
        	

        	if(_linkedOptics != "")then
        	{
        		{if(_x == _linkedOptics)exitwith{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories;
        	};
        	if(_linkedMuzzle != "")then
        	{
        		{if(_x == _linkedMuzzle)exitwith{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories;
        	};
        	if(_linkedAccs != "")then
        	{
        		{if(_x == _linkedAccs)exitwith{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories;
        	};        	        	     	
	
        	
        	
        	{
        		_ammo = getText(configFile >> "CfgMagazines" >> _x >> "ammo");
        	 _price = _price + (getNumber(_item >> "WeaponSlotsInfo" >> "mass") + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit") + getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")) * (count(getArray(_item >> "muzzles"))));
        	}foreach _magnames;
					//_displayName = getText (_item >> "displayName");
        	SQU_Rifles = SQU_Rifles + [configName _item];
          SQU_RiflesCfg = SQU_RiflesCfg + [[_price,configName _item]];
        };
      };			
  	};
	};
};

// pistols
_count =  count (configFile >> "CfgWeapons");
for "_x" from 0 to (_count-1) do
{
  _item=((configFile >> "CfgWeapons") select _x);
  if (isClass _item) then
  {
    if (getnumber (_item >> "scope") == 2) then  // public
    {
      if (count(getarray (_item >> "magazines")) !=0 ) then  //WeaponHardMounted
      {    	
        if (getnumber (_item >> "type") == 2) then  //WeaponSlotPrimary
        {
        	_price = 0;
        	_displayName = getText (_item >> "displayName");
        	_magname = (getArray(_item >> "magazines"))select 0;
        	_magnames = (getArray(_item >> "magazines"));
        	_linkedOptics = (getText(_item >> "LinkedItems" >> "LinkedItemsOptic" >> "item" ));
        	_linkedMuzzle = (getText(_item >> "LinkedItems" >> "LinkedItemsMuzzle" >> "item" ));        	
        	_linkedAccs = (getText(_item >> "LinkedItems" >> "LinkedItemsAcc" >> "item" ));
        	

        	if(_linkedOptics != "")then
        	{
        		{if(_x == _linkedOptics)exitwith{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories;
        	};
        	if(_linkedMuzzle != "")then
        	{
        		{if(_x == _linkedMuzzle)exitwith{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories;
        	};
        	if(_linkedAccs != "")then
        	{
        		{if(_x == _linkedAccs)exitwith{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories;
        	};
        	        	
        	{
        		_ammo = getText(configFile >> "CfgMagazines" >> _x >> "ammo");
        	 _price = _price + (getNumber(_item >> "WeaponSlotsInfo" >> "mass") + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit") + getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")) * (count(getArray(_item >> "muzzles"))));
        	}foreach _magnames;

        	SQU_handWeapons = SQU_handWeapons + [configName _item];
          SQU_handWeaponsCfg = SQU_handWeaponsCfg + [[_price,configName _item]];
        };
      };		
  	};
	};
};	  
// Launchers
_count =  count (configFile >> "CfgWeapons");
for "_x" from 0 to (_count-1) do
{
  _item=((configFile >> "CfgWeapons") select _x);
  if (isClass _item) then
  {
    if (getnumber (_item >> "scope") == 2) then  // public
    {
      if (count(getarray (_item >> "magazines")) !=0 ) then  //WeaponHardMounted
      {    	
        if (getnumber (_item >> "type") == 4) then  //WeaponSlotPrimary
        {
        	_price = 0;
        	_displayName = getText (_item >> "displayName");
        	_magname = (getArray(_item >> "magazines"))select 0;
        	_magnames = (getArray(_item >> "magazines"));
        	
        	{
        		_ammo = getText(configFile >> "CfgMagazines" >> _x >> "ammo");
        	 _price = _price + (getNumber(_item >> "WeaponSlotsInfo" >> "mass") + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit") + getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")) * (count(getArray(_item >> "muzzles"))));
        	}foreach _magnames;

        	SQU_Launchers = SQU_Launchers + [configName _item];
          SQU_LaunchersCfg = SQU_LaunchersCfg + [[_price,configName _item]];
        };
      };		
  	};
	};
};
// magazines
_count =  count (configFile >> "CfgMagazines");
for "_x" from 0 to (_count-1) do
{
  _item=((configFile >> "CfgMagazines") select _x);
  if (isClass _item) then
  {
    if (getnumber (_item >> "scope") == 2) then  // public
    {
   	

        _price = 0;
       	_displayName = getText (_item >> "displayName");
      	

				_ammo = getText(_item >> "ammo");
				_speed =(getNumber(configFile >> "cfgAmmo" >> _ammo >> "typicalSpeed"));
				_type =(getNumber(_item >> "type"));	
     	  _price =(getNumber (_item >> "count")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")) ;							
//        _price = _price + (getNumber(_item >> "mass")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")) ;
				_price = round _price;
				
        if( ((getText (_item >> "picture")) != "") && (_speed < 100) && (_type != 16)) then  // public
        {
        	SQU_gernades = SQU_gernades + [configName _item];
          SQU_gernadesCfg = SQU_gernadesCfg + [[_price,configName _item]];
				}else{
          _speed =(getNumber(_item >> "initSpeed"));
          _type =(getText(_item >> "type"));
          if((_speed == 0) && (_type == "2*		256")) then  // public
          {
          	_price = (round(_price/2));	
            SQU_gernades = SQU_gernades + [configName _item];
            SQU_gernadesCfg = SQU_gernadesCfg + [[_price,configName _item]];	
          }else{				
            SQU_magazines = SQU_magazines + [configName _item];
            SQU_magazinesCfg = SQU_magazinesCfg + [[_price,configName _item]];	
       		};				
				};
	
  	};
	};
};

if(!isDedicated)then
{
  SQU_PriceSoldiers =
  {
  	private ["_price"];
  	_price = 100;
    {_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_handWeaponsCfg select _foreachIndex)select 0)}}forEach SQU_handWeapons}forEach _this;
  	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_RiflesCfg select _foreachIndex)select 0)}}forEach SQU_Rifles}forEach _this;
  	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_LaunchersCfg select _foreachIndex)select 0)}}forEach SQU_Launchers}forEach _this;
  	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories}forEach _this; 
  	
   	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_magazinesCfg select _foreachIndex)select 0)}}forEach SQU_magazines}forEach _this;
  	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_gernadesCfg select _foreachIndex)select 0)}}forEach SQU_gernades}forEach _this; 
  	      	
  	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_vestsCfg select _foreachIndex)select 0)}}forEach SQU_vests}forEach _this;           	  
   	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_backpacksCfg select _foreachIndex)select 0)}}forEach SQU_backpacks}forEach _this;
   	_price
  };
  
  //Check Custom Soliders prices and update if there has been a price tweak
  //profileNameSpace setVariable ["SQU_SaveCustom1",nil];
  //profileNameSpace setVariable ["SQU_SaveCustom2",nil];
  //profileNameSpace setVariable ["SQU_SaveCustom3",nil];
  //profileNameSpace setVariable ["SQU_SaveCustom4",nil];
  //profileNameSpace setVariable ["SQU_SaveCustom5",nil];
  //profileNameSpace setVariable ["SQU_SaveCustom6",nil];
  for [{_i=1},{_i<=6},{_i=_i+1}] do
  {
    if(!isNil{profileNameSpace getVariable(format["SQU_SaveCustom%1",_i])})then
    {
    	if(!isNil{((profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]))select 0)})then
    	{
    	
    		_price = (((profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]))select 0)select 0);
    		_items = (((profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]))select 0)select 2);
    		_newprice = _items call SQU_PriceSoldiers;
    
    		if(	_price != _newprice)then
    		{
    			_temparray = ((profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]))select 0);
    			_temparray set[0,_newprice];
    			_temparray1 = (profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]));
    			_temparray1 set[0,_temparray];			
    			profileNameSpace setVariable [format["SQU_SaveCustom%1",_i], _temparray1];
    		};			
    		SQU_soldiersE = SQU_soldiersE + [(format["SQU_SaveCustom%1",_i])];
    		SQU_soldiersCfgE = SQU_soldiersCfgE + [((profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]))select 0)];
    	};
    	if(!isNil{((profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]))select 1)})then
    	{
    	
    		_price = (((profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]))select 1)select 0);
    		_items = (((profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]))select 1)select 2);
    		_newprice = _items call SQU_PriceSoldiers;
    
    		if(	_price != _newprice)then
    		{
    			_temparray = ((profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]))select 1);
    			_temparray set[0,_newprice];
    			_temparray1 = (profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]));
    			_temparray1 set[1,_temparray];			
    			profileNameSpace setVariable [format["SQU_SaveCustom%1",_i], _temparray1];
    		};	
    		SQU_soldiersW = SQU_soldiersW + [(format["SQU_SaveCustom%1",_i])];
    		SQU_soldiersCfgW = SQU_soldiersCfgW + [((profileNameSpace getVariable (format["SQU_SaveCustom%1",_i]))select 1)];		
    	};	
    };
  };	
  
  saveProfileNameSpace;
};

//Soliders
_count =  count (configFile >> "CfgVehicles");
for "_x" from 0 to (_count-1) do
{
  _item=((configFile >> "CfgVehicles") select _x);
  if (isClass _item) then
  {
    if (getNumber (_item >> "scope") == 2) then  
    {
      if ((getText (_item >> "vehicleClass") == "Men")||(getText (_item >> "vehicleClass") == "MenSniper")/* || (getText (_item >> "vehicleClass") == "MenSupport") || (getText (_item >> "vehicleClass") == "MenDiver")*/)  then  
      {
      	if ((getNumber (_item >> "side") == SQU_east ) && (getText (_item >> "faction") == "OPF_F")&& ((configName _item) != "o_soldier_unarmed_f") )then  
    	  {
    	  	_price = 100;
					_threat = getArray(_item >> "threat");
					_weapons = getArray(_item >> "weapons");
					_magazines = getArray(_item >> "magazines");    	  	
					_linkedItems = getArray(_item >> "linkedItems"); 
					_Items = getArray(_item >> "Items");
					_backpack = getText(_item >> "backpack");	
					
					if(_backpack != "")then
					{
						_group = createGroup east;
						_unit = _group createUnit [(configName _item), [0,0,200], [], 0, "NONE"];
						_linkedItems = _linkedItems + [(configName(inheritsFrom(configFile >> "CfgVehicles" >> (typeOf (unitBackpack  _unit)))))];
						{
							if(_x in SQU_handWeapons)then{_weapons = _weapons + [_x]};
							if(_x in SQU_Rifles)then{_weapons = _weapons + [_x]};
							if(_x in SQU_Launchers)then{_weapons = _weapons + [_x]};
							if(_x in SQU_magazines)then{_magazines = _magazines + [_x]};
							if(_x in SQU_gernades)then{_magazines = _magazines + [_x]};	
							if(_x in SQU_accessories)then{_linkedItems = _linkedItems + [_x]};
							if(_x in SQU_vests)then{_linkedItems = _linkedItems + [_x]};
							if(_x in SQU_clothes) then {_linkedItems = _linkedItems + [_x]};
							if(_x in SQU_backpacks)then{_linkedItems = _linkedItems + [_x]};														
						}foreach (backpackItems _unit);
						//player sidechat format ["%1",(configName(inheritsFrom(configFile >> "CfgVehicles" >> (typeOf (unitBackpack  _unit)))))];						 
						//player sidechat format ["%1",configName _item];
						SQU_FilledBackpack set[count SQU_FilledBackpack,_backpack];
						SQU_FilledBackpackItems set[count SQU_FilledBackpackItems,(backpackItems _unit)];								
						deleteVehicle _unit; 
						deleteGroup _group; 
					};				
					
					

        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_handWeaponsCfg select _foreachIndex)select 0)}}forEach SQU_handWeapons}forEach _weapons;
        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_RiflesCfg select _foreachIndex)select 0)}}forEach SQU_Rifles}forEach _weapons;
        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_LaunchersCfg select _foreachIndex)select 0)}}forEach SQU_Launchers}forEach _weapons;
        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories}forEach _weapons; 
        	
         	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_magazinesCfg select _foreachIndex)select 0)}}forEach SQU_magazines}forEach _magazines;
        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_gernadesCfg select _foreachIndex)select 0)}}forEach SQU_gernades}forEach _magazines; 
        	      	
         	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories}forEach _linkedItems;
          {_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories}forEach _Items;        	
        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_vestsCfg select _foreachIndex)select 0)}}forEach SQU_vests}forEach _linkedItems;           	  
         	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_backpacksCfg select _foreachIndex)select 0)}}forEach SQU_backpacks}forEach _linkedItems;
         	//{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_clothesCfg select _foreachIndex)select 0)}}forEach SQU_clothes}forEach _linkedItems; 
         	         	       	      	
					if(_price > SQU_MostExpensiveUnit)then{SQU_MostExpensiveUnit = _price};  	  	
        	_displayName = getText (_item >> "displayName");
     	    SQU_soldiersE = SQU_soldiersE + [configName _item];        	
          SQU_soldiersCfgE = SQU_soldiersCfgE + [[_price, configName _item]];
					if(((_threat select 1) >= .3) || ((_threat select 2) >= .3))then{SQU_Soft_InfE = SQU_Soft_InfE + [((count SQU_soldiersE) - 1)]};
					if((_threat select 1) > .5)then{SQU_Armour_InfE = SQU_Armour_InfE + [((count SQU_soldiersE) - 1)]};			
					if((_threat select 2) > .5)then{SQU_Air_InfE = SQU_Air_InfE + [((count SQU_soldiersE) - 1)]};    
				};
      	if ((getNumber (_item >> "side") == SQU_west ) && (getText (_item >> "faction") == "BLU_F") && ((configName _item) != "B_RangeMaster_F") && ((configName _item) != "B_Competitor_F") && ((configName _item) != "b_soldier_unarmed_f") )then 
    	  {
    	  	_price = 100;
					_threat = getArray(_item >> "threat");
					_weapons = getArray(_item >> "weapons");
					_magazines = getArray(_item >> "magazines");    	  	
					_linkedItems = getArray(_item >> "linkedItems"); 
					_Items = getArray(_item >> "Items");
					_backpack = getText(_item >> "backpack");	

					
					if(_backpack != "")then
					{
						_group = createGroup west;
						_unit = _group createUnit [(configName _item), [0,0,200], [], 0, "NONE"];
						_linkedItems = _linkedItems + [(configName(inheritsFrom(configFile >> "CfgVehicles" >> (typeOf (unitBackpack  _unit)))))];
						{
							if(_x in SQU_handWeapons)then{_weapons = _weapons + [_x]};
							if(_x in SQU_Rifles)then{_weapons = _weapons + [_x]};
							if(_x in SQU_Launchers)then{_weapons = _weapons + [_x]};
							if(_x in SQU_magazines)then{_magazines = _magazines + [_x]};
							if(_x in SQU_gernades)then{_magazines = _magazines + [_x]};	
							if(_x in SQU_accessories)then{_linkedItems = _linkedItems + [_x]};
							if(_x in SQU_vests)then{_linkedItems = _linkedItems + [_x]};
							//if(_x in SQU_clothes) then {_linkedItems = _linkedItems + [_x]};							
							if(_x in SQU_backpacks)then{_linkedItems = _linkedItems + [_x]};														
						}foreach (backpackItems _unit);
						SQU_FilledBackpack set[count SQU_FilledBackpack,_backpack];
						SQU_FilledBackpackItems set[count SQU_FilledBackpackItems,(backpackItems _unit)];								
						deleteVehicle _unit; 
						deleteGroup _group; 
					};					

        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_handWeaponsCfg select _foreachIndex)select 0)}}forEach SQU_handWeapons}forEach _weapons;
        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_RiflesCfg select _foreachIndex)select 0)}}forEach SQU_Rifles}forEach _weapons;
        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_LaunchersCfg select _foreachIndex)select 0)}}forEach SQU_Launchers}forEach _weapons;
        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories}forEach _weapons;        	
        	
         	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_magazinesCfg select _foreachIndex)select 0)}}forEach SQU_magazines}forEach _magazines;
        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_gernadesCfg select _foreachIndex)select 0)}}forEach SQU_gernades}forEach _magazines; 
        	      	
         	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories}forEach _linkedItems;
         	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_accessoriesCfg select _foreachIndex)select 0)}}forEach SQU_accessories}forEach _Items; 
        	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_vestsCfg select _foreachIndex)select 0)}}forEach SQU_vests}forEach _linkedItems;           	  
         	{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_backpacksCfg select _foreachIndex)select 0)}}forEach SQU_backpacks}forEach _linkedItems;
         	//{_weap = _x;{if(_x == _weap)then{_price = _price + ((SQU_clothesCfg select _foreachIndex)select 0)}}forEach SQU_clothes}forEach _linkedItems;         	
         	
         	//if("B_Soldier_F" == (configName _item))then{player sidechat format["%1",(_weapons+_magazines+_linkedItems+_Items)]};
         	       	      	
					if(_price > SQU_MostExpensiveUnit)then{SQU_MostExpensiveUnit = _price};    	  	
        	_displayName = getText (_item >> "displayName");
     	    SQU_soldiersW = SQU_soldiersW + [configName _item];        	
          SQU_soldiersCfgW = SQU_soldiersCfgW + [[_price, configName _item]];
					if(((_threat select 1) >= .3) || ((_threat select 2) >= .3))then{SQU_Soft_InfW = SQU_Soft_InfW + [((count SQU_soldiersW) - 1)]};
					if((_threat select 1) > .5)then{SQU_Armour_InfW = SQU_Armour_InfW + [((count SQU_soldiersW) - 1)]};				
					if((_threat select 2) > .5)then{SQU_Air_InfW = SQU_Air_InfW + [((count SQU_soldiersW) - 1)]};        
				};				
			};
		};
	};
};
//cars soft
_count =  count (configFile >> "CfgVehicles");
for "_x" from 0 to (_count-1) do
{
	
  _item=((configFile >> "CfgVehicles") select _x);
  if (isClass _item) then
  {
    if (getNumber (_item >> "scope") == 2) then  
    {
      if ( ((configName _item)isKindOf "Car") && ((configName _item) != "O_Truck_02_fuel_F") && ((configName _item) != "B_Truck_01_fuel_F") && ((configName _item) != "B_G_Van_01_fuel_F")
      && ((configName _item) != "B_Truck_01_mover_F") && ((configName _item) != "O_Truck_03_fuel_F") && ((configName _item) != "O_Truck_03_device_F") && ((configName _item) != "O_Truck_02_medical_F")
      && ((configName _item) != "O_Truck_02_Ammo_F") ) then  
      {
      	if ((getNumber (_item >> "side") == SQU_east ) && (getText (_item >> "faction") == "OPF_F"))then 
    	  {
     	  	_price = 0;
     	  	_priceIron = 0;   
					_threat = getArray(_item >> "threat");
					_Support = getText(_item >> "vehicleClass");     	  	  	  	   	  	
        	_displayName = getText (_item >> "displayName");
         	_price = ((getNumber (_item >> "cost"))/100);
         	_mag = (getArray (_item >> "Turrets" >> "MainTurret">> "magazines"));
         	_armor = (getNumber (_item >> "armor"));
         	_mapSize = (getNumber (_item >> "mapSize"));
         	_priceIron = ((round((_armor * _mapSize)*3))/100000);
         	_price = round _price;
         	_price = _price + _priceIron;

		         	
        	if((count _mag) > 0)then
        	{
        		_ammo = (getText(configFile >> "CfgMagazines" >> (_mag select 0) >> "ammo"));
          	if(_ammo != "")then
          	{
          		_price = _price +  (getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")); 
          	};
          };
    	
          SQU_carsE = SQU_carsE + [configName _item];
          SQU_carsCfgE = SQU_carsCfgE + [[_price, configName _item]];
					if((_threat select 0) > .8)then{SQU_Soft_CarE = SQU_Soft_CarE + [((count SQU_carsE) - 1)]};
					if((_threat select 1) > .5)then{SQU_Armour_CarE = SQU_Armour_CarE + [((count SQU_carsE) - 1)]};			
					if((_threat select 2) > .5)then{SQU_Air_CarE = SQU_Air_CarE + [((count SQU_carsE) - 1)]};	
					if(_Support == "Support")then{SQU_Trans_CarE = SQU_Trans_CarE + [((count SQU_carsE) - 1)]};        
				};
      	if  ((getNumber (_item >> "side") == SQU_west ) && (getText (_item >> "faction") == "BLU_F")) then 
    	  {
     	  	_price = 0;
     	  	_priceIron = 0;   
     	  	_threat = getArray(_item >> "threat");  
					_Support = getText(_item >> "vehicleClass");      	  	 	  	   	  	
        	_displayName = getText (_item >> "displayName");
         	_price = ((getNumber (_item >> "cost"))/100);
         	_mag = (getArray (_item >> "Turrets" >> "MainTurret">> "magazines"));
         	_armor = (getNumber (_item >> "armor"));
         	_mapSize = (getNumber (_item >> "mapSize"));
         	_priceIron = ((round((_armor * _mapSize)*3))/100000);
         	_price = round _price;
         	_price = _price + _priceIron;

										
        	if((count _mag) > 0)then
        	{
        		_ammo = (getText(configFile >> "CfgMagazines" >> (_mag select 0) >> "ammo"));
          	if(_ammo != "")then
          	{
          		_price = _price +  (getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")); 
          	};
          };
    	
          SQU_carsW = SQU_carsW + [configName _item];
          SQU_carsCfgW = SQU_carsCfgW + [[_price, configName _item]];
					if((_threat select 0) > .8)then{SQU_Soft_CarW = SQU_Soft_CarW + [((count SQU_carsW) - 1)]}; 
					if((_threat select 1) > .5)then{SQU_Armour_CarW = SQU_Armour_CarW + [((count SQU_carsW) - 1)]}; 				
					if((_threat select 2) > .5)then{SQU_Air_CarW = SQU_Air_CarW + [((count SQU_carsW) - 1)]}; 
					if(_Support == "Support")then{SQU_Trans_CarW = SQU_Trans_CarW + [((count SQU_carsW) - 1)]};        
				};				
			};
		};
	};
};

//Tanks
_count =  count (configFile >> "CfgVehicles");
for "_x" from 0 to (_count-1) do
{
	
  _item=((configFile >> "CfgVehicles") select _x);
  if (isClass _item) then
  {
    if (getNumber (_item >> "scope") == 2) then  
    {
      if ((configName _item)isKindOf "Tank") then  
      {
      	if ((getNumber (_item >> "side") == SQU_east ) && (getText (_item >> "faction") == "OPF_F"))then 
    	  {
     	  	_price = 0;
     	  	_priceIron = 0;  
     	  	_threat = getArray(_item >> "threat");  
     	  	_seats = getNumber(_item >> "transportSoldier");  	  	   	  	
        	_displayName = getText (_item >> "displayName");
         	_price = ((getNumber (_item >> "cost"))/100);
         	_mag = (getArray (_item >> "Turrets" >> "MainTurret">> "magazines"));
         	_armor = (getNumber (_item >> "armor"));
         	_mapSize = (getNumber (_item >> "mapSize"));
         	_priceIron = ((round((_armor * _mapSize)*3))/100000);
         	_price = round _price;
         	_price = _price + _priceIron;

					         	
        	if((count _mag) > 0)then
        	{
        		_ammo = (getText(configFile >> "CfgMagazines" >> (_mag select 0) >> "ammo"));
          	if(_ammo != "")then
          	{
          		_price = _price +  (getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")); 
          	};
          };
    	
          SQU_TanksE = SQU_TanksE + [configName _item];
          SQU_TanksCfgE = SQU_TanksCfgE + [[_price, configName _item]];
					if((_threat select 0) > .8)then{SQU_Soft_TankE = SQU_Soft_TankE + [((count SQU_TanksE) - 1)]};
					if((_threat select 1) > .5)then{SQU_Armour_TankE = SQU_Armour_TankE + [((count SQU_TanksE) - 1)]};				
					if((_threat select 2) > .5)then{SQU_Air_TankE = SQU_Air_TankE + [((count SQU_TanksE) - 1)]};	
					if(_seats > 7)then{SQU_Trans_TankE = SQU_Trans_TankE + [((count SQU_TanksE) - 1)]};          
				};
      	if  ((getNumber (_item >> "side") == SQU_west ) && (getText (_item >> "faction") == "BLU_F")) then 
    	  {
     	  	_price = 0;
     	  	_priceIron = 0;   
     	  	_threat = getArray(_item >> "threat");   	
     	  	_seats = getNumber(_item >> "transportSoldier");  	   	  	
        	_displayName = getText (_item >> "displayName");
         	_price = ((getNumber (_item >> "cost"))/100);
         	_mag = (getArray (_item >> "Turrets" >> "MainTurret">> "magazines"));
         	_armor = (getNumber (_item >> "armor"));
         	_mapSize = (getNumber (_item >> "mapSize"));
         	_priceIron = ((round((_armor * _mapSize)*3))/100000);
         	_price = round _price;
         	_price = _price + _priceIron;
					
        	if((count _mag) > 0)then
        	{
        		_ammo = (getText(configFile >> "CfgMagazines" >> (_mag select 0) >> "ammo"));
          	if(_ammo != "")then
          	{
          		_price = _price +  (getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")); 
          	};
          };
    	
          SQU_TanksW = SQU_TanksW + [configName _item];
          SQU_TanksCfgW = SQU_TanksCfgW + [[_price, configName _item]];
					if((_threat select 0) > .8)then{SQU_Soft_TankW = SQU_Soft_TankW + [((count SQU_TanksW) - 1)]};
					if((_threat select 1) > .5)then{SQU_Armour_TankW = SQU_Armour_TankW + [((count SQU_TanksW) - 1)]};					
					if((_threat select 2) > .5)then{SQU_Air_TankW = SQU_Air_TankW + [((count SQU_TanksW) - 1)]};
					if(_seats > 7)then{SQU_Trans_TankW = SQU_Trans_TankW + [((count SQU_TanksW) - 1)]};      
				};				
			};
		};
	};
};

//air
_count =  count (configFile >> "CfgVehicles");
for "_x" from 0 to (_count-1) do
{
  _item=((configFile >> "CfgVehicles") select _x);
  if (isClass _item) then
  {
  	if ((configName _item)isKindOf "Air" )then
  	{
      if (getNumber (_item >> "scope") == 2) then  
      {
      	if ((getNumber (_item >> "side") == SQU_east ) && (getText (_item >> "faction") == "OPF_F"))then 
    	  {
     	  	_price = 0; 
     	  	_priceIron = 0;	  	
     	  	_threat = getArray(_item >> "threat"); 
     	  	_seats = getNumber(_item >> "transportSoldier");
        	_displayName = getText (_item >> "displayName");
         	_price = ((getNumber (_item >> "cost"))/200);
         	_magnames = (getArray (_item >> "magazines"));
         	_armor = (getNumber (_item >> "armor"));
         	_mapSize = (getNumber (_item >> "mapSize"));
         	_priceIron = ((round((_armor * _mapSize)*3))/100000);
         //		player globalchat format["_priceIron = %1",_priceIron];	
         	_price = round _price;
					         	         	
        	if((count _magnames) > 0)then
        	{
          	{
          		_ammo = getText(configFile >> "CfgMagazines" >> _x >> "ammo");
          	 _price = _price  + ((getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit") + getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")));
          	}foreach _magnames;
          };
         	_price = _price + _priceIron;
          SQU_AirCraftE = SQU_AirCraftE + [configName _item];
          SQU_AirCraftCfgE = SQU_AirCraftCfgE + [[_price, configName _item]]; 

					if((_threat select 0) > .8)then{SQU_Soft_AirE = SQU_Soft_AirE + [((count SQU_AirCraftE) - 1)]}; 
					if((_threat select 1) > .5)then{SQU_Armour_AirE = SQU_Armour_AirE + [((count SQU_AirCraftE) - 1)]}; 		
					if((_threat select 2) > .5)then{SQU_Air_AirE = SQU_Air_AirE + [((count SQU_AirCraftE) - 1)]}; 
					if(_seats > 5)then{SQU_Trans_AirE = SQU_Trans_AirE + [((count SQU_AirCraftE) - 1)]};        
				};
      	if  ((getNumber (_item >> "side") == SQU_west ) && (getText (_item >> "faction") == "BLU_F")) then 
    	  {
     	  	_price = 0; 
     	  	_priceIron = 0;	  	
     	  	_threat = getArray(_item >> "threat");
     	  	_seats = getNumber(_item >> "transportSoldier"); 
        	_displayName = getText (_item >> "displayName");
        	if((configName _item) == "B_Heli_Light_01_F")then
        	{
         		_price = ((getNumber (_item >> "cost"))/1300)
         	}else{
         		_price = ((getNumber (_item >> "cost"))/200)
         	};
         	_magnames = (getArray (_item >> "magazines"));
         	_armor = (getNumber (_item >> "armor"));
         	_mapSize = (getNumber (_item >> "mapSize"));
         	_priceIron = ((round((_armor * _mapSize)*3))/100000);
         	_price = round _price;
         	
         	         	
        	if((count _magnames) > 0)then
        	{
          	{
          		_ammo = getText(configFile >> "CfgMagazines" >> _x >> "ammo");
          	 _price = _price  + ((getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit") + getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")));
          	}foreach _magnames;
          };
         	_price = _price + _priceIron;
          SQU_AirCraftW = SQU_AirCraftW + [configName _item];
          SQU_AirCraftCfgW = SQU_AirCraftCfgW + [[_price, configName _item]]; 
					if((_threat select 0) > .8)then{SQU_Soft_AirW = SQU_Soft_AirW + [((count SQU_AirCraftW) - 1)]};  
					if((_threat select 1) > .5)then{SQU_Armour_AirW = SQU_Armour_AirW + [((count SQU_AirCraftW) - 1)]};  				
					if((_threat select 2) > .5)then{SQU_Air_AirW = SQU_Air_AirW + [((count SQU_AirCraftW) - 1)]};  
					if(_seats > 5)then{SQU_Trans_AirW = SQU_Trans_AirW + [((count SQU_AirCraftW) - 1)]};            
				};				
			};
		};
	};
};


// Ships
_count =  count (configFile >> "CfgVehicles");
for "_x" from 0 to (_count-1) do
{
  _item=((configFile >> "CfgVehicles") select _x);
  if (isClass _item) then
  {
  	if (((configName _item)isKindOf "Ship" ) && (getText(_item >> "vehicleClass") != "Submarine"))then
  	{
      if (getNumber (_item >> "scope") == 2) then  
      {
      	if ((getNumber (_item >> "side") == SQU_east ) && (getText (_item >> "faction") == "OPF_F"))then 
    	  {
     	  	_price = 0;  
     	  	_priceIron = 0;	 
     	  	_threat = getArray(_item >> "threat");   
     	  	_seats = getNumber(_item >> "transportSoldier");  	  	 	  	
        	_displayName = getText (_item >> "displayName");
         	_price = ((getNumber (_item >> "cost"))/60);
         	_mags = (getArray (_item >> "Turrets" >> "FrontTurret">> "magazines"));
         	_mags = _mags + (getArray (_item >> "Turrets" >> "RearTurret">> "magazines"));
         	//_price = _price * (getNumber (_item >> "armor"));
         	_armor = (getNumber (_item >> "armor"));
         	_mapSize = (getNumber (_item >> "mapSize"));
         	_priceIron = ((round((_armor * _mapSize)*3))/100000);
         	_price = round _price;

					
        	if((count _mags) > 0)then
        	{
        		{
        		_ammo = (getText(configFile >> "CfgMagazines" >> _x >> "ammo"));
          	if(_ammo != "")then
          	{
          		_price = _price + (((getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")))*10); 
          	};
        	  }foreach _mags;
          };
         	_price = _price + _priceIron;
          SQU_ShipsE = SQU_ShipsE + [configName _item];        	 	
          SQU_ShipsCfgE = SQU_ShipsCfgE + [[_price,configName _item]]; 
					if((_threat select 0) > .8)then{SQU_Soft_ShipE = SQU_Soft_ShipE + [((count SQU_ShipsE) - 1)]}; 
					if((_threat select 1) > .5)then{SQU_Armour_ShipE = SQU_Armour_ShipE + [((count SQU_ShipsE) - 1)]}; 					
					if((_threat select 2) > .5)then{SQU_Air_ShipE = SQU_Air_ShipE + [((count SQU_ShipsE) - 1)]}; 
					if(_seats > 7)then{SQU_Trans_ShipE = SQU_Trans_ShipE + [((count SQU_ShipsE) - 1)]};      
				};
      	if  ((getNumber (_item >> "side") == SQU_west ) && (getText (_item >> "faction") == "BLU_F")) then 
    	  {
     	  	_price = 0;  
     	  	_priceIron = 0;	  
     	  	_threat = getArray(_item >> "threat");  
     	  	_seats = getNumber(_item >> "transportSoldier");  	  	 	  	
        	_displayName = getText (_item >> "displayName");
         	_price = ((getNumber (_item >> "cost"))/60);
         	_mags = (getArray (_item >> "Turrets" >> "FrontTurret">> "magazines"));
         	_mags = _mags + (getArray (_item >> "Turrets" >> "RearTurret">> "magazines"));
         //	_price = _price * (getNumber (_item >> "armor"));
         	_armor = (getNumber (_item >> "armor"));
         	_mapSize = (getNumber (_item >> "mapSize"));
         	_priceIron = ((round((_armor * _mapSize)*3))/100000);
         	_price = round _price;

					         	         	
        	if((count _mags) > 0)then
        	{
        		{
        		_ammo = (getText(configFile >> "CfgMagazines" >> _x >> "ammo"));
          	if(_ammo != "")then
          	{
          		_price = _price + (((getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")))*10); 
          	};
        	  }foreach _mags;
          };
         	_price = _price + _priceIron;
          SQU_ShipsW = SQU_ShipsW + [configName _item];        	 	
          SQU_ShipsCfgW = SQU_ShipsCfgW + [[_price,configName _item]]; 
					if((_threat select 0) > .8)then{SQU_Soft_ShipW = SQU_Soft_ShipW + [((count SQU_ShipsW) - 1)]}; 
					if((_threat select 1) > .5)then{SQU_Armour_ShipW = SQU_Armour_ShipW + [((count SQU_ShipsW) - 1)]}; 				
					if((_threat select 2) > .5)then{SQU_Air_ShipW = SQU_Air_ShipW + [((count SQU_ShipsW) - 1)]}; 	
					if(_seats > 7)then{SQU_Trans_ShipW = SQU_Trans_ShipW + [((count SQU_ShipsW) - 1)]};          
				};				
			};
		};
	};
};


// Statics
_count =  count (configFile >> "CfgVehicles");
for "_x" from 0 to (_count-1) do
{
  _item=((configFile >> "CfgVehicles") select _x);
  if (isClass _item) then
  {
  	if (((configName _item)isKindOf "StaticWeapon" )||((configName _item)isKindOf "Shelter_base_F"))then
  	{
      if (getNumber (_item >> "scope") == 2) then  
      {
      	if ((getNumber (_item >> "side") == SQU_east ) && (getText (_item >> "faction") == "OPF_F"))then 
    	  {
     	  	_price = 0;  
        	_displayName = getText (_item >> "displayName");
         	_price = ((getNumber (_item >> "cost"))/60);
         	_mags = (getArray (_item >> "Turrets" >> "MainTurret">> "magazines"));
         	_price = round _price;

        	if((count _mags) > 0)then
        	{
        		{
        		_ammo = (getText(configFile >> "CfgMagazines" >> _x >> "ammo"));
          	if(_ammo != "")then
          	{
          		_price = _price + (((getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")))*10); 
          	};
        	  }foreach _mags;
          };
         	_price = _price;
          SQU_StaticsE = SQU_StaticsE + [configName _item];        	 	
          SQU_StaticsCfgE = SQU_StaticsCfgE + [[_price,configName _item]]; 
				};
      	if  ((getNumber (_item >> "side") == SQU_west ) && (getText (_item >> "faction") == "BLU_F")) then 
    	  {
     	  	_price = 0;  
        	_displayName = getText (_item >> "displayName");
         	_price = ((getNumber (_item >> "cost"))/60);
         	_mags = (getArray (_item >> "Turrets" >> "MainTurret">> "magazines"));
         	_price = round _price;
         	         	
        	if((count _mags) > 0)then
        	{
        		{
        		_ammo = (getText(configFile >> "CfgMagazines" >> _x >> "ammo"));
          	if(_ammo != "")then
          	{
          		_price = _price + (((getNumber(configFile >> "cfgAmmo" >> _ammo >> "hit")) + (getNumber(configFile >> "cfgAmmo" >> _ammo >> "indirecthit")))*10); 
          	};
        	  }foreach _mags;
          };
         	_price = _price;
          SQU_StaticsW = SQU_StaticsW + [configName _item];        	 	
          SQU_StaticsCfgW = SQU_StaticsCfgW + [[_price,configName _item]]; 
				};				
			};
		};
	};
};
SQU_PricesFinished = true;

 

 

Share this post


Link to post
Share on other sites

fyi personal arsenal still lets you bypass this system, as everything not defined is free and available.  I use a script to kill the player if they use PA, so it can be dealt with.....

Share this post


Link to post
Share on other sites

@gc8 Thanks for the side selective code, I'll add it to the options of the addArsenal function! About the problem with the base weapons: Filtering the input array for the base weapons turns out to be more comlicated than I thought. The main problem is that even a different skin on the weapon will mark it as a variant of the uncolored variant. I might have a new idea about addressing this issue but that remains to be seen.

 

@squeeze Uff that's a lot of code :icon1: I will have to adjust it so it fits the system and this might take a while :upside:

 

15 hours ago, accuracythruvolume said:

fyi personal arsenal still lets you bypass this system

Err what exactly is this PA? The current version should also lock any items that can be added to a container if they are not defined, so the items in the left lists will still show up. Maybe adding a limited arsenal might help?

["AmmoboxInit",[_crate,false,{true}]] spawn BIS_fnc_arsenal;

 

  • Thanks 1

Share this post


Link to post
Share on other sites

@7erra I Think I just found something.. not sure but the weapon configs have "baseWeapon" variable. So maybe you could try this:

 

_testConf = configfile >> "CfgWeapons" >> "arifle_Mk20_F";

if((configname _testConf) == (getText(_testConf >> "baseWeapon"))) then
{
 systemchat "Base weapon!";
};

 

Find all base weapons:

 

_weapons = configFile >> "CfgWeapons";
{
if((configname _x) == (getText(_x >> "baseWeapon"))) then
{
 diag_log format["Base weapon found: %1 - %2", configname _x,getText(_x >> "baseWeapon")];
};
} forEach ("(getNumber (_x >> 'scope')) > 0" configClasses _weapons);

 

 

Edited by gc8
Loop to find all base weapons
  • Like 1

Share this post


Link to post
Share on other sites

Nice find @gc8! I was going another way with

if (!isClass(_weaponCfg>>"LinkedItems")) then {"base weapon"};

But your method even gets the name of the base weapon.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×