fn_fetchCfg.sqf 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. @version: 1.0
  3. @file_name: fetch_config.sqf
  4. @file_author: TAW_Tonic
  5. @file_edit: 5/9/2013
  6. @file_description: Fetch information from either binConfig or VAS Config
  7. */
  8. private["_request","_filter","_list"];
  9. _request = _this select 0;
  10. _filter = if(isNil {_this select 1}) then {nil} else {_this select 1}; //Need to handle this so it doesn't throw an error.
  11. switch(_request) do
  12. {
  13. case "guns":
  14. {
  15. if(count VAS_weapons > 0) then
  16. {
  17. if(!isNil {_filter}) then
  18. {
  19. _list = [VAS_weapons,_filter] call VAS_fnc_filter;
  20. }
  21. else
  22. {
  23. _list = VAS_weapons;
  24. };
  25. }
  26. else
  27. {
  28. if(isNil {VAS_pre_weapons}) then {["CfgWeapons"] call VAS_fnc_buildConfig;};
  29. if(!isNil {_filter}) then
  30. {
  31. _list = [VAS_pre_weapons,_filter] call VAS_fnc_filter;
  32. }
  33. else
  34. {
  35. _list = VAS_pre_weapons;
  36. };
  37. };
  38. };
  39. case "mags":
  40. {
  41. if(count VAS_magazines > 0) then
  42. {
  43. _list = VAS_magazines;
  44. }
  45. else
  46. {
  47. if(isNil {VAS_pre_magazines}) then {["CfgMagazines"] call VAS_fnc_buildConfig;};
  48. _list = VAS_pre_magazines;
  49. };
  50. };
  51. case "items":
  52. {
  53. if(count VAS_items > 0) then
  54. {
  55. if(!isnil {_filter}) then
  56. {
  57. _list = [VAS_items,_filter] call VAS_fnc_filter;
  58. }
  59. else
  60. {
  61. _list = VAS_items;
  62. };
  63. }
  64. else
  65. {
  66. if(isNil {VAS_pre_items}) then {["CfgWeapons"] call VAS_fnc_buildConfig;};
  67. if(!isNil {_filter}) then
  68. {
  69. _list = [VAS_pre_items,_filter] call VAS_fnc_filter;
  70. }
  71. else
  72. {
  73. _list = VAS_pre_items;
  74. };
  75. };
  76. };
  77. case "packs":
  78. {
  79. if(count VAS_backpacks > 0) then
  80. {
  81. _list = VAS_backpacks;
  82. }
  83. else
  84. {
  85. if(isNil {VAS_pre_backpacks}) then {["CfgVehicles"] call VAS_fnc_buildConfig;};
  86. _list = VAS_pre_backpacks;
  87. };
  88. };
  89. case "glass":
  90. {
  91. if(count VAS_glasses > 0) then
  92. {
  93. _list = VAS_glasses;
  94. }
  95. else
  96. {
  97. if(isNil {VAS_pre_glasses}) then {["CfgGlasses"] call VAS_fnc_buildConfig;};
  98. _list = VAS_pre_glasses;
  99. };
  100. };
  101. };
  102. _list;