initial commit

This commit is contained in:
Benjamin Kyd
2019-06-05 00:45:50 +01:00
commit c8014ec81e
610 changed files with 177002 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#include "..\..\script_macros.hpp"
/*
File: fn_dataQuery.sqf
Author: Bryan "Tonic" Boardwine
Description:
Starts the 'authentication' process and sends a request out to
the server to check for player information.
*/
private ["_uid","_side","_sender"];
if (life_session_completed) exitWith {}; //Why did this get executed when the client already initialized? Fucking arma...
_sender = player;
_uid = getPlayerUID _sender;
_side = playerSide;
cutText[format [localize "STR_Session_Query",_uid],"BLACK FADED"];
0 cutFadeOut 999999999;
if (life_HC_isActive) then {
[_uid,_side,_sender] remoteExec ["HC_fnc_queryRequest",HC_Life];
} else {
[_uid,_side,_sender] remoteExec ["DB_fnc_queryRequest",RSERV];
};

View File

@@ -0,0 +1,31 @@
#include "..\..\script_macros.hpp"
/*
File: fn_insertPlayerInfo.sqf
Author: Bryan "Tonic" Boardwine
Description:
Upon first join inital player data is sent to the server and added to the database.
Setup data gets sent to life_server\Functions\MySQL\fn_insertRequest.sqf
*/
if (life_session_completed) exitWith {}; //Why did this get executed when the client already initialized? Fucking arma...
cutText[localize "STR_Session_QueryFail","BLACK FADED"];
0 cutFadeOut 9999999;
private ["_bank"];
switch (playerSide) do {
case west: {
_bank = LIFE_SETTINGS(getNumber,"bank_cop");
};
case civilian: {
_bank = LIFE_SETTINGS(getNumber,"bank_civ");
};
case independent: {
_bank = LIFE_SETTINGS(getNumber,"bank_med");
};
};
if (life_HC_isActive) then {
[getPlayerUID player,profileName,CASH,_bank,player] remoteExecCall ["HC_fnc_insertRequest",HC_Life];
} else {
[getPlayerUID player,profileName,CASH,_bank,player] remoteExecCall ["DB_fnc_insertRequest",RSERV];
};

View File

@@ -0,0 +1,113 @@
#include "..\..\script_macros.hpp"
/*
File: fn_requestReceived.sqf
Author: Bryan "Tonic" Boardwine
Description:
Called by the server saying that we have a response so let's
sort through the information, validate it and if all valid
set the client up.
*/
private _count = count _this;
life_session_tries = life_session_tries + 1;
if (life_session_completed) exitWith {}; //Why did this get executed when the client already initialized? Fucking arma...
if (life_session_tries > 3) exitWith {cutText[localize "STR_Session_Error","BLACK FADED"]; 0 cutFadeOut 999999999;};
0 cutText [localize "STR_Session_Received","BLACK FADED"];
0 cutFadeOut 9999999;
//Error handling and junk..
if (isNil "_this") exitWith {[] call SOCK_fnc_insertPlayerInfo;};
if (_this isEqualType "") exitWith {[] call SOCK_fnc_insertPlayerInfo;};
if (count _this isEqualTo 0) exitWith {[] call SOCK_fnc_insertPlayerInfo;};
if ((_this select 0) isEqualTo "Error") exitWith {[] call SOCK_fnc_insertPlayerInfo;};
if (!(getPlayerUID player isEqualTo (_this select 0))) exitWith {[] call SOCK_fnc_dataQuery;};
//Lets make sure some vars are not set before hand.. If they are get rid of them, hopefully the engine purges past variables but meh who cares.
if (!isServer && (!isNil "life_adminlevel" || !isNil "life_coplevel" || !isNil "life_donorlevel")) exitWith {
[profileName,getPlayerUID player,"VariablesAlreadySet"] remoteExecCall ["SPY_fnc_cookieJar",RSERV];
[profileName,format ["Variables set before client initialization...\nlife_adminlevel: %1\nlife_coplevel: %2\nlife_donorlevel: %3",life_adminlevel,life_coplevel,life_donorlevel]] remoteExecCall ["SPY_fnc_notifyAdmins",RCLIENT];
sleep 0.9;
failMission "SpyGlass";
};
//Parse basic player information.
CASH = parseNumber (_this select 2);
BANK = parseNumber (_this select 3);
CONST(life_adminlevel,(_this select 4));
if (LIFE_SETTINGS(getNumber,"donor_level") isEqualTo 1) then {
CONST(life_donorlevel,(_this select 5));
} else {
CONST(life_donorlevel,0);
};
//Loop through licenses
if (count (_this select 6) > 0) then {
{missionNamespace setVariable [(_x select 0),(_x select 1)];} forEach (_this select 6);
};
life_gear = _this select 8;
[true] call life_fnc_loadGear;
//Parse side specific information.
switch (playerSide) do {
case west: {
CONST(life_coplevel,(_this select 7));
CONST(life_medicLevel,0);
life_blacklisted = _this select 9;
if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then {
life_hunger = ((_this select 10) select 0);
life_thirst = ((_this select 10) select 1);
player setDamage ((_this select 10) select 2);
};
};
case civilian: {
life_is_arrested = _this select 7;
CONST(life_coplevel, 0);
CONST(life_medicLevel, 0);
life_houses = _this select (_count - 3);
if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then {
life_hunger = ((_this select 9) select 0);
life_thirst = ((_this select 9) select 1);
player setDamage ((_this select 9) select 2);
};
//Position
if (LIFE_SETTINGS(getNumber,"save_civilian_position") isEqualTo 1) then {
life_is_alive = _this select 10;
life_civ_position = _this select 11;
if (life_is_alive) then {
if !(count life_civ_position isEqualTo 3) then {diag_log format ["[requestReceived] Bad position received. Data: %1",life_civ_position];life_is_alive =false;};
if (life_civ_position distance (getMarkerPos "respawn_civilian") < 300) then {life_is_alive = false;};
};
};
{
_house = nearestObject [(call compile format ["%1",(_x select 0)]), "House"];
life_vehicles pushBack _house;
} forEach life_houses;
life_gangData = _this select (_count - 2);
if (!(count life_gangData isEqualTo 0)) then {
[] spawn life_fnc_initGang;
};
[] spawn life_fnc_initHouses;
};
case independent: {
CONST(life_medicLevel,(_this select 7));
CONST(life_coplevel,0);
if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then {
life_hunger = ((_this select 9) select 0);
life_thirst = ((_this select 9) select 1);
player setDamage ((_this select 9) select 2);
};
};
};
if (count (_this select (_count - 1)) > 0) then {
{life_vehicles pushBack _x;} forEach (_this select (_count - 1));
};
life_session_completed = true;

View File

@@ -0,0 +1,19 @@
#include "..\..\script_macros.hpp"
/*
File: fn_syncData.sqf
Author: Bryan "Tonic" Boardwine"
Description:
Used for player manual sync to the server.
*/
_fnc_scriptName = "Player Synchronization";
if (isNil "life_session_time") then {life_session_time = false;};
if (life_session_time) exitWith {hint localize "STR_Session_SyncdAlready";};
[] call SOCK_fnc_updateRequest;
hint localize "STR_Session_SyncData";
[] spawn {
life_session_time = true;
sleep (5 * 60);
life_session_time = false;
};

View File

@@ -0,0 +1,63 @@
#include "..\..\script_macros.hpp"
/*
File: fn_updatePartial.sqf
Author: Bryan "Tonic" Boardwine
Description:
Sends specific information to the server to update on the player,
meant to keep the network traffic down with large sums of data flowing
through remoteExec
*/
private ["_mode","_packet","_array","_flag"];
_mode = param [0,0,[0]];
_packet = [getPlayerUID player,playerSide,nil,_mode];
_array = [];
_flag = switch (playerSide) do {case west: {"cop"}; case civilian: {"civ"}; case independent: {"med"};};
switch (_mode) do {
case 0: {
_packet set[2,CASH];
};
case 1: {
_packet set[2,BANK];
};
case 2: {
{
_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 set[2,_array];
};
case 3: {
[] call life_fnc_saveGear;
_packet set[2,life_gear];
};
case 4: {
_packet set[2,life_is_alive];
_packet set[4,getPosATL player];
};
case 5: {
_packet set[2,life_is_arrested];
};
case 6: {
_packet set[2,CASH];
_packet set[4,BANK];
};
case 7: {
// Tonic is using for keychain..?
};
};
if (life_HC_isActive) then {
_packet remoteExecCall ["HC_fnc_updatePartial",HC_Life];
} else {
_packet remoteExecCall ["DB_fnc_updatePartial",RSERV];
};

View File

@@ -0,0 +1,44 @@
#include "..\..\script_macros.hpp"
/*
File: fn_updateRequest.sqf
Author: Tonic
Description:
Passes ALL player information to the server to save player data to the database.
*/
private ["_packet","_array","_flag","_alive","_position"];
_packet = [getPlayerUID player,(profileName),playerSide,CASH,BANK];
_array = [];
_alive = alive player;
_position = getPosATL player;
_flag = switch (playerSide) do {case west: {"cop"}; case civilian: {"civ"}; case independent: {"med"};};
{
_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;
_array = [];
_array pushBack life_hunger;
_array pushBack life_thirst;
_array pushBack (damage player);
_packet pushBack _array;
switch (playerSide) do {
case civilian: {
_packet pushBack life_is_arrested;
_packet pushBack _alive;
_packet pushBack _position;
};
};
if (life_HC_isActive) then {
_packet remoteExecCall ["HC_fnc_updateRequest",HC_Life];
} else {
_packet remoteExecCall ["DB_fnc_updateRequest",RSERV];
};