@LabelIndex 398355
@StringIndex 59582
class 0 pa36_enchant_npc : ai_pa36_enchant {
handler:
	EventHandler TALK_SELECTED(fhtml0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) < 3 && gg::OwnItemCount(talker,13034) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Pailaka - Song of Ice and Fire (in progress)");
			}
			if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) < 3 && gg::OwnItemCount(talker,13034) >= 1 && gg::OwnItemCount(talker,13038) == 0 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Pailaka - Song of Ice and Fire (in progress)");
			}
			if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 3 && gg::OwnItemCount(talker,13034) >= 1 && gg::OwnItemCount(talker,13038) >= 1 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
				_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) >= 4 && gg::GetMemoState(talker,128) < 6 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Pailaka - Song of Ice and Fire (in progress)");
			}
			if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 6 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Pailaka - Song of Ice and Fire (in progress)");
			}
			if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) >= 7 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"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) == 1 && gg::GetMemoState(talker,128) < 3 && gg::OwnItemCount(talker,13034) == 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_enchant_npc_q0128_01a.htm");
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) < 3 && gg::OwnItemCount(talker,13034) >= 1 && gg::OwnItemCount(talker,13038) == 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;
						}
						myself::ShowPage(talker,"pa36_enchant_npc_q0128_01.htm");
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 3 && gg::OwnItemCount(talker,13034) >= 1 && gg::OwnItemCount(talker,13038) >= 1 && 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_enchant_npc_q0128_02.htm");
					}
					break;
				}
				case 3: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) >= 4 && gg::GetMemoState(talker,128) < 6 && 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_enchant_npc_q0128_05.htm");
					}
					break;
				}
				case 4: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 6 && 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_enchant_npc_q0128_06.htm");
					}
					break;
				}
				case 5: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) >= 7 && 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_enchant_npc_q0128_06a.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,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 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
				if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 3 && gg::OwnItemCount(talker,13034) >= 1 && gg::OwnItemCount(talker,13038) >= 1 ) {
					myself::GiveItem1(talker,13035,1);
					myself::GiveItem1(talker,13132,1);
					myself::DeleteItem1(talker,13034,gg::OwnItemCount(talker,13034));
					myself::DeleteItem1(talker,13038,gg::OwnItemCount(talker,13038));
					myself::DeleteItem1(talker,13131,gg::OwnItemCount(talker,13131));
					myself::SetMemoState(talker,128,4);
					myself::ShowPage(talker,"pa36_enchant_npc_q0128_03.htm");
					myself::SetFlagJournal(talker,128,4);
					myself::ShowQuestMark(talker,128);
					myself::SoundEffect(talker,"ItemSound.quest_middle");
				} else if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 3 && ( gg::OwnItemCount(talker,13034) < 1 || gg::OwnItemCount(talker,13038) < 1 ) ) {
					myself::ShowPage(talker,"pa36_enchant_npc_q0128_04.htm");
				}
			}
			if( reply == 2 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
				if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 6 && gg::OwnItemCount(talker,13035) >= 1 && gg::OwnItemCount(talker,13039) >= 1 ) {
					myself::ShowPage(talker,"pa36_enchant_npc_q0128_07.htm");
				} else if( gg::HaveMemo(talker,128) == 1 && gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 6 && ( gg::OwnItemCount(talker,13035) < 1 || gg::OwnItemCount(talker,13039) < 1 ) ) {
					myself::ShowPage(talker,"pa36_enchant_npc_q0128_04.htm");
				}
			}
			if( reply == 3 && myself::GetOneTimeQuestFlag(talker,128) == 0 ) {
				if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 6 && gg::OwnItemCount(talker,13035) >= 1 && gg::OwnItemCount(talker,13039) >= 1 ) {
					myself::GiveItem1(talker,13036,1);
					myself::GiveItem1(talker,13135,1);
					myself::DeleteItem1(talker,13035,1);
					myself::DeleteItem1(talker,13039,1);
					myself::DeleteItem1(talker,13134,1);
					myself::SetMemoState(talker,128,7);
					myself::ShowPage(talker,"pa36_enchant_npc_q0128_09.htm");
					myself::SetFlagJournal(talker,128,7);
					myself::ShowQuestMark(talker,128);
					myself::SoundEffect(talker,"ItemSound.quest_middle");
				} else if( gg::HaveMemo(talker,128) == 1 && gg::GetMemoState(talker,128) == 6 && ( gg::OwnItemCount(talker,13035) < 1 || gg::OwnItemCount(talker,13039) < 1 ) ) {
					myself::ShowPage(talker,"pa36_enchant_npc_q0128_04.htm");
				}
			}
		}
		super;
	}

}
