@LabelIndex 397938
@StringIndex 59516
class 0 pa36_intro_npc : ai_pa36_intro {
handler:
	EventHandler TALK_SELECTED(fhtml0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,128) == 0 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Pailaka - Song of Ice and Fire");
			}
			if( gg::HaveMemo(talker,128) == 0 && myself::GetOneTimeQuestFlag(talker,128) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Pailaka - Song of Ice and Fire (done)");
			}
			if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 1 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Pailaka - Song of Ice and Fire (in progress)");
			}
			if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) >= 2 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Pailaka - Song of Ice and Fire (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,128) == 0 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) ) {
						myself::SetCurrentQuestID(128);
						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 ) {
							myself::ShowQuestPage(talker,"pa36_intro_npc_q0128_02.htm",128);
						} else {
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,128) == 0 && myself::GetOneTimeQuestFlag(talker,128) == 1 ) ) {
						myself::SetCurrentQuestID(128);
						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::ShowQuestPage(talker,"pa36_intro_npc_q0128_02b.htm",128);
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 1 ) ) {
						myself::SetCurrentQuestID(128);
						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,"pa36_intro_npc_q0128_06.htm");
					}
					break;
				}
				case 3: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) >= 2 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) ) {
						myself::SetCurrentQuestID(128);
						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,"pa36_intro_npc_q0128_07.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker) {
		if( quest_id == 128 ) {
			myself::SetCurrentQuestID(128);
			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,128) == 0 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
					if( talker.level >= 36 && talker.level <= 42 ) {
						myself::SetMemoState(talker,128,1);
						myself::SetMemo(talker,quest_id);
						myself::SoundEffect(talker,"ItemSound.quest_accept");
						myself::ShowQuestPage(talker,"pa36_intro_npc_q0128_04.htm",128);
						gg::AddLog(1,talker,quest_id);
						myself::SetFlagJournal(talker,128,1);
						myself::ShowQuestMark(talker,128);
					} else if( talker.level < 36 ) {
						myself::ShowQuestPage(talker,"pa36_intro_npc_q0128_05.htm",128);
					} else if( talker.level > 42 ) {
						myself::ShowQuestPage(talker,"pa36_intro_npc_q0128_05z.htm",128);
					}
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,fhtml0,reply,talker) {
		if( ask == 128 ) {
			myself::SetCurrentQuestID(128);
			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 == 128 ) {
			if( reply == 1 ) {
				if( gg::HaveMemo(talker,128) == 0 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
					myself::FHTML_SetFileName(fhtml0,"pa36_intro_npc_q0128_02a.htm");
					myself::FHTML_SetInt(fhtml0,"quest_id",128);
					myself::ShowQuestFHTML(talker,fhtml0,128);
				}
			}
		}
		super;
	}

}
