@LabelIndex 404877
@StringIndex 60757
class 0 chamberlain_neurath : chamberlain {
property:
	TelPosList Position1 = {{"Front of the Innadril Castle"; 117608; 241660; -1408; 0; 0 };{"Heine Town Square"; 111455; 219400; -3546; 0; 0 };{"Front of the White Sand Fortress"; 124651; 207877; -3184; 0; 0 }};
	TelPosList Position2 = {{"Front of the Innadril Castle"; 117608; 241660; -1408; 0; 0 };{"Heine Town Square"; 111455; 219400; -3546; 0; 0 };{"Front of the White Sand Fortress"; 124651; 207877; -3184; 0; 0 };{"The Center of Alligator Island"; 113708; 178387; -3232; 500; 0 };{"Field of Silence (Western Section)"; 75387; 195263; -3000; 500; 0 };{"Field of Whispers (Eastern Section)"; 97786; 209303; -3040; 500; 0 };{"Inside the Garden of Eva"; 82693; 242220; -6712; 500; 0 }};
	BuySellList SellList0 = {{"advdeluxe_food_for_strider";10};{"pledge_shield_castle";10};{"circlet_of_innadril";10};{"agathion_seal_bracelet_innadril";10};{"13686";10}};

handler:
	EventHandler TALK_SELECTED(c0,fhtml0,i0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,711) == 0 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path to Becoming a Lord - Innadril");
			}
			if( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 1 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path to Becoming a Lord - Innadril (in progress)");
			}
			if( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 2 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Path to Becoming a Lord - Innadril (in progress)");
			}
			if( myself::IsMyLord(talker) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Path to Becoming a Lord - Innadril (in progress)");
			}
			if( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 3 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Path to Becoming a Lord - Innadril (in progress)");
			}
			if( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 4 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Path to Becoming a Lord - Innadril (in progress)");
			}
			if( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 5 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Path to Becoming a Lord - Innadril (in progress)");
			}
			if( gg::HaveMemo(talker,711) == 1 && ( gg::GetMemoState(talker,711) / 1000 ) >= 1 && ( gg::GetMemoState(talker,711) / 1000 ) <= 100 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Path to Becoming a Lord - Innadril (in progress)");
			}
			if( gg::HaveMemo(talker,711) == 1 && ( gg::GetMemoState(talker,711) / 1000 ) >= 101 && myself::IsMyLord(talker) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Path to Becoming a Lord - Innadril (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,711) == 0 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(711);
						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(86) == 0 ) {
								myself::ShowQuestPage(talker,"chamberlain_neurath_q0711_01.htm",711);
							} else {
								myself::ShowQuestPage(talker,"chamberlain_neurath_q0711_03.htm",711);
							}
						} else {
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 1 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(711);
						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,711,1) ) < 60 ) {
							myself::ShowPage(talker,"chamberlain_neurath_q0711_05.htm");
						} else {
							myself::SetMemoState(talker,711,2);
							myself::SetMemoStateEx(talker,711,1,0);
							myself::ShowPage(talker,"chamberlain_neurath_q0711_06.htm");
						}
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 2 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(711);
						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_neurath_q0711_07.htm");
					}
					break;
				}
				case 3: {
					if( _from_choice == 0 || myself::IsMyLord(talker) == 0 ) {
						myself::SetCurrentQuestID(711);
						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::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) {
							c0 = myself::Pledge_GetLeader(talker);
							if( myself::IsNullCreature(c0) == 0 ) {
								if( gg::HaveMemo(c0,711) == 1 && gg::GetMemoState(c0,711) == 3 ) {
									if( myself::DistFromMe(c0) <= 1500 ) {
										myself::ShowPage(talker,"chamberlain_neurath_q0711_11.htm");
									} else {
										myself::ShowPage(talker,"chamberlain_neurath_q0711_10.htm");
									}
								} else if( gg::HaveMemo(c0,711) == 1 && gg::GetMemoState(c0,711) == 4 ) {
									myself::ShowPage(talker,"chamberlain_neurath_q0711_13a.htm");
								} else {
									myself::ShowPage(talker,"chamberlain_neurath_q0711_09.htm");
								}
							} else {
								myself::ShowPage(talker,"chamberlain_neurath_q0711_09.htm");
							}
						} else if( myself::Castle_GetPledgeId() != talker.pledge_id ) {
							myself::ShowPage(talker,"chamberlain_neurath_q0711_09.htm");
						}
					}
					break;
				}
				case 4: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 3 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(711);
						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_neurath_q0711_14.htm");
					}
					break;
				}
				case 5: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 4 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(711);
						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_neurath_q0711_15.htm");
					}
					break;
				}
				case 6: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 5 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(711);
						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,711);
						myself::SetMemoState(talker,711,( i0 + 1000 ));
						myself::ShowPage(talker,"chamberlain_neurath_q0711_16.htm");
						myself::SetFlagJournal(talker,711,5);
						myself::ShowQuestMark(talker,711);
						myself::SoundEffect(talker,"ItemSound.quest_middle");
					}
					break;
				}
				case 7: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,711) == 1 && ( gg::GetMemoState(talker,711) / 1000 ) >= 1 && ( gg::GetMemoState(talker,711) / 1000 ) <= 100 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(711);
						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::GetMemoState(talker,711) % 100 ) >= 15 ) {
							myself::ShowPage(talker,"chamberlain_neurath_q0711_17.htm");
						} else {
							myself::ShowPage(talker,"chamberlain_neurath_q0711_18.htm");
						}
					}
					break;
				}
				case 8: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,711) == 1 && ( gg::GetMemoState(talker,711) / 1000 ) >= 101 && myself::IsMyLord(talker) == 1 ) ) {
						myself::SetCurrentQuestID(711);
						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::GetMemoState(talker,711) % 100 ) >= 15 ) {
							if( gg::GetDominionWarState(86) == 5 || myself::Castle_IsUnderSiege() ) {
								myself::ShowPage(talker,"chamberlain_neurath_q0711_20a.htm");
							} else if( gg::Fortress_GetContractStatus(108) == -1 ) {
								myself::ShowPage(talker,"chamberlain_neurath_q0711_20b.htm");
							} else {
								myself::ShowPage(talker,"chamberlain_neurath_q0711_20.htm");
							}
						} else {
							myself::ShowPage(talker,"chamberlain_neurath_q0711_19.htm");
							myself::SetFlagJournal(talker,711,7);
							myself::ShowQuestMark(talker,711);
							myself::SoundEffect(talker,"ItemSound.quest_middle");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

	EventHandler TIMER_FIRED_EX(i0,talker,timer_id) {
		myself::SetCurrentQuestID(711);
		if( timer_id == 71101 ) {
			myself::Say(gg::MakeFString(71151,"","","","",""));
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,c0,fhtml0,i0,i1,reply,talker) {
		if( ask == 711 ) {
			myself::SetCurrentQuestID(711);
			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 == 711 ) {
			if( reply == 1 ) {
				if( gg::HaveMemo(talker,711) == 0 && myself::IsMyLord(talker) == 1 ) {
					myself::FHTML_SetFileName(fhtml0,"chamberlain_neurath_q0711_02.htm");
					myself::FHTML_SetInt(fhtml0,"quest_id",711);
					myself::ShowQuestFHTML(talker,fhtml0,711);
				}
			}
			if( reply == 2 ) {
				if( gg::HaveMemo(talker,711) == 1 && gg::GetMemoState(talker,711) == 2 && myself::IsMyLord(talker) == 1 ) {
					myself::SetMemoState(talker,711,3);
					myself::ShowPage(talker,"chamberlain_neurath_q0711_08.htm");
					myself::SetFlagJournal(talker,711,2);
					myself::ShowQuestMark(talker,711);
					myself::SoundEffect(talker,"ItemSound.quest_middle");
				}
			}
			if( reply == 3 ) {
				c0 = myself::Pledge_GetLeader(talker);
				i0 = talker.dbid;
				if( myself::IsNullCreature(c0) == 0 && myself::DistFromMe(c0) <= 1500 && gg::HaveMemo(c0,711) == 1 && gg::GetMemoState(c0,711) == 3 && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) {
					myself::FHTML_SetFileName(fhtml0,"chamberlain_neurath_q0711_12.htm");
					myself::FHTML_SetStr(fhtml0,"name",talker.name);
					myself::ShowFHTML(talker,fhtml0);
					myself::Say(gg::MakeFString(71152,talker.name,"","","",""));
					myself::SetMemoState(c0,711,4);
					myself::SetFlagJournal(c0,711,3);
					myself::ShowQuestMark(c0,711);
					myself::SoundEffect(c0,"ItemSound.quest_middle");
					myself::SetMemoStateEx(c0,711,1,i0);
				} else {
					myself::ShowPage(talker,"chamberlain_neurath_q0711_13.htm");
				}
			}
			if( reply == 4 ) {
				if( gg::HaveMemo(talker,711) == 1 && ( gg::GetMemoState(talker,711) / 1000 ) >= 101 && myself::IsMyLord(talker) == 1 && ( gg::GetMemoState(talker,711) % 100 ) >= 15 && gg::GetDominionWarState(86) != 5 ) {
					myself::FHTML_SetFileName(fhtml0,"chamberlain_neurath_q0711_21.htm");
					myself::FHTML_SetStr(fhtml0,"name",talker.name);
					myself::ShowFHTML(talker,fhtml0);
					myself::Say(gg::MakeFString(71159,talker.name,"","","",""));
					myself::DeclareLord(86,talker);
					myself::RemoveMemo(talker,711);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					gg::AddLog(2,talker,711);
				}
			}
		}
		super;
	}

}
