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,97 @@
/*
File: fn_wantedAdd.sqf
Author: Bryan "Tonic" Boardwine"
Database Persistence By: ColinM
Assistance by: Paronity
Stress Tests by: Midgetgrimm
This file is for Nanou's HeadlessClient.
Description:
Adds or appends a unit to the wanted list.
*/
private ["_uid","_type","_index","_data","_crime","_val","_customBounty","_name","_pastCrimes","_query","_queryResult"];
_uid = [_this,0,"",[""]] call BIS_fnc_param;
_name = [_this,1,"",[""]] call BIS_fnc_param;
_type = [_this,2,"",[""]] call BIS_fnc_param;
_customBounty = [_this,3,-1,[0]] call BIS_fnc_param;
if (_uid isEqualTo "" || _type isEqualTo "" || _name isEqualTo "") exitWith {}; //Bad data passed.
//What is the crime?
switch (_type) do
{
case "187V": {_type = ["187V",650]};
case "187": {_type = ["187",2000]};
case "901": {_type = ["901",450]};
case "215": {_type = ["215",200]};
case "213": {_type = ["213",1000]};
case "211": {_type = ["211",100]};
case "207": {_type = ["207",350]};
case "207A": {_type = ["207A",200]};
case "390": {_type = ["390",1500]};
case "487": {_type = ["487",150]};
case "488": {_type = ["488",70]};
case "480": {_type = ["480",100]};
case "481": {_type = ["481",100]};
case "482": {_type = ["482",500]};
case "483": {_type = ["483",950]};
case "459": {_type = ["459",650]};
case "666": {_type = ["666",200]};
case "667": {_type = ["667",4500]};
case "668": {_type = ["668",1500]};
case "1": {_type = ["1",250]};
case "2": {_type = ["2",100]};
case "3": {_type = ["3",75]};
case "4": {_type = ["4",125]};
case "5": {_type = ["5",50]};
case "6": {_type = ["6",40]};
case "7": {_type = ["7",75]};
case "8": {_type = ["8",2500]};
case "9": {_type = ["9",2500]};
case "10": {_type = ["10",7500]};
case "11": {_type = ["11",5000]};
case "12": {_type = ["12",1250]};
case "13": {_type = ["13",750]};
case "14": {_type = ["14",250]};
case "15": {_type = ["15",1250]};
case "16": {_type = ["16",750]};
case "17": {_type = ["17",50]};
case "18": {_type = ["18",750]};
case "19": {_type = ["19",1250]};
case "20": {_type = ["20",250]};
case "21": {_type = ["21",250]};
case "22": {_type = ["22",1000]};
case "23": {_type = ["23",2500]};
case "24": {_type = ["24",5000]};
case "25": {_type = ["25",10000]};
default {_type = [];};
};
if (_type isEqualTo []) exitWith {}; //Not our information being passed...
//Is there a custom bounty being sent? Set that as the pricing.
if !(_customBounty isEqualTo -1) then {_type set[1,_customBounty];};
//Search the wanted list to make sure they are not on it.
_query = format ["SELECT wantedID FROM wanted WHERE wantedID='%1'",_uid];
_queryResult = [_query,2,true] call HC_fnc_asyncCall;
_val = [_type select 1] call HC_fnc_numberSafe;
_number = _type select 0;
if !(count _queryResult isEqualTo 0) then
{
_crime = format ["SELECT wantedCrimes, wantedBounty FROM wanted WHERE wantedID='%1'",_uid];
_crimeresult = [_crime,2] call HC_fnc_asyncCall;
_pastcrimess = [_crimeresult select 0] call HC_fnc_mresToArray;
if (_pastcrimess isEqualType "") then {_pastcrimess = call compile format ["%1", _pastcrimess];};
_pastCrimes = _pastcrimess;
_pastCrimes pushBack _number;
_pastCrimes = [_pastCrimes] call HC_fnc_mresArray;
_query = format ["UPDATE wanted SET wantedCrimes = '%1', wantedBounty = wantedBounty + '%2', active = '1' WHERE wantedID='%3'",_pastCrimes,_val,_uid];
[_query,1] call HC_fnc_asyncCall;
} else {
_crime = [_type select 0];
_crime = [_crime] call HC_fnc_mresArray;
_query = format ["INSERT INTO wanted (wantedID, wantedName, wantedCrimes, wantedBounty, active) VALUES('%1', '%2', '%3', '%4', '1')",_uid,_name,_crime,_val];
[_query,1] call HC_fnc_asyncCall;
};

View File

@@ -0,0 +1,33 @@
/*
File: fn_wantedBounty.sqf
Author: Bryan "Tonic" Boardwine"
Database Persistence By: ColinM
Assistance by: Paronity
Stress Tests by: Midgetgrimm
This file is for Nanou's HeadlessClient.
Description:
Checks if the person is on the bounty list and awards the cop for killing them.
*/
private ["_civ","_cop","_id","_half","_result","_queryResult","_amount"];
_uid = [_this,0,"",[""]] call BIS_fnc_param;
_civ = [_this,1,objNull,[objNull]] call BIS_fnc_param;
_cop = [_this,2,objNull,[objNull]] call BIS_fnc_param;
_half = [_this,3,false,[false]] call BIS_fnc_param;
if (isNull _civ || isNull _cop) exitWith {};
_query = format ["SELECT wantedID, wantedName, wantedCrimes, wantedBounty FROM wanted WHERE active='1' AND wantedID='%1'",_uid];
_queryResult = [_query,2] call HC_fnc_asyncCall;
if !(count _queryResult isEqualTo 0) then
{
_amount = _queryResult select 3;
if !(_amount isEqualTo 0) then {
if (_half) then {
[((_amount) / 2),_amount] remoteExecCall ["life_fnc_bountyReceive",_cop];
} else {
[_amount,_amount] remoteExecCall ["life_fnc_bountyReceive",_cop];
};
};
};

View File

@@ -0,0 +1,80 @@
#include "\life_hc\hc_macros.hpp"
/*
File: fn_wantedCrimes.sqf
Author: ColinM
Assistance by: Paronity
Stress Tests by: Midgetgrimm
This file is for Nanou's HeadlessClient.
Description:
Grabs a list of crimes committed by a person.
*/
private ["_display","_criminal","_tab","_queryResult","_result","_ret","_crimesDb","_crimesArr","_type"];
disableSerialization;
_ret = [_this,0,objNull,[objNull]] call BIS_fnc_param;
_criminal = [_this,1,[],[]] call BIS_fnc_param;
_query = format ["SELECT wantedCrimes, wantedBounty FROM wanted WHERE active='1' AND wantedID='%1'",_criminal select 0];
_queryResult = [_query,2] call HC_fnc_asyncCall;
_crimesArr = [];
_type = [_queryResult select 0] call HC_fnc_mresToArray;
if (_type isEqualType "") then {_type = call compile format ["%1", _type];};
{
switch (_x) do
{
case "187V": {_x = "STR_Crime_187V"};
case "187": {_x = "STR_Crime_187"};
case "901": {_x = "STR_Crime_901"};
case "215": {_x = "STR_Crime_215"};
case "213": {_x = "STR_Crime_213"};
case "211": {_x = "STR_Crime_211"};
case "207": {_x = "STR_Crime_207"};
case "207A": {_x = "STR_Crime_207A"};
case "390": {_x = "STR_Crime_390"};
case "487": {_x = "STR_Crime_487"};
case "488": {_x = "STR_Crime_488"};
case "480": {_x = "STR_Crime_480"};
case "481": {_x = "STR_Crime_481"};
case "482": {_x = "STR_Crime_482"};
case "483": {_x = "STR_Crime_483"};
case "459": {_x = "STR_Crime_459"};
case "666": {_x = "STR_Crime_666"};
case "667": {_x = "STR_Crime_667"};
case "668": {_x = "STR_Crime_668"};
case "919": {_x = "STR_Crime_919"};
case "919A": {_x = "STR_Crime_919A"};
case "1": {_x = "STR_Crime_1"};
case "2": {_x = "STR_Crime_2"};
case "3": {_x = "STR_Crime_3"};
case "4": {_x = "STR_Crime_4"};
case "5": {_x = "STR_Crime_5"};
case "6": {_x = "STR_Crime_6"};
case "7": {_x = "STR_Crime_7"};
case "8": {_x = "STR_Crime_8"};
case "9": {_x = "STR_Crime_9"};
case "10": {_x = "STR_Crime_10"};
case "11": {_x = "STR_Crime_11"};
case "12": {_x = "STR_Crime_12"};
case "13": {_x = "STR_Crime_13"};
case "14": {_x = "STR_Crime_14"};
case "15": {_x = "STR_Crime_15"};
case "16": {_x = "STR_Crime_16"};
case "17": {_x = "STR_Crime_17"};
case "18": {_x = "STR_Crime_18"};
case "19": {_x = "STR_Crime_19"};
case "20": {_x = "STR_Crime_20"};
case "21": {_x = "STR_Crime_21"};
case "22": {_x = "STR_Crime_22"};
case "23": {_x = "STR_Crime_23"};
case "24": {_x = "STR_Crime_24"};
case "25": {_x = "STR_Crime_25"};
};
_crimesArr pushBack _x;
}forEach _type;
_queryResult set[0,_crimesArr];
[_queryResult] remoteExec ["life_fnc_wantedInfo",_ret];

View File

@@ -0,0 +1,49 @@
#include "\life_hc\hc_macros.hpp"
/*
File: fn_wantedFetch.sqf
Author: Bryan "Tonic" Boardwine"
Database Persistence By: ColinM
Assistance by: Paronity
Stress Tests by: Midgetgrimm
This file is for Nanou's HeadlessClient.
Description:
Displays wanted list information sent from the server.
*/
private ["_ret","_list","_result","_queryResult","_units","_inStatement"];
_ret = [_this,0,objNull,[objNull]] call BIS_fnc_param;
if (isNull _ret) exitWith {};
_inStatement = "";
_list = [];
_units = [];
{if ((side _x) isEqualTo civilian) then {_units pushBack (getPlayerUID _x)};} forEach playableUnits;
if (_units isEqualTo []) exitWith {[_list] remoteExec ["life_fnc_wantedList",_ret];};
{
if (count _units > 1) then {
if (_inStatement isEqualTo "") then {
_inStatement = "'" + _x + "'";
} else {
_inStatement = _inStatement + ", '" + _x + "'";
};
} else {
_inStatement = _x;
};
} forEach _units;
_query = format ["SELECT wantedID, wantedName FROM wanted WHERE active='1' AND wantedID in (%1)",_inStatement];
_queryResult = [_query,2,true] call HC_fnc_asyncCall;
diag_log format ["Query: %1",_query];
{
_list pushBack (_x);
}
forEach _queryResult;
if (_list isEqualTo []) exitWith {[_list] remoteExec ["life_fnc_wantedList",_ret];};
[_list] remoteExec ["life_fnc_wantedList",_ret];

View File

@@ -0,0 +1,21 @@
/*
File: fn_wantedPerson.sqf
Author: Bryan "Tonic" Boardwine"
Database Persistence By: ColinM
Assistance by: Paronity
Stress Tests by: Midgetgrimm
This file is for Nanou's HeadlessClient.
Description:
Fetches a specific person from the wanted array.
*/
private ["_unit","_index","_queryResult","_result"];
_unit = [_this,0,objNull,[objNull]] call BIS_fnc_param;
if (isNull _unit) exitWith {[]};
_uid = getPlayerUID player;
_query = format ["SELECT wantedID, wantedName, wantedBounty FROM wanted WHERE active='1' AND wantedID='%1'",_uid];
_queryResult = [_query,2] call HC_fnc_asyncCall;
if (_queryResult isEqualTo []) exitWith {[]};
_queryResult;

View File

@@ -0,0 +1,27 @@
#include "\life_hc\hc_macros.hpp"
/*
File: fn_wantedProfUpdate.sqf
Author: [midgetgrimm]
Persistence by: ColinM
This file is for Nanou's HeadlessClient.
Description:
Updates name of player if they change profiles
*/
private ["_uid","_name","_query","_tickTime","_wantedCheck","_wantedQuery"];
_uid = [_this,0,"",[""]] call BIS_fnc_param;
_name = [_this,1,"",[""]] call BIS_fnc_param;
//Bad data check
if (_uid isEqualTo "" || _name isEqualTo "") exitWith {};
_wantedCheck = format ["SELECT wantedName FROM wanted WHERE wantedID='%1'",_uid];
_wantedQuery = [_wantedCheck,2] call HC_fnc_asyncCall;
if (_wantedQuery isEqualTo []) exitWith {};
_wantedQuery = call compile format ["%1",_wantedQuery];
if !(_name isEqualTo (_wantedQuery select 0)) then {
_query = format ["UPDATE wanted SET wantedName='%1' WHERE wantedID='%2'",_name,_uid];
[_query,2] call HC_fnc_asyncCall;
};

View File

@@ -0,0 +1,18 @@
/*
File: fn_wantedRemove.sqf
Author: Bryan "Tonic" Boardwine"
Database Persistence By: ColinM
Assistance by: Paronity
Stress Tests by: Midgetgrimm
This file is for Nanou's HeadlessClient.
Description:
Removes a person from the wanted list.
*/
private ["_uid","_query"];
_uid = [_this,0,"",[""]] call BIS_fnc_param;
if (_uid isEqualTo "") exitWith {}; //Bad data
_query = format ["UPDATE wanted SET active = '0', wantedCrimes = '[]', wantedBounty = 0 WHERE wantedID='%1'",_uid];
[_query,2] call HC_fnc_asyncCall;