mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
* Advanced trading fixes/modifcations This adds combine currency option to the Advanced trading screen since @Airwaves man noticed it didn't have a way of doing it. Updated stringtables with correct "paid" spelling and differing text for buying/selling. This also addds proper currency checking/reporting for the log system that has been introduced, it's untidy but it works, instead of getting "user bought x for 1000 currency" in a non coins server, it will convert it to the proper 1 brief 5 10oz gold etc system (uses a new function z_calcDefaultCurrencyNoImg) This also adds a check to see if the buy list is empty (as per the selling list) and returns text to the user informing them. Re-arranged buy and sell so buy is on top of sell, it's a bit easier to read then. * Advanced trading logging change This was missing from my previous commit, this changes the server_tradeobject to check if it's being passed a number (single currency) or text (my logging currency changes) * Advanced trading rework Fixes all problems @ebaydayz
83 lines
3.5 KiB
Plaintext
83 lines
3.5 KiB
Plaintext
private ['_item','_picture','_class','_display','_buyPrice','_sellPrice','_formattedText','_buyCurrency','_sellCurrency','_compatible','_weapon','_attach','_config','_compatibleText','_type','_text'];
|
|
#include "defines.sqf";
|
|
_item = _this select 0;
|
|
_picture = _item select 4;
|
|
_class = _item select 0;
|
|
_display = _item select 3;
|
|
_buyPrice = 0;
|
|
_sellPrice = 0;
|
|
if (Z_Selling) then {
|
|
_buyPrice = _item select 6;
|
|
_buyCurrency = _item select 8;
|
|
_sellPrice = _item select 2;
|
|
_sellCurrency = _item select 7;
|
|
} else {
|
|
_buyPrice = _item select 2;
|
|
_buyCurrency = _item select 7;
|
|
_sellPrice = _item select 6;
|
|
_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 {
|
|
_formattedText = format [
|
|
"<img image='%1' size='3' align='center'/><br />" +
|
|
"<t color='#33BFFF' size='0.8'>%8: </t><t color='#ffffff' size='0.8'>%2</t><br />" +
|
|
"<t color='#33BFFF' size='0.8'>%9: </t><t color='#ffffff' size='0.8'>%3</t><br />" +
|
|
"<t color='#33BFFF' size='0.8'>%11: </t><t color='#ffffff' size='0.8'>%6 %7</t><br />" +
|
|
"<t color='#33BFFF' size='0.8'>%10: </t><t color='#ffffff' size='0.8'>%5 %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"
|
|
];
|
|
} else {
|
|
_picSell = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'picture');
|
|
_sellCurrency = getText (configFile >> 'CfgMagazines' >> _sellCurrency >> 'displayName');
|
|
_picBuy = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'picture');
|
|
_buyCurrency = getText (configFile >> 'CfgMagazines' >> _buyCurrency >> 'displayName');
|
|
_formattedText = format [
|
|
"<img image='%1' size='3' align='center'/><br />" +
|
|
"<t color='#33BFFF' size='0.8'>%11: </t><t color='#ffffff' size='0.8'>%2</t><br />" +
|
|
"<t color='#33BFFF' size='0.8'>%12: </t><t color='#ffffff' size='0.8'>%3</t><br />" +
|
|
"<t color='#33BFFF' size='0.8'>%14: </t><t color='#ffffff' size='0.8'>%6 <img image='%10' /> %9</t><br />" +
|
|
"<t color='#33BFFF' size='0.8'>%13: </t><t color='#ffffff' size='0.8'>%5 <img image='%8' /> %7</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"
|
|
];
|
|
};
|
|
|
|
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;
|