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

handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,2) == 1 && myself::GetOneTimeQuestFlag(talker,2) == 0 && myself::OwnItemCount(talker,1092) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"What Women Want (Continue)");
			}
			if( myself::HaveMemo(talker,313) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Collect Spores");
			}
			if( myself::HaveMemo(talker,313) != 0 && myself::OwnItemCount(talker,1118) < 10 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Collect Spores (Continue)");
			}
			if( myself::HaveMemo(talker,313) != 0 && myself::OwnItemCount(talker,1118) >= 10 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Collect Spores (Continue)");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,2) == 1 && myself::GetOneTimeQuestFlag(talker,2) == 0 && myself::OwnItemCount(talker,1092) == 0 ) )
					{
						myself::SetCurrentQuestID(2);
						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::OwnItemCount(talker,1093) )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::ShowPage(talker,"green_q0002_01.htm");
								myself::SetFlagJournal(talker,2,3);
								myself::DeleteItem1(talker,1093,1);
								myself::GiveItem1(talker,1094,1);
							}
						}
						else if( myself::OwnItemCount(talker,1094) || myself::OwnItemCount(talker,689) || myself::OwnItemCount(talker,693) )
						{
							myself::ShowPage(talker,"green_q0002_02.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || myself::HaveMemo(talker,313) == 0 )
					{
						myself::SetCurrentQuestID(313);
						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 >= 8 )
							{
								myself::FHTML_SetFileName(fhtml0,"green_q0313_03.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",313);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"green_q0313_02.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,313) != 0 && myself::OwnItemCount(talker,1118) < 10 ) )
					{
						myself::SetCurrentQuestID(313);
						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,"green_q0313_06.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,313) != 0 && myself::OwnItemCount(talker,1118) >= 10 ) )
					{
						myself::SetCurrentQuestID(313);
						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::DeleteItem1(talker,1118,myself::OwnItemCount(talker,1118));
							myself::RemoveMemo(talker,313);
							myself::AddLog(2,talker,313);
							myself::SoundEffect(talker,"ItemSound.quest_finish");
							myself::GiveItem1(talker,57,3500);
							myself::ShowPage(talker,"green_q0313_07.htm");
						}
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 313 )
		{
			myself::SetCurrentQuestID(313);
			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::SetMemo(talker,quest_id);
				myself::AddLog(1,talker,313);
				myself::SetFlagJournal(talker,313,1);
				myself::SoundEffect(talker,"ItemSound.quest_accept");
				myself::ShowPage(talker,"green_q0313_05.htm");
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,fhtml0,quest_id,reply,talker)
	{
		if( ask == 313 )
		{
			myself::SetCurrentQuestID(313);
			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 == 313 )
		{
			if( reply == 1 )
			{
				myself::FHTML_SetFileName(fhtml0,"green_q0313_04.htm");
				myself::FHTML_SetInt(fhtml0,"quest_id",313);
				myself::ShowFHTML(talker,fhtml0);
			}
		}
		super;
	}

}
