class 1 krokian_padisha_sobekk : raid_boss_type2
{
handler:
	EventHandler MY_DYING(always_list,c0,c1,code_info,i0,i1,i2,i3,i9,last_attacker,lparty,member,random1_list,target)
	{
		c1 = myself::GetLastAttacker();
		if( c1.master )
		{
			c0 = c1.master;
		}
		else
		{
			c0 = c1;
		}
		if( gg::IsNull(c0) == 0 && myself::DistFromMe(c0) <= 1500 && gg::Rand(1000) < 35 )
		{
			i1 = myself::Party_GetCount(c0);
			if( i1 == 0 )
			{
				if( myself::HaveMemo(c0,350) == 1 )
				{
					i9 = ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( myself::OwnItemCount(c0,4651) + myself::OwnItemCount(c0,4652) ) + myself::OwnItemCount(c0,4653) ) + myself::OwnItemCount(c0,4654) ) + myself::OwnItemCount(c0,4655) ) + myself::OwnItemCount(c0,4656) ) + myself::OwnItemCount(c0,4657) ) + myself::OwnItemCount(c0,4658) ) + myself::OwnItemCount(c0,4659) ) + myself::OwnItemCount(c0,4660) ) + myself::OwnItemCount(c0,4661) ) + myself::OwnItemCount(c0,5579) ) + myself::OwnItemCount(c0,5582) ) + myself::OwnItemCount(c0,5914) ) + myself::OwnItemCount(c0,4629) ) + myself::OwnItemCount(c0,4630) ) + myself::OwnItemCount(c0,4631) ) + myself::OwnItemCount(c0,4632) ) + myself::OwnItemCount(c0,4633) ) + myself::OwnItemCount(c0,4634) ) + myself::OwnItemCount(c0,4635) ) + myself::OwnItemCount(c0,4636) ) + myself::OwnItemCount(c0,4637) ) + myself::OwnItemCount(c0,4638) ) + myself::OwnItemCount(c0,4639) ) + myself::OwnItemCount(c0,5577) ) + myself::OwnItemCount(c0,5580) ) + myself::OwnItemCount(c0,5908) ) + myself::OwnItemCount(c0,4640) ) + myself::OwnItemCount(c0,4641) ) + myself::OwnItemCount(c0,4642) ) + myself::OwnItemCount(c0,4643) ) + myself::OwnItemCount(c0,4644) ) + myself::OwnItemCount(c0,4645) ) + myself::OwnItemCount(c0,4646) ) + myself::OwnItemCount(c0,4647) ) + myself::OwnItemCount(c0,4648) ) + myself::OwnItemCount(c0,4649) ) + myself::OwnItemCount(c0,4650) ) + myself::OwnItemCount(c0,5578) ) + myself::OwnItemCount(c0,5581) ) + myself::OwnItemCount(c0,5911) );
					if( i9 == 1 )
					{
						i2 = 0;
						i3 = 0;
						if( myself::OwnItemCount(c0,4661) == 1 )
						{
							i2 = 4661;
							i3 = 5579;
						}
						else if( myself::OwnItemCount(c0,5579) == 1 )
						{
							i2 = 5579;
							i3 = 5582;
						}
						else if( myself::OwnItemCount(c0,4639) == 1 )
						{
							i2 = 4639;
							i3 = 5577;
						}
						else if( myself::OwnItemCount(c0,5577) == 1 )
						{
							i2 = 5577;
							i3 = 5580;
						}
						else if( myself::OwnItemCount(c0,4650) == 1 )
						{
							i2 = 4650;
							i3 = 5578;
						}
						else if( myself::OwnItemCount(c0,5578) == 1 )
						{
							i2 = 5578;
							i3 = 5581;
						}
						if( i2 > 0 && i3 > 0 )
						{
							myself::DeleteItem1(c0,i2,1);
							myself::GiveItem1(c0,i3,1);
							myself::SoundEffect(c0,"ItemSound.quest_itemget");
							myself::ShowSystemMessage(c0,974);
						}
						else
						{
							myself::ShowSystemMessage(c0,1264);
						}
					}
					else if( i9 > 1 )
					{
						myself::ShowSystemMessage(c0,977);
					}
					else
					{
						myself::ShowSystemMessage(c0,1265);
					}
				}
			}
			else
			{
				for(i0 = 0; i0 < i1; i0 = ( i0 + 1 ))
				{
					c1 = myself::Party_GetCreature(c0,i0);
					if( myself::HaveMemo(c1,350) == 1 )
					{
						i9 = ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( myself::OwnItemCount(c1,4651) + myself::OwnItemCount(c1,4652) ) + myself::OwnItemCount(c1,4653) ) + myself::OwnItemCount(c1,4654) ) + myself::OwnItemCount(c1,4655) ) + myself::OwnItemCount(c1,4656) ) + myself::OwnItemCount(c1,4657) ) + myself::OwnItemCount(c1,4658) ) + myself::OwnItemCount(c1,4659) ) + myself::OwnItemCount(c1,4660) ) + myself::OwnItemCount(c1,4661) ) + myself::OwnItemCount(c1,5579) ) + myself::OwnItemCount(c1,5582) ) + myself::OwnItemCount(c1,5914) ) + myself::OwnItemCount(c1,4629) ) + myself::OwnItemCount(c1,4630) ) + myself::OwnItemCount(c1,4631) ) + myself::OwnItemCount(c1,4632) ) + myself::OwnItemCount(c1,4633) ) + myself::OwnItemCount(c1,4634) ) + myself::OwnItemCount(c1,4635) ) + myself::OwnItemCount(c1,4636) ) + myself::OwnItemCount(c1,4637) ) + myself::OwnItemCount(c1,4638) ) + myself::OwnItemCount(c1,4639) ) + myself::OwnItemCount(c1,5577) ) + myself::OwnItemCount(c1,5580) ) + myself::OwnItemCount(c1,5908) ) + myself::OwnItemCount(c1,4640) ) + myself::OwnItemCount(c1,4641) ) + myself::OwnItemCount(c1,4642) ) + myself::OwnItemCount(c1,4643) ) + myself::OwnItemCount(c1,4644) ) + myself::OwnItemCount(c1,4645) ) + myself::OwnItemCount(c1,4646) ) + myself::OwnItemCount(c1,4647) ) + myself::OwnItemCount(c1,4648) ) + myself::OwnItemCount(c1,4649) ) + myself::OwnItemCount(c1,4650) ) + myself::OwnItemCount(c1,5578) ) + myself::OwnItemCount(c1,5581) ) + myself::OwnItemCount(c1,5911) );
						if( i9 == 1 )
						{
							i2 = 0;
							i3 = 0;
							if( myself::OwnItemCount(c1,4661) == 1 )
							{
								i2 = 4661;
								i3 = 5579;
							}
							else if( myself::OwnItemCount(c1,5579) == 1 )
							{
								i2 = 5579;
								i3 = 5582;
							}
							else if( myself::OwnItemCount(c1,4639) == 1 )
							{
								i2 = 4639;
								i3 = 5577;
							}
							else if( myself::OwnItemCount(c1,5577) == 1 )
							{
								i2 = 5577;
								i3 = 5580;
							}
							else if( myself::OwnItemCount(c1,4650) == 1 )
							{
								i2 = 4650;
								i3 = 5578;
							}
							else if( myself::OwnItemCount(c1,5578) == 1 )
							{
								i2 = 5578;
								i3 = 5581;
							}
							if( i2 > 0 && i3 > 0 )
							{
								myself::DeleteItem1(c1,i2,1);
								myself::GiveItem1(c1,i3,1);
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
								myself::ShowSystemMessage(c1,974);
							}
							else
							{
								myself::ShowSystemMessage(c1,1264);
							}
						}
						else if( i9 > 1 )
						{
							myself::ShowSystemMessage(c1,977);
						}
						else
						{
							myself::ShowSystemMessage(c1,1265);
						}
					}
				}
			}
		}
		super;
	}

}
