class 1 bone_collector : wizard_pa_corpse_necro_summon
{
handler:
	EventHandler MY_DYING(always_list,code_info,i4,i9,last_attacker,lparty,member,random1_list,target)
	{
		always_list = gg::AllocCodeInfoList();
		random1_list = gg::AllocCodeInfoList();
		target = last_attacker;
		if( myself::HaveMemo(target,24) == 1 && myself::GetMemoState(target,24) == 11 && myself::OwnItemCount(target,7151) == 0 )
		{
			random1_list::SetInfo(0,target);
		}
		target = last_attacker;
		if( myself::HaveMemo(target,633) == 1 && ( myself::GetMemoState(target,633) == ( ( 1 * 10 ) + 1 ) || myself::GetMemoState(target,633) == ( ( 1 * 10 ) + 2 ) ) )
		{
			random1_list::SetInfo(1,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,633) == 1 && ( myself::GetMemoState(target,633) == ( ( 1 * 10 ) + 1 ) || myself::GetMemoState(target,633) == ( ( 1 * 10 ) + 2 ) ) )
				{
					random1_list::SetInfo(1,target);
				}
			}
		}
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(24);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						if( gg::Rand(100) < 10 )
						{
							myself::GiveItem1(target,7151,1);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
							myself::SetFlagJournal(target,24,10);
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(633);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
					{
						i4 = gg::Rand(1000);
						if( i4 < 342 && 342 != 0 )
						{
							if( ( myself::OwnItemCount(target,7544) + 1 ) >= 200 )
							{
								if( myself::OwnItemCount(target,7544) < 200 )
								{
									myself::GiveItem1(target,7544,( 200 - myself::OwnItemCount(target,7544) ));
									myself::SoundEffect(target,"ItemSound.quest_middle");
								}
								myself::SetFlagJournal(target,633,2);
								myself::SetMemoState(target,633,( ( 1 * 10 ) + 2 ));
							}
							else
							{
								myself::GiveItem1(target,7544,1);
								myself::SoundEffect(target,"ItemSound.quest_itemget");
							}
						}
						else if( i4 < ( 342 + 0 ) && 0 != 0 )
						{
						}
						else if( i4 < ( ( 342 + 0 ) + 0 ) && 0 != 0 )
						{
						}
					}
					break;
				}
			}
		}
		super;
	}

}
