테스트

aion-server 4.8

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

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

import com.aionemu.gameserver.instance.handlers.GeneralInstanceHandler;
import com.aionemu.gameserver.instance.handlers.InstanceID;
import com.aionemu.gameserver.model.animations.TeleportAnimation;
import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.network.aion.serverpackets.SM_SYSTEM_MESSAGE;
import com.aionemu.gameserver.services.teleport.TeleportService;
import com.aionemu.gameserver.utils.ThreadPoolManager;
import com.aionemu.gameserver.world.WorldMapInstance;

/**
 * After activating the start device one of three game events will be chosen.
 * The first one is a key collecting challenge with a time limit about 5
 * minutes. After that all monster and chests will despawn. It happens in
 * the first room, the way to the next one is blocked. After time expires
 * a portal to the prisons will be spawned, where you can open the doors
 * with your keys to kill the NPC behind them and get some ap relics.
 * The second one seems to be a hide&seek with a time limit about 5
 * minutes, too. The goal of this is actually not clear. After time expires
 * you get access to the last room with a "Test Subject ..." NPC, who drops
 * five rare manastone bundles. There is also a chest containing relics
 * behind the test subject.
 * The third one is a tower defense game, where wave of balaur spawn and
 * try to kill something. It seems to be finished after 5 minutes too with
 * the commander wave. Maybe he drops the missing ap relics or rare
 * manastone bundles. (written by Estrayl)
 * 
 * @author Yeats
 *         TODO: Mini Game 2 & 3
 */
@InstanceID(300480000)
public class DanuarMysticariumInstance extends GeneralInstanceHandler {

	private List<Future<?>> tasks;

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

	@Override
	public void onOpenDoor(int door) {
		switch (door) {
			case 6 -> spawn(219964, 225.53f, 529.7f, 153.04f, (byte) 100);
			case 7 -> spawn(219963, 241.602f, 541.79f, 152.591f, (byte) 95);
			case 8 -> spawn(219965, 262.17f, 545.68f, 150.51f, (byte) 85);
			case 10 -> spawn(219964, 295.04f, 547.48f, 148.73f, (byte) 90);
			case 11 -> spawn(219963, 317.654f, 545.801f, 148.8f, (byte) 80);
			case 12 -> spawn(219965, 336.94f, 532.89f, 148.472f, (byte) 75);
			case 13 -> spawn(219969, 348.14f, 512.56f, 148.19f, (byte) 65);
			case 101 -> spawn(219963, 212.068f, 510.02f, 153.23f, (byte) 115);
		}
	}

	@Override
	public void handleUseItemFinish(Player player, Npc npc) {
		switch (npc.getNpcId()) {
			case 731583:
				startTasks();
				instance.setDoorState(3, true);
				sendMsg(SM_SYSTEM_MESSAGE.STR_MSG_IDLDF5Re_solo_game1_1());
				TeleportService.teleportTo(player, instance, 140.45f, 182.2f, 242f, (byte) 10, TeleportAnimation.FADE_OUT_BEAM);
				npc.getController().delete();
				break;
			case 702715:
				TeleportService.teleportTo(player, instance, 236.1f, 488.86f, 152f, (byte) 25, TeleportAnimation.FADE_OUT_BEAM);
				break;
			case 702717:
				TeleportService.moveToInstanceExit(player, mapId, player.getRace());
				break;
		}
	}

	private void startTasks() {
		tasks = new ArrayList<>();
		tasks.add(ThreadPoolManager.getInstance().schedule(() -> sendMsg(SM_SYSTEM_MESSAGE.STR_MSG_IDLDF5Re_solo_game1_2()), 125000));
		tasks.add(ThreadPoolManager.getInstance().schedule(() -> sendMsg(SM_SYSTEM_MESSAGE.STR_MSG_IDLDF5Re_solo_game1_3()), 155000));
		tasks.add(ThreadPoolManager.getInstance().schedule(() -> sendMsg(SM_SYSTEM_MESSAGE.STR_MSG_IDLDF5Re_solo_game1_4()), 175000));
		tasks.add(ThreadPoolManager.getInstance().schedule(() -> {
			deleteAliveNpcs(219958, 219959, 702700, 702701);
			spawn(702715, 169.366f, 208.93f, 188.02f, (byte) 0);
			sendMsg(SM_SYSTEM_MESSAGE.STR_MSG_IDLDF5Re_solo_game1_5());
			sendMsg(SM_SYSTEM_MESSAGE.STR_MSG_IDLDF5Re_solo_game1_6());
		}, 185000)); // 3min 5sec
	}

	private void cancelTasks() {
		if (tasks != null) {
			tasks.stream().filter(future -> future != null && !future.isCancelled()).forEach(future -> future.cancel(true));
		}
	}

	@Override
	public void onInstanceDestroy() {
		cancelTasks();
	}

	@Override
	public void leaveInstance(Player player) {
		TeleportService.moveToInstanceExit(player, mapId, player.getRace());
	}
}

📎 첨부파일

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