class 1 day_violet : merchant_for_chaotic
{
property:
	BuySellList SellList0 = {{"soulshot_none";50};{"spiritshot_none";50};{"blessed_spiritshot_none";50};{"comp_bspiritshot_none";50};{"comp_spiritshot_none";50};{"comp_soulshot_none";50};{"adv_comp_bspiritshot_none";50};{"adv_comp_spiritshot_none";50};{"adv_comp_soulshot_none";50};{"wooden_arrow";50};{"bone_arrow";50};{"fine_steel_arrow";50};{"lesser_healing_potion";50};{"healing_potion";50};{"antidote";50};{"advanced_antidote";50};{"bandage";50};{"emergency_dressing";50};{"quick_step_potion";50};{"swift_attack_potion";50};{"potion_of_acumen2";50};{"scroll_of_awake";50};{"scroll_of_escape";50};{"scroll_of_resurrection";50};{"scroll_of_escape_to_agit";50};{"spirit_ore";50};{"soul_ore";50};{"energy_stone";50};{"key_of_thief";50};{"rope_of_magic_d";50};{"rope_of_magic_c";50};{"rope_of_magic_b";50};{"gemstone_d";50};{"dice_heart";50};{"dice_spade";50};{"dice_clover";50};{"dice_diamond";50};{"scroll_recovery_ng";50};{"scroll_recovery_d";50};{"scroll_recovery_c";50};{"scroll_recovery_b";50};{"elixir_of_life_ng";50};{"elixir_of_life_d";50};{"elixir_of_life_c";50};{"elixir_of_men_str_d";50};{"elixir_of_cp_ng";50};{"elixir_of_cp_d";50};{"elixir_of_cp_c";50};{"elixir_of_cp_b";50}};

handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,23) == 1 && myself::GetMemoState(talker,23) == 10 && myself::OwnItemCount(talker,7149) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Lidia's Heart (Continue)");
			}
			if( myself::HaveMemo(talker,23) == 1 && myself::GetMemoState(talker,23) == 11 && myself::OwnItemCount(talker,7150) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Lidia's Heart (Continue)");
			}
			if( myself::HaveMemo(talker,23) == 1 && myself::GetMemoState(talker,23) == 11 && myself::OwnItemCount(talker,7150) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Lidia's Heart (Continue)");
			}
			if( myself::HaveMemo(talker,23) == 0 && myself::GetOneTimeQuestFlag(talker,23) == 1 && myself::HaveMemo(talker,24) == 0 && myself::GetOneTimeQuestFlag(talker,24) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Lidia's Heart (End)");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,23) == 1 && myself::GetMemoState(talker,23) == 10 && myself::OwnItemCount(talker,7149) >= 1 ) )
					{
						myself::SetCurrentQuestID(23);
						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::SetMemoState(talker,23,11);
						myself::ShowPage(talker,"day_violet_q0023_01.htm");
						myself::SetFlagJournal(talker,23,9);
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,23) == 1 && myself::GetMemoState(talker,23) == 11 && myself::OwnItemCount(talker,7150) == 0 ) )
					{
						myself::SetCurrentQuestID(23);
						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,"day_violet_q0023_02.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,23) == 1 && myself::GetMemoState(talker,23) == 11 && myself::OwnItemCount(talker,7150) >= 1 ) )
					{
						myself::SetCurrentQuestID(23);
						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();
							myself::GiveItem1(talker,57,100000);
							myself::DeleteItem1(talker,7150,myself::OwnItemCount(talker,7150));
							myself::RemoveMemo(talker,23);
							myself::AddLog(2,talker,23);
							myself::SetOneTimeQuestFlag(talker,23,1);
							myself::SoundEffect(talker,"ItemSound.quest_finish");
							myself::ShowPage(talker,"day_violet_q0023_03.htm");
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,23) == 0 && myself::GetOneTimeQuestFlag(talker,23) == 1 && myself::HaveMemo(talker,24) == 0 && myself::GetOneTimeQuestFlag(talker,24) == 0 ) )
					{
						myself::SetCurrentQuestID(23);
						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,"day_violet_q0023_04.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

}
