require "scripts/style.lua"

SetPlantingHireValues();

reDoWindow = function()
	redisplayWindow("viniculturing");
end;

hirePrice = GetHiringPriceViniculture();

if hireProd <= curProd then
	hireFunction = function()
		EnableWindow("hireWindow", false)
		DisplayDialog({"scripts/ok.lua", body="grapesAlredyPlanted", title="alredyPlantedTitle", x = kCenter, y = kCenter});
		EnableWindow("hireWindow", true)
	end;
	
elseif	hirePrice > availableMoney then
	hireFunction = function()
		EnableWindow("hireWindow", false)
		DisplayDialog({"scripts/ok.lua", body="nomoneyhire", title="nomoney_title", x = kCenter, y = kCenter});
		EnableWindow("hireWindow", true)
	end;
else
	hireFunction = function()
			EnableWindow("hireWindow", false);
			hired = DisplayDialog({"scripts/hireviniculture.lua"});
			if(hired == 1) then
				CloseWindow();
			else
				EnableWindow("hireWindow", true);
			end
	end;
end;

function getTutorial()
	return not AlreadyPlayedMinigame(1);
end;

if (getTutorialMode) then
	playingTutorial = getTutorial()
end;
	
DisplayDialog{
	"scripts/proceed.lua",
	start=function()
			PlayViniculture();
	   end,
	hire= hireFunction;
	title = "startviniculture_title",
	body = "startviniculture",
	name = "hireWindow",
	tutorial = playingTutorial
};
