@LabelIndex 405076
@StringIndex 60815
class 0 chamberlain_alfred : chamberlain {
property:
	TelPosList Position1 = {{"Front of the Goddard Castle"; 153996; -50182; -2992; 0; 0 };{"Goddard Town Square"; 147728; -56331; -2776; 0; 0 };{"Front of the Border Fortress"; 153460; -70055; -3312; 0; 0 }};
	TelPosList Position2 = {{"Front of the Goddard Castle"; 153996; -50182; -2992; 0; 0 };{"Goddard Town Square"; 147728; -56331; -2776; 0; 0 };{"Front of the Border Fortress"; 153460; -70055; -3312; 0; 0 };{"Hot Springs"; 144880; -113468; -2560; 500; 0 };{"Varka Silenos Stronghold"; 125740; -40864; -3736; 500; 0 };{"Ketra Orc Outpost"; 146990; -67128; -3640; 500; 0 };{"Entrance to the Forge of the Gods"; 169018; -116303; -2432; 500; 0 };{"Wall of Argos"; 165054; -47861; -3560; 500; 0 }};
	BuySellList SellList0 = {{"advdeluxe_food_for_strider";10};{"pledge_shield_castle";10};{"circlet_of_godard";10};{"agathion_seal_bracelet_goddard";10};{"13686";10}};

handler:
	EventHandler TALK_SELECTED(fhtml0,i0,i1,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,715) == 0 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to Becoming a Lord - Goddard");
			}
			if( gg::HaveMemo(talker,715) == 1 && gg::GetMemoState(talker,715) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path to Becoming a Lord - Goddard (in progress)");
			}
			if( gg::HaveMemo(talker,715) == 1 && ( gg::GetMemoState(talker,715) / 100 ) == 1 && ( gg::GetMemoState(talker,715) % 100 ) != 21 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Path to Becoming a Lord - Goddard (in progress)");
			}
			if( gg::HaveMemo(talker,715) == 1 && gg::GetMemoState(talker,715) == 11 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Path to Becoming a Lord - Goddard (in progress)");
			}
			if( gg::HaveMemo(talker,715) == 1 && ( gg::GetMemoState(talker,715) / 100 ) == 2 && ( gg::GetMemoState(talker,715) / 10 ) != 22 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Path to Becoming a Lord - Goddard (in progress)");
			}
			if( gg::HaveMemo(talker,715) == 1 && ( ( gg::GetMemoState(talker,715) / 10 ) == 12 || ( gg::GetMemoState(talker,715) / 10 ) == 2 ) ) {
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Path to Becoming a Lord - Goddard (in progress)");
			}
			if( gg::HaveMemo(talker,715) == 1 && ( gg::GetMemoState(talker,715) / 10 ) == 22 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Path to Becoming a Lord - Goddard (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,715) == 0 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(715);
						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(87) == 0 ) {
								myself::ShowQuestPage(talker,"chamberlain_alfred_q0715_01.htm",715);
							} else {
								myself::ShowQuestPage(talker,"chamberlain_alfred_q0715_03.htm",715);
							}
						} else {
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,715) == 1 && gg::GetMemoState(talker,715) == 1 ) ) {
						myself::SetCurrentQuestID(715);
						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_alfred_q0715_04a.htm");
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,715) == 1 && ( gg::GetMemoState(talker,715) / 100 ) == 1 && ( gg::GetMemoState(talker,715) % 100 ) != 21 ) ) {
						myself::SetCurrentQuestID(715);
						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_alfred_q0715_07.htm");
					}
					break;
				}
				case 3: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,715) == 1 && gg::GetMemoState(talker,715) == 11 ) ) {
						myself::SetCurrentQuestID(715);
						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_alfred_q0715_08.htm");
					}
					break;
				}
				case 4: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,715) == 1 && ( gg::GetMemoState(talker,715) / 100 ) == 2 && ( gg::GetMemoState(talker,715) / 10 ) != 22 ) ) {
						myself::SetCurrentQuestID(715);
						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_alfred_q0715_09.htm");
						i0 = gg::GetMemoState(talker,715);
						if( i0 == 201 ) {
							myself::SetMemoState(talker,715,( i0 + 10 ));
						}
						myself::SetFlagJournal(talker,715,6);
						myself::ShowQuestMark(talker,715);
						myself::SoundEffect(talker,"ItemSound.quest_middle");
					}
					break;
				}
				case 5: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,715) == 1 && ( ( gg::GetMemoState(talker,715) / 10 ) == 12 || ( gg::GetMemoState(talker,715) / 10 ) == 2 ) ) ) {
						myself::SetCurrentQuestID(715);
						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 = gg::GetMemoState(talker,715);
						i1 = ( i0 / 10 );
						if( i1 == 2 ) {
							myself::SetMemoState(talker,715,( i0 + 100 ));
						}
						myself::ShowPage(talker,"chamberlain_alfred_q0715_10.htm");
						myself::SetFlagJournal(talker,715,7);
						myself::ShowQuestMark(talker,715);
						myself::SoundEffect(talker,"ItemSound.quest_middle");
					}
					break;
				}
				case 6: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,715) == 1 && ( gg::GetMemoState(talker,715) / 10 ) == 22 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(715);
						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(87) == 5 || myself::Castle_IsUnderSiege() ) {
							myself::ShowPage(talker,"chamberlain_alfred_q0715_11a.htm");
						} else if( gg::Fortress_GetContractStatus(109) == -1 ) {
							myself::ShowPage(talker,"chamberlain_alfred_q0715_11b.htm");
						} else {
							myself::ShowPage(talker,"chamberlain_alfred_q0715_11.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler MENU_SELECTED(ask,fhtml0,i0,reply,talker) {
		if( ask == 715 ) {
			myself::SetCurrentQuestID(715);
			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 == 715 ) {
			if( reply == 1 ) {
				if( gg::HaveMemo(talker,715) == 0 && myself::IsMyLord(talker) == 1 && myself::IsDominionOfLord(87) == 0 ) {
					myself::FHTML_SetFileName(fhtml0,"chamberlain_alfred_q0715_02.htm");
					myself::FHTML_SetInt(fhtml0,"quest_id",715);
					myself::ShowQuestFHTML(talker,fhtml0,715);
				}
			}
			if( reply == 2 ) {
				if( gg::HaveMemo(talker,715) == 1 && gg::GetMemoState(talker,715) == 1 ) {
					i0 = gg::GetMemoState(talker,715);
					myself::SetMemoState(talker,715,( i0 + 100 ));
					myself::ShowPage(talker,"chamberlain_alfred_q0715_05.htm");
					myself::SetFlagJournal(talker,715,2);
					myself::ShowQuestMark(talker,715);
					myself::SoundEffect(talker,"ItemSound.quest_middle");
				}
			}
			if( reply == 3 ) {
				if( gg::HaveMemo(talker,715) == 1 && gg::GetMemoState(talker,715) == 1 ) {
					i0 = gg::GetMemoState(talker,715);
					myself::SetMemoState(talker,715,( i0 + 10 ));
					myself::ShowPage(talker,"chamberlain_alfred_q0715_06.htm");
					myself::SetFlagJournal(talker,715,3);
					myself::ShowQuestMark(talker,715);
					myself::SoundEffect(talker,"ItemSound.quest_middle");
				}
			}
			if( reply == 4 ) {
				if( gg::HaveMemo(talker,715) == 1 && ( gg::GetMemoState(talker,715) / 10 ) == 22 && gg::GetDominionWarState(87) != 5 && myself::IsMyLord(talker) == 1 ) {
					myself::Say(gg::MakeFString(71559,talker.name,"","","",""));
					myself::DeclareLord(87,talker);
					myself::RemoveMemo(talker,715);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					gg::AddLog(2,talker,715);
					myself::ShowPage(talker,"chamberlain_alfred_q0715_12.htm");
				}
			}
		}
		super;
	}

}
