@LabelIndex 404670
@StringIndex 60703
class 0 chamberlain_brasseur : chamberlain {
property:
	TelPosList Position1 = {{"Front of the Oren Castle"; 75648; 39380; -2952; 0; 0 };{"Oren Town Square"; 82323; 55466; -1480; 0; 0 };{"Front of the Ivory Fortress"; 77023; 1591; -3608; 0; 0 }};
	TelPosList Position2 = {{"Front of the Oren Castle"; 75648; 39380; -2952; 0; 0 };{"Oren Town Square"; 82323; 55466; -1480; 0; 0 };{"Front of the Ivory Fortress"; 77023; 1591; -3608; 0; 0 };{"Ivory Tower"; 85391; 16228; -3640; 500; 0 };{"Near the frontier post"; 109721; -7394; -2800; 500; 0 };{"Sea of Spores"; 64328; 26803; -3768; 500; 0 };{"Enchanted Valley, Southern Region"; 124904; 61992; -3973; 500; 0 };{"Ancient Battleground"; 118509; -4779; -4000; 500; 0 }};
	BuySellList SellList0 = {{"advdeluxe_food_for_strider";10};{"pledge_shield_castle";10};{"circlet_of_oren";10};{"agathion_seal_bracelet_oren";10};{"13686";10}};

handler:
	EventHandler TALK_SELECTED(fhtml0,i0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,712) == 0 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to Becoming a Lord - Oren");
			}
			if( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) == 1 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path to Becoming a Lord - Oren (in progress)");
			}
			if( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) == 2 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Path to Becoming a Lord - Oren (in progress)");
			}
			if( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) == 3 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Path to Becoming a Lord - Oren (in progress)");
			}
			if( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) > 3 && gg::GetMemoState(talker,712) < 9 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Path to Becoming a Lord - Oren (in progress)");
			}
			if( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) == 9 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Path to Becoming a Lord - Oren (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,712) == 0 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(712);
						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(84) == 0 ) {
								myself::ShowQuestPage(talker,"chamberlain_brasseur_q0712_01.htm",712);
							} else {
								myself::ShowQuestPage(talker,"chamberlain_brasseur_q0712_03.htm",712);
							}
						} else {
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) == 1 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(712);
						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() - gg::GetMemoStateEx(talker,712,1) ) < 60 ) {
							myself::ShowPage(talker,"chamberlain_brasseur_q0712_05.htm");
						} else {
							myself::SetMemoState(talker,712,3);
							myself::SetMemoStateEx(talker,712,1,0);
							myself::ShowPage(talker,"chamberlain_brasseur_q0712_06.htm");
							myself::SetFlagJournal(talker,712,2);
							myself::ShowQuestMark(talker,712);
							myself::SoundEffect(talker,"ItemSound.quest_middle");
						}
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) == 2 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(712);
						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,712,3);
						myself::ShowPage(talker,"chamberlain_brasseur_q0712_07.htm");
						myself::SetFlagJournal(talker,712,2);
						myself::ShowQuestMark(talker,712);
						myself::SoundEffect(talker,"ItemSound.quest_middle");
					}
					break;
				}
				case 3: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) == 3 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(712);
						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_brasseur_q0712_08.htm");
					}
					break;
				}
				case 4: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) > 3 && gg::GetMemoState(talker,712) < 9 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(712);
						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_brasseur_q0712_09.htm");
					}
					break;
				}
				case 5: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) == 9 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(712);
						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(84) == 5 || myself::Castle_IsUnderSiege() ) {
							myself::ShowPage(talker,"chamberlain_brasseur_q0712_10a.htm");
						} else if( gg::Fortress_GetContractStatus(105) == -1 ) {
							myself::ShowPage(talker,"chamberlain_brasseur_q0712_10b.htm");
						} else {
							myself::ShowPage(talker,"chamberlain_brasseur_q0712_10.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(i0,quest_id,talker) {
		if( quest_id == 712 ) {
			myself::SetCurrentQuestID(712);
			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,712) == 0 && myself::IsMyLord(talker) == 1 && myself::IsDominionOfLord(84) == 0 ) {
					i0 = myself::GetCurrentTick();
					myself::SetMemoState(talker,712,1);
					myself::SetMemo(talker,quest_id);
					myself::SetMemoStateEx(talker,712,1,i0);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					myself::ShowQuestPage(talker,"chamberlain_brasseur_q0712_04.htm",712);
					myself::SetFlagJournal(talker,712,1);
					myself::ShowQuestMark(talker,712);
					myself::AddTimerEx(71201,( 1000 * 60 ));
				}
				gg::AddLog(1,talker,quest_id);
			}
			return;
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(i0,talker,timer_id) {
		myself::SetCurrentQuestID(712);
		if( timer_id == 71201 ) {
			myself::Say(gg::MakeFString(71251,"","","","",""));
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,fhtml0,reply,talker) {
		if( ask == 712 ) {
			myself::SetCurrentQuestID(712);
			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 == 712 ) {
			if( reply == 1 ) {
				if( gg::HaveMemo(talker,712) == 0 && myself::IsMyLord(talker) == 1 && myself::IsDominionOfLord(84) == 0 ) {
					myself::FHTML_SetFileName(fhtml0,"chamberlain_brasseur_q0712_02.htm");
					myself::FHTML_SetInt(fhtml0,"quest_id",712);
					myself::ShowQuestFHTML(talker,fhtml0,712);
				}
			}
			if( reply == 2 ) {
				if( gg::HaveMemo(talker,712) == 1 && gg::GetMemoState(talker,712) == 9 && myself::IsMyLord(talker) == 1 && gg::GetDominionWarState(84) != 5 ) {
					myself::FHTML_SetFileName(fhtml0,"chamberlain_brasseur_q0712_11.htm");
					myself::FHTML_SetStr(fhtml0,"name",talker.name);
					myself::ShowFHTML(talker,fhtml0);
					myself::Say(gg::MakeFString(71259,talker.name,"","","",""));
					myself::DeclareLord(84,talker);
					myself::RemoveMemo(talker,712);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					gg::AddLog(2,talker,712);
				}
			}
		}
		super;
	}

}
