@LabelIndex 421533
@StringIndex 63775
class 1 sailren_maker : default_use_db_maker {
handler:
	EventHandler ON_SCRIPT_EVENT(script_event_arg1,script_event_arg2,script_event_arg3,def0,i0,i1) {
		switch(script_event_arg1) {
			case 11042: {
				def0 = myself::GetSpawnDefine(0);
				if( gg::IsNull(def0) == 0 ) {
					def0::SendScriptEvent(11042,1,0);
				}
				break;
			}
		}
		super;
	}

	EventHandler ON_DB_NPC_INFO(loaded_def,record0,i0,maker0) {
		if( record0.is_alive ) {
			if( myself::AtomicIncreaseTotal(loaded_def,1,1) ) {
				if( record0.x != -113091 ) {
					maker0 = gg::GetNpcMaker("rune16_npc2017_01m1");
					if( gg::IsNull(maker0) == 0 ) {
						gg::SendMakerScriptEvent(maker0,11047,0,0);
					}
				}
				if( record0.x == -113091 ) {
					maker0 = gg::GetNpcMaker("rune16_npc2017_13m1");
					if( gg::IsNull(maker0) == 0 ) {
						gg::SendMakerScriptEvent(maker0,11047,0,0);
					}
				}
				loaded_def::SetDBLoaded(1);
				loaded_def::SpawnEx(1,0,record0.x,record0.y,record0.z,0,record0.hp,record0.mp,record0.db_value);
			}
		} else if( myself::AtomicIncreaseTotal(loaded_def,1,1) ) {
			if( record0.death_time == 0 ) {
				loaded_def::Spawn2(loaded_def.total,0,0);
			} else {
				i0 = ( record0.death_time + loaded_def.respawn_time );
				loaded_def::RegToRespawnTimer(i0);
			}
		}
	}

	EventHandler ON_NPC_DELETED(deleted_def,i0,i1,maker0,reply) {
		deleted_def::SetDBLoaded(0);
		maker0 = gg::GetNpcMaker("rune16_npc2017_01m1");
		if( gg::IsNull(maker0) == 0 ) {
			gg::SendMakerScriptEvent(maker0,11045,0,0);
		}
		if( myself::AtomicIncreaseTotal(deleted_def,1,1) ) {
			deleted_def::Spawn2(1,deleted_def.respawn_time,deleted_def.respawn_rand);
		}
	}

}
