@LabelIndex 423421
@StringIndex 63867
class 1 maker_fav_6_main : default_maker {
parameter:
	string	sub_maker_name = "gludio58_1926_60";
	string	sub_maker_name_1 = "gludio58_1926_601m1";
	string	sub_maker_name_2 = "gludio58_1926_602m1";
	string	sub_maker_name_3 = "gludio58_1926_603m1";
	string	sub_maker_name_4 = "gludio58_1926_604m1";
	int	death_count = 10;
	string	f8_maker_name = "gludio58_1926_801m1";

handler:
	EventHandler ON_START(i0,def0) {
		myself.i_ai0 = 1;
		myself.i_ai1 = gg::Rand(death_count);
		myself.i_ai2 = gg::Rand(death_count);
		myself.i_ai3 = gg::Rand(death_count);
		myself.i_ai4 = gg::Rand(death_count);
		myself::AddTimerEx(78001,( 1 * 1000 ));
		myself::AddTimerEx(78002,( ( ( 3 * 60 ) * 60 ) * 1000 ));
		def0 = myself::GetSpawnDefine(0);
		if( gg::IsNull(def0) == 0 ) {
			if( myself::AtomicIncreaseTotal(def0,def0.total,1) ) {
				def0::Spawn2(def0.total,0,0);
			}
		}
	}

	EventHandler ON_SCRIPT_EVENT(script_event_arg1,script_event_arg2,script_event_arg3,maker0) {
		if( script_event_arg1 == 78010019 ) {
			switch(script_event_arg3) {
				case 1: {
					myself.i_ai1 = ( myself.i_ai1 + 1 );
					break;
				}
				case 2: {
					myself.i_ai2 = ( myself.i_ai2 + 1 );
					break;
				}
				case 3: {
					myself.i_ai3 = ( myself.i_ai3 + 1 );
					break;
				}
				case 4: {
					myself.i_ai4 = ( myself.i_ai4 + 1 );
					break;
				}
			}
			myself::AddTimerEx(78001,( 10 * 1000 ));
		} else if( script_event_arg1 == 78010016 ) {
			if( script_event_arg2 == 3 ) {
				if( myself.i_ai0 != -1 ) {
					maker0 = gg::GetNpcMaker(sub_maker_name + gg::IntToStr(script_event_arg3) + "m1");
					if( gg::IsNull(maker0) == 0 ) {
						gg::SendMakerScriptEvent(maker0,78010003,0,script_event_arg3);
						myself.i_ai0 = -1;
						maker0 = gg::GetNpcMaker(f8_maker_name);
						if( gg::IsNull(maker0) == 0 ) {
							gg::SendMakerScriptEvent(maker0,78010034,0,script_event_arg3);
						}
					}
					myself.i_ai1 = gg::Rand(death_count);
					myself.i_ai2 = gg::Rand(death_count);
					myself.i_ai3 = gg::Rand(death_count);
					myself.i_ai4 = gg::Rand(death_count);
					myself::AddTimerEx(78001,( ( 5 * 60 ) * 1000 ));
				}
			} else if( gg::Rand(1000) > 500 && script_event_arg2 < 3 ) {
				myself.i_ai0 = ( script_event_arg2 + 1 );
			} else {
				myself.i_ai0 = script_event_arg2;
			}
			switch(script_event_arg3) {
				case 1: {
					myself.i_ai1 = 0;
					myself.i_ai2 = ( ( myself.i_ai2 + 1 ) * gg::Rand(3) );
					myself.i_ai3 = ( ( myself.i_ai3 + 1 ) * gg::Rand(3) );
					myself.i_ai4 = ( ( myself.i_ai4 + 1 ) * gg::Rand(3) );
					break;
				}
				case 2: {
					myself.i_ai2 = 0;
					myself.i_ai1 = ( ( myself.i_ai1 + 1 ) * gg::Rand(3) );
					myself.i_ai3 = ( ( myself.i_ai3 + 1 ) * gg::Rand(3) );
					myself.i_ai4 = ( ( myself.i_ai4 + 1 ) * gg::Rand(3) );
					break;
				}
				case 3: {
					myself.i_ai3 = 0;
					myself.i_ai1 = ( ( myself.i_ai1 + 1 ) * gg::Rand(3) );
					myself.i_ai2 = ( ( myself.i_ai2 + 1 ) * gg::Rand(3) );
					myself.i_ai4 = ( ( myself.i_ai4 + 1 ) * gg::Rand(3) );
					break;
				}
				case 4: {
					myself.i_ai4 = 0;
					myself.i_ai1 = ( ( myself.i_ai1 + 1 ) * gg::Rand(3) );
					myself.i_ai2 = ( ( myself.i_ai2 + 1 ) * gg::Rand(3) );
					myself.i_ai3 = ( ( myself.i_ai3 + 1 ) * gg::Rand(3) );
					break;
				}
			}
			myself::AddTimerEx(78001,( 10 * 1000 ));
		} else if( script_event_arg1 == 78010040 ) {
			myself.i_ai0 = script_event_arg2;
			switch(script_event_arg3) {
				case 1: {
					myself.i_ai1 = 0;
					myself.i_ai2 = ( ( myself.i_ai2 + 1 ) * gg::Rand(3) );
					myself.i_ai3 = ( ( myself.i_ai3 + 1 ) * gg::Rand(3) );
					myself.i_ai4 = ( ( myself.i_ai4 + 1 ) * gg::Rand(3) );
					break;
				}
				case 2: {
					myself.i_ai2 = 0;
					myself.i_ai1 = ( ( myself.i_ai1 + 1 ) * gg::Rand(3) );
					myself.i_ai3 = ( ( myself.i_ai3 + 1 ) * gg::Rand(3) );
					myself.i_ai4 = ( ( myself.i_ai4 + 1 ) * gg::Rand(3) );
					break;
				}
				case 3: {
					myself.i_ai3 = 0;
					myself.i_ai1 = ( ( myself.i_ai1 + 1 ) * gg::Rand(3) );
					myself.i_ai2 = ( ( myself.i_ai2 + 1 ) * gg::Rand(3) );
					myself.i_ai4 = ( ( myself.i_ai4 + 1 ) * gg::Rand(3) );
					break;
				}
				case 4: {
					myself.i_ai4 = 0;
					myself.i_ai1 = ( ( myself.i_ai1 + 1 ) * gg::Rand(3) );
					myself.i_ai2 = ( ( myself.i_ai2 + 1 ) * gg::Rand(3) );
					myself.i_ai3 = ( ( myself.i_ai3 + 1 ) * gg::Rand(3) );
					break;
				}
			}
			myself::AddTimerEx(78001,( 10 * 1000 ));
		} else if( script_event_arg1 == 78010034 ) {
			myself.i_ai0 = -1;
		} else if( script_event_arg1 == 78010004 ) {
			myself.i_ai0 = 1;
		}
	}

	EventHandler ON_NPC_DELETED(deleted_def,i0,i1,maker0,reply,def0) {
	}

	EventHandler ON_TIMER(timer_id,maker0) {
		if( timer_id == 78001 ) {
			if( myself.i_ai1 >= myself.i_ai2 && myself.i_ai1 >= myself.i_ai3 && myself.i_ai1 >= myself.i_ai4 && myself.i_ai1 >= death_count && myself.i_ai0 > 0 ) {
				maker0 = gg::GetNpcMaker(sub_maker_name_1);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,78010018,myself.i_ai0,1);
					myself.i_ai0 = 0;
				}
			} else if( myself.i_ai2 >= myself.i_ai1 && myself.i_ai2 >= myself.i_ai3 && myself.i_ai2 >= myself.i_ai4 && myself.i_ai2 >= death_count && myself.i_ai0 > 0 ) {
				maker0 = gg::GetNpcMaker(sub_maker_name_2);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,78010018,myself.i_ai0,2);
					myself.i_ai0 = 0;
				}
			} else if( myself.i_ai3 >= myself.i_ai1 && myself.i_ai3 >= myself.i_ai2 && myself.i_ai3 >= myself.i_ai4 && myself.i_ai3 >= death_count && myself.i_ai0 > 0 ) {
				maker0 = gg::GetNpcMaker(sub_maker_name_3);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,78010018,myself.i_ai0,3);
					myself.i_ai0 = 0;
				}
			} else if( myself.i_ai4 >= myself.i_ai1 && myself.i_ai4 >= myself.i_ai2 && myself.i_ai4 >= myself.i_ai3 && myself.i_ai4 >= death_count && myself.i_ai0 > 0 ) {
				maker0 = gg::GetNpcMaker(sub_maker_name_4);
				if( gg::IsNull(maker0) == 0 ) {
					gg::SendMakerScriptEvent(maker0,78010018,myself.i_ai0,4);
					myself.i_ai0 = 0;
				}
			}
		}
		if( timer_id == 78002 ) {
			if( myself.i_ai0 != 0 ) {
				myself.i_ai0 = 1;
				myself.i_ai1 = gg::Rand(death_count);
				myself.i_ai2 = gg::Rand(death_count);
				myself.i_ai3 = gg::Rand(death_count);
				myself.i_ai4 = gg::Rand(death_count);
				myself::AddTimerEx(78001,( 1 * 1000 ));
				myself::AddTimerEx(78002,( ( ( 3 * 60 ) * 60 ) * 1000 ));
			} else {
				myself::AddTimerEx(78002,( ( 15 * 60 ) * 1000 ));
			}
		}
	}

}
