Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. /**
  2. * Author; StokesMagee
  3. * Website; www.stokesmagee.net
  4. * Copyright; © 2017 StokesMagee
  5. *
  6. * This work is property of StokesMagee. You do not have permissions to use/edit/distribute any of this content
  7. * without written permission from StokesMagee.
  8. */
  9.  
  10. private["_dialog", "_categoryClasses", "_itemListControl", "_categoryClass", "_categoryVehicleClassNames", "_className", "_salesPrice", "_indexEntryIndex", "_playerMoney", "_quality", "_requiredRespect", "_qualityColor", "_popTabColor", "_missingPopTabs", "_missingRespect"];
  11. disableSerialization;
  12. _dialog = uiNameSpace getVariable ["RscExileVehicleTraderDialog", displayNull];
  13. _categoryClasses = _this;
  14. if (_categoryClasses select 0 == "") then
  15. {
  16. _categoryClasses = getArray(missionConfigFile >> "CfgTraders" >> ExileClientCurrentTrader >> "categories");
  17. };
  18. _itemListControl = _dialog displayCtrl 4001;
  19. lbClear _itemListControl;
  20. {
  21. _categoryClass = _x;
  22. _categoryVehicleClassNames = getArray(missionConfigFile >> "CfgTraderCategories" >> _categoryClass >> "items");
  23. {
  24. _className = _x;
  25. _salesPrice = getNumber(missionConfigFile >> "CfgExileArsenal" >> _className >> "price");
  26. private _displayName = getText(configFile >> "CfgVehicles" >> _className >> "displayName");
  27. if ([_displayName, _className] call SM_TraderPlus_Search) then
  28. {
  29. _indexEntryIndex = _itemListControl lbAdd _displayName;
  30. _playerMoney = player getVariable ["ExileMoney", 0];
  31. _quality = getNumber(missionConfigFile >> "CfgExileArsenal" >> _className >> "quality");
  32. _requiredRespect = getNumber(missionConfigFile >> "CfgTrading" >> "requiredRespect" >> format["Level%1",_quality]);
  33. _qualityColor = [1, 1, 1, 1];
  34. _popTabColor = [1, 1, 1, 1];
  35. switch (_quality) do
  36. {
  37. case 2: { _qualityColor = [0.62, 0.87 ,0.23, 1]; };
  38. case 3: { _qualityColor = [0, 0.78, 0.92, 1]; };
  39. case 4: { _qualityColor = [0.62, 0.27, 0.58, 1]; };
  40. case 5: { _qualityColor = [1, 0.7, 0.09, 1]; };
  41. case 6: { _qualityColor = [0.93, 0, 0.48, 1]; };
  42. };
  43. if (_salesPrice > _playerMoney) then
  44. {
  45. _popTabColor = [0.91, 0, 0, 0.6];
  46. _missingPopTabs = _salesPrice - _playerMoney;
  47. _itemListControl lbSetTooltip [_indexEntryIndex, format["Missing %1 Pop Tabs", _missingPopTabs]];
  48. };
  49. if (_requiredRespect > ExileClientPlayerScore) then
  50. {
  51. _qualityColor set [3, 0.3];
  52. _popTabColor set [3, 0.3];
  53. _missingRespect = _requiredRespect - ExileClientPlayerScore;
  54. _itemListControl lbSetTooltip [_indexEntryIndex, format["Missing %1 Respect", _missingRespect]];
  55. };
  56. if ((_salesPrice > _playerMoney) && (_requiredRespect > ExileClientPlayerScore)) then
  57. {
  58. _itemListControl lbSetTooltip [_indexEntryIndex, format["Missing %1 Pop Tabs & %2 Respect", _missingPopTabs, _missingRespect]];
  59. };
  60.  
  61. private _currentStock = missionNamespace getVariable ["SM_TraderPlus_ItemQuantity:" + _className, getNumber(_arsenalConfig >> _className >> "quantity")];
  62. if (_currentStock == 0) then
  63. {
  64. _itemListControl lbSetTooltip [_indexEntryIndex, format["%1 Out of stock!", endl]];
  65. _popTabColor = [1,0.25,0.25,1];
  66. _itemListControl lbSetTextRight [_indexEntryIndex, "Out of stock"];
  67. }
  68. else
  69. {
  70. _itemListControl lbSetTooltip [_indexEntryIndex, format["%1 in stock!",_currentStock call ExileClient_util_string_exponentToString]];
  71. _itemListControl lbSetTextRight [_indexEntryIndex, _salesPrice call ExileClient_util_string_exponentToString];
  72. };
  73.  
  74. _itemListControl lbSetData [_indexEntryIndex, _className];
  75. _itemListControl lbSetColor [_indexEntryIndex, _qualityColor];
  76. _itemListControl lbSetColorRight [_indexEntryIndex, _popTabColor];
  77. _itemListControl lbSetPictureRightColor [_indexEntryIndex, _popTabColor];
  78. _itemListControl lbSetValue [_indexEntryIndex, _quality * 100000 + _salesPrice];
  79. };
  80. }
  81. forEach _categoryVehicleClassNames;
  82. }
  83. forEach _categoryClasses;
  84. lbSortByValue _itemListControl;
  85. true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement