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:
ebaydayz
2016-09-09 13:53:20 -04:00
parent e5e212bbc2
commit 8f25cc70db
12 changed files with 28 additions and 22 deletions

View File

@@ -1,10 +1,10 @@
[NEW] Fully updated to DayZ 1.8.7 base @icomrade @ebaydayz
[NEW] 1.8.7 attachments system, community weapons, base objects, traps, tripwires and car bomb
[NEW] 1.8.7 journal and crafting menu are now functional (default 'J' key)
[NEW] 1.8.7 spawn selection, set dayz_spawnselection = 1; in init.sqf (Chernarus only)
[NEW] 1.8.7 infected camps, points of interest and infectious waterholes map additions (Chernarus only)
[NEW] 1.8.7 configurable blood trails, set dayz_bleedingeffect in init.sqf
[NEW] 1.8.7 weapon switching system and hotkeys (1 = primary, 2 = pistol, 3 = melee (or rifle onBack if DZE_TwoPrimaries=2;))
[NEW] Fully updated to DayZ 1.8.8 base @icomrade @ebaydayz
[NEW] 1.8.8 attachments system, community weapons, base objects, traps, tripwires and car bomb
[NEW] 1.8.8 journal and crafting menu are now functional (default 'J' key)
[NEW] 1.8.8 spawn selection, set dayz_spawnselection = 1; in init.sqf (Chernarus only)
[NEW] 1.8.8 infected camps, points of interest and infectious waterholes map additions (Chernarus only)
[NEW] 1.8.8 configurable blood trails, set dayz_bleedingeffect in init.sqf
[NEW] 1.8.8 weapon switching system and hotkeys (1 = primary, 2 = pistol, 3 = melee (or rifle onBack if DZE_TwoPrimaries=2;))
[NEW] Players can carry more than one primary weapon which allows the abillity to hide one on their back, configure using DZE_TwoPrimaries. See configVariables.sqf for details @icomrade
[NEW] Optional news/rules feed on player login, set dayz_enableRules in init.sqf
[NEW] Status UI icons are toggleable between "vanilla","epoch","dark" set DZE_UI in init.sqf @ebaydayz
@@ -64,7 +64,7 @@
[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
[FIXED] Zombies now target and attack players correctly with 1.8.7 code
[FIXED] Zombies now target and attack players correctly with 1.8.8 code
[FIXED] Server position sync bug after falling unconscious #1522 @ebaydayz
[FIXED] Character sometimes failing to sync after changing clothes #1545
[FIXED] Backpack wipes when changing clothes. #1361 @icomrade

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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]];
};

View File

@@ -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]];
};

View File

@@ -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;

View File

@@ -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 ];

View File

@@ -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"];

View File

@@ -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 ];

View File

@@ -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;

View File

@@ -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;
};

View File

@@ -14789,6 +14789,9 @@
<French>Vente</French>
<Czech>Prodejní</Czech>
</Key>
<Key ID="STR_EPOCH_TRADE_NOT_SELLING">
<English>This trader does not sell this item</English>
</Key>
<Key ID="STR_EPOCH_TRADE_SELLING_GEAR">
<English>Selling from your gear.</English>
<German>Verkauf aus meiner Ausrüstung.</German>
@@ -15980,6 +15983,9 @@
<German>Hinzufügen</German>
<Czech>Přidat</Czech>
</Key>
<Key ID="STR_EPOCH_UNAVAILABLE">
<English>Unavailable</English>
</Key>
<Key ID="STR_EPOCH_DOME">
<English>Dome</English>
<German>Kuppel</German>