diff --git a/Sources/epoch_code/compile/functions/EPOCH_fnc_getHitPointsDamageAverage.sqf b/Sources/epoch_code/compile/functions/EPOCH_fnc_getHitPointsDamageAverage.sqf new file mode 100644 index 00000000..d0828d4c --- /dev/null +++ b/Sources/epoch_code/compile/functions/EPOCH_fnc_getHitPointsDamageAverage.sqf @@ -0,0 +1,37 @@ +/* + Author: Aaron Clark - EpochMod.com + + Contributors: + + Description: + Function to check HitPointDamageAverage. + + 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/functions/EPOCH_fnc_getHitPointsDamageAverage.sqf + + Example: + _average = [cursorObject, "steering", 1] call EPOCH_fnc_getHitPointsDamageAverage;; + + Parameter(s): + _this select 0: OBJECT - Object to check Hitpoints + _this select 1: STRING - String to find in Hitpointname (e.g. "wheel"); + _this select 2: SCALAR - Sub-Array in getAllHitPointsDamage to search for String (default = 0) + _this select 3: SCALAR - Sub-Array for Hitpoint-Values in getAllHitPointsDamage (default = 2) + + Returns: + SCALAR +*/ +params [ "_object", "_match", ["_indexIn", 0], ["_indexOut", 2] ]; +_dmg = 0; +_parts = 0; +_allHitPoints = getAllHitPointsDamage _object; +{ + if ((toLower(_x) find _match) != -1) then { + _dmg = _dmg + ((_allHitPoints select _indexOut) select _forEachIndex); + _parts = _parts + 1; + }; +} forEach (_allHitPoints select _indexIn); +(_dmg / _parts) 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 97d1495f..156a0bef 100644 --- a/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf +++ b/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyDown.sqf @@ -38,12 +38,19 @@ if (_handled) exitWith{ true }; if !(alive player) exitWith{ false }; EPOCH_doRotate = false; -EPOCH_modKeys = [_shift,_ctrl,_alt]; -'modifier' spawn epoch_favBar_draw; + +if !(EPOCH_modKeys isequalto [_shift,_ctrl,_alt]) then { + EPOCH_modKeys = [_shift,_ctrl,_alt]; + call epoch_favBar_modifier; +}; //Favorites bar if (_dikCode in [EPOCH_keysfav1,EPOCH_keysfav2,EPOCH_keysfav3,EPOCH_keysfav4,EPOCH_keysfav5]) then { - _this call epoch_favBar_action; + if (isnull EPOCH_Target) then { + _this call epoch_favBar_action; + } else { + "Can't use while in building mode!" call epoch_message; + }; }; // increase vol @@ -107,7 +114,7 @@ if (_dikCode == EPOCH_keysAction) then { // Player only code if (vehicle player == player) then { - if (_dikCode == EPOCH_keysBuildMode1 && EPOCH_buildMode > 0) then { + if ((_dikCode == EPOCH_keysBuildMode1 && !EPOCH_favBar_itemConsumed) && EPOCH_buildMode > 0) then { EPOCH_buildMode = 0; ["Build Mode: Disabled", 5] call Epoch_message; EPOCH_Target = objNull; @@ -231,6 +238,8 @@ if (vehicle player == player) then { }; // end player only code +EPOCH_favBar_itemConsumed = false; + if (_dikCode in (actionKeys "Salute")) then { if (_ctrl) then { player playactionNow "GestureFinger"; 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 ffb67d84..51960002 100644 --- a/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyUp.sqf +++ b/Sources/epoch_code/compile/interface_event_handlers/EPOCH_KeyUp.sqf @@ -34,8 +34,10 @@ _handled = false; _this call Epoch_custom_EH_KeyUp; if (_handled) exitWith{ true }; -EPOCH_modKeys = [_shift,_ctrl,_alt]; -'modifier' spawn epoch_favBar_draw; +if !(EPOCH_modKeys isequalto [_shift,_ctrl,_alt]) then { + EPOCH_modKeys = [_shift,_ctrl,_alt]; + call epoch_favBar_modifier; +}; //Main actions if (_dikCode == EPOCH_keysAction) then { diff --git a/Sources/epoch_code/compile/inventory/EPOCH_equip.sqf b/Sources/epoch_code/compile/inventory/EPOCH_equip.sqf index db21cf08..875b89f7 100644 --- a/Sources/epoch_code/compile/inventory/EPOCH_equip.sqf +++ b/Sources/epoch_code/compile/inventory/EPOCH_equip.sqf @@ -30,21 +30,21 @@ 4 - not enough space 5 - accessory not compatible */ -private ["_item","_drop","_forceEquip"]; +private ["_item","_drop","_forceEquip","_return","_loadout","_slot","_uniform","_vest","_bpack","_uniformItems","_vestItems","_bPackItems","_itemInInventory", +"_fnc_dropItem","_fnc_findItemInContainers","_fnc_moveWeaponFromContainer","_fnc_MoveWeaponToContainer","_fnc_canMoveToContainer","_fnc_dropEquipWeapon","_fnc_dropAssign", +"_fnc_MoveShellToContainer","_fnc_moveShellFromContainer","_fnc_dropEquipShells","_fnc_findAccessorySlot","_fnc_dropEquipAccessories"]; params [["_item","",[""]],["_drop",false,[false]],["_forceEquip",false,[false]]]; _return = 0; if (_item == "") exitWith {_return}; _slot = _item call epoch_itemTypeSlot; _loadout = getUnitLoadout player; -_loadout params ["_pSlot","_sSlot","_hSlot","_uniform","_vest","_bpack","_helm","_goggles","_bino","_assigned"]; -_pSlot params ["_pWeapon","_pSilencer","_pLaser","_pOptic","_pMag","_pMag2","_pBipod"]; -_sSlot params ["_sWeapon","_sSilencer","_sLaser","_sOptic","_sMag","_sBipod"]; -_hSlot params ["_hWeapon","_hSilencer","_hLaser","_hOptic","_hMag","_hBipod"]; +_uniform = _loadout param [3,[]]; +_vest = _loadout param [4,[]]; +_bpack = _loadout param [5,[]]; _uniformItems = _uniform param [1,[]]; _vestItems = _vest param [1,[]]; _bPackItems = _bPack param [1,[]]; -_binoculars = _bino param [0,[]]; _itemInInventory = _item in ((magazines player) + (items player)); @@ -73,7 +73,7 @@ _fnc_dropItem = { }; _fnc_findItemInContainers = { - private "_item"; + private ["_item","_container","_index","_found","_currItem"]; params ["_item"]; _container = 0; @@ -96,7 +96,7 @@ _fnc_findItemInContainers = { if _found exitWith {}; } forEach [_uniformItems,_vestItems,_bPackItems]; - [_container,_index,_found]; + [_container,_index,_found] }; _fnc_moveWeaponFromContainer = { @@ -292,7 +292,7 @@ _fnc_dropEquipShells = { _fnc_findAccessorySlot = { _item = toLower _item; - private ["_found","_slot","_accessory"]; + private ["_found","_slot","_accessory","_compatibleMuzzles","_compatibleCows","_compatiblePointers","_compatibleBipods"]; _slot = 0; _accessory = 0; _found = false; @@ -322,7 +322,7 @@ _fnc_findAccessorySlot = { if (_item in _compatibleBipods) exitWith {_found = true; _accessory = 6}; } forEach [(primaryWeapon player),(secondaryWeapon player),(handgunWeapon player)]; - [_found,_slot,_accessory]; + [_found,_slot,_accessory] }; _fnc_dropEquipAccessories = { @@ -339,7 +339,7 @@ _fnc_dropEquipAccessories = { _item = toLower _item; _itemEquipped = _item in _itemsPlayer; _equipped = (_loadout select _slot) select _accessory; - systemChat str [_item,_equipped]; + if (!_itemInInventory && !_itemEquipped) exitWith {_return = 3}; if (_equipped != "") then { _equipped = (_loadout select _slot) select _accessory; @@ -369,7 +369,7 @@ _fnc_dropEquipAccessories = { }; player selectWeapon ((_loadout select _slot) select 0); - if (!EPOCH_fav_FastWeaponSwitching) then { + if !(["CfgEpochClient", "Fav_FastWeaponSwitching", false] call EPOCH_fnc_returnConfigEntryV2) then { player playAction "reloadMagazine"; }; _return @@ -452,6 +452,7 @@ switch _slot do { }; case 12: //mines { + private ["_allMuzzles","_muzzle","_found","_mags"]; if (_itemInInventory) then { _allMuzzles = getArray (configFile >> "CfgWeapons" >> "Put" >> "Muzzles"); diff --git a/Sources/epoch_code/compile/inventory/EPOCH_itemTypeSlot.sqf b/Sources/epoch_code/compile/inventory/EPOCH_itemTypeSlot.sqf index edb32ab1..22d2317b 100644 --- a/Sources/epoch_code/compile/inventory/EPOCH_itemTypeSlot.sqf +++ b/Sources/epoch_code/compile/inventory/EPOCH_itemTypeSlot.sqf @@ -34,7 +34,7 @@ 17 - Grenades 17 - Unsure about these, modify script as required, but don't change existing structure */ -private ["_item"]; +private ["_item","_cat","_type"]; params [["_item","",[""]]]; if (_item == "") exitWith {false}; @@ -61,15 +61,4 @@ if (_type == "Grenade") exitWith {17}; //unsure if (_type in ["Magazine","Shotgun","FirstAidKit","LaserDesignator","Medikit","MineDetector","Toolkit","VehicleWeapon","Unknown","UnknownEquipment","UnknownWeapon"]) exitWith {18}; -0 - - - - - - - - - - - +0 \ No newline at end of file diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf index 1ae50a7e..e1afb736 100644 --- a/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf +++ b/Sources/epoch_code/compile/setup/masterLoop/Event1.sqf @@ -162,9 +162,6 @@ if (EPOCH_debugMode) then { // player to player trade loop call EPOCH_TradeLoop; -//Updates favorites bar -call epoch_favBar_refresh; - // blank out unused hud elements and prepare for next loop _hudIndex = missionNamespace getVariable [format["EPOCH_dynHUD_%1","topRight"],1]; for "_i" from _hudIndex to 9 do { diff --git a/Sources/epoch_code/compile/setup/masterLoop/Event8.sqf b/Sources/epoch_code/compile/setup/masterLoop/Event8.sqf new file mode 100644 index 00000000..116ce905 --- /dev/null +++ b/Sources/epoch_code/compile/setup/masterLoop/Event8.sqf @@ -0,0 +1,2 @@ +//Updates favorites bar +call epoch_favBar_refresh; \ No newline at end of file diff --git a/Sources/epoch_code/compile/traders/EPOCH_calcDamageCost.sqf b/Sources/epoch_code/compile/traders/EPOCH_calcDamageCost.sqf new file mode 100644 index 00000000..ae866def --- /dev/null +++ b/Sources/epoch_code/compile/traders/EPOCH_calcDamageCost.sqf @@ -0,0 +1,35 @@ +/* + Author: Raimonds Virtoss - EpochMod.com + + Contributors: + + Description: Takes in total cost of vehicle and returns new price with damage % taken into account + + 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/gui/scripts/favBar/epoch_favBar_refresh.sqf + + Usage: [_vehOBJ,_costINT] call EPOCH_calcDamageCost; +*/ + +private ["_dmg","_hitPoints"]; +params [["_obj",objNull, [objNull]],["_cost",0, [0]]]; + +if (_obj isEqualTo objNull) exitWith {-1}; + +_hitPoints = getAllHitPointsDamage _obj; +_totalHPoints = count (_hitPoints select 1); +_totalDamagedPoints = 0; +{ + _dmg = _hitPoints select 2 select _forEachIndex; + if (_dmg > 0) then { + _totalDamagedPoints = _totalDamagedPoints +1; + }; +} forEach (_hitPoints select 1); + +_math = round (_totalDamagedPoints / _totalHPoints * 100); +_newCost = _cost - _math; + +_newCost \ No newline at end of file diff --git a/Sources/epoch_code/compile/traders/EPOCH_npcTraderAdd.sqf b/Sources/epoch_code/compile/traders/EPOCH_npcTraderAdd.sqf index fd938ff7..19386532 100644 --- a/Sources/epoch_code/compile/traders/EPOCH_npcTraderAdd.sqf +++ b/Sources/epoch_code/compile/traders/EPOCH_npcTraderAdd.sqf @@ -1,5 +1,5 @@ //[[[cog import generate_private_arrays ]]] -private ["_aiItems","_allowAdd","_array","_config","_cryptoCount","_index","_item","_itemClasses","_itemQtys","_itemTax","_itemWorth","_limit","_qtyIndex","_sizeOut","_slot","_stockLimit","_tax","_uiItem","_worth"]; +private ["_errormsg","_aiItems","_allowAdd","_array","_config","_cryptoCount","_index","_item","_itemClasses","_itemQtys","_itemTax","_itemWorth","_limit","_qtyIndex","_sizeOut","_slot","_stockLimit","_tax","_uiItem","_worth"]; //[[[end]]] params ["_control","_selected"]; @@ -8,6 +8,7 @@ if !(isNull EPOCH_lastNPCtradeTarget) then { _allowAdd = true; _stockLimit = false; _uiItem = (_selected select 0) lbData (_selected select 1); + _errormsg = "Limit one per trade"; _config = 'CfgPricing' call EPOCH_returnConfig; if (isClass(_config >> _uiItem)) then{ @@ -33,6 +34,23 @@ if !(isNull EPOCH_lastNPCtradeTarget) then { }; if (_uiItem isKindOf "Air" || _uiItem isKindOf "Ship" || _uiItem isKindOf "LandVehicle" || _uiItem isKindOf "Tank") then { + if (["CfgEpochClient", "DisallowSellOnDamage", false] call EPOCH_fnc_returnConfigEntryV2) then { + { + _vehicle = _x; + if (local _vehicle && (typeof _vehicle) isequalto _uiItem) then { + { + if ((["wheel",tolower _x] call bis_fnc_instring) || _x isequalto "HitEngine") then { + if (((getAllHitPointsDamage _vehicle) select 2 select _foreachindex) >= 1) then { + _allowAdd = false; + _errormsg = "Cannot be sold - too much damage"; + }; + }; + if (!_allowAdd) exitwith {}; + } foreach ((getAllHitPointsDamage _vehicle) select 0); + }; + if (!_allowAdd) exitwith {}; + } foreach (EPOCH_lastNPCtradeTarget nearEntities[[_uiItem], 30]); + }; // check if a vehicle is already on the list _sizeOut = lbSize 41501; @@ -94,7 +112,7 @@ if !(isNull EPOCH_lastNPCtradeTarget) then { if (_stockLimit) then{ ["Trader has the maximum amount of this item", 5] call Epoch_message; } else { - ["Limit one per trade", 5] call Epoch_message; + [_errormsg, 5] call Epoch_message; }; }; }; diff --git a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_action.sqf b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_action.sqf index 7d7196eb..6b347513 100644 --- a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_action.sqf +++ b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_action.sqf @@ -13,7 +13,7 @@ Usage: none */ -private ["_item","_slot"]; +private ["_item","_slot","_dsp","_kee","_tileIdx","_itemHasInteraction","_force","_errorCode","_curSlot","_Fav_DropIfOverflow","_Fav_FastWeaponSwitching"]; params ["_dsp","_kee"]; _tileIdx = switch (_kee) do { @@ -30,15 +30,18 @@ _itemHasInteraction = str(missionConfigFile >> "CfgItemInteractions" >> _item) ! if (_itemHasInteraction) then { EPOCH_InteractedItem = ["",_item,""]; [] call EPOCH_consumeItem; + EPOCH_favBar_itemConsumed = true; } else { + _Fav_DropIfOverflow = ["CfgEpochClient", "Fav_DropIfOverflow", false] call EPOCH_fnc_returnConfigEntryV2; _slot = _item call epoch_itemTypeSlot; _force = if (_slot in [3,4,5,7,8,10,11,16]) then {true} else {false}; //see how it works with other items, definitely keep true for weapons - _errorCode = [_item,EPOCH_fav_DropIfOverflow,_force] call epoch_equip; + _errorCode = [_item,_Fav_DropIfOverflow,_force] call epoch_equip; player selectWeapon _item; if (_slot in [3,4,5]) then { _curSlot = _item call epoch_itemTypeSlot; - if (_curSlot == _slot && !EPOCH_fav_FastWeaponSwitching && _errorCode in [1,2]) then {player playAction "reloadMagazine";}; + _Fav_FastWeaponSwitching = ["CfgEpochClient", "Fav_FastWeaponSwitching", false] call EPOCH_fnc_returnConfigEntryV2; + if (_curSlot == _slot && !_Fav_FastWeaponSwitching && _errorCode in [1,2]) then {player playAction "reloadMagazine";}; }; if (_errorCode isEqualTo 2) then {"Not enough space, item dropped on the ground!" call epoch_message;}; @@ -46,5 +49,4 @@ if (_itemHasInteraction) then { if (_errorCode isEqualTo 3) then {"Item not found!" call epoch_message;}; if (_errorCode isEqualTo 5) then {"No compatible weapon found!" call epoch_message;}; }; - true diff --git a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_draw.sqf b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_draw.sqf index 80d88b0d..9fc28f74 100644 --- a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_draw.sqf +++ b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_draw.sqf @@ -14,22 +14,27 @@ Usage: none */ disableSerialization; - +private ["_action","_idx","_bidx","_mod","_baritems","_Fav_BannedItems"]; params ["_action","_idx","_bidx","_mod"]; +_Fav_BannedItems = ["CfgEpochClient", "Fav_BannedItems", []] call EPOCH_fnc_returnConfigEntryV2; switch _action do { case "load": { - if (EPOCH_fav_resetOnLogin) then { - profileNamespace setVariable ["rmx_var_favBar_MNone",nil]; - profileNamespace setVariable ["rmx_var_favBar_MCtrl",nil]; - profileNamespace setVariable ["rmx_var_favBar_MShift",nil]; - profileNamespace setVariable ["rmx_var_favBar_MAlt",nil]; - }; + private ["_tmp","_c","_p"]; rmx_var_favBar_MNone = profileNamespace getVariable ["rmx_var_favBar_MNone",["","","","",""]]; rmx_var_favBar_MCtrl = profileNamespace getVariable ["rmx_var_favBar_MCtrl",["","","","",""]]; rmx_var_favBar_MShift = profileNamespace getVariable ["rmx_var_favBar_MShift",["","","","",""]]; rmx_var_favBar_MAlt = profileNamespace getVariable ["rmx_var_favBar_MAlt",["","","","",""]]; + { + _baritems = _x; + { + if (_x in _Fav_BannedItems) then { + _baritems set [_foreachindex,""]; + }; + } foreach _x; + } foreach [rmx_var_favBar_MNone,rmx_var_favBar_MCtrl,rmx_var_favBar_MShift,rmx_var_favBar_MAlt]; + rmx_var_favBar_current = rmx_var_favBar_MNone; waitUntil {uiSleep 0.1; ctrlShown (["fav_equipped", 1] call epoch_getHUDCtrl)}; @@ -46,19 +51,13 @@ switch _action do { _c ctrlCommit 0; }; - "draw_current" call epoch_favBar_draw; + call epoch_favBar_drawCurrent; call epoch_favBar_refresh; }; - case "draw_current": - { - for "_i" from 0 to 4 do { - _c = (["fav_pic", _i+1] call epoch_getHUDCtrl); - _c ctrlSetText ((rmx_var_favBar_current select _i) call EPOCH_itemPicture); - }; - }; case "add": { - if (rmx_var_favBar_Item in EPOCH_fav_BannedItems) exitWith {"Item is not allowed in favorites!" call epoch_message; false}; + private ["_type","_isBanned","_isAmmo","_isChemlight","_itemIsWeapon","_itemHasInteraction","_c"]; + if (rmx_var_favBar_Item in _Fav_BannedItems) exitWith {"Item is not allowed in favorites!" call epoch_message; false}; if (rmx_var_favBar_Item in rmx_var_favBar_current) exitWith {"Item already exists in favorites!" call epoch_message; false}; //if duplicate _type = (rmx_var_favBar_Item call BIS_fnc_itemType) select 1; @@ -115,31 +114,10 @@ switch _action do { _c ctrlSetText ""; }; }; - case "modifier": - { - switch EPOCH_modKeys do { - case [true,false,false]: //shift - { - rmx_var_favBar_current = rmx_var_favBar_MShift; - }; - case [false,true,false]: //Ctrl - { - rmx_var_favBar_current = rmx_var_favBar_MCtrl; - }; - case [false,false,true]: //Alt - { - rmx_var_favBar_current = rmx_var_favBar_MAlt; - }; - default { //Any other combo or no modifier - rmx_var_favBar_current = rmx_var_favBar_MNone; - }; - }; - 'draw_current' call epoch_favBar_draw; - call epoch_favBar_refresh; - }; default {systemChat "fail"}; }; for "_i" from 1 to 5 do { (["fav_pic_bg", _i] call epoch_getHUDCtrl) ctrlSetText "x\addons\a3_epoch_code\Data\UI\favbar\fav_bg.paa"; }; +true diff --git a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_drawCurrent.sqf b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_drawCurrent.sqf new file mode 100644 index 00000000..1c8f7912 --- /dev/null +++ b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_drawCurrent.sqf @@ -0,0 +1,5 @@ +for "_i" from 0 to 4 do { + _c = (["fav_pic", _i+1] call epoch_getHUDCtrl); + _c ctrlSetText ((rmx_var_favBar_current select _i) call EPOCH_itemPicture); +}; +true \ No newline at end of file diff --git a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_getGearItem.sqf b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_getGearItem.sqf index a4180445..ee54c943 100644 --- a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_getGearItem.sqf +++ b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_getGearItem.sqf @@ -15,6 +15,7 @@ RETURNS: classname for item in inventory */ +private ["_return","_dispName","_idx","_className"]; (_this select 1 select 0) params ["_dispName","_idx","_className"]; _return = ""; diff --git a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_getItemByIDC.sqf b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_getItemByIDC.sqf index 84c71bdf..803bb16b 100644 --- a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_getItemByIDC.sqf +++ b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_getItemByIDC.sqf @@ -14,7 +14,7 @@ Usage: none */ - +private ["_item","_ammo","_cnt"]; //switch _item = switch (_this) do { diff --git a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_inventory.sqf b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_inventory.sqf index c2b9c8bb..bfa115e5 100644 --- a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_inventory.sqf +++ b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_inventory.sqf @@ -24,8 +24,9 @@ Usage: none */ -//TODO: Maybe - spawn IDC cleanup thread, wait until display closes -if !(EPOCH_fav_enableFavoriteBar) exitWith {false}; +private ["_display","_c","_gIdx","_g"]; + +if !(["CfgEpochClient", "Fav_enableFavoriteBar", true] call EPOCH_fnc_returnConfigEntryV2) exitWith {false}; disableSerialization; waitUntil {!isNull findDisplay 602}; @@ -40,7 +41,7 @@ rmx_var_fav_selected = false; //(_this select 1 select 0 select 2) { _c = _display displayCtrl _x; - _c ctrlAddEventHandler ["MouseButtonDown",(format ["'modifier' spawn epoch_favBar_draw; rmx_var_favBar_Item = %1 call epoch_favBar_getItemByIDC; rmx_var_fav_selected = true",_x])]; + _c ctrlAddEventHandler ["MouseButtonDown",(format ["call epoch_favBar_modifier; rmx_var_favBar_Item = %1 call epoch_favBar_getItemByIDC; rmx_var_fav_selected = true",_x])]; } forEach [610,620,641,622,621,644,623,611,624,642,626,625,627,612,628,643,630,629,631,6240,6216,6217,6238]; _gIdx = 0; @@ -74,6 +75,7 @@ for "_i" from 1 to 5 do { (["fav_pic_bg", _i] call epoch_getHUDCtrl) ctrlShow true; }; +true /* { _crl = _display displayCtrl _x; @@ -85,20 +87,4 @@ _c ctrlCommit 0; */ //Listboxes? //6325,1241 -//619,638,633 - - - - - - - - - - - - - - - - +//619,638,633 \ No newline at end of file diff --git a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_modifier.sqf b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_modifier.sqf new file mode 100644 index 00000000..0f9b479d --- /dev/null +++ b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_modifier.sqf @@ -0,0 +1,9 @@ +switch EPOCH_modKeys do { +case [true,false,false]:{rmx_var_favBar_current = rmx_var_favBar_MShift;}; +case [false,true,false]:{rmx_var_favBar_current = rmx_var_favBar_MCtrl;}; +case [false,false,true]:{rmx_var_favBar_current = rmx_var_favBar_MAlt;}; +default {rmx_var_favBar_current = rmx_var_favBar_MNone;}; +}; +call epoch_favBar_drawCurrent; +call epoch_favBar_refresh; +true \ No newline at end of file diff --git a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_refresh.sqf b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_refresh.sqf index 24b876c5..006e7faa 100644 --- a/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_refresh.sqf +++ b/Sources/epoch_code/gui/scripts/favBar/epoch_favBar_refresh.sqf @@ -14,7 +14,8 @@ Usage: none */ -if !(EPOCH_fav_enableFavoriteBar) exitWith {false}; +if !(["CfgEpochClient", "Fav_enableFavoriteBar", true] call EPOCH_fnc_returnConfigEntryV2) exitWith {false}; +private ["_playerItems","_equipped","_mod","_txt"]; _playerItems = itemsWithMagazines player; _equipped = [primaryWeapon player, secondaryWeapon player, handgunWeapon player, headgear player, goggles player, hmd player, binocular player]; @@ -58,4 +59,5 @@ for "_i" from 1 to 5 do { (["fav_keymap", _forEachIndex + 1] call epoch_getHUDCtrl) ctrlShow false; }; }; -}forEach rmx_var_favBar_current; \ No newline at end of file +}forEach rmx_var_favBar_current; +true \ No newline at end of file diff --git a/Sources/epoch_code/init/client_init.sqf b/Sources/epoch_code/init/client_init.sqf index f6d4e494..8f7fd5c0 100644 --- a/Sources/epoch_code/init/client_init.sqf +++ b/Sources/epoch_code/init/client_init.sqf @@ -62,20 +62,10 @@ rmx_var_dynamicHUD_groups = []; rmx_var_dynamicHUD_groupCTRL = []; //Favorites bar +EPOCH_favBar_itemConsumed = false; rmx_var_favBar_Item = ""; EPOCH_modKeys = [false,false,false]; -//If disabled, players will not be able to use favorite bar -EPOCH_fav_enableFavoriteBar = true; -//If enabled, same slot weapons from favorites bar are equipped instantly, otherwise reload action is played (recommended for immersion) -EPOCH_fav_FastWeaponSwitching = false; -//If enabled and inventory full, equipped weapon will be dropped on ground in favor for the new selected weapon, otherwise action will fail with message and weapon will not be equipped -EPOCH_fav_DropIfOverflow = false; -//Items that users are not allowed to pin -EPOCH_fav_BannedItems = ["FAK"]; //add items that can be abused here -//Reset all favorite items on every login (players will be required to re-add everything again). -EPOCH_fav_resetOnLogin = true; - ["EPOCH_onEachFrame", "onEachFrame", EPOCH_onEachFrame] call BIS_fnc_addStackedEventHandler; // Custom Keys diff --git a/Sources/epoch_config/Configs/CfgClientFunctions.hpp b/Sources/epoch_config/Configs/CfgClientFunctions.hpp index a1593641..d6429996 100644 --- a/Sources/epoch_config/Configs/CfgClientFunctions.hpp +++ b/Sources/epoch_config/Configs/CfgClientFunctions.hpp @@ -72,6 +72,7 @@ class CfgClientFunctions class tradeFilter {}; class takeCrypto {}; class startBankTransfer {}; + class calcDamageCost {}; }; class interface_event_handlers { @@ -136,7 +137,8 @@ class CfgClientFunctions class giveAttributes {}; class fnc_spawnEffects {}; class fnc_arrayStringToBool {}; - class client_updatePlayerStat {}; + class client_updatePlayerStat {}; + class fnc_getHitPointsDamageAverage {}; }; class environment { @@ -325,11 +327,13 @@ class CfgClientFunctions class favBar { file = "epoch_code\gui\scripts\favBar"; class favBar_draw {}; + class favBar_drawCurrent {}; class favBar_refresh {}; class favBar_action{}; class favBar_getItemByIDC {}; class favBar_inventory {}; class favBar_getGearItem {}; + class favBar_modifier {}; }; }; }; diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index 7fab13cb..08847686 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -93,9 +93,17 @@ class CfgEpochClient playerRevengeMinAliveTime = 900; bankTransferTime[] = {0.0006,1.2,0.06}; + // Favorite Bar + Fav_enableFavoriteBar = "true"; // If disabled, players will not be able to use favorite bar + Fav_DropIfOverflow = "false"; // If enabled and inventory full, equipped weapon will be dropped on ground in favor for the new selected weapon, otherwise action will fail with message and weapon will not be equipped + Fav_FastWeaponSwitching = "false"; // If enabled, same slot weapons from favorites bar are equipped instantly, otherwise reload action is played (recommended for immersion) + Fav_BannedItems[] = {"FAK"}; // Items that users are not allowed to pin + + // Advanced Vehicle Repair + UseAdvancedVehicleRepair = "true"; // Switch On / Off Advanced Vehicle Repair (Does not effect SuppressedCraftingItems !) + DisallowSellOnDamage = "false"; // Prevent from selling Vehicles with one or more fully damaged wheel or engine SuppressedCraftingItems[] = {"VehicleRepair","VehicleRepairLg"}; // Suppresed for usage of "Advanced Vehicle Repair" - UseAdvancedVehicleRepair = "true"; - VehicleRepairs[] = { + VehicleRepairs[] = { // {Hitpoint, dmg to repair, dmg to replace, mat to repair, mat to replace} {"HitHull",0.33,0.66,"ItemScraps","ItemCorrugated"}, {"HitBody",0.33,1,"ItemScraps","ItemCorrugated"}, {"HitLFWheel",0.33,1,"VehicleRepair","SpareTire"}, diff --git a/Sources/epoch_config/Configs/CfgMasterLoop.hpp b/Sources/epoch_config/Configs/CfgMasterLoop.hpp index 8c612f86..20ff39e9 100644 --- a/Sources/epoch_config/Configs/CfgMasterLoop.hpp +++ b/Sources/epoch_config/Configs/CfgMasterLoop.hpp @@ -44,6 +44,10 @@ class CfgMasterLoop { delay = 600; }; + class Event8 + { + delay = 5; //used for FavBar, adjust as required + }; }; }; diff --git a/Tools/BAT/paa2png.bat b/Tools/BAT/paa2png.bat new file mode 100644 index 00000000..b1e3a886 --- /dev/null +++ b/Tools/BAT/paa2png.bat @@ -0,0 +1,3 @@ +rem Adjust path to Pal2PacE.exe below +rem Put this batch inside the same folder as your .paa textures, handy for mass extracting data if you have unRapped your game into P:\ drive +for %%f in (*.paa) do ( "D:\SteamLibrary\steamapps\common\Arma 3 Tools\TexView2\Pal2PacE.exe" "%%~nf.paa" "%%~nf.png" ) \ No newline at end of file diff --git a/Tools/BAT/paa2tga.bat b/Tools/BAT/paa2tga.bat new file mode 100644 index 00000000..f6d8e8a1 --- /dev/null +++ b/Tools/BAT/paa2tga.bat @@ -0,0 +1 @@ + for %%f in (*.paa) do ( "D:\SteamLibrary\steamapps\common\Arma 3 Tools\TexView2\Pal2PacE.exe" "%%~nf.paa" "%%~nf.tga" ) \ No newline at end of file