Make free slots display for gear more logical

- Don't show tool slots as available weapon slots in gear. Player is
informed of tool slots count in systemChat.
- Don't show pistol mag slots as available item slots in gear. Player is
informed of pistol mag slots count in systemChat. Only pistol ammo and
bandages can be purchased into them.
- Removed "Stand still to complete trade" message since the medic
animation loop is no longer used
- Added back backpack mags count message and avoided redundant "Backpack
space exceeded message" @oiad
ee3eb845a3 (commitcomment-18483149)
This commit is contained in:
ebaydayz
2016-08-02 11:55:50 -04:00
parent f3c80934b4
commit a95925aac5
4 changed files with 40 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
private ["_selection","_return","_toBuyWeaps","_toBuyTotalMags","_toBuyBags","_toolsToBuy","_sidearmToBuy"
,"_primaryToBuy","_currentPrimarys","_p","_b","_check0","_check1","_check2","_check3","_check4","_allowedMags"
,"_primaryToBuy","_p","_b","_check0","_check1","_check2","_check3","_check4","_allowedMags"
,"_allowedPrimary","_allowedTools","_allowedSidearm","_allowedBackpacks","_parentClasses","_toolClasses"
,"_duplicate","_quantity","_tool","_totalBagSlots","_pistolMags","_regularMags","_toBuyPistolMags"
,"_toBuyRegularMags","_type","_freeSpace","_backpack","_totalSpace"
@@ -37,14 +37,8 @@ if (_selection == 2) then { //gear
_allowedPistolMags = 8 - _pistolMags;
_allowedRegularMags = 12 - _regularMags;
_currentPrimarys = 0;
_p = primaryWeapon player;
if (!isNil '_p' && _p != "") then {
_currentPrimarys = 1;
};
_allowedPrimary = 1 - _currentPrimarys;
_allowedPrimary = if (!isNil "_p" && _p != "") then {0} else {1};
// (secondaryWeapon player) returns launcher, doesn't work for pistol
_allowedSidearm = 1;
@@ -138,6 +132,7 @@ if (_selection == 0) then { //backpack
_check0 = true;
_freeSpace = [_backpack,_primaryToBuy,_sidearmToBuy,_toolsToBuy,_toBuyTotalMags] call Z_calcFreeSpace;
_totalSpace = _freeSpace select 0;
_allowedMags = _freeSpace select 1;
_allowedWeapons = _freeSpace select 2; // needed since some bags have >= 5 slots but transportMaxWeapons = 0;
_totalBagSlots = _freeSpace select 4;
} else {
@@ -147,26 +142,33 @@ if (_selection == 0) then { //backpack
_check1 = false;
_check2 = false;
_check3 = false;
_check4 = false;
if (_allowedWeapons >= _toBuyWeaps) then { //_toBuyWeaps does not include tools (which can exceed transportMaxWeapons in backpacks but not vehicles)
_check1 = true;
} else {
systemChat format[localize "STR_EPOCH_TRADE_BAG_WEPS", _allowedWeapons];
};
if (_allowedMags >= _toBuyTotalMags) then {
_check2 = true;
} else {
systemChat format[localize "STR_EPOCH_TRADE_BAG_MAGS", _allowedMags];
};
if (_toBuyBags < 1) then { // A backpack can not hold any backpacks
_check2 = true;
_check3 = true;
} else {
systemChat localize "STR_EPOCH_TRADE_BAG_BAGS";
};
if (_totalSpace <= _totalBagSlots) then {
_check3 = true;
_check4 = true;
} else {
systemChat localize "STR_EPOCH_TRADE_BACKPACK_FULL";
if (_check1 && _check2 && _check3) then { systemChat localize "STR_EPOCH_TRADE_BACKPACK_FULL"; }; // Avoids redundant message
};
if (_check0 && _check1 && _check2 && _check3) then { _return = true; };
if (_check0 && _check1 && _check2 && _check3 && _check4) then { _return = true; };
};
_return

View File

@@ -155,7 +155,7 @@ if (_enoughMoney) then {
publicVariableServer "PVDZE_veh_Publish2";
_keySelected;
};
systemChat localize "STR_EPOCH_PLAYER_105";
//systemChat localize "STR_EPOCH_PLAYER_105"; // "Stand still to complete trade". Medic animation loop no longer used.
closeDialog 2;

View File

@@ -1,14 +1,30 @@
private ["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBackpacks","_pic","_backpack","_actualMags","_freeSpace"];
private ["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBackpacks","_pic","_backpack","_actualMags","_freeSpace","_allowedPrimary","_allowedSidearm","_p"];
#include "defines.hpp"
_selection = _this select 0;
_returnArray = [0,0,0];
if (_selection == 2) then { //gear
_actualMags = {!(_x in MeleeMagazines)} count (magazines player);
_allowedMags = 20 - _actualMags;
// 12 toolbelt + 1 Binoculars + 1 NVG + 1 Pistol + 1 Primary (onBack isn't counted in weapons player)
_allowedWeapons = 16 - count(weapons player);
//_actualMags = {!(_x in MeleeMagazines)} count (magazines player);
//_allowedMags = 20 - _actualMags; //8 pistol + 12 regular = 20
// Don't show pistol mag slots as item slots in gear. Player is informed of pistol mag slots count in systemChat.
_actualMags = {(getNumber (configFile >> "CfgMagazines" >> _x >> "type") == 256)} count (magazines player); // 256 = WeaponSlotItem (normal magazine)
_allowedMags = 12 - _actualMags;
_p = primaryWeapon player;
_allowedPrimary = if (!isNil "_p" && _p != "") then {0} else {1};
_allowedSidearm = 1;
{
if (getNumber (configFile >> "CfgWeapons" >> _x >> "type") == 2) exitWith { // 2 = WeaponSlotHandGun (occupies pistol slot)
_allowedSidearm = 0;
};
} count (weapons player);
// 12 toolbelt + 1 Binoculars + 1 NVG + 1 Pistol + 1 Primary = 16 (onBack isn't counted in weapons player)
//_allowedWeapons = 16 - count(weapons player);
// Don't show tool slots as weapon slots in gear. Player is informed of tool slots count in systemChat.
_allowedWeapons = _allowedPrimary + _allowedSidearm;
_pic = getText (configFile >> "CfgVehicles" >> (typeOf player) >> "portrait");

View File

@@ -16208,6 +16208,10 @@
<Key ID="STR_EPOCH_TRADE_BACKPACK_FULL">
<English>Total backpack space exceeded.</English>
</Key>
<Key ID="STR_EPOCH_TRADE_BAG_MAGS">
<English>Only %1 mags will fit into your backpack.</English>
<Russian>В рюкзак поместится предметов: %1.</Russian>
</Key>
<Key ID="STR_EPOCH_TRADE_BAG_WEPS">
<English>Only %1 weapons will fit into your backpack.</English>
<Russian>В рюкзак поместится оружия: %1.</Russian>