class 1 sir_eric_rodemai : citizen
{
handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 7000 && talker.is_pledge_master == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Pursuit of Clan Ambition (Continue)");
			}
			if( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 7000 && talker.is_pledge_master == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Pursuit of Clan Ambition (Continue)");
			}
			if( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 8000 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Pursuit of Clan Ambition (Continue)");
			}
			if( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 8100 && talker.is_pledge_master == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Pursuit of Clan Ambition (Continue)");
			}
			if( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 8100 && talker.is_pledge_master == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Pursuit of Clan Ambition (Continue)");
			}
			if( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) < 8511 && myself::GetMemoState(talker,503) >= 8500 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Pursuit of Clan Ambition (Continue)");
			}
			if( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 8700 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Pursuit of Clan Ambition (Continue)");
			}
			if( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) >= 9000 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Pursuit of Clan Ambition (Continue)");
			}
			if( talker.is_pledge_master == 1 && myself::HaveMemo(talker,508) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"The Clan's Reputation");
			}
			if( talker.is_pledge_master == 1 && myself::HaveMemo(talker,508) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 9;
				myself::AddChoice(9,"The Clan's Reputation (Continue)");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 7000 && talker.is_pledge_master == 0 ) )
					{
						myself::SetCurrentQuestID(503);
						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,"sir_eric_rodemai_q0503_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 7000 && talker.is_pledge_master == 1 ) )
					{
						myself::SetCurrentQuestID(503);
						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,"sir_eric_rodemai_q0503_02.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 8000 ) )
					{
						myself::SetCurrentQuestID(503);
						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,"sir_eric_rodemai_q0503_05.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 8100 && talker.is_pledge_master == 1 ) )
					{
						myself::SetCurrentQuestID(503);
						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::SetMemoState(talker,503,8500);
						myself::ShowPage(talker,"sir_eric_rodemai_q0503_06.htm");
						myself::SetJournal(talker,503,10);
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 8100 && talker.is_pledge_master == 0 ) )
					{
						myself::SetCurrentQuestID(503);
						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,"sir_eric_rodemai_q0503_07.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) < 8511 && myself::GetMemoState(talker,503) >= 8500 ) )
					{
						myself::SetCurrentQuestID(503);
						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,"sir_eric_rodemai_q0503_08.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) == 8700 ) )
					{
						myself::SetCurrentQuestID(503);
						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,"sir_eric_rodemai_q0503_09.htm");
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(myself::Pledge_GetLeader(talker),503) == 1 && myself::GetMemoState(talker,503) >= 9000 ) )
					{
						myself::SetCurrentQuestID(503);
						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,"sir_eric_rodemai_q0503_11.htm");
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( talker.is_pledge_master == 1 && myself::HaveMemo(talker,508) == 0 ) )
					{
						myself::SetCurrentQuestID(508);
						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( myself::GetMemoCount(talker) < 26 )
						{
							pledge0 = myself::GetPledge(talker);
							if( pledge0.skill_level < 5 )
							{
								myself::ShowPage(talker,"sir_eric_rodemai_q0508_0103.htm");
							}
							else
							{
								myself::ShowPage(talker,"sir_eric_rodemai_q0508_0101.htm");
								myself::SetMemo(talker,508);
								myself::AddLog(1,talker,508);
								myself::SetJournal(talker,508,1);
								myself::SoundEffect(talker,"ItemSound.quest_accept");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 9:
				{
					if( _from_choice == 0 || ( talker.is_pledge_master == 1 && myself::HaveMemo(talker,508) == 1 ) )
					{
						myself::SetCurrentQuestID(508);
						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;
						}
						i0 = 0;
						if( myself::OwnItemCount(talker,8277) > 0 )
						{
							myself::ShowPage(talker,"sir_eric_rodemai_q0508_0102a.htm");
							myself::DeleteItem1(talker,8277,1);
							i0 = 85;
						}
						else if( myself::OwnItemCount(talker,8279) > 0 )
						{
							myself::ShowPage(talker,"sir_eric_rodemai_q0508_0102b.htm");
							myself::DeleteItem1(talker,8279,1);
							i0 = 143;
						}
						else if( myself::OwnItemCount(talker,8280) > 0 )
						{
							myself::ShowPage(talker,"sir_eric_rodemai_q0508_0102c.htm");
							myself::DeleteItem1(talker,8280,1);
							i0 = 50;
						}
						else if( myself::OwnItemCount(talker,8281) > 0 )
						{
							myself::ShowPage(talker,"sir_eric_rodemai_q0508_0102d.htm");
							myself::DeleteItem1(talker,8281,1);
							i0 = 125;
						}
						else if( myself::OwnItemCount(talker,8282) > 0 )
						{
							myself::ShowPage(talker,"sir_eric_rodemai_q0508_0102e.htm");
							myself::DeleteItem1(talker,8282,1);
							i0 = 71;
						}
						else if( myself::OwnItemCount(talker,8494) > 0 )
						{
							myself::ShowPage(talker,"sir_eric_rodemai_q0508_0102f.htm");
							myself::DeleteItem1(talker,8494,1);
							i0 = 80;
						}
						else
						{
							myself::ShowPage(talker,"sir_eric_rodemai_q0508_0102.htm");
						}
						if( i0 > 0 )
						{
							myself::PledgeScoreInc(talker,i0);
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 503 )
		{
			myself::SetCurrentQuestID(503);
			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( reply == 1 )
			{
				myself::ShowPage(talker,"sir_eric_rodemai_q0503_03.htm");
			}
			if( reply == 2 )
			{
				myself::DeleteItem1(talker,3868,myself::OwnItemCount(talker,3868));
				myself::SetMemoState(talker,503,8000);
				myself::ShowPage(talker,"sir_eric_rodemai_q0503_04.htm");
				myself::SetJournal(talker,503,8);
			}
			if( reply == 3 )
			{
				myself::SetMemoState(talker,503,9000);
				myself::ShowPage(talker,"sir_eric_rodemai_q0503_10.htm");
				myself::SetJournal(talker,503,11);
			}
		}
		if( ask == 508 )
		{
			myself::SetCurrentQuestID(508);
			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( reply == 1 )
			{
				myself::ShowPage(talker,"sir_eric_rodemai_q0508_0101a.htm");
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"sir_eric_rodemai_q0508_0101b.htm");
			}
			if( reply == 3 )
			{
				myself::ShowPage(talker,"sir_eric_rodemai_q0508_0101c.htm");
			}
			if( reply == 4 )
			{
				myself::ShowPage(talker,"sir_eric_rodemai_q0508_0101d.htm");
			}
			if( reply == 5 )
			{
				myself::ShowPage(talker,"sir_eric_rodemai_q0508_0101e.htm");
			}
			if( reply == 6 )
			{
				myself::ShowPage(talker,"sir_eric_rodemai_q0508_0101f.htm");
			}
			if( reply == 7 )
			{
				if( myself::HaveMemo(talker,508) == 1 )
				{
					myself::RemoveMemo(talker,508);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					myself::ShowPage(talker,"sir_eric_rodemai_q0508_0105.htm");
				}
			}
		}
		super;
	}

}
