@LabelIndex 397759
@StringIndex 59485
class 0 q_inventor_maru : citizen {
handler:
	EventHandler TALK_SELECTED(fhtml0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,269) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Invention Ambition");
			}
			if( gg::HaveMemo(talker,269) == 1 && gg::OwnItemCount(talker,10866) < 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Invention Ambition (In Progress)");
			}
			if( gg::HaveMemo(talker,269) == 1 && gg::OwnItemCount(talker,10866) >= 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Invention Ambition (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,269) == 0 ) {
						myself::SetCurrentQuestID(269);
						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 >= 18 ) {
								myself::ShowQuestPage(talker,"inventor_maru_q0269_01.htm",269);
							} else {
								myself::ShowPage(talker,"inventor_maru_q0269_02.htm");
							}
						} else {
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,269) == 1 && gg::OwnItemCount(talker,10866) < 1 ) ) {
						myself::SetCurrentQuestID(269);
						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,"inventor_maru_q0269_05.htm");
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,269) == 1 && gg::OwnItemCount(talker,10866) >= 1 ) ) {
						myself::SetCurrentQuestID(269);
						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::OwnItemCount(talker,10866) >= 10 ) {
								myself::GiveItem1(talker,57,( ( 50 * gg::OwnItemCount(talker,10866) ) + 2044 ));
							} else {
								myself::GiveItem1(talker,57,( 50 * gg::OwnItemCount(talker,10866) ));
							}
							gg::AddLog(3,talker,269);
							myself::DeleteItem1(talker,10866,gg::OwnItemCount(talker,10866));
							myself::ShowPage(talker,"inventor_maru_q0269_06.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker) {
		if( quest_id == 269 ) {
			myself::SetCurrentQuestID(269);
			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,269) == 0 && talker.level >= 18 ) {
					myself::SetMemo(talker,269);
					myself::ShowQuestMark(talker,269);
					gg::AddLog(1,talker,269);
					myself::SetFlagJournal(talker,269,1);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					myself::ShowQuestPage(talker,"inventor_maru_q0269_04.htm",269);
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,fhtml0,reply,talker) {
		if( ask == 269 ) {
			myself::SetCurrentQuestID(269);
			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 == 269 ) {
			if( reply == 1 ) {
				if( gg::HaveMemo(talker,269) == 0 && talker.level >= 18 ) {
					myself::FHTML_SetFileName(fhtml0,"inventor_maru_q0269_03.htm");
					myself::FHTML_SetInt(fhtml0,"quest_id",269);
					myself::ShowQuestFHTML(talker,fhtml0,269);
				}
			}
			if( reply == 2 ) {
				if( gg::HaveMemo(talker,269) == 1 ) {
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 ) {
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::RemoveMemo(talker,269);
						gg::AddLog(2,talker,269);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
						myself::ShowPage(talker,"inventor_maru_q0269_07.htm");
					}
				}
			}
			if( reply == 3 ) {
				if( gg::HaveMemo(talker,269) == 1 ) {
					myself::ShowPage(talker,"inventor_maru_q0269_08.htm");
				}
			}
		}
		super;
	}

}
