From 866358e4d00c8ad1031734bc6eda23a77db86aee Mon Sep 17 00:00:00 2001 From: ebaydayz Date: Mon, 31 Oct 2016 13:07:07 -0400 Subject: [PATCH] Add launcher handling to advanced trading --- CHANGE LOG 1.0.6.txt | 2 +- .../Configs/CfgMagazines/CfgMagazines.hpp | 2 +- .../CfgMagazines/Magazines/LauncherAmmo.hpp | 81 +++++++++++++++++++ .../CfgMagazines/Magazines/Magazines.hpp | 1 + .../functions/z_at_allowBuying.sqf | 10 ++- .../functions/z_at_buyItems.sqf | 2 +- .../functions/z_at_displayFreeSpace.sqf | 12 +-- .../R3F_Weight/Magazines/LauncherAmmo.hpp | 20 ++++- .../R3F_Weight/Weapons/Launchers.hpp | 8 ++ SQF/dayz_code/stringtable.xml | 4 +- 10 files changed, 125 insertions(+), 17 deletions(-) create mode 100644 SQF/dayz_code/Configs/CfgMagazines/Magazines/LauncherAmmo.hpp diff --git a/CHANGE LOG 1.0.6.txt b/CHANGE LOG 1.0.6.txt index 6f02e5488..f3061909b 100644 --- a/CHANGE LOG 1.0.6.txt +++ b/CHANGE LOG 1.0.6.txt @@ -68,7 +68,7 @@ [CHANGED] With R3Fweight on overburdened players are now forced to move slowly instead of being knocked out. The scream was also removed. #1145 @icomrade @ebaydayz [CHANGED] Abort and respawn are now disabled immediately in the pause menu onLoad to compensate for low fps delay. @ebaydayz [CHANGED] Player_onPause is now customizable by admins along with the new unscheduled fn_pauseMenuChecks. #1340 @Rimblock @ebaydayz -[CHANGED] Satchel charges and mines now take one inventory slot instead of two. @ebaydayz +[CHANGED] Satchel charges, mines and launcher rounds now take one inventory slot instead of multiple. @ebaydayz [FIXED] Zombies now target and attack players correctly with 1.8.8 code [FIXED] Server position sync bug after falling unconscious. Fixes AI on server not seeing the player after knock out and position revert after relog. #1522 @ebaydayz diff --git a/SQF/dayz_code/Configs/CfgMagazines/CfgMagazines.hpp b/SQF/dayz_code/Configs/CfgMagazines/CfgMagazines.hpp index e6a576487..bb4ad9ada 100644 --- a/SQF/dayz_code/Configs/CfgMagazines/CfgMagazines.hpp +++ b/SQF/dayz_code/Configs/CfgMagazines/CfgMagazines.hpp @@ -4,7 +4,7 @@ class CfgMagazines class CA_Magazine; class HandGrenade; class TimeBomb; - + class CA_LauncherMagazine; //Weapon magazines diff --git a/SQF/dayz_code/Configs/CfgMagazines/Magazines/LauncherAmmo.hpp b/SQF/dayz_code/Configs/CfgMagazines/Magazines/LauncherAmmo.hpp new file mode 100644 index 000000000..62d199837 --- /dev/null +++ b/SQF/dayz_code/Configs/CfgMagazines/Magazines/LauncherAmmo.hpp @@ -0,0 +1,81 @@ +// Use single slot for everything, let R3F weight handle load + +class M136 : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class Javelin : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class AT13 : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class PG7V : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class PG7VL : PG7V { + type = WeaponSlotItem; +}; + +class PG7VR : PG7V { + type = WeaponSlotItem; +}; + +class OG7 : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class PG9_AT : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class OG9_HE : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class Stinger : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class SMAW_HEDP : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class SMAW_HEAA : SMAW_HEDP { + type = WeaponSlotItem; +}; + +class MAAWS_HEDP : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class MAAWS_HEAT : MAAWS_HEDP { + type = WeaponSlotItem; +}; + +class Strela : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class RPG18 : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class Igla : Strela { + type = WeaponSlotItem; +}; + +class 2Rnd_Igla : Igla { + type = WeaponSlotItem; +}; + +class NLAW : CA_LauncherMagazine { + type = WeaponSlotItem; +}; + +class Dragon_EP1 : CA_LauncherMagazine { + type = WeaponSlotItem; +}; \ No newline at end of file diff --git a/SQF/dayz_code/Configs/CfgMagazines/Magazines/Magazines.hpp b/SQF/dayz_code/Configs/CfgMagazines/Magazines/Magazines.hpp index e8c305905..576b72a58 100644 --- a/SQF/dayz_code/Configs/CfgMagazines/Magazines/Magazines.hpp +++ b/SQF/dayz_code/Configs/CfgMagazines/Magazines/Magazines.hpp @@ -17,5 +17,6 @@ #include "Misc.hpp" //CZ550, Lee-Enfield, Winchester 1866 #include "Shotgun.hpp" #include "Arrows.hpp" +#include "LauncherAmmo.hpp" #undef COMBINE_MAG \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf index d47deb22b..0401a1c92 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf @@ -50,10 +50,12 @@ if (_selection == 2) then { //gear _allowedBinocular = 2; _duplicate = false; { - _type = getNumber (configFile >> "CfgWeapons" >> _x >> "type"); - if (_type == 2) then { _allowedSidearm = 0; }; // WeaponSlotHandGun (occupies pistol slot) - if (_type == 4096) then { _allowedBinocular = _allowedBinocular - 1; }; // WeaponSlotBinocular - if (_type == 131072) then { _allowedTools = _allowedTools - 1; }; // WeaponSlotInventory (toolbelt slot) + switch getNumber (configFile >> "CfgWeapons" >> _x >> "type") do { + case 2: {_allowedSidearm = 0;}; //Pistol + case 4: {_allowedBackpacks = 0;}; //Launcher + case 4096: {_allowedBinocular = _allowedBinocular - 1;}; //Binocular slot + case 131072: {_allowedTools = _allowedTools - 1;}; //Toolbelt slot + }; if (_x in _toolClasses) exitWith {_duplicate = true;}; // Forbid purchasing duplicate tools into gear } count (weapons player); diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf index 13930f87a..57b5c5681 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf @@ -66,7 +66,7 @@ if (Z_SingleCurrency) then { if ('PistolCore' in _parentClasses) then { _sidearmToBuy = _sidearmToBuy + (_x select 9); } else { - _primaryToBuy = _primaryToBuy + (_x select 9); + _primaryToBuy = _primaryToBuy + (_x select 9); //Include launchers in this count since they also take up 10 slots in backpack }; }; _priceToBuy = _priceToBuy + ((_x select 11)*(_x select 2)*(_x select 9)); diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayFreeSpace.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayFreeSpace.sqf index aa01feeb4..2d86dc792 100644 --- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayFreeSpace.sqf +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayFreeSpace.sqf @@ -14,11 +14,14 @@ if (_selection == 2) then { //gear _p = primaryWeapon player; _allowedPrimary = if (_p != "") then {0} else {1}; if (DZE_TwoPrimaries == 2 && dayz_onBack == "") then { _allowedPrimary = _allowedPrimary + 1; }; - + + _backpack = unitBackpack player; + _allowedBackpacks = if (isNull _backpack) then {1} else {0}; _allowedSidearm = 1; { - if (getNumber (configFile >> "CfgWeapons" >> _x >> "type") == 2) exitWith { // 2 = WeaponSlotHandGun (occupies pistol slot) - _allowedSidearm = 0; + switch getNumber (configFile >> "CfgWeapons" >> _x >> "type") do { + case 2: {_allowedSidearm = 0;}; //Pistol + case 4: {_allowedBackpacks = 0;}; //Launcher }; } count (weapons player); @@ -34,9 +37,6 @@ if (_selection == 2) then { //gear , _pic ]; - _backpack = unitBackpack player; - _allowedBackpacks = if (isNull _backpack) then {1} else {0}; - _returnArray = [_allowedMags, _allowedWeapons, _allowedBackpacks]; }; diff --git a/SQF/dayz_code/external/R3F_Realism/R3F_Weight/Magazines/LauncherAmmo.hpp b/SQF/dayz_code/external/R3F_Realism/R3F_Weight/Magazines/LauncherAmmo.hpp index be42a1c7c..4650933f2 100644 --- a/SQF/dayz_code/external/R3F_Realism/R3F_Weight/Magazines/LauncherAmmo.hpp +++ b/SQF/dayz_code/external/R3F_Realism/R3F_Weight/Magazines/LauncherAmmo.hpp @@ -20,10 +20,18 @@ class PG7VR { weight = 4.5; }; +class PG9_AT +{ + weight = 4.5; +}; class OG7 { weight = 2; }; +class OG9_HE +{ + weight = 2; +}; class RPG18 { weight = 1.2; @@ -36,6 +44,10 @@ class Igla { weight = 11; }; +class 2Rnd_Igla +{ + weight = 22; +}; class Strela { weight = 10; @@ -60,11 +72,15 @@ class SMAW_HEDP { weight = 6; }; -class MAAWS_HEAA +class MAAWS_HEDP { weight = 6; }; -class MAAWS_HEDP +class MAAWS_HEAT +{ + weight = 6; +}; +class NLAW { weight = 6; }; diff --git a/SQF/dayz_code/external/R3F_Realism/R3F_Weight/Weapons/Launchers.hpp b/SQF/dayz_code/external/R3F_Realism/R3F_Weight/Weapons/Launchers.hpp index 9e7295185..6eb4cf196 100644 --- a/SQF/dayz_code/external/R3F_Realism/R3F_Weight/Weapons/Launchers.hpp +++ b/SQF/dayz_code/external/R3F_Realism/R3F_Weight/Weapons/Launchers.hpp @@ -24,6 +24,10 @@ class MAAWS { weight = 7.5; }; +class BAF_NLAW_Launcher +{ + weight = 7.5; +}; class M47Launcher_EP1 { weight = 7; @@ -52,6 +56,10 @@ class MetisLauncher { weight = 16; }; +class Javelin +{ + weight = 16; +}; class Igla { weight = 7; diff --git a/SQF/dayz_code/stringtable.xml b/SQF/dayz_code/stringtable.xml index 8328530f1..fbb72ad05 100644 --- a/SQF/dayz_code/stringtable.xml +++ b/SQF/dayz_code/stringtable.xml @@ -15017,11 +15017,11 @@ У вас нет рюкзака. - You already have a backpack. + You already have a backpack or launcher. Du hast bereits einen Rucksack. - You can only buy one backpack into your gear. + You can only buy one backpack or launcher into your gear. Du hast nur einen Rucksack in deine Ausrüstung kaufen.