테스트

aion-server 4.8

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

import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicBoolean;

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

import ai.AggressiveNpcAI;

/**
 * @author xTz
 */
@AIName("marabata")
public class MarabataAI extends AggressiveNpcAI {

	private Future<?> boosterLifeCheckTask;
	private AtomicBoolean isStarted = new AtomicBoolean();

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

	@Override
	protected void handleAttack(Creature creature) {
		super.handleAttack(creature);
		if (isStarted.compareAndSet(false, true)) {
			boosterLifeCheckTask = ThreadPoolManager.getInstance().scheduleAtFixedRate(() -> {
				if (isDead())
					return;
				switch (getNpcId()) {
					case 214849:
						if (!isBoosterAlive(700439))
							spawn(700439, 665.374f, 372.751f, 99.375f, (byte) 90);
						if (!isBoosterAlive(700440))
							spawn(700440, 681.851f, 408.625f, 100.472f, (byte) 13);
						if (!isBoosterAlive(700441))
							spawn(700441, 646.550f, 406.088f, 99.375f, (byte) 49);
						break;
					case 214850:
						if (!isBoosterAlive(700442))
							spawn(700442, 636.118f, 325.537f, 99.375f, (byte) 49);
						if (!isBoosterAlive(700443))
							spawn(700443, 676.257f, 319.650f, 99.375f, (byte) 4);
						if (!isBoosterAlive(700444))
							spawn(700444, 655.851f, 292.711f, 99.375f, (byte) 90);
						break;
					case 214851:
						if (!isBoosterAlive(700445))
							spawn(700445, 605.625f, 380.479f, 99.375f, (byte) 14);
						if (!isBoosterAlive(700446))
							spawn(700446, 598.706f, 345.978f, 99.375f, (byte) 98);
						if (!isBoosterAlive(700447))
							spawn(700447, 567.775f, 366.207f, 99.375f, (byte) 59);
						break;
				}
			}, 30000, 30000);
		}
	}

	@Override
	protected void handleSpawned() {
		super.handleSpawned();
		switch (getNpcId()) {
			case 214849:
				spawn(700439, 665.374f, 372.751f, 99.375f, (byte) 90);
				spawn(700440, 681.851f, 408.625f, 100.472f, (byte) 13);
				spawn(700441, 646.550f, 406.088f, 99.375f, (byte) 49);
				break;
			case 214850:
				spawn(700442, 636.118f, 325.537f, 99.375f, (byte) 49);
				spawn(700443, 676.257f, 319.650f, 99.375f, (byte) 4);
				spawn(700444, 655.851f, 292.711f, 99.375f, (byte) 90);
				break;
			case 214851:
				spawn(700445, 605.625f, 380.479f, 99.375f, (byte) 14);
				spawn(700446, 598.706f, 345.978f, 99.375f, (byte) 98);
				spawn(700447, 567.775f, 366.207f, 99.375f, (byte) 59);
				break;
		}
	}

	private boolean isBoosterAlive(int boosterId) {
		return getPosition().getWorldMapInstance().getNpc(boosterId) != null;
	}

	private void cancelTask() {
		if (boosterLifeCheckTask != null && !boosterLifeCheckTask.isCancelled())
			boosterLifeCheckTask.cancel(true);
	}

	@Override
	protected void handleDied() {
		super.handleDied();
		cancelTask();
	}

	@Override
	protected void handleDespawned() {
		super.handleDespawned();
		cancelTask();
	}
}

📎 첨부파일

댓글 작성 권한이 없습니다.
🏆 포인트 랭킹 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