class 1 groot : merchant
{
property:
	BuySellList SellList0 = {{"dye_s1c3_d";10};{"dye_s1d3_d";10};{"dye_c1s3_d";10};{"dye_c1d3_d";10};{"dye_d1s3_d";10};{"dye_d1c3_d";10};{"dye_i1m3_d";10};{"dye_i1w3_d";10};{"dye_m1i3_d";10};{"dye_m1w3_d";10};{"dye_w1i3_d";10};{"dye_w1m3_d";10};{"dye_s1c2_d";10};{"dye_s1d2_d";10};{"dye_c1s2_d";10};{"dye_c1d2_d";10};{"dye_d1s2_d";10};{"dye_d1c2_d";10};{"dye_i1m2_d";10};{"dye_i1w2_d";10};{"dye_m1i2_d";10};{"dye_m1w2_d";10};{"dye_w1i2_d";10};{"dye_w1m2_d";10};{"dye_s1c3_c";10};{"dye_s1d3_c";10};{"dye_c1s3_c";10};{"dye_c1c3_c";10};{"dye_d1s3_c";10};{"dye_d1c3_c";10};{"dye_i1m3_c";10};{"dye_i1w3_c";10};{"dye_m1i3_c";10};{"dye_m1w3_c";10};{"dye_w1i3_c";10};{"dye_w1m3_c";10};{"dye_s1c2_c";10};{"dye_s1d2_c";10};{"dye_c1s2_c";10};{"dye_c1c2_c";10};{"dye_d1s2_c";10};{"dye_d1c2_c";10};{"dye_i1m2_c";10};{"dye_i1w2_c";10};{"dye_m1i2_c";10};{"dye_m1w2_c";10};{"dye_w1i2_c";10};{"dye_w1m2_c";10};{"dye_s2c4_c";10};{"dye_s2d4_c";10};{"dye_c2s4_c";10};{"dye_c2c4_c";10};{"dye_d2s4_c";10};{"dye_d2c4_c";10};{"dye_i2m4_c";10};{"dye_i2w4_c";10};{"dye_m2i4_c";10};{"dye_m2w4_c";10};{"dye_w2i4_c";10};{"dye_w2m4_c";10};{"dye_s2c3_c";10};{"dye_s2d3_c";10};{"dye_c2s3_c";10};{"dye_c2c3_c";10};{"dye_d2s3_c";10};{"dye_d2c3_c";10};{"dye_i2m3_c";10};{"dye_i2w3_c";10};{"dye_m2i3_c";10};{"dye_m2w3_c";10};{"dye_w2i3_c";10};{"dye_w2m3_c";10};{"dye_s3c5_c";10};{"dye_s3d5_c";10};{"dye_c3s5_c";10};{"dye_c3c5_c";10};{"dye_d3s5_c";10};{"dye_d3c5_c";10};{"dye_i3m5_c";10};{"dye_i3w5_c";10};{"dye_m3i5_c";10};{"dye_m3w5_c";10};{"dye_w3i5_c";10};{"dye_w3m5_c";10};{"dye_s3c4_c";10};{"dye_s3d4_c";10};{"dye_c3s4_c";10};{"dye_c3c4_c";10};{"dye_d3s4_c";10};{"dye_d3c4_c";10};{"dye_i3m4_c";10};{"dye_i3w4_c";10};{"dye_m3i4_c";10};{"dye_m3w4_c";10};{"dye_w3i4_c";10};{"dye_w3m4_c";10};{"dye_s4c6_c";10};{"dye_s4d6_c";10};{"dye_c4s6_c";10};{"dye_c4c6_c";10};{"dye_d4s6_c";10};{"dye_d4c6_c";10};{"dye_i4m6_c";10};{"dye_i4w6_c";10};{"dye_m4i6_c";10};{"dye_m4w6_c";10};{"dye_w4i6_c";10};{"dye_w4m6_c";10};{"dye_s4c5_c";10};{"dye_s4d5_c";10};{"dye_c4s5_c";10};{"dye_c4c5_c";10};{"dye_d4s5_c";10};{"dye_d4c5_c";10};{"dye_i4m5_c";10};{"dye_i4w5_c";10};{"dye_m4i5_c";10};{"dye_m4w5_c";10};{"dye_w4i5_c";10};{"dye_w4m5_c";10}};

handler:
	EventHandler TALK_SELECTED(talker)
	{
		if( _from_choice == 0 )
		{
			if( myself::HaveMemo(talker,223) == 1 && myself::OwnItemCount(talker,3280) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 0;
				myself::AddChoice(0,"Test of the Champion (Continue)");
			}
			if( myself::HaveMemo(talker,223) == 1 && myself::OwnItemCount(talker,3281) && ( myself::OwnItemCount(talker,3287) < 30 || myself::OwnItemCount(talker,3288) < 30 || myself::OwnItemCount(talker,3289) < 30 ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 1;
				myself::AddChoice(1,"Test of the Champion (Continue)");
			}
			if( myself::HaveMemo(talker,223) == 1 && myself::OwnItemCount(talker,3281) && myself::OwnItemCount(talker,3287) >= 30 && myself::OwnItemCount(talker,3288) >= 30 && myself::OwnItemCount(talker,3289) >= 30 )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 2;
				myself::AddChoice(2,"Test of the Champion (Continue)");
			}
			if( myself::HaveMemo(talker,223) == 1 && myself::OwnItemCount(talker,3282) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 3;
				myself::AddChoice(3,"Test of the Champion (Continue)");
			}
			if( myself::HaveMemo(talker,223) == 1 && ( myself::OwnItemCount(talker,3283) || myself::OwnItemCount(talker,3284) || myself::OwnItemCount(talker,3285) || myself::OwnItemCount(talker,3286) ) )
			{
				_choiceN = ( _choiceN + 1 );
				_code = 4;
				myself::AddChoice(4,"Test of the Champion (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,223) == 1 && myself::OwnItemCount(talker,3280) ) )
					{
						myself::SetCurrentQuestID(223);
						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,"groot_q0223_01.htm");
					}
					break;
				}
				case 1:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,223) == 1 && myself::OwnItemCount(talker,3281) && ( myself::OwnItemCount(talker,3287) < 30 || myself::OwnItemCount(talker,3288) < 30 || myself::OwnItemCount(talker,3289) < 30 ) ) )
					{
						myself::SetCurrentQuestID(223);
						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,"groot_q0223_03.htm");
					}
					break;
				}
				case 2:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,223) == 1 && myself::OwnItemCount(talker,3281) && myself::OwnItemCount(talker,3287) >= 30 && myself::OwnItemCount(talker,3288) >= 30 && myself::OwnItemCount(talker,3289) >= 30 ) )
					{
						myself::SetCurrentQuestID(223);
						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,"groot_q0223_04.htm");
							myself::GiveItem1(talker,3282,1);
							myself::DeleteItem1(talker,3281,1);
							myself::DeleteItem1(talker,3287,myself::OwnItemCount(talker,3287));
							myself::DeleteItem1(talker,3288,myself::OwnItemCount(talker,3288));
							myself::DeleteItem1(talker,3289,myself::OwnItemCount(talker,3289));
							myself::SetFlagJournal(talker,223,8);
						}
					}
					break;
				}
				case 3:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,223) == 1 && myself::OwnItemCount(talker,3282) ) )
					{
						myself::SetCurrentQuestID(223);
						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,"groot_q0223_05.htm");
					}
					break;
				}
				case 4:
				{
					if( _from_choice == 0 || ( myself::HaveMemo(talker,223) == 1 && ( myself::OwnItemCount(talker,3283) || myself::OwnItemCount(talker,3284) || myself::OwnItemCount(talker,3285) || myself::OwnItemCount(talker,3286) ) ) )
					{
						myself::SetCurrentQuestID(223);
						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,"groot_q0223_06.htm");
					}
					break;
				}
			}
			return;
		}
		super;
	}

	EventHandler MENU_SELECTED(ask,reply,talker)
	{
		if( ask == 223 )
		{
			myself::SetCurrentQuestID(223);
			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 == 223 )
		{
			if( reply == 1 && myself::OwnItemCount(talker,3280) > 0 )
			{
				if( ( myself::GetCurrentTick() - talker.quest_last_reward_time ) > 1 )
				{
					talker.quest_last_reward_time = myself::GetCurrentTick();
					myself::ShowPage(talker,"groot_q0223_02.htm");
					myself::GiveItem1(talker,3281,1);
					myself::DeleteItem1(talker,3280,1);
					myself::SetFlagJournal(talker,223,6);
				}
			}
		}
		super;
	}

}
