Add attachments compatibility list to trader

Also reduced item info size a bit to better fit normal and large
interface sizes.
This commit is contained in:
ebaydayz
2016-05-07 19:29:00 -04:00
parent 3d4d6f6544
commit 41e653136f
4 changed files with 123 additions and 47 deletions

View File

@@ -1,4 +1,4 @@
private ['_item','_picture','_class','_display','_buyPrice','_sellPrice','_formattedText','_buyCurrency','_sellCurrency']; private ['_item','_picture','_class','_display','_buyPrice','_sellPrice','_formattedText','_buyCurrency','_sellCurrency','_compatible','_weapon','_attach','_config','_compatibleText','_type','_text'];
#include "defines.sqf"; #include "defines.sqf";
_item = _this select 0; _item = _this select 0;
_picture = _item select 4; _picture = _item select 4;
@@ -18,13 +18,43 @@ if (Z_Selling) then {
_sellCurrency = _item select 8; _sellCurrency = _item select 8;
}; };
_compatible = [];
if (["Attachment",_class] call fnc_inString) then {
_config = configFile >> "CfgWeapons";
for "_i" from 0 to (count _config)-1 do {
_weapon = _config select _i;
if (isClass _weapon && {isClass (_weapon >> "Attachments")}) then {
for "_i" from 0 to (count (_weapon >> "Attachments"))-1 do {
_attach = (_weapon >> "Attachments") select _i;
_type = configName _attach;
if (_class == _type) exitWith {
_text = getText (_weapon >> "displayName");
if (!(_text in _compatible) && (!(isClass (_weapon >> "ItemActions")) or {count (_weapon >> "ItemActions") < 1})) then {
_compatible set [count _compatible,_text];
};
};
};
};
};
};
_compatibleText = "";
{
if (_forEachIndex > 0) then {
_compatibleText = _compatibleText + ", " + _x;
} else {
_compatibleText = _compatibleText + _x;
};
} forEach _compatible;
if (Z_SingleCurrency) then { if (Z_SingleCurrency) then {
_formattedText = format [ _formattedText = format [
"<img image='%1' size='3' align='center'/><br />" + "<img image='%1' size='3' align='center'/><br />" +
"<t color='#33BFFF'>%8: </t><t color='#ffffff'>%2</t><br />" + "<t color='#33BFFF' size='0.8'>%8: </t><t color='#ffffff' size='0.8'>%2</t><br />" +
"<t color='#33BFFF'>%9: </t><t color='#ffffff'>%3</t><br />" + "<t color='#33BFFF' size='0.8'>%9: </t><t color='#ffffff' size='0.8'>%3</t><br />" +
"<t color='#33BFFF'>%10: </t><t color='#ffffff'>%5 %7</t><br />" + "<t color='#33BFFF' size='0.8'>%10: </t><t color='#ffffff' size='0.8'>%5 %7</t><br />" +
"<t color='#33BFFF'>%11: </t><t color='#ffffff'>%6 %7</t><br />" "<t color='#33BFFF' size='0.8'>%11: </t><t color='#ffffff' size='0.8'>%6 %7</t><br />"
, _picture, _display, _class, 'lazy', _sellPrice, _buyPrice, CurrencyName, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291" , _picture, _display, _class, 'lazy', _sellPrice, _buyPrice, CurrencyName, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291"
]; ];
} else { } else {
@@ -34,11 +64,19 @@ if (Z_SingleCurrency) then {
_buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName'); _buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName');
_formattedText = format [ _formattedText = format [
"<img image='%1' size='3' align='center'/><br />" + "<img image='%1' size='3' align='center'/><br />" +
"<t color='#33BFFF'>%11: </t><t color='#ffffff'>%2</t><br />" + "<t color='#33BFFF' size='0.8'>%11: </t><t color='#ffffff' size='0.8'>%2</t><br />" +
"<t color='#33BFFF'>%12: </t><t color='#ffffff'>%3</t><br />" + "<t color='#33BFFF' size='0.8'>%12: </t><t color='#ffffff' size='0.8'>%3</t><br />" +
"<t color='#33BFFF'>%13: </t><t color='#ffffff'>%5 <img image='%8' /> %7</t><br />" + "<t color='#33BFFF' size='0.8'>%13: </t><t color='#ffffff' size='0.8'>%5 <img image='%8' /> %7</t><br />" +
"<t color='#33BFFF'>%14: </t><t color='#ffffff'>%6 <img image='%10' /> %9</t><br />" "<t color='#33BFFF' size='0.8'>%14: </t><t color='#ffffff' size='0.8'>%6 <img image='%10' /> %9</t><br />"
, _picture, _display, _class, 'lazy', _sellPrice, _buyPrice, _sellCurrency , _picSell , _buyCurrency, _picBuy, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291" , _picture, _display, _class, 'lazy', _sellPrice, _buyPrice, _sellCurrency , _picSell , _buyCurrency, _picBuy, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291"
]; ];
}; };
if (count _compatible > 0) then {
_formattedText = _formattedText + format [
"<t color='#33BFFF' size='0.8'>%1: </t><t color='#ffffff' size='0.7'>%2</t>"
,localize "STR_EPOCH_COMPATIBLE",_compatibleText
];
};
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText;

View File

@@ -118,18 +118,14 @@ _wepText = "";
if (Z_SingleCurrency) then { if (Z_SingleCurrency) then {
_formattedText = format [ _formattedText = format [
"<img image='%1' size='3' /><br />" + "<img image='%1' size='3' /><br />" +
"<t color='#33BFFF'>%10: </t><t color='#ffffff'>%2</t><br />" + "<t color='#33BFFF' size='0.8'>%10: </t><t color='#ffffff' size='0.7'>%2</t><br />" +
"<t color='#33BFFF'>%11: </t><t color='#ffffff'>%3</t><br />" + "<t color='#33BFFF' size='0.8'>%11: </t><t color='#ffffff' size='0.7'>%3</t><br />" +
"<t color='#33BFFF'>%12: </t><t color='#ffffff'>%5 %7</t><br />" + "<t color='#33BFFF' size='0.8'>%12: </t><t color='#ffffff' size='0.8'>%5 %7</t><br />" +
"<t color='#33BFFF'>%13: </t><t color='#ffffff'>%6 %7</t><br />" + "<t color='#33BFFF' size='0.8'>%13: </t><t color='#ffffff' size='0.8'>%6 %7</t><br />" +
"<t color='#33BFFF'>%14: </t><t color='#ffffff'>%9</t><br />" + "<t color='#33BFFF' size='0.8'>%14/%15/%16: </t><t color='#ffffff' size='0.8'>%9/%8/%4</t><br />" +
"<t color='#33BFFF'>%15: </t><t color='#ffffff'>%8</t><br />" + "<t color='#33BFFF' size='0.8'>%17: </t><t color='#ffffff' size='0.8'>%18 </t><t color='#33BFFF' size='0.8'>%24: </t><t color='#ffffff' size='0.8'>%25</t><br />" + // Armor / Seats
"<t color='#33BFFF'>%16: </t><t color='#ffffff'>%4</t><br />" + "<t color='#33BFFF' size='0.8'>%21%22: </t><t color='#ffffff' size='0.8'>%23 </t><t color='#33BFFF' size='0.8'>%19: </t><t color='#ffffff' size='0.8'>%20</t><br />" + // MaxSpeed / Fuel
"<t color='#33BFFF'>%17: </t><t color='#ffffff'>%18</t><br />" + // Armor "<t color='#33BFFF' size='0.8'>%26: </t><t color='#ffffff' size='0.7'>%27</t>" // Weapons
//"<t color='#33BFFF'>%19: </t><t color='#ffffff'>%20</t><br />" + // Fuel
"<t color='#33BFFF'>%21%22: </t><t color='#ffffff'>%23</t><br />" + // MaxSpeed
"<t color='#33BFFF'>%24: </t><t color='#ffffff'>%25</t><br />" + // Seats
"<t color='#33BFFF'>%26: </t><t color='#ffffff'>%27</t>" // Weapons
, _picture, _display, _class, _transportmaxBackpacks, _sellPrice, _buyPrice, CurrencyName, _transportMaxWeapons,_transportMaxMagazines, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291", localize "STR_EPOCH_MAGS", localize "STR_EPOCH_WEPS", localize "STR_EPOCH_BAGS", , _picture, _display, _class, _transportmaxBackpacks, _sellPrice, _buyPrice, CurrencyName, _transportMaxWeapons,_transportMaxMagazines, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291", localize "STR_EPOCH_MAGS", localize "STR_EPOCH_WEPS", localize "STR_EPOCH_BAGS",
localize "STR_EPOCH_ARMOR",_armor,localize "STR_EPOCH_FUEL",_fuelCapacity,localize "STR_EPOCH_MAX",localize "STR_EPOCH_SPEED",_maxSpeed,localize "STR_EPOCH_SEATS",_seats,localize "STR_EPOCH_WEAPONS",_wepText localize "STR_EPOCH_ARMOR",_armor,localize "STR_EPOCH_FUEL",_fuelCapacity,localize "STR_EPOCH_MAX",localize "STR_EPOCH_SPEED",_maxSpeed,localize "STR_EPOCH_SEATS",_seats,localize "STR_EPOCH_WEAPONS",_wepText
]; ];
@@ -143,18 +139,14 @@ if (Z_SingleCurrency) then {
_formattedText = format [ _formattedText = format [
"<img image='%1' size='3' /><br />" + "<img image='%1' size='3' /><br />" +
"<t color='#33BFFF'>%13: </t><t color='#ffffff'>%2</t><br />" + "<t color='#33BFFF' size='0.8'>%13: </t><t color='#ffffff' size='0.7'>%2</t><br />" +
"<t color='#33BFFF'>%14: </t><t color='#ffffff'>%3</t><br />" + "<t color='#33BFFF' size='0.8'>%14: </t><t color='#ffffff' size='0.7'>%3</t><br />" +
"<t color='#33BFFF'>%15: </t><t color='#ffffff'>%5 <img image='%11' /> %10</t><br />" + "<t color='#33BFFF' size='0.8'>%15: </t><t color='#ffffff' size='0.8'>%5 <img image='%11' /> %10</t><br />" +
"<t color='#33BFFF'>%16: </t><t color='#ffffff'>%6 <img image='%12' /> %7</t><br />" + "<t color='#33BFFF' size='0.8'>%16: </t><t color='#ffffff' size='0.8'>%6 <img image='%12' /> %7</t><br />" +
"<t color='#33BFFF'>%17: </t><t color='#ffffff'>%8</t><br />" + "<t color='#33BFFF' size='0.8'>%17/%18/%19: </t><t color='#ffffff' size='0.8'>%8/%9/%4</t><br />" +
"<t color='#33BFFF'>%18: </t><t color='#ffffff'>%9</t><br />" + "<t color='#33BFFF' size='0.8'>%20: </t><t color='#ffffff' size='0.8'>%21 </t><t color='#33BFFF' size='0.8'>%27: </t><t color='#ffffff' size='0.8'>%28</t><br />" + // Armor / Seats
"<t color='#33BFFF'>%19: </t><t color='#ffffff'>%4</t><br />" + "<t color='#33BFFF' size='0.8'>%24%25: </t><t color='#ffffff' size='0.8'>%26 </t><t color='#33BFFF' size='0.8'>%22: </t><t color='#ffffff' size='0.8'>%23</t><br />" + // MaxSpeed / Fuel
"<t color='#33BFFF'>%20: </t><t color='#ffffff'>%21</t><br />" + // Armor "<t color='#33BFFF' size='0.8'>%29: </t><t color='#ffffff' size='0.7'>%30</t>" // Weapons
//"<t color='#33BFFF'>%22: </t><t color='#ffffff'>%23</t><br />" + // Fuel
"<t color='#33BFFF'>%24%25: </t><t color='#ffffff'>%26</t><br />" + // MaxSpeed
"<t color='#33BFFF'>%27: </t><t color='#ffffff'>%28</t><br />" + // Seats
"<t color='#33BFFF'>%29: </t><t color='#ffffff'>%30</t>" // Weapons
, _picture, _display, _class, _transportmaxBackpacks, _sellPrice, _buyPrice, _buyCurrency, _transportMaxWeapons,_transportMaxMagazines, _sellCurrency, _picSell,_picBuy, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291", localize "STR_EPOCH_WEPS", localize "STR_EPOCH_MAGS", localize "STR_EPOCH_BAGS", , _picture, _display, _class, _transportmaxBackpacks, _sellPrice, _buyPrice, _buyCurrency, _transportMaxWeapons,_transportMaxMagazines, _sellCurrency, _picSell,_picBuy, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291", localize "STR_EPOCH_WEPS", localize "STR_EPOCH_MAGS", localize "STR_EPOCH_BAGS",
localize "STR_EPOCH_ARMOR",_armor,localize "STR_EPOCH_FUEL",_fuelCapacity,localize "STR_EPOCH_MAX",localize "STR_EPOCH_SPEED",_maxSpeed,localize "STR_EPOCH_SEATS",_seats,localize "STR_EPOCH_WEAPONS",_wepText localize "STR_EPOCH_ARMOR",_armor,localize "STR_EPOCH_FUEL",_fuelCapacity,localize "STR_EPOCH_MAX",localize "STR_EPOCH_SPEED",_maxSpeed,localize "STR_EPOCH_SEATS",_seats,localize "STR_EPOCH_WEAPONS",_wepText
]; ];

View File

@@ -1,4 +1,4 @@
private ["_item","_picture","_class","_display","_buyPrice","_sellPrice","_magazines","_magText","_formattedText","_buyCurrency","_sellCurrency"]; private ["_item","_picture","_class","_display","_buyPrice","_sellPrice","_magazines","_magText","_formattedText","_buyCurrency","_sellCurrency","_attachments","_attachText","_config","_text","_attach","_type"];
#include "defines.sqf"; #include "defines.sqf";
_item = _this select 0; _item = _this select 0;
@@ -22,9 +22,33 @@ if (Z_Selling) then {
_sellCurrency = _item select 8; _sellCurrency = _item select 8;
}; };
_attachments = [];
_config = configFile >> "CfgWeapons" >> _class >> "Attachments";
if (isClass _config) then {
for "_i" from 0 to (count _config)-1 do {
_attach = _config select _i;
_type = configName _attach;
_text = getText (configFile >> "CfgMagazines" >> _type >> "displayName");
_attachments set [count _attachments,_text];
};
};
if (count _attachments < 1) then {_attachments = [localize "STR_EPOCH_NONE"];};
_attachText = "";
{
if (_forEachIndex > 0) then {
_attachText = _attachText + ", " + _x;
} else {
_attachText = _attachText + _x;
};
} forEach _attachments;
_magazines = []; _magazines = [];
if( isArray (configFile >> 'CfgWeapons' >> _class >> 'magazines')) then { if( isArray (configFile >> 'CfgWeapons' >> _class >> 'magazines')) then {
_magazines = getArray (configFile >> 'CfgWeapons' >> _class >> 'magazines'); {
_magazines set [count _magazines, getText (configFile >> "CfgMagazines" >> _x >> "displayName")];
} forEach (getArray (configFile >> 'CfgWeapons' >> _class >> 'magazines'));
}; };
_magText = ""; _magText = "";
@@ -40,12 +64,11 @@ _magText = "";
if (Z_SingleCurrency) then { if (Z_SingleCurrency) then {
_formattedText = format [ _formattedText = format [
"<img image='%1' size='3' align='center' /><br />" + "<img image='%1' size='3' align='center' /><br />" +
"<t color='#33BFFF'>%8: </t><t color='#ffffff'>%2</t><br />" + "<t color='#33BFFF' size='0.8'>%8: </t><t color='#ffffff' size='0.8'>%2</t><br />" +
"<t color='#33BFFF'>%9: </t><t color='#ffffff'>%3</t><br />" + "<t color='#33BFFF' size='0.8'>%9: </t><t color='#ffffff' size='0.8'>%3</t><br />" +
"<t color='#33BFFF'>%10: </t><t color='#ffffff'>%5 %7</t><br />" + "<t color='#33BFFF' size='0.8'>%10: </t><t color='#ffffff' size='0.8'>%5 %7</t><br />" +
"<t color='#33BFFF'>%11: </t><t color='#ffffff'>%6 %7</t><br />" + "<t color='#33BFFF' size='0.8'>%11: </t><t color='#ffffff' size='0.8'>%6 %7</t><br />"
"<t color='#33BFFF'>%12: </t><br /><t color='#ffffff' size='0.5'>%4</t>" , _picture, _display, _class, _magText, _sellPrice, _buyPrice, CurrencyName, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291"
, _picture, _display, _class, _magText, _sellPrice, _buyPrice, CurrencyName, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291", localize "STR_EPOCH_MAGS"
]; ];
}else { }else {
_picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture'); _picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture');
@@ -55,15 +78,22 @@ if (Z_SingleCurrency) then {
_formattedText = format [ _formattedText = format [
"<img image='%1' size='3' align='center' /><br />" + "<img image='%1' size='3' align='center' /><br />" +
"<t color='#33BFFF'>%11: </t><t color='#ffffff'>%2</t><br />" + "<t color='#33BFFF' size='0.8'>%11: </t><t color='#ffffff' size='0.8'>%2</t><br />" +
"<t color='#33BFFF'>%12: </t><t color='#ffffff'>%3</t><br />" + "<t color='#33BFFF' size='0.8'>%12: </t><t color='#ffffff' size='0.8'>%3</t><br />" +
"<t color='#33BFFF'>%13: </t><t color='#ffffff'>%5 <img image='%9' /> %7</t><br />" + "<t color='#33BFFF' size='0.8'>%13: </t><t color='#ffffff' size='0.8'>%5 <img image='%9' /> %7</t><br />" +
"<t color='#33BFFF'>%14: </t><t color='#ffffff'>%6 <img image='%10' /> %8</t><br />" + "<t color='#33BFFF' size='0.8'>%14: </t><t color='#ffffff' size='0.8'>%6 <img image='%10' /> %8</t><br />"
"<t color='#33BFFF'>%15: </t><br /><t color='#ffffff' size='0.5'>%4</t>" , _picture, _display, _class, _magText, _sellPrice, _buyPrice, _sellCurrency, _buyCurrency, _picSell, _picBuy, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291"
, _picture, _display, _class, _magText, _sellPrice, _buyPrice, _sellCurrency, _buyCurrency, _picSell, _picBuy, localize "STR_EPOCH_NAME", localize "STR_EPOCH_CLASS", localize "STR_EPOCH_PLAYER_292", localize "STR_EPOCH_PLAYER_291", localize "STR_EPOCH_MAGS"
]; ];
}; };
_parentClasses = [(configFile >> "CfgWeapons" >> _class),true] call BIS_fnc_returnParents;
if !("ItemCore" in _parentClasses or "Binocular" in _parentClasses) then {
_formattedText = _formattedText + format [
"<t color='#33BFFF' size='0.8'>%1: </t><t color='#ffffff' size='0.7'>%2</t><br />" +
"<t color='#33BFFF' size='0.8'>%3: </t><t color='#ffffff' size='0.7'>%4</t>"
,localize "STR_EPOCH_ATTACHMENTS",_attachText,localize "STR_EPOCH_MAGS",_magText
];
};
(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText;

View File

@@ -15890,6 +15890,14 @@
<English>Bags</English> <English>Bags</English>
<Russian>Рюкзаков</Russian> <Russian>Рюкзаков</Russian>
</Key> </Key>
<Key ID="STR_EPOCH_ATTACHMENTS">
<English>Attachments</English>
<German>Zubehör</German>
<Russian>Вложения</Russian>
<Spanish>Accesorios</Spanish>
<French>Accessoires</French>
<Czech>Přílohy</Czech>
</Key>
<Key ID="STR_EPOCH_SEATS"> <Key ID="STR_EPOCH_SEATS">
<English>Seats</English> <English>Seats</English>
<German>Sitze</German> <German>Sitze</German>
@@ -17322,5 +17330,13 @@
<Polish>Brak</Polish> <Polish>Brak</Polish>
<Hungarian>Nincs</Hungarian> <Hungarian>Nincs</Hungarian>
</Key> </Key>
<Key ID="STR_EPOCH_COMPATIBLE">
<English>Compatible</English>
<German>Kompatibel</German>
<Russian>совместимый</Russian>
<Spanish>Compatible</Spanish>
<French>Compatible</French>
<Czech>Kompatibilní</Czech>
</Key>
</Package> </Package>
</Project> </Project>