Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_retrievePrices.sqf
  4. Author: Derek
  5. Description:
  6. Searches through the economy public variables to locate the correct ones
  7. */
  8. private["_market","_priceArray","_varname","_itemArray","_shopItems"];
  9. params [
  10. ["_type", 0],
  11. ["_data", ""]
  12. ];
  13.  
  14. if ( _data isEqualTo "") exitWith {diag_log "Shoptype is null";};
  15.  
  16. _itemArray = [];
  17.  
  18. switch (_data) do {
  19. case "economy" :{
  20. _market = missionNamespace getVariable "MarketPrices";
  21. {
  22. _name = (_x select 0);
  23. _fact = (_x select 1);
  24. if (_fact != 0) then {
  25. _varname = format["%1MarketGoodPrice",_name];
  26. _priceArray = missionNamespace getVariable (_varname);
  27. _itemArray pushBack _priceArray;
  28. };
  29. } forEach _market;
  30. };
  31. default {
  32. _shopItems = M_CONFIG(getArray,"VirtualShops",_data, "items");
  33. if ((LIFE_SETTINGS(getNumber, "dynamic_market")) isEqualTo 1) then {
  34. {
  35. _varname = format["%1MarketGoodPrice",_x];
  36. _priceArray = missionNamespace getVariable (_varname);
  37. _itemArray pushBack _priceArray;
  38. } forEach _shopItems;
  39. } else {
  40. {
  41. _itemArray pushBack [_x, ITEM_BUYPRICE(_x), ITEM_SELLPRICE(_x)];
  42. } forEach _shopItems;
  43. };
  44. };
  45. };
  46.  
  47. if (_data isEqualTo "economy") exitwith {[_type,_itemArray] spawn life_fnc_updateEconomy};
  48. [_type,_itemArray] spawn life_fnc_updatePrice;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement