테스트

aion-server 4.8

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

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

import com.aionemu.gameserver.ai.event.AIEventType;
import com.aionemu.gameserver.instance.handlers.GeneralInstanceHandler;
import com.aionemu.gameserver.instance.handlers.InstanceID;
import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.network.aion.serverpackets.SM_PLAY_MOVIE;
import com.aionemu.gameserver.skillengine.SkillEngine;
import com.aionemu.gameserver.skillengine.effect.AbnormalState;
import com.aionemu.gameserver.utils.PacketSendUtility;
import com.aionemu.gameserver.utils.ThreadPoolManager;
import com.aionemu.gameserver.world.WorldMapInstance;
import com.aionemu.gameserver.world.zone.ZoneInstance;
import com.aionemu.gameserver.world.zone.ZoneName;

/**
 * @author Ritsu, Luzien
 * @see <a href="http://gameguide.na.aiononline.com/aion/Padmarashka%27s+Cave+Walkthrough">Padmarashka's Cave</a>
 */
@InstanceID(320150000)
public class PadmarashkasCaveInstance extends GeneralInstanceHandler {

	private final AtomicBoolean moviePlayed = new AtomicBoolean();
	private final AtomicInteger killedPadmarashkaProtector = new AtomicInteger();
	private final AtomicInteger killedEggs = new AtomicInteger();

	public PadmarashkasCaveInstance(WorldMapInstance instance) {
		super(instance);
	}

	@Override
	public void onDie(Npc npc) {
		final int npcId = npc.getNpcId();
		switch (npcId) {
			case 218670:
			case 218671:
			case 218673:
			case 218674:
				if (killedPadmarashkaProtector.incrementAndGet() == 4) {
					killedPadmarashkaProtector.set(0);
					final Npc padmarashka = getNpc(218756);
					if (padmarashka != null && !padmarashka.isDead()) {
						padmarashka.getEffectController().unsetAbnormal(AbnormalState.SLEEP);
						// padmarashka.getEffectController().broadCastEffects(0);
						SkillEngine.getInstance().getSkill(padmarashka, 19187, 55, padmarashka).useNoAnimationSkill();
						padmarashka.getEffectController().removeEffect(19186); // skill should handle this TODO: fix
						ThreadPoolManager.getInstance()
							.schedule(() -> padmarashka.getAi().onCreatureEvent(AIEventType.CREATURE_AGGRO, instance.getPlayersInside().get(0)), 1000);
					}
				}
				break;
			case 282613:
			case 282614:
				if (killedEggs.incrementAndGet() == 20) { // TODO: find value
					final Npc padmarashka = getNpc(218756);
					if (padmarashka != null && !padmarashka.isDead()) {
						SkillEngine.getInstance().applyEffectDirectly(20101, padmarashka, padmarashka);
					}
				}
				break;
		}
	}

	@Override
	public void onEnterZone(Player player, ZoneInstance zone) {
		if (zone.getAreaTemplate().getZoneName() == ZoneName.get("PADMARASHKAS_NEST_320150000") && moviePlayed.compareAndSet(false, true))
			PacketSendUtility.broadcastToMap(instance, new SM_PLAY_MOVIE(false, 0, 0, 488, true));
	}

	@Override
	public void onInstanceDestroy() {
		moviePlayed.set(false);
		killedPadmarashkaProtector.set(0);
	}
}

📎 첨부파일

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