From 7a1058cb6d2193e92de02ea8964f53a962539dd1 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Thu, 18 Feb 2016 14:16:47 -0500 Subject: [PATCH 1/4] Block local script execution bug See:
https://dev.arma3.com/post/spotrep-00045
Fixed: Exploit with inGameUISetEventHandler granted a menu hack
possibility
Still not fixed in A20A as of 1.63.131129 --- SQF/dayz_code/system/antihack.sqf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SQF/dayz_code/system/antihack.sqf b/SQF/dayz_code/system/antihack.sqf index 54ee7b5f2..1aef2b95a 100644 --- a/SQF/dayz_code/system/antihack.sqf +++ b/SQF/dayz_code/system/antihack.sqf @@ -1,3 +1,8 @@ +/* Block local script execution bug. Still not fixed in A20A as of 1.63.131129 */ +inGameUISetEventHandler ["PrevAction","false"]; +inGameUISetEventHandler ["NextAction","false"]; +inGameUISetEventHandler ["Action","false"]; + /* Anti-Teleport - Created By Razor / Refactored By Alby & CopyPasted to Epoch by Skaronator */ From 65c2a7e6b44cb0da35a3cf9afc70b83e5db4e9a8 Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Thu, 18 Feb 2016 19:38:23 -0500 Subject: [PATCH 2/4] Fix opening supply crate over water See #1558 --- CHANGE LOG 1.0.6.txt | 2 ++ SQF/dayz_code/actions/player_craftItem.sqf | 5 ++++- SQF/dayz_code/actions/player_loadCrate.sqf | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGE LOG 1.0.6.txt b/CHANGE LOG 1.0.6.txt index 33ffdd222..fead8e821 100644 --- a/CHANGE LOG 1.0.6.txt +++ b/CHANGE LOG 1.0.6.txt @@ -36,6 +36,8 @@ [FIXED] Loading screen issue where you can walk around and see a black screen #1610 @deanreid [FIXED] Crafting a sledgehammer with one already in your toolbelt no longer eats your parts. #1567 #1667 @Namindu [FIXED] DarkUI hunger and thirst inconsistency with vanilla UI and health system @SplenectomY @icomrade #1622 +[FIXED] Fire barrels not being detected over water @pj999 @icomrade #1559 +[FIXED] Opening supply crates over water no longer drops the items on the sea floor @pj999 @icomrade #1558 [UPDATED] .hpp files updated in dayz_epoch_b CfgLootPos > CfgBuildingPos. @Uro1 [UPDATED] .bat files updated in Config-Examples @Raziel23x diff --git a/SQF/dayz_code/actions/player_craftItem.sqf b/SQF/dayz_code/actions/player_craftItem.sqf index 3ce42871a..989d82dfb 100644 --- a/SQF/dayz_code/actions/player_craftItem.sqf +++ b/SQF/dayz_code/actions/player_craftItem.sqf @@ -229,7 +229,10 @@ if (_canDo) then { _bag addWeaponCargoGlobal [_x,1]; } else { systemChat format[(localize "str_epoch_player_314"),_x]; - _object = createVehicle ["WeaponHolder",position player,[],0,"CAN_COLLIDE"]; + _location = player modeltoworld [0,0.3,0]; + if ((_location select 2) < 0) then {_location set [2,0];}; + _object = createVehicle ["WeaponHolder",_location,[],0,"CAN_COLLIDE"]; + if (surfaceIsWater _location) then {_object setPosASL (getPosASL player);} else {_object setPosATL _location;}; _object setVariable ["permaLoot",true]; _object addWeaponCargoGlobal [_x,1]; }; diff --git a/SQF/dayz_code/actions/player_loadCrate.sqf b/SQF/dayz_code/actions/player_loadCrate.sqf index 3a1e80252..df3c6e8c8 100644 --- a/SQF/dayz_code/actions/player_loadCrate.sqf +++ b/SQF/dayz_code/actions/player_loadCrate.sqf @@ -54,7 +54,7 @@ if(_type == "backpack") then { _b0x1337 addBackpackCargoGlobal [_create,_qty]; }; if (surfaceIsWater _location) then { - _b0x1337 setPosASL _location; + _b0x1337 setPosASL (getPosASL player); } else { _b0x1337 setPosATL _location; }; From 4f18f1c884e5d51948c89edb4d11500c33c3ba2b Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Thu, 18 Feb 2016 20:39:00 -0500 Subject: [PATCH 3/4] Update change log --- CHANGE LOG 1.0.6.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGE LOG 1.0.6.txt b/CHANGE LOG 1.0.6.txt index fead8e821..6737fc67e 100644 --- a/CHANGE LOG 1.0.6.txt +++ b/CHANGE LOG 1.0.6.txt @@ -16,6 +16,7 @@ [CHANGED] Tweaked fuel capacity variables for vehicles. @RimBlock [CHANGED] Tweaked rotate_logs.bat to incorporate the day of the week for better organization @Raziel23x [CHANGED] All instances of sleep replaced with the more reliable uiSleep @icomrade +[CHANGED] Several getPosATL changed to call FNC_GetPos for water compatibility @icomrade [FIXED] Backpack wipes when changing clothes. #1361 @icomrade [FIXED] CH53 gear when locked #1364 @icomrade @@ -36,7 +37,7 @@ [FIXED] Loading screen issue where you can walk around and see a black screen #1610 @deanreid [FIXED] Crafting a sledgehammer with one already in your toolbelt no longer eats your parts. #1567 #1667 @Namindu [FIXED] DarkUI hunger and thirst inconsistency with vanilla UI and health system @SplenectomY @icomrade #1622 -[FIXED] Fire barrels not being detected over water @pj999 @icomrade #1559 +[FIXED] Fire barrels not being detected over water @pj999 @icomrade #1559 #1564 [FIXED] Opening supply crates over water no longer drops the items on the sea floor @pj999 @icomrade #1558 [UPDATED] .hpp files updated in dayz_epoch_b CfgLootPos > CfgBuildingPos. @Uro1 From fd78f272504d5c6a0ea0d75f015e566173f12c6e Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Thu, 18 Feb 2016 22:12:13 -0500 Subject: [PATCH 4/4] Fix copy key failing when player has no backpack Related to #1567, so I made this a function so it can be reused. People should call this whenever they are adding a toolbelt item which the player may already have. It has localized strings and handles spawning the weapon holder on water, land and rooftop. Tested both the sledgehammer and key copying. Confirmed all three conditions are working. --- CHANGE LOG 1.0.6.txt | 1 + SQF/dayz_code/actions/player_copyKey.sqf | 8 +--- SQF/dayz_code/actions/player_craftItem.sqf | 16 +------- SQF/dayz_code/compile/fn_addDuplicateTool.sqf | 40 +++++++++++++++++++ SQF/dayz_code/compile/fn_checkItems.sqf | 6 +-- SQF/dayz_code/compile/fn_hasTools.sqf | 4 +- SQF/dayz_code/init/compiles.sqf | 1 + SQF/dayz_epoch_b/stringtable.xml | 10 ----- 8 files changed, 51 insertions(+), 35 deletions(-) create mode 100644 SQF/dayz_code/compile/fn_addDuplicateTool.sqf diff --git a/CHANGE LOG 1.0.6.txt b/CHANGE LOG 1.0.6.txt index 6737fc67e..85a1da5ee 100644 --- a/CHANGE LOG 1.0.6.txt +++ b/CHANGE LOG 1.0.6.txt @@ -36,6 +36,7 @@ [FIXED] Trader menu expected array error #1618-1620 @ebaydayz [FIXED] Loading screen issue where you can walk around and see a black screen #1610 @deanreid [FIXED] Crafting a sledgehammer with one already in your toolbelt no longer eats your parts. #1567 #1667 @Namindu +[FIXED] Copy key failing when player doesn't have a backpack @ebaydayz [FIXED] DarkUI hunger and thirst inconsistency with vanilla UI and health system @SplenectomY @icomrade #1622 [FIXED] Fire barrels not being detected over water @pj999 @icomrade #1559 #1564 [FIXED] Opening supply crates over water no longer drops the items on the sea floor @pj999 @icomrade #1558 diff --git a/SQF/dayz_code/actions/player_copyKey.sqf b/SQF/dayz_code/actions/player_copyKey.sqf index 927b68c03..659cdccf0 100644 --- a/SQF/dayz_code/actions/player_copyKey.sqf +++ b/SQF/dayz_code/actions/player_copyKey.sqf @@ -1,4 +1,4 @@ -private ["_item","_config","_pos","_onLadder","_create","_started","_finished","_animState","_isMedic","_qty","_b0x1337","_num_removed","_text","_haskey","_hastoolweapon","_isNear","_hasTinBar"]; +private ["_item","_config","_pos","_onLadder","_create","_started","_finished","_animState","_isMedic","_num_removed","_text","_haskey","_hastoolweapon","_isNear","_hasTinBar"]; if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_56") , "PLAIN DOWN"]; }; DZE_ActionInProgress = true; @@ -59,12 +59,8 @@ if(_finished) then { _num_removed = ([player,"ItemTinBar"] call BIS_fnc_invRemove); if(_num_removed == 1) then { - // output key to backpack if space _create = _item; - _qty = 1; - _b0x1337 = unitBackpack player; - _b0x1337 addWeaponCargoGlobal [_create,_qty]; - cutText [(localize "str_epoch_player_60") , "PLAIN DOWN"]; + _create call player_addDuplicateTool; } else { cutText [(localize "str_epoch_player_61") , "PLAIN DOWN"]; }; diff --git a/SQF/dayz_code/actions/player_craftItem.sqf b/SQF/dayz_code/actions/player_craftItem.sqf index 989d82dfb..5952c34b1 100644 --- a/SQF/dayz_code/actions/player_craftItem.sqf +++ b/SQF/dayz_code/actions/player_craftItem.sqf @@ -222,20 +222,8 @@ if (_canDo) then { _craft_doLoop = false; }; { - if ((_x == "ItemSledge") && {_x in items player}) then { - _bag = unitBackpack player; - if (!isNull _bag) then { - systemChat format[(localize "str_epoch_player_313"),_x]; - _bag addWeaponCargoGlobal [_x,1]; - } else { - systemChat format[(localize "str_epoch_player_314"),_x]; - _location = player modeltoworld [0,0.3,0]; - if ((_location select 2) < 0) then {_location set [2,0];}; - _object = createVehicle ["WeaponHolder",_location,[],0,"CAN_COLLIDE"]; - if (surfaceIsWater _location) then {_object setPosASL (getPosASL player);} else {_object setPosATL _location;}; - _object setVariable ["permaLoot",true]; - _object addWeaponCargoGlobal [_x,1]; - }; + if (_x == "ItemSledge") then { + _x call player_addDuplicateTool; } else { player addWeapon _x; }; diff --git a/SQF/dayz_code/compile/fn_addDuplicateTool.sqf b/SQF/dayz_code/compile/fn_addDuplicateTool.sqf new file mode 100644 index 000000000..c9a4571b3 --- /dev/null +++ b/SQF/dayz_code/compile/fn_addDuplicateTool.sqf @@ -0,0 +1,40 @@ +/* +Description: +Checks whether the player already has the tool on their toolbelt and then adds it. Useful for batch crafting tools. +1. If they don't then it adds it to their toolbelt. +2. If they do then it adds it to their backpack. If their backpack is full it simply falls on the ground. +3. If they have no backpack it spawns on the floor as a last resort. +The player is given an appropriate systemChat message in case 2 or 3. + +Parameter: +_this: string - toolbelt item classname to check and add + +Returns: +false if item is not a duplicate, otherwise true + +How to use: +"ItemSledge" call player_addDuplicateTool; +*/ +private ["_bag","_hasTool","_location","_object"]; +_hasTool = true; + +if (_this in items player) then { + _bag = unitBackpack player; + if (!isNull _bag) then { + systemChat format[(localize "str_epoch_player_313"),_this]; + _bag addWeaponCargoGlobal [_this,1]; + } else { + systemChat format[(localize "str_epoch_player_314"),_this]; + _location = player modeltoworld [0,0.3,0]; + if ((_location select 2) < 0) then {_location set [2,0];}; + _object = createVehicle ["WeaponHolder",_location,[],0,"CAN_COLLIDE"]; + if (surfaceIsWater _location) then {_object setPosASL (getPosASL player);} else {_object setPosATL _location;}; + _object setVariable ["permaLoot",true]; + _object addWeaponCargoGlobal [_this,1]; + }; +} else { + _hasTool = false; + player addWeapon _this; +}; + +_hasTool \ No newline at end of file diff --git a/SQF/dayz_code/compile/fn_checkItems.sqf b/SQF/dayz_code/compile/fn_checkItems.sqf index 958f62500..bc61a8200 100644 --- a/SQF/dayz_code/compile/fn_checkItems.sqf +++ b/SQF/dayz_code/compile/fn_checkItems.sqf @@ -1,10 +1,10 @@ /* Description: -Checks whether the player has the required items (magazines) || not -&& displays a message if an item is missing. +Checks whether the player has the required items (magazines) or not +and displays a message if an item is missing. Parameter(s): -_this: list of item names the player is required to have (can also be an sub-array with item name && quantity) +_this: list of item names the player is required to have (can also be an sub-array with item name and quantity) Returns: Boolean (true if the player has all required items) diff --git a/SQF/dayz_code/compile/fn_hasTools.sqf b/SQF/dayz_code/compile/fn_hasTools.sqf index 05978b850..72b9ae593 100644 --- a/SQF/dayz_code/compile/fn_hasTools.sqf +++ b/SQF/dayz_code/compile/fn_hasTools.sqf @@ -1,7 +1,7 @@ /* Description: -Checks whether the player has the required tools equipped || not -&& displays a message if a tool is missing from the tool belt. +Checks whether the player has the required tools equipped or not +and displays a message if a tool is missing from the tool belt. Parameter(s): _this: list of tool names the player is required to have diff --git a/SQF/dayz_code/init/compiles.sqf b/SQF/dayz_code/init/compiles.sqf index e2177b91b..d5b5495ca 100644 --- a/SQF/dayz_code/init/compiles.sqf +++ b/SQF/dayz_code/init/compiles.sqf @@ -141,6 +141,7 @@ if (!isDedicated) then { onPreloadFinished "if (!isNil 'init_keyboard') then { [] spawn init_keyboard; }; dayz_preloadFinished = true;"; // helper functions + player_addDuplicateTool = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_addDuplicateTool.sqf"; player_hasTools = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_hasTools.sqf"; player_checkItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_checkItems.sqf"; player_removeItems = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_removeItems.sqf"; diff --git a/SQF/dayz_epoch_b/stringtable.xml b/SQF/dayz_epoch_b/stringtable.xml index 90ef19370..10724e879 100644 --- a/SQF/dayz_epoch_b/stringtable.xml +++ b/SQF/dayz_epoch_b/stringtable.xml @@ -3306,16 +3306,6 @@ \n\nConstruire une clé requiert une barre de fer \n\nNa vytvoření klíče potřebujete 1 cihličku cínu - - \n\nCopied key has been added to your backpack. - \n\nCopied key has been added to your backpack. - \n\nDer kopierte Schlüssel wurde Ihrem Rücksack hinzugefügt. - \n\nСкопированный ключ был добавлен в ваш рюкзак. - - \n\nDe gekopieerde sleutel is in je rugzak gestopt. - \n\nLe double de la clé a été ajouté dans votre sac à dos. - Zkopírovaný klíč byl přidán do batohu - \n\nCanceled Key Crafting. \n\nCanceled Key Crafting.