require "scripts/style.lua"

local hireFn;
COMBINING_MAX_HIRE = 35;

reDoWindow = function()
	redisplayWindow("combining")
end

--showHireTutorial = true;

SetCombiningValues();

if StartProduction >= COMBINING_MAX_HIRE then
--if StartProduction > 1000 then
	hireFn = function()
		--PopModal("hireWindow");
		EnableWindow("hireWindow", false)
		DisplayDialog({"scripts/ok.lua", body="maxquality", title="maxquality_title", x = kCenter, y = kCenter});
		EnableWindow("hireWindow", true)
	end;
elseif StartValue > availableMoney then
	hireFn = function()
		--PopModal("hireWindow");
		EnableWindow("hireWindow", false)
		DisplayDialog({"scripts/ok.lua", body="nomoneyhire", title="nomoney_title", x = kCenter, y = kCenter});
		EnableWindow("hireWindow", true)
	end;
else
	hireFn = function()
		EnableWindow("hireWindow", false)
		hired = DisplayDialog({"scripts/hirecombining.lua"});
		if(hired == 1)then
			CloseWindow();
		else
			EnableWindow("hireWindow", true);
		end
	end;
end;

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

if (getTutorialMode) then
	playingTutorial = getTutorial()
end;

DisplayDialog{
	"scripts/proceed.lua",
	start=function()
			PlayCombining();
	   end,
	name = "hireWindow",
	hire= hireFn,
	title = "proceedtocombine_title",
	body = "proceedtocombine_body",
	tutorial = playingTutorial
};
