class 1 miner_mai : citizen
{
handler:
	EventHandler TALKED(i0,i1,quest_id,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::GetMemoStateEx(talker,255,1) < 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Dwarf's Tutorial");
			}
			if( ( myself::GetMemoStateEx(talker,255,1) == 1 || myself::GetMemoStateEx(talker,255,1) == 2 || myself::GetMemoStateEx(talker,255,1) == 0 ) && myself::OwnItemCount(talker,6353) < 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Dwarf's Tutorial");
			}
			if( ( myself::GetMemoStateEx(talker,255,1) == 2 || myself::GetMemoStateEx(talker,255,1) == 1 || myself::GetMemoStateEx(talker,255,1) == 0 ) && myself::OwnItemCount(talker,6353) > 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Dwarf's Tutorial");
			}
			if( myself::GetMemoStateEx(talker,255,1) == 3 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Dwarf's Tutorial");
			}
			if( myself::GetMemoStateEx(talker,255,1) > 3 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Dwarf's Tutorial");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,0);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || myself::GetMemoStateEx(talker,255,1) < 0 )
					{
						myself::SetCurrentQuestID(206);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) )
						{
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						if( talker.race == 4 )
						{
							myself::DeleteRadar(talker,108567,-173994,-406,2);
							myself::AddTimerEx(( myself::GetIndexFromCreature(talker) + 1000000 ),( 1000 * 30 ));
							if( myself::IsInCategory(0,talker.occupation) )
							{
								myself::ShowPage(talker,"carl001.htm");
							}
							else
							{
								myself::ShowPage(talker,"doff001.htm");
							}
							myself::SetMemoStateEx(talker,255,1,0);
							i1 = myself::GetMemoState(talker,255);
							i1 = 2147483392;
							talker::EnableTutorialEvent(i0,1048576);
						}
						else
						{
							myself::ShowPage(talker,"carl006.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( ( myself::GetMemoStateEx(talker,255,1) == 1 || myself::GetMemoStateEx(talker,255,1) == 2 || myself::GetMemoStateEx(talker,255,1) == 0 ) && myself::OwnItemCount(talker,6353) < 1 ) )
					{
						myself::SetCurrentQuestID(206);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) )
						{
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						myself::ShowPage(talker,"carl002.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( ( myself::GetMemoStateEx(talker,255,1) == 2 || myself::GetMemoStateEx(talker,255,1) == 1 || myself::GetMemoStateEx(talker,255,1) == 0 ) && myself::OwnItemCount(talker,6353) > 0 ) )
					{
						myself::SetCurrentQuestID(206);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) )
						{
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						myself::ShowPage(talker,"miner_mai003.htm");
						myself::DeleteItem1(talker,6353,myself::OwnItemCount(talker,6353));
						myself::SetMemoStateEx(talker,255,1,3);
						myself::GiveItem1(talker,1498,1);
						myself::AddTimerEx(( myself::GetIndexFromCreature(talker) + 1000000 ),( 1000 * 30 ));
						myself::GetMemoState(talker,255) = 2147483392;
						talker::SetMemoState(255,i0,4);
						if( myself::IsInCategory(0,talker.occupation) && myself::OwnItemCount(talker,5789) <= 0 )
						{
							myself::VoiceEffect(talker,"tutorial_voice_026",1000);
							myself::GiveItem1(talker,5789,200);
						}
						if( myself::IsInCategory(1,talker.occupation) && myself::OwnItemCount(talker,5789) <= 0 && myself::OwnItemCount(talker,5790) <= 0 )
						{
							myself::VoiceEffect(talker,"tutorial_voice_027",1000);
							myself::GiveItem1(talker,5790,100);
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || myself::GetMemoStateEx(talker,255,1) == 3 )
					{
						myself::SetCurrentQuestID(206);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) )
						{
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						myself::ShowPage(talker,"miner_mai004.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || myself::GetMemoStateEx(talker,255,1) > 3 )
					{
						myself::SetCurrentQuestID(206);
						if( myself::GetInventoryInfo(talker,0) >= ( myself::GetInventoryInfo(talker,1) * 0.800000 ) || myself::GetInventoryInfo(talker,2) >= ( myself::GetInventoryInfo(talker,3) * 0.800000 ) )
						{
							myself::ShowSystemMessage(talker,1118);
							return;
						}
						myself::ShowPage(talker,"carl005.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(talker,timer_id)
	{
		myself::SetCurrentQuestID(206);
		if( timer_id <= 1000000 )
		{
			return;
		}
		talker = myself::GetCreatureFromIndex(( timer_id - 1000000 ));
		if( talker.alive == 0 || talker.is_pc == 0 )
		{
			return;
		}
		if( myself::GetMemoStateEx(talker,255,1) == 0 && timer_id >= 1000000 )
		{
			myself::VoiceEffect(talker,"tutorial_voice_009a",0);
			myself::SetMemoStateEx(talker,255,1,1);
		}
		if( myself::GetMemoStateEx(talker,255,1) == 3 && timer_id >= 1000000 )
		{
			myself::VoiceEffect(talker,"tutorial_voice_010f",0);
			myself::SetMemoStateEx(talker,255,1,4);
		}
		super;
	}

}
