Prevent MeleeMagazines being counted by BIS_fnc_inv

This commit is contained in:
ebaydayz
2016-05-03 12:21:43 -04:00
parent f8b3ba2105
commit 2f98fc0451
18 changed files with 42 additions and 18 deletions

View File

@@ -1,7 +1,8 @@
private ["_selection","_return","_toBuyWeaps","_toBuyMags","_toBuyBags","_toolsToBuy","_sidearmToBuy","_primaryToBuy","_currentPrimarys" private ["_selection","_return","_toBuyWeaps","_toBuyMags","_toBuyBags","_toolsToBuy","_sidearmToBuy","_primaryToBuy","_currentPrimarys"
,"_currentSecondarys","_currentSec","_currentPrim","_currentTool","_p","_s","_b","_check0","_check1","_check2","_check3","_check4","_mags","_weaps","_bags" ,"_currentSecondarys","_currentSec","_currentPrim","_currentTool","_p","_s","_b","_check0","_check1","_check2","_check3","_check4","_mags","_weaps","_bags"
,"_normalBags","_normalMags","_normalWeaps","_allowedMags","_allowedPrimary","_allowedTools","_allowedSidearm","_allowedWeapons","_allowedBackpacks" ,"_normalBags","_normalMags","_normalWeaps","_allowedMags","_allowedPrimary","_allowedTools","_allowedSidearm","_allowedWeapons","_allowedBackpacks"
,"_totalSpace","_totalNewSpace","_counter","_parentClasses","_alreadyInBackpack","_kinds","_kinds2","_kinds3","_ammmounts","_ammmounts2","_ammmounts3" ,"_totalSpace","_totalNewSpace","_counter","_parentClasses","_alreadyInBackpack","_kinds","_kinds2","_kinds3","_ammmounts","_ammmounts2","_ammmounts3",
"_actualMags"
]; ];
_selection = Z_SellingFrom; _selection = Z_SellingFrom;
_return = false; _return = false;
@@ -19,7 +20,8 @@ if (_vehiclesToBuy > 0) then {
}; };
if(_selection == 2) then{ //gear if(_selection == 2) then{ //gear
_allowedMags = 20 - count(magazines player); _actualMags = {!(_x in MeleeMagazines)} count (magazines player);
_allowedMags = 20 - _actualMags;
_currentPrimarys = 0; _currentPrimarys = 0;

View File

@@ -1,11 +1,12 @@
private["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBackpacks","_allowedTools","_allowedPrimary","_allowedSidearm","_formattedText","_pic" private["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBackpacks","_allowedTools","_allowedPrimary","_allowedSidearm","_formattedText","_pic"
,"_backpack","_backpackAmount","_vehicleWeapons","_vehicleMagazines","_vehicleBackpacks","_tempWeaponsArray","_tempBackpackArray","_tempMagazinesArray"]; ,"_backpack","_backpackAmount","_vehicleWeapons","_vehicleMagazines","_vehicleBackpacks","_tempWeaponsArray","_tempBackpackArray","_tempMagazinesArray","_actualMags"];
#include "defines.sqf"; #include "defines.sqf";
_selection = _this select 0; _selection = _this select 0;
_returnArray = [0,0,0]; _returnArray = [0,0,0];
if(_selection == 2) then{ //gear if(_selection == 2) then{ //gear
_allowedMags = 20 - count(magazines player); _actualMags = {!(_x in MeleeMagazines)} count (magazines player);
_allowedMags = 20 - _actualMags;
_allowedWeapons = 14 - count(weapons player); _allowedWeapons = 14 - count(weapons player);
_pic = getText (configFile >> 'CfgVehicles' >> (typeOf player) >> 'picture'); _pic = getText (configFile >> 'CfgVehicles' >> (typeOf player) >> 'picture');

View File

@@ -21,7 +21,7 @@ if (!isNil '_pic' && _pic == "") then {
}; };
_formattedText = format [ _formattedText = format [
"<t size='1' align='center' color='#ffffff'> %2 </t>" "<t size='1' align='center' color='#ffffff'>%1 %2</t>"
, _pic, localize "STR_UI_GEAR" , _pic, localize "STR_UI_GEAR"
]; ];

View File

@@ -51,6 +51,8 @@ _hasInput = true;
} forEach (_input + _required); } forEach (_input + _required);
if (_hasInput) then { if (_hasInput) then {
//Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix)
{player removeMagazines _x} count MeleeMagazines;
_freeSlots = [player] call BIS_fnc_invSlotsEmpty; _freeSlots = [player] call BIS_fnc_invSlotsEmpty;
{ {
_item = _x select 0; _item = _x select 0;

View File

@@ -84,6 +84,8 @@ if ((count _upgrade) > 0) then {
_abortInvAdd = false; _abortInvAdd = false;
_i = 0; _i = 0;
_addedItems = []; _addedItems = [];
//Remove melee magazines (BIS_fnc_invAdd fix)
{player removeMagazines _x} count MeleeMagazines;
{ {
_itemOut = _x select 0; _itemOut = _x select 0;

View File

@@ -87,6 +87,8 @@ if(!r_drag_sqf and !r_player_unconscious and !_onLadder) then {
} forEach (_input); } forEach (_input);
if (_hasInput) then { if (_hasInput) then {
//Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix)
{player removeMagazines _x} count MeleeMagazines;
_freeSlots = [player] call BIS_fnc_invSlotsEmpty; _freeSlots = [player] call BIS_fnc_invSlotsEmpty;
{ {
_item = _x select 0; _item = _x select 0;

View File

@@ -76,6 +76,8 @@ if (count _nearByPile > 0) then {
} forEach (_input + _required); } forEach (_input + _required);
if (_hasInput) then { if (_hasInput) then {
//Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix)
{player removeMagazines _x} count MeleeMagazines;
_freeSlots = [player] call BIS_fnc_invSlotsEmpty; _freeSlots = [player] call BIS_fnc_invSlotsEmpty;
{ {
_item = _x select 0; _item = _x select 0;

View File

@@ -93,7 +93,8 @@ if (count(_findNearestTree) >= 1) then {
}; };
if (_proceed) then { if (_proceed) then {
//Remove melee magazines (BIS_fnc_invAdd fix)
{player removeMagazines _x} count MeleeMagazines;
_invResult = false; _invResult = false;
_i = 0; _i = 0;
for "_x" from 1 to _countOut do { for "_x" from 1 to _countOut do {

View File

@@ -26,6 +26,8 @@ _weapon = _this select 1;
_newWeapon = _this select 2; _newWeapon = _this select 2;
//check that player has enough room in inventory //check that player has enough room in inventory
//Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix)
{player removeMagazines _x} count MeleeMagazines;
if ((([player] call BIS_fnc_invSlotsEmpty) select 4) < 1) exitWith if ((([player] call BIS_fnc_invSlotsEmpty) select 4) < 1) exitWith
{ {
closeDialog 0; closeDialog 0;

View File

@@ -31,6 +31,8 @@ switch (_rounded) do {
}; };
}; };
//Remove melee magazines (BIS_fnc_invAdd fix)
{player removeMagazines _x} count MeleeMagazines;
_i = 0; _i = 0;
while {_i < _rounded} do { while {_i < _rounded} do {
_i = _i + 1; _i = _i + 1;

View File

@@ -63,9 +63,7 @@ switch _option do {
[player,_range,true,(getPosATL player)] spawn player_alertZombies; [player,_range,true,(getPosATL player)] spawn player_alertZombies;
player setVariable["cashMoney",_newWealth,true]; player setVariable["cashMoney",_newWealth,true];
call player_forceSave;
PVDZ_plr_Save = [player,(magazines player),true,true];
publicVariableServer "PVDZ_plr_Save";
PVDZE_maintainArea = [player,1,_target]; PVDZE_maintainArea = [player,1,_target];
publicVariableServer "PVDZE_maintainArea"; publicVariableServer "PVDZE_maintainArea";

View File

@@ -44,6 +44,8 @@ if (_hasToolbox) then {
r_doLoop = false; r_doLoop = false;
if (_finished) then { if (_finished) then {
//Remove melee magazines (BIS_fnc_invAdd fix)
{player removeMagazines _x} count MeleeMagazines;
_damage = [_vehicle,_hitpoint] call object_getHit; _damage = [_vehicle,_hitpoint] call object_getHit;
if (_damage < 0.10) then { if (_damage < 0.10) then {
_BreakableParts = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitLGlass","HitRGlass","HitEngine","HitFuel","HitHRotor"]; _BreakableParts = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitLGlass","HitRGlass","HitEngine","HitFuel","HitHRotor"];
@@ -56,9 +58,6 @@ if (_hasToolbox) then {
_brokenPart = false; _brokenPart = false;
}; };
} else { } else {
//Remove melee ammo due to the way ammo is working.
{player removeMagazines _x} count MeleeMagazines;
_isOK = [player,_part] call BIS_fnc_invAdd; _isOK = [player,_part] call BIS_fnc_invAdd;
_brokenPart = false; _brokenPart = false;
}; };

View File

@@ -129,6 +129,8 @@ if (_finished) then {
_isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected); _isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
//Remove melee magazines (BIS_fnc_invAdd fix)
{player removeMagazines _x} count MeleeMagazines;
_config = _keySelected; _config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd; _isOk = [player,_config] call BIS_fnc_invAdd;

View File

@@ -109,6 +109,8 @@ if (_qty >= _qty_in) then {
_isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected); _isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
//Remove melee magazines (BIS_fnc_invAdd fix)
{player removeMagazines _x} count MeleeMagazines;
_config = _keySelected; _config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd; _isOk = [player,_config] call BIS_fnc_invAdd;
waitUntil {!isNil "_isOk"}; waitUntil {!isNil "_isOk"};

View File

@@ -128,6 +128,8 @@ if (_finished) then {
_isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected); _isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
//Remove melee magazines (BIS_fnc_invAdd fix)
{player removeMagazines _x} count MeleeMagazines;
_config = _keySelected; _config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd; _isOk = [player,_config] call BIS_fnc_invAdd;

View File

@@ -116,6 +116,8 @@ if (_qty >= _qty_in) then {
_isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected); _isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
//Remove melee magazines (BIS_fnc_invAdd fix)
{player removeMagazines _x} count MeleeMagazines;
_config = _keySelected; _config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd; _isOk = [player,_config] call BIS_fnc_invAdd;
waitUntil {!isNil "_isOk"}; waitUntil {!isNil "_isOk"};

View File

@@ -1,4 +1,4 @@
private ["_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_bos","_needed","_started","_finished","_animState","_isMedic","_total_parts_out","_abort","_removed","_activatingPlayer","_traderID","_done"]; private ["_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_bos","_needed","_started","_finished","_animState","_isMedic","_total_parts_out","_abort","_removed","_activatingPlayer","_traderID","_done","_actualMags"];
// [part_out,part_in, qty_out, qty_in,]; // [part_out,part_in, qty_out, qty_in,];
if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;}; if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;};
@@ -29,8 +29,8 @@ while {r_autoTrade} do {
_removed = 0; _removed = 0;
// check if current magazine count is greater than 20 // check if current magazine count is greater than 20
_actualMags = {!(_x in MeleeMagazines)} count (magazines player);
if ((count (magazines player)) > 20) exitWith {localize "str_player_24" call dayz_rollingMessages; r_autoTrade = false}; if (_actualMags > 20) exitWith {localize "str_player_24" call dayz_rollingMessages; r_autoTrade = false};
_canAfford = false; _canAfford = false;
if(_bos == 1) then { if(_bos == 1) then {

View File

@@ -34,6 +34,9 @@ if (_this in items player) then {
_this call _dropOnFloor; _this call _dropOnFloor;
}; };
} else { } else {
//Remove melee magazines (BIS_fnc_invAdd fix)
{player removeMagazines _x} count MeleeMagazines;
if !([player,_this] call BIS_fnc_invAdd) then { if !([player,_this] call BIS_fnc_invAdd) then {
systemChat localize "str_epoch_player_107"; systemChat localize "str_epoch_player_107";
_this call _dropOnFloor; _this call _dropOnFloor;