mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-24 17:39:18 +03:00
Localize sell and buy only messages
PrimaryWeapon always returns "", never nil unless the player object isNull (in which case this script would not be running). Fixed cases where a nil variable would throw an error when checking the next condition.
This commit is contained in:
@@ -39,7 +39,7 @@ if (_selection == 2) then { //gear
|
||||
_allowedRegularMags = 12 - _regularMags;
|
||||
|
||||
_p = primaryWeapon player;
|
||||
_allowedPrimary = if (!isNil "_p" && _p != "") then {0} else {1};
|
||||
_allowedPrimary = if (_p != "") then {0} else {1};
|
||||
if (DZE_TwoPrimaries == 2 && dayz_onBack == "") then { _allowedPrimary = _allowedPrimary + 1; };
|
||||
|
||||
_b = unitBackpack player;
|
||||
|
||||
@@ -211,7 +211,7 @@ if (_enoughMoney) then {
|
||||
_count = 0;
|
||||
while {_count < (_x select 9)} do {
|
||||
_p = primaryWeapon player;
|
||||
_hasPrimary = if (!isNil "_p" && _p != "") then {true} else {false};
|
||||
_hasPrimary = if (_p != "") then {true} else {false};
|
||||
if (_hasPrimary && getNumber (configFile >> "CfgWeapons" >> (_x select 0) >> "type") == 1) then {
|
||||
dayz_onBack = _x select 0; //Add to back
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private ["_arrayOfTraderCat","_counter","_cat","_cfgtraders","_y","_type","_buy","_sell","_pic","_text","_worth","_buyCurrency","_sellCurrency","_ignore","_categoryNumber"];
|
||||
private ["_arrayOfTraderCat","_counter","_cat","_cfgtraders","_y","_type","_buy","_sell","_pic","_text","_worth","_buyCurrency","_sellCurrency","_ignore","_categoryNumber","_BcurrencyQty","_ScurrencyQty"];
|
||||
|
||||
call Z_clearBuyList;
|
||||
Z_BuyableArray = [];
|
||||
@@ -60,8 +60,8 @@ _counter = 0;
|
||||
_buyCurrency = CurrencyName;
|
||||
_sellCurrency = CurrencyName;
|
||||
};
|
||||
if (_BcurrencyQty < 0) then {_buyCurrency = "Unavailable"; _ignore = true;};
|
||||
if (_ScurrencyQty < 0) then {_sellCurrency = "Unavailable";};
|
||||
if (_BcurrencyQty < 0) then {_buyCurrency = localize "STR_EPOCH_UNAVAILABLE"; _ignore = true;};
|
||||
if (_ScurrencyQty < 0) then {_sellCurrency = localize "STR_EPOCH_UNAVAILABLE";};
|
||||
if (!_ignore) then { // Fill buyable list for one category only
|
||||
Z_BuyableArray set [count Z_BuyableArray, [_y,_type,_BcurrencyQty,_text,_pic,_forEachIndex, _ScurrencyQty, _buyCurrency, _sellCurrency, 0,_cat, _worth]];
|
||||
};
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Fills up the sell or buy list if the item has a valid config.
|
||||
**/
|
||||
private ["_weaps","_mags","_extraText","_all","_arrayOfTraderCat","_totalPrice","_backUpText","_bags","_vehUpgraded"];
|
||||
private ["_weaps","_mags","_extraText","_all","_arrayOfTraderCat","_totalPrice","_backUpText","_bags","_vehUpgraded","_currencyQty"];
|
||||
#include "defines.hpp"
|
||||
|
||||
_weaps = _this select 0;
|
||||
@@ -103,7 +103,7 @@ _totalPrice = 0;
|
||||
_buyCurrency = CurrencyName;
|
||||
_sellCurrency = CurrencyName;
|
||||
};
|
||||
if (_currencyQty < 0) then {_buyCurrency = "Unavailable";};
|
||||
if (_currencyQty < 0) then {_buyCurrency = localize "STR_EPOCH_UNAVAILABLE";};
|
||||
if ((_sell select 0) >= 0) then {
|
||||
Z_SellableArray set [count(Z_SellableArray) , [_y, _type, _sell select 0, _text, _pic, _forEachIndex, _currencyQty, _sellCurrency, _buyCurrency, 0 ,_cat, _worth]];
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ if (_selection == 2) then { //gear
|
||||
_allowedMags = 12 - _actualMags;
|
||||
|
||||
_p = primaryWeapon player;
|
||||
_allowedPrimary = if (!isNil "_p" && _p != "") then {0} else {1};
|
||||
_allowedPrimary = if (_p != "") then {0} else {1};
|
||||
if (DZE_TwoPrimaries == 2 && dayz_onBack == "") then { _allowedPrimary = _allowedPrimary + 1; };
|
||||
|
||||
_allowedSidearm = 1;
|
||||
|
||||
@@ -2,7 +2,7 @@ private ["_index","_temp","_index2"];
|
||||
#include "defines.hpp"
|
||||
|
||||
_index = _this select 0;
|
||||
if (!isNil"_index" && _index > -1) then {
|
||||
if (!isNil "_index" && {_index > -1}) then {
|
||||
lbDelete [Z_AT_SELLABLELIST, _index];
|
||||
_temp = Z_SellableArray select _index;
|
||||
//_item = [_temp select 0,_temp select 1 ,_temp select 2,_temp select 3, _temp select 4 ];
|
||||
|
||||
@@ -2,7 +2,7 @@ private "_index";
|
||||
#include "defines.hpp"
|
||||
|
||||
_index = _this select 0;
|
||||
if (!isNil"_index" && _index > -1) then {
|
||||
if (!isNil "_index" && {_index > -1}) then {
|
||||
lbDelete [Z_AT_BUYINGLIST, _index];
|
||||
Z_BuyingArray set [_index,"deleted"];
|
||||
Z_BuyingArray = Z_BuyingArray - ["deleted"];
|
||||
|
||||
@@ -2,7 +2,7 @@ private ["_index","_temp","_index2"];
|
||||
#include "defines.hpp"
|
||||
|
||||
_index = _this select 0;
|
||||
if (!isNil"_index" && _index > -1) then {
|
||||
if (!isNil "_index" && {_index > -1}) then {
|
||||
lbDelete [Z_AT_SELLINGLIST, _index];
|
||||
_temp = Z_SellArray select _index;
|
||||
//_item = [_temp select 0,_temp select 1 ,_temp select 2,_temp select 3, _temp select 4 ];
|
||||
|
||||
@@ -3,14 +3,14 @@ private ["_amount","_index","_index2","_temp"];
|
||||
|
||||
_index = _this select 0;
|
||||
_amount = parseNumber(_this select 1);
|
||||
if (!isNil"_index" && _index > -1 && (typeName _amount == "SCALAR")) then {
|
||||
if (!isNil "_index" && {_index > -1} && {typeName _amount == "SCALAR"}) then {
|
||||
_temp = [] + (Z_BuyableArray select _index);
|
||||
_temp set [9,(ceil _amount)];
|
||||
Z_BuyingArray set [count(Z_BuyingArray),_temp];
|
||||
if (_amount > 0) then {
|
||||
_index2 = lbAdd [Z_AT_BUYINGLIST, format["%1x: %2",_temp select 9,_temp select 3]];
|
||||
} else {
|
||||
_index2 = lbAdd [Z_AT_BUYINGLIST, "This trader does not sell this item"];
|
||||
_index2 = lbAdd [Z_AT_BUYINGLIST, localize "STR_EPOCH_TRADE_NOT_SELLING"];
|
||||
};
|
||||
lbSetPicture [Z_AT_BUYINGLIST, _index2, _temp select 4];
|
||||
call Z_calcPrice;
|
||||
|
||||
@@ -2,7 +2,7 @@ disableSerialization;
|
||||
|
||||
Z_traderData = (_this select 3); // gets the trader data ( e.g menu_Functionary1 )
|
||||
|
||||
if (isNil "Z_traderData" || count (Z_traderData) == 0) exitWith {
|
||||
if (isNil "Z_traderData" or {count Z_traderData == 0}) exitWith {
|
||||
localize "STR_EPOCH_TRADE_ERROR" call dayz_rollingMessages;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user