class 1 tweety : merchant_for_newbie
{
property:
	BuySellList SellList0 = {{"soulshot_none";15};{"spiritshot_none";15};{"blessed_spiritshot_none";15};{"comp_bspiritshot_none";15};{"comp_spiritshot_none";15};{"comp_soulshot_none";15};{"adv_comp_bspiritshot_none";15};{"adv_comp_spiritshot_none";15};{"adv_comp_soulshot_none";15};{"wooden_arrow";15};{"bone_arrow";15};{"lesser_healing_potion";15};{"antidote";15};{"bandage";15};{"quick_step_potion";15};{"swift_attack_potion";15};{"potion_of_acumen2";15};{"scroll_of_escape";15};{"scroll_of_resurrection";15};{"spirit_ore";15};{"soul_ore";15};{"energy_stone";15};{"key_of_thief";15};{"rope_of_magic_d";15};{"scroll_recovery_ng";15};{"scroll_recovery_d";15};{"elixir_of_life_ng";15};{"elixir_of_life_d";15};{"elixir_of_men_str_ng";15};{"elixir_of_men_str_d";15};{"elixir_of_cp_ng";15};{"elixir_of_cp_d";15};{"summoning_crystal";15};{"dice_heart";15};{"dice_spade";15};{"dice_clover";15};{"dice_diamond";15}};

handler:
	EventHandler (talker)
	{
		myself::ShowPage(talker,fnHi);
	}

	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,225) == 1 && myself::OwnItemCount(talker,2795) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Test of the Searcher (Continue)");
			}
			if( myself::HaveMemo(talker,225) == 1 && myself::OwnItemCount(talker,2796) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Test of the Searcher (Continue)");
			}
			if( myself::HaveMemo(talker,225) == 1 && ( myself::OwnItemCount(talker,2800) == 1 || myself::OwnItemCount(talker,2799) == 1 || myself::OwnItemCount(talker,2805) == 1 || myself::OwnItemCount(talker,2808) == 1 || myself::OwnItemCount(talker,2798) == 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Test of the Searcher (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 2 && myself::OwnItemCount(talker,4239) < 20 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 2 && myself::OwnItemCount(talker,4239) >= 20 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 3 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Acts of Evil (Continue)");
			}
			if( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) >= 4 && myself::GetOneTimeQuestFlag(talker,171) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Acts of Evil (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,225) == 1 && myself::OwnItemCount(talker,2795) == 1 ) )
					{
						myself::SetCurrentQuestID(225);
						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,"tweety_q0225_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,225) == 1 && myself::OwnItemCount(talker,2796) == 1 ) )
					{
						myself::SetCurrentQuestID(225);
						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,2797) < 10 )
						{
							myself::ShowPage(talker,"tweety_q0225_02.htm");
						}
						else if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
						{
							talker.quest_last_reward_time = myself::GetCurrentTick();
							myself::ShowPage(talker,"tweety_q0225_03.htm");
							myself::DeleteItem1(talker,2796,1);
							myself::GiveItem1(talker,2798,1);
							myself::DeleteItem1(talker,2797,myself::OwnItemCount(talker,2797));
							myself::SetFlagJournal(talker,225,12);
						}
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,225) == 1 && ( myself::OwnItemCount(talker,2800) == 1 || myself::OwnItemCount(talker,2799) == 1 || myself::OwnItemCount(talker,2805) == 1 || myself::OwnItemCount(talker,2808) == 1 || myself::OwnItemCount(talker,2798) == 1 ) ) )
					{
						myself::SetCurrentQuestID(225);
						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,"tweety_q0225_04.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 2 && myself::OwnItemCount(talker,4239) < 20 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"tweety_q0171_01.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 2 && myself::OwnItemCount(talker,4239) >= 20 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,4240,1);
							myself::DeleteItem1(talker,4239,myself::OwnItemCount(talker,4239));
							myself::SetMemoState(talker,171,3);
							myself::SetFlagJournal(talker,171,3);
							myself::ShowPage(talker,"tweety_q0171_02.htm");
						}
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) == 3 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"tweety_q0171_03.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,171) == 1 && myself::GetMemoState(talker,171) >= 4 && myself::GetOneTimeQuestFlag(talker,171) == 0 ) )
					{
						myself::SetCurrentQuestID(171);
						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,"tweety_q0171_04.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 225 )
		{
			myself::SetCurrentQuestID(225);
			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 == 225 )
		{
			if( reply == 1 )
			{
				if( myself::OwnItemCount(talker,2795) >= 1 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::ShowPage(talker,"tweety_q0225_01a.htm");
						myself::DeleteItem1(talker,2795,1);
						myself::GiveItem1(talker,2796,1);
						myself::SetFlagJournal(talker,225,10);
					}
				}
			}
		}
		super;
	}

}
