#include <macro.h>
/*
	File: fn_updateRequest.sqf
	Author: Tonic
*/
private["_packet","_array","_flag"];
_packet = [getPlayerUID player,(profileName),playerSide,CASH,BANK];
_array = [];
_flag = switch(playerSide) do {case west: {"cop"}; case civilian: {"civ"}; case independent: {"med"}; case east: {"adac"};};

{
	_varName = LICENSE_VARNAME(configName _x,_flag);
	_array pushBack [_varName,LICENSE_VALUE(configName _x,_flag)];
} foreach (format["getText(_x >> 'side') isEqualTo '%1'",_flag] configClasses (missionConfigFile >> "Licenses"));

_packet pushBack _array;

[] call life_fnc_saveGear;
_packet pushBack life_gear;
switch (playerSide) do {
	case civilian: {
		_packet pushBack life_is_arrested;
	};
};
_stats = [100 - (getdammage player *100), life_hunger, life_thirst, life_battery]; // 0.1 * 100 = 10 -100 = 90
switch(playerside) do {
	case west: {
		ALLSTATS set [0,_stats];
	};
	case civilian: {
		ALLSTATS set [1,_stats];
	};
	case independent: {
		ALLSTATS set [2,_stats];
	};
	case east: {
		ALLSTATS set [3,_stats];
	};
};

_packet pushback ALLSTATS;
[_packet,"DB_fnc_updateRequest",false,false] call life_fnc_MP;