class 1 warehouse_keeper_norman : warehouse_keeper
{
handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,167) == 1 && myself::OwnItemCount(talker,1106) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Dwarven Kinship (Continue)");
			}
			if( myself::HaveMemo(talker,219) == 1 && myself::OwnItemCount(talker,3186) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Testimony of Fate (Continue)");
			}
			if( myself::HaveMemo(talker,219) == 1 && myself::OwnItemCount(talker,3187) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Testimony of Fate (Continue)");
			}
			if( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3122) == 1 && myself::OwnItemCount(talker,3123) == 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Trial of the Guildsman (Continue)");
			}
			if( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3122) >= 1 && myself::OwnItemCount(talker,3125) >= 1 && myself::OwnItemCount(talker,3126) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Trial of the Guildsman (Continue)");
			}
			if( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3122) >= 1 && myself::OwnItemCount(talker,3125) >= 1 && myself::OwnItemCount(talker,3127) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 5;
				myself::AddChoice(5,"Trial of the Guildsman (Continue)");
			}
			if( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3122) >= 1 && myself::OwnItemCount(talker,3125) >= 1 && myself::OwnItemCount(talker,3128) >= 30 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 6;
				myself::AddChoice(6,"Trial of the Guildsman (Continue)");
			}
			if( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3122) >= 1 && myself::OwnItemCount(talker,3129) >= 1 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 7;
				myself::AddChoice(7,"Trial of the Guildsman (Continue)");
			}
			if( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3125) == 0 && myself::OwnItemCount(talker,3129) == 0 && myself::OwnItemCount(talker,3122) == 1 && ( myself::OwnItemCount(talker,3134) >= 1 || myself::OwnItemCount(talker,3139) >= 1 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 8;
				myself::AddChoice(8,"Trial of the Guildsman (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,167) == 1 && myself::OwnItemCount(talker,1106) == 1 ) )
					{
						myself::SetCurrentQuestID(167);
						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,"warehouse_keeper_norman_q0323_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,219) == 1 && myself::OwnItemCount(talker,3186) ) )
					{
						myself::SetCurrentQuestID(219);
						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,"warehouse_keeper_norman_q0219_01.htm");
							myself::GiveItem1(talker,3187,1);
							myself::DeleteItem1(talker,3186,1);
							myself::SetFlagJournal(talker,219,13);
						}
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,219) == 1 && myself::OwnItemCount(talker,3187) ) )
					{
						myself::SetCurrentQuestID(219);
						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,"warehouse_keeper_norman_q0219_02.htm");
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3122) == 1 && myself::OwnItemCount(talker,3123) == 1 ) )
					{
						myself::SetCurrentQuestID(216);
						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,"warehouse_keeper_norman_q0216_01.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3122) >= 1 && myself::OwnItemCount(talker,3125) >= 1 && myself::OwnItemCount(talker,3126) >= 1 ) )
					{
						myself::SetCurrentQuestID(216);
						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,"warehouse_keeper_norman_q0216_05.htm");
					}
					break;
				}
				case 5:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3122) >= 1 && myself::OwnItemCount(talker,3125) >= 1 && myself::OwnItemCount(talker,3127) >= 1 ) )
					{
						myself::SetCurrentQuestID(216);
						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,"warehouse_keeper_norman_q0216_06.htm");
					}
					break;
				}
				case 6:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3122) >= 1 && myself::OwnItemCount(talker,3125) >= 1 && myself::OwnItemCount(talker,3128) >= 30 ) )
					{
						myself::SetCurrentQuestID(216);
						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,"warehouse_keeper_norman_q0216_07.htm");
					}
					break;
				}
				case 7:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3122) >= 1 && myself::OwnItemCount(talker,3129) >= 1 ) )
					{
						myself::SetCurrentQuestID(216);
						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,3130) >= 70 && myself::OwnItemCount(talker,3131) >= 70 && myself::OwnItemCount(talker,3132) >= 70 && myself::OwnItemCount(talker,3133) >= 70 )
						{
							if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
							{
								talker.quest_last_reward_time = myself::GetCurrentTick();
								myself::ShowPage(talker,"warehouse_keeper_norman_q0216_12.htm");
								myself::DeleteItem1(talker,3129,myself::OwnItemCount(talker,3129));
								myself::DeleteItem1(talker,3130,myself::OwnItemCount(talker,3130));
								myself::DeleteItem1(talker,3131,myself::OwnItemCount(talker,3131));
								myself::DeleteItem1(talker,3132,myself::OwnItemCount(talker,3132));
								myself::DeleteItem1(talker,3133,myself::OwnItemCount(talker,3133));
								myself::GiveItem1(talker,3134,7);
								if( myself::OwnItemCount(talker,3138) >= 7 )
								{
									myself::SetFlagJournal(talker,216,6);
								}
							}
						}
						else
						{
							myself::ShowPage(talker,"warehouse_keeper_norman_q0216_11.htm");
						}
					}
					break;
				}
				case 8:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,216) == 1 && myself::OwnItemCount(talker,3125) == 0 && myself::OwnItemCount(talker,3129) == 0 && myself::OwnItemCount(talker,3122) == 1 && ( myself::OwnItemCount(talker,3134) >= 1 || myself::OwnItemCount(talker,3139) >= 1 ) ) )
					{
						myself::SetCurrentQuestID(216);
						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,"warehouse_keeper_norman_q0216_13.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 167 )
		{
			myself::SetCurrentQuestID(167);
			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 == 167 )
		{
			if( reply == 1 && myself::GetOneTimeQuestFlag(talker,167) == 0 && myself::OwnItemCount(talker,1106) == 1 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"warehouse_keeper_norman_q0323_02.htm");
					myself::DeleteItem1(talker,1106,1);
					myself::GiveItem1(talker,57,20000);
					myself::RemoveMemo(talker,167);
					myself::AddLog(2,talker,167);
					myself::SoundEffect(talker,"ItemSound.quest_finish");
					myself::SetOneTimeQuestFlag(talker,167,1);
				}
			}
		}
		if( ask == 216 )
		{
			myself::SetCurrentQuestID(216);
			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 == 216 )
		{
			if( reply == 1 )
			{
				myself::ShowPage(talker,"warehouse_keeper_norman_q0216_02.htm");
			}
			if( reply == 2 )
			{
				myself::ShowPage(talker,"warehouse_keeper_norman_q0216_03.htm");
			}
			if( reply == 3 )
			{
				if( myself::OwnItemCount(talker,3123) >= 1 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::ShowPage(talker,"warehouse_keeper_norman_q0216_04.htm");
						myself::DeleteItem1(talker,3123,1);
						myself::GiveItem1(talker,3125,1);
						myself::GiveItem1(talker,3126,1);
					}
				}
			}
			if( reply == 4 )
			{
				myself::ShowPage(talker,"warehouse_keeper_norman_q0216_08.htm");
			}
			if( reply == 5 )
			{
				myself::ShowPage(talker,"warehouse_keeper_norman_q0216_09.htm");
			}
			if( reply == 6 )
			{
				if( myself::OwnItemCount(talker,3125) >= 1 )
				{
					if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
					{
						talker.quest_last_reward_time = myself::GetCurrentTick();
						myself::ShowPage(talker,"warehouse_keeper_norman_q0216_10.htm");
						myself::DeleteItem1(talker,3128,myself::OwnItemCount(talker,3128));
						myself::DeleteItem1(talker,3125,1);
						myself::GiveItem1(talker,3129,1);
					}
				}
			}
		}
		super;
	}

}
