mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2026-02-15 04:32:56 +03:00
Added trader menus by @maca134
This commit is contained in:
265
SQF/dayz_code/Configs/dialog.hpp
Normal file
265
SQF/dayz_code/Configs/dialog.hpp
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Styles
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
class RscTextTraderDialog
|
||||||
|
{
|
||||||
|
access = 0;
|
||||||
|
type = 0;
|
||||||
|
idc = -1;
|
||||||
|
colorBackground[] = {0,0,0,0};
|
||||||
|
colorText[] = {0.8784,0.8471,0.651,1};
|
||||||
|
text = "";
|
||||||
|
fixedWidth = 0;
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
h = 0.037;
|
||||||
|
w = 0.3;
|
||||||
|
style = 0;
|
||||||
|
shadow = 2;
|
||||||
|
font = "Zeppelin32";
|
||||||
|
SizeEx = 0.03921;
|
||||||
|
};
|
||||||
|
class RscListBoxTraderDialog
|
||||||
|
{
|
||||||
|
access = 0;
|
||||||
|
type = 5;
|
||||||
|
w = 0.4;
|
||||||
|
h = 0.4;
|
||||||
|
rowHeight = 0;
|
||||||
|
colorText[] = {0.8784,0.8471,0.651,1};
|
||||||
|
colorScrollbar[] = {0.95,0.95,0.95,1};
|
||||||
|
colorSelect[] = {0.95,0.95,0.95,1};
|
||||||
|
colorSelect2[] = {0.95,0.95,0.95,1};
|
||||||
|
colorSelectBackground[] = {0,0,0,1};
|
||||||
|
colorSelectBackground2[] = {0.8784,0.8471,0.651,1};
|
||||||
|
colorBackground[] = {0,0,0,1};
|
||||||
|
soundSelect[] = {"",0.1,1};
|
||||||
|
arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
|
||||||
|
arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
|
||||||
|
class ScrollBar
|
||||||
|
{
|
||||||
|
color[] = {1,1,1,0.6};
|
||||||
|
colorActive[] = {1,1,1,1};
|
||||||
|
colorDisabled[] = {1,1,1,0.3};
|
||||||
|
shadow = 0;
|
||||||
|
thumb = "\ca\ui\data\ui_scrollbar_thumb_ca.paa";
|
||||||
|
arrowFull = "\ca\ui\data\ui_arrow_top_active_ca.paa";
|
||||||
|
arrowEmpty = "\ca\ui\data\ui_arrow_top_ca.paa";
|
||||||
|
border = "\ca\ui\data\ui_border_scroll_ca.paa";
|
||||||
|
};
|
||||||
|
style = 16;
|
||||||
|
font = "Zeppelin32";
|
||||||
|
shadow = 2;
|
||||||
|
sizeEx = 0.03921;
|
||||||
|
color[] = {1,1,1,1};
|
||||||
|
period = 1.2;
|
||||||
|
maxHistoryDelay = 1;
|
||||||
|
autoScrollSpeed = -1;
|
||||||
|
autoScrollDelay = 5;
|
||||||
|
autoScrollRewind = 0;
|
||||||
|
};
|
||||||
|
class RscShortcutButtonTraderDialog
|
||||||
|
{
|
||||||
|
type = 16;
|
||||||
|
x = 0.1;
|
||||||
|
y = 0.1;
|
||||||
|
class HitZone
|
||||||
|
{
|
||||||
|
left = 0.004;
|
||||||
|
top = 0.029;
|
||||||
|
right = 0.004;
|
||||||
|
bottom = 0.029;
|
||||||
|
};
|
||||||
|
class ShortcutPos
|
||||||
|
{
|
||||||
|
left = 0.0145;
|
||||||
|
top = 0.026;
|
||||||
|
w = 0.0392157;
|
||||||
|
h = 0.0522876;
|
||||||
|
};
|
||||||
|
class TextPos
|
||||||
|
{
|
||||||
|
left = 0.05;
|
||||||
|
top = 0.034;
|
||||||
|
right = 0.005;
|
||||||
|
bottom = 0.005;
|
||||||
|
};
|
||||||
|
shortcuts[] = {};
|
||||||
|
textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)";
|
||||||
|
color[] = {0.8784,0.8471,0.651,1};
|
||||||
|
color2[] = {0.95,0.95,0.95,1};
|
||||||
|
colorDisabled[] = {1,1,1,0.25};
|
||||||
|
colorBackground[] = {1,1,1,1};
|
||||||
|
colorBackground2[] = {1,1,1,0.4};
|
||||||
|
class Attributes
|
||||||
|
{
|
||||||
|
font = "Zeppelin32";
|
||||||
|
color = "#E5E5E5";
|
||||||
|
align = "left";
|
||||||
|
shadow = "true";
|
||||||
|
};
|
||||||
|
idc = -1;
|
||||||
|
style = 0;
|
||||||
|
default = 0;
|
||||||
|
shadow = 2;
|
||||||
|
w = 0.183825;
|
||||||
|
h = 0.104575;
|
||||||
|
periodFocus = 1.2;
|
||||||
|
periodOver = 0.8;
|
||||||
|
animTextureNormal = "\ca\ui\data\ui_button_normal_ca.paa";
|
||||||
|
animTextureDisabled = "\ca\ui\data\ui_button_disabled_ca.paa";
|
||||||
|
animTextureOver = "\ca\ui\data\ui_button_over_ca.paa";
|
||||||
|
animTextureFocused = "\ca\ui\data\ui_button_focus_ca.paa";
|
||||||
|
animTexturePressed = "\ca\ui\data\ui_button_down_ca.paa";
|
||||||
|
animTextureDefault = "\ca\ui\data\ui_button_default_ca.paa";
|
||||||
|
period = 0.4;
|
||||||
|
font = "Zeppelin32";
|
||||||
|
size = 0.03921;
|
||||||
|
sizeEx = 0.03921;
|
||||||
|
text = "";
|
||||||
|
soundEnter[] = {"\ca\ui\data\sound\onover",0.09,1};
|
||||||
|
soundPush[] = {"\ca\ui\data\sound\new1",0,0};
|
||||||
|
soundClick[] = {"\ca\ui\data\sound\onclick",0.07,1};
|
||||||
|
soundEscape[] = {"\ca\ui\data\sound\onescape",0.09,1};
|
||||||
|
action = "";
|
||||||
|
class AttributesImage
|
||||||
|
{
|
||||||
|
font = "Zeppelin32";
|
||||||
|
color = "#E5E5E5";
|
||||||
|
align = "left";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
class TraderDialog
|
||||||
|
{
|
||||||
|
idd = -1;
|
||||||
|
movingenable = 0;
|
||||||
|
|
||||||
|
class Controls {
|
||||||
|
class RscTextTraderDialog_1000: RscTextTraderDialog
|
||||||
|
{
|
||||||
|
idc = -1;
|
||||||
|
x = 0.283646 * safezoneW + safezoneX;
|
||||||
|
y = 0.22492 * safezoneH + safezoneY;
|
||||||
|
w = 0.432709 * safezoneW;
|
||||||
|
h = 0.55016 * safezoneH;
|
||||||
|
colorBackground[] = {0,0,0,0.7};
|
||||||
|
};
|
||||||
|
class RscTextTraderDialog_1001: RscTextTraderDialog
|
||||||
|
{
|
||||||
|
idc = -1;
|
||||||
|
text = "Trader Menu";
|
||||||
|
x = 0.283646 * safezoneW + safezoneX;
|
||||||
|
y = 0.22492 * safezoneH + safezoneY;
|
||||||
|
w = 0.432709 * safezoneW;
|
||||||
|
h = 0.055016 * safezoneH;
|
||||||
|
colorBackground[] = {0,0,0,0.7};
|
||||||
|
};
|
||||||
|
class RscListboxTraderDialog_1500: RscListboxTraderDialog
|
||||||
|
{
|
||||||
|
idc = 12000;
|
||||||
|
x = 0.290407 * safezoneW + safezoneX;
|
||||||
|
y = 0.334952 * safezoneH + safezoneY;
|
||||||
|
w = 0.121699 * safezoneW;
|
||||||
|
h = 0.178802 * safezoneH;
|
||||||
|
onMouseButtonClick = "[(lbCurSel 12000)] spawn TraderDialogLoadItemList;";
|
||||||
|
};
|
||||||
|
class RscTextTraderDialog_1002: RscTextTraderDialog
|
||||||
|
{
|
||||||
|
idc = -1;
|
||||||
|
text = "Categories";
|
||||||
|
x = 0.290407 * safezoneW + safezoneX;
|
||||||
|
y = 0.29369 * safezoneH + safezoneY;
|
||||||
|
w = 0.0743718 * safezoneW;
|
||||||
|
h = 0.027508 * safezoneH;
|
||||||
|
};
|
||||||
|
class RscListboxTraderDialog_1501: RscListboxTraderDialog
|
||||||
|
{
|
||||||
|
idc = 12001;
|
||||||
|
x = 0.425628 * safezoneW + safezoneX;
|
||||||
|
y = 0.334952 * safezoneH + safezoneY;
|
||||||
|
w = 0.283965 * safezoneW;
|
||||||
|
h = 0.385112 * safezoneH;
|
||||||
|
onMouseButtonClick = "[(lbCurSel 12001)] spawn TraderDialogShowPrices;";
|
||||||
|
};
|
||||||
|
class RscShortcutButtonTraderDialog_1700: RscShortcutButtonTraderDialog
|
||||||
|
{
|
||||||
|
idc = -1;
|
||||||
|
text = "Buy";
|
||||||
|
x = 0.635221 * safezoneW + safezoneX;
|
||||||
|
y = 0.720064 * safezoneH + safezoneY;
|
||||||
|
w = 0.0743718 * safezoneW;
|
||||||
|
h = 0.055016 * safezoneH;
|
||||||
|
onButtonClick = "[(lbCurSel 12001)] call TraderDialogBuy; ((ctrlParent (_this select 0)) closeDisplay 9000);";
|
||||||
|
};
|
||||||
|
class RscShortcutButtonTraderDialog_1701: RscShortcutButtonTraderDialog
|
||||||
|
{
|
||||||
|
idc = -1;
|
||||||
|
text = "Sell";
|
||||||
|
x = 0.540566 * safezoneW + safezoneX;
|
||||||
|
y = 0.720064 * safezoneH + safezoneY;
|
||||||
|
w = 0.0743718 * safezoneW;
|
||||||
|
h = 0.055016 * safezoneH;
|
||||||
|
onButtonClick = "[(lbCurSel 12001)] call TraderDialogSell; ((ctrlParent (_this select 0)) closeDisplay 9000);";
|
||||||
|
};
|
||||||
|
class RscTextTraderDialog_1003: RscTextTraderDialog
|
||||||
|
{
|
||||||
|
idc = -1;
|
||||||
|
text = "Buy For";
|
||||||
|
x = 0.290407 * safezoneW + safezoneX;
|
||||||
|
y = 0.555016 * safezoneH + safezoneY;
|
||||||
|
w = 0.0743718 * safezoneW;
|
||||||
|
h = 0.027508 * safezoneH;
|
||||||
|
};
|
||||||
|
class RscTextTraderDialog_1004: RscTextTraderDialog
|
||||||
|
{
|
||||||
|
idc = -1;
|
||||||
|
text = "Sell For";
|
||||||
|
x = 0.290407 * safezoneW + safezoneX;
|
||||||
|
y = 0.623786 * safezoneH + safezoneY;
|
||||||
|
w = 0.0743718 * safezoneW;
|
||||||
|
h = 0.027508 * safezoneH;
|
||||||
|
};
|
||||||
|
class RscTextTraderDialog_1005: RscTextTraderDialog
|
||||||
|
{
|
||||||
|
idc = 12002;
|
||||||
|
text = "";
|
||||||
|
x = 0.290407 * safezoneW + safezoneX;
|
||||||
|
y = 0.582524 * safezoneH + safezoneY;
|
||||||
|
w = 0.114938 * safezoneW;
|
||||||
|
h = 0.027508 * safezoneH;
|
||||||
|
colorText[] = {1,1,1,1};
|
||||||
|
};
|
||||||
|
class RscTextTraderDialog_1006: RscTextTraderDialog
|
||||||
|
{
|
||||||
|
idc = 12003;
|
||||||
|
text = "";
|
||||||
|
x = 0.290407 * safezoneW + safezoneX;
|
||||||
|
y = 0.651294 * safezoneH + safezoneY;
|
||||||
|
w = 0.114938 * safezoneW;
|
||||||
|
h = 0.027508 * safezoneH;
|
||||||
|
colorText[] = {1,1,1,1};
|
||||||
|
};
|
||||||
|
class RscShortcutButtonTraderDialog_1702: RscShortcutButtonTraderDialog
|
||||||
|
{
|
||||||
|
idc = -1;
|
||||||
|
text = "Close";
|
||||||
|
x = 0.290407 * safezoneW + safezoneX;
|
||||||
|
y = 0.720064 * safezoneH + safezoneY;
|
||||||
|
w = 0.0743718 * safezoneW;
|
||||||
|
h = 0.055016 * safezoneH;
|
||||||
|
onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 9000);";
|
||||||
|
};
|
||||||
|
class RscText_1007: RscText
|
||||||
|
{
|
||||||
|
idc = -1;
|
||||||
|
text = "Items";
|
||||||
|
x = 0.432389 * safezoneW + safezoneX;
|
||||||
|
y = 0.29369 * safezoneH + safezoneY;
|
||||||
|
w = 0.0743718 * safezoneW;
|
||||||
|
h = 0.027508 * safezoneH;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//class RscPicture;
|
class RscPicture;
|
||||||
//class RscButton;
|
class RscButton;
|
||||||
class CA_IGUI_Title;
|
class CA_IGUI_Title;
|
||||||
class CA_Title;
|
class CA_Title;
|
||||||
class RscText;
|
class RscText;
|
||||||
|
|||||||
@@ -95,60 +95,6 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
/// Base Classes
|
/// Base Classes
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
/*
|
|
||||||
class RscPicture
|
|
||||||
{
|
|
||||||
access = 0;
|
|
||||||
type = 0;
|
|
||||||
idc = -1;
|
|
||||||
style = 48;
|
|
||||||
colorBackground[] = {0,0,0,0};
|
|
||||||
colorText[] = {1,1,1,1};
|
|
||||||
font = "TahomaB";
|
|
||||||
sizeEx = 0;
|
|
||||||
lineSpacing = 0;
|
|
||||||
text = "";
|
|
||||||
fixedWidth = 0;
|
|
||||||
shadow = 0;
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
w = 0.2;
|
|
||||||
h = 0.15;
|
|
||||||
};
|
|
||||||
class RscButton
|
|
||||||
{
|
|
||||||
access = 0;
|
|
||||||
type = 1;
|
|
||||||
text = "";
|
|
||||||
colorText[] = {0.8784,0.8471,0.651,1};
|
|
||||||
colorDisabled[] = {0.4,0.4,0.4,1};
|
|
||||||
colorBackground[] = {1,0.537,0,0.5};
|
|
||||||
colorBackgroundDisabled[] = {0.95,0.95,0.95,1};
|
|
||||||
colorBackgroundActive[] = {1,0.537,0,1};
|
|
||||||
colorFocused[] = {1,0.537,0,1};
|
|
||||||
colorShadow[] = {0.023529,0,0.0313725,1};
|
|
||||||
colorBorder[] = {0.023529,0,0.0313725,1};
|
|
||||||
soundEnter[] = {"\ca\ui\data\sound\onover",0.09,1};
|
|
||||||
soundPush[] = {"\ca\ui\data\sound\new1",0,0};
|
|
||||||
soundClick[] = {"\ca\ui\data\sound\onclick",0.07,1};
|
|
||||||
soundEscape[] = {"\ca\ui\data\sound\onescape",0.09,1};
|
|
||||||
style = 2;
|
|
||||||
x = 0;
|
|
||||||
y = 0;
|
|
||||||
w = 0.095589;
|
|
||||||
h = 0.039216;
|
|
||||||
shadow = 2;
|
|
||||||
font = "Zeppelin33";
|
|
||||||
sizeEx = 0.03921;
|
|
||||||
offsetX = 0.003;
|
|
||||||
offsetY = 0.003;
|
|
||||||
offsetPressedX = 0.002;
|
|
||||||
offsetPressedY = 0.002;
|
|
||||||
borderSize = 0;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
class RscPicture;
|
|
||||||
class RscButton;
|
|
||||||
|
|
||||||
class SafeKeyPad
|
class SafeKeyPad
|
||||||
{
|
{
|
||||||
|
|||||||
24
SQF/dayz_code/actions/show_dialog.sqf
Normal file
24
SQF/dayz_code/actions/show_dialog.sqf
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
private ["_trader_data", "_dialog"];
|
||||||
|
|
||||||
|
if (TradeInprogress) exitWith {
|
||||||
|
cutText ["Trading already in progress." , "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
|
||||||
|
_trader_data = (_this select 3);
|
||||||
|
|
||||||
|
_dialog = createdialog "TraderDialog";
|
||||||
|
lbClear TraderDialogCatList;
|
||||||
|
lbClear TraderDialogItemList;
|
||||||
|
|
||||||
|
TraderCurrentCatIndex = -1;
|
||||||
|
TraderItemList = -1;
|
||||||
|
|
||||||
|
TraderCatList = [];
|
||||||
|
{
|
||||||
|
private ["_index", "_x"];
|
||||||
|
_index = lbAdd [TraderDialogCatList, _x select 0];
|
||||||
|
TraderCatList set [count TraderCatList, _x select 1];
|
||||||
|
} forEach _trader_data;
|
||||||
|
waitUntil { !dialog };
|
||||||
|
TraderCurrentCatIndex = -1;
|
||||||
|
TraderCatList = -1;
|
||||||
@@ -578,10 +578,8 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
|
|||||||
|
|
||||||
} forEach (_traderMenu select 1);
|
} forEach (_traderMenu select 1);
|
||||||
// Database menu
|
// Database menu
|
||||||
{
|
_buy = player addAction ["Trader Menu", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 99, true, false, "",""];
|
||||||
_buy = player addAction [(_x select 0), "\z\addons\dayz_code\actions\buy_or_sell.sqf",[(_x select 1),(_x select 0)], 99, true, false, "",""];
|
s_player_parts set [count s_player_parts,_buy];
|
||||||
s_player_parts set [count s_player_parts,_buy];
|
|
||||||
} forEach (_traderMenu select 0);
|
|
||||||
|
|
||||||
// Add static metals trader options under sub menu
|
// Add static metals trader options under sub menu
|
||||||
_metals_trader = player addAction ["Trade Metals", "\z\addons\dayz_code\actions\trade_metals.sqf",["na"], 0, true, false, "",""];
|
_metals_trader = player addAction ["Trade Metals", "\z\addons\dayz_code\actions\trade_metals.sqf",["na"], 0, true, false, "",""];
|
||||||
|
|||||||
@@ -432,6 +432,194 @@ if (!isDedicated) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
dayz_originalPlayer = player;
|
dayz_originalPlayer = player;
|
||||||
|
|
||||||
|
|
||||||
|
// trader menu gui by maca134
|
||||||
|
TraderDialogCatList = 12000;
|
||||||
|
TraderDialogItemList = 12001;
|
||||||
|
TraderDialogBuyPrice = 12002;
|
||||||
|
TraderDialogSellPrice = 12003;
|
||||||
|
|
||||||
|
TraderCurrentCatIndex = -1;
|
||||||
|
TraderCatList = -1;
|
||||||
|
TraderItemList = -1;
|
||||||
|
|
||||||
|
TraderDialogLoadItemList = {
|
||||||
|
private ["_index", "_trader_id", "_activatingPlayer"];
|
||||||
|
TraderItemList = -1;
|
||||||
|
_index = _this select 0;
|
||||||
|
|
||||||
|
if (_index < 0 or TraderCurrentCatIndex == _index) exitWith {};
|
||||||
|
TraderCurrentCatIndex = _index;
|
||||||
|
|
||||||
|
_trader_id = TraderCatList select _index;
|
||||||
|
_activatingPlayer = player;
|
||||||
|
|
||||||
|
lbClear TraderDialogItemList;
|
||||||
|
ctrlSetText [TraderDialogBuyPrice, ""];
|
||||||
|
ctrlSetText [TraderDialogSellPrice, ""];
|
||||||
|
|
||||||
|
lbAdd [TraderDialogItemList, "Loading items..."];
|
||||||
|
|
||||||
|
dayzTraderMenuResult = call compile format["tcacheBuy_%1;",_trader_id];
|
||||||
|
|
||||||
|
if(isNil "dayzTraderMenuResult") then {
|
||||||
|
dayzTraderMenu = [_activatingPlayer,_trader_id];
|
||||||
|
publicVariableServer "dayzTraderMenu";
|
||||||
|
waitUntil {!isNil "dayzTraderMenuResult"};
|
||||||
|
};
|
||||||
|
|
||||||
|
lbClear TraderDialogItemList;
|
||||||
|
_item_list = [];
|
||||||
|
{
|
||||||
|
private ["_header", "_item", "_name", "_type", "_textPart", "_qty", "_buy", "_bqty", "_bname", "_btype", "_btextCurrency", "_sell", "_sqty", "_sname", "_stype", "_stextCurrency", "_order", "_order", "_afile", "_File", "_count", "_bag", "_bagclass", "_index", "_image"];
|
||||||
|
_header = _x select 0; // "TRD"
|
||||||
|
_item = _x select 1;
|
||||||
|
_name = _item select 0;
|
||||||
|
_type = _item select 1;
|
||||||
|
switch (true) do {
|
||||||
|
case (_type == 1): {
|
||||||
|
_type = "CfgMagazines";
|
||||||
|
};
|
||||||
|
case (_type == 2): {
|
||||||
|
_type = "CfgVehicles";
|
||||||
|
};
|
||||||
|
case (_type == 3): {
|
||||||
|
_type = "CfgWeapons";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// Display Name of item
|
||||||
|
_textPart = getText(configFile >> _type >> _name >> "displayName");
|
||||||
|
|
||||||
|
// Total in stock
|
||||||
|
_qty = _x select 2;
|
||||||
|
|
||||||
|
// Buy Data from array
|
||||||
|
_buy = _x select 3;
|
||||||
|
_bqty = _buy select 0;
|
||||||
|
_bname = _buy select 1;
|
||||||
|
_btype = _buy select 2;
|
||||||
|
switch(true)do{
|
||||||
|
case (_btype == 1): {
|
||||||
|
_btype = "CfgMagazines";
|
||||||
|
};
|
||||||
|
case (_btype == 2): {
|
||||||
|
_btype = "CfgVehicles";
|
||||||
|
};
|
||||||
|
case (_btype == 3): {
|
||||||
|
_btype = "CfgWeapons";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// Display Name of buy item
|
||||||
|
_btextCurrency = getText(configFile >> _btype >> _bname >> "displayName");
|
||||||
|
|
||||||
|
_sell = _x select 4;
|
||||||
|
_sqty = _sell select 0;
|
||||||
|
_sname = _sell select 1;
|
||||||
|
_stype = _sell select 2;
|
||||||
|
switch(true)do{
|
||||||
|
case (_stype == 1): {
|
||||||
|
_stype = "CfgMagazines";
|
||||||
|
};
|
||||||
|
case (_stype == 2): {
|
||||||
|
_stype = "CfgVehicles";
|
||||||
|
};
|
||||||
|
case (_stype == 3): {
|
||||||
|
_stype = "CfgWeapons";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
// Display Name of sell item
|
||||||
|
_stextCurrency = getText(configFile >> _stype >> _sname >> "displayName");
|
||||||
|
|
||||||
|
// Menu sort order
|
||||||
|
_order = _x select 5;
|
||||||
|
|
||||||
|
// Action file to use for trade
|
||||||
|
_afile = _x select 7;
|
||||||
|
_File = "\z\addons\dayz_code\actions\" + _afile + ".sqf";
|
||||||
|
|
||||||
|
_count = 0;
|
||||||
|
if(_type == "CfgVehicles") then {
|
||||||
|
if (_afile == "trade_backpacks") then {
|
||||||
|
_bag = unitBackpack player;
|
||||||
|
_bagclass = typeOf _bag;
|
||||||
|
if(_name == _bagclass) then {
|
||||||
|
_count = 1;
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
_count = {(typeOf _x) == _name} count (nearestObjects [player, [_name], 20]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if(_type == "CfgMagazines") then {
|
||||||
|
_count = {_x == _name} count magazines player;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(_type == "CfgWeapons") then {
|
||||||
|
_count = {_x == _name} count weapons player;
|
||||||
|
};
|
||||||
|
|
||||||
|
_index = lbAdd [TraderDialogItemList, format["%1 (%2)", _textPart, _name]];
|
||||||
|
|
||||||
|
if (_count > 0) then {
|
||||||
|
lbSetColor [TraderDialogItemList, _index, [0, 1, 0, 1]];
|
||||||
|
};
|
||||||
|
|
||||||
|
_image = getText(configFile >> _type >> _name >> "picture");
|
||||||
|
lbSetPicture [TraderDialogItemList, _index, _image];
|
||||||
|
|
||||||
|
_item_list set [count _item_list, [
|
||||||
|
_name,
|
||||||
|
_textPart,
|
||||||
|
_bqty,
|
||||||
|
_bname,
|
||||||
|
_btextCurrency,
|
||||||
|
_sqty,
|
||||||
|
_sname,
|
||||||
|
_stextCurrency,
|
||||||
|
_header,
|
||||||
|
_File
|
||||||
|
]];
|
||||||
|
} forEach dayzTraderMenuResult;
|
||||||
|
TraderItemList = _item_list;
|
||||||
|
};
|
||||||
|
|
||||||
|
TraderDialogShowPrices = {
|
||||||
|
private ["_index", "_item"];
|
||||||
|
_index = _this select 0;
|
||||||
|
if (_index < 0) exitWith {};
|
||||||
|
while {count TraderItemList < 1} do { sleep 1; };
|
||||||
|
_item = TraderItemList select _index;
|
||||||
|
ctrlSetText [TraderDialogBuyPrice, format["%1 %2", _item select 2, _item select 4]];
|
||||||
|
ctrlSetText [TraderDialogSellPrice, format["%1 %2", _item select 5, _item select 7]];
|
||||||
|
};
|
||||||
|
|
||||||
|
TraderDialogBuy = {
|
||||||
|
private ["_index", "_item", "_data"];
|
||||||
|
_index = _this select 0;
|
||||||
|
if (_index < 0) exitWith {
|
||||||
|
cutText ["Trading canceled." , "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
_item = TraderItemList select _index;
|
||||||
|
_data = [_item select 0, _item select 3, 1, _item select 2, "buy", _item select 4, _item select 1, _item select 8];
|
||||||
|
[0, player, '', _data] execVM (_item select 9);
|
||||||
|
TraderItemList = -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
TraderDialogSell = {
|
||||||
|
private ["_index", "_item", "_data"];
|
||||||
|
_index = _this select 0;
|
||||||
|
if (_index < 0) exitWith {
|
||||||
|
cutText ["Trading canceled." , "PLAIN DOWN"];
|
||||||
|
};
|
||||||
|
_item = TraderItemList select _index;
|
||||||
|
_data = [_item select 6, _item select 0, _item select 5, 1, "sell", _item select 1, _item select 7, _item select 8];
|
||||||
|
[0, player, '', _data] execVM (_item select 9);
|
||||||
|
TraderItemList = -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
progressLoadingScreen 0.8;
|
progressLoadingScreen 0.8;
|
||||||
|
|||||||
Reference in New Issue
Block a user