--
-- Mod: FS19_RealLifeNumbers by Kaj-Aage Henneberg "Ki", ArmChairFarming
-- Script: RealNumbersCommodityPrices by Kaj-Aage Henneberg "Ki", ArmChairFarming
-- e-mail: kaj-aage.henneberg@outlook.dk
-- Download: www.modhoster.com
-- All rights reserved.
-- Version 1.1.4.0
-- 30.11.2018 - 29.06.2019

-- Names for FillTypes

-- WHEAT BARLEY OAT CANOLA SUNFLOWER SOYBEAN MAIZE POTATO SUGARBEET OILSEEDRADISH
-- MANURE SEEDS FORAGE FORAGE_MIXING CHAFF WOODCHIPS SILAGE
-- STRAW GRASS_WINDROW DRYGRASS_WINDROW SUGARCANE FERTILIZER PIGFOOD LIME
-- WOOL TREESAPLINGS EGG
-- MILK FUEL WATER DIESEL DEF
-- LIQUIDFERTILIZER HERBICIDE
-- CHAFF GRASS_WINDROW
-- LIQUIDMANURE DIGESTATE
-- COW_TYPE_BRAHMAN_GREY COW_TYPE_BRAHMAN_LIGHT_BROWN COW_TYPE_BRAHMAN_WHITE
-- COW_TYPE_BRAHMAN_BROWN COW_TYPE_BROWN COW_TYPE_BROWN_WHITE COW_TYPE_BLACK
-- COW_TYPE_BLACK_WHITE
-- SHEEP_TYPE_WHITE SHEEP_TYPE_BROWN SHEEP_TYPE_BLACK_WHITE SHEEP_TYPE_BLACK
-- PIG_TYPE_RED PIG_TYPE_WHITE PIG_TYPE_BLACK_WHITE PIG_TYPE_BLACK
-- CHICKEN_TYPE_BLACK CHICKEN_TYPE_WHITE CHICKEN_TYPE_BROWN CHICKEN_TYPE_ROOSTER

--[[

	Version 1.1

	More fillTypes have been included.

Commodity prices

Farmland

	Price per hectar (farmland) is obtained from EUROSTAT for different EU countries.
	FS19 operates with two areas (1) farmland area and (2) field area. When a field is bought, you buy a larger piece of land, the farmland.
	The field area is only the area tillaged for crop growth. The purchase price for the ntire farmland is the pricePerHa * farmlandArea. The
	in-game mission page will give information about field area, but not the farmland are. To get information about both use the script
	RealNumbersFieldInfo included in this mod. To use it press ,LeftAlt-rf. Information is printed to the log file.

Fuel

	Fuel and diesel: National averagage values.

Seed

	Seed price is calculated as follow. From the US department of agriculture (USDA) statistical service seed prices were collected as national
	average values (2010 - 2014) for spring wheat, winter wheat, barley, oat, sunflower, soybean, and maize, and scaled to $/100 kg. For each crop, these numbers were
	multiplied by the seed usage for that crop to calculate the $/ha for each crop. Adding up the seed cost for each crop gives the seed cost for
	1 ha of each crop. The seed usage for each crop was converted from mass to volume by dividing the mass amount per ha by 50% of the fresh crop
	mass density (assuming that seeds contain less water than fresh crop). Dividing the total seed cost by the total seed volume gives the
	seed price per liter. Dividing the total seed mass by the total seed volume gives a seed density. Potatoes have been excluded from this calulation
	because seed usage and seed density for potatoes differs significantly from grain type seeds and would bias the result heavily toward potatoes.

	Seed price: 0.3626 $/liter (default ingame: 0.3 pricePerLiter)
	Seed density: 0.3207 kg/Liter (default ingame: 0.35 massPerLiter)

Spray types

	Fertilizer prices are averaged prices over several NPK type fertilizers, as different countries use different NPK mix.

	Liquid fertilizer: data are not published by EUROSTAT or USDA. Default in-game values are used.

	Lime data are only available as US national averages. US values are also used for EU.

	Herbicide data are only available as US national averages. US values are also used for EU.

Feed

	There are no straw prices at USDA. The average value for EU is used.

	Hay prices are purchase pricess for EU and Sell prices for US.

	Pig food prices is an average over a variety of complete feed types

Final comments

	Some price parameters have not been changed yet, as I have not been able to find the tables, in which
	they are stored:

	Annual loan interest is 100 percent by defult. This is much too high. Less than 5-8 % is more realistic.
	Helper salery is very high. Should be 8 - 12 €/hour in some countries.

	Animal buy and sell prices are defined in the script RealNumbersAnimalTradePrices also included in this mod.

]]--


RealNumbersCommodityPrices = {};

function myPrintShopInfo(Category, textWidth1, itemName, textWidth2, itemId, itemVolume, itemUnit, itemPrice, currency)
	local text1 = Category..string.rep(" ",textWidth1-string.len(Category));
	local text2 = itemName..string.rep(" ",textWidth2-string.len(itemName));
	print(string.format("%s %s Id : %4.0f, %6.0f %s, %8.2f %s", text1, text2, itemId, itemVolume, itemUnit, itemPrice, currency));
end;

function RealNumbersCommodityPrices:loadMap(name)
	local currency = "€";	-- or  "$" or "£"
    local textWidth = 40; 	-- text width in log file
    local iFillType = 0;
	local storeObject = 0;
	local Item = "Empty";
	local idx = 0;
	local price = 0;
	local pricePerHa = 0;
	local massScale = 1000;
	local randomness = 1; 			--1: on, 0: off
	local isDebug = RN.isDebug;  	-- Change to False when not debugging

	local Commodity = RN.commodity;
	local commodityDensity = RN.commodityDensity;
	local commodityPricePer100kg = RN.commodityPricePer100kg;
	local randomPriceFactor = 1;
	local roundBales = RN.roundBales;
	local roundBaleMass = RN.roundBaleMass;
	local roundBaleVolume = RN.roundBaleVolume;
	local roundBalePricePer100kg = RN.roundBalePricePer100kg;
	local squareBales = RN.squareBales;
	local squareBaleMass = RN.squareBaleMass;
	local squareBaleVolume = RN.squareBaleVolume;
	local squareBalePricePer100kg = RN.squareBalePricePer100kg;
	local organicMaterials = RN.organicMaterials;
	local organicPrices = RN.organicPrices;


	local liqfertDilutionFactor = RN.liqfertDilutionFactor;						-- 1 Liter of liquid fertilizer is diluted to 20 liters of solution
	local herbicideDilutionFactor = RN.herbicideDilutionFactor;					-- 1 liter of herbicide is diluted to 200 liters of solution
	local gameMoneyUnit = g_i18n.moneyUnit;
	local volumeUnit = "L";

	if gameMoneyUnit == 1 then
        currency = "€";
	elseif gameMoneyUnit == 2 then
        currency = "$";
	elseif gameMoneyUnit == 3 then
        currency = "£";
	end;
	RN.fieldPriceList = {};
	RN.fieldStatus = {};														-- For sale, For rent, Owned, Rented
	RN.sprayCost = {};
	RN.sprayPrice = {};
	RN2.pricePerLiter = {};
	RN2.massPerLiter = {};

	for k = 1, 200 do
		RN.fieldPriceList[k] = RN.pricePerHa;									-- list of purchase prices per hectare
		RN.fieldStatus[k] = " For sale";
	end;
	for k = 1, #RN.rentedFields do
		RN.fieldPriceList[RN.rentedFields[k]] = RN.rentPricePerHa; 				-- overwrite purchase prices with rent prices on rentable field
		RN.fieldStatus[RN.rentedFields[k]] = " For rent";
	end;


	print("\nFS19_RealLifeNumbers: RealNumbersCommodityPrices active\n")

-- Interest rate

	if isDebug then
		myPrint("Annual interest rate", RN.annualLoanInterest,textWidth,"%");
		myPrint("Max loan", RN.loanMax,textWidth,currency);
		end;

-- Farmland

	g_farmlandManager.pricePerHa = RN.pricePerHa;  -- set new value value
	local pricePerHa = g_farmlandManager.pricePerHa;  -- read new value
	if isDebug then
		myPrint("Farmland purchase price Per Ha", pricePerHa,textWidth,currency.."/ha");
		myPrint("Farmland rent price Per Ha", RN.rentPricePerHa,textWidth,currency.."/ha");
		print(" ");
	end;

--	local fillTypeCategoryGroup = g_currentMission.fillTypeManager:getFillTypesByCategoryNames("FARMSILO");
--	for i, v in pairs(g_currentMission.fillTypeManager.fillTypes) do
	local fillTypeName = RN.commodityName;
	for i, fillType in pairsByKeys(fillTypeName) do
		randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
		local iFillType = g_currentMission.fillTypeManager:getFillTypeIndexByName(fillType);
		if iFillType ~= nil then		-- do only if the fillType is included in the map?

			local fillName = tostring(g_currentMission.fillTypeManager.fillTypes[iFillType].name);
			RN2.pricePerLiter[fillName] = randomPriceFactor * g_currentMission.fillTypeManager.fillTypes[iFillType].pricePerLiter;
			g_currentMission.fillTypeManager.fillTypes[iFillType].pricePerLiter = RN2.pricePerLiter[fillName];
			RN2.massPerLiter[fillName] = massScale * g_currentMission.fillTypeManager.fillTypes[iFillType].massPerLiter;
			if RN.commodityName[fillName] ~= nil then		-- the file type is defined in the mod
				local price = 0;
				if fillName == "HERBICIDE" then
					price = RN.commodityDensity[fillName] * RN.commodityPricePer100kg[fillName] / (RN.herbicideDilutionFactor * 100); -- price/L
				elseif fillName == "LIQUIDFERTILIZER" then
					price = RN.commodityDensity[fillName] * RN.commodityPricePer100kg[fillName] / (RN.liqfertDilutionFactor * 100); -- price/L
				else
					price = RN.commodityDensity[fillName] * RN.commodityPricePer100kg[fillName] / 100; -- price/L
				end;
				g_currentMission.fillTypeManager.fillTypes[iFillType].pricePerLiter = randomPriceFactor * price;
				g_currentMission.fillTypeManager.fillTypes[iFillType].massPerLiter = RN.commodityDensity[fillName]/massScale; --T/L
				RN2.pricePerLiter[fillName] = randomPriceFactor * price;
				RN2.massPerLiter[fillName] = RN.commodityDensity[fillName];
			end;

			if isDebug then
				myPrint(fillName.." fillTypeIndex",iFillType,textWidth," ");
				myPrintFloat(fillName.." massPerLiter",RN2.massPerLiter[fillName],textWidth," kg/L");
				myPrintFloat("RandomPriceFactor",randomPriceFactor,textWidth," ");
				if fillName == "HERBICIDE" then
					myPrint(fillName.." price (diluted)",1000 * RN2.pricePerLiter[fillName],textWidth,currency.."/1000 L");
				elseif fillName == "LIQUIDFERTILIZER" then
					myPrint(fillName.." price (diluted)",1000 * RN2.pricePerLiter[fillName],textWidth,currency.."/1000 L");
				else
					myPrint(fillName.." price",1000 * RN2.pricePerLiter[fillName],textWidth,currency.."/1000 L");
				end;
				print(" ");
			end;
		end;
	end;



--[[

-- Store objects

-- Bigbag pigfood

	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(407);
	storeObject.price = randomPriceFactor * RN.bigbagVolume[1] * RN.commodityDensity["PIGFOOD"] * RN.commodityPricePer100kg["PIGFOOD"]/100;

-- Bigbag horsefood
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(408);
	storeObject.price = randomPriceFactor * RN.bigbagVolume[2] * RN.commodityDensity["PIGFOOD"] * RN.commodityPricePer100kg["PIGFOOD"]/100;

-- Bigbag chickenfood
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(409);
	storeObject.price = randomPriceFactor * RN.bigbagVolume[3] * RN.commodityDensity["PIGFOOD"] * RN.commodityPricePer100kg["PIGFOOD"]/100;

-- Bigbag seeds
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(410);
	storeObject.price = randomPriceFactor * RN.bigbagVolume[4] * RN.commodityDensity["SEEDS"] * RN.commodityPricePer100kg["SEEDS"]/100;

-- Bigbag fertilizer
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(411);
	storeObject.price = randomPriceFactor * RN.bigbagVolume[5] * RN.commodityDensity["FERTILIZER"] * RN.commodityPricePer100kg["FERTILIZER"]/100;

-- Bigbag lime
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(412);
	storeObject.price = randomPriceFactor * RN.bigbagVolume[6] * RN.commodityDensity["LIME"] * RN.commodityPricePer100kg["LIME"]/100;

-- Liquid fertilizer pallet
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(413);
	storeObject.price = randomPriceFactor * RN.storePalletVolume[1] * RN.commodityDensity["FERTILIZER"] * RN.commodityPricePer100kg["FERTILIZER"]/(RN.herbicideDilutionFactor  * 100);

-- Herbicide pallet
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(414);
	storeObject.price = randomPriceFactor * RN.storePalletVolume[2] * RN.commodityDensity["HERBICIDE"] * RN.commodityPricePer100kg["HERBICIDE"]/(RN.herbicideDilutionFactor * 100);

-- Tree saplings
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(415);
	storeObject.price = randomPriceFactor * RN.storePalletVolume[3] * RN.treeSaplingsUnitPrice;

-- Poplar saplings
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(416);
	storeObject.price = randomPriceFactor * RN.storePalletVolume[4] * RN.seedDensity.POPLAR * RN.seedPricePer100kg.POPLAR/100;

-- Sugarcane
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(417);
	storeObject.price = randomPriceFactor * RN.storePalletVolume[5] * RN.seedDensity.SUGARCANE * RN.seedPricePer100kg.SUGARCANE/100;

-- Square bale straw
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(421);
	local strawSquareBaleMass = RN.commodityDensity.SQUAREBALE_WHEAT * RN.commodityVolume.SQUAREBALE_WHEAT;
	storeObject.price = 1.3 * randomPriceFactor * strawSquareBaleMass * RN.commodityPricePer100kg.SQUAREBALE_WHEAT/100;

-- Square bale hay
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(422);
	local haySquareBaleMass = RN.commodityDensity.SQUAREBALE * RN.commodityVolume.SQUAREBALE;
	storeObject.price = 1.3 * randomPriceFactor * haySquareBaleMass * RN.commodityPricePer100kg.SQUAREBALE/100;

-- Round bale silage
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(423);
	local silageRoundBaleMass = RN.commodityDensity.ROUNDBALE * RN.commodityVolume.ROUNDBALE;
	storeObject.price = 1.3 * randomPriceFactor * silageRoundBaleMass * RN.commodityPricePer100kg.ROUNDBALE/100;

-- Round bale straw
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(424);
	local strawRoundBaleMass = RN.commodityDensity.ROUNDBALE_WHEAT * RN.commodityVolume.ROUNDBALE_WHEAT;
	storeObject.price = 1.3 * randomPriceFactor * strawRoundBaleMass * RN.commodityPricePer100kg.ROUNDBALE_WHEAT/100;

-- Round bale hay
	randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
	storeObject = g_storeManager:getItemByIndex(425);
	local hayRoundBaleMass = RN.commodityDensity.ROUNDBALE_DRYGRASS * RN.commodityVolume.ROUNDBALE_DRYGRASS;
	storeObject.price = 1.3 * randomPriceFactor * hayRoundBaleMass * RN.commodityPricePer100kg.ROUNDBALE_DRYGRASS/100;
--]]

	if g_storeManager.items ~= nil then
		print("\nStore items of commodity types\n")
		for k,items in pairs(g_storeManager.items) do
			local itemId = items.id;
			local itemName = items.name;
			local itemCategory = items.categoryName;
			local itemPrice = items.price;
			if itemCategory == "BIGBAGS" then
--				print_r(items);
				local specs = items.specs;
				local capacity = specs.capacity;
				local fillType = specs.fillTypes;
				if fillType.fillTypeNames ~= nil then
					local fillName = string.upper(fillType.fillTypeNames);
					local cap1 = capacity[1];
					local cap11 = cap1[1];
					local itemVolume = cap11.capacity;
					local itemUnit = volumeUnit;
					randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
					if RN.commodityDensity[fillName] ~= nil then
						items.price = randomPriceFactor * itemVolume * RN.commodityDensity[fillName] * RN.commodityPricePer100kg[fillName]/100;
					end;
					myPrintShopInfo(itemCategory, 9, itemName, 26, itemId, itemVolume, itemUnit, items.price, currency);
--					print_r(items);
				end;
			end;
		end;
		print(" ");
		for k,items in pairs(g_storeManager.items) do
--			print_r(items);
			local itemId = items.id;
			local itemName = items.name;
			local itemCategory = items.categoryName;
			local itemPrice = items.price;
			if itemCategory == "PALLETS" then
				local specs = items.specs;
				local capacity = specs.capacity;
				local fillType = specs.fillTypes;
				if fillType.fillTypeNames ~= nil then
					local dilutionFactor = 1;
					local fillName = string.upper(fillType.fillTypeNames);
					if fillName == "FERTILIZER" then fillName = "LIQUIDFERTILIZER"; end;
					if fillName == "LIQUIDFERTILIZER" then
						dilutionFactor = 1/RN.liqfertDilutionFactor;
					end;
					if fillName == "HERBICIDE" then
						dilutionFactor = 1/RN.herbicideDilutionFactor;
					end;
					local cap1 = capacity[1];
					local cap11 = cap1[1];
					local itemVolume = cap11.capacity;
					local itemUnit = volumeUnit;
					randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;
					if fillName == "TREESAPLINGS" then
						items.price = randomPriceFactor * itemVolume * RN.treeSaplingsUnitPrice;
					elseif fillName == "POPLAR" then
						items.price = randomPriceFactor * itemVolume * RN.seedDensity.POPLAR * RN.seedPricePer100kg.POPLAR/100;
					elseif  fillName == "SUGARCANE" then
						items.price = randomPriceFactor * itemVolume * RN.seedDensity.SUGARCANE * RN.seedPricePer100kg.SUGARCANE/100;
					elseif RN.commodityDensity[fillName] ~= nil then
						items.price = dilutionFactor *randomPriceFactor * itemVolume * RN.commodityDensity[fillName] * RN.commodityPricePer100kg[fillName]/100;
					end;

					myPrintShopInfo(itemCategory, 9, itemName, 26, itemId, itemVolume, itemUnit, items.price, currency);
--					print_r(items);
				end;
			end;
		end;
		print(" ");
		for k,items in pairs(g_storeManager.items) do
			local itemId = items.id;
			local itemName = items.name;
			local itemCategory = items.categoryName;
			local itemPrice = items.price;
			if itemCategory == "BALES" then
				local specs = items.specs;
				local capacity = specs.capacity;
				local fillType = specs.fillTypes;
				local cap1 = capacity[1];
				local cap11 = cap1[1];
				randomPriceFactor = 1 + randomness * RN.commodityPriceVariation * (math.random()-0.5)/100;

				if string.find(string.upper(itemName), "SQUARE") ~= nil then
					cap11.capacity = RN.commodityVolume.SQUAREBALE;
					if string.find(string.upper(itemName), "STRAW") ~= nil then
						local strawSquareBaleMass = RN.commodityDensity.SQUAREBALE_WHEAT * RN.commodityVolume.SQUAREBALE_WHEAT;
						items.price = 1.3 * randomPriceFactor * strawSquareBaleMass * RN.commodityPricePer100kg.SQUAREBALE_WHEAT/100;
					end;
					if string.find(string.upper(itemName), "HAY") ~= nil then
						local haySquareBaleMass = RN.commodityDensity.SQUAREBALE * RN.commodityVolume.SQUAREBALE;
						items.price = 1.3 * randomPriceFactor * haySquareBaleMass * RN.commodityPricePer100kg.SQUAREBALE/100;
					end;
				elseif string.find(string.upper(itemName), "ROUND") ~= nil then
					cap11.capacity = RN.commodityVolume.ROUNDBALE;
					if string.find(string.upper(itemName), "STRAW") ~= nil then
						local strawRoundBaleMass = RN.commodityDensity.ROUNDBALE_WHEAT * RN.commodityVolume.ROUNDBALE_WHEAT;
						items.price = 1.3 * randomPriceFactor * strawRoundBaleMass * RN.commodityPricePer100kg.ROUNDBALE_WHEAT/100;
					end;
					if string.find(string.upper(itemName), "HAY") ~= nil then
						local hayRoundBaleMass = RN.commodityDensity.ROUNDBALE_DRYGRASS * RN.commodityVolume.ROUNDBALE_DRYGRASS;
						items.price = 1.3 * randomPriceFactor * hayRoundBaleMass * RN.commodityPricePer100kg.ROUNDBALE_DRYGRASS/100;
					end;
					if string.find(string.upper(itemName), "SILAGE") ~= nil then
						local silageRoundBaleMass = RN.commodityDensity.ROUNDBALE * RN.commodityVolume.ROUNDBALE;
						items.price = 1.3 * randomPriceFactor * silageRoundBaleMass * RN.commodityPricePer100kg.ROUNDBALE/100;
					end;
				end;
				local itemVolume = cap11.capacity;
				local itemUnit = volumeUnit;
				myPrintShopInfo(itemCategory, 9, itemName, 26, itemId, itemVolume, itemUnit, items.price, currency);
			end;
		end;
	end;
	print(" ");
end;


function RealNumbersCommodityPrices:keyEvent(unicode, sym, modifier, isDown)
end;

function RealNumbersCommodityPrices:update(dt)
	if g_fieldManager.fields ~= nil then
		g_farmlandManager.pricePerHa = RN.pricePerHa;   -- set new value value
		local randomness = 1;							-- set to zero for no fluctuation, set to 1 for +/- 5% fluctuation
		for k,field in pairs(g_fieldManager.fields) do
			local farmland = field.farmland;
			local farmlandArea = farmland.areaInHa;
			local farmlandId = farmland.id;
			local randomFieldPriceFactor = 1 + randomness * 1 * (math.random()-0.5)/10;
			farmland.price = randomFieldPriceFactor * RN.fieldPriceList[farmlandId] * farmlandArea;
			local fieldId = field.fieldId;
			if field.fieldArea < 0.15 then
				field.fieldArea = farmlandArea;		-- if field area is set to a very low value it is reset to the farmland area
			end;
		end;
	end;

	if g_farmManager.farms ~= nil then
		for k,farm in pairs(g_farmManager.farms) do
			farm.loanAnnualInterestRate = RN.annualLoanInterest;
			farm.loanMax = RN.loanMax;
		end;
	end;


	if g_storeManager.items ~= nil then
		for k,items in pairs(g_storeManager.items) do
			if items.allowLeasing then
				items.runningLeasingFactor = RN.DEFAULT_RUNNING_LEASING_FACTOR;
			end;
		end;
	end;


	EconomyManager.DEFAULT_RUNNING_LEASING_FACTOR = RN.DEFAULT_RUNNING_LEASING_FACTOR;
	EconomyManager.PER_DAY_LEASING_FACTOR = RN.PER_DAY_LEASING_FACTOR;
	EconomyManager.DEFAULT_LEASING_DEPOSIT_FACTOR = RN.DEFAULT_LEASING_DEPOSIT_FACTOR;
	local gameLevel = g_currentMission.missionInfo.economicDifficulty;
	EconomyManager.PRICE_MULTIPLIER[gameLevel] = RN.gameLevel.sellPriceMultiplier[gameLevel];
	EconomyManager.COST_MULTIPLIER[gameLevel] = RN.gameLevel.buyPriceMultiplier[gameLevel];
	EconomyManager.DIRECT_SELL_MULTIPLIER = RN.DIRECT_SELL_MULTIPLIER;

end;
function RealNumbersCommodityPrices:draw()
end;
function RealNumbersCommodityPrices:deleteMap()
end;
function RealNumbersCommodityPrices:mouseEvent(posX, posY, isDown, isUp, button)
end;

addModEventListener(RealNumbersCommodityPrices);
