Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gang bank #557

Merged
merged 20 commits into from
May 15, 2019
Merged
1 change: 1 addition & 0 deletions Altis_Life.Altis/CfgRemoteExec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class CfgRemoteExec {
F(life_fnc_vehicleAnimate,CLIENT)
F(life_fnc_wantedList,CLIENT)
F(life_fnc_wireTransfer,CLIENT)
F(life_fnc_gangBankResponse,CLIENT)
F(SOCK_fnc_dataQuery,CLIENT)
F(SOCK_fnc_insertPlayerInfo,CLIENT)
F(SOCK_fnc_requestReceived,CLIENT)
Expand Down
4 changes: 2 additions & 2 deletions Altis_Life.Altis/Functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ class Life_Client_Core {
class bankTransfer {};
class bankWithdraw {};
class displayHandler {};
class gangDeposit {};
class gangWithdraw {};
class gangBankResponse {};
class garageLBChange {};
class impoundMenu {};
class progressBar {};
Expand All @@ -166,6 +165,7 @@ class Life_Client_Core {
class spawnPointCfg {};
class spawnPointSelected {};
class unimpound {};
class useGangBank {};
class vehicleGarage {};
class wireTransfer {};
};
Expand Down
4 changes: 2 additions & 2 deletions Altis_Life.Altis/config/Config_SpyGlass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ class SpyGlass {
"life_fnc_copsiren_meta","life_fnc_copsplit","life_fnc_copsplit_meta","life_fnc_corpse","life_fnc_corpse_meta","life_fnc_creategang","life_fnc_creategang_meta","life_fnc_deathscreen","life_fnc_deathscreen_meta","life_fnc_defusekit","life_fnc_defusekit_meta","life_fnc_demochargetimer","life_fnc_demochargetimer_meta","life_fnc_devicemine","life_fnc_devicemine_meta",
"life_fnc_displayhandler","life_fnc_displayhandler_meta","life_fnc_dooranimate","life_fnc_dooranimate_meta","life_fnc_dpfinish","life_fnc_dpfinish_meta","life_fnc_dropfishingnet","life_fnc_dropfishingnet_meta","life_fnc_dropitems","life_fnc_dropitems_meta","life_fnc_escinterupt","life_fnc_escinterupt_meta","life_fnc_escortaction","life_fnc_escortaction_meta",
"life_fnc_fedcamdisplay","life_fnc_fedcamdisplay_meta","life_fnc_fetchcfgdetails","life_fnc_fetchcfgdetails_meta","life_fnc_fetchdeadgear","life_fnc_fetchdeadgear_meta","life_fnc_fetchvehinfo","life_fnc_fetchvehinfo_meta","life_fnc_flashbang","life_fnc_flashbang_meta","life_fnc_freezeplayer","life_fnc_freezeplayer_meta","life_fnc_fuellbchange","life_fnc_fuellbchange_meta",
"life_fnc_fuelrefuelcar","life_fnc_fuelrefuelcar_meta","life_fnc_fuelstatopen","life_fnc_fuelstatopen_meta","life_fnc_fuelstore","life_fnc_fuelstore_meta","life_fnc_fuelsupply","life_fnc_fuelsupply_meta","life_fnc_gangcreated","life_fnc_gangcreated_meta","life_fnc_gangdeposit","life_fnc_gangdeposit_meta","life_fnc_gangdisband","life_fnc_gangdisband_meta","life_fnc_gangdisbanded",
"life_fnc_fuelrefuelcar","life_fnc_fuelrefuelcar_meta","life_fnc_fuelstatopen","life_fnc_fuelstatopen_meta","life_fnc_fuelstore","life_fnc_fuelstore_meta","life_fnc_fuelsupply","life_fnc_fuelsupply_meta","life_fnc_gangcreated","life_fnc_gangcreated_meta","life_fnc_usegangbank","life_fnc_usegangbank_meta","life_fnc_gangdisband","life_fnc_gangdisband_meta","life_fnc_gangdisbanded",
"life_fnc_gangdisbanded_meta","life_fnc_ganginvite","life_fnc_ganginvite_meta","life_fnc_ganginviteplayer","life_fnc_ganginviteplayer_meta","life_fnc_gangkick","life_fnc_gangkick_meta","life_fnc_gangleave","life_fnc_gangleave_meta","life_fnc_gangmenu","life_fnc_gangmenu_meta","life_fnc_gangnewleader","life_fnc_gangnewleader_meta","life_fnc_gangupgrade","life_fnc_gangupgrade_meta",
"life_fnc_gangwithdraw","life_fnc_gangwithdraw_meta","life_fnc_garagelbchange","life_fnc_garagelbchange_meta","life_fnc_garagerefund","life_fnc_garagerefund_meta","life_fnc_gather","life_fnc_gather_meta","life_fnc_getbuildingpositions","life_fnc_getbuildingpositions_meta","life_fnc_getdpmission","life_fnc_getdpmission_meta","life_fnc_givediff","life_fnc_givediff_meta","life_fnc_giveitem",
"life_fnc_gangbankresponse","life_fnc_gangbankresponse_meta","life_fnc_garagelbchange","life_fnc_garagelbchange_meta","life_fnc_garagerefund","life_fnc_garagerefund_meta","life_fnc_gather","life_fnc_gather_meta","life_fnc_getbuildingpositions","life_fnc_getbuildingpositions_meta","life_fnc_getdpmission","life_fnc_getdpmission_meta","life_fnc_givediff","life_fnc_givediff_meta","life_fnc_giveitem",
"life_fnc_giveitem_meta","life_fnc_givemoney","life_fnc_givemoney_meta","life_fnc_gutanimal","life_fnc_gutanimal_meta","life_fnc_handledamage","life_fnc_handledamage_meta","life_fnc_handleinv","life_fnc_handleinv_meta","life_fnc_handleitem","life_fnc_handleitem_meta","life_fnc_healhospital","life_fnc_healhospital_meta","life_fnc_hideobj","life_fnc_hideobj_meta","life_fnc_houseconfig",
"life_fnc_houseconfig_meta","life_fnc_housemenu","life_fnc_housemenu_meta","life_fnc_hudsetup","life_fnc_hudsetup_meta","life_fnc_hudupdate","life_fnc_hudupdate_meta","life_fnc_impoundaction","life_fnc_impoundaction_meta","life_fnc_impoundmenu","life_fnc_impoundmenu_meta","life_fnc_initciv","life_fnc_initciv_meta","life_fnc_initcop","life_fnc_initcop_meta","life_fnc_initgang",
"life_fnc_initgang_meta","life_fnc_inithouses","life_fnc_inithouses_meta","life_fnc_initmedic","life_fnc_initmedic_meta","life_fnc_inventoryclosed","life_fnc_inventoryclosed_meta","life_fnc_inventoryopened","life_fnc_inventoryopened_meta","life_fnc_isdamaged","life_fnc_isdamaged_meta","life_fnc_isnumeric","life_fnc_isnumeric_meta","life_fnc_isuidactive","life_fnc_isuidactive_meta",
Expand Down
4 changes: 2 additions & 2 deletions Altis_Life.Altis/dialog/bank.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Life_atm_management {
idc = 2705;
text = "$STR_ATM_WithdrawGang";
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
onButtonClick = "[] call life_fnc_gangWithdraw";
onButtonClick = "[false] call life_fnc_useGangBank";
x = 0.365;
y = 0.7;
w = 0.275;
Expand All @@ -109,7 +109,7 @@ class Life_atm_management {
idc = 2706;
text = "$STR_ATM_DepositGang";
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5};
onButtonClick = "[] call life_fnc_gangDeposit";
onButtonClick = "[true] call life_fnc_useGangBank";
x = 0.365;
y = 0.752;
w = 0.275;
Expand Down
16 changes: 16 additions & 0 deletions Altis_Life.Altis/dialog/function/fn_gangBankResponse.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "..\..\script_macros.hpp"
/*
File: fn_gankBankResponse.sqf
Author: DomT602
Description:
Receives response from the server.
*/
params [
["_value",-1,[0]]
];
if (!isRemoteExecuted || remoteExecutedOwner != 2) exitWith {};
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
if (_value isEqualTo -1) exitWith {};

hint format ["You successfully withdrew $%1.",_value];
CASH = CASH + _value;
[] call life_fnc_atmMenu;
43 changes: 0 additions & 43 deletions Altis_Life.Altis/dialog/function/fn_gangDeposit.sqf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,34 @@
Description:
Withdraws money from the gang bank.
*/
private ["_value"];
_value = parseNumber(ctrlText 2702);
_gFund = GANG_FUNDS;
group player setVariable ["gbank_in_use_by",player,true];
params [
["_deposit",false,[false]]
];

private _value = parseNumber(ctrlText 2702);
private _gFund = GANG_FUNDS;
if ((time - life_action_delay) < 0.5) exitWith {hint localize "STR_NOTF_ActionDelay"};

//Series of stupid checks
if (isNil {(group player) getVariable "gang_name"}) exitWith {hint localize "STR_ATM_NotInGang"}; // Checks if player isn't in a gang
if (_value > 999999) exitWith {hint localize "STR_ATM_WithdrawMax";};
if (_value < 0) exitWith {};
if (_value < 1) exitWith {};
if (!([str(_value)] call TON_fnc_isnumber)) exitWith {hint localize "STR_ATM_notnumeric"};
if (_value > _gFund) exitWith {hint localize "STR_ATM_NotEnoughFundsG"};
if ((_deposit && _value > CASH) || (!_deposit && _value > _gFund)) exitWith {hint localize "STR_ATM_NotEnoughCash"};
if (_val < 100 && _gFund > 20000000) exitWith {hint localize "STR_ATM_WithdrawMin"}; //Temp fix for something.
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
if ((group player getVariable ["gbank_in_use_by",player]) != player) exitWith {hint localize "STR_ATM_WithdrawInUseG"}; //Check if it's in use.

_gFund = _gFund - _value;
CASH = CASH + _value;
group player setVariable ["gang_bank",_gFund,true];
life_action_delay = time;
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
if (_deposit) then {
CASH = CASH - _value;
[] call life_fnc_atmMenu;
};

if (life_HC_isActive) then {
[1,group player] remoteExec ["HC_fnc_updateGang",HC_Life]; //Update the database.
[1,group player,_deposit,_value,player,CASH] remoteExecCall ["HC_fnc_updateGang",HC_Life]; //Update the database.
} else {
[1,group player] remoteExec ["TON_fnc_updateGang",RSERV]; //Update the database.
[1,group player,_deposit,_value,player,CASH] remoteExecCall ["TON_fnc_updateGang",RSERV]; //Update the database.
};

hint format [localize "STR_ATM_WithdrawSuccessG",[_value] call life_fnc_numberText];
[] call life_fnc_atmMenu;
[6] call SOCK_fnc_updatePartial;

if (LIFE_SETTINGS(getNumber,"player_moneyLog") isEqualTo 1) then {
if (LIFE_SETTINGS(getNumber,"battlEye_friendlyLogging") isEqualTo 1) then {
money_log = format [localize "STR_DL_ML_withdrewGang_BEF",_value,[_gFund] call life_fnc_numberText,[BANK] call life_fnc_numberText,[CASH] call life_fnc_numberText];
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
2 changes: 1 addition & 1 deletion BEFilters/remoteexec.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
//regex
1 "" !="_this call fn_whoDoneIt"
5 "" !BIS_fnc_(effectKilled(AirDestruction|Secondaries)|execVM) !DB_fnc_(insertRequest|queryRequest|updatePartial|updateRequest) !HC_fnc_(addContainer|addHouse|chopShopSell|deleteDBContainer|getVehicles|insertGang|insertRequest|jailSys|queryRequest|receivekeyofServer) !HC_fnc_(removeGang|sellHouse(Container)?|spawnVehicle|spikeStrip) !HC_fnc_update(Gang|HouseContainers|HouseTrunk|Partial|Request) !HC_fnc_vehicle(Create|Delete|Store|Update) !HC_fnc_wanted(Add|Bounty|Crimes|Fetch|ProfUpdate|Remove) !life_fnc_(AAN|addVehicle2Chain|adminid|admininfo|animSync|bountyReceive|broadcast|colorVehicle|copLights) !life_fnc_(copSearch|CopSiren|corpse|demoChargeTimer|flashbang|freezePlayer|gangCreated|gangDisbanded|gangInvite) !life_fnc_(garageRefund|giveDiff|hideObj|impoundMenu|jail(Me|Sys)?) !life_fnc_(jumpFnc|knockedOut|licenseCheck|licensesRead|lightHouse|lockVehicle|medic(Lights|Request|Siren)) !life_fnc_(moveIn|pickupItem|pickupMoney|pulloutVeh|receiveItem|receiveMoney|removeLicenses|restrain|revived) !life_fnc_(robPerson|robReceive|say3D|searchClient|seizeClient|setFuel|simDisable|soundDevice|spikeStripEffect) !life_fnc_(tazeSound|ticketPaid|ticketPrompt|vehicleAnimate) !life_fnc_wanted(Add|Bounty|Crimes|Fetch|Info|List|ProfUpdate|Remove) !life_fnc_wireTransfer !SOCK_fnc_(dataQuery|insertPlayerInfo|updateRequest) !SPY_fnc_(cookieJar|notifyAdmins|observe) !TON_fnc_(addContainer|addHouse|chopShopSell|cleanupRequest|handleBlastingCharge) !TON_fnc_clientGang(Kick|Leader|Left) !TON_fnc_(clientGetKey|clientMessage) !TON_fnc_(deleteDBContainer|getID|getVehicles|insertGang|keyManagement|managesc|pickupAction|player_query|recupkeyforHC) !TON_fnc_(removeGang|sellHouse(Container)?|spawnVehicle|spikeStrip) !TON_fnc_update(Gang|HouseContainers|HouseTrunk) !TON_fnc_vehicle(Create|Delete|Store|Update) !="_this call fn_whoDoneIt"
5 "" !BIS_fnc_(effectKilled(AirDestruction|Secondaries)|execVM) !DB_fnc_(insertRequest|queryRequest|updatePartial|updateRequest) !HC_fnc_(addContainer|addHouse|chopShopSell|deleteDBContainer|getVehicles|insertGang|insertRequest|jailSys|queryRequest|receivekeyofServer) !HC_fnc_(removeGang|sellHouse(Container)?|spawnVehicle|spikeStrip) !HC_fnc_update(Gang|HouseContainers|HouseTrunk|Partial|Request) !HC_fnc_vehicle(Create|Delete|Store|Update) !HC_fnc_wanted(Add|Bounty|Crimes|Fetch|ProfUpdate|Remove) !life_fnc_(AAN|addVehicle2Chain|adminid|admininfo|animSync|bountyReceive|broadcast|colorVehicle|copLights) !life_fnc_(copSearch|CopSiren|corpse|demoChargeTimer|flashbang|freezePlayer|gangCreated|gangDisbanded|gangInvite) !life_fnc_(garageRefund|giveDiff|hideObj|impoundMenu|jail(Me|Sys)?) !life_fnc_(jumpFnc|knockedOut|licenseCheck|licensesRead|lightHouse|lockVehicle|medic(Lights|Request|Siren)) !life_fnc_(moveIn|pickupItem|pickupMoney|pulloutVeh|receiveItem|receiveMoney|removeLicenses|restrain|revived) !life_fnc_(robPerson|robReceive|say3D|searchClient|seizeClient|setFuel|simDisable|soundDevice|spikeStripEffect) !life_fnc_(tazeSound|ticketPaid|ticketPrompt|vehicleAnimate|gangBankResponse) !life_fnc_wanted(Add|Bounty|Crimes|Fetch|Info|List|ProfUpdate|Remove) !life_fnc_wireTransfer !SOCK_fnc_(dataQuery|insertPlayerInfo|updateRequest) !SPY_fnc_(cookieJar|notifyAdmins|observe) !TON_fnc_(addContainer|addHouse|chopShopSell|cleanupRequest|handleBlastingCharge) !TON_fnc_clientGang(Kick|Leader|Left) !TON_fnc_(clientGetKey|clientMessage) !TON_fnc_(deleteDBContainer|getID|getVehicles|insertGang|keyManagement|managesc|pickupAction|player_query|recupkeyforHC) !TON_fnc_(removeGang|sellHouse(Container)?|spawnVehicle|spikeStrip) !TON_fnc_update(Gang|HouseContainers|HouseTrunk) !TON_fnc_vehicle(Create|Delete|Store|Update) !="_this call fn_whoDoneIt"
29 changes: 28 additions & 1 deletion life_hc/MySQL/Gangs/fn_updateGang.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Description:
Updates the gang information?
*/
scopeName "main";
private ["_groupID","_bank","_maxMembers","_members","_membersFinal","_query","_owner"];
params [
["_mode",0,[0]],
Expand All @@ -30,7 +31,33 @@ switch (_mode) do {
};

case 1: {
_query = format ["UPDATE gangs SET bank='%1' WHERE id='%2'",([(_group getVariable ["gang_bank",0])] call HC_fnc_numberSafe),_groupID];
params [
"",
"",
["_deposit",false,[false]],
["_value",0,[0]],
["_unit",objNull,[objNull]],
["_cash",0,[0]]
];

private _funds = _group getVariable ["gang_bank",0];
if (_deposit) then {
_funds = _funds + _value;
_group setVariable ["gang_bank",_funds,true];
[1,format["Successfully deposited $%1.",_value]] remoteExecCall ["life_fnc_broadcast",remoteExecutedOwner];
_cash = _cash - _value;
} else {
if (_value > _funds) exitWith {
[1,"There are not enough funds in the bank for this withdrawal."] remoteExecCall ["life_fnc_broadcast",remoteExecutedOwner];
breakTo "main";
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
};
_funds = _funds - _value;
_group setVariable ["gang_bank",_funds,true];
[_value] remoteExecCall ["life_fnc_gangBankResponse",remoteExecutedOwner];
_cash = _cash + _value;
};
_query = format ["UPDATE gangs SET bank='%1' WHERE id='%2'",([_funds] call HC_fnc_numberSafe),_groupID];
[getPlayerUID _unit,side _unit,_cash,0] call HC_fnc_updatePartial;
};

case 2: {
Expand Down
29 changes: 28 additions & 1 deletion life_server/Functions/Gangs/fn_updateGang.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Description:
Updates the gang information?
*/
scopeName "main";
private ["_groupID","_bank","_maxMembers","_members","_membersFinal","_query","_owner"];
params [
["_mode",0,[0]],
Expand All @@ -28,7 +29,33 @@ switch (_mode) do {
};

case 1: {
_query = format ["UPDATE gangs SET bank='%1' WHERE id='%2'",([(_group getVariable ["gang_bank",0])] call DB_fnc_numberSafe),_groupID];
params [
"",
"",
["_deposit",false,[false]],
["_value",0,[0]],
["_unit",objNull,[objNull]],
["_cash",0,[0]]
];

private _funds = _group getVariable ["gang_bank",0];
if (_deposit) then {
_funds = _funds + _value;
_group setVariable ["gang_bank",_funds,true];
[1,format["Successfully deposited $%1.",_value]] remoteExecCall ["life_fnc_broadcast",remoteExecutedOwner];
_cash = _cash - _value;
} else {
if (_value > _funds) exitWith {
[1,"There are not enough funds in the bank for this withdrawal."] remoteExecCall ["life_fnc_broadcast",remoteExecutedOwner];
breakTo "main";
DomT602 marked this conversation as resolved.
Show resolved Hide resolved
};
_funds = _funds - _value;
_group setVariable ["gang_bank",_funds,true];
[_value] remoteExecCall ["life_fnc_gangBankResponse",remoteExecutedOwner];
_cash = _cash + _value;
};
_query = format ["UPDATE gangs SET bank='%1' WHERE id='%2'",([_funds] call DB_fnc_numberSafe),_groupID];
[getPlayerUID _unit,side _unit,_cash,0] call DB_fnc_updatePartial;
};

case 2: {
Expand Down