fn_buildConfig.sqf 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. @version: 1.0
  3. @file_name: build_config.sqf
  4. @file_author: TAW_Tonic
  5. @file_edit: 5/9/2013
  6. @file_description: If preload is enabled, it will build our preloaded config, otherwise fetches everything from the config.
  7. */
  8. private["_cfg","_type","_temp","_ret","_master","_class","_details","_displayName","_scope","_type","_str","_itemInfo"];
  9. _cfg = _this select 0;
  10. if(VAS_preload) then
  11. {
  12. if(!isNil {VAS_pre_weapons} && !isNil {VAS_pre_magazines} && !isNil {VAS_pre_items} && !isNil {VAS_pre_backpacks} && !isNil {VAS_pre_glasses}) exitWith { hint "Ended."; }; //Exit since preload is completed and shouldn't be called again.
  13. //If it is called again then why is that? Are you not happy with what I supplied you? I supplied you with wonderful candy! Y U NO LIKE MY CANDY?!?!?
  14. };
  15. switch(_cfg) do
  16. {
  17. case "CfgWeapons":
  18. {
  19. _temp = [];
  20. _ret = [];
  21. _ret2 = [];
  22. _master = configFile >> _cfg;
  23. private["_base","_ret2"];
  24. for "_i" from 0 to (count _master)-1 do
  25. {
  26. _class = _master select _i;
  27. if(isClass _class) then
  28. {
  29. _class = configName _class;
  30. _details = [_class,_cfg] call VAS_fnc_fetchCfgDetails;
  31. _displayName = _details select 1;
  32. _picture = _details select 2;
  33. _scope = _details select 3;
  34. _type = _details select 4;
  35. _base = configName(inheritsFrom (configFile >> "CfgWeapons" >> _class));
  36. //diag_log format["DEBUG - %1 :: %2",_class,_base];
  37. if(_scope >= 2 && _type in [1,2,4,5,4096,131072] && _picture != "" && !(_displayName in _temp) && _displayName != "") then
  38. {
  39. _str = [_class,4] call KRON_StrLeft;
  40. if(_type in [131072,4096] && (_details select 5) != -1) then
  41. {
  42. if(_str != "ACRE" && !(_class in VAS_r_items)) then
  43. {
  44. _temp set[count _temp,_displayName];
  45. _ret2 set[count _ret2,_class];
  46. };
  47. }
  48. else
  49. {
  50. if(_str != "ACRE" && !(_base in VAS_r_weapons) && !(_class in VAS_r_weapons)) then
  51. {
  52. _temp set[count _temp,_displayName];
  53. _ret set[count _ret,_class];
  54. };
  55. };
  56. };
  57. };
  58. };
  59. VAS_pre_weapons = _ret;
  60. VAS_pre_items = _ret2;
  61. };
  62. case "CfgMagazines":
  63. {
  64. _temp = [];
  65. _ret = [];
  66. _master = configFile >> _cfg;
  67. for "_i" from 0 to (count _master)-1 do
  68. {
  69. _class = _master select _i;
  70. if(isClass _class) then
  71. {
  72. _class = configName _class;
  73. _details = [_class,_cfg] call VAS_fnc_fetchCfgDetails;
  74. _displayName = _details select 1;
  75. _picture = _details select 2;
  76. _scope = _details select 3;
  77. if(_scope >= 1 && _picture != "" && !(_displayName in _temp)) then
  78. {
  79. _str = [_class,4] call KRON_StrLeft;
  80. if(_str != "ACRE" && !(_class in VAS_R_magazines)) then
  81. {
  82. _temp set[count _temp,_displayName];
  83. _ret set[count _ret,_class];
  84. };
  85. };
  86. };
  87. };
  88. VAS_pre_magazines = _ret;
  89. };
  90. case "CfgVehicles":
  91. {
  92. _ret = [];
  93. _master = configFile >> _cfg;
  94. private["_base"];
  95. for "_i" from 0 to (count _master)-1 do
  96. {
  97. _class = _master select _i;
  98. if(isClass _class) then
  99. {
  100. _class = configName _class;
  101. _details = [_class,_cfg] call VAS_fnc_fetchCfgDetails;
  102. _displayName = _details select 1;
  103. _picture = _details select 2;
  104. _scope = _details select 3;
  105. _type = _details select 4;
  106. _base = inheritsFrom (configFile >> _cfg >> _class);
  107. if(_scope >= 2 && _type == "Backpacks" && _picture != "") then
  108. {
  109. _str = [_class,4] call KRON_StrLeft;
  110. if(_str != "ACRE" && !(_base in VAS_r_backpacks) && !(_class in VAS_r_backpacks)) then
  111. {
  112. _ret set[count _ret,_class];
  113. };
  114. };
  115. };
  116. };
  117. VAS_pre_backpacks = _ret;
  118. };
  119. case "CfgGlasses":
  120. {
  121. _temp = [];
  122. _ret = [];
  123. _master = configFile >> _cfg;
  124. for "_i" from 0 to (count _master)-1 do
  125. {
  126. _class = _master select _i;
  127. if(isClass _class) then
  128. {
  129. _class = configName _class;
  130. _details = [_class,_cfg] call VAS_fnc_fetchCfgDetails;
  131. _displayName = _details select 1;
  132. _picture = _details select 2;
  133. if(_picture != "" && _displayName != "None" && !(_displayName in _temp)) then
  134. {
  135. _str = [_class,4] call KRON_StrLeft;
  136. if(_str != "ACRE" && !(_class in VAS_r_glasses)) then
  137. {
  138. _temp set[count _temp,_displayName];
  139. _ret set[count _ret,_class];
  140. };
  141. };
  142. };
  143. };
  144. VAS_pre_glasses = _ret;
  145. };
  146. };