diff --git a/CHANGE LOG 1.0.6.txt b/CHANGE LOG 1.0.6.txt index cdb3bbb00..b37384902 100644 --- a/CHANGE LOG 1.0.6.txt +++ b/CHANGE LOG 1.0.6.txt @@ -28,6 +28,7 @@ [NEW] Added waves effect during stormy weather #974 @FramedYannick @ebaydayz [NEW] Optional variable to prevent stealing from backpacks by non-friendlies at traders. Set DZE_BackpackAntiTheft = true; in init.sqf @ebaydayz [NEW] Players can carry more than one primary weapon which allows the abillity to hide one on their back, configure using DZE_TwoPrimaries. see ConfigVariable.sqf for details @icomrade +[NEW] Zupa's Advanced Trading is now included as part of the Epoch Code, enabled with DZE_advancedTrading = true; NOT COMPATIBLE WITH DATABASE TRADERS @icomrade @Windmolders [CHANGED] Many duplicate functions and variables were renamed. See Documents\1.0.6 Variable Name Changes.txt @ebaydayz [CHANGED] Several weapon, item and tool classnames changed. Admins see SQL\1.0.6_Updates @ebaydayz diff --git a/SQF/dayz_code/Configs/RscDisplay/ZSCdefines.hpp b/SQF/dayz_code/Configs/RscDisplay/ZSCdefines.hpp new file mode 100644 index 000000000..764639df8 --- /dev/null +++ b/SQF/dayz_code/Configs/RscDisplay/ZSCdefines.hpp @@ -0,0 +1,644 @@ +class ZSC_RscScrollBar +{ + color[] = {1,1,1,0.6}; + colorActive[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.3}; + shadow = 0; + scrollSpeed = 0.06; + width = 0; + height = 0; + autoScrollEnabled = 0; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; +}; + +class ZSC_RscControlsGroup { + type = 15; + idc = -1; + x = 0; + y = 0; + w = 1; + h = 1; + shadow = 0; + style = 16; + + class VScrollBar : ZSC_RscScrollBar + { + width = 0.021; + autoScrollEnabled = 1; + }; + + class HScrollBar : ZSC_RscScrollBar + { + height = 0.028; + }; + + class Controls {}; +}; + +class ZSC_RscControlsGroupNoScrollbars : ZSC_RscControlsGroup { + class VScrollbar : VScrollbar { + width = 0; + }; + class HScrollbar : HScrollbar { + height = 0; + }; +}; + +class ZSC_RscHud +{ + idc = -1; + type = 0; + style = 0x00; + colorBackground[] = { 1 , 1 , 1 , 0 }; + colorText[] = { 1 , 1 , 1 , 1 }; + font = "Zeppelin32"; + sizeEx = 0.025; + h = 0.25; + text = ""; +}; + +class ZSC_RscListNBox +{ + style = 16; + type = 102; + shadow = 0; + font = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + color[] = {0.95,0.95,0.95,1}; + colorText[] = {1,1,1,1.0}; + colorDisabled[] = {1,1,1,0.25}; + colorScrollbar[] = {0.95,0.95,0.95,1}; + colorSelect[] = {0,0,0,1}; + colorSelect2[] = {0,0,0,1}; + colorSelectBackground[] = {0.95,0.95,0.95,1}; + colorSelectBackground2[] = {1,1,1,0.5}; + period = 1.2; + class ListScrollBar: ZSC_RscScrollBar{}; + class ScrollBar: ZSC_RscScrollBar{}; +}; + +class ZSC_RscText { + x = 0; + y = 0; + h = 0.037; + w = 0.3; + type = 0; + style = 0; + shadow = 1; + colorShadow[] = {0, 0, 0, 0.5}; + font = "Zeppelin32"; + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + text = ""; + colorText[] = {1, 1, 1, 1.0}; + colorBackground[] = {0, 0, 0, 0}; + linespacing = 1; + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; +}; + +class ZSC_RscLine : ZSC_RscText { + idc = -1; + style = 176; + x = 0.17; + y = 0.48; + w = 0.66; + h = 0; + text = ""; + colorBackground[] = {0, 0, 0, 0}; + colorText[] = {1, 1, 1, 1.0}; +}; + +class ZSC_RscTree { + style = 2; + font = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; + rowHeight = 0.0439091; + color[] = {1, 1, 1, 1}; + colorSelect[] = {0.7, 0.7, 0.7, 1}; + colorBackground[] = {0, 0, 0, 0}; + colorSelectBackground[] = {0, 0, 0, 0.5}; + colorBorder[] = {0, 0, 0, 0}; + borderSize = 0; +}; + +class ZSC_RscTitle : ZSC_RscText { + style = 0; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + colorText[] = {0.95, 0.95, 0.95, 1}; +}; + +class ZSC_RscPicture { + shadow = 0; + type = 0; + style = 48; + sizeEx = 0.023; + font = "Zeppelin32"; + colorBackground[] = {}; + colorText[] = {}; + x = 0; + y = 0; + w = 0.2; + h = 0.15; + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; +}; + +class ZSC_RscTextMulti : ZSC_RscText +{ + linespacing = 1; + style = 0 + 16 + 0x200; +}; + +class ZSC_RscPictureKeepAspect : ZSC_RscPicture +{ + style = 0x30 + 0x800; +}; + +class ZSC_RscStructuredText { + type = 13; + style = 0; + x = 0; + y = 0; + h = 0.035; + w = 0.1; + text = ""; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + colorText[] = {1, 1, 1, 1.0}; + shadow = 1; + class Attributes { + font = "Zeppelin32"; + color = "#ffffff"; + align = "left"; + shadow = 1; + }; +}; + +class ZSC_RscActiveText { + idc = -1; + type = 11; + style = 0; + x = 0; + y = 0; + h = 0.037; + w = 0.3; + sizeEx = 0.040; + font = "Zeppelin32"; + color[] = {1, 1, 1, 1}; + colorActive[] = {1, 0.2, 0.2, 1}; + action = ""; + text = ""; + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; +}; + +class ZSC_RscButton +{ + style = 2; + x = 0; + y = 0; + w = 0.095589; + h = 0.039216; + shadow = 2; + font = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + colorText[] = {1,1,1,1.0}; + colorDisabled[] = {0.4,0.4,0.4,1}; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",0.7}; + colorBackgroundActive[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorBackgroundDisabled[] = {0.95,0.95,0.95,1}; + offsetX = 0.003; + offsetY = 0.003; + offsetPressedX = 0.002; + offsetPressedY = 0.002; + colorFocused[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorShadow[] = {0,0,0,1}; + colorBorder[] = {0,0,0,1}; + borderSize = 0.0; + soundPush[] = { "", 0, 1 }; + soundEnter[] = { "", 0, 1 }; + soundClick[] ={ "", 0, 1 }; + soundEscape[] ={ "", 0, 1 }; + sound[] ={ "", 0, 1 }; +}; + +class ZSC_RscButtonTextOnly : ZSC_RscButton { + SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; + colorBackground[] = {1, 1, 1, 0}; + colorBackgroundActive[] = {1, 1, 1, 0}; + colorBackgroundDisabled[] = {1, 1, 1, 0}; + colorFocused[] = {1, 1, 1, 0}; + colorShadow[] = {1, 1, 1, 0}; + borderSize = 0.0; +}; + +class ZSC_RscShortcutButton { + idc = -1; + style = 0; + default = 0; + shadow = 1; + w = 0.183825; + h = "((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)"; + color[] = {1,1,1,1.0}; + colorFocused[] = {1,1,1,1.0}; + color2[] = {0.95,0.95,0.95,1}; + colorDisabled[] = {1,1,1,0.25}; + colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorBackgroundFocused[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])",1}; + colorBackground2[] = {1,1,1,1}; + periodFocus = 1.2; + periodOver = 0.8; + class HitZone + { + left = 0.0; + top = 0.0; + right = 0.0; + bottom = 0.0; + }; + class ShortcutPos + { + left = 0; + top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)"; + h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + }; + class TextPos + { + left = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)"; + top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + right = 0.005; + bottom = 0.0; + }; + period = 0.4; + font = "Zeppelin32"; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + text = ""; + action = ""; + class Attributes + { + font = "Zeppelin32"; + color = "#E5E5E5"; + align = "left"; + shadow = "true"; + }; + class AttributesImage + { + font = "Zeppelin32"; + color = "#E5E5E5"; + align = "left"; + }; + soundPush[] = { "", 0, 1 }; + soundEnter[] = { "", 0, 1 }; + soundClick[] = { "", 0, 1 }; + soundEscape[] = { "", 0, 1 }; + sound[] = { "", 0, 1 }; +}; + +class ZSC_RscButtonMenu : ZSC_RscShortcutButton { + idc = -1; + type = 16; + style = "0x02 + 0xC0"; + default = 0; + shadow = 0; + x = 0; + y = 0; + w = 0.095589; + h = 0.039216; + animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; + animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; + animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; + colorBackground[] = {0,0,0,0.8}; + colorBackgroundFocused[] = {1,1,1,1}; + colorBackground2[] = {0.75,0.75,0.75,1}; + color[] = {1,1,1,1}; + colorFocused[] = {0,0,0,1}; + color2[] = {0,0,0,1}; + colorText[] = {1,1,1,1}; + colorDisabled[] = {1,1,1,0.25}; + period = 1.2; + periodFocus = 1.2; + periodOver = 1.2; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; + class TextPos + { + left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)"; + top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; + right = 0.005; + bottom = 0.0; + }; + class Attributes + { + font = "Zeppelin32"; + color = "#E5E5E5"; + align = "left"; + shadow = "false"; + }; + class ShortcutPos + { + left = "(6.25 * (((safezoneW / safezoneH) min 1.2) / 40)) - 0.0225 - 0.005"; + top = 0.005; + w = 0.0225; + h = 0.03; + }; + textureNoShortcut = ""; +}; + +class ZSC_RscShortcutButtonMain : ZSC_RscShortcutButton { + idc = -1; + style = 0; + default = 0; + w = 0.313726; + h = 0.104575; + color[] = {1, 1, 1, 1.0}; + colorDisabled[] = {1, 1, 1, 0.25}; + class HitZone { + left = 0.0; + top = 0.0; + right = 0.0; + bottom = 0.0; + }; + class ShortcutPos { + left = 0.0145; + top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)) / 2"; + w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2) * (3/4)"; + h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; + }; + class TextPos { + left = "(((safezoneW / safezoneH) min 1.2) / 32) * 1.5"; + top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)*2 - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)) / 2"; + right = 0.005; + bottom = 0.0; + }; + period = 0.5; + font = "Zeppelin32"; + size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; + text = ""; + action = ""; + class Attributes { + font = "Zeppelin32"; + color = "#E5E5E5"; + align = "left"; + shadow = "false"; + }; + class AttributesImage { + font = "Zeppelin32"; + color = "#E5E5E5"; + align = "false"; + }; +}; + +class ZSC_RscCheckbox { + idc = -1; + type = 7; + style = 0; + x = "LINE_X(XVAL)"; + y = LINE_Y; + w = "LINE_W(WVAL)"; + h = 0.029412; + colorText[] = {1, 0, 0, 1}; + color[] = {0, 0, 0, 0}; + colorBackground[] = {0, 0, 1, 1}; + colorTextSelect[] = {0, 0.8, 0, 1}; + colorSelectedBg[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 1}; + colorSelect[] = {0, 0, 0, 1}; + colorTextDisable[] = {0.4, 0.4, 0.4, 1}; + colorDisable[] = {0.4, 0.4, 0.4, 1}; + font = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; + rows = 1; + 5ns = 1; + strings[] = {UNCHECKED}; + checked_strings[] = {CHECKED}; + soundPush[] = { "", 0, 1 }; + soundEnter[] = { "", 0, 1 }; + soundClick[] ={ "", 0, 1 }; + soundEscape[] ={ "", 0, 1 }; + sound[] ={ "", 0, 1 }; +}; + +class ZSC_RscProgress +{ + type = 8; + style = 0; + x = 0.344; + y = 0.619; + w = 0.313726; + h = 0.0261438; + texture = ""; + shadow = 2; + colorFrame[] = {0, 0, 0, 1}; + colorBackground[] = {0,0,0,0.7}; + colorBar[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.7])"}; +}; + +class ZSC_RscListBox +{ + style = 16; + idc = -1; + type = 5; + w = 0.275; + h = 0.04; + font = "Zeppelin32"; + colorSelect[] = {1, 1, 1, 1}; + colorText[] = {1, 1, 1, 1}; + colorBackground[] = {0.28,0.28,0.28,0.28}; + colorSelect2[] = {1, 1, 1, 1}; + colorSelectBackground[] = {0.95, 0.95, 0.95, 0.5}; + colorSelectBackground2[] = {1, 1, 1, 0.5}; + colorScrollbar[] = {0.2, 0.2, 0.2, 1}; + wholeHeight = 0.45; + rowHeight = 0.04; + color[] = {0.7, 0.7, 0.7, 1}; + colorActive[] = {0,0,0,1}; + colorDisabled[] = {0,0,0,0.3}; + sizeEx = 0.023; + maxHistoryDelay = 1; + autoScrollSpeed = -1; + autoScrollDelay = 5; + autoScrollRewind = 0; + tooltipColorText[] = {1,1,1,1}; + tooltipColorBox[] = {1,1,1,1}; + tooltipColorShade[] = {0,0,0,0.65}; + class ListScrollBar: ZSC_RscScrollBar + { + color[] = {1,1,1,1}; + autoScrollEnabled = 1; + }; + soundPush[] = { "", 0, 1 }; + soundEnter[] = { "", 0, 1 }; + soundClick[] ={ "", 0, 1 }; + soundEscape[] ={ "", 0, 1 }; + sound[] ={ "", 0, 1 }; +}; + +class ZSC_RscEdit { + type = 2; + style = 0x00 + 0x40; + font = "Zeppelin32"; + shadow = 2; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + colorBackground[] = {0, 0, 0, 1}; + colorText[] = {0.95, 0.95, 0.95, 1}; + colorDisabled[] = {1, 1, 1, 0.25}; + autocomplete = false; + colorSelection[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 1}; + canModify = 1; + soundPush[] = { "", 0, 1 }; + soundEnter[] = { "", 0, 1 }; + soundClick[] ={ "", 0, 1 }; + soundEscape[] ={ "", 0, 1 }; + sound[] ={ "", 0, 1 }; +}; + +class ZSC_RscSlider { + h = 0.025; + color[] = {1, 1, 1, 0.8}; + colorActive[] = {1, 1, 1, 1}; +}; + +class ZSC_RscXSliderH +{ + style = 1024; + type = 43; + shadow = 2; + x = 0; + y = 0; + h = 0.029412; + w = 0.400000; + color[] = { + 1, 1, 1, 0.7 + }; + colorActive[] = { + 1, 1, 1, 1 + }; + colorDisabled[] = { + 1, 1, 1, 0.500000 + }; +}; + +class ZSC_RscFrame { + type = 0; + idc = -1; + style = 64; + shadow = 2; + colorBackground[] = {0, 0, 0, 0}; + colorText[] = {1, 1, 1, 1}; + font = "Zeppelin32"; + sizeEx = 0.02; + text = ""; +}; + +class ZSC_RscBackground : ZSC_RscText { + type = 0; + IDC = -1; + style = 512; + shadow = 0; + x = 0.0; + y = 0.0; + w = 1.0; + h = 1.0; + text = ""; + ColorBackground[] = {0.48, 0.5, 0.35, 1}; + ColorText[] = {0.1, 0.1, 0.1, 1}; + font = "Zeppelin32"; + SizeEx = 1; +}; + +class ZSC_RscHTML { + colorText[] = {1, 1, 1, 1.0}; + colorBold[] = {1, 1, 1, 1.0}; + colorLink[] = {1, 1, 1, 0.75}; + colorLinkActive[] = {1, 1, 1, 1.0}; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + shadow = 2; + class H1 { + font = "Zeppelin32"; + fontBold = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; + align = "left"; + }; + class H2 { + font = "Zeppelin32"; + fontBold = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + align = "right"; + }; + class H3 { + font = "Zeppelin32"; + fontBold = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + align = "left"; + }; + class H4 { + font = "Zeppelin32"; + fontBold = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + align = "left"; + }; + class H5 { + font = "Zeppelin32"; + fontBold = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + align = "left"; + }; + class H6 { + font = "Zeppelin32"; + fontBold = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + align = "left"; + }; + class P { + font = "Zeppelin32"; + fontBold = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + align = "left"; + }; +}; + +class ZSC_RscCombo { + style = 16; + type = 4; + x = 0; + y = 0; + w = 0.12; + h = 0.035; + shadow = 0; + colorSelect[] = {0, 0, 0, 1}; + colorText[] = {0.95, 0.95, 0.95, 1}; + maxHistoryDelay = 1; + colorBackground[] = {0.4,0.4,0.4,0.4}; + colorSelectBackground[] = {1, 1, 1, 0.7}; + colow_Rscrollbar[] = {1, 0, 0, 1}; + wholeHeight = 0.45; + color[] = {1, 1, 1, 1}; + colorActive[] = {1, 0, 0, 1}; + colorDisabled[] = {1, 1, 1, 0.25}; + font = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; + class ComboScrollBar : ZSC_RscScrollBar {}; +}; + +class ZSC_RscToolbox { + colorText[] = {0.95, 0.95, 0.95, 1}; + color[] = {0.95, 0.95, 0.95, 1}; + colorTextSelect[] = {0.95, 0.95, 0.95, 1}; + colorSelect[] = {0.95, 0.95, 0.95, 1}; + colorTextDisable[] = {0.4, 0.4, 0.4, 1}; + colorDisable[] = {0.4, 0.4, 0.4, 1}; + colorSelectedBg[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.3843])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.7019])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.8862])", 0.5}; + font = "Zeppelin32"; + sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; +}; \ No newline at end of file diff --git a/SQF/dayz_code/Configs/RscDisplay/advancedTrading.hpp b/SQF/dayz_code/Configs/RscDisplay/advancedTrading.hpp new file mode 100644 index 000000000..aa31f460a --- /dev/null +++ b/SQF/dayz_code/Configs/RscDisplay/advancedTrading.hpp @@ -0,0 +1,501 @@ +class AT_Zupa_BlueButton: ZSC_RscButtonMenu { + colorBackground[] = {0.2,0.75,1,1}; + colorText[] = {1,1,1,1}; + class Attributes + { + align = "center"; + }; +}; + +class AdvancedTrading +{ + idd = 711197; + onLoad = "uiNamespace setVariable ['AdvancedTrading', _this select 0]"; + class Controls { + class RscText_ATBackground1: ZSC_RscText + { + idc = -1; + x = 0.20 * safezoneW + safezoneX; + y = 0.15 * safezoneH + safezoneY; + w = 0.40 * safezoneW; + h = 0.70 * safezoneH; + colorBackground[] = {0.2,0.2,0.2,1}; + }; + class RscText_ATBackground2: ZSC_RscText + { + idc = -1; + x = 0.60 * safezoneW + safezoneX; + y = 0.15 * safezoneH + safezoneY; + w = 0.20 * safezoneW; + h = 0.70 * safezoneH; + colorBackground[] = {0.1,0.1,0.1,1}; + }; + class RscText_AT2: ZSC_RscText + { + idc = -1; + text = "Advanced Trading"; + x = 0.20 * safezoneW + safezoneX; + y = 0.15 * safezoneH + safezoneY; + w = 0.60 * safezoneW; + h = 0.04 * safezoneH; + colorBackground[] = {0.2,0.75,1,1}; + colorText[] = {1,1,1,1}; + }; + + class RscText_Zupa_1: ZSC_RscText + { + idc = 7408; + text = "Selling from gear."; + x = 0.21 * safezoneW + safezoneX; + y = 0.22 * safezoneH + safezoneY; + w = 0.38 * safezoneW; + h = 0.05 * safezoneH; + colorText[] = {1,1,1,1}; + }; + class ZSC_RscButtonMenu_Z1: AT_Zupa_BlueButton + { + idc = -1; + text = "Gear"; + x = 0.21 * safezoneW + safezoneX; + y = 0.26 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "[2] call Z_getContainer;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_Z2: AT_Zupa_BlueButton + { + idc = -1; + text = "Backpack"; + x = 0.31 * safezoneW + safezoneX; + y = 0.26 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "[0] call Z_getContainer;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_Z3: AT_Zupa_BlueButton + { + idc = -1; + text = "Vehicle"; + x = 0.41 * safezoneW + safezoneX; + y = 0.26 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "[1] call Z_getContainer;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_Z4: AT_Zupa_BlueButton + { + idc = 7416; + text = "Sell"; + x = 0.51 * safezoneW + safezoneX; + y = 0.26 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "call Z_ChangeBuySell;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class RscText_AT6: ZSC_RscText + { + idc = 7412; + text = ""; + x = 0.21 * safezoneW + safezoneX; + y = 0.30 * safezoneH + safezoneY; + w = 0.30 * safezoneW; + h = 0.03 * safezoneH; + colorText[] = {1,1,1,1}; + }; + class RscText_AT7: ZSC_RscText + { + idc = 7413; + text = ""; + x = 0.21 * safezoneW + safezoneX; + y = 0.33 * safezoneH + safezoneY; + w = 0.30 * safezoneW; + h = 0.03 * safezoneH; + colorText[] = {1,1,1,1}; + }; + class RscText_AT8: ZSC_RscText + { + idc = -1; + text = "Inventory"; + x = 0.21 * safezoneW + safezoneX; + y = 0.38 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.03 * safezoneH; + colorText[] = {1,1,1,1}; + }; + class RscText_AT9: ZSC_RscText + { + idc = 7409; + text = "Selling"; + x = 0.46 * safezoneW + safezoneX; + y = 0.38 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.03 * safezoneH; + colorText[] = {1,1,1,1}; + }; + class RscBackgroundText_Zupa_1: ZSC_RscText + { + idc = -1; + text = ""; + x = 0.21* safezoneW + safezoneX; + y = 0.41 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.30 * safezoneH; + colorText[] = {1,1,1,1}; + colorBackground[] = {0.1,0.1,0.1,1}; + }; + class RscBackgroundText_Zupa_2: ZSC_RscText + { + idc = -1; + text = ""; + x = 0.46 * safezoneW + safezoneX; + y = 0.41* safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.30 * safezoneH; + colorText[] = {1,1,1,1}; + colorBackground[] = {0.1,0.1,0.1,1}; + }; + + class RscListbox_AT10: ZSC_RscListBox + { + idc = 7401; + type = 5; + idcLeft = -1; + idcRight = -1; + x = 0.21* safezoneW + safezoneX; + y = 0.41 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.30 * safezoneH; + soundSelect[] = {"",0.1,1}; + colorBackground[] = {0.1,0.1,0.1,0.8}; + onLBSelChanged = "['sellable',(lbCurSel 7401)] call Z_getItemInfo"; + class ListScrollBar: ZSC_RscScrollBar{}; + 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"; + }; + }; + class RscListbox_AT11: ZSC_RscListBox + { + idc = 7402; + x = 0.46 * safezoneW + safezoneX; + y = 0.41* safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.30 * safezoneH; + soundSelect[] = {"",0.1,1}; + colorBackground[] = {0.1,0.1,0.1,0.8}; + onLBSelChanged = "['selling',(lbCurSel 7402)] call Z_getItemInfo"; + class ListScrollBar: ZSC_RscScrollBar{}; + 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"; + }; + }; + class RscListbox_AT20: ZSC_RscListBox + { + idc = 7421; + type = 5; + idcLeft = -1; + idcRight = -1; + x = 0.21* safezoneW + safezoneX; + y = 0.41 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.30 * safezoneH; + soundSelect[] = {"",0.1,1}; + colorBackground[] = {0.1,0.1,0.1,0.8}; + onload = "ctrlShow [_this,false]"; + onLBSelChanged = "['buyable',(lbCurSel 7421)] call Z_getItemInfo"; + class ListScrollBar: ZSC_RscScrollBar{}; + 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"; + }; + }; + class RscListbox_AT21: ZSC_RscListBox + { + idc = 7422; + x = 0.46 * safezoneW + safezoneX; + y = 0.41* safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.30 * safezoneH; + soundSelect[] = {"",0.1,1}; + colorBackground[] = {0.1,0.1,0.1,0.8}; + onload = "ctrlShow [_this,false]"; + onLBSelChanged = "['buying',(lbCurSel 7422)] call Z_getItemInfo"; + 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"; + }; + }; + class RscSearchBackground: ZSC_RscText + { + idc = -1; + x = 0.21 * safezoneW + safezoneX; + y = 0.72 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.03 * safezoneH; + colorText[] = {1,1,1,1}; + colorBackground[] = {0.1,0.1,0.1,1}; + }; + class Zupa_Filter_Edit : ZSC_RscEdit { + idc = 7444; + colorText[] = {1,1,1,1}; + text = ""; + sizeEx = 0.030; + x = 0.21 * safezoneW + safezoneX; + y = 0.72 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.04; + }; + class ZSC_RscButtonMenu_ATTFilter: AT_Zupa_BlueButton + { + idc = -1; + text = "Filter"; + x = 0.21 * safezoneW + safezoneX; + y = 0.77 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + onButtonClick = "[(ctrlText 7444)] call Z_filterList;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_AT12: AT_Zupa_BlueButton + { + idc = 7430; + text = " > "; + x = 0.36 * safezoneW + safezoneX; + y = 0.41 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "[(lbCurSel 7401)] call Z_pushItemToList;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_AT14: AT_Zupa_BlueButton + { + idc = 7431; + text = " >> "; + x = 0.36 * safezoneW + safezoneX; + y = 0.49 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "call Z_pushAllToList;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_AT13: AT_Zupa_BlueButton + { + idc = 7432; + text = " < "; + x = 0.36 * safezoneW + safezoneX; + y = 0.57 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "[(lbCurSel 7402)] call Z_removeItemFromList;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_AT15: AT_Zupa_BlueButton + { + idc = 7433; + text = " << "; + x = 0.36 * safezoneW + safezoneX; + y = 0.65 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "call Z_removeAllToList;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_ATT1: AT_Zupa_BlueButton + + { + idc = 7440; + text = " > "; + x = 0.36 * safezoneW + safezoneX; + y = 0.41 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "[(lbCurSel 7421),(ctrlText 7441)] call Z_toBuyingList;"; + onload = "ctrlShow [_this,false]"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class Zupa_Ammount_Edit : ZSC_RscEdit { + idc = 7441; + colorText[] = {1,1,1,1}; + text = "1"; + sizeEx = 0.030; + x = 0.36 * safezoneW + safezoneX; + y = 0.49 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + h = 0.03; + onload = "ctrlShow [_this,false]"; + }; + class ZSC_RscButtonMenu_ATT3: AT_Zupa_BlueButton + { + idc = 7442; + text = " < "; + x = 0.36 * safezoneW + safezoneX; + y = 0.57 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "[(lbCurSel 7422)] call Z_removeItemFromBuyingList;"; + onload = "ctrlShow [_this,false]"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_ATT4: AT_Zupa_BlueButton + { + idc = 7443; + text = " << "; + x = 0.36 * safezoneW + safezoneX; + y = 0.65 * safezoneH + safezoneY; + w = 0.08 * safezoneW; + onButtonClick = "call Z_removeAllFromBuyingList;"; + onload = "ctrlShow [_this,false]"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class RscText_ATT8: ZSC_RscText + { + idc = 7404; + text = "0/0/0"; + x = 0.45 * safezoneW + safezoneX; + y = 0.32 * safezoneH + safezoneY; + w = 0.15 * safezoneW; + h = 0.03 * safezoneH; + colorText[] = {1,1,1,1}; + onload = "ctrlShow [_this,false]"; + }; + class RscSearchBackground2: ZSC_RscText + { + idc = -1; + text = ""; + x = 0.46 * safezoneW + safezoneX; + y = 0.72 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.03 * safezoneH; + colorText[] = {1,1,1,1}; + colorBackground[] = {0.1,0.1,0.1,1}; + }; + class RscText_AT18: ZSC_RscText + { + idc = 7410; + text = "Nothing"; + x = 0.46 * safezoneW + safezoneX; + y = 0.72 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.03 * safezoneH; + colorText[] = {1,1,1,1}; + }; + class ZSC_RscButtonMenu_AT16: AT_Zupa_BlueButton + { + idc = 7435; + text = "Sell"; + x = 0.46 * safezoneW + safezoneX; + y = 0.77 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + onButtonClick = "call Z_SellItems;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_AT27: AT_Zupa_BlueButton + { + idc = 7436; + text = "Buy"; + x = 0.46 * safezoneW + safezoneX; + y = 0.77 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + onload = "ctrlShow [_this,false]"; + onButtonClick = "call Z_BuyItems;"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + }; + class ZSC_RscButtonMenu_AT28: AT_Zupa_BlueButton + { + idc = -1; + x = 0.63 * safezoneW + safezoneX; + y = 0.77 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 9000);"; + colorBackground[] = {1,1,1,1}; + color[] = {0,0,0,1}; + text = "Close"; + }; + class RscStrText_AT_PriceInfo: ZSC_RscStructuredText // todo + { + idc = 7451; + text = ""; + x = 0.46 * safezoneW + safezoneX; + y = 0.72 * safezoneH + safezoneY; + w = 0.13 * safezoneW; + h = 0.03 * safezoneH; + colorText[] = {1,1,1,1}; + }; + class RscText_AT_InfoLabel: ZSC_RscText + { + idc = -1; + text = " Item info"; + x = 0.60 * safezoneW + safezoneX; + y = 0.38 * safezoneH + safezoneY; + w = 0.20 * safezoneW; + h = 0.03 * safezoneH; + colorBackground[] = {0.2,0.75,1,1}; + colorText[] = {1,1,1,1}; + }; + class RscText_AT_BreakLine: ZSC_RscText + { + idc = -1; + x = 0.60 * safezoneW + safezoneX; + y = 0.15 * safezoneH + safezoneY; + w = 0.0005 * safezoneW; + h = 0.70 * safezoneH; + colorBackground[] = {0.2,0.75,1,1}; + }; + class RscStrText_AT_ItemInfo: ZSC_RscStructuredText + { + idc = 7445; + text = ""; + x = 0.61 * safezoneW + safezoneX; + y = 0.43 * safezoneH + safezoneY; + w = 0.19 * safezoneW; + h = 0.59 * safezoneH; + colorText[] = {1,1,1,1}; + }; + class RscStrText_AT_ContainerInfo: ZSC_RscStructuredText + { + idc = 7446; + text = ""; + x = 0.61 * safezoneW + safezoneX; + y = 0.24 * safezoneH + safezoneY; + w = 0.19 * safezoneW; + h = 0.35 * safezoneH; + colorText[] = {1,1,1,1}; + }; + }; +}; diff --git a/SQF/dayz_code/Configs/RscDisplay/tradermenu.hpp b/SQF/dayz_code/Configs/RscDisplay/tradermenu.hpp index 089075f89..3aba9d5d1 100644 --- a/SQF/dayz_code/Configs/RscDisplay/tradermenu.hpp +++ b/SQF/dayz_code/Configs/RscDisplay/tradermenu.hpp @@ -281,3 +281,7 @@ class TraderDialog }; }; }; + +//Include advanced trading dialogue +#include "ZSCdefines.hpp" +#include "advancedTrading.hpp" \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/config.sqf b/SQF/dayz_code/actions/AdvancedTrading/config.sqf new file mode 100644 index 000000000..6b13899a0 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/config.sqf @@ -0,0 +1,6 @@ +Z_AT_FolderLocation = '\z\addons\dayz_code\actions\AdvancedTrading'; +Z_VehicleDistance = 30; // Distance that a vehicle needs to be to see it's content or to sell it. +Z_SingleCurrency = false; // Does your server use a single currency system. +Z_AllowTakingMoneyFromBackpack = true; // When buying items with DEFAULT CURRENCY to any inventory. Do you allow the trader to take money from your backpack. +Z_AllowTakingMoneyFromVehicle = true; // When buying items with DEFAULT CURRENCY to any inventory. Do you allow the trader to take money from your vehicle. +Z_MoneyVariable = "cashMoney"; // If using a Single currency system, change this to whatever currency you are using. diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/KK_fnc_inString.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/KK_fnc_inString.sqf new file mode 100644 index 000000000..11162909b --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/KK_fnc_inString.sqf @@ -0,0 +1,30 @@ +/* +* Author: Killzone_Kid +* +* Description: +* Find a string within a string (case insensitive) +* +* Parameter(s): +* _this select 0: string to be found +* _this select 1: string to search in +* +* Returns: +* Boolean (true when string is found) +* +* How to use: +* _found = ["needle", "Needle in Haystack"] call KK_fnc_inString; +*/ +private ["_needle","_haystack","_needleLen","_hay","_found"]; +_needle = [_this, 0, "", [""]] call BIS_fnc_param; +_haystack = toArray ([_this, 1, "", [""]] call BIS_fnc_param); +_needleLen = count toArray _needle; +_hay = +_haystack; +_hay resize _needleLen; +_found = false; +for "_i" from _needleLen to count _haystack do { + if (toString _hay == _needle) exitWith {_found = true}; + _hay set [_needleLen, _haystack select _i]; + _hay set [0, "x"]; + _hay = _hay - ["x"] +}; +_found \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_addCoins.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_addCoins.sqf new file mode 100644 index 000000000..b1c32db98 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_addCoins.sqf @@ -0,0 +1,12 @@ +private ["_player","_amount","_wealth","_newwealth", "_result"]; +_player = _this select 0; +_amount = _this select 1; +_result = false; +_wealth = _player getVariable[Z_MoneyVariable,0]; +_player setVariable[Z_MoneyVariable,_wealth + _amount, true]; +PVDZE_plr_Save = [_player,(magazines _player),true,true] ; +publicVariableServer "PVDZE_plr_Save"; +_player setVariable ["moneychanged",1,true]; +_newwealth = _player getVariable[Z_MoneyVariable,0]; +if (_newwealth >= _wealth) then { _result = true; }; +_result diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_removeCoins.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_removeCoins.sqf new file mode 100644 index 000000000..5ddf6c2ce --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/SC_fnc_removeCoins.sqf @@ -0,0 +1,20 @@ +private ["_player","_amount","_wealth","_newwealth", "_result"]; +_player = _this select 0; +_amount = _this select 1; +_result = false; +_wealth = _player getVariable[Z_MoneyVariable,0]; +if(_amount > 0)then{ +if (_wealth < _amount) then { +_result = false; +} else { +_newwealth = _wealth - _amount; +_player setVariable[Z_MoneyVariable,_newwealth, true]; +_player setVariable ["moneychanged",1,true]; +_result = true; +PVDZE_plr_Save = [_player,(magazines _player),true,true] ; +publicVariableServer "PVDZE_plr_Save"; +}; +}else{ +_result = true; +}; +_result diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/defines.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/defines.sqf new file mode 100644 index 000000000..69ac61eef --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/defines.sqf @@ -0,0 +1,79 @@ +// #define Z_AT_DIALOGWINDOW 711197 +#define Z_AT_DIALOGWINDOW 711197 + +// #define Z_AT_SELLABLELIST 7401 +#define Z_AT_SELLABLELIST 7401 + +// #define Z_AT_SELLINGLIST 7402 +#define Z_AT_SELLINGLIST 7402 + +// #define Z_AT_BUYABLELIST 7421 +#define Z_AT_BUYABLELIST 7421 + +// #define Z_AT_BUYINGLIST 7422 +#define Z_AT_BUYINGLIST 7422 + +// #define Z_AT_CONTAINERINDICATOR 7408 +#define Z_AT_CONTAINERINDICATOR 7408 + +// #define Z_AT_ITEMINFO 7445 +#define Z_AT_ITEMINFO 7445 + +// #define Z_AT_SLOTSDISPLAY 7404 +#define Z_AT_SLOTSDISPLAY 7404 + +// #define Z_AT_TRADERLINE1 7412 +#define Z_AT_TRADERLINE1 7412 + +// #define Z_AT_TRADERLINE2 7413 +#define Z_AT_TRADERLINE2 7413 + +// #define Z_AT_PRICEDISPLAY 7410 +#define Z_AT_PRICEDISPLAY 7410 + +// #define Z_AT_SELLBUYTOGGLE 7416 +#define Z_AT_SELLBUYTOGGLE 7416 + +// #define Z_AT_RIGHTLISTTITLE 7409 +#define Z_AT_RIGHTLISTTITLE 7409 + +// #define Z_AT_REMOVESELLITEMBUTTON 7432 +#define Z_AT_REMOVESELLITEMBUTTON 7432 + +// #define Z_AT_REMOVEALLSELLITEMBUTTON 7433 +#define Z_AT_REMOVEALLSELLITEMBUTTON 7433 + +// #define Z_AT_REMOVEBUYITEMBUTTON 7432 +#define Z_AT_REMOVEBUYITEMBUTTON 7442 + +// #define Z_AT_REMOVEALLBUYITEMBUTTON 7433 +#define Z_AT_REMOVEALLBUYITEMBUTTON 7443 + +// #define Z_AT_BUYINGAMOUNT 7441 +#define Z_AT_BUYINGAMOUNT 7441 + +// #define Z_AT_BUYBUTTON 7436 +#define Z_AT_BUYBUTTON 7436 + +// #define Z_AT_SELLBUTTON 7435 +#define Z_AT_SELLBUTTON 7435 + +// #define Z_AT_ADDBUYITEMBUTTON 7440 +#define Z_AT_ADDBUYITEMBUTTON 7440 + +// #define Z_AT_ADDSELLITEMBUTTON 7430 +#define Z_AT_ADDSELLITEMBUTTON 7430 + +// #define Z_AT_ADDALLSELLITEMBUTTON 7431 +#define Z_AT_ADDALLSELLITEMBUTTON 7431 + +// #define Z_AT_TOGGLECURRENCYBUTTON 7450 +#define Z_AT_TOGGLECURRENCYBUTTON 7450 + +// #define Z_AT_CONTAINERINFO 7446 +#define Z_AT_CONTAINERINFO 7446 + +// #define Z_AT_PRICEINFO 7451 +#define Z_AT_PRICEINFO 7451 + +// diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf new file mode 100644 index 000000000..0f0ae95b5 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf @@ -0,0 +1,264 @@ +private ["_selection","_return","_toBuyWeaps","_toBuyMags","_toBuyBags","_toolsToBuy","_sidearmToBuy","_primaryToBuy","_currentPrimarys" +,"_currentSecondarys","_currentSec","_currentPrim","_currentTool","_p","_s","_b","_check0","_check1","_check2","_check3","_check4","_mags","_weaps","_bags" +,"_normalBags","_normalMags","_normalWeaps","_allowedMags","_allowedPrimary","_allowedTools","_allowedSidearm","_allowedWeapons","_allowedBackpacks" +,"_totalSpace","_totalNewSpace","_counter","_parentClasses","_alreadyInBackpack","_kinds","_kinds2","_kinds3","_ammmounts","_ammmounts2","_ammmounts3" +]; +_selection = Z_SellingFrom; +_return = false; +_toBuyWeaps = _this select 0; +_toBuyMags = _this select 1; +_toBuyBags = _this select 2; +_toolsToBuy = _this select 3; +_sidearmToBuy = _this select 4; +_primaryToBuy = _this select 5; +_vehiclesToBuy = _this select 6; + + +if(_selection == 2) then{ //gear + _allowedMags = 20 - count(magazines player); + + _currentPrimarys = 0; + + _p = primaryWeapon player; + if ( !isNil '_p' && _p != "" ) then { + _currentPrimarys = 1; + }; + + _allowedPrimary = 1 - _currentPrimarys; + + _currentSecondarys = 0; + + _s = secondaryWeapon player; + if ( !isNil '_s' && _s != "" ) then { + _currentSecondarys = 1; + }; + + _allowedSidearm = 1 - _currentSecondarys; + + _currentBackpacks = 0; + + _b = unitBackpack player; + if ( !isNull _b ) then { + _currentBackpacks = 1; + }; + + _allowedBackpacks = 1 - _currentBackpacks; + + _allowedTools = 12; + + { + _parentClasses = [(configFile >> "CfgWeapons" >> _x ),true] call BIS_fnc_returnParents; + if( 'ItemCore' in _parentClasses || 'Binocular' in _parentClasses) then { + _allowedTools = _allowedTools - 1; + } + }count (weapons player); + + _check1 = false; + _check2 = false; + _check3 = false; + + if( _allowedPrimary >= _primaryToBuy && _allowedSidearm >= _sidearmToBuy && _allowedTools >= _toolsToBuy)then{ + _check1 = true; + }else{ + systemChat format["You can only buy %1 primary, %2 sidearm and %3 tools in your gear.", _allowedPrimary, _allowedSidearm , _allowedTools]; + }; + if( _allowedMags >= _toBuyMags)then{ + _check2 = true; + }else{ + systemChat format["You can only buy %1 magazines in your gear.",_allowedMags]; + }; + if( _allowedBackpacks >= _toBuyBags)then{ + _check3 = true; + }else{ + systemChat format["You can only buy %1 backpacks in your gear.",_allowedBackpacks]; + }; + + if(_check1 && _check2 && _check3)then{ + _return = true; + }; + +}; +if(_selection == 1) then{ //vehicle + _allowedMags = 0; + _allowedWeapons = 0; + _allowedBackpacks = 0; + if ( !isNull Z_vehicle) then { + + _mags = getMagazineCargo Z_vehicle; + _weaps = getWeaponCargo Z_vehicle; + _bags = getBackpackCargo Z_vehicle; + + _normalMags = []; + _normalWeaps = []; + _normalBags = []; + + _kinds = _mags select 0; + _ammmounts = _mags select 1; + { + _counter = 0 ; + while{ _counter < ( _ammmounts select _forEachIndex)}do{ + _normalMags set [count(_normalMags),_x]; + _counter = _counter + 1; + }; + }forEach _kinds; + + _kinds2 = _weaps select 0; + _ammmounts2 = _weaps select 1; + { + _counter = 0 ; + while{ _counter < ( _ammmounts2 select _forEachIndex)}do{ + _normalWeaps set [count(_normalWeaps),_x]; + _counter = _counter + 1; + }; + }forEach _kinds2; + + _kinds3 = _bags select 0; + _ammmounts3 = _bags select 1; + { + _counter = 0 ; + while{ _counter < ( _ammmounts3 select _forEachIndex)}do{ + _normalBags set [count(_normalBags),_x]; + _counter = _counter + 1; + }; + }forEach _kinds3; + + + _allowedWeapons = getNumber (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'transportMaxWeapons') - count(_normalWeaps); + _allowedMags = getNumber (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'transportMaxMagazines') - count(_normalMags); + _allowedBackpacks = getNumber (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'transportMaxBackpacks ') - count(_normalBags); + }; + + _check1 = false; + _check2 = false; + _check3 = false; + + if( _allowedWeapons >= ( _toBuyWeaps + _toolsToBuy ) )then{ + _check1 = true; + }else{ + systemChat format["You can only buy %1 weapons in your vehicle.", _allowedWeapons]; + }; + if( _allowedMags >= _toBuyMags)then{ + _check2 = true; + }else{ + systemChat format["You can only buy %1 magazines in your vehicle.", _allowedMags]; + }; + if( _allowedBackpacks >= _toBuyBags)then{ + _check3 = true; + }else{ + systemChat format["You can only buy %1 backpacks in your vehicle.", _allowedBackpacks]; + }; + + if(_check1 && _check2 && _check3)then{ + _return = true; + }; +}; +if(_selection == 0) then{ //backpack + _allowedWeapons = 0; + _allowedMags = 0; + _allowedBackpacks = 0; + + _totalSpace = 0; + _totalNewSpace = 0; + + _backpack = unitBackpack player; + _check0 = false; + if (!isNull _backpack) then { + _check0 = true; + + _mags = getMagazineCargo _backpack; + _weaps = getWeaponCargo _backpack; + + _normalMags = []; + _normalWeaps = []; + + _kinds = _mags select 0; + _ammmounts = _mags select 1; + { + _counter = 0 ; + while{ _counter < ( _ammmounts select _forEachIndex)} do { + _normalMags set [count(_normalMags), _x]; + _counter = _counter + 1; + }; + }forEach _kinds; + + _kinds2 = _weaps select 0; + _ammmounts2 = _weaps select 1; + { + _counter = 0 ; + while{ _counter < ( _ammmounts2 select _forEachIndex)} do { + _normalWeaps set [count(_normalWeaps), _x]; + _counter = _counter + 1; + }; + }forEach _kinds2; + + _allowedWeapons = getNumber (configFile >> 'CfgVehicles' >> (typeOf _backpack) >> 'transportMaxWeapons') - count(_normalWeaps); + _allowedMags = getNumber (configFile >> 'CfgVehicles' >> (typeOf _backpack) >> 'transportMaxMagazines') - count(_normalMags); + + + + _currentPrim = 0; + _currentSec = 0; + _currentTool = 0; + + { + _parentClasses = [(configFile >> "CfgWeapons" >> _x ),true] call BIS_fnc_returnParents; + if( 'ItemCore' in _parentClasses || 'Binocular' in _parentClasses ) then { + _currentTool = _currentTool + 1; + } else { + if( 'PistolCore' in _parentClasses )then { + _currentSec = _currentSec + 1; + } else { + _currentPrim = _currentPrim + 1; + }; + }; + } count _normalWeaps; + + + _alreadyInBackpack = (10 * _currentPrim) + (5 * _currentSec) + _currentTool + count(_normalMags); + + _totalNewSpace = 10 * _primaryToBuy + 5 * _sidearmToBuy + _toolsToBuy + _toBuyMags; + + _totalSpace = _alreadyInBackpack + _totalNewSpace; + + }else { + systemChat format["You need a backpack.", _allowedMags]; + }; + + _check1 = false; + _check2 = false; + _check3 = false; + _check4 = false; + + if( _allowedWeapons >= _toBuyWeaps)then{ + _check1 = true; + } else { + systemChat format["Only %1 weapons fit in the backpack.", _allowedMags]; + }; + if( _allowedMags >= _toBuyMags)then{ + _check2 = true; + } else { + systemChat format["Only %1 mags fit in the backpack." , _allowedWeapons]; + }; + if( _allowedBackpacks >= _toBuyBags)then{ + _check3 = true; + } else { + systemChat format["Only %1 bags fit in the backpack." , _allowedBackpacks ]; + }; + + if( _totalSpace <= _allowedMags)then{ + _check4 = true; + }else{ + systemChat format["Total space succeeded: Mag=1, Tool=1, Side=5, Primary=10 slots and your bag capacity is %1 where you tried %2 slots.", _allowedMags, _totalNewSpace]; + }; + + if(_check0 && _check1 && _check2 && _check3 && _check4)then{ + _return = true; + }; +}; + +if(_vehiclesToBuy != 0)then{ + _return = false; + systemChat "You can NOT buy vehicles in this version"; +}; + +_return diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf new file mode 100644 index 000000000..927a10cc1 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_buyItems.sqf @@ -0,0 +1,181 @@ +private ["_magazinesToBuy", "_weaponsToBuy", "_backpacksToBuy", "_toolsToBuy", "_sidearmToBuy", "_primaryToBuy", "_priceToBuy" +,"_enoughMoney", "_myMoney", "_canBuy", "_moneyInfo","_count","_success","_backpack" +]; + +_magazinesToBuy = 0; +_weaponsToBuy = 0; +_backpacksToBuy = 0; +_toolsToBuy = 0; +_sidearmToBuy = 0; +_primaryToBuy = 0; +_vehiclesToBuy = 0; + +_priceToBuy = 0; + +if (Z_SingleCurrency) then { + { + if( _x select 1 == "trade_weapons")then{ + _parentClasses = [(configFile >> "CfgWeapons" >> (_x select 0)),true] call BIS_fnc_returnParents; + if( 'ItemCore' in _parentClasses || 'Binocular' in _parentClasses) then { + _toolsToBuy = _toolsToBuy + (_x select 9); + } else { + _weaponsToBuy = _weaponsToBuy + (_x select 9); + if('PistolCore' in _parentClasses)then { + _sidearmToBuy = _sidearmToBuy + (_x select 9); + } else { + _primaryToBuy = _primaryToBuy + (_x select 9); // _ammount + }; + }; + _priceToBuy = _priceToBuy + ((_x select 9)*(_x select 2)); + }; + if( _x select 1 == "trade_items")then{ + _magazinesToBuy = _magazinesToBuy + (_x select 9) ; + _priceToBuy = _priceToBuy + ((_x select 9)*(_x select 2)); + }; + if( _x select 1 == "trade_backpacks")then{ + _backpacksToBuy = _backpacksToBuy + (_x select 9) ; + _priceToBuy = _priceToBuy + ((_x select 9)*(_x select 2)); // _price * _amount + }; + if( _x select 1 == "trade_any_vehicle")then{ + _vehiclesToBuy = _vehiclesToBuy + (_x select 9) ; + _priceToBuy = _priceToBuy + ((_x select 9)*(_x select 2)); // _price * _amount + }; + } count Z_BuyingArray; +} else { + { + if( _x select 1 == "trade_weapons")then{ + _parentClasses = [(configFile >> "CfgWeapons" >> (_x select 0)),true] call BIS_fnc_returnParents; + if( 'ItemCore' in _parentClasses || 'Binocular' in _parentClasses) then { + _toolsToBuy = _toolsToBuy + (_x select 9); + } else { + _weaponsToBuy = _weaponsToBuy + (_x select 9); + if('PistolCore' in _parentClasses)then { + _sidearmToBuy = _sidearmToBuy + (_x select 9); + } else { + _primaryToBuy = _primaryToBuy + (_x select 9); + }; + }; + _priceToBuy = _priceToBuy + ((_x select 11)*(_x select 2)*(_x select 9)); // _worth * _price * _amount + }; + if( _x select 1 == "trade_items")then{ + _magazinesToBuy = _magazinesToBuy + (_x select 9) ; + _priceToBuy = _priceToBuy + ((_x select 11) *(_x select 2)*(_x select 9)); + }; + if( _x select 1 == "trade_backpacks")then{ + _backpacksToBuy = _backpacksToBuy + (_x select 9) ; + _priceToBuy = _priceToBuy + ((_x select 11)*(_x select 2)*(_x select 9)); + }; + if( _x select 1 == "trade_any_vehicle")then{ + _vehiclesToBuy = _vehiclesToBuy + (_x select 9) ; + _priceToBuy = _priceToBuy + ((_x select 11)*(_x select 2)*(_x select 9)); + }; + } count Z_BuyingArray; +}; + +_canBuy = [_weaponsToBuy,_magazinesToBuy,_backpacksToBuy,_toolsToBuy, _sidearmToBuy, _primaryToBuy,_vehiclesToBuy] call Z_allowBuying; + +_myMoney = player getVariable[Z_MoneyVariable,0]; + +_enoughMoney = false; + +_moneyInfo = [false, [], [], [], 0]; + +if (Z_SingleCurrency) then { + if (_myMoney >= _priceToBuy) then { + _enoughMoney = true; + } else { + _enoughMoney = false; + }; +} else { + _moneyInfo = _priceToBuy call Z_canAfford; + _enoughMoney = _moneyInfo select 0; +}; + +if(_enoughMoney) then { + if(_canBuy) then { + systemChat format["Starting trade."]; + + closeDialog 2; + + if(Z_SellingFrom == 0) then { //backpack + _backpack = unitBackpack player; + systemChat format["Adding %1 items in backpack",count (Z_BuyingArray)]; + { + if( _x select 1 == "trade_weapons")then{ + _backpack addWeaponCargoGlobal [_x select 0, _x select 9]; + diag_log format ["%1 x %2 added", _x select 0, _x select 9]; + }; + if( _x select 1 == "trade_items")then{ + _backpack addMagazineCargoGlobal [_x select 0, _x select 9]; + diag_log format ["%1 x %2 added", _x select 0, _x select 9]; + }; + } count Z_BuyingArray; + }; + + if(Z_SellingFrom == 1)then{ //vehicle + { + systemChat format["Adding %1 items in %2",count (Z_BuyingArray), typeOf Z_vehicle]; + if( _x select 1 == "trade_weapons")then{ + Z_vehicle addWeaponCargoGlobal [_x select 0, _x select 9]; + diag_log format ["%1 x %2 added", _x select 0, _x select 9]; + }; + if( _x select 1 == "trade_items")then{ + Z_vehicle addMagazineCargoGlobal [_x select 0, _x select 9]; + diag_log format ["%1 x %2 added", _x select 0, _x select 9]; + }; + if( _x select 1 == "trade_backpacks")then{ + Z_vehicle addBackpackCargoGlobal [_x select 0, _x select 9]; + diag_log format ["%1 x %2 added", _x select 0, _x select 9]; + }; + } count Z_BuyingArray; + }; + + if(Z_SellingFrom == 2)then{ //gear + systemChat format["Adding %1 items in gear",count (Z_BuyingArray)]; + { + if( _x select 1 == "trade_weapons") then { + _count = 0; + while{ _count < (_x select 9)}do{ + player addWeapon (_x select 0); + diag_log format ["%1 added", _x select 0]; + _count = _count + 1; + }; + }; + if( _x select 1 == "trade_items" ) then { + _count = 0; + while{ _count < (_x select 9)} do { + player addMagazine (_x select 0); + diag_log format ["%1 added", _x select 0]; + _count = _count + 1; + }; + }; + if( _x select 1 == "trade_backpacks")then{ + player addBackpack (_x select 0); + }; + } count Z_BuyingArray; + }; + if (!Z_SingleCurrency) then { + _success = [player,_priceToBuy, _moneyInfo] call Z_payDefault; + if (_success) then { + systemChat format["Trade successfull, payed %1 worth of items.", _priceToBuy]; + } else { + systemchat "DEBUG: Something went wrong in the pay process. Please report this issue."; + }; + } else { + _success = [player,_priceToBuy] call SC_fnc_removeCoins; + if (_success) then { + systemChat format["Trade successfull, payed %1 %2.", _priceToBuy, CurrencyName]; + } else { + systemchat "DEBUG: Something went wrong in the pay process. Please report this issue."; + }; + }; + } else { + systemChat "You could not buy these items because the container lacks space to hold them."; + }; +}else{ + if( Z_SingleCurrency) then { + systemChat format["You need %1 %2 to buy all these items.",_priceToBuy,CurrencyName]; + } else { + systemChat format["You need more money to buy all these items."]; + }; +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf new file mode 100644 index 000000000..a59ff7b87 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcBuyableList.sqf @@ -0,0 +1,56 @@ +private ["_arrayOfTraderCat","_counter","_cat","_cfgtraders","_y","_type","_buy","_sell","_pic","_text","_worth","_buyCurrency","_sellCurrency"]; +call Z_clearBuyList; +call Z_clearBuyingList; +Z_BuyableArray = []; +Z_BuyingArray = []; +_arrayOfTraderCat = Z_traderData; +_counter = 0; +{ + _cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)]; + _cfgtraders = missionConfigFile >> "CfgTraderCategory" >> _cat; + for "_i" from 0 to (count _cfgtraders) - 1 do + { + _y = _cfgtraders select _i; + if (isClass _y) then + { + _y = configName (_y ); + _type = getText(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "type"); + _buy = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "buy"); + _sell = getArray(missionConfigFile >> "CfgTraderCategory" >> _cat >> _y >> "sell"); + _pic = ""; + _text = ""; + _buyCurrency = ""; + _sellCurrency = ""; + _worth = 0; + + if(_type == "trade_items")then{ + _pic = getText (configFile >> 'CfgMagazines' >> _y >> 'picture'); + _text = getText (configFile >> 'CfgMagazines' >> _y >> 'displayName'); + }; + if(_type == "trade_weapons")then{ + _pic = getText (configFile >> 'CfgWeapons' >> _y >> 'picture'); + _text = getText (configFile >> 'CfgWeapons' >> _y >> 'displayName'); + }; + if(_type == "trade_any_vehicle" || _type == "trade_backpacks")then{ + _pic = getText (configFile >> 'CfgVehicles' >> _y >> 'picture'); + _text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName'); + }; + + if(!Z_SingleCurrency) then { + _buyCurrency = _buy select 1; + _sellCurrency = _sell select 1, + _part = (configFile >> "CfgMagazines" >> _buyCurrency); + _worth = getNumber(_part >> "worth"); + }else{ + _buyCurrency = CurrencyName; + _sellCurrency = CurrencyName; + }; + + Z_BuyableArray set [count(Z_BuyableArray) , [_y,_type,_buy select 0,_text,_pic,_forEachIndex,_sell select 0, _buyCurrency, _sellCurrency, 0,_cat, _worth]]; + }; + }; +}forEach _arrayOfTraderCat; + +Z_OriginalBuyableArray = [] + Z_BuyableArray; +call Z_fillBuyableList; +call Z_calcPrice; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrency.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrency.sqf new file mode 100644 index 000000000..4af9aa788 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcDefaultCurrency.sqf @@ -0,0 +1,47 @@ +private["_worth","_string","_briefcase_100oz","_gold_10oz_a","_gold_10oz_b","_gold_10oz","_gold_1oz","_gold_1oz_b","_gold_1oz_a","_silver_10oz","_silver_10oz_a","_silver_10oz_b" +,"_silver_1oz","_silver_1oz_a","_silver_10oz_b","_pic","_string" +]; +_total = _this; +_string = ""; + +_briefcase_100oz = floor(_total / 10000); + +_gold_10oz_a = floor(_total / 1000); +_gold_10oz_b = _briefcase_100oz * 10; +_gold_10oz = (_gold_10oz_a - _gold_10oz_b); + +_gold_1oz_a = floor(_total / 100); +_gold_1oz_b = _gold_10oz_a * 10; +_gold_1oz = (_gold_1oz_a - _gold_1oz_b); + +_silver_10oz_a = floor(_total / 10); +_silver_10oz_b = _gold_1oz_a * 10; +_silver_10oz = (_silver_10oz_a - _silver_10oz_b); + +_silver_1oz_a = floor(_total); +_silver_1oz_b = _silver_10oz_a * 10; +_silver_1oz = (_silver_1oz_a - _silver_1oz_b); + + +if (_briefcase_100oz > 0) then { + _pic = getText (configFile >> 'CfgMagazines' >> 'ItemBriefcase100oz' >> 'picture'); + _string = format["%1x",_briefcase_100oz,_pic]; +}; +if (_gold_10oz > 0) then { + _pic = getText (configFile >> 'CfgMagazines' >> 'ItemGoldBar10oz' >> 'picture'); + _string = format["%3%1x",_gold_10oz,_pic, _string]; +}; +if (_gold_1oz > 0) then { + _pic = getText (configFile >> 'CfgMagazines' >> 'ItemGoldBar' >> 'picture'); + _string = format["%3%1x",_gold_1oz,_pic, _string]; +}; +if (_silver_10oz > 0) then { + _pic = getText (configFile >> 'CfgMagazines' >> 'ItemSilverBar10oz' >> 'picture'); + _string = format["%3%1x",_silver_10oz,_pic, _string]; +}; +if (_silver_1oz > 0) then { + _pic = getText (configFile >> 'CfgMagazines' >> 'ItemSilverBar' >> 'picture'); + _string = format["%3%1x",_silver_1oz,_pic, _string]; +}; + +_string diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcPrice.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcPrice.sqf new file mode 100644 index 000000000..46530b9ff --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calcPrice.sqf @@ -0,0 +1,41 @@ +/** +* call Z_calcPrice +* +* Calculate the total price for single currency. +**/ +private ["_sellPrice","_ctrltext"]; +#include "defines.sqf"; + +_sellPrice = 0; + +if(Z_SingleCurrency) then { + _ctrltext = ''; + if(Z_Selling)then{ + { + _sellPrice = _sellPrice + (_x select 2); + }count Z_SellArray; + _ctrltext = format["%1 %2", _sellPrice , CurrencyName]; + } else { + { + _sellPrice = _sellPrice + ((_x select 2) * (_x select 9)); + }count Z_BuyingArray; + _ctrltext = format["%1 %2", _sellPrice , CurrencyName]; + }; + ctrlSetText [Z_AT_PRICEDISPLAY, _ctrltext]; + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_PRICEINFO) ctrlSetStructuredText parseText ''; +} else { + if(Z_Selling)then { + _ctrltext = ""; + { + _sellPrice = _sellPrice + ((_x select 2) * (_x select 11)); + }count Z_SellArray; + _ctrltext = _sellPrice call Z_calcDefaultCurrency; + } else { + { + _sellPrice = _sellPrice + ((_x select 2) * (_x select 11) * (_x select 9)); + }count Z_BuyingArray; + _ctrltext = _sellPrice call Z_calcDefaultCurrency; + }; + ctrlSetText [Z_AT_PRICEDISPLAY, '']; + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_PRICEINFO) ctrlSetStructuredText parseText _ctrltext; +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf new file mode 100644 index 000000000..e7584d1bc --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf @@ -0,0 +1,108 @@ +private["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBackpacks","_allowedTools","_allowedPrimary","_allowedSidearm","_formattedText","_pic" +,"_backpack","_backpackAmount","_vehicleWeapons","_vehicleMagazines","_vehicleBackpacks","_tempWeaponsArray","_tempBackpackArray","_tempMagazinesArray"]; +#include "defines.sqf"; + +_selection = _this select 0; +_returnArray = [0,0,0]; +if(_selection == 2) then{ //gear + _allowedMags = 20 - count(magazines player); + _allowedWeapons = 14 - count(weapons player); + + _pic = getText (configFile >> 'CfgVehicles' >> (typeOf player) >> 'picture'); + + _formattedText = format [ + "" + , _pic + ]; + + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText; + + _backpack = unitBackpack player; + _backpackAmount = 0; + if (!isNil "_backpack") then { + _backpackAmount = 1; + }; + + _allowedBackpacks = 1 - _backpackAmount; + _returnArray = [_allowedMags, _allowedWeapons, _allowedBackpacks]; +}; +if(_selection == 1) then{ //vehicle + _allowedMags = 0; + _allowedWeapons = 0; + _allowedBackpacks = 0; + _vehicleMagazines = 0; + _vehicleWeapons = 0; + _vehicleBackpacks = 0; + if (!isNull Z_vehicle) then { + + _pic = getText (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'picture'); + + _formattedText = format [ + "" + , _pic + ]; + + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText; + + _tempMagazinesArray = getMagazineCargo Z_vehicle; + + { + _vehicleMagazines = _vehicleMagazines + _x; + }count ( _tempMagazinesArray select 1); + + + _tempWeaponsArray = getWeaponCargo Z_vehicle; + + { + _vehicleWeapons = _vehicleWeapons + _x; + }count ( _tempWeaponsArray select 1); + + + _tempBackpackArray = getBackpackCargo Z_vehicle; + + { + _vehicleBackpacks = _vehicleBackpacks + _x; + }count ( _tempBackpackArray select 1); + + _allowedWeapons = getNumber (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'transportMaxWeapons'); + _allowedMags = getNumber (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'transportMaxMagazines'); + _allowedBackpacks = getNumber (configFile >> 'CfgVehicles' >> (typeOf Z_vehicle) >> 'transportmaxbackpacks '); + }; + _returnArray = [_allowedMags - _vehicleMagazines, _allowedWeapons - _vehicleWeapons, _allowedBackpacks - _vehicleBackpacks]; +}; +if(_selection == 0) then{ //backpack + _allowedWeapons = 0; + _allowedMags = 0; + _allowedBackpacks = 0; + _vehicleMagazines = 0; + _vehicleWeapons = 0; + _backpack = unitBackpack player; + if (!isNil "_backpack") then { + _pic = getText (configFile >> 'CfgVehicles' >> (typeOf _backpack) >> 'picture'); + + _formattedText = format [ + "" + , _pic + ]; + + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText; + _tempMagazinesArray = getMagazineCargo Z_vehicle; + + { + _vehicleMagazines = _vehicleMagazines + _x; + }count ( _tempMagazinesArray select 1); + + + _tempWeaponsArray = getWeaponCargo Z_vehicle; + + { + _vehicleWeapons = _vehicleWeapons + _x; + }count ( _tempWeaponsArray select 1); + + _allowedWeapons = getNumber (configFile >> 'CfgVehicles' >> (typeOf _backpack) >> 'transportMaxWeapons'); + _allowedMags = getNumber (configFile >> 'CfgVehicles' >> (typeOf _backpack) >> 'transportMaxMagazines'); + _allowedBackpacks = 0; + }; + _returnArray = [_allowedMags - _vehicleMagazines ,_allowedWeapons - _vehicleWeapons, _allowedBackpacks]; +}; +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetText format["%1/%2/%3",_returnArray select 1,_returnArray select 0,_returnArray select 2]; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_canAfford.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_canAfford.sqf new file mode 100644 index 000000000..b1b3a6ca0 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_canAfford.sqf @@ -0,0 +1,76 @@ +private ['_worth', '_total_currency','_return','_part','_totalToPay','_inventoryMoney','_backpackMoney',"_kinds","_kinds2","_kinds3","_ammmounts","_ammmounts2","_ammmounts3" +,"_vehicleMoney"]; + +_totalToPay = _this; +_return = [false, [], [], [], 0]; + +_total_currency = 0; +_inventoryMoney = []; +{ + _part = (configFile >> "CfgMagazines" >> _x); + _worth = (_part >> "worth"); + if isNumber (_worth) then { + _total_currency = _total_currency + getNumber(_worth); + _inventoryMoney set [count(_inventoryMoney),_x]; + }; +} count (magazines player); + +_return set [1, _inventoryMoney]; + +if( Z_AllowTakingMoneyFromBackpack ) then { + _backpackPlayer = unitBackpack player; + + if (!isNull _backpackPlayer) then { + _mags = getMagazineCargo Z_vehicle; + _backpackMoney = []; + _kinds = _mags select 0; + _ammmounts = _mags select 1; + { + _part = (configFile >> "CfgMagazines" >> _x); + _worth = (_part >> "worth"); + + if isNumber (_worth) then { + _total_currency = _total_currency + ( getNumber(_worth) * (_ammmounts select _forEachIndex)); + + _counter = 0 ; + while{ _counter < ( _ammmounts select _forEachIndex)}do{ + _backpackMoney set [count(_backpackMoney),_x]; + _counter = _counter + 1; + }; + }; + }forEach _kinds; + _return set [2, _backpackMoney]; + + }; +}; + +if( Z_AllowTakingMoneyFromVehicle ) then { + if (!isNull Z_vehicle) then { + + _mags = getMagazineCargo Z_vehicle; + _vehicleMoney = []; + _kinds = _mags select 0; + _ammmounts = _mags select 1; + { + _part = (configFile >> "CfgMagazines" >> _x); + _worth = (_part >> "worth"); + + if isNumber (_worth) then { + _total_currency = _total_currency + ( getNumber(_worth) * (_ammmounts select _forEachIndex)); + _counter = 0 ; + while{ _counter < ( _ammmounts select _forEachIndex)}do{ + _vehicleMoney set [count(_vehicleMoney),_x]; + _counter = _counter + 1; + }; + }; + }forEach _kinds; + _return set [3, _vehicleMoney]; + }; +}; + +if ( _totalToPay <= _total_currency) then { + _return set [0, true]; + _return set [4, _total_currency]; +}; + +_return diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_changeBuySell.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_changeBuySell.sqf new file mode 100644 index 000000000..31c573301 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_changeBuySell.sqf @@ -0,0 +1,16 @@ +#include "defines.sqf"; + +Z_Selling = !Z_Selling; +if(Z_Selling)then{ + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SELLBUYTOGGLE) ctrlSetText "Buy"; + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText "Selling"; + {ctrlShow [_x,true];} forEach [Z_AT_SELLABLELIST,Z_AT_SELLINGLIST,Z_AT_SELLBUTTON,Z_AT_ADDSELLITEMBUTTON,Z_AT_ADDALLSELLITEMBUTTON,Z_AT_REMOVESELLITEMBUTTON,Z_AT_REMOVEALLSELLITEMBUTTON]; // show + {ctrlShow [_x,false];} forEach [Z_AT_BUYABLELIST,Z_AT_BUYINGLIST,Z_AT_BUYBUTTON,Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_SLOTSDISPLAY]; // hide +}else{ + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SELLBUYTOGGLE) ctrlSetText "Sell"; + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_RIGHTLISTTITLE) ctrlSetText "Buying"; + {ctrlShow [_x,true];} forEach [Z_AT_BUYABLELIST,Z_AT_BUYINGLIST,Z_AT_BUYBUTTON,Z_AT_ADDBUYITEMBUTTON,Z_AT_BUYINGAMOUNT,Z_AT_REMOVEBUYITEMBUTTON,Z_AT_REMOVEALLBUYITEMBUTTON,Z_AT_SLOTSDISPLAY]; // show + {ctrlShow [_x,false];} forEach [Z_AT_SELLABLELIST,Z_AT_SELLINGLIST,Z_AT_SELLBUTTON,Z_AT_ADDSELLITEMBUTTON,Z_AT_ADDALLSELLITEMBUTTON,Z_AT_REMOVESELLITEMBUTTON,Z_AT_REMOVEALLSELLITEMBUTTON]; // hide + call Z_calcBuyableList; +}; +[2] call Z_getContainer; // default gear \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf new file mode 100644 index 000000000..a770de1b0 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkArrayInConfig.sqf @@ -0,0 +1,96 @@ +/** +* [_weaps,_mags,_extraText] call Z_checkArrayInConfig +* +* @param Array of Strings _this select 0 (_weaps) -> all weapons/items in the container +* @param Array of Strings _this select 1 (_mags) -> all magazines in the container +* @param String _this select 2 (_extraText) -> Indicator what container you are trading from +* +* Fills up the sell or buy list if the item has a valid config. +**/ +private ["_weaps","_mags","_extraText","_all","_total","_arrayOfTraderCat","_totalPrice","_ctrltext","_backUpText"]; +#include "defines.sqf"; + +_weaps = _this select 0; +_mags = _this select 1; +_extraText = _this select 2; +_all = _weaps + _mags ; +_total = count(_all); +_arrayOfTraderCat = Z_traderData; +_totalPrice = 0; +if(_total > 0)then{ + { + _y = _x; + { + private ["_cat","_excists","_pic","_text","_type","_sell","_buy","_buyCurrency","_sellCurrency","_worth"]; + _cat = format["Category_%1",(_arrayOfTraderCat select _forEachIndex select 1)]; + _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"]) : + { + _pic = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName'); + _text = getText (configFile >> 'CfgVehicles' >> _y >> 'displayName'); + }; + }; + + if( isNil '_text')then{ + _text = _y; + }; + + _worth = 0; + + if(!Z_SingleCurrency) then { + _buyCurrency = _buy select 1; + _sellCurrency = _sell select 1; + _part = (configFile >> "CfgMagazines" >> _sellCurrency); + _worth = getNumber(_part >> "worth"); + }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; + + Z_OriginalSellableArray = [] + Z_SellableArray; + + _backUpText = _extraText; + + if(Z_SellingFrom != 2)then{ + _extraText = getText (configFile >> 'CfgVehicles' >> _extraText >> 'displayName'); + }; + if (isNil '_extraText')then{ + _extraText = _backUpText; + }; + + if (Z_SingleCurrency) then { + _ctrltext = format["I would offer %1 %2.", _totalPrice,CurrencyName]; + ctrlSetText [Z_AT_TRADERLINE2, _ctrltext]; + } else { + ctrlSetText [Z_AT_TRADERLINE2, '']; + }; + + _ctrltext = format["I accept %1 items from %2.", count(Z_SellableArray) , _extraText]; + ctrlSetText [Z_AT_TRADERLINE1, _ctrltext]; + + call Z_fillSellList; +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkCloseVehicle.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkCloseVehicle.sqf new file mode 100644 index 000000000..c9ab397cf --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_checkCloseVehicle.sqf @@ -0,0 +1,17 @@ +private ["_vehicle","_list","_result"]; +Z_vehicle = objNull; +_vehicle = objNull; +_list = nearestObjects [(getPosATL player), ["AllVehicles"], Z_VehicleDistance]; +{ + if(!isNull _x && local _x && !isPlayer _x && alive _x && !(_x isKindOf "zZombie_base"))then{ + systemChat format["Selected %1",typeOf _x]; + _vehicle = _x; + }; +}count _list; +_result = false; +if(!isNull _vehicle)then{ + Z_vehicle = _vehicle; + _result = true; + [format["Buying in %1.", typeOf Z_vehicle]] call Z_filleTradeTitle; +}; +_result diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyList.sqf new file mode 100644 index 000000000..bcff2c8a5 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyList.sqf @@ -0,0 +1,7 @@ +/** +* call Z_clearBuyList +* +* Clears the visual listbox of items you could buy. +**/ +#include "defines.sqf"; +lbClear Z_AT_BUYABLELIST; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyingList.sqf new file mode 100644 index 000000000..0292b6363 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearBuyingList.sqf @@ -0,0 +1,8 @@ +/** +* call Z_clearBuyingList +* +* Clears the visual listbox of items you were going to buy. +**/ + +#include "defines.sqf"; +lbClear Z_AT_BUYINGLIST; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearLists.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearLists.sqf new file mode 100644 index 000000000..5b09eff78 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearLists.sqf @@ -0,0 +1,8 @@ +/** +* call Z_clearLists +* +* Clears the visual listbox of items you were going to sell and could be selled. +**/ +#include "defines.sqf"; +lbClear Z_AT_SELLABLELIST; +lbClear Z_AT_SELLINGLIST; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearSellableList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearSellableList.sqf new file mode 100644 index 000000000..cb21c2cde --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_clearSellableList.sqf @@ -0,0 +1,7 @@ +/** +* call Z_clearSellableList +* +* Clears the visual listbox of items you were going to sell. +**/ +#include "defines.sqf"; +lbClear Z_AT_SELLABLELIST; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayBackpackInfo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayBackpackInfo.sqf new file mode 100644 index 000000000..d157e1f02 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayBackpackInfo.sqf @@ -0,0 +1,54 @@ +private ["_item","_picture","_class","_display","_transportMaxWeapons","_transportMaxMagazines","_transportmaxBackpacks","_buyPrice","_sellPrice" +,"_buyCurrency","_sellCurrency","_formattedText" +]; + +#include "defines.sqf"; + +_item = _this select 0; + +_picture = _item select 4; +_class = _item select 0; +_display = _item select 3; + +_transportMaxWeapons = 0; +_transportMaxMagazines = 0; + +_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; +}; + +if ( isNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxWeapons')) then { + _transportMaxWeapons = getNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxWeapons'); +}; + +if ( isNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxMagazines')) then { + _transportMaxMagazines = getNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxMagazines'); +}; + +if ( Z_SingleCurrency ) then { + _buyCurrency = CurrencyName; + _sellCurrency = CurrencyName; +}; + +_formattedText = format [ +"
" + +"Name: %2
" + +"Class: %3
" + +"Sell: %5 %7
" + +"Buy: %6 %4
" + +"Mags: %8
" + +"Weaps:%9
" +, _picture, _display, _class, _buyCurrency , _sellPrice, _buyPrice, _sellCurrency, _transportMaxWeapons,_transportMaxMagazines +]; + +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayItemInfo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayItemInfo.sqf new file mode 100644 index 000000000..8a39a1276 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayItemInfo.sqf @@ -0,0 +1,44 @@ +private ['_item','_picture','_class','_display','_buyPrice','_sellPrice','_formattedText','_buyCurrency','_sellCurrency']; +#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; +}; + +if (Z_SingleCurrency) then { + _formattedText = format [ + "
" + + "Name: %2
" + + "Class: %3
" + + "Sell: %5 %7
" + + "Buy: %6 %7
" + , _picture, _display, _class, 'lazy', _sellPrice, _buyPrice, CurrencyName + ]; +} 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 [ + "
" + + "Name: %2
" + + "Class: %3
" + + "Sell: %5 %7
" + + "Buy: %6 %9
" + , _picture, _display, _class, 'lazy', _sellPrice, _buyPrice, _sellCurrency , _picSell , _buyCurrency, _picBuy + ]; +}; +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayVehicleInfo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayVehicleInfo.sqf new file mode 100644 index 000000000..973689659 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayVehicleInfo.sqf @@ -0,0 +1,87 @@ +private ['_item', '_type','_picture',"_class","_display","_transportMaxWeapons","_transportMaxMagazines","_transportmaxBackpacks" +,"_buyPrice","_sellPrice","_buyCurrency","_sellCurrency","_formattedText" +]; + +#include "defines.sqf"; + +_item = _this select 0; + +_picture = _item select 4; +_class = _item select 0; +_display = _item select 3; + +_fuelCapacity = nil; +_maxSpeed = nil; +_armor = nil; +_seats = nil; +_weapons = nil; + +_transportMaxWeapons = 0; +_transportMaxMagazines = 0; +_transportmaxBackpacks = 0; + +_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; +}; + +if ( isNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxWeapons')) then { + _transportMaxWeapons = getNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxWeapons'); +}; + +if ( isNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxMagazines')) then { + _transportMaxMagazines = getNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxMagazines'); +}; + +if ( isNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxBackpacks')) then { + _transportmaxBackpacks = getNumber (configFile >> 'CfgVehicles' >> _class >> 'transportMaxBackpacks'); +}; + +if (Z_SingleCurrency) then { + _formattedText = format [ + "
" + + "Name: %2
" + + "Class: %3
" + + "Sell: %5 %7
" + + "Buy: %6 %7
" + + "Mags: %9
" + + "Weaps: %8
" + + "Backs: %4
" + , _picture, _display, _class, _transportmaxBackpacks, _sellPrice, _buyPrice, CurrencyName, _transportMaxWeapons,_transportMaxMagazines + ]; + + +}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 [ + "
" + + "Name: %2
" + + "Class: %3
" + + "Sell: %5 %10
" + + "Buy: %6 %7
" + + "Mags: %8
" + + "Weaps: %9
" + + "Backs: %4
" + , _picture, _display, _class, _transportmaxBackpacks, _sellPrice, _buyPrice, _buyCurrency, _transportMaxWeapons,_transportMaxMagazines, _sellCurrency, _picSell,_picBuy + ]; + + +}; + + + +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayWeaponInfo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayWeaponInfo.sqf new file mode 100644 index 000000000..a0fcc0ff4 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_displayWeaponInfo.sqf @@ -0,0 +1,69 @@ +private ["_item","_picture","_class","_display","_buyPrice","_sellPrice","_magazines","_magText","_formattedText","_buyCurrency","_sellCurrency"]; +#include "defines.sqf"; + +_item = _this select 0; +_picture = _item select 4; +_class = _item select 0; +_display = _item select 3; +_buyPrice = 0; +_sellPrice = 0; +_buyCurrency = ""; +_sellCurrency = ""; + +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; +}; + +_magazines = []; +if( isArray (configFile >> 'CfgWeapons' >> _class >> 'magazines')) then { + _magazines = getArray (configFile >> 'CfgWeapons' >> _class >> 'magazines'); +}; +_magText = ""; + +{ + if( _forEachIndex > 0) then { + _magText = _magText + ', ' + _x; + } else { + _magText = _magText + _x; + }; + +}foreach _magazines; + +if (Z_SingleCurrency) then { + _formattedText = format [ + "
" + + "Name: %2
" + + "Class: %3
" + + "Sell: %5 %7
" + + "Buy: %6 %7
" + + "Mags:
%4" + , _picture, _display, _class, _magText, _sellPrice, _buyPrice, CurrencyName + ]; +}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 [ + "
" + + "Name: %2
" + + "Class: %3
" + + "Sell: %5 %7
" + + "Buy: %6 %8
" + + "Mags:
%4" + , _picture, _display, _class, _magText, _sellPrice, _buyPrice, _sellCurrency, _buyCurrency, _picSell, _picBuy + ]; +}; + + + +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyableList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyableList.sqf new file mode 100644 index 000000000..a6dc3bf1f --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyableList.sqf @@ -0,0 +1,5 @@ +#include "defines.sqf"; +{ + _index = lbAdd [Z_AT_BUYABLELIST, _x select 3]; + lbSetPicture [Z_AT_BUYABLELIST, _index, _x select 4 ]; +}count Z_BuyableArray; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyingList.sqf new file mode 100644 index 000000000..2ab9a1720 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillBuyingList.sqf @@ -0,0 +1,5 @@ +#include "defines.sqf"; +{ + _index = lbAdd [Z_AT_BUYINGLIST, _x select 3]; + lbSetPicture [Z_AT_BUYINGLIST, _index, _x select 4]; +}count Z_BuyingArray; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellList.sqf new file mode 100644 index 000000000..823a6922a --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellList.sqf @@ -0,0 +1,10 @@ +/** +* call Z_fillSellList +* +* Visualy fills in the listbox of items that can be sold. +**/ +#include "defines.sqf"; +{ + _index = lbAdd [Z_AT_SELLABLELIST, _x select 3]; + lbSetPicture [Z_AT_SELLABLELIST, _index, _x select 4 ]; +}count Z_SellableArray; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellingList.sqf new file mode 100644 index 000000000..65873983a --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_fillSellingList.sqf @@ -0,0 +1,10 @@ +/** +* call Z_fillSellingList +* +* Visualy fills in the listbox of items currently being sold. +**/ +#include "defines.sqf"; +{ + _index = lbAdd [Z_AT_SELLINGLIST, _x select 3]; + lbSetPicture [Z_AT_SELLINGLIST, _index, _x select 4]; +}count Z_SellArray; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filleTradeTitle.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filleTradeTitle.sqf new file mode 100644 index 000000000..b62888159 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filleTradeTitle.sqf @@ -0,0 +1,10 @@ +/** +* [_text] call Z_filleTradeTitle +* +* @param String _this select 0 (_text) -> The text you want in the label. +* +* Changes the indication of where you are selling/buying from in the trade window. +**/ +#include "defines.sqf"; +_text = _this select 0; +ctrlSetText [Z_AT_CONTAINERINDICATOR, _text]; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filterList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filterList.sqf new file mode 100644 index 000000000..8fb4b411b --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_filterList.sqf @@ -0,0 +1,54 @@ +/** +* call Z_filterList +* +* @param String _this select 0 (_query) -> the current string in the filter input +* +* Filters the buyable or sellable list on your input. +**/ + +if(count _this > 0) then { + _query = _this select 0; // the search string. + if(Z_Selling)then { + if(isNil '_query' || _query == "") then { + _newSellArray = []; + { + if( _x find Z_SellArray < 0) then { + _newSellArray set [count(_newSellArray), _x]; + }; + } forEach Z_OriginalSellableArray; + + Z_SellableArray = [] + _newSellArray; + + call Z_clearSellableList; + call Z_fillSellList; + }else { + _newSellArray = []; + { + if(( [_query,(_x select 0)] call KK_fnc_inString) || ([_query,(_x select 3)] call KK_fnc_inString) ) then { + if( _x find Z_SellArray < 0 ) then { + _newSellArray set [count(_newSellArray), _x]; + }; + }; + } forEach Z_OriginalSellableArray; + Z_SellableArray = [] + _newSellArray; + call Z_clearSellableList; + call Z_fillSellList; + }; + }else { + if(isNil '_query' || _query == "") then { + Z_BuyableArray = [] + Z_OriginalBuyableArray; + call Z_clearBuyList; + call Z_fillBuyableList; + }else { + _newBuyArray = []; + { + if(( [_query,(_x select 0)] call KK_fnc_inString) || ([_query,(_x select 3)] call KK_fnc_inString) ) then { + _newBuyArray set [count(_newBuyArray), _x]; + }; + } forEach Z_OriginalBuyableArray; + Z_BuyableArray = [] + _newBuyArray; + call Z_clearBuyList; + call Z_fillBuyableList; + }; + }; +}; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getBackpackItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getBackpackItems.sqf new file mode 100644 index 000000000..393303c7b --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getBackpackItems.sqf @@ -0,0 +1,53 @@ +/** +* call Z_getBackpackItems +* +* Gets all your items stored in your backpack and innitiates the selling list. +**/ +#include "defines.sqf"; +private ["_backpack","_pic","_formattedText","_mags","_weaps","_normalMags","_normalWeaps","_kinds","_kinds2","_ammmounts","_ammmounts2","_ctrltext"]; +call Z_clearLists; +Z_SellableArray = []; +Z_SellArray = []; +_backpack = unitBackpack player; +if (!isNull _backpack) then { + _pic = getText (configFile >> 'CfgVehicles' >> (typeOf _backpack) >> 'picture'); + + _formattedText = format [ + "" + , _pic + ]; + + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText; + + _mags = getMagazineCargo _backpack; + _weaps = getWeaponCargo _backpack; + _normalMags = []; + _normalWeaps = []; + _kinds = _mags select 0; + _ammmounts = _mags select 1; + { + _counter = 0 ; + while{ _counter < ( _ammmounts select _forEachIndex)}do{ + _normalMags set [count(_normalMags),_x]; + _counter = _counter + 1; + }; + }forEach _kinds; + + _kinds2 = _weaps select 0; + _ammmounts2 = _weaps select 1; + { + _counter = 0 ; + while{ _counter < ( _ammmounts2 select _forEachIndex)}do{ + _normalWeaps set [count(_normalWeaps),_x]; + _counter = _counter + 1; + }; + }forEach _kinds2; + + [_normalMags,_normalWeaps, typeOf _backpack] call Z_checkArrayInConfig; +}else{ + _ctrltext = format["I'm not stupid."]; + ctrlSetText [Z_AT_TRADERLINE2, _ctrltext]; + + _ctrltext = format["You are not wearing a backpack."]; + ctrlSetText [Z_AT_TRADERLINE1, _ctrltext]; +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getContainer.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getContainer.sqf new file mode 100644 index 000000000..009ffcd14 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getContainer.sqf @@ -0,0 +1,71 @@ +/** +* call Z_getContainer +* +* Switches between selling and buying and the item container (gear/vehicle/bakcpack) and initiates item loading. +**/ +private ["_lbIndex","_formattedText","_canBuyInVehicle"]; +#include "defines.sqf"; +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetText format["0 / 0 / 0"]; +call Z_clearBuyingList; +call Z_clearLists; +Z_SellableArray = []; +Z_SellArray = []; +Z_BuyingArray = []; + +_lbIndex = _this select 0; + +_formattedText = format ['']; + +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText _formattedText; + +call Z_calcPrice; + +if(Z_Selling)then{ + switch (_lbIndex) do { + case 0: { + ["Selling from backpack."] call Z_filleTradeTitle; + Z_SellingFrom = 0; + call Z_getBackpackItems; + }; + case 1: { + ["Selling from vehicle."] call Z_filleTradeTitle; + Z_SellingFrom = 1; + call Z_getVehicleItems; + }; + case 2: { + ["Selling from gear."] call Z_filleTradeTitle; + Z_SellingFrom = 2; + call Z_getGearItems; + }; + }; +}else{ + _ctrltext = format[" "]; + ctrlSetText [Z_AT_TRADERLINE2, _ctrltext]; + + _ctrltext = format["These are all the items I'm selling."]; + ctrlSetText [Z_AT_TRADERLINE1, _ctrltext]; + switch (_lbIndex) do { + + case 0: { + Z_SellingFrom = 0; + ["Buying in backpack."] call Z_filleTradeTitle; + [0] call Z_calculateFreeSpace; + }; + case 1: { + Z_SellingFrom = 1; + ["Buying in vehicle."] call Z_filleTradeTitle; + _canBuyInVehicle = call Z_checkCloseVehicle; + if(_canBuyInVehicle)then{ + [1] call Z_calculateFreeSpace; + }else{ + systemChat format["Get in the driver seat to be able to trade to your vehicle."]; + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_SLOTSDISPLAY) ctrlSetText format["%1 / %2 / %3",0,0,0]; + }; + }; + case 2: { + Z_SellingFrom = 2; + ["Buying in gear."] call Z_filleTradeTitle; + [2] call Z_calculateFreeSpace; + }; + }; +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf new file mode 100644 index 000000000..6d9260327 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf @@ -0,0 +1,30 @@ +/** +* call Z_getBackpackItems +* +* Gets all your items stored in your gear and innitiates the selling list. +**/ +private ["_mags","_weaps","_skin","_formattedText","_icon"]; +#include "defines.sqf"; +call Z_clearLists; +Z_SellArray = []; +Z_SellableArray = []; + _mags = magazines player; + _weaps = weapons player; + +_skin = typeOf player; + +_pic = getText (configFile >> 'CfgVehicles' >> _skin >> 'picture'); +_icon = getText (configFile >> 'CfgVehicles' >> _skin >> 'icon'); + +if (!isNil '_pic' && _pic == "") then { + _pic = _icon; +}; + +_formattedText = format [ + " Gear " + , _pic +]; + +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText; + +[_weaps,_mags,"your gear"] call Z_checkArrayInConfig; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemConfig.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemConfig.sqf new file mode 100644 index 000000000..072fef4ba --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemConfig.sqf @@ -0,0 +1,27 @@ + +#include "defines.sqf"; +private ['_item', '_type']; +_item = _this select 0; +_type = _item select 1; + +switch (true) do { + case (_type == "trade_items") : + { + [_item] call Z_displayItemInfo; + }; + case (_type == "trade_weapons") : + { + [_item] call Z_displayWeaponInfo; + }; + case (_type == "trade_backpacks") : + { + [_item] call Z_displayBackpackInfo; + }; + case (_type == "trade_any_vehicle") : + { + [_item] call Z_displayVehicleInfo; + }; + default { + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_ITEMINFO) ctrlSetStructuredText parseText "No info found"; + } +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemInfo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemInfo.sqf new file mode 100644 index 000000000..a5ed6d5ed --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getItemInfo.sqf @@ -0,0 +1,32 @@ +/** +* [_selectedList, _selectedIndex ]call Z_clearBuyingList +* +* Innitiates the item info to be displayed by getting the right item out of the corresponding list based on your sellection. +**/ +private ['_item','_selectedList','_selectedIndex']; + +_selectedList = _this select 0; +_selectedIndex = _this select 1; + +_item = []; + +if(_selectedIndex >= 0) then { + switch(_selectedList) do { + case 'sellable': { + _item = Z_SellableArray select _selectedIndex; + }; + case 'selling': { + _item = Z_SellArray select _selectedIndex; + }; + case 'buyable': { + _item = Z_BuyableArray select _selectedIndex; + }; + case 'buying': { + _item = Z_BuyingArray select _selectedIndex; + }; + }; +}; + +if( count _item > 0) then { + [_item] call Z_getItemConfig; +}; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getVehicleItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getVehicleItems.sqf new file mode 100644 index 000000000..daff550d6 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getVehicleItems.sqf @@ -0,0 +1,64 @@ +/** +* call Z_getBackpackItems +* +* Gets all your items stored in your vehicle and innitiates the selling list. +**/ +#include "defines.sqf"; +Z_vehicle = objNull; +call Z_clearLists; +Z_SellableArray = []; +Z_SellArray = []; +_vehicle = objNull; + +_list = nearestObjects [(getPosATL player), ["AllVehicles"], Z_VehicleDistance]; +{ + if (!isNull _x && local _x && !isPlayer _x && alive _x && !(_x isKindOf "zZombie_base")) then { + systemChat format["Selected %1",typeOf _x]; + _vehicle = _x; + }; +}count _list; + +if (!isNull _vehicle) then { + _pic = getText (configFile >> 'CfgVehicles' >> (typeOf _vehicle) >> 'picture'); + + _formattedText = format [ + "" + , _pic + ]; + + (findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_CONTAINERINFO) ctrlSetStructuredText parseText _formattedText; + Z_vehicle = _vehicle; + _mags = getMagazineCargo _vehicle; + _weaps = getWeaponCargo _vehicle; + + _normalMags = []; + _normalWeaps = []; + + _kinds = _mags select 0; + _ammmounts = _mags select 1; + { + _counter = 0 ; + while{ _counter < ( _ammmounts select _forEachIndex)}do{ + _normalMags set [count(_normalMags),_x]; + _counter = _counter + 1; + }; + }forEach _kinds; + + _kinds2 = _weaps select 0; + _ammmounts2 = _weaps select 1; + { + _counter = 0 ; + while{ _counter < ( _ammmounts2 select _forEachIndex)}do{ + _normalWeaps set [count(_normalWeaps),_x]; + _counter = _counter + 1; + }; + }forEach _kinds2; + + [_normalWeaps,_normalMags, typeOf _vehicle] call Z_checkArrayInConfig; +}else{ + _ctrltext = format["Get in driver seat first!"]; + ctrlSetText [Z_AT_TRADERLINE2, _ctrltext]; + + _ctrltext = format["I do not see any vehicle."]; + ctrlSetText [Z_AT_TRADERLINE1, _ctrltext]; +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_payDefault.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_payDefault.sqf new file mode 100644 index 000000000..5265f0d7f --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_payDefault.sqf @@ -0,0 +1,24 @@ +private ["_player","_toPay","_moneyInfo","_totalWorth","_moneyInGear","_moneyInBackpack","_moneyInVehicle", "_success"]; + +_player = _this select 0; +_toPay = _this select 1; +_moneyInfo = _this select 2; +_totalWorth = _moneyInfo select 4; +_moneyInGear = _moneyInfo select 1; +_moneyInBackpack = _moneyInfo select 2; +_moneyInVehicle = _moneyInfo select 3; + +{ + _nil = [player, _x , 1] call BIS_fnc_invRemove; +}count _moneyInGear; + +if (count _moneyInBackpack > 0 ) then { + _nil = [unitBackpack _player, _moneyInBackpack, []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo; +}; +if (!isNull Z_vehicle && count _moneyInVehicle > 0 ) then { + _nil = [Z_vehicle, _moneyInVehicle, []] call ZUPA_fnc_removeWeaponsAndMagazinesCargo; +}; + +_success = [_toPay, _totalWorth] call Z_returnChange; + +_success diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_pushAllToList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_pushAllToList.sqf new file mode 100644 index 000000000..faf354e38 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_pushAllToList.sqf @@ -0,0 +1,6 @@ +Z_SellArray = Z_SellArray + Z_SellableArray; +Z_SellableArray = []; +call Z_clearLists; +call Z_fillSellList; +call Z_fillSellingList; +call Z_calcPrice; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_pushItemToList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_pushItemToList.sqf new file mode 100644 index 000000000..1d6a865d3 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_pushItemToList.sqf @@ -0,0 +1,13 @@ +#include "defines.sqf"; +_index = _this select 0; +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 ]; + Z_SellArray set [count(Z_SellArray),_temp]; + Z_SellableArray set [_index,"deleted"]; + Z_SellableArray = Z_SellableArray - ["deleted"]; + _index2 = lbAdd [Z_AT_SELLINGLIST, _temp select 3]; + lbSetPicture [Z_AT_SELLINGLIST, _index2, _temp select 4]; + call Z_calcPrice; +}; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeAllFromBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeAllFromBuyingList.sqf new file mode 100644 index 000000000..b16798ffb --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeAllFromBuyingList.sqf @@ -0,0 +1,2 @@ +call Z_clearBuyingList; +Z_BuyingArray = []; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeAllToList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeAllToList.sqf new file mode 100644 index 000000000..b8c7694c7 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeAllToList.sqf @@ -0,0 +1,6 @@ +Z_SellableArray = Z_SellableArray + Z_SellArray; +Z_SellArray = []; +call Z_clearLists; +call Z_fillSellList; +call Z_fillSellingList; +call Z_calcPrice; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromBuyingList.sqf new file mode 100644 index 000000000..6dadd1305 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromBuyingList.sqf @@ -0,0 +1,8 @@ +#include "defines.sqf"; +_index = _this select 0; +if(!isNil"_index" && _index > -1)then { + lbDelete [Z_AT_BUYINGLIST, _index]; + Z_BuyingArray set [_index,"deleted"]; + Z_BuyingArray = Z_BuyingArray - ["deleted"]; + call Z_calcPrice; +}; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromList.sqf new file mode 100644 index 000000000..4d66f3100 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_removeItemFromList.sqf @@ -0,0 +1,13 @@ +#include "defines.sqf"; +_index = _this select 0; +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 ]; + Z_SellableArray set [count(Z_SellableArray),_temp]; + Z_SellArray set [_index,"deleted"]; + Z_SellArray = Z_SellArray - ["deleted"]; + _index2 = lbAdd [Z_AT_SELLABLELIST, _temp select 3]; + lbSetPicture [Z_AT_SELLABLELIST, _index2, _temp select 4]; + call Z_calcPrice; +}; \ No newline at end of file diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_returnChange.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_returnChange.sqf new file mode 100644 index 000000000..85b02b764 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_returnChange.sqf @@ -0,0 +1,76 @@ +// Made for DayZ Epoch by vbawol edited for AdvancedTrading by Zupa +private ["_trade_total","_part_inWorth","_part_in_configClass","_total_currency","_part","_worth","_return_change","_total","_briefcase_100oz","_gold_10oz_a","_gold_10oz_b","_gold_10oz","_gold_1oz_a","_gold_1oz_b","_gold_1oz","_silver_10oz_a","_silver_10oz_b","_silver_10oz","_silver_1oz_a","_silver_1oz_b","_silver_1oz","_successful","_buyOrSell","_total_items"]; + +_successful = false; + +_trade_total = _this select 0; + +_total_currency = _this select 1; + +_return_change = 0; +if (!Z_Selling) then { + _return_change = _total_currency - _trade_total; +} else { + _return_change = _total_currency + _trade_total; +}; + +if (_return_change > 0) then { + + _total = _return_change; + + _briefcase_100oz = floor(_total / 10000); + + _gold_10oz_a = floor(_total / 1000); + _gold_10oz_b = _briefcase_100oz * 10; + _gold_10oz = (_gold_10oz_a - _gold_10oz_b); + + _gold_1oz_a = floor(_total / 100); + _gold_1oz_b = _gold_10oz_a * 10; + _gold_1oz = (_gold_1oz_a - _gold_1oz_b); + + _silver_10oz_a = floor(_total / 10); + _silver_10oz_b = _gold_1oz_a * 10; + _silver_10oz = (_silver_10oz_a - _silver_10oz_b); + + _silver_1oz_a = floor(_total); + _silver_1oz_b = _silver_10oz_a * 10; + _silver_1oz = (_silver_1oz_a - _silver_1oz_b); + + + if (_briefcase_100oz > 0) then { + for "_x" from 1 to _briefcase_100oz do { + player addMagazine "ItemBriefcase100oz"; + }; + }; + if (_gold_10oz > 0) then { + if (_gold_10oz == 1) then { + player addMagazine "ItemGoldBar10oz"; + } else { + player addMagazine format["ItemBriefcase%1oz",floor(_gold_10oz*10)]; + }; + }; + if (_gold_1oz > 0) then { + if (_gold_1oz == 1) then { + player addMagazine "ItemGoldBar"; + } else { + player addMagazine format["ItemGoldBar%1oz",_gold_1oz]; + }; + }; + if (_silver_10oz > 0) then { + if (_silver_10oz == 1) then { + player addMagazine "ItemSilverBar10oz"; + } else { + player addMagazine format["ItemBriefcaseS%1oz",floor(_silver_10oz*10)]; + }; + }; + if (_silver_1oz > 0) then { + if (_silver_1oz == 1) then { + player addMagazine "ItemSilverBar"; + } else { + player addMagazine format["ItemSilverBar%1oz",_silver_1oz]; + }; + }; + _successful = true; +}; + +_successful diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf new file mode 100644 index 000000000..7a9385edf --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_sellItems.sqf @@ -0,0 +1,113 @@ +private ["_index","_tempArray","_outcome","_weaponsArray","_itemsArray","_bpArray","_bpCheckArray","_weaponsCheckArray","_itemsCheckArray"]; + +_index = count (Z_SellArray) - 1; +_tempArray = Z_SellArray; +if(_index > -1)then{ + closeDialog 2; + _outcome = []; + _weaponsArray = []; + _itemsArray = []; + _bpArray = []; + _bpCheckArray = []; + _weaponsCheckArray = []; + _itemsCheckArray = []; + { + private ["_type","_name"]; + _type = _x select 1; + _name = _x select 0; + + switch (true) do { + case (_type == "trade_items") : + { + _itemsArray set [count(_itemsArray),_name]; + _itemsCheckArray set [count(_itemsCheckArray),[_x select 2, _x select 11]]; + }; + case (_type == "trade_weapons") : + { + _weaponsArray set [count(_weaponsArray),_name]; + _weaponsCheckArray set [count(_weaponsCheckArray),[_x select 2, _x select 11]]; + }; + case (_type == "trade_backpacks") : + { + _bpArray set [count(_bpArray),_name]; + _bpCheckArray set [count(_bpCheckArray),[_x select 2, _x select 11]]; + }; + + }; + }count Z_SellArray; + + if(Z_SellingFrom == 0)then{ + _outcome = [unitBackpack player,_itemsArray,_weaponsArray] call ZUPA_fnc_removeWeaponsAndMagazinesCargo; + }; + if(Z_SellingFrom == 1)then{ + _outcome = [Z_vehicle,_itemsArray,_weaponsArray,_bpArray] call ZUPA_fnc_removeWeaponsAndMagazinesCargo; + }; + + //gear + if(Z_SellingFrom == 2)then{ + _wA = []; + _mA = []; + { + _localResult = [player,(_x select 0),1] call BIS_fnc_invRemove; + if( _localResult != 1)then{ + if(_x select 1 == "trade_items")then{ + _mA set [count(_mA),0]; + }else{ + _wA set [count(_wA),0]; + }; + }else{ + if(_x select 1 == "trade_items")then{ + _mA set [count(_mA),1]; + }else{ + _wA set [count(_wA),1]; + }; + }; + + }count Z_SellArray; + + _outcome set [0,_mA]; + _outcome set [1,_wA]; + _outcome set [2,[]]; + }; + + _money = 0; + + if (Z_SingleCurrency) then { + { + _money = _money + ( (((_itemsCheckArray select _forEachIndex) select 0)) * _x) ; + }forEach (_outcome select 0); + { + _money = _money + ( (((_weaponsCheckArray select _forEachIndex) select 0)) * _x) ; + }forEach (_outcome select 1); + { + _money = _money + ( ( ((_bpCheckArray select _forEachIndex) select 0) ) * _x) ; + }forEach (_outcome select 2); + } else { + { + _itemData = _itemsCheckArray select _forEachIndex; + _money = _money + ( (_itemData select 0) * (_itemData select 1) * _x); + }forEach (_outcome select 0); + { + _itemData = _weaponsCheckArray select _forEachIndex; + _money = _money + ( (_itemData select 0) * (_itemData select 1) * _x); + }forEach (_outcome select 1); + { + _itemData = _bpCheckArray select _forEachIndex; + _money = _money + ( (_itemData select 0) * (_itemData select 1) * _x); + }forEach (_outcome select 2); + }; + + if(typeName _money == "SCALAR") then { + if (Z_SingleCurrency) then { + _success = [player,_money] call SC_fnc_addCoins; + systemChat format["Trade successfull, received %1 %2", _money , CurrencyName]; + } else { + _success = [_money, 0] call Z_returnChange; + systemChat format["Trade successfull."]; + }; + }else{ + systemChat format["Money is not a number. Something went wrong."]; + }; +}else{ + systemChat format["No Items to sell"]; +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf new file mode 100644 index 000000000..b8db00790 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_toBuyingList.sqf @@ -0,0 +1,11 @@ +#include "defines.sqf"; +_index = _this select 0; +_amount = parseNumber(_this select 1); +if(!isNil"_index" && _index > -1 && (typeName _amount == "SCALAR") && _amount > 0 )then { + _temp = Z_BuyableArray select _index; + _temp set [9,(ceil _amount)]; + Z_BuyingArray set [count(Z_BuyingArray),_temp]; + _index2 = lbAdd [Z_AT_BUYINGLIST, format["%1x: %2",_temp select 9,_temp select 3]]; + lbSetPicture [Z_AT_BUYINGLIST, _index2, _temp select 4]; + call Z_calcPrice; +}; diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf new file mode 100644 index 000000000..45be896f6 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/functions/zupa_fnc_removeWeaponsAndMagazinesCargo.sqf @@ -0,0 +1,112 @@ + /* ---------------------------------------------------------------------------- + Examples: + _result = [_backpack, ["SmokeShell","M16_AMMO"],["M16","M16","M240"],["backpack1","backpack2"]] call ZUPA_fnc_removeWeaponsAndMagazinesCargo; + _result == [[1,0,0,1,1,1,0],[1,0,0,1],[1,0]]; // 1 = success, 0 = fail ->( item was not in cargo) + + Author: + Zupa 2014-09-30 + ---------------------------------------------------------------------------- */ +private ["_unit", "_items","_weaps","_normalItems","_normalWeaps", "_count", "_i", "_unit_allItems", "_unit_allItems_types", "_unit_allItems_count", "_item_type", "_item_count", "__returnVar"]; +_unit = _this select 0; +_items = _this select 1; +_weaps = _this select 2; +_bags = []; +if(count _this > 3)then{ + _bags = _this select 3; +}; + +_normalItems = []; +_normalWeaps = []; +_normalBags = []; + +_unit_allItems = getMagazineCargo _unit; // [[type1, typeN, ...],[count1, countN, ...]] +_unit_allItems_types = _unit_allItems select 0; +_unit_allItems_count = _unit_allItems select 1; + +_unit_allWeaps = getWeaponCargo _unit; +_unit_allWeaps_types = _unit_allWeaps select 0; +_unit_allWeaps_count = _unit_allWeaps select 1; + +_unit_allBags = getBackpackCargo _unit; +_unit_allBags_types = _unit_allBags select 0; +_unit_allBags_count = _unit_allBags select 1; + +clearMagazineCargoGlobal _unit; +clearWeaponCargoGlobal _unit; + +if( count _bags > 0 )then{ + clearBackpackCargoGlobal _unit; +}; + +{ + _counter = 0 ; + while{ _counter < ( _unit_allItems_count select _forEachIndex)}do{ + _normalItems set [count(_normalItems),_x]; + _counter = _counter + 1; + }; +}forEach _unit_allItems_types; +{ + _counter = 0 ; + while{ _counter < ( _unit_allWeaps_count select _forEachIndex)}do{ + _normalWeaps set [count(_normalWeaps),_x]; + _counter = _counter + 1; + }; +}forEach _unit_allWeaps_types; +{ + _counter = 0 ; + while{ _counter < ( _unit_allBags_count select _forEachIndex)}do{ + _normalBagss set [count(_normalBags),_x]; + _counter = _counter + 1; + }; +}forEach _unit_allBags_types; + +_returnVar = []; +_returnMag = []; +_returnWeap = []; +_returnBag = []; +{ + _inCargo = _normalItems find _x; + if(_inCargo > -1)then{ + _normalItems set [_inCargo, "soldItem"]; + _returnMag set [count(_returnMag),1]; + }else{ + _returnMag set [count(_returnMag),0]; + }; +}count _items; +_normalItems = _normalItems - ["soldItem"]; +{ + _unit addMagazineCargoGlobal [_x, 1]; +}count _normalItems; + +{ + _inCargo = _normalWeaps find _x; + if(_inCargo > -1)then{ + _normalWeaps set [_inCargo, "soldItem"]; + _returnWeap set [count(_returnWeap),1]; + }else{ + _returnWeap set [count(_returnWeap),0]; + }; +}count _weaps; +_normalWeaps = _normalWeaps - ["soldItem"]; +{ + _unit addWeaponCargoGlobal [_x, 1]; +}count _normalWeaps; + +{ + _inCargo = _normalBags find _x; + if(_inCargo > -1)then{ + _normalBags set [_inCargo, "soldItem"]; + _returnBag set [count(_returnBag),1]; + }else{ + _returnBag set [count(_returnBag),0]; + }; +}count _bags; +_normalWeaps = _normalWeaps - ["soldItem"]; +{ + _unit addBackpackCargoGlobal [_x, 1]; +}count _normalBags; + +_returnVar set [0,_returnMag]; +_returnVar set [1,_returnWeap]; +_returnVar set [2,_returnBag]; +_returnVar diff --git a/SQF/dayz_code/actions/AdvancedTrading/init.sqf b/SQF/dayz_code/actions/AdvancedTrading/init.sqf new file mode 100644 index 000000000..ae0f4fa68 --- /dev/null +++ b/SQF/dayz_code/actions/AdvancedTrading/init.sqf @@ -0,0 +1,90 @@ +disableSerialization; + +Z_traderData = (_this select 3); // gets the trader data ( e.g menu_Functionary1 ) + +if( isNil "Z_traderData" || count (Z_traderData) == 0)exitWith{ + cutText [format["There went something wrong selecting the trader."], "PLAIN DOWN"]; +}; + +if(DZE_ActionInProgress) exitWith { cutText ['There is already an action in progress.' , "PLAIN DOWN"] }; + +if(isNil "Z_AdvancedTradingInit")then{ + + //#include "config.sqf"; + #include "\z\addons\dayz_code\actions\AdvancedTrading\functions\defines.sqf"; + + /* Configs that needs to be defined but not changed in config file */ + Z_Selling = true; + Z_SellingFrom = 2; + Z_vehicle = objNull; + Z_OriginalSellableArray = []; + Z_SellableArray = []; + Z_SellArray = []; + Z_OriginalBuyableArray = []; + Z_BuyableArray = []; + Z_BuyingArray = []; + + if( isNil 'CurrencyName' && Z_SingleCurrency )then{ + CurrencyName = 'Coins'; // fallback + }; + if (!Z_SingleCurrency) then { + CurrencyName = ''; + }; + + /* end script config */ + + KK_fnc_inString = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\KK_fnc_inString.sqf"); + ZUPA_fnc_removeWeaponsAndMagazinesCargo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\zupa_fnc_removeWeaponsAndMagazinesCargo.sqf"); + + Z_filleTradeTitle = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_filleTradeTitle.sqf"); + Z_clearLists = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearLists.sqf"); + Z_clearSellableList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearSellableList.sqf"); + Z_clearBuyList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearBuyList.sqf"); + Z_clearBuyingList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_clearBuyingList.sqf"); + Z_getItemInfo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_getItemInfo.sqf"); + Z_getItemConfig = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_getItemConfig.sqf"); + Z_displayItemInfo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_displayItemInfo.sqf"); + Z_displayWeaponInfo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_displayWeaponInfo.sqf"); + Z_displayBackpackInfo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_displayBackpackInfo.sqf"); + Z_displayVehicleInfo = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_displayVehicleInfo.sqf"); + Z_getContainer = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_getContainer.sqf"); + Z_getBackpackItems = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_getBackpackItems.sqf"); + Z_getVehicleItems = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_getVehicleItems.sqf"); + Z_getGearItems = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_getGearItems.sqf"); + Z_filterList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_filterList.sqf"); + Z_checkArrayInConfig = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_checkArrayInConfig.sqf"); + Z_calcPrice = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcPrice.sqf"); + Z_fillSellList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillSellList.sqf"); + Z_fillSellingList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillSellingList.sqf"); + Z_pushItemToList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_pushItemToList.sqf"); + Z_removeItemFromList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_removeItemFromList.sqf"); + Z_pushAllToList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_pushAllToList.sqf"); + Z_removeAllToList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_removeAllToList.sqf"); + Z_SellItems = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_sellItems.sqf"); + Z_BuyItems = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_buyItems.sqf"); + Z_ChangeBuySell = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_changeBuySell.sqf"); + Z_removeAllFromBuyingList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_removeAllFromBuyingList.sqf"); + Z_removeItemFromBuyingList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_removeItemFromBuyingList.sqf"); + Z_toBuyingList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_toBuyingList.sqf"); + Z_calcBuyableList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcBuyableList.sqf"); + Z_fillBuyableList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillBuyableList.sqf"); + Z_fillBuyingList = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_fillBuyingList.sqf"); + Z_calculateFreeSpace = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calculateFreeSpace.sqf"); + Z_checkCloseVehicle = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_checkCloseVehicle.sqf"); + Z_allowBuying = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_allowBuying.sqf"); + Z_canAfford = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_canAfford.sqf"); + Z_returnChange = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_returnChange.sqf"); + Z_payDefault = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_payDefault.sqf"); + Z_calcDefaultCurrency = compile preprocessFileLineNumbers (Z_AT_FolderLocation + "\functions\z_at_calcDefaultCurrency.sqf"); + + Z_AdvancedTradingInit = true; +}; + +createDialog "AdvancedTrading"; + +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_REMOVESELLITEMBUTTON) ctrlSetText " < "; +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_REMOVEALLSELLITEMBUTTON) ctrlSetText " << "; +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_REMOVEBUYITEMBUTTON) ctrlSetText " < "; +(findDisplay Z_AT_DIALOGWINDOW displayCtrl Z_AT_REMOVEALLBUYITEMBUTTON) ctrlSetText " << "; + +call Z_ChangeBuySell; diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 40a55c771..42677de80 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -927,13 +927,17 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur if (_humanity_logic) then { _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false]; s_player_parts set [count s_player_parts,_cancel]; - } else { + } else { // Static Menu { //diag_log format["DEBUG TRADER: %1", _x]; _buy = player addAction [format["Trade %1 %2 for %3 %4",(_x select 3),(_x select 5),(_x select 2),(_x select 6)], "\z\addons\dayz_code\actions\trade_items_wo_db.sqf",[(_x select 0),(_x select 1),(_x select 2),(_x select 3),(_x select 4),(_x select 5),(_x select 6)], (_x select 7), true, true]; s_player_parts set [count s_player_parts,_buy]; } count (_traderMenu select 1); + if (DZE_advancedTrading) then { + _buyV = player addAction ["Advanced Trading", "\z\addons\dayz_code\actions\AdvancedTrading\init.sqf",(_traderMenu select 0), 999, true, false, "",""]; + s_player_parts set [count s_player_parts,_buyV]; + }; // Database menu _buy = player addAction [localize "STR_EPOCH_PLAYER_289", "\z\addons\dayz_code\actions\show_dialog.sqf",(_traderMenu select 0), 999, true, false]; s_player_parts set [count s_player_parts,_buy]; diff --git a/SQF/dayz_code/configVariables.sqf b/SQF/dayz_code/configVariables.sqf index 8e60ee1a2..ccc98534a 100644 --- a/SQF/dayz_code/configVariables.sqf +++ b/SQF/dayz_code/configVariables.sqf @@ -43,6 +43,16 @@ MaxAmmoBoxes = 3; // Max number of random Supply_Crate_DZE to spawn around the m MaxMineVeins = 50; // Max number of random mine veins to spawn around the map timezoneswitch = 0; // Changes murderMenu times with this offset in hours. DZE_SafeZonePosArray = []; //Prevent players in safeZones from being killed if their vehicle is destroyed. Format is [[[3D POS] RADIUS],[[3D POS] RADIUS]]; Ex. DZE_SafeZonePosArray = [[[6325.6772,7807.7412,0],150],[[4063.4226,11664.19,0],150]]; + +/****** Advanced Trading Variables ***********/ +DZE_advancedTrading = true; //Use advanced trading system. WARNING: set to false if you use database traders, you should use config-traders anyway! +Z_AT_FolderLocation = '\z\addons\dayz_code\actions\AdvancedTrading'; +Z_VehicleDistance = 30; // Distance that a vehicle needs to be to see it's content or to sell it. +Z_SingleCurrency = false; // Does your server use a single currency system. +Z_AllowTakingMoneyFromBackpack = true; // When buying items with DEFAULT CURRENCY to any inventory. Do you allow the trader to take money from your backpack. +Z_AllowTakingMoneyFromVehicle = true; // When buying items with DEFAULT CURRENCY to any inventory. Do you allow the trader to take money from your vehicle. +Z_MoneyVariable = "cashMoney"; // If using a Single currency system, change this to whatever currency you are using. +/**********************************************/ /* Developers: