PromptHeading = ID_TUTORIAL_6_OFFSET + 1
g_currentprompt = 0;
g_counter = 0;
Tweaks.numyearsin24hours = 0;

-------------------------------------------------------------------------------------------------
-- INITIALISE_Level. Standard level event
-------------------------------------------------------------------------------------------------
function EVENTINITIALISE_Level()
	-- load the building and business file
	C_RunScript("scripts\\maps\\tempmap.lua");
	C_RunScript("scripts\\tutorial4\\initialpref.lua");

end;

-------------------------------------------------------------------------------------------------
-- Level. Standard level event.
-------------------------------------------------------------------------------------------------
function EVENT_Level()
	-- create an initial prompt
	C_TriggerEvent("BlockCam", 1, PACIFIC_AVENUE);

	Interface.DisableAllControls();
	Interface.DisableAll3DPicking();
	Interface.DisableCameraControl();

	-- create the initial prompt
	CreatePrompt(1);
end;

function CATCHEVENT_InterfacePromptDismiss(a)
	CreatePrompt(a);
end;

function CATCHEVENT_TutorialEvent(a)

	if a == TUT_MPP_BUILDING_DEMOLISH then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_MPP_BUILDING_DEMOLISH);
	end;

	if g_currentprompt == 21 then
		if a~= TUT_MOVE_TO_NEXT_PHASE then
		  if a~= TUT_MPP_BUILDING_REFURBISH then
		  if a~= TUT_END_BUILD then
			Interface.DismissPrompt();
			Interface.DisableControl(TUT_MPP_GREENBUTTON_5);
			end;
		end;
		end;
	end;

	if g_currentprompt == 20 then
		if a~= TUT_MOVE_TO_NEXT_PHASE  then
			if a == TUT_MPP_BUILDING_REFURBISH then
				Interface.DismissPrompt();
				Interface.DisableControl(TUT_MPP_BUILDING_REFURBISH);
				Interface.DisableControl(TUT_MPP_BUILDING_REFURBISH_LIST);
			end;
		end;
	end;

	if g_currentprompt == 19 and a~= TUT_MOVE_TO_NEXT_PHASE then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_MPP_BUILDING_REFURBISH_LIST);
	end;

	if g_currentprompt == 18 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_MPP_GREENBUTTON_4);
	end;

	if g_currentprompt == 16 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_MPP_GREENBUTTON_3);
	end;

	if a == TUT_BAP_OK_BUTTON and g_currentprompt == 15 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_BAP_PLUS_BUTTON_1);
		Interface.DisableControl(TUT_BAP_PLUS_BUTTON_2);
		Interface.DisableControl(TUT_BAP_MINUS_BUTTON_1);
		Interface.DisableControl(TUT_BAP_MINUS_BUTTON_2);
		Interface.DisableControl(TUT_BAP_OK_BUTTON);
	end;

	if g_currentprompt == 14 then
		Interface.DismissPrompt();
	end;

	if g_currentprompt == 13 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_MPP_GREENBUTTON_2);
	end;

	if g_currentprompt == 10 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_BAP_OK_BUTTON);
	end;

	if g_currentprompt == 9 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_MPP_GREENBUTTON_2);
	end;

	if g_currentprompt == 7 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_MPP_INFOBUTTON_2);
	end;

	if a == TUT_MPP_BUILDING_RIGHT_TOGGLE and g_currentprompt == 6 then
		Interface.DismissPrompt();
		Interface.DisableControl(TUT_MPP_BUILDING_RIGHT_TOGGLE);
	end;

	if a == TUT_MPP_BUILDING_RIGHT_TOGGLE and g_currentprompt == 5 then
		Interface.DismissPrompt();
	end;

	if a == TUT_MPP_BUILDING_RIGHT_TOGGLE and g_currentprompt == 4 then
		Interface.DismissPrompt();
	end;
end;

function CATCHEVENT_Picked3D(a)

	if g_currentprompt == 2 then
		Interface.DismissPrompt();
		Interface.DisableAll3DPicking();
	end;

	if g_currentprompt == 11 then
		Interface.DismissPrompt();
		Interface.DisableAll3DPicking();
	end;

end;

-- prompt manager
function CreatePrompt(a)
	g_currentprompt = a;
	body = a+PromptHeading;
	if a == 1 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"Now let's look at what you can do with buildings. ", a+1);
	elseif a == 2 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Lets click on this building here...", a+1);
		Interface.PositionPrompt(0,-140);
		Interface.EnableBuildingPicking(8);
		Interface.AddArrow( 290, 300 );
	elseif a == 3 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"This building is owned buy the city so you can only get certain information on it. Here's the top line finance information. The graph shows profit over the last four days. ", a+1);
		Interface.PositionPrompt(0,0);
		Interface.AddArrow( 180, 154 );
	elseif a == 4 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Click here to get more details on the Income for this business...", a+1);
		Interface.AddArrow( 167, 178 );
		Interface.EnableControl(TUT_MPP_BUILDING_RIGHT_TOGGLE);
	elseif a == 5 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"And again to get more details on the runnings costs...", a+1);
		Interface.AddArrow( 167, 178 );
	elseif a == 6 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"And again to return to the graph showing the profit of the business.", a+1);
		Interface.AddArrow( 167, 178 );
	elseif a == 7 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Click the Buy / Sell Value button. ", a+1);
		Interface.EnableControl(TUT_MPP_INFOBUTTON_2);
		Interface.AddArrow( 80, 47 );
	elseif a == 8 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"Here is how much it costs to buy the business from its owner. You must be the landlord to buy it. If you owned the business then you can sell it back to the city, the value shows how much you would receive.", a+1);
		Interface.AddArrow( 101, 107);
	elseif a == 9 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Click on the Business Adjustments button. ", a+1);
		Interface.EnableControl(TUT_MPP_GREENBUTTON_2);
		Interface.AddArrow( 32, 93);
	elseif a == 10 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"You can now see how this store is set up. You can't change anything as you do not own this store, but you can see the price being charged for goods! Click Ok to continue. ", a+1);
		Interface.PositionPrompt(0,150);
		Interface.EnableControl(TUT_BAP_OK_BUTTON);
		Interface.AddArrow(572,275);
	elseif a == 11 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"This store belongs to you. Let's see what is different. Click on it now...", a+1);
		Interface.PositionPrompt(0,-140);
		Interface.EnableBuildingPicking(7);
		Interface.AddArrow( 324, 181 );
	elseif a == 12 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"There are now 3 extra buttons available here. From top to bottom these are Sell, Refurbish and Demolish.", a+1);
		Interface.AddArrow( 31, 137);
	elseif a == 13 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Before we go rushing into the new stuff, let's look at how the Business Adjustment panel has changed. Click on it now. ", a+1);
		Interface.AddArrow( 30, 93);
		Interface.PositionPrompt(0,150);
		Interface.EnableControl(TUT_MPP_GREENBUTTON_2);
	elseif a == 14 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"You now have control over the price and amount of stock you want to hold. Try changing the values. ", a+1);
		Interface.EnableControl(TUT_BAP_PLUS_BUTTON_1);
		Interface.EnableControl(TUT_BAP_PLUS_BUTTON_2);
		Interface.EnableControl(TUT_BAP_MINUS_BUTTON_1);
		Interface.EnableControl(TUT_BAP_MINUS_BUTTON_2);
		Interface.AddArrow( 269, 164);
	elseif a == 15 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"The Stock level cannot exceed this value. If you need to stock more you should build a bigger building! Click the Ok button to continue. ", a+1);
		Interface.EnableControl(TUT_BAP_OK_BUTTON);
		Interface.AddArrow( 437, 266);
	elseif a == 16 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Click on the Sell button.", a+1);
		Interface.EnableControl(TUT_MPP_GREENBUTTON_3);
		Interface.AddArrow( 29, 125);
	elseif a == 17 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"If you needed to you could sell this business to the city for the price quoted. We won't do that yet as there's more I need to show you. ", a+1);
		Interface.AddArrow( 118, 56 );
	elseif a == 18 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Click the Refurbish button. ", a+1);
		Interface.EnableControl(TUT_MPP_GREENBUTTON_4);
		Interface.AddArrow( 28, 140 );
	elseif a == 19 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"You can refurbish this building into any of the ones listed. If a business is not list it will be because the building is either to large or too small. Choose what you want to refurbish to from the list...", a+1);
		Interface.EnableControl(TUT_MPP_BUILDING_REFURBISH_LIST);
		Interface.PositionPrompt(0,-100);
		Interface.AddArrow( 188, 221 );
	elseif a == 20 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Check the price and then click on Refurbish. ", a+1);
		Interface.EnableControl(TUT_MPP_BUILDING_REFURBISH);
		Interface.AddArrow( 158, 110 );
	elseif a == 21 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Great. Finally, the only other thing you can do is demolish a building. Click here...  ", a+1);
		Interface.EnableControl(TUT_MPP_GREENBUTTON_5);
		Interface.AddArrow( 29, 165 );
	elseif a == 22 then
		Interface.CreateMessage(PromptHeading,body, a+1); --"Note the cost of demolition. It's not that steep, but you should be aware when you spend your cash! Hit the Demolish button. Go ahead...", a+1);
		Interface.EnableControl(TUT_MPP_BUILDING_DEMOLISH);
		Interface.AddArrow( 158, 110 );
	elseif a == 23 then
		Interface.CreatePrompt(PromptHeading,body, a+1); --"Great. Now you know all about the Building mode. ", a+1);
	elseif a == 24 then
		Game.End(true);
	end;
end;

