class 1 leto_lizardman : warrior_passive
{
handler:
	EventHandler MY_DYING(always_list,c1,code_info,i4,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;
		always_list::SetInfo(4,target);
		target = last_attacker;
		if( myself::HaveMemo(target,300) == 1 && myself::GetMemoState(target,300) == ( ( 1 * 10 ) + 1 ) )
		{
			random1_list::SetInfo(5,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,300) == 1 && myself::GetMemoState(target,300) == ( ( 1 * 10 ) + 1 ) )
				{
					random1_list::SetInfo(5,target);
				}
			}
		}
		while( gg::IsNull(code_info = always_list::Next()) == 0 )
		{
			switch(code_info.code)
			{
				case 0:
				{
					myself::SetCurrentQuestID(212);
					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,212) && myself::GetMemoState(c1,212) == 9 && myself::OwnItemCount(c1,2641) < 20 )
						{
							if( myself::OwnItemCount(c1,2641) == 19 )
							{
								myself::GiveItem1(c1,2641,1);
								myself::SoundEffect(c1,"ItemSound.quest_middle");
								myself::SetFlagJournal(c1,212,12);
							}
							else
							{
								myself::GiveItem1(c1,2641,1);
								myself::SoundEffect(c1,"ItemSound.quest_itemget");
							}
						}
					}
					break;
				}
				case 1:
				{
					myself::SetCurrentQuestID(224);
					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,224) && myself::GetMemoState(c1,224) == 13 && myself::OwnItemCount(c1,3306) < 140 )
						{
							if( ( ( myself::OwnItemCount(c1,3306) - 120 ) * 5 ) > gg::Rand(100) )
							{
								myself::CreateOnePrivateEx(1027090,"serpent_demon_kadesh",0,0,myself::FloatToInt(myself.sm.x),myself::FloatToInt(myself.sm.y),myself::FloatToInt(myself.sm.z),0,0,0,0);
								myself::DeleteItem1(c1,3306,myself::OwnItemCount(c1,3306));
								myself::SoundEffect(c1,"Itemsound.quest_before_battle");
							}
							else
							{
								myself::GiveItem1(c1,3306,1);
								myself::SoundEffect(c1,"Itemsound.quest_itemget");
							}
						}
					}
					break;
				}
				case 2:
				{
					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,3285) && myself::OwnItemCount(c1,3292) < 100 )
						{
							if( gg::Rand(2) == 1 )
							{
								if( myself::OwnItemCount(c1,3292) == 99 )
								{
									myself::GiveItem1(c1,3292,1);
									myself::SoundEffect(c1,"Itemsound.quest_middle");
									myself::SetFlagJournal(c1,223,13);
								}
								else
								{
									myself::GiveItem1(c1,3292,1);
									myself::SoundEffect(c1,"Itemsound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 3:
				{
					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,3347) && myself::OwnItemCount(c1,3337) < 30 )
						{
							if( gg::Rand(20) < 5 )
							{
								if( myself::OwnItemCount(c1,3337) == 29 )
								{
									myself::GiveItem1(c1,3337,1);
									myself::SoundEffect(c1,"Itemsound.quest_middle");
								}
								else
								{
									myself::GiveItem1(c1,3337,1);
									myself::SoundEffect(c1,"Itemsound.quest_itemget");
								}
							}
						}
					}
					break;
				}
				case 4:
				{
					myself::SetCurrentQuestID(229);
					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,229) == 1 && myself::OwnItemCount(c1,3309) == 1 && myself::OwnItemCount(c1,3310) == 1 )
						{
							if( gg::Rand(100) <= 50 && myself::OwnItemCount(c1,3312) < 20 )
							{
								c1.quest_last_reward_time = myself::GetCurrentTick();
								myself::GiveItem1(c1,3312,1);
								if( myself::OwnItemCount(c1,3312) >= 20 )
								{
									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 )
		{
			if( code_info.code == 5 )
			{
				myself::SetCurrentQuestID(300);
				target = code_info::RandomSelectOne();
				if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 )
				{
					i4 = gg::Rand(1000);
					if( i4 < 300 && 300 != 0 )
					{
						if( ( myself::OwnItemCount(target,7139) + 1 ) >= 60 )
						{
							if( myself::OwnItemCount(target,7139) < 60 )
							{
								myself::GiveItem1(target,7139,( 60 - myself::OwnItemCount(target,7139) ));
								myself::SoundEffect(target,"ItemSound.quest_middle");
								myself::SetFlagJournal(target,300,2);
							}
							if( ( ( 0 == 1 && myself::OwnItemCount(target,0) >= 0 ) || 0 == 0 ) && ( ( 0 == 1 && myself::OwnItemCount(target,0) >= 0 ) || 0 == 0 ) )
							{
								myself::SetMemoState(target,300,( ( 1 * 10 ) + 2 ));
							}
						}
						else
						{
							myself::GiveItem1(target,7139,1);
							myself::SoundEffect(target,"ItemSound.quest_itemget");
						}
					}
					else if( i4 < ( 300 + 0 ) && 0 != 0 )
					{
					}
					else if( i4 < ( ( 300 + 0 ) + 0 ) && 0 != 0 )
					{
					}
				}
			}
		}
		super;
	}

}
