class 1 windsus : warrior_passive
{
handler:
	EventHandler MY_DYING(always_list,c1,code_info,i9,last_attacker,lparty,member,random1_list,target)
	{
		always_list = gg::AllocCodeInfoList();
		random1_list = gg::AllocCodeInfoList();
		target = last_attacker;
		always_list::SetInfo(0,target);
		target = last_attacker;
		always_list::SetInfo(1,target);
		target = last_attacker;
		always_list::SetInfo(2,target);
		target = last_attacker;
		always_list::SetInfo(3,target);
		target = last_attacker;
		if( myself::HaveMemo(target,335) && myself::OwnItemCount(target,3695) && myself::OwnItemCount(target,3714) < 1 )
		{
			random1_list::SetInfo(4,target);
		}
		target = last_attacker;
		if( myself::HaveMemo(target,335) && myself::OwnItemCount(target,3734) && myself::OwnItemCount(target,3776) < 30 )
		{
			random1_list::SetInfo(5,target);
		}
		target = last_attacker;
		if( myself::HaveMemo(target,426) == 1 )
		{
			random1_list::SetInfo(6,target);
		}
		if( gg::IsNull(lparty) == 0 )
		{
			for(i9 = 0; i9 < lparty.member_count; i9 = ( i9 + 1 ))
			{
				target = myself::GetMemberOfParty(lparty,i9);
				if( myself::HaveMemo(target,426) == 1 )
				{
					random1_list::SetInfo(6,target);
				}
			}
		}
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(217);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( c1.master )
						{
							c1 = c1.master;
						}
						if( myself::HaveMemo(c1,217) && myself::GetMemoState(c1,217) == 11 && myself::OwnItemCount(c1,2756) < 10 )
						{
							if( gg::Rand(2) == 1 )
							{
								if( myself::OwnItemCount(c1,2756) == 9 )
								{
									myself::GiveItem1(c1,2756,1);
									myself::SetMemoState(c1,217,12);
									myself::SoundEffect(c1,"Itemsound.quest_middle");
									myself::SetFlagJournal(c1,217,15);
								}
								else
								{
									myself::GiveItem1(c1,2756,1);
									myself::SoundEffect(c1,"Itemsound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(223);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( c1.master )
						{
							c1 = c1.master;
						}
						if( myself::HaveMemo(c1,223) && myself::OwnItemCount(c1,3281) && myself::OwnItemCount(c1,3289) < 30 )
						{
							if( gg::Rand(2) == 1 )
							{
								if( myself::OwnItemCount(c1,3289) == 29 )
								{
									myself::GiveItem1(c1,3289,1);
									myself::SoundEffect(c1,"Itemsound.quest_middle");
									if( myself::OwnItemCount(c1,3287) >= 30 && myself::OwnItemCount(c1,3288) >= 30 )
									{
										myself::SetFlagJournal(c1,223,7);
									}
								}
								else
								{
									myself::GiveItem1(c1,3289,1);
									myself::SoundEffect(c1,"Itemsound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 2:
				{
					myself::SetCurrentQuestID(230);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( c1.master )
						{
							c1 = c1.master;
						}
						if( myself::HaveMemo(c1,230) && myself::OwnItemCount(c1,3352) == 0 && myself::OwnItemCount(c1,3350) && myself::OwnItemCount(c1,3345) < 30 )
						{
							if( gg::Rand(10) < 7 )
							{
								if( myself::OwnItemCount(c1,3345) == 29 )
								{
									myself::GiveItem1(c1,3345,1);
									myself::SoundEffect(c1,"Itemsound.quest_middle");
								}
								else
								{
									myself::GiveItem1(c1,3345,1);
									myself::SoundEffect(c1,"Itemsound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 3:
				{
					myself::SetCurrentQuestID(228);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						c1 = myself::GetLastAttacker();
						if( c1.master )
						{
							c1 = c1.master;
						}
						if( myself::HaveMemo(c1,228) && myself::OwnItemCount(c1,2847) == 1 && myself::OwnItemCount(c1,2861) == 1 && myself::OwnItemCount(c1,2852) < 10 )
						{
							if( gg::Rand(100) < 50 )
							{
								c1.quest_last_reward_time = myself::GetCurrentTick();
								myself::GiveItem1(c1,2852,1);
								if( myself::OwnItemCount(c1,2852) >= 10 )
								{
									myself::SoundEffect(c1,"ItemSound.quest_middle");
								}
								else
								{
									myself::SoundEffect(c1,"ItemSound.quest_itemget");
								}
							}
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
			switch(code_info.code)
			{
				case 4:
				{
					myself::SetCurrentQuestID(335);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						if( gg::Rand(10) == 0 )
						{
							myself::CreateOnePrivate(1027143,"windsus_aleph",0,1);
						}
					}
					break;
				}
				case 5:
				{
					myself::SetCurrentQuestID(335);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						if( gg::Rand(2) == 0 )
						{
							myself::GiveItem1(target,3776,1);
							if( myself::OwnItemCount(target,3776) >= 30 )
							{
								myself::SoundEffect(target,"ItemSound.quest_middle");
							}
							else
							{
								myself::SoundEffect(target,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
				case 6:
				{
					myself::SetCurrentQuestID(426);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						if( gg::Rand(1000) < 335 )
						{
							myself::GiveItem1(target,7586,1);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
						}
					}
					break;
				}
			}
		}
		super;
	}

}
