테스트

aion-server 4.8

Gitteol
최고관리자 · 1 · 💬 0 클론/새로받기
 4.8 61f661d · 1 commits 새로받기(Pull)
game-server/data/handlers/ai/instance/drakenspire/WavePortalAI.java
package ai.instance.drakenspire;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;

import com.aionemu.commons.utils.Rnd;
import com.aionemu.gameserver.ai.AIName;
import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.utils.ThreadPoolManager;

import ai.NoActionAI;

/**
 * @author Estrayl
 */
@AIName("wave_portal")
public class WavePortalAI extends NoActionAI {

	private List<Future<?>> tasks = new ArrayList<>();

	public WavePortalAI(Npc owner) {
		super(owner);
	}

	@Override
	protected void handleSpawned() {
		super.handleSpawned();
		int staticId = getOwner().getSpawn().getStaticId();
		tasks.add(ThreadPoolManager.getInstance().scheduleAtFixedRate(() -> {
			switch (staticId) {
				case 84 -> {// Top Left
					spawn(236204, 581.92f, 823.65f, 1609.64f, (byte) 15, "301390000_Wave_Top_Left_01");
					spawn(236204, 581.92f, 823.65f, 1609.64f, (byte) 15, "301390000_Wave_Top_Left_02");
				}
				case 405 -> {// Central
					spawn(Rnd.get(236216, 236220), 635.17f, 811.90f, 1598.50f, (byte) 30, "301390000_Wave_Commander_Left", 1000);
					spawn(Rnd.get(236216, 236220), 635.17f, 811.90f, 1598.50f, (byte) 30, "301390000_Wave_Commander_Middle", 0);
					spawn(Rnd.get(236216, 236220), 635.17f, 811.90f, 1598.50f, (byte) 30, "301390000_Wave_Commander_Right", 1000);
				}
				case 548 -> {// Bottom Left
					spawn(236204, 687.29f, 825.78f, 1609.66f, (byte) 45, "301390000_Wave_Bottom_Left_01");
					spawn(236204, 687.29f, 825.78f, 1609.66f, (byte) 45, "301390000_Wave_Bottom_Left_02");
				}
				case 398 -> {// Bottom Central
					spawn(236205, 704.21f, 877.60f, 1604.55f, (byte) 60, "301390000_Wave_Bottom_Central_01");
					spawn(236205, 704.21f, 877.60f, 1604.55f, (byte) 60, "301390000_Wave_Bottom_Central_02");
				}
				case 401 -> {// Top Central
					spawn(236205, 575.15f, 877.52f, 1600.89f, (byte) 0, "301390000_Wave_Top_Central_01");
					spawn(236205, 575.15f, 877.52f, 1600.89f, (byte) 0, "301390000_Wave_Top_Central_02");
				}
				case 399 -> {// Bottom Right
					spawn(236206, 690.59f, 932.85f, 1618.27f, (byte) 75, "301390000_Wave_Bottom_Right_01");
					spawn(236206, 690.59f, 932.85f, 1618.27f, (byte) 75, "301390000_Wave_Bottom_Right_02");
				}
				case 407 -> {// Top Right
					spawn(236206, 576.92f, 936.11f, 1620.33f, (byte) 104, "301390000_Wave_Top_Right_01");
					spawn(236206, 576.92f, 936.11f, 1620.33f, (byte) 104, "301390000_Wave_Top_Right_02");
				}
			}
		}, 8000, staticId == 405 ? 40000 : 22000));
	}

	private void spawn(int npcId, float x, float y, float z, int heading, String walkerId) {
		spawn(npcId, x, y, z, heading, walkerId, 0);
	}

	private void spawn(int npcId, float x, float y, float z, int heading, String walkerId, int delay) {
		tasks.add(ThreadPoolManager.getInstance().schedule(() -> {
			Npc npc = (Npc) spawn(npcId, x, y, z, (byte) heading);
			npc.getSpawn().setWalkerId(walkerId);
		}, delay));
	}

	@Override
	protected void handleDespawned() {
		for (Future<?> task : tasks)
			if (task != null && !task.isCancelled())
				task.cancel(true);
		super.handleDespawned();
	}
}

📎 첨부파일

댓글 작성 권한이 없습니다.
🏆 포인트 랭킹 TOP 10
순위 닉네임 포인트
1 no_profile 타키야겐지쪽지보내기 자기소개 아이디로 검색 전체게시물 102,949
2 no_profile 동가리쪽지보내기 자기소개 아이디로 검색 전체게시물 63,733
3 no_profile 라프텔쪽지보내기 자기소개 아이디로 검색 전체게시물 51,771
4 no_profile 불멸의행복쪽지보내기 자기소개 아이디로 검색 전체게시물 36,923
5 서번트쪽지보내기 자기소개 아이디로 검색 전체게시물 35,011
6 no_profile 닥터스쪽지보내기 자기소개 아이디로 검색 전체게시물 29,470
7 no_profile 검은고양이쪽지보내기 자기소개 아이디로 검색 전체게시물 29,077
8 no_profile Revolution쪽지보내기 자기소개 아이디로 검색 전체게시물 28,199
9 no_profile 보거스쪽지보내기 자기소개 아이디로 검색 전체게시물 26,731
10 no_profile 호롤롤로쪽지보내기 자기소개 아이디로 검색 전체게시물 17,020
알림 0