class 1 trader_viktor : merchant
{
property:
	BuySellList SellList0 = {{"long_sword";30};{"throw_knife";30};{"bow_of_forest";30};{"short_spear";30};{"falchion";30};{"sword_breaker";30};{"composition_bow";30};{"buzdygan";30};{"iron_hammer";30};{"long_spear";30};{"saber";30};{"steel_sword";30};{"handiwork_dagger";30};{"assassin_knife";30};{"strengthening_bow";30};{"hand_axe";30};{"heavy_mace";30};{"work_hammer";30};{"trident";30};{"bastard_sword";30};{"poniard_dagger";30};{"long_bow";30};{"dark_elven_bow";30};{"pike";30};{"dwarven_trident";30};{"cestus";30};{"viper_s_canine";30};{"bagh-nakh";30};{"single-edged_jamadhr";30}};
	BuySellList SellList1 = {{"apprentice_s_staff";30};{"relic_of_saints";30};{"mage_staff";30};{"crucifix_of_blessing";30};{"voodoo_doll";30};{"bone_staff";30};{"scroll_of_wisdom";30};{"priest_sword";30};{"branch_of_life";30};{"proof_of_revenge";30};{"mace_of_prayer";30};{"doom_hammer";30};{"mystic_staff";30};{"staff_of_mana";30};{"divine_tome";30};{"sword_of_magic";30};{"sword_of_mystic";30};{"sword_of_occult";30};{"dagger_of_mana";30};{"mystic_knife";30};{"conjure_knife";30}};

handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2650) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Trial of the Seeker");
			}
			if( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2652) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Trial of the Seeker");
			}
			if( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2659) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Trial of the Seeker");
			}
			if( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2661) == 1 && myself::OwnItemCount(talker,2662) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Trial of the Seeker");
			}
			if( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2663) == 1 && myself::OwnItemCount(talker,2664) == 1 && myself::OwnItemCount(talker,2665) == 1 && myself::OwnItemCount(talker,2672) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Trial of the Seeker");
			}
			if( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2651) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Trial of the Seeker");
			}
			if( _choiceN > 1 )
			{
				myself::ShowChoicePage(talker,1);
				return;
			}
		}
		if( _from_choice || _choiceN == 1 )
		{
			switch(_code)
			{
				case 0:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2650) == 1 ) )
					{
						myself::SetCurrentQuestID(213);
						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,"trader_viktor_q0213_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2652) == 1 ) )
					{
						myself::SetCurrentQuestID(213);
						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,"trader_viktor_q0213_12.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2659) == 1 ) )
					{
						myself::SetCurrentQuestID(213);
						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,2660) < 10 )
						{
							myself::ShowPage(talker,"trader_viktor_q0213_13.htm");
						}
						else
						{
							myself::ShowPage(talker,"trader_viktor_q0213_14.htm");
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2661) == 1 && myself::OwnItemCount(talker,2662) == 1 ) )
					{
						myself::SetCurrentQuestID(213);
						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,"trader_viktor_q0213_16.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2663) == 1 && myself::OwnItemCount(talker,2664) == 1 && myself::OwnItemCount(talker,2665) == 1 && myself::OwnItemCount(talker,2672) == 1 ) )
					{
						myself::SetCurrentQuestID(213);
						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,"trader_viktor_q0213_17.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,213) == 1 && myself::OwnItemCount(talker,2651) == 1 ) )
					{
						myself::SetCurrentQuestID(213);
						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,"trader_viktor_q0213_05.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 213 )
		{
			myself::SetCurrentQuestID(213);
			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 == 213 )
		{
			if( reply == 1 )
			{
				myself::ShowPage(talker,"trader_viktor_q0213_02.htm");
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"trader_viktor_q0213_03.htm");
			}
			if( reply == 3 )
			{
				myself::ShowPage(talker,"trader_viktor_q0213_04.htm");
			}
			if( reply == 4 )
			{
				if( myself::OwnItemCount(talker,2650) >= 1 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::ShowPage(talker,"trader_viktor_q0213_05.htm");
						myself::DeleteItem1(talker,2650,1);
						myself::GiveItem1(talker,2651,1);
						myself::SetFlagJournal(talker,213,7);
					}
				}
			}
			if( reply == 5 )
			{
				myself::ShowPage(talker,"trader_viktor_q0213_06.htm");
			}
			if( reply == 6 )
			{
				myself::ShowPage(talker,"trader_viktor_q0213_07.htm");
			}
			if( reply == 7 )
			{
				myself::ShowPage(talker,"trader_viktor_q0213_08.htm");
			}
			if( reply == 8 )
			{
				myself::ShowPage(talker,"trader_viktor_q0213_09.htm");
			}
			if( reply == 9 )
			{
				myself::ShowPage(talker,"trader_viktor_q0213_10.htm");
			}
			if( reply == 10 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"trader_viktor_q0213_11.htm");
					myself::SetFlagJournal(talker,213,9);
					myself::GiveItem1(talker,2659,1);
					myself::DeleteItem1(talker,2650,myself::OwnItemCount(talker,2650));
					myself::DeleteItem1(talker,2658,myself::OwnItemCount(talker,2658));
					myself::DeleteItem1(talker,2652,myself::OwnItemCount(talker,2652));
					myself::DeleteItem1(talker,2651,myself::OwnItemCount(talker,2651));
				}
			}
			if( reply == 11 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"trader_viktor_q0213_15.htm");
					myself::SetFlagJournal(talker,213,11);
					myself::DeleteItem1(talker,2659,myself::OwnItemCount(talker,2659));
					myself::DeleteItem1(talker,2660,myself::OwnItemCount(talker,2660));
					myself::GiveItem1(talker,2661,1);
					myself::GiveItem1(talker,2662,1);
				}
			}
		}
		super;
	}

}
