@LabelIndex 394678
@StringIndex 58761
class 0 matras : citizen {
handler:
	EventHandler TALK_SELECTED(fhtml0,i0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,132) == 0 && myself::GetOneTimeQuestFlag(talker,132) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Curiosity of a Matras");
			}
			if( gg::HaveMemo(talker,132) == 0 && myself::GetOneTimeQuestFlag(talker,132) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Curiosity of a Matras (Done)");
			}
			if( gg::HaveMemo(talker,132) == 1 && gg::GetMemoState(talker,132) == 1 && myself::GetOneTimeQuestFlag(talker,132) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Curiosity of a Matras (In Progress)");
			}
			if( gg::HaveMemo(talker,132) == 1 && gg::GetMemoState(talker,132) == 2 && myself::GetOneTimeQuestFlag(talker,132) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Curiosity of a Matras (In Progress)");
			}
			if( gg::HaveMemo(talker,691) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Matras' Suspicious Request");
			}
			if( gg::HaveMemo(talker,691) == 1 && gg::GetMemoState(talker,691) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Matras' Suspicious Request (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,132) == 0 && myself::GetOneTimeQuestFlag(talker,132) == 0 ) ) {
						myself::SetCurrentQuestID(132);
						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( talker.level >= 76 ) {
								myself::FHTML_SetFileName(fhtml0,"matras_q0132_01.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",132);
								myself::ShowQuestFHTML(talker,fhtml0,132);
							} else {
								myself::ShowQuestPage(talker,"matras_q0132_02.htm",132);
							}
						} else {
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,132) == 0 && myself::GetOneTimeQuestFlag(talker,132) == 1 ) ) {
						myself::SetCurrentQuestID(132);
						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,"finishedquest.htm");
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,132) == 1 && gg::GetMemoState(talker,132) == 1 && myself::GetOneTimeQuestFlag(talker,132) == 0 ) ) {
						myself::SetCurrentQuestID(132);
						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::OwnItemCount(talker,9800) >= 1 && gg::OwnItemCount(talker,9801) >= 1 ) {
							myself::DeleteItem1(talker,9800,gg::OwnItemCount(talker,9800));
							myself::DeleteItem1(talker,9801,gg::OwnItemCount(talker,9801));
							myself::SetMemoState(talker,132,2);
							myself::ShowPage(talker,"matras_q0132_05.htm");
							myself::SetFlagJournal(talker,132,3);
							myself::ShowQuestMark(talker,132);
							myself::SoundEffect(talker,"ItemSound.quest_middle");
						} else {
							myself::ShowPage(talker,"matras_q0132_04.htm");
						}
					}
					break;
				}
				case 3: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,132) == 1 && gg::GetMemoState(talker,132) == 2 && myself::GetOneTimeQuestFlag(talker,132) == 0 ) ) {
						myself::SetCurrentQuestID(132);
						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,"matras_q0132_06.htm");
					}
					break;
				}
				case 4: {
					if( _from_choice == 0 || gg::HaveMemo(talker,691) == 0 ) {
						myself::SetCurrentQuestID(691);
						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( talker.level >= 76 ) {
								myself::ShowQuestPage(talker,"matras_q0691_01.htm",691);
							} else {
								myself::ShowPage(talker,"matras_q0691_03.htm");
							}
						} else {
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 5: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,691) == 1 && gg::GetMemoState(talker,691) == 1 ) ) {
						myself::SetCurrentQuestID(691);
						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::OwnItemCount(talker,10372) >= 1 ) {
							myself::ShowPage(talker,"matras_q0691_05.htm");
						} else if( gg::GetMemoStateEx(talker,691,1) == 0 ) {
							myself::ShowPage(talker,"matras_q0691_06.htm");
						} else if( gg::GetMemoStateEx(talker,691,1) >= 1 ) {
							i0 = gg::GetMemoStateEx(talker,691,1);
							myself::FHTML_SetFileName(fhtml0,"matras_q0691_07.htm");
							myself::FHTML_SetInt(fhtml0,"itemcount",i0);
							myself::ShowFHTML(talker,fhtml0);
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker) {
		if( quest_id == 132 ) {
			myself::SetCurrentQuestID(132);
			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::HaveMemo(talker,132) == 0 && myself::GetOneTimeQuestFlag(talker,132) == 0 && talker.level >= 76 ) {
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 ) {
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::SetMemoState(talker,132,1);
					myself::SetMemo(talker,quest_id);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					gg::AddLog(1,talker,quest_id);
					myself::SetFlagJournal(talker,132,1);
					myself::ShowQuestMark(talker,132);
					if( myself::GetOneTimeQuestFlag(talker,200) == 0 ) {
						myself::GiveItem1(talker,10521,1);
						myself::GiveItem1(talker,10522,1);
						myself::GiveItem1(talker,10523,1);
						myself::GiveItem1(talker,10524,1);
						myself::GiveItem1(talker,10525,1);
						myself::GiveItem1(talker,10526,1);
						myself::SetOneTimeQuestFlag(talker,200,1);
						myself::ShowQuestPage(talker,"matras_q0132_03.htm",132);
					} else {
						myself::ShowQuestPage(talker,"matras_q0132_03a.htm",132);
					}
				}
			}
			return;
		}
		if( quest_id == 691 ) {
			myself::SetCurrentQuestID(691);
			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 ) {
				if( talker.level >= 76 && gg::HaveMemo(talker,691) == 0 ) {
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::SetMemoState(talker,691,1);
					myself::SetMemo(talker,quest_id);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					myself::ShowQuestPage(talker,"matras_q0691_04.htm",691);
					gg::AddLog(1,talker,quest_id);
					myself::SetFlagJournal(talker,691,1);
					myself::ShowQuestMark(talker,691);
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,fhtml0,i0,i1,reply,talker) {
		if( ask == 132 ) {
			myself::SetCurrentQuestID(132);
			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 == 132 ) {
			if( reply == 1 && gg::HaveMemo(talker,132) == 1 && gg::GetMemoState(talker,132) == 2 && myself::GetOneTimeQuestFlag(talker,132) == 0 ) {
				myself::RemoveMemo(talker,132);
				myself::SoundEffect(talker,"ItemSound.quest_finish");
				myself::ShowPage(talker,"matras_q0132_07.htm");
				gg::AddLog(2,talker,132);
				myself::GiveItem1(talker,57,65884);
				myself::IncrementParam(talker,0,50541);
				myself::IncrementParam(talker,1,5094);
				myself::SetOneTimeQuestFlag(talker,132,1);
			}
		}
		if( ask == 691 ) {
			myself::SetCurrentQuestID(691);
			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 == 691 ) {
			if( reply == 1 ) {
				if( gg::HaveMemo(talker,691) == 0 ) {
					myself::FHTML_SetFileName(fhtml0,"matras_q0691_02.htm");
					myself::FHTML_SetInt(fhtml0,"quest_id",691);
					myself::ShowQuestFHTML(talker,fhtml0,691);
				}
			}
			if( reply == 2 ) {
				if( gg::HaveMemo(talker,691) == 1 && gg::GetMemoState(talker,691) == 1 ) {
					i0 = gg::GetMemoStateEx(talker,691,1);
					i1 = gg::OwnItemCount(talker,10372);
					myself::DeleteItem1(talker,10372,gg::OwnItemCount(talker,10372));
					myself::SetMemoStateEx(talker,691,1,( i0 + i1 ));
					myself::FHTML_SetFileName(fhtml0,"matras_q0691_08.htm");
					myself::FHTML_SetInt(fhtml0,"itemcount",( i0 + i1 ));
					myself::ShowFHTML(talker,fhtml0);
				}
			}
			if( reply == 3 ) {
				if( gg::HaveMemo(talker,691) == 1 && gg::GetMemoState(talker,691) == 1 ) {
					if( gg::GetMemoStateEx(talker,691,1) >= 744 ) {
						i0 = gg::GetMemoStateEx(talker,691,1);
						gg::AddLog(3,talker,691);
						myself::SetMemoStateEx(talker,691,1,( i0 - 744 ));
						myself::ShowPage(talker,"matras_q0691_09.htm");
						myself::GiveItem1(talker,10413,1);
					} else {
						i0 = gg::GetMemoStateEx(talker,691,1);
						myself::FHTML_SetFileName(fhtml0,"matras_q0691_10.htm");
						myself::FHTML_SetInt(fhtml0,"itemcount",i0);
						myself::ShowFHTML(talker,fhtml0);
					}
				}
			}
			if( reply == 4 ) {
				myself::ShowPage(talker,"matras_q0691_11.htm");
			}
			if( reply == 5 ) {
				i0 = gg::GetMemoStateEx(talker,691,1);
				myself::GiveItem1(talker,57,( i0 * 10000 ));
				myself::RemoveMemo(talker,691);
				myself::SoundEffect(talker,"ItemSound.quest_finish");
				myself::ShowPage(talker,"matras_q0691_12.htm");
				gg::AddLog(2,talker,691);
			}
		}
		super;
	}

}
