fn_mainDisplay.sqf 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #include "macro.sqf"
  2. /*
  3. @version: 1.2
  4. @file_name: fn_mainDisplay.sqf
  5. @file_author: TAW_Tonic
  6. @file_edit: 5/31/2013
  7. @file_description: When called, sort the call and display our targeted information.
  8. */
  9. private["_request","_filter","_control","_info"];
  10. waitUntil {!isNull (findDisplay VAS_Main_Display)};
  11. disableSerialization;
  12. _request = _this select 0;
  13. _filter = _this select 1;
  14. [_request] call VAS_fnc_filterShow;
  15. lbClear VAS_getControl(VAS_Main_Display,VAS_virt_list);
  16. lbClear VAS_getControl(VAS_Main_Display,VAS_unit_list);
  17. uiNamespace setVariable["VAS_UI_FILTER",_request];
  18. if(_filter && !isNil {(uiNamespace getVariable "VAS_UI_FILTER_VAR")}) exitWith
  19. {
  20. [(uiNamespace getVariable "VAS_UI_FILTER_VAR")] spawn VAS_fnc_filterMenu;
  21. };
  22. uiNamespace setVariable["VAS_UI_FILTER_VAR",nil];
  23. switch (_request) do
  24. {
  25. case "guns":
  26. {
  27. _control = VAS_getControl(VAS_Main_Display,VAS_virt_list);
  28. _info = ["guns"] call VAS_fnc_fetchCfg;
  29. {
  30. _details = [_x,"CfgWeapons"] call VAS_fnc_fetchCfgDetails;
  31. if(count _details > 0) then
  32. {
  33. _control lbAdd format["%1", (_details select 1)]; //Displayname on list
  34. _control lbSetData [(lbSize _control)-1,(_details select 0)]; //Data for index is classname
  35. _control lbSetValue [(lbSize _control)-1,(_details select 4)]; //Value for index is type
  36. _control lbSetPicture [(lbSize _control)-1,(_details select 2)];
  37. };
  38. } foreach _info;
  39. _control = VAS_getControl(VAS_Main_Display,VAS_unit_list);
  40. _info = [([] call VAS_fnc_fetchPlayerGear),[1,2,4,5,4096]] call VAS_fnc_filter;
  41. {
  42. _details = [_x,"CfgWeapons"] call VAS_fnc_fetchCfgDetails;
  43. if(count _details > 0) then
  44. {
  45. _control lbAdd format["%1", (_details select 1)]; //Displayname on list
  46. _control lbSetData [(lbSize _control)-1,(_details select 0)]; //Data for index is classname
  47. _control lbSetValue [(lbSize _control)-1,(_details select 4)]; //Value for index is type
  48. _control lbSetPicture [(lbSize _control)-1,(_details select 2)];
  49. };
  50. } foreach _info;
  51. };
  52. case "mags":
  53. {
  54. _control = VAS_getControl(VAS_Main_Display,VAS_virt_list);
  55. _info = ["mags"] call VAS_fnc_fetchCfg;
  56. {
  57. _details = [_x,"CfgMagazines"] call VAS_fnc_fetchCfgDetails;
  58. if(count _details > 0) then
  59. {
  60. _control lbAdd format["%1", (_details select 1)]; //Displayname on list
  61. _control lbSetData [(lbSize _control)-1,(_details select 0)]; //Data for index is classname
  62. _control lbSetPicture [(lbSize _control)-1,(_details select 2)];
  63. };
  64. } foreach _info;
  65. _control = VAS_getControl(VAS_Main_Display,VAS_unit_list);
  66. _info = [([] call VAS_fnc_fetchPlayerGear),"mag"] call VAS_fnc_filter;
  67. private["_mags","_mag"];
  68. _mags = [];
  69. {
  70. _details = [_x,"CfgMagazines"] call VAS_fnc_fetchCfgDetails;
  71. if(count _details > 0) then
  72. {
  73. if(!(_x in _mags)) then
  74. {
  75. _mags set[count _mags,_x];
  76. _mag = _x;
  77. _control lbAdd format["[%1] %2",({_x == _mag} count _info),(_details select 1)]; //Displayname on list
  78. _control lbSetData [(lbSize _control)-1,(_details select 0)]; //Data for index is classname
  79. _control lbSetPicture [(lbSize _control)-1,(_details select 2)];
  80. };
  81. };
  82. } foreach _info;
  83. };
  84. case "items":
  85. {
  86. _control = VAS_getControl(VAS_Main_Display,VAS_virt_list);
  87. _info = ["items"] call VAS_fnc_fetchCfg;
  88. {
  89. _details = [_x,"CfgWeapons"] call VAS_fnc_fetchCfgDetails;
  90. if(count _details > 0) then
  91. {
  92. _control lbAdd format["%1", (_details select 1)]; //Displayname on list
  93. _control lbSetData [(lbSize _control)-1,(_details select 0)]; //Data for index is classname
  94. _control lbSetValue [(lbSize _control)-1,(_details select 4)]; //Value for index is type
  95. _control lbSetPicture [(lbSize _control)-1,(_details select 2)];
  96. };
  97. } foreach _info;
  98. _control = VAS_getControl(VAS_Main_Display,VAS_unit_list);
  99. _info = [([] call VAS_fnc_fetchPlayerGear),"items"] call VAS_fnc_filter;
  100. {
  101. _details = [_x,"CfgWeapons"] call VAS_fnc_fetchCfgDetails;
  102. if(count _details > 0) then
  103. {
  104. _control lbAdd format["%1", (_details select 1)]; //Displayname on list
  105. _control lbSetData [(lbSize _control)-1,(_details select 0)]; //Data for index is classname
  106. _control lbSetValue [(lbSize _control)-1,(_details select 4)]; //Value for index is type
  107. _control lbSetPicture [(lbSize _control)-1,(_details select 2)];
  108. };
  109. } foreach _info;
  110. };
  111. case "packs":
  112. {
  113. _control = VAS_getControl(VAS_Main_Display,VAS_virt_list);
  114. _info = ["packs"] call VAS_fnc_fetchCfg;
  115. {
  116. _details = [_x,"CfgVehicles"] call VAS_fnc_fetchCfgDetails;
  117. if(count _details > 0) then
  118. {
  119. _control lbAdd format["%1", (_details select 1)]; //Displayname on list
  120. _control lbSetData [(lbSize _control)-1,(_details select 0)]; //Data for index is classname
  121. _control lbSetPicture [(lbSize _control)-1,(_details select 2)];
  122. };
  123. } foreach _info;
  124. _control = VAS_getControl(VAS_Main_Display,VAS_unit_list);
  125. _info = [([] call VAS_fnc_fetchPlayerGear),"packs"] call VAS_fnc_filter;
  126. {
  127. _details = [_x,"CfgVehicles"] call VAS_fnc_fetchCfgDetails;
  128. if(count _details > 0) then
  129. {
  130. _control lbAdd format["%1", (_details select 1)]; //Displayname on list
  131. _control lbSetData [(lbSize _control)-1,(_details select 0)]; //Data for index is classname
  132. _control lbSetPicture [(lbSize _control)-1,(_details select 2)];
  133. };
  134. } foreach _info;
  135. };
  136. case "glass":
  137. {
  138. _control = VAS_getControl(VAS_Main_Display,VAS_virt_list);
  139. _info = ["glass"] call VAS_fnc_fetchCfg;
  140. {
  141. _details = [_x,"CfgGlasses"] call VAS_fnc_fetchCfgDetails;
  142. if(count _details > 0) then
  143. {
  144. _control lbAdd format["%1", (_details select 1)]; //Displayname on list
  145. _control lbSetData [(lbSize _control)-1,(_details select 0)]; //Data for index is classname
  146. _control lbSetPicture [(lbSize _control)-1,(_details select 2)];
  147. };
  148. } foreach _info;
  149. _control = VAS_getControl(VAS_Main_Display,VAS_unit_list);
  150. _info = [([] call VAS_fnc_fetchPlayerGear),"glass"] call VAS_fnc_filter;
  151. {
  152. _details = [_x,"CfgGlasses"] call VAS_fnc_fetchCfgDetails;
  153. if(count _details > 0) then
  154. {
  155. _control lbAdd format["%1", (_details select 1)]; //Displayname on list
  156. _control lbSetData [(lbSize _control)-1,(_details select 0)]; //Data for index is classname
  157. _control lbSetPicture [(lbSize _control)-1,(_details select 2)];
  158. };
  159. } foreach _info;
  160. };
  161. };