class 1 galicbredo : merchant
{
property:
	BuySellList SellList0 = {{"necklace_of_wisdom";15};{"blue_diamond_necklace";15};{"necklace_of_devotion";15};{"cat_seye_earing";15};{"coral_earing";15};{"red_cresent_earing";15};{"ring_of_wisdom";15};{"blue_coral_ring";15};{"ring_of_devotion";15}};
	BuySellList SellList1 = {{"sb_adv_defence_power1";15};{"sb_advanced_attack_power1";15};{"sb_might1";15};{"sb_battle_heal1";15};{"sb_vampiric_touch1";15};{"sb_ice_bolt1";15};{"sb_heal1";15};{"sb_group_heal1";15};{"sb_shield1";15};{"sb_breeze1";15};{"sb_wind_walk1";15};{"sb_curse:weakness";15};{"sb_curse:poison1";15};{"sb_cure_poison1";15};{"sb_flame_strike1";15};{"sb_drain_energy1";15};{"sb_elemental_heal1";15};{"sb_disrupt_undead1";15};{"sb_resurrection1";15};{"sb_blaze1";15};{"sb_summon_shadow1";15};{"sb_summon_silhouette1";15};{"sb_summon_unicorn_boxer1";15};{"sb_summon_blackcat1";15};{"sb_servitor_heal1";15};{"sb_aqua_swirl1";15};{"sb_arcane_acumen1";15};{"sb_energy_bolt1";15};{"sb_aura_burn1";15};{"sb_charm11";15};{"sb_concentration1";15};{"sb_water_breathing";15};{"sb_twister1";15};{"sb_poison1";15};{"sb_poison_recovery1";15};{"sb_confusion1";15};{"sb_cure_bleeding1";15};{"sb_dryad_root1";15};{"sb_mental_shield1";15};{"sb_body_to_mind1";15};{"sb_shadow_spark1";15};{"sb_surrender_to_earth1";15};{"sb_surrender_to_fire1";15};{"sb_surrender_to_poison1";15};{"sb_summon_cuti_cat1";15};{"sb_summon_unicorn_mirage1";15};{"sb_servitor_mana_charge1";15};{"sb_solar_spark1";15};{"sb_agility1";15};{"sb_empower1";15};{"sb_poison_cloud1";15};{"sb_focus1";15};{"sb_holy_weapon1";15};{"sb_touch_of_god1";15};{"sb_fire_resist1";15};{"sb_recharge1";15};{"sb_vampiric_rage1";15};{"sb_sleep1";15};{"sb_corpse_life_drain1";15};{"sb_night_murmur1";15};{"sb_blood_lust1";15};{"sb_pain_thorn1";15};{"sb_devotioin_of_shine1";15};{"sb_chill_flame1";15};{"sb_mass_frenzy1";15};{"sb_external_fear1";15};{"sb_entice_madness1";15};{"sb_pain_edge1";15};{"sb_inspire_life_force1";15};{"sb_devotioin_of_soul1";15};{"sb_burning_spirit1";15};{"sb_blaze_quake1";15};{"sb_eternal_flame1";15};{"sb_bind_will1";15};{"sb_aura_sway1";15};{"sb_engrave_seal_of_timid1";15};{"sb_pure_inspiration1";15};{"sb_power_of_paagrio1";15};{"sb_summon_mechanic_golem1";15}};

handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,355) == 0 && talker.level < 36 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Family Honor");
			}
			if( myself::HaveMemo(talker,355) == 0 && talker.level >= 36 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Family Honor");
			}
			if( myself::HaveMemo(talker,355) == 1 && myself::OwnItemCount(talker,4350) < 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Family Honor (Continue)");
			}
			if( myself::HaveMemo(talker,355) == 1 && myself::OwnItemCount(talker,4350) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Family Honor (Continue)");
			}
			if( myself::HaveMemo(talker,653) == 1 && myself::GetMemoState(talker,653) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Wild Maiden (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,355) == 0 && talker.level < 36 ) )
					{
						myself::SetCurrentQuestID(355);
						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,"galicbredo_q0355_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,355) == 0 && talker.level >= 36 ) )
					{
						myself::SetCurrentQuestID(355);
						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,"galicbredo_q0355_02.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,355) == 1 && myself::OwnItemCount(talker,4350) < 1 ) )
					{
						myself::SetCurrentQuestID(355);
						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,"galicbredo_q0355_05.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,355) == 1 && myself::OwnItemCount(talker,4350) >= 1 ) )
					{
						myself::SetCurrentQuestID(355);
						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,"galicbredo_q0355_06.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,653) == 1 && myself::GetMemoState(talker,653) == 1 ) )
					{
						myself::SetCurrentQuestID(653);
						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::GiveItem1(talker,57,2553);
						myself::ShowPage(talker,"galicbredo_q0653_01.htm");
						myself::RemoveMemo(talker,653);
						myself::SoundEffect(talker,"ItemSound.quest_finish");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler QUEST_ACCEPTED(quest_id,talker)
	{
		if( quest_id == 355 )
		{
			myself::SetCurrentQuestID(355);
			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) < 16 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::SetMemo(talker,quest_id);
					myself::SetJournal(talker,355,1);
					myself::SoundEffect(talker,"ItemSound.quest_accept");
					myself::ShowPage(talker,"galicbredo_q0355_04.htm");
					myself::AddLog(1,talker,quest_id);
				}
			}
			else
			{
				myself::ShowPage(talker,"fullquest.htm");
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,fhtml0,i0,quest_id,reply,talker)
	{
		if( ask == 355 )
		{
			myself::SetCurrentQuestID(355);
			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 == 355 )
		{
			if( reply == 1 )
			{
				myself::FHTML_SetFileName(fhtml0,"galicbredo_q0355_03.htm");
				myself::FHTML_SetInt(fhtml0,"quest_id",355);
				myself::ShowFHTML(talker,fhtml0);
			}
			if( reply == 2 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					if( myself::OwnItemCount(talker,4252) < 1 )
					{
						myself::ShowPage(talker,"galicbredo_q0355_07.htm");
					}
					else if( myself::OwnItemCount(talker,4252) >= 100 )
					{
						myself::GiveItem1(talker,57,( ( myself::OwnItemCount(talker,4252) * 120 ) + 7800 ));
						myself::DeleteItem1(talker,4252,myself::OwnItemCount(talker,4252));
						myself::ShowPage(talker,"galicbredo_q0355_07b.htm");
					}
					else if( myself::OwnItemCount(talker,4252) >= 1 && myself::OwnItemCount(talker,4252) < 100 )
					{
						myself::GiveItem1(talker,57,( ( myself::OwnItemCount(talker,4252) * 120 ) + 2800 ));
						myself::DeleteItem1(talker,4252,myself::OwnItemCount(talker,4252));
						myself::ShowPage(talker,"galicbredo_q0355_07a.htm");
					}
				}
			}
			if( reply == 3 )
			{
				myself::ShowPage(talker,"galicbredo_q0355_08.htm");
			}
			if( reply == 4 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					if( myself::OwnItemCount(talker,4252) > 0 )
					{
						myself::GiveItem1(talker,57,( myself::OwnItemCount(talker,4252) * 120 ));
					}
					myself::DeleteItem1(talker,4252,myself::OwnItemCount(talker,4252));
					myself::RemoveMemo(talker,355);
					myself::AddLog(2,talker,quest_id);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					myself::ShowPage(talker,"galicbredo_q0355_09.htm");
				}
			}
		}
		super;
	}

}
