@LabelIndex 380553
@StringIndex 55954
class 0 retired_oldman_tantan : citizen {
handler:
	EventHandler TALK_SELECTED(fhtml0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,652) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"An Aged Ex-Adventurer");
			}
			if( gg::HaveMemo(talker,652) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"An Aged Ex-Adventurer (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,652) == 0 ) {
						myself::SetCurrentQuestID(652);
						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 >= 46 ) {
								myself::FHTML_SetFileName(fhtml0,"retired_oldman_tantan_q0652_01.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",652);
								myself::ShowQuestFHTML(talker,fhtml0,652);
							} else {
								myself::ShowQuestPage(talker,"retired_oldman_tantan_q0652_01a.htm",652);
							}
						} else {
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || gg::HaveMemo(talker,652) == 1 ) {
						myself::SetCurrentQuestID(652);
						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,"retired_oldman_tantan_q0652_02.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker) {
		if( quest_id == 652 ) {
			myself::SetCurrentQuestID(652);
			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,1464) >= 100 ) {
					if( myself.av_quest0::CompareExchange(1,0) <= 0 ) {
						myself::DeleteItem1(talker,1464,100);
						myself::SetMemo(talker,quest_id);
						myself::ShowQuestMark(talker,quest_id);
						myself::SoundEffect(talker,"ItemSound.quest_accept");
						myself::ShowQuestPage(talker,"retired_oldman_tantan_q0652_04.htm",652);
						gg::AddLog(1,talker,quest_id);
						myself::AddTimerEx(65201,( 3 * 1000 ));
					} else {
						myself::ShowQuestPage(talker,"retired_oldman_tantan_q0652_06.htm",652);
					}
				} else if( gg::OwnItemCount(talker,1464) <= 0 ) {
					myself::ShowQuestPage(talker,"retired_oldman_tantan_q0652_05.htm",652);
				} else {
					myself::ShowQuestPage(talker,"retired_oldman_tantan_q0652_05a.htm",652);
				}
			}
			return;
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(timer_id) {
		myself::SetCurrentQuestID(652);
		if( timer_id == 65201 ) {
			myself::Despawn();
		}
		super;
	}

}
