@LabelIndex 379560
@StringIndex 55776
class 0 mineral_trader_hittchi : merchant {
property:
	BuySellList SellList0 = {{"spirit_ore";20};{"soul_ore";20};{"rope_of_magic_d";20};{"rope_of_magic_c";20};{"rope_of_magic_b";20};{"rope_of_magic_a";20};{"gemstone_d";20};{"gemstone_c";20};{"gemstone_b";20}};

handler:
	EventHandler TALK_SELECTED(fhtml0,talker) {
		if( _from_choice == 0 ) {
			if( gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 100 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Path of the Artisan (In Progress)");
			}
			if( gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 101 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Path of the Artisan (In Progress)");
			}
			if( gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 102 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Path of the Artisan (In Progress)");
			}
			if( gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 201 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Path of the Artisan (In Progress)");
			}
			if( gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 202 ) {
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Path of the Artisan (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,418) == 1 && gg::GetMemoState(talker,418) == 100 ) ) {
						myself::SetCurrentQuestID(418);
						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,"mineral_trader_hittchi_q0418_01.htm");
					}
					break;
				}
				case 1: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 101 ) ) {
						myself::SetCurrentQuestID(418);
						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,"mineral_trader_hittchi_q0418_04.htm");
					}
					break;
				}
				case 2: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 102 ) ) {
						myself::SetCurrentQuestID(418);
						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,"mineral_trader_hittchi_q0418_06a.htm");
					}
					break;
				}
				case 3: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 201 ) ) {
						myself::SetCurrentQuestID(418);
						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,"mineral_trader_hittchi_q0418_08.htm");
					}
					break;
				}
				case 4: {
					if( _from_choice == 0 || ( gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 202 ) ) {
						myself::SetCurrentQuestID(418);
						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,"mineral_trader_hittchi_q0418_11.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker) {
		if( ask == 418 ) {
			myself::SetCurrentQuestID(418);
			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 == 418 ) {
			if( reply == 1 && gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 100 ) {
				myself::ShowPage(talker,"mineral_trader_hittchi_q0418_02.htm");
			}
			if( reply == 101 && gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 100 ) {
				myself::SetMemoState(talker,418,101);
				myself::ShowPage(talker,"mineral_trader_hittchi_q0418_03.htm");
				myself::SetFlagJournal(talker,418,10);
				myself::ShowQuestMark(talker,418);
				myself::SoundEffect(talker,"ItemSound.quest_middle");
			}
			if( reply == 102 && gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 100 ) {
				myself::SetMemoState(talker,418,102);
				myself::ShowPage(talker,"mineral_trader_hittchi_q0418_05.htm");
				myself::SetFlagJournal(talker,418,11);
				myself::ShowQuestMark(talker,418);
				myself::SoundEffect(talker,"ItemSound.quest_middle");
			}
			if( reply == 2 && gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 100 ) {
				myself::ShowPage(talker,"mineral_trader_hittchi_q0418_06.htm");
			}
			if( reply == 201 && gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 100 ) {
				myself::SetMemoState(talker,418,201);
				myself::ShowPage(talker,"mineral_trader_hittchi_q0418_07.htm");
				myself::SetFlagJournal(talker,418,12);
				myself::ShowQuestMark(talker,418);
				myself::SoundEffect(talker,"ItemSound.quest_middle");
			}
			if( reply == 202 && gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 100 ) {
				myself::SetMemoState(talker,418,202);
				myself::ShowPage(talker,"mineral_trader_hittchi_q0418_09.htm");
			}
			if( reply == 203 && gg::HaveMemo(talker,418) == 1 && gg::GetMemoState(talker,418) == 202 ) {
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 ) {
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::GiveItem1(talker,1635,1);
					if( myself::GetOneTimeQuestFlag(talker,145) == 0 ) {
						myself::SetOneTimeQuestFlag(talker,145,1);
						if( talker.level >= 20 ) {
							myself::IncrementParam(talker,0,160267);
							myself::IncrementParam(talker,1,11726);
							myself::GiveItem1(talker,57,81900);
						} else if( talker.level >= 19 ) {
							myself::IncrementParam(talker,0,228064);
							myself::IncrementParam(talker,1,15075);
							myself::GiveItem1(talker,57,81900);
						} else {
							myself::IncrementParam(talker,0,295862);
							myself::IncrementParam(talker,1,18424);
							myself::GiveItem1(talker,57,81900);
						}
					}
					gg::AddLog(2,talker,418);
					myself::RemoveMemo(talker,418);
					gg::AddPCSocial(gg::GetIndexFromCreature(talker),3);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					myself::ShowPage(talker,"mineral_trader_hittchi_q0418_10.htm");
				}
			}
		}
		super;
	}

}
