@LabelIndex 404796
@StringIndex 60738
class 0 chamberlain_logan : chamberlain {
property:
	TelPosList Position1 = {{"Front of the Aden Castle"; 147428; 20161; -2008; 0; 0 };{"Aden Town Square"; 147450; 28081; -2294; 0; 0 };{"Front of the Narsell Fortress"; 160702; 51661; -3512; 0; 0 };{"Front of the Basin Fortress"; 189664; 46042; -4264; 0; 0 }};
	TelPosList Position2 = {{"Front of the Aden Castle"; 147428; 20161; -2008; 0; 0 };{"Aden Town Square"; 147450; 28081; -2294; 0; 0 };{"Front of the Narsell Fortress"; 160702; 51661; -3512; 0; 0 };{"Front of the Basin Fortress"; 189664; 46042; -4264; 0; 0 };{"Enchanted Valley, Northern Region"; 104426; 33746; -3825; 500; 0 };{"Blazing Swamp"; 155310; -16339; -3320; 500; 0 };{"Forest of Mirrors"; 142065; 81300; -3000; 500; 0 };{"Anghel Waterfall"; 166182; 91560; -3168; 500; 0 }};
	BuySellList SellList0 = {{"advdeluxe_food_for_strider";10};{"pledge_shield_castle";10};{"circlet_of_aden";10};{"agathion_seal_bracelet_aden";10};{"13686";10}};

handler:
	EventHandler TALK_SELECTED(fhtml0,i0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,713) == 0 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to Becoming a Lord - Aden");
			}
			if( gg::HaveMemo(talker,713) == 1 && gg::GetMemoState(talker,713) > 0 && gg::GetMemoState(talker,713) < 1000 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path to Becoming a Lord - Aden (in progress)");
			}
			if( gg::HaveMemo(talker,713) == 1 && gg::GetMemoState(talker,713) == 1000 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Path to Becoming a Lord - Aden (in progress)");
			}
			if( _choiceN > 1 ) {
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 ) {
			switch(_code) {
				case 0: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,713) == 0 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(713);
						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 ) {
							if( myself::IsDominionOfLord(85) == 0 ) {
								myself::FHTML_SetFileName(fhtml0,"chamberlain_logan_q0713_01.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",713);
								myself::ShowQuestFHTML(talker,fhtml0,713);
							} else {
								myself::ShowQuestPage(talker,"chamberlain_logan_q0713_02.htm",713);
							}
						} else {
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,713) == 1 && gg::GetMemoState(talker,713) > 0 && gg::GetMemoState(talker,713) < 1000 ) ) {
						myself::SetCurrentQuestID(713);
						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,"chamberlain_logan_q0713_04.htm");
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,713) == 1 && gg::GetMemoState(talker,713) == 1000 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(713);
						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( gg::GetDominionWarState(85) == 5 || myself::Castle_IsUnderSiege() ) {
							myself::ShowPage(talker,"chamberlain_logan_q0713_05a.htm");
						} else if( gg::Fortress_GetContractStatus(106) == -1 || gg::Fortress_GetContractStatus(107) == -1 ) {
							myself::ShowPage(talker,"chamberlain_logan_q0713_05b.htm");
						} else {
							myself::ShowPage(talker,"chamberlain_logan_q0713_05.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(i0,quest_id,talker) {
		if( quest_id == 713 ) {
			myself::SetCurrentQuestID(713);
			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::GetCurrentTick() - talker.quest_last_reward_time ) > 1 ) {
				talker.quest_last_reward_time = myself::GetCurrentTick();
				if( gg::HaveMemo(talker,713) == 0 && myself::IsMyLord(talker) == 1 && myself::IsDominionOfLord(85) == 0 ) {
					myself::SetMemoState(talker,713,1);
					myself::SetMemo(talker,quest_id);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					myself::ShowQuestPage(talker,"chamberlain_logan_q0713_03.htm",713);
					myself::SetFlagJournal(talker,713,1);
					myself::ShowQuestMark(talker,713);
				}
				gg::AddLog(1,talker,quest_id);
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker) {
		if( ask == 713 ) {
			myself::SetCurrentQuestID(713);
			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( ask == 713 ) {
			if( reply == 1 ) {
				if( gg::HaveMemo(talker,713) == 1 && gg::GetMemoState(talker,713) == 1000 && myself::IsMyLord(talker) == 1 && gg::GetDominionWarState(85) != 5 ) {
					myself::Say(gg::MakeFString(71351,talker.name,"","","",""));
					myself::DeclareLord(85,talker);
					myself::RemoveMemo(talker,713);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					myself::ShowPage(talker,"chamberlain_logan_q0713_06.htm");
					gg::AddLog(2,talker,713);
				}
			}
		}
		super;
	}

}
