Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Main configuration for non-persistent market system
- Will need triggers to hook into vanilla pricing methods
- Edited by: Lukas "Alduin86"
- */
- ////////////MAIN CONFIG
- private["_silberPrice","_goldPrice","_queryResult","_query","_item","_itemprice","_oilpPrice","_coalrPrice","_iron_rPrice","_diamondcPrice","_copper_rPrice","_salt_rPrice","_glassPrice","_cementPrice","_turtlePrice","_marijuanaPrice","_cocainepPrice","_heroinpPrice","_goldbarPrice","_methb_Price","_methn_Price"];
- _query = format["SELECT resource, price FROM resources"];
- waitUntil{sleep (random 0.3); !DB_Async_Active};
- _queryResult = [_query,2,true] call DB_fnc_asyncCall;
- _rows = call compile format["%1",_queryResult]; //compile data
- diag_log "------------- Market Query Request -------------";
- diag_log format["Query: %1",_query];
- diag_log format["Result: %1",_rows];
- diag_log "------------------------------------------------";
- //* _rows should look like this now: [["oilp","1000"],["diamond","2000"]];
- {
- _item = (_x select 0); //on the first run = "oilp", second run = "diamond")
- _itemprice = (_x select 1); //on the first run = "1000", second run = "2000") //* Note: _price is a STRING now!
- diag_log format["%1-price %2 generated",_item,_itemprice];
- if(_item == "oilp") then {_oilpPrice = _itemprice}; // The right price should be assigned
- if(_item == "iron_r") then {_iron_rPrice = _itemprice}; // The right price should be assigned
- if(_item == "diamondc") then {_diamondcPrice = _itemprice}; // The right price should be assigned
- if(_item == "copper_r") then {_copper_rPrice = _itemprice}; // The right price should be assigned
- if(_item == "salt_r") then {_salt_rPrice = _itemprice}; // The right price should be assigned
- if(_item == "glass") then {_glassPrice = _itemprice}; // The right price should be assigned
- if(_item == "cement") then {_cementPrice = _itemprice}; // The right price should be assigned
- if(_item == "turtle") then {_turtlePrice = _itemprice}; // The right price should be assigned
- if(_item == "marijuana") then {_marijuanaPrice = _itemprice}; // The right price should be assigned
- if(_item == "cocainep") then {_cocainepPrice = _itemprice}; // The right price should be assigned
- if(_item == "heroinp") then {_heroinpPrice = _itemprice}; // The right price should be assigned
- if(_item == "goldbar") then {_goldbarPrice = _itemprice}; // The right price should be assigned
- if(_item == "coalr") then {_coalrPrice = _itemprice}; // The right price should be assigned
- if(_item == "gold") then {_goldPrice = _itemprice}; // The right price should be assigned
- if(_item == "silber") then {_silberPrice = _itemprice}; // The right price should be assigned
- if(_item == "methb") then {_methb_Price = _itemprice}; // The right price should be assigned
- if(_item == "methn") then {_methn_Price = _itemprice}; // The right price should be assigned
- } forEach _rows;
- life_market_resources = [
- //Schema: SHORTNAME, DEFAULT-WERT, MIN-WERT, MAX-WERT, VERÄNDERUNG BEI AKTION [VERKAUF Multipliziert mit 1, Kauf multipliziert um -1
- ///////////////////////////////////
- //Edel
- ///////////////////////////////////
- ["diamondc", _diamondcPrice, 2678, 5357, 3, 1,
- [
- ["gold",1],
- ["silber",1]
- ]
- ],
- ["gold", _goldPrice, 1200, 6300, 2, 2,
- [
- ["diamondc",1],
- ["silber",1]
- ]
- ],
- ["silber", _silberPrice, 1200, 6300, 2, 2,
- [
- ["diamondc",1],
- ["gold",1]
- ]
- ],
- ///////////////////////////////////
- //Metalle
- ///////////////////////////////////
- ["coalr", _coalrPrice, 1000, 2000, 3, 1,
- [
- ["copper_r",1],
- ["iron_r",1]
- ]
- ],
- ["iron_r", _iron_rPrice, 3333, 6666, 3, 1,
- [
- ["copper_r",1],
- ["coalr",1]
- ]
- ],
- ["copper_r", _copper_rPrice, 1339, 3571, 3, 1,
- [
- ["iron_r",1],
- ["coalr",1]
- ]
- ],
- ///////////////////////////////////
- //Bank
- ///////////////////////////////////
- ["goldbar", _goldbarPrice, 95000, 95000, 0, 0,
- [
- ]
- ],
- ///////////////////////////////////
- //Bla
- ///////////////////////////////////
- ["oilp", _oilpPrice, 500, 6300, 3, 1,
- [
- ["salt_r",1],
- ["cement",1],
- ["glass",1]
- ]
- ],
- ["salt_r", _salt_rPrice, 1200, 3350, 3, 1,
- [
- ["oilp",1],
- ["cement",1],
- ["glass",1]
- ]
- ],
- ["glass", _glassPrice, 1785, 4464, 3, 1,
- [
- ["oilp",1],
- ["salt_r",1],
- ["cement",1]
- ]
- ],
- ["cement", _cementPrice, 2666, 6666, 3, 1,
- [
- ["oilp",1],
- ["salt_r",1],
- ["glass",1]
- ]
- ],
- ///////////////////////////////////
- //Illegal
- ///////////////////////////////////
- ["turtle", _turtlePrice, 10000, 10000, 0, 0,
- [
- ]
- ],
- ["marijuana", _marijuanaPrice, 4464, 8035,4, 2,
- [
- ["methn",1],
- ["methb",1],
- ["cocainep",1],
- ["heroinp",1]
- ]
- ],
- ["cocainep", _cocainepPrice, 4464, 8928, 4, 2,
- [
- ["methn",1],
- ["methb",1],
- ["marijuana",1],
- ["heroinp",1]
- ]
- ],
- ["methb", _methb_Price, 6400, 10028, 4, 2,
- [
- ["methn",1],
- ["marijuana",1],
- ["heroinp",1],
- ["cocainep",1]
- ]
- ],
- ["methn", _methn_Price, 4244, 9299, 4, 2,
- [
- ["methb",1],
- ["marijuana",1],
- ["heroinp",1],
- ["cocainep",1]
- ]
- ],
- ["heroinp", _heroinpPrice, 3571, 7142, 4, 2,
- [
- ["methn",1],
- ["methb",1],
- ["marijuana",1],
- ["cocainep",1]
- ]
- ]
- ];
- publicVariable "life_market_resources";
- diag_log "------------- Life Market Resources -------------";
- diag_log format["Result: %1",life_market_resources];
- diag_log "------------------------------------------------";
- life_market_shortnames = [];
- {
- life_market_shortnames set [count life_market_shortnames, _x select 0];
- }
- foreach life_market_resources;
- publicVariable "life_market_shortnames";
- life_market_prices = [];
- {
- life_market_prices set [count life_market_prices, [_x select 0, _x select 1, 0, 0] ];
- }
- foreach life_market_resources;
- publicVariable "life_market_prices";
- systemChat "Market Prices Generated!";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement