@LabelIndex 217677
@StringIndex 24585
class 0 water_spirit_ashutar : raid_boss_type4 {
handler:
	EventHandler MY_DYING(always_list,av_quest0,c0,c1,c2,c3,code_info,i0,i1,i2,i3,i4,i9,last_attacker,lparty,member,npc0,random1_list,target) {
		always_list = gg::AllocCodeInfoList();
		random1_list = gg::AllocCodeInfoList();
		target = last_attacker;
		always_list::SetInfo(0,target);
		always_list::SetInfo(0,target);
		if( gg::IsNull(lparty) == 0 ) {
			for(i9 = 0; i9 < lparty.member_count; i9++) {
				target = myself::GetMemberOfParty(lparty,i9);
				always_list::SetInfo(0,target);
			}
		}
		target = last_attacker;
		always_list::SetInfo(1,target);
		always_list::SetInfo(1,target);
		if( gg::IsNull(lparty) == 0 ) {
			for(i9 = 0; i9 < lparty.member_count; i9++) {
				target = myself::GetMemberOfParty(lparty,i9);
				always_list::SetInfo(1,target);
			}
		}
		target = last_attacker;
		if( gg::HaveMemo(target,610) == 1 && gg::GetMemoState(target,610) >= ( ( 2 * 10 ) - 9 ) && gg::GetMemoState(target,610) <= ( ( 2 * 10 ) + 1 ) ) {
			random1_list::SetInfo(2,target);
		}
		if( gg::HaveMemo(target,610) == 1 && gg::GetMemoState(target,610) >= ( ( 2 * 10 ) - 9 ) && gg::GetMemoState(target,610) <= ( ( 2 * 10 ) + 1 ) ) {
			random1_list::SetInfo(2,target);
		}
		if( gg::IsNull(lparty) == 0 ) {
			for(i9 = 0; i9 < lparty.member_count; i9++) {
				target = myself::GetMemberOfParty(lparty,i9);
				if( gg::HaveMemo(target,610) == 1 && gg::GetMemoState(target,610) >= ( ( 2 * 10 ) - 9 ) && gg::GetMemoState(target,610) <= ( ( 2 * 10 ) + 1 ) ) {
					random1_list::SetInfo(2,target);
				}
			}
		}
		target = last_attacker;
		always_list::SetInfo(3,target);
		while( gg::IsNull(code_info = always_list::Next()) == 0 ) {
			switch(code_info.code) {
				case 0: {
					myself::SetCurrentQuestID(611);
					while( gg::IsNull(target = code_info::Next()) == 0 ) {
						if( myself::DistFromMe(target) <= 1500 ) {
							myself::SetCurrentQuestID(611);
							if( gg::OwnItemCount(target,7225) >= 1 ) {
								myself::DeleteItem1(target,7225,gg::OwnItemCount(target,7225));
								myself::GiveItem1(target,7224,1);
							} else if( gg::OwnItemCount(target,7224) >= 1 ) {
								myself::DeleteItem1(target,7224,gg::OwnItemCount(target,7224));
								myself::GiveItem1(target,7223,1);
							} else if( gg::OwnItemCount(target,7223) >= 1 ) {
								myself::DeleteItem1(target,7223,gg::OwnItemCount(target,7223));
								myself::GiveItem1(target,7222,1);
							} else if( gg::OwnItemCount(target,7222) >= 1 ) {
								myself::DeleteItem1(target,7222,gg::OwnItemCount(target,7222));
								myself::GiveItem1(target,7221,1);
							} else if( gg::OwnItemCount(target,7221) >= 1 ) {
								myself::DeleteItem1(target,7221,gg::OwnItemCount(target,7221));
							}
							if( gg::HaveMemo(target,611) ) {
								myself::RemoveMemo(target,611);
								gg::AddLog(2,target,611);
								myself::DeleteItem1(target,7226,gg::OwnItemCount(target,7226));
								myself::DeleteItem1(target,7227,gg::OwnItemCount(target,7227));
								myself::DeleteItem1(target,7228,gg::OwnItemCount(target,7228));
							}
							if( gg::HaveMemo(target,612) ) {
								myself::RemoveMemo(target,612);
								gg::AddLog(2,target,612);
								myself::DeleteItem1(target,7234,gg::OwnItemCount(target,7234));
							}
							if( gg::HaveMemo(target,613) ) {
								myself::RemoveMemo(target,613);
								gg::AddLog(2,target,613);
								myself::DeleteItem1(target,7240,gg::OwnItemCount(target,7240));
							}
							if( gg::HaveMemo(target,614) ) {
								myself::RemoveMemo(target,614);
								gg::AddLog(2,target,614);
								myself::DeleteItem1(target,7241,gg::OwnItemCount(target,7241));
							}
							if( gg::HaveMemo(target,615) ) {
								myself::RemoveMemo(target,615);
								gg::AddLog(2,target,615);
								myself::DeleteItem1(target,7242,gg::OwnItemCount(target,7242));
							}
							if( gg::HaveMemo(target,616) ) {
								myself::RemoveMemo(target,616);
								gg::AddLog(2,target,616);
								myself::DeleteItem1(target,7244,gg::OwnItemCount(target,7244));
							}
						}
					}
					break;
				}
				case 1: {
					myself::SetCurrentQuestID(610);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						npc0 = gg::GetNPCFromID(myself.sm.param1);
						if( gg::IsNull(npc0) == 0 ) {
							npc0.av_quest0::Exchange(0);
						}
					}
					break;
				}
				case 3: {
					myself::SetCurrentQuestID(715);
					target = code_info::RandomSelectOne();
					if( gg::IsNull(target) == 0 && myself::DistFromMe(target) <= 1500 ) {
						myself::Say(gg::MakeFString(71551,target.name,"","","",""));
						c0 = myself::Pledge_GetLeader(target);
						if( myself::IsNullCreature(c0) == 0 ) {
							if( gg::HaveMemo(c0,715) == 1 && ( ( gg::GetMemoState(c0,715) / 10 ) % 10 ) == 1 ) {
								if( ( gg::GetMemoState(c0,715) / 10 ) == 21 ) {
									i0 = gg::GetMemoState(c0,715);
									myself::SetMemoState(c0,715,( i0 + 10 ));
									myself::SetFlagJournal(c0,715,9);
									myself::ShowQuestMark(c0,715);
									myself::SoundEffect(c0,"ItemSound.quest_middle");
								} else if( ( gg::GetMemoState(c0,715) / 10 ) == 1 ) {
									i0 = gg::GetMemoState(c0,715);
									myself::SetMemoState(c0,715,( i0 + 10 ));
									myself::SetFlagJournal(c0,715,5);
									myself::ShowQuestMark(c0,715);
									myself::SoundEffect(c0,"ItemSound.quest_middle");
								}
							}
						}
					}
					break;
				}
			}
		}
		code_info = random1_list::RandomSelectOne();
		if( gg::IsNull(code_info) == 0 ) {
			switch(code_info.code) {
				case 2: {
					myself::SetCurrentQuestID(610);
					while( gg::IsNull(target = code_info::Next()) == 0 ) {
						if( myself::DistFromMe(target) <= 1500 ) {
							myself::SetCurrentQuestID(610);
							if( myself.sm.param2 == target.dbid ) {
								myself::GiveItem1(target,7239,1);
								myself::SoundEffect(target,"ItemSound.quest_middle");
								myself::SetFlagJournal(target,610,3);
								myself::ShowQuestMark(target,610);
								myself::SetMemoState(target,610,( ( 2 * 10 ) + 2 ));
							} else if( gg::GetMemoState(target,610) == 21 ) {
								myself::GiveItem1(target,7239,1);
								myself::SoundEffect(target,"ItemSound.quest_middle");
								myself::SetFlagJournal(target,610,3);
								myself::ShowQuestMark(target,610);
								myself::SetMemoState(target,610,( ( 2 * 10 ) + 2 ));
							} else if( gg::OwnItemCount(target,7238) >= 1 ) {
								myself::DeleteItem1(target,7238,1);
								myself::GiveItem1(target,7239,1);
								myself::SoundEffect(target,"ItemSound.quest_middle");
								myself::SetFlagJournal(target,610,3);
								myself::ShowQuestMark(target,610);
								myself::SetMemoState(target,610,( ( 2 * 10 ) + 2 ));
							}
							npc0 = gg::GetNPCFromID(myself.sm.param1);
							if( gg::IsNull(npc0) == 0 ) {
								npc0.av_quest0::Exchange(0);
							}
						}
					}
					break;
				}
			}
		}
		super;
	}

	EventHandler TIMER_FIRED_EX(c0,i0,npc0,talker,timer_id) {
		myself::SetCurrentQuestID(610);
		if( timer_id == ( ( 610 * 100 ) + 1 ) ) {
			myself::Say(gg::MakeFString(61051,"","","","",""));
			npc0 = gg::GetNPCFromID(myself.sm.param1);
			if( gg::IsNull(npc0) == 0 ) {
				npc0.av_quest0::Exchange(0);
			}
			myself::Despawn();
		}
		super;
	}

	EventHandler CREATED(i0,i_quest0) {
		myself::SetCurrentQuestID(610);
		myself::AddTimerEx(( ( 610 * 100 ) + 1 ),( 1000 * 1200 ));
		myself::Say(gg::MakeFString(61050,"","","","",""));
		super;
	}

}
