From d067b9662a64d67a6f79ad7d447b713a765e9348 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 5 Feb 2017 18:50:59 +0100 Subject: [PATCH 01/15] Add files via upload --- .../customs/EPOCH_custom_EH_FiredMan.sqf | 15 +++++++++++++++ .../customs/EPOCH_custom_EH_GetInMan.sqf | 16 ++++++++++++++++ .../customs/EPOCH_custom_EH_GetOutMan.sqf | 16 ++++++++++++++++ .../EPOCH_custom_EH_InventoryClosed.sqf | 15 +++++++++++++++ .../EPOCH_custom_EH_InventoryOpened.sqf | 15 +++++++++++++++ .../customs/EPOCH_custom_EH_KeyDown.sqf | 19 +++++++++++++++++++ .../customs/EPOCH_custom_EH_KeyUp.sqf | 19 +++++++++++++++++++ .../customs/EPOCH_custom_EH_Killed.sqf | 15 +++++++++++++++ .../customs/EPOCH_custom_EH_Put.sqf | 15 +++++++++++++++ .../customs/EPOCH_custom_EH_Take.sqf | 15 +++++++++++++++ .../customs/EPOCH_custom_OnEachFrame.sqf | 14 ++++++++++++++ 11 files changed, 174 insertions(+) create mode 100644 Sources/epoch_code/customs/EPOCH_custom_EH_FiredMan.sqf create mode 100644 Sources/epoch_code/customs/EPOCH_custom_EH_GetInMan.sqf create mode 100644 Sources/epoch_code/customs/EPOCH_custom_EH_GetOutMan.sqf create mode 100644 Sources/epoch_code/customs/EPOCH_custom_EH_InventoryClosed.sqf create mode 100644 Sources/epoch_code/customs/EPOCH_custom_EH_InventoryOpened.sqf create mode 100644 Sources/epoch_code/customs/EPOCH_custom_EH_KeyDown.sqf create mode 100644 Sources/epoch_code/customs/EPOCH_custom_EH_KeyUp.sqf create mode 100644 Sources/epoch_code/customs/EPOCH_custom_EH_Killed.sqf create mode 100644 Sources/epoch_code/customs/EPOCH_custom_EH_Put.sqf create mode 100644 Sources/epoch_code/customs/EPOCH_custom_EH_Take.sqf create mode 100644 Sources/epoch_code/customs/EPOCH_custom_OnEachFrame.sqf diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_FiredMan.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_FiredMan.sqf new file mode 100644 index 00000000..6d57ea8e --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_FiredMan.sqf @@ -0,0 +1,15 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch FiredMan Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_FiredMan.sqf +*/ +params ["_unit","_weapon","_muzzle","_mode","_ammo","_magazine","_projectile"]; diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_GetInMan.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_GetInMan.sqf new file mode 100644 index 00000000..cf92fa5b --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_GetInMan.sqf @@ -0,0 +1,16 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch GetInMan Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_GetInMan.sqf +*/ +params ["_unit","_position","_vehicle"]; + diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_GetOutMan.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_GetOutMan.sqf new file mode 100644 index 00000000..c3e0f8bb --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_GetOutMan.sqf @@ -0,0 +1,16 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch GetOutMan Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_GetOutMan.sqf +*/ +params ["_unit","_position","_vehicle"]; + diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryClosed.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryClosed.sqf new file mode 100644 index 00000000..1688e4d2 --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryClosed.sqf @@ -0,0 +1,15 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch Take Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_Take.sqf +*/ +params ["_unit","_container"]; diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryOpened.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryOpened.sqf new file mode 100644 index 00000000..c3f9ef05 --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryOpened.sqf @@ -0,0 +1,15 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch Take Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_Take.sqf +*/ +params ["_unit","_container","_sec"]; diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_KeyDown.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_KeyDown.sqf new file mode 100644 index 00000000..03629c49 --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_KeyDown.sqf @@ -0,0 +1,19 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch KeyUp Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_KeyDown.sqf +*/ +params ["_display","_dikCode","_shift","_ctrl","_alt"]; +_handled = false; + + +_handled diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_KeyUp.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_KeyUp.sqf new file mode 100644 index 00000000..6d643dc3 --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_KeyUp.sqf @@ -0,0 +1,19 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch KeyUp Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_KeyUp.sqf +*/ +params ["_display","_dikCode","_shift","_ctrl","_alt"]; +_handled = false; + + +_handled diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_Killed.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_Killed.sqf new file mode 100644 index 00000000..6be7e921 --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_Killed.sqf @@ -0,0 +1,15 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch Killed Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_Killed.sqf +*/ +params [["_unit",objNull,[objNull]],["_killer",objNull,[objNull]] ]; diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_Put.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_Put.sqf new file mode 100644 index 00000000..602a0f7a --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_Put.sqf @@ -0,0 +1,15 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch Put Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_Put.sqf +*/ +params ["_unit","_container","_itemclass"]; diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_Take.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_Take.sqf new file mode 100644 index 00000000..08beceb4 --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_Take.sqf @@ -0,0 +1,15 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch Take Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_EH_Take.sqf +*/ +params ["_unit","_container","_itemclass"]; diff --git a/Sources/epoch_code/customs/EPOCH_custom_OnEachFrame.sqf b/Sources/epoch_code/customs/EPOCH_custom_OnEachFrame.sqf new file mode 100644 index 00000000..9a00d76a --- /dev/null +++ b/Sources/epoch_code/customs/EPOCH_custom_OnEachFrame.sqf @@ -0,0 +1,14 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + Custom A3 Epoch OnEachFrame + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/custom/EPOCH_custom_OnEachFrame.sqf +*/ From ee3224f14ac4ff8d1cbf50fbabcc93313cc17b40 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 5 Feb 2017 18:51:57 +0100 Subject: [PATCH 02/15] Add files via upload --- .../event_handlers/EPOCH_InventoryClosed.sqf | 19 ++++++++++ .../event_handlers/EPOCH_InventoryOpened.sqf | 35 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 Sources/epoch_code/compile/event_handlers/EPOCH_InventoryClosed.sqf create mode 100644 Sources/epoch_code/compile/event_handlers/EPOCH_InventoryOpened.sqf diff --git a/Sources/epoch_code/compile/event_handlers/EPOCH_InventoryClosed.sqf b/Sources/epoch_code/compile/event_handlers/EPOCH_InventoryClosed.sqf new file mode 100644 index 00000000..3ef616af --- /dev/null +++ b/Sources/epoch_code/compile/event_handlers/EPOCH_InventoryClosed.sqf @@ -0,0 +1,19 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + A3 Epoch InventoryClosed Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/event_handlers/EPOCH_InventoryClosed.sqf +*/ +params ["_unit","_container"]; +if !(EPOCH_arr_interactedObjs isEqualTo[]) then { + [EPOCH_arr_interactedObjs] remoteExec['EPOCH_server_save_vehicles', 2]; + EPOCH_arr_interactedObjs = []; +}; \ No newline at end of file diff --git a/Sources/epoch_code/compile/event_handlers/EPOCH_InventoryOpened.sqf b/Sources/epoch_code/compile/event_handlers/EPOCH_InventoryOpened.sqf new file mode 100644 index 00000000..457b0895 --- /dev/null +++ b/Sources/epoch_code/compile/event_handlers/EPOCH_InventoryOpened.sqf @@ -0,0 +1,35 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: [Ignatz] He-Man + + Description: + A3 Epoch InventoryOpened Eventhandler + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/event_handlers/EPOCH_InventoryOpened.sqf +*/ +params ["_unit","_container","_sec"]; +setMousePosition[0.5, 0.5]; +call EPOCH_showStats; +_this spawn EPOCH_initUI; +_containerlocked = (locked _container in [2, 3] || _container getVariable['EPOCH_Locked', false]); +_seclocked = false; +if !(isNull _sec) then { + _seclocked = (locked _sec in [2, 3] || _sec getVariable['EPOCH_Locked', false]); +}; +if (_containerlocked || _seclocked) then { + [] spawn { + disableSerialization; + waitUntil {!isNull findDisplay 602}; + _d = findDisplay 602; + _cargo = _d displayCtrl 6401; + _ground = _d displayCtrl 6321; + _cargo ctrlEnable false; + ctrlSetFocus _ground; + ctrlActivate _ground; + }; +}; \ No newline at end of file From 3c5d1124634003f824ae58148ace1b742f4c6282 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 5 Feb 2017 18:54:06 +0100 Subject: [PATCH 03/15] Update EPOCH_KeyDown.sqf --- .../compile/interface_event_handlers/EPOCH_KeyDown.sqf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf b/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf index 8af89140..9f2e3b0a 100644 --- a/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf +++ b/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf @@ -32,6 +32,9 @@ params ["_display","_dikCode","_shift","_ctrl","_alt"]; _handled = false; +_this call Epoch_custom_EH_KeyDown; +if (_handled) exitWith{ true }; + if !(alive player) exitWith{ false }; EPOCH_doRotate = false; From de36d8225cbf9791cea40aba67d85b3055386a62 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 5 Feb 2017 18:54:44 +0100 Subject: [PATCH 04/15] Update EPOCH_KeyUp.sqf --- .../compile/interface_event_handlers/EPOCH_KeyUp.sqf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyUp.sqf b/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyUp.sqf index 749642d2..56606952 100644 --- a/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyUp.sqf +++ b/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyUp.sqf @@ -30,6 +30,10 @@ private ["_handled"]; //[[[end]]] params ["_display","_dikCode","_shift","_ctrl","_alt"]; _handled = false; + +_this call Epoch_custom_EH_KeyUp; +if (_handled) exitWith{ true }; + //Main actions if (_dikCode == EPOCH_keysAction) then { EPOCH_keysActionPressed = false; From 2f7216d63c61a3e2f2312e29ab411fb810689c80 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 5 Feb 2017 18:55:20 +0100 Subject: [PATCH 05/15] Update EPOCH_onEachFrame.sqf --- Sources/epoch_code/compile/EPOCH_onEachFrame.sqf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf b/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf index 6f57592d..1a7da556 100644 --- a/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf +++ b/Sources/epoch_code/compile/EPOCH_onEachFrame.sqf @@ -179,3 +179,5 @@ if (EPOCH_ESP_PLAYER || EPOCH_ESP_VEHICLES) then { }; } forEach EPOCH_ESP_VEHICLEPLAYER; }; + +call Epoch_custom_OnEachFrame; From b70f05e023e955bbbce9994e4d47f0c0d4649469 Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 5 Feb 2017 18:57:40 +0100 Subject: [PATCH 06/15] Update CfgClientFunctions.hpp --- .../epoch_config/Configs/CfgClientFunctions.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Sources/epoch_config/Configs/CfgClientFunctions.hpp b/Sources/epoch_config/Configs/CfgClientFunctions.hpp index cd4f9a14..b43cd670 100644 --- a/Sources/epoch_config/Configs/CfgClientFunctions.hpp +++ b/Sources/epoch_config/Configs/CfgClientFunctions.hpp @@ -82,6 +82,8 @@ class CfgClientFunctions { class getInMan {}; class getOutMan {}; + class InventoryClosed {}; + class InventoryOpened {}; }; class setup { @@ -165,6 +167,21 @@ class CfgClientFunctions class initUI {}; class refeshUI {}; }; + class customs + { + file = "epoch_code\customs"; + class custom_EH_FiredMan {}; + class custom_EH_GetInMan {}; + class custom_EH_GetOutMan {}; + class custom_EH_InventoryClosed {}; + class custom_EH_InventoryOpened {}; + class custom_EH_KeyDown {}; + class custom_EH_KeyUp {}; + class custom_EH_Killed {}; + class custom_EH_Put {}; + class custom_EH_Take {}; + class custom_OnEachFrame {}; + }; class messaging { file = "epoch_code\gui\scripts\messaging"; From ea2cb1b250815504a43f10fd855f48a2bfc19a8b Mon Sep 17 00:00:00 2001 From: He-Man Date: Sun, 5 Feb 2017 19:00:38 +0100 Subject: [PATCH 07/15] Update CfgEpochClient.hpp --- .../epoch_config/Configs/CfgEpochClient.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index 48564f5b..2a8a2481 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -50,22 +50,22 @@ class CfgEpochClient displayAddEventHandler[] = {"keyDown","keyUp"}; keyDown = "(_this call EPOCH_KeyDown)"; keyUp = "(_this call EPOCH_KeyUp)"; - addEventHandler[] = {"Respawn","Put","Take","InventoryClosed","InventoryOpened","Fired","Killed","HandleRating","GetInMan","GetOutMan"}; + addEventHandler[] = {"Respawn","Put","Take","InventoryClosed","InventoryOpened","FiredMan","Killed","HandleRating","GetInMan","GetOutMan"}; Respawn = "(_this select 0) call EPOCH_clientRespawn"; - Put = "(_this select 1) call EPOCH_interact;_this call EPOCH_PutHandler"; - Take = "(_this select 1) call EPOCH_interact;_this call EPOCH_UnisexCheck"; - Fired = "_this call EPOCH_fnc_playerFired;"; - InventoryClosed = "if !(EPOCH_arr_interactedObjs isEqualTo[]) then {[EPOCH_arr_interactedObjs] remoteExec['EPOCH_server_save_vehicles', 2]; EPOCH_arr_interactedObjs = [];};"; - InventoryOpened = "setMousePosition[0.5, 0.5];call EPOCH_showStats;_this spawn EPOCH_initUI;params ['_unit','_container','_sec'];_containerlocked = (locked _container in [2, 3] || _container getVariable['EPOCH_Locked', false]);_seclocked = false;if !(isNull _sec) then {_seclocked = (locked _sec in [2, 3] || _sec getVariable['EPOCH_Locked', false]);};if (_containerlocked || _seclocked) then {[] spawn {disableSerialization;waitUntil {!isNull findDisplay 602};_d = findDisplay 602;_cargo = _d displayCtrl 6401;_ground = _d displayCtrl 6321;_cargo ctrlEnable false;ctrlSetFocus _ground;ctrlActivate _ground;};};"; - Killed = "_this call EPOCH_fnc_playerDeath;"; + Put = "(_this select 1) call EPOCH_interact;_this call EPOCH_PutHandler;_this call Epoch_custom_EH_Put"; + Take = "(_this select 1) call EPOCH_interact;_this call EPOCH_UnisexCheck;_this call Epoch_custom_EH_Take"; + FiredMan = "_this call EPOCH_fnc_playerFired;_this call Epoch_custom_EH_FiredMan"; + InventoryClosed = "_this call EPOCH_InventoryClosed;_this call EPOCH_custom_EH_InventoryClosed"; + InventoryOpened = "_this call EPOCH_InventoryOpened;_this call EPOCH_custom_EH_InventoryOpened"; + Killed = "_this call EPOCH_fnc_playerDeath;_this call Epoch_custom_EH_Killed"; HandleRating = "EPOCH_playerKarma = EPOCH_playerKarma + (_this select 1);0"; HandleDamage = ""; HandleHeal = ""; Dammaged = ""; Hit = ""; HitPart = ""; - GetInMan = "_this call EPOCH_getInMan"; - GetOutMan = "_this call EPOCH_getOutMan;"; + GetInMan = "_this call EPOCH_getInMan;_this call Epoch_custom_EH_GetInMan"; + GetOutMan = "_this call EPOCH_getOutMan;_this call Epoch_custom_EH_GetOutMan"; // suppress these units from spawning near Jammer or Traders nonJammerAI[] = {"B_Heli_Transport_01_F","PHANTOM","EPOCH_Sapper_F","Epoch_SapperB_F","I_UAV_01_F","EPOCH_RyanZombie_1"}; nonTraderAI[] = {"B_Heli_Transport_01_F","PHANTOM","EPOCH_Sapper_F","Epoch_SapperB_F","I_UAV_01_F","Epoch_Cloak_F","GreatWhite_F","EPOCH_RyanZombie_1"}; From 3c3772f3f668cff13bffc5e9d9531fcbfea53747 Mon Sep 17 00:00:00 2001 From: He-Man Date: Mon, 6 Feb 2017 19:49:23 +0100 Subject: [PATCH 08/15] Update EPOCH_custom_EH_InventoryClosed.sqf --- Sources/epoch_code/customs/EPOCH_custom_EH_InventoryClosed.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryClosed.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryClosed.sqf index 1688e4d2..93fb3953 100644 --- a/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryClosed.sqf +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryClosed.sqf @@ -4,7 +4,7 @@ Contributors: [Ignatz] He-Man Description: - Custom A3 Epoch Take Eventhandler + Custom A3 Epoch InventoryClosed Eventhandler Licence: Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike From 061270b5a27b7265e066ce3be5ab33e2084f593c Mon Sep 17 00:00:00 2001 From: He-Man Date: Mon, 6 Feb 2017 19:50:15 +0100 Subject: [PATCH 09/15] Update EPOCH_custom_EH_InventoryOpened.sqf --- Sources/epoch_code/customs/EPOCH_custom_EH_InventoryOpened.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryOpened.sqf b/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryOpened.sqf index c3f9ef05..1941dbbc 100644 --- a/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryOpened.sqf +++ b/Sources/epoch_code/customs/EPOCH_custom_EH_InventoryOpened.sqf @@ -4,7 +4,7 @@ Contributors: [Ignatz] He-Man Description: - Custom A3 Epoch Take Eventhandler + Custom A3 Epoch InventoryOpened Eventhandler Licence: Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike From 6c08d6835fa360d55d2100ec4bc51b565a87436e Mon Sep 17 00:00:00 2001 From: He-Man Date: Fri, 10 Feb 2017 20:21:32 +0100 Subject: [PATCH 10/15] Only Group Leader can place a Jammer --- Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf b/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf index 7485d338..1ea066de 100644 --- a/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf @@ -130,6 +130,10 @@ if !(_jammer isEqualTo []) then { }; } else { + if (!(EPOCH_my_groupUID isequalto "") && !((getplayeruid player) isequalto EPOCH_my_groupUID)) exitwith { + _buildingAllowed = false; + ["The Group Leader must place the Jammer!", 5] call Epoch_message; + }; if (_objType in ["PlotPole_EPOCH", "PlotPole_SIM_EPOCH"]) then { // TODO: rework not ideal to use allmissionobjects _alljammer = allmissionobjects 'PlotPole_EPOCH'; From 1816c9755f83a0824188765a874ec9b59d42506b Mon Sep 17 00:00:00 2001 From: He-Man Date: Fri, 10 Feb 2017 20:25:36 +0100 Subject: [PATCH 11/15] Update EPOCH_isBuildAllowed.sqf Only the Group Leader can place a Jammer --- .../epoch_code/compile/building/EPOCH_isBuildAllowed.sqf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf b/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf index 1ea066de..2118fc62 100644 --- a/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf +++ b/Sources/epoch_code/compile/building/EPOCH_isBuildAllowed.sqf @@ -130,11 +130,11 @@ if !(_jammer isEqualTo []) then { }; } else { - if (!(EPOCH_my_groupUID isequalto "") && !((getplayeruid player) isequalto EPOCH_my_groupUID)) exitwith { - _buildingAllowed = false; - ["The Group Leader must place the Jammer!", 5] call Epoch_message; - }; if (_objType in ["PlotPole_EPOCH", "PlotPole_SIM_EPOCH"]) then { + if (!(EPOCH_my_groupUID isequalto "") && !((getplayeruid player) isequalto EPOCH_my_groupUID)) exitwith { + _buildingAllowed = false; + ["The Group Leader must place the Jammer!", 5] call Epoch_message; + }; // TODO: rework not ideal to use allmissionobjects _alljammer = allmissionobjects 'PlotPole_EPOCH'; _c = 0; From 69a3b8b5d7cb156ec94c0bfee8a5c3dc968388ec Mon Sep 17 00:00:00 2001 From: He-Man Date: Fri, 10 Feb 2017 21:28:00 +0100 Subject: [PATCH 12/15] Reworked NPC Trade Script - no longer use PubVar for Trade - "Purchase Failed" not abort the complete trade - Added an option, that Players with to much Bank-debit can not sell, but can purchase. The Money for Purchasing goes directly to the Bank then. --- .../@epochhive/epochconfig.hpp | 3 +- .../compile/traders/EPOCH_NpcTrade_return.sqf | 86 +++++ .../compile/traders/EPOCH_startNpcTrade.sqf | 70 ---- .../Configs/CfgClientFunctions.hpp | 1 + .../EPOCH_server_makeNPCTrade.sqf | 346 +++++++++++------- 5 files changed, 293 insertions(+), 213 deletions(-) create mode 100644 Sources/epoch_code/compile/traders/EPOCH_NpcTrade_return.sqf diff --git a/Server_Install_Pack/@epochhive/epochconfig.hpp b/Server_Install_Pack/@epochhive/epochconfig.hpp index 4fa8612e..2203fa02 100644 --- a/Server_Install_Pack/@epochhive/epochconfig.hpp +++ b/Server_Install_Pack/@epochhive/epochconfig.hpp @@ -25,7 +25,8 @@ antagonistChancePDeath = 0.33; //33% chance when player was killed from a other antagonistChanceLoot = 0.09; //9% chance when player click "SEARCH" on a loot object // Player Related -cloneCost = 100; // debt incurred on player death +cloneCost = 100; // debt incurred on player death +MaxBankDebitforTrade = -50000 // If Player has less money on Bank, Crypto from Trade goes directly to Bank instead to Player // vehicles - Max vehicle slots is calculated from per vehicle limits below. Warning! Higher the number lower the performance. simulationHandlerOld = "false"; // When enabled this feature disables simulation on vehicles that are not nea players. Can help improve client fps at the cost of server fps. diff --git a/Sources/epoch_code/compile/traders/EPOCH_NpcTrade_return.sqf b/Sources/epoch_code/compile/traders/EPOCH_NpcTrade_return.sqf new file mode 100644 index 00000000..0b0a9c9a --- /dev/null +++ b/Sources/epoch_code/compile/traders/EPOCH_NpcTrade_return.sqf @@ -0,0 +1,86 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: He-Man + + Description: + NPC trade code + + Licence: + Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike + + Github: + https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/traders/EPOCH_startNpcTrade.sqf + + Example: + cursorTarget call EPOCH_startNpcTrade; + + Parameter(s): + _this: OBJECT + + Returns: + NOTHING +*/ +//[[[cog import generate_private_arrays ]]] +private ["_addWeaponToHands","_arrayIn","_arrayOut","_config","_current_crypto","_errorMsg","_item","_itemTax","_itemWorth","_sizeOut","_tax","_type","_vehSlot","_vehicle","_vehicles"]; +//[[[end]]] +params [["_returnIn",[]],["_returnOut",[]],["_message",""]]; + +if (isNil "EPOCH_TRADE_STARTED") exitWith{}; + +if !(_returnOut isEqualTo[]) then { + // add purchased items + { + if ([_x, "CfgWeapons"] call EPOCH_fnc_isAny) then { + _type = getNumber(configfile >> "CfgWeapons" >> (_x) >> "type"); + _addWeaponToHands = false; + switch (_type) do { + case 1: { + if (primaryWeapon player == "") then { + _addWeaponToHands = true; + }; + }; + case 4: { + if (secondaryWeapon player == "") then { + _addWeaponToHands = true; + }; + }; + case 2: { + if (handgunWeapon player == "") then { + _addWeaponToHands = true; + }; + }; + }; + if (_addWeaponToHands) then { + player addWeapon _x; + } + else { + _x call EPOCH_fnc_addItemOverflow; + }; + } + else { + if ([_x, "CfgMagazines"] call EPOCH_fnc_isAny) then { + _x call EPOCH_fnc_addItemOverflow; + }; + }; + } forEach _returnOut; +}; + +if !(_message isequalto "") then { + [_message, 5] call Epoch_message; +}; + +EPOCH_TRADE_STARTED = nil; + +// Ignatz ... +if (isnil 'Ignatz_LastTrade') then { + Ignatz_LastTrade = diag_ticktime; + ['Tradings',1,'add'] call Ignatz_Client_PlayerStatsUpdate; +} +else { + if (diag_ticktime > Ignatz_LastTrade+300) then { + ['Tradings',1,'add'] call Ignatz_Client_PlayerStatsUpdate; + Ignatz_LastTrade = diag_ticktime; + }; +}; +// ... Ignatz diff --git a/Sources/epoch_code/compile/traders/EPOCH_startNpcTrade.sqf b/Sources/epoch_code/compile/traders/EPOCH_startNpcTrade.sqf index 31092954..469ed6a9 100644 --- a/Sources/epoch_code/compile/traders/EPOCH_startNpcTrade.sqf +++ b/Sources/epoch_code/compile/traders/EPOCH_startNpcTrade.sqf @@ -25,7 +25,6 @@ private ["_addWeaponToHands","_arrayIn","_arrayOut","_config","_current_crypto","_errorMsg","_item","_itemTax","_itemWorth","_sizeOut","_tax","_type","_vehSlot","_vehicle","_vehicles"]; //[[[end]]] -if (!isNil "EPOCH_TRADE_COMPLETE") exitWith {}; if (!isNil "EPOCH_TRADE_STARTED") exitWith{}; if (isNull _this) exitWith{}; @@ -119,74 +118,5 @@ if (alive _this) then { // close menu closeDialog 0; - - [_arrayIn, _arrayOut] spawn{ - - waitUntil{ uiSleep 0.1; !isNil "EPOCH_TRADE_COMPLETE" }; - - // SOLD ITEMS ARRAY - if !((EPOCH_TRADE_COMPLETE select 0) isEqualTo[]) then { - if ((EPOCH_TRADE_COMPLETE select 0) isEqualTo(_this select 0)) then { - ['Items Sold', 5] call Epoch_message; - } - else { - ['Failed To Sell Items', 5] call Epoch_message; - }; - }; - - // PURCHASED ITEMS ARRAY - if !((EPOCH_TRADE_COMPLETE select 1) isEqualTo[]) then { - if ((EPOCH_TRADE_COMPLETE select 1) isEqualTo(_this select 1)) then { - - _errorMsg = 'Items Purchased: '; - // add purchased items - { - if ([_x, "CfgWeapons"] call EPOCH_fnc_isAny) then { - _errorMsg = _errorMsg + format["%1, ", getText(configfile >> "CfgWeapons" >> (_x) >> "displayName")]; - _type = getNumber(configfile >> "CfgWeapons" >> (_x) >> "type"); - _addWeaponToHands = false; - switch (_type) do { - case 1: { - if (primaryWeapon player == "") then { - _addWeaponToHands = true; - }; - }; - case 4: { - if (secondaryWeapon player == "") then { - _addWeaponToHands = true; - }; - }; - case 2: { - if (handgunWeapon player == "") then { - _addWeaponToHands = true; - }; - }; - }; - if (_addWeaponToHands) then { - player addWeapon _x; - } - else { - _x call EPOCH_fnc_addItemOverflow; - }; - } else { - if ([_x, "CfgMagazines"] call EPOCH_fnc_isAny) then { - _errorMsg = _errorMsg + format["%1, ", getText(configfile >> "CfgMagazines" >> (_x) >> "displayName")]; - _x call EPOCH_fnc_addItemOverflow; - } else { - _errorMsg = _errorMsg + format["%1, ", getText(configfile >> "CfgVehicles" >> (_x) >> "displayName")]; - }; - }; - } forEach(_this select 1); - - [_errorMsg, 5] call Epoch_message; - } - else { - ['Failed To Purchase Items', 5] call Epoch_message; - }; - }; - - EPOCH_TRADE_COMPLETE = nil; - EPOCH_TRADE_STARTED = nil; - }; }; }; diff --git a/Sources/epoch_config/Configs/CfgClientFunctions.hpp b/Sources/epoch_config/Configs/CfgClientFunctions.hpp index b43cd670..c4405dd6 100644 --- a/Sources/epoch_config/Configs/CfgClientFunctions.hpp +++ b/Sources/epoch_config/Configs/CfgClientFunctions.hpp @@ -60,6 +60,7 @@ class CfgClientFunctions }; class traders { + class NpcTrade_return {}; class startInteract {}; class startInteractNPC {}; class npcTraderAdd {}; diff --git a/Sources/epoch_server/compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf b/Sources/epoch_server/compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf index 36cf0845..571f98a1 100644 --- a/Sources/epoch_server/compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf +++ b/Sources/epoch_server/compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf @@ -12,9 +12,11 @@ Github: https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_server/compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf */ -private ["_vehicleSold","_vehHiveKey","_VAL","_makeTradeIn","_vehSlot","_playerNetID","_vehicle","_vehicles","_tradeTotal","_current_crypto","_tradeQtyTotal","_currQty","_qtyIndex","_itemWorth","_item","_itemQty","_position","_foundSmoke","_objOwner","_tmpposition","_lockOwner","_helipad","_helipads","_smoke","_vehicleBought","_playerGroup","_vehObj","_final_location","_group","_wp","_wHPos","_wH","_nearByHolder","_itemTax","_tax","_objHiveKey","_playerCryptoLimit","_config","_cIndex","_vars","_current_cryptoRaw","_aiItems","_itemClasses","_itemQtys","_returnIn","_returnOut","_slot"]; +private ["_SkipOut","_tradeIn","_tradeOut","_message","_vehicleSold","_vehHiveKey","_VAL","_makeTradeIn","_vehSlot","_playerNetID","_vehicle","_vehicles","_tradeTotal","_current_crypto","_tradeQtyTotal","_currQty","_qtyIndex","_itemWorth","_item","_itemQty","_position","_foundSmoke","_objOwner","_tmpposition","_lockOwner","_helipad","_helipads","_smoke","_vehicleBought","_playerGroup","_vehObj","_final_location","_group","_wp","_wHPos","_wH","_nearByHolder","_itemTax","_tax","_objHiveKey","_playerCryptoLimit","_config","_cIndex","_vars","_current_cryptoRaw","_aiItems","_itemClasses","_itemQtys","_returnIn","_returnOut","_slot"]; params ["_trader","_itemsIn","_itemsOut","_player",["_token","",[""]]]; +_playerUID = getplayeruid _player; + _vehicleSold = false; _vehicleBought = false; @@ -30,7 +32,11 @@ _slot = _trader getVariable["AI_SLOT", -1]; if (_slot != -1) then { _tradeTotal = 0; + _tradeIn = 0; + _tradeOut = 0; _tradeQtyTotal = 0; + _message = ""; + _SkipOut = false; _config = 'CfgPricing' call EPOCH_returnConfig; @@ -96,185 +102,241 @@ if (_slot != -1) then { if (_qtyIndex == -1) then { _itemClasses pushBack _item; _itemQtys pushBack _itemQty; - _tradeTotal = _tradeTotal + _itemWorth; + _tradeIn = _tradeIn + _itemWorth; _current_crypto = _current_crypto + _itemWorth; _tradeQtyTotal = _tradeQtyTotal + _itemQty; } else { _currQty = _itemQtys select _qtyIndex; _itemQtys set[_qtyIndex, (_currQty + _itemQty)]; - _tradeTotal = _tradeTotal + _itemWorth; + _tradeIn = _tradeIn + _itemWorth; _current_crypto = _current_crypto + _itemWorth; _tradeQtyTotal = _tradeQtyTotal + _itemQty; }; }; }; } forEach _itemsIn; + + _response = ["Bank", _playerUID] call EPOCH_fnc_server_hiveGETRANGE; + if ((_response select 0) == 1 && (_response select 1) isEqualType []) then { + _bankData = _response select 1; + if !(_bankData isEqualTo[]) then { + _serverSettingsConfig = configFile >> "CfgEpochServer"; + _MaxBankDebit = [_serverSettingsConfig, "MaxBankDebitforTrade", -999999] call EPOCH_fnc_returnConfigEntry; + _bankBalance = _bankData select 0; + if (_bankBalance < _MaxBankDebit) then { + if (_tradeIn > 0) then { + _bankBalance = _bankBalance + _tradeIn; + _return = ["Bank", _playerUID, EPOCH_expiresBank, [_bankBalance]] call EPOCH_fnc_server_hiveSETEX; + _message = _message + "Items sold, but the Money goes to your Bank - to much Bank-Debit"; + } + else { + _message = _message + "Putchase not possible - to much Bank-Debit"; + }; + _current_crypto = _current_cryptoRaw; + _tradeIn = 0; + _itemsIn = []; + _itemsOut = []; + _SkipOut = true; + }; + ['Bank',_bankBalance,'set'] remoteexec ['Ignatz_Client_PlayerStatsUpdate',_player]; + }; + }; - { - _item = _x; - _itemQty = 1; - if (isClass (_config >> _item)) then{ - _itemWorth = getNumber(_config >> _item >> "price"); - _itemTax = getNumber(_config >> _item >> "tax"); - _tax = _itemWorth * (EPOCH_taxRate + _itemTax); - _itemWorth = ceil(_itemWorth + _tax); - _qtyIndex = _itemClasses find _item; - // add items to array - if (_qtyIndex != -1) then { + if (!_SkipOut) then { + { + _item = _x; + _itemQty = 1; + if (isClass (_config >> _item)) then{ + _itemWorth = getNumber(_config >> _item >> "price"); + _itemTax = getNumber(_config >> _item >> "tax"); + _tax = _itemWorth * (EPOCH_taxRate + _itemTax); + _itemWorth = ceil(_itemWorth + _tax); + _qtyIndex = _itemClasses find _item; + // add items to array + if (_qtyIndex != -1) then { - _currQty = _itemQtys select _qtyIndex; - if (_currQty >= _itemQty) then { + _currQty = _itemQtys select _qtyIndex; + if (_currQty >= _itemQty) then { - if (_current_crypto >= _itemWorth) then { + if (_current_crypto >= _itemWorth) then { - if (_item isKindOf "Air" || _item isKindOf "Ship" || _item isKindOf "LandVehicle" || _item isKindOf "Tank") then{ + if (_item isKindOf "Air" || _item isKindOf "Ship" || _item isKindOf "LandVehicle" || _item isKindOf "Tank") then{ - if (!_vehicleBought) then { + if (!_vehicleBought) then { - if !(EPOCH_VehicleSlots isEqualTo[]) then { - _position = getPosATL _player; + if !(EPOCH_VehicleSlots isEqualTo[]) then { + _position = getPosATL _player; - _helipad = nearestObjects[_position, ["Land_HelipadEmpty_F", "Land_HelipadCircle_F"], 100]; - _helipads = []; - _smoke = nearestObject[_position, "SmokeShell"]; - if (!isNull _smoke) then { - _helipad pushBack _smoke; - }; - - // water check - if (_item isKindOf "Ship") then { - { - if (surfaceIsWater (getposATL _x)) then { - _helipads pushBack _x; - } - } forEach _helipad; - } else { - { - if !(surfaceIsWater (getposATL _x)) then { - _helipads pushBack _x; - } - } forEach _helipad; - }; - - if !(_helipads isEqualTo[]) then { - - _foundSmoke = false; - { - if (_x isKindOf "SmokeShell") then { - _objOwner = owner _x; - if (_objOwner == owner _player) then { - _position = getPosATL _x; - _foundSmoke = true; - } else { - { - if (_objOwner == owner _x) exitWith{ - _position = getPosATL _x; - _foundSmoke = true; - }; - } forEach (units _player); - }; - }; - if (_foundSmoke) exitWith {}; - } forEach _helipads; - if !(_foundSmoke) then { - _position = getPosATL (_helipads select 0); + _helipad = nearestObjects[_position, ["Land_HelipadEmpty_F", "Land_HelipadCircle_F"], 100]; + _helipads = []; + _smoke = nearestObject[_position, "SmokeShell"]; + if (!isNull _smoke) then { + _helipad pushBack _smoke; }; - } else { - _tmpposition = []; + + // water check if (_item isKindOf "Ship") then { - _tmpposition = [_position, 20, 120, 10, 0, 1000, 1] call BIS_fnc_findSafePos; - _tmpposition = [_tmpposition, 0, 60, 10, 2, 1000, 0] call BIS_fnc_findSafePos; + { + if (surfaceIsWater (getposATL _x)) then { + _helipads pushBack _x; + } + } forEach _helipad; } else { - _tmpposition = [_position, 20, 120, 20, 0, 2000, 0] call BIS_fnc_findSafePos; + { + if !(surfaceIsWater (getposATL _x)) then { + _helipads pushBack _x; + } + } forEach _helipad; }; - if ((count _tmpposition) == 2) then { - _tmpposition set [2, 0]; - if (surfaceIsWater _tmpposition) then { - _tmpposition = ATLtoASL _tmpposition; + + if !(_helipads isEqualTo[]) then { + + _foundSmoke = false; + { + if (_x isKindOf "SmokeShell") then { + _objOwner = owner _x; + if (_objOwner == owner _player) then { + _position = getPosATL _x; + _foundSmoke = true; + } else { + { + if (_objOwner == owner _x) exitWith{ + _position = getPosATL _x; + _foundSmoke = true; + }; + } forEach (units _player); + }; + }; + if (_foundSmoke) exitWith {}; + } forEach _helipads; + if !(_foundSmoke) then { + _position = getPosATL (_helipads select 0); + }; + } else { + _tmpposition = []; + if (_item isKindOf "Ship") then { + _tmpposition = [_position, 20, 150, 5, 0, 1000, 1] call BIS_fnc_findSafePos; + _tmpposition = [_tmpposition, 0, 60, 10, 2, 1000, 0] call BIS_fnc_findSafePos; + } else { + _tmpposition = [_position, 20, 120, 5, 0, 2000, 0] call BIS_fnc_findSafePos; + }; + if ((count _tmpposition) == 2) then { + _tmpposition set [2, 0]; + if (surfaceIsWater _tmpposition) then { + _tmpposition = ATLtoASL _tmpposition; + }; + _position = _tmpposition; + } + else { + _road = [getpos _player,100] call BIS_fnc_nearestRoad; + if (!isnull _road) then { + _position = getpos _road; + }; }; - _position = _tmpposition; }; + // select available slot + _vehslot = EPOCH_VehicleSlots select 0; + // Remove from available slots + EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_vehslot]; + missionNamespace setVariable ['EPOCH_VehicleSlotCount', count EPOCH_VehicleSlots, true]; + _vehicleBought = true; + + // Group access + _lockOwner = getPlayerUID _player; + _playerGroup = _player getVariable["GROUP", ""]; + if (_playerGroup != "") then { + _lockOwner = _playerGroup; + }; + + _vehObj = [_item,_position,random 360,true,_vehslot,_lockOwner,"NONE",false,false] call EPOCH_spawn_vehicle; + _final_location = getPosATL _vehObj; + + _group = group _player; + _wp = _group addWaypoint [_final_location, 0]; + deleteWaypoint [_group, 0]; + + _returnOut pushBack _item; + + _itemQtys set[_qtyIndex, (_currQty - _itemQty)]; + _tradeOut = _tradeOut - _itemWorth; + _current_crypto = _current_crypto - _itemWorth; + _tradeQtyTotal = _tradeQtyTotal + _itemQty; + } + else { + _errorMsg = "Failed to purchase vehicle."; + [_errorMsg, 5] remoteExec ['Epoch_message',_player]; }; - // select available slot - _vehslot = EPOCH_VehicleSlots select 0; - // Remove from available slots - EPOCH_VehicleSlots = EPOCH_VehicleSlots - [_vehslot]; - missionNamespace setVariable ['EPOCH_VehicleSlotCount', count EPOCH_VehicleSlots, true]; - _vehicleBought = true; + }; + } else { - // Group access - _lockOwner = getPlayerUID _player; - _playerGroup = _player getVariable["GROUP", ""]; - if (_playerGroup != "") then { - _lockOwner = _playerGroup; + if (_item isKindOf "Bag_Base") then { + _wH = objNull; + _nearByHolder = nearestObjects [position _player,["groundWeaponHolder"],3]; + if (_nearByHolder isEqualTo []) then { + _wHPos = _player modelToWorld [0,1,0]; + if (surfaceIsWater _wHPos) then { + _wHPos = ASLToATL _wHPos; + }; + _wH = createVehicle ["groundWeaponHolder",_wHPos, [], 0, "CAN_COLLIDE"]; + } else { + _wH = _nearByHolder select 0; }; - - _vehObj = [_item,_position,random 360,true,_vehslot,_lockOwner,"NONE",false,false] call EPOCH_spawn_vehicle; - _final_location = getPosATL _vehObj; - - _group = group _player; - _wp = _group addWaypoint [_final_location, 0]; - deleteWaypoint [_group, 0]; - - _returnOut pushBack _item; - - _itemQtys set[_qtyIndex, (_currQty - _itemQty)]; - _tradeTotal = _tradeTotal - _itemWorth; - _current_crypto = _current_crypto - _itemWorth; - _tradeQtyTotal = _tradeQtyTotal + _itemQty; - } else { - // diag_log "DEBUG: no slots found to spawn vehicle"; - // [_errorMsg, 5] call Epoch_message; - _errorMsg = "Failed to purchase vehicle."; - [_errorMsg, 5] remoteExec ['Epoch_message',_player]; + _wh addBackpackCargoGlobal [_item,1]; }; + _returnOut pushBack _item; + _itemQtys set[_qtyIndex, (_currQty - _itemQty)]; + _tradeOut = _tradeOut - _itemWorth; + _current_crypto = _current_crypto - _itemWorth; + _tradeQtyTotal = _tradeQtyTotal + _itemQty; }; - } else { - - if (_item isKindOf "Bag_Base") then { - _wH = objNull; - _nearByHolder = nearestObjects [position _player,["groundWeaponHolder"],3]; - if (_nearByHolder isEqualTo []) then { - _wHPos = _player modelToWorld [0,1,0]; - if (surfaceIsWater _wHPos) then { - _wHPos = ASLToATL _wHPos; - }; - _wH = createVehicle ["groundWeaponHolder",_wHPos, [], 0, "CAN_COLLIDE"]; - } else { - _wH = _nearByHolder select 0; - }; - _wh addBackpackCargoGlobal [_item,1]; - }; - - _returnOut pushBack _item; - - _itemQtys set[_qtyIndex, (_currQty - _itemQty)]; - _tradeTotal = _tradeTotal - _itemWorth; - _current_crypto = _current_crypto - _itemWorth; - _tradeQtyTotal = _tradeQtyTotal + _itemQty; }; }; }; }; - }; - } forEach _itemsOut; + } forEach _itemsOut; + }; + + + if !(_itemsIn isEqualTo []) then { + if (_itemsIn isEqualTo _returnIn) then { + _message = _message + "All Items sold"; + } + else { + _message = _message + "Not all Items sold"; + }; + }; + if !(_itemsOut isEqualTo []) then { + if (_itemsOut isEqualTo _returnOut) then { + if !(_message isequalto "") then { + _message = _message + " | "; + }; + _message = _message + "All Items purchased"; + } + else { + if !(_message isequalto "") then { + _message = _message + " / "; + }; + _message = _message + "Not all Items purchased"; + }; + }; - if (_itemsIn isEqualTo _returnIn || _itemsOut isEqualTo _returnOut) then { - // save changes to array + _tradeTotal = _tradeIn + _tradeOut; + + + if !(_returnIn isequalto [] && _returnOut isEqualTo []) then { _trader setVariable["AI_ITEMS", [_itemClasses, _itemQtys], true]; - // Force Save _objHiveKey = format["%1:%2", (call EPOCH_fn_InstanceID), _slot]; ["AI_ITEMS", _objHiveKey, EPOCH_expiresAIdata, [_itemClasses, _itemQtys]] call EPOCH_fnc_server_hiveSETEX; - // push crypto changes to player - _playerCryptoLimit = EPOCH_customVarLimits select _cIndex; - _playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"]; - _current_crypto = ((_current_cryptoRaw + _tradeTotal) min _playerCryptoLimitMax) max _playerCryptoLimitMin; - // send to player - _current_crypto remoteExec ['EPOCH_effectCrypto',_player]; - _vars set[_cIndex, _current_crypto]; - _player setVariable["VARS", _vars]; + if !(_tradeTotal isequalto 0) then { + _playerCryptoLimit = EPOCH_customVarLimits select _cIndex; + _playerCryptoLimit params ["_playerCryptoLimitMax","_playerCryptoLimitMin"]; + _current_crypto = ((_current_cryptoRaw + _tradeTotal) min _playerCryptoLimitMax) max _playerCryptoLimitMin; + _current_crypto remoteExec ['EPOCH_effectCrypto',_player]; + _vars set[_cIndex, _current_crypto]; + _player setVariable["VARS", _vars]; + }; }; // Send completed trade back to player - [["tradeComplete", [_returnIn, _returnOut]], _player] call EPOCH_sendRemoteExecClient; + [_returnIn, _returnOut,_message] remoteexec ["EPOCH_NpcTrade_return",_player]; }; From a18819d984ac75f3d0ee5146f5e2c4d5d05df67b Mon Sep 17 00:00:00 2001 From: He-Man Date: Fri, 10 Feb 2017 21:30:41 +0100 Subject: [PATCH 13/15] Update EPOCH_server_makeNPCTrade.sqf --- .../compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/epoch_server/compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf b/Sources/epoch_server/compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf index 571f98a1..3a0348dc 100644 --- a/Sources/epoch_server/compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf +++ b/Sources/epoch_server/compile/epoch_trading/EPOCH_server_makeNPCTrade.sqf @@ -138,7 +138,6 @@ if (_slot != -1) then { _itemsOut = []; _SkipOut = true; }; - ['Bank',_bankBalance,'set'] remoteexec ['Ignatz_Client_PlayerStatsUpdate',_player]; }; }; From 2467875a80ebe5316a2749c1d6ffce09ceaca89e Mon Sep 17 00:00:00 2001 From: He-Man Date: Fri, 10 Feb 2017 21:34:45 +0100 Subject: [PATCH 14/15] Update EPOCH_NpcTrade_return.sqf --- .../compile/traders/EPOCH_NpcTrade_return.sqf | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Sources/epoch_code/compile/traders/EPOCH_NpcTrade_return.sqf b/Sources/epoch_code/compile/traders/EPOCH_NpcTrade_return.sqf index 0b0a9c9a..31d2664f 100644 --- a/Sources/epoch_code/compile/traders/EPOCH_NpcTrade_return.sqf +++ b/Sources/epoch_code/compile/traders/EPOCH_NpcTrade_return.sqf @@ -71,16 +71,3 @@ if !(_message isequalto "") then { }; EPOCH_TRADE_STARTED = nil; - -// Ignatz ... -if (isnil 'Ignatz_LastTrade') then { - Ignatz_LastTrade = diag_ticktime; - ['Tradings',1,'add'] call Ignatz_Client_PlayerStatsUpdate; -} -else { - if (diag_ticktime > Ignatz_LastTrade+300) then { - ['Tradings',1,'add'] call Ignatz_Client_PlayerStatsUpdate; - Ignatz_LastTrade = diag_ticktime; - }; -}; -// ... Ignatz From fa05a9d9eb9b1caf1b51251fdeab74950293899e Mon Sep 17 00:00:00 2001 From: He-Man Date: Wed, 15 Feb 2017 23:46:16 +0100 Subject: [PATCH 15/15] Fixed forcewalk stucks --- .../compile/interface_event_handlers/EPOCH_KeyDown.sqf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf b/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf index 9f2e3b0a..bbb2c01f 100644 --- a/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf +++ b/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf @@ -150,6 +150,9 @@ if (vehicle player == player) then { _currentPos = ATLtoASL _currentPos; }; player forceWalk(lineIntersects[eyePos player, _currentPos, player, objNull]); + } + else { + player forceWalk false; }; }; };