class 1 cel : merchant_for_newbie
{
property:
	BuySellList SellList0 = {{"necklace_of_magic";15};{"necklace_of_knowledge";15};{"necklace_of_anguish";15};{"necklace_of_wisdom";15};{"apprentice_s_earing";15};{"mage_earing";15};{"earing_of_strength";15};{"earing_of_wisdom";15};{"cat_seye_earing";15};{"magic_ring";15};{"ring_of_knowledge";15};{"ring_of_anguish";15};{"ring_of_wisdom";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_summon_mechanic_golem1";15};{"battle_manual_fallen_arrow";15};{"battle_manual_fallen_attack";15};{"battle_manual_rapid_attack";15};{"battle_manual_increase_power";15};{"battle_manual_detect_trap";15};{"battle_manual_defuse_trap";15};{"sb_greater_heal11";15};{"sb_greater_group_heal11";15};{"sb_resist_shock1";15};{"sb_return1";15};{"sb_mana_regeneration";15};{"sb_might_of_heaven11";15};{"sb_mass_summon_aqua_cubic";15};{"sb_bless_shield1";15};{"sb_surrender_to_water1";15};{"sb_summon_life_cubic1";15};{"sb_summon_storm_cubic1";15};{"sb_summon_aqua_cubic1";15};{"sb_summon_unicorn_merrow1";15};{"sb_servitor_cure1";15};{"sb_servitor_physical_shield1";15};{"sb_solar_flare1";15};{"sb_spirit_barrier1";15};{"sb_aura_bolt1";15};{"sb_aura_flare11";15};{"sb_curse_fear1";15};{"sb_transfer_pain";15};{"sb_frost_bolt11";15};{"sb_freezing_skin1";15};{"sb_hydro_blast11";15};{"sb_servitor_magic_shield1";15};{"sb_servitor_haste1";15};{"sb_serenade_of_eva1";15};{"sb_sleeping_cloud1";15};{"sb_ice_dagger1";15};{"sb_freezing_shackle1";15};{"sb_vitalize1";15};{"sb_cancel1";15};{"sb_party_recall1";15};{"sb_servitor_empower1";15};{"sb_frost_wall1";15};{"sb_mana_burn";15};{"sb_major_heal";15};{"sb_betray";15};{"sb_summon_unicorn_seraphim";15};{"sb_summon_friend";15};{"sb_erase";15};{"sb_invocation";15};{"sb_turn_undead";15};{"sb_trance";15};{"sb_auqa_resist1";15};{"sb_unholy_resistance";15};{"sb_mass_surr_to_water";15};{"sb_aqua_splash1";15};{"sb_advanced_block1";15};{"sb_aura_flash";15};{"sb_clarity";15};{"sb_summon_attractive_cubic";15};{"sb_servitor_blessing";15};{"sb_wild_magic1";15};{"sb_seed_of_water";15};{"sb_aura_symphony1";15};{"sb_blizzard1";15};{"sb_elemental_symphony_e1";15}};

handler:
	EventHandler TALK_SELECTED(fhtml0,talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,164) == 0 && myself::GetOneTimeQuestFlag(talker,164) == 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Blood Fiend");
			}
			if( myself::HaveMemo(talker,164) == 0 && myself::GetOneTimeQuestFlag(talker,164) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Blood Fiend (Complete)");
			}
			if( myself::HaveMemo(talker,164) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Blood Fiend (Continue)");
			}
			if( myself::HaveMemo(talker,160) != 0 && myself::OwnItemCount(talker,1027) != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Nerupa's Request (Continue)");
			}
			if( myself::HaveMemo(talker,160) != 0 && myself::OwnItemCount(talker,1028) != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Nerupa's Request (Continue)");
			}
			if( myself::HaveMemo(talker,160) != 0 && myself::OwnItemCount(talker,1029) != 0 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Nerupa's Request (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,164) == 0 && myself::GetOneTimeQuestFlag(talker,164) == 0 ) )
					{
						myself::SetCurrentQuestID(164);
						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.race != 1 && talker.race != 3 && talker.race != 4 && talker.race != 0 )
							{
								myself::ShowPage(talker,"cel_q0318_00.htm");
							}
							else if( talker.level >= 21 )
							{
								myself::FHTML_SetFileName(fhtml0,"cel_q0318_03.htm");
								myself::FHTML_SetInt(fhtml0,"quest_id",164);
								myself::ShowFHTML(talker,fhtml0);
							}
							else
							{
								myself::ShowPage(talker,"cel_q0318_02.htm");
							}
						}
						else
						{
							myself::ShowPage(talker,"fullquest.htm");
						}
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,164) == 0 && myself::GetOneTimeQuestFlag(talker,164) == 1 ) )
					{
						myself::SetCurrentQuestID(164);
						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,"finishedquest.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || myself::HaveMemo(talker,164) )
					{
						myself::SetCurrentQuestID(164);
						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,1044) < 1 )
						{
							myself::ShowPage(talker,"cel_q0318_05.htm");
						}
						else if( myself::OwnItemCount(talker,1044) >= 1 && myself::GetOneTimeQuestFlag(talker,164) == 0 )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::ShowPage(talker,"cel_q0318_06.htm");
								myself::GiveItem1(talker,57,42130);
								myself::DeleteItem1(talker,1044,1);
								myself::RemoveMemo(talker,164);
								myself::AddLog(2,talker,164);
								myself::SoundEffect(talker,"ItemSound.quest_finish");
								myself::SetOneTimeQuestFlag(talker,164,1);
							}
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,160) != 0 && myself::OwnItemCount(talker,1027) != 0 ) )
					{
						myself::SetCurrentQuestID(160);
						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,1027,myself::OwnItemCount(talker,1027));
							if( myself::OwnItemCount(talker,1028) == 0 )
							{
								myself::GiveItem1(talker,1028,1);
							}
							myself::ShowPage(talker,"cel_q0311_01.htm");
							myself::SetFlagJournal(talker,160,3);
						}
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,160) != 0 && myself::OwnItemCount(talker,1028) != 0 ) )
					{
						myself::SetCurrentQuestID(160);
						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,"cel_q0311_02.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,160) != 0 && myself::OwnItemCount(talker,1029) != 0 ) )
					{
						myself::SetCurrentQuestID(160);
						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,"cel_q0311_03.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

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

}
