mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-15 12:42:57 +03:00
Advanced trading tidying, spelling fixes, private fixes and string fixes (#1716)
* Advanced trading tidying, spelling fixes, private fixes and string fixes. Fixes snap building issue with metal floors Fixed spelling mistakes in various scripts Fixed formatting uglyness in various scripts Fixed invalid private lines in various scripts Changed Advanced trading so buying worked more like selling, You can't select backpack if you don't have a pack nor can you select a vehicle if you don't have a vehicle. Removed some redundant strings from Advanced trading and changed a few of the strings to be more englishy Removed the ability to buy a backpack into your backpack (You cant do this anyway) Fixed a bug where if you had nothing in your backpack it would break the checkArrayInConfig script so the titlebar would not refresh correctly Removed slot counts on no backpack and no vehicle (No need for it, just clutter) Moved backpack/vehicle checking to z_at_getContainer.sqf * Last part of tidyness fixes Last part of tidyness fixes * Actual backpack fix Lets actually fix the buying backpack into backpack or backpack when you already have one. * Missing from commit Missing from commit
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* Fills up the sell or buy list if the item has a valid config.
|
||||
**/
|
||||
private ["_weaps","_mags","_extraText","_all","_total","_arrayOfTraderCat","_totalPrice","_ctrltext","_backUpText","_bags"];
|
||||
private ["_weaps","_mags","_extraText","_all","_arrayOfTraderCat","_totalPrice","_backUpText","_bags"];
|
||||
#include "defines.hpp"
|
||||
|
||||
_weaps = _this select 0;
|
||||
@@ -16,13 +16,14 @@ _mags = _this select 1;
|
||||
_extraText = _this select 2;
|
||||
_bags = _this select 3;
|
||||
_vehTrade = false;
|
||||
|
||||
if (false call Z_checkCloseVehicle) then {
|
||||
_all = _weaps + _mags + _bags + [(typeOf Z_vehicle)];
|
||||
_vehTrade = true;
|
||||
} else {
|
||||
_all = _weaps + _mags + _bags;
|
||||
};
|
||||
_total = count(_all);
|
||||
|
||||
_arrayOfTraderCat = Z_traderData;
|
||||
_HasKeyCheck = {
|
||||
_obj = _this select 0;
|
||||
@@ -44,92 +45,80 @@ _HasKeyCheck = {
|
||||
_keyFound;
|
||||
};
|
||||
_totalPrice = 0;
|
||||
if(_total > 0)then{
|
||||
|
||||
{
|
||||
_y = _x;
|
||||
{
|
||||
_y = _x;
|
||||
{
|
||||
private ["_cat","_excists","_pic","_text","_type","_sell","_buy","_buyCurrency","_sellCurrency","_worth"];
|
||||
_cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)];
|
||||
if (isNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")) then {
|
||||
_cat = format["Category_%1",getNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")];
|
||||
private ["_cat","_exists","_pic","_text","_type","_sell","_buy","_buyCurrency","_sellCurrency","_worth"];
|
||||
_cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)];
|
||||
if (isNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")) then {
|
||||
_cat = format["Category_%1",getNumber (missionConfigFile >> "CfgTraderCategory" >> _cat >> "duplicate")];
|
||||
};
|
||||
_exists = isClass(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y);
|
||||
if (_exists) exitWith {
|
||||
_pic = "";
|
||||
_text = "";
|
||||
_type = getText(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "type");
|
||||
_sell = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "sell");
|
||||
_buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy");
|
||||
switch (true) do {
|
||||
case (_type == "trade_items") :
|
||||
{
|
||||
_pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture');
|
||||
_text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName');
|
||||
};
|
||||
case (_type == "trade_weapons") :
|
||||
{
|
||||
_pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture');
|
||||
_text = getText (configFile >> 'CfgWeapons' >> _y >> 'displayName');
|
||||
};
|
||||
case (_type in ["trade_backpacks", "trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"]) :
|
||||
{
|
||||
_pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture');
|
||||
_text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName');
|
||||
};
|
||||
};
|
||||
_excists = isClass(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y );
|
||||
if(_excists)exitWith{
|
||||
_pic = "";
|
||||
_text = "";
|
||||
_type = getText(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "type");
|
||||
_sell = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "sell");
|
||||
_buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy");
|
||||
switch (true) do {
|
||||
case (_type == "trade_items") :
|
||||
{
|
||||
_pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture');
|
||||
_text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName');
|
||||
};
|
||||
case (_type == "trade_weapons") :
|
||||
{
|
||||
_pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture');
|
||||
_text = getText (configFile >> 'CfgWeapons' >> _y >> 'displayName');
|
||||
};
|
||||
case (_type in ["trade_backpacks", "trade_any_vehicle", "trade_any_vehicle_free", "trade_any_vehicle_old", "trade_any_bicycle", "trade_any_bicycle_old", "trade_any_boat", "trade_any_boat_old"]) :
|
||||
{
|
||||
_pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture');
|
||||
_text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName');
|
||||
};
|
||||
};
|
||||
|
||||
if( isNil '_text')then{
|
||||
_text = _y;
|
||||
if (isNil '_text') then { _text = _y; };
|
||||
_HasKey = true;
|
||||
if (_vehTrade && {(typeOf Z_vehicle) == _y}) then {
|
||||
if (!(_type in ["trade_any_bicycle", "trade_any_bicycle_old", "trade_any_vehicle_free"]) && DZE_SaleRequiresKey) then {
|
||||
_HasKey = [Z_vehicle, _all] call _HasKeyCheck;
|
||||
};
|
||||
_HasKey = true;
|
||||
if (_vehTrade && {(typeOf Z_vehicle) == _y}) then {
|
||||
if (!(_type in ["trade_any_bicycle", "trade_any_bicycle_old", "trade_any_vehicle_free"]) && DZE_SaleRequiresKey) then {
|
||||
_HasKey = [Z_vehicle, _all] call _HasKeyCheck;
|
||||
};
|
||||
};
|
||||
if (!_HasKey) exitWith {};
|
||||
|
||||
_worth = 0;
|
||||
|
||||
if(!Z_SingleCurrency) then {
|
||||
_buyCurrency = _buy select 1;
|
||||
_sellCurrency = _sell select 1;
|
||||
_part = (configFile >> "CfgMagazines" >> _sellCurrency);
|
||||
_worth = getNumber(_part >> "worth");
|
||||
if (_worth == 0) then {
|
||||
_worth = DZE_GemWorthList select (DZE_GemList find _buyCurrency);
|
||||
};
|
||||
}else{
|
||||
_buyCurrency = CurrencyName;
|
||||
_sellCurrency = CurrencyName;
|
||||
};
|
||||
|
||||
Z_SellableArray set [count(Z_SellableArray) , [_y, _type, _sell select 0, _text, _pic, _forEachIndex, _buy select 0, _sellCurrency, _buyCurrency, 0 ,_cat, _worth]];
|
||||
_totalPrice = _totalPrice + (_sell select 0);
|
||||
};
|
||||
}forEach _arrayOfTraderCat;
|
||||
}count _all;
|
||||
if (!_HasKey) exitWith {};
|
||||
|
||||
Z_OriginalSellableArray = [] + Z_SellableArray;
|
||||
_worth = 0;
|
||||
|
||||
_backUpText = _extraText;
|
||||
if (!Z_SingleCurrency) then {
|
||||
_buyCurrency = _buy select 1;
|
||||
_sellCurrency = _sell select 1;
|
||||
_part = (configFile >> "CfgMagazines" >> _sellCurrency);
|
||||
_worth = getNumber(_part >> "worth");
|
||||
if (_worth == 0) then { _worth = DZE_GemWorthList select (DZE_GemList find _buyCurrency); };
|
||||
} else {
|
||||
_buyCurrency = CurrencyName;
|
||||
_sellCurrency = CurrencyName;
|
||||
};
|
||||
|
||||
if(Z_SellingFrom != 2)then{
|
||||
_extraText = getText (configFile >> 'CfgVehicles' >> _extraText >> 'displayName');
|
||||
};
|
||||
if (isNil '_extraText')then{
|
||||
_extraText = _backUpText;
|
||||
};
|
||||
Z_SellableArray set [count(Z_SellableArray) , [_y, _type, _sell select 0, _text, _pic, _forEachIndex, _buy select 0, _sellCurrency, _buyCurrency, 0 ,_cat, _worth]];
|
||||
_totalPrice = _totalPrice + (_sell select 0);
|
||||
};
|
||||
} forEach _arrayOfTraderCat;
|
||||
} count _all;
|
||||
|
||||
if (Z_SingleCurrency) then {
|
||||
_ctrltext = format[localize "STR_EPOCH_TRADE_OFFER", _totalPrice,CurrencyName];
|
||||
ctrlSetText [Z_AT_TRADERLINE2, _ctrltext];
|
||||
} else {
|
||||
ctrlSetText [Z_AT_TRADERLINE2, ''];
|
||||
};
|
||||
Z_OriginalSellableArray = [] + Z_SellableArray;
|
||||
|
||||
_ctrltext = format[localize "STR_EPOCH_TRADE_ACCEPT", count(Z_SellableArray) , _extraText];
|
||||
ctrlSetText [Z_AT_TRADERLINE1, _ctrltext];
|
||||
_backUpText = _extraText;
|
||||
|
||||
call Z_fillSellList;
|
||||
if (Z_SellingFrom != 2) then { _extraText = getText (configFile >> 'CfgVehicles' >> _extraText >> 'displayName'); };
|
||||
if (isNil '_extraText') then { _extraText = _backUpText; };
|
||||
|
||||
if (Z_SingleCurrency) then {
|
||||
ctrlSetText [Z_AT_TRADERLINE2, format[localize "STR_EPOCH_TRADE_OFFER", _totalPrice,CurrencyName]];
|
||||
} else {
|
||||
ctrlSetText [Z_AT_TRADERLINE2, ''];
|
||||
};
|
||||
ctrlSetText [Z_AT_TRADERLINE1, format[localize "STR_EPOCH_TRADE_ACCEPT", count(Z_SellableArray) , _extraText]];
|
||||
|
||||
call Z_fillSellList;
|
||||
|
||||
Reference in New Issue
Block a user