Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. switch (_index) do {
  2.  
  3. case 0: {
  4. _config = M_CONFIG(getArray,"WeaponShops",_shop,"items");
  5. {
  6. _bool = [_x] call life_fnc_levelCheck;
  7. if (_bool) then {
  8. _itemInfo = [_x select 0] call life_fnc_fetchCfgDetails;
  9. _itemList lbAdd format ["%1",if (!((_x select 1) isEqualTo "")) then {_x select 1} else {_itemInfo select 1}];
  10. _itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
  11. _itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
  12. _itemList lbSetValue[(lbSize _itemList)-1,_x select 2];
  13. };
  14. true
  15. } count _config;
  16.  
  17. ((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
  18. ((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Mags";
  19. ((findDisplay 38400) displayCtrl 38407) ctrlSetText localize "STR_Global_Accs";
  20.  
  21. ctrlShow [38402,true];
  22. ctrlShow [38406,true];
  23. ctrlShow [38407,true];
  24. };
  25.  
  26. case 1: {
  27. _config = [];
  28. private _listedItems = [];
  29. //Go through weapons
  30. if (primaryWeapon player != "") then {_config pushBack primaryWeapon player;};
  31. if (secondaryWeapon player != "") then {_config pushBack secondaryWeapon player;};
  32. if (handgunWeapon player != "") then {_config pushBack handgunWeapon player;};
  33.  
  34. //Go through items
  35. _config = _config + primaryWeaponItems player;
  36. _config = _config + (assignedItems player);
  37. _config = _config + (uniformItems player);
  38. _config = _config + (vestItems player);
  39. _config = _config + (backpackItems player);
  40.  
  41. ((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Sell";
  42. ctrlShow [38402,true];
  43. ctrlShow [38406,false];
  44. ctrlShow [38407,false];
  45.  
  46. private _itemArray = [];
  47. _itemArray pushBack M_CONFIG(getArray,"WeaponShops",_shop,"items");
  48. _itemArray pushBack M_CONFIG(getArray,"WeaponShops",_shop,"mags");
  49. _itemArray pushBack M_CONFIG(getArray,"WeaponShops",_shop,"accs");
  50. {
  51. _y = _x;
  52. {
  53. if (!(_x in _listedItems) && _x != "") then {
  54. _iS = [_x,_y] call TON_fnc_index;
  55. if !(_iS isEqualTo -1) then {
  56. _z = _y select _iS;
  57. if (!((_z select 3) isEqualTo -1)) then {
  58.  
  59. _bool = [_z] call life_fnc_levelCheck;
  60. if (_bool) then {
  61.  
  62. _itemInfo = [_x] call life_fnc_fetchCfgDetails;
  63. _listedItems pushBack _x;
  64.  
  65. _itemCount = {_x == (_itemInfo select 0)} count _config;
  66. if (_itemCount > 1) then {
  67. _itemList lbAdd format ["[%2] %1",_itemInfo select 1,_itemCount];
  68. } else {
  69. _itemList lbAdd format ["%1",_itemInfo select 1];
  70. };
  71. _itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
  72. _itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
  73.  
  74.  
  75. };
  76. };
  77. };
  78. };
  79. true
  80. } count _config;
  81. true
  82. } count _itemArray;
  83. };
  84. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement