From 599cd04770382752e0ce4322d489e54d9ac7129f Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Thu, 28 Dec 2023 17:25:10 -0800 Subject: [PATCH] Fix leaving challenges --- src/main/java/emu/lunarcore/data/excel/StageExcel.java | 5 +++++ src/main/java/emu/lunarcore/game/battle/BattleService.java | 2 +- .../java/emu/lunarcore/game/challenge/ChallengeInstance.java | 1 + src/main/java/emu/lunarcore/game/enums/StageType.java | 4 +++- .../server/packet/recv/HandlerGetDailyActiveInfoCsReq.java | 2 +- .../server/packet/recv/HandlerGetRogueInfoCsReq.java | 3 ++- .../server/packet/recv/HandlerPlayerLoginFinishCsReq.java | 3 +-- 7 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/emu/lunarcore/data/excel/StageExcel.java b/src/main/java/emu/lunarcore/data/excel/StageExcel.java index 94fd8d7cb..c52eb1b3e 100644 --- a/src/main/java/emu/lunarcore/data/excel/StageExcel.java +++ b/src/main/java/emu/lunarcore/data/excel/StageExcel.java @@ -32,6 +32,11 @@ public int getId() { @Override public void onLoad() { + // Safety check for future versions + if (this.StageType == null) { + this.StageType = emu.lunarcore.game.enums.StageType.Unknown; + } + // Cache monster list this.monsterWaves = new ArrayList<>(); diff --git a/src/main/java/emu/lunarcore/game/battle/BattleService.java b/src/main/java/emu/lunarcore/game/battle/BattleService.java index f4bbc8c99..7049c9422 100644 --- a/src/main/java/emu/lunarcore/game/battle/BattleService.java +++ b/src/main/java/emu/lunarcore/game/battle/BattleService.java @@ -255,7 +255,7 @@ public Battle finishBattle(Player player, BattleEndStatus result, BattleStatisti case BATTLE_END_QUIT -> { updateStatus = false; // Only teleport back to anchor if stage is a random fight - if (battle.getStage().getStageType().getVal() <= StageType.Maze.getVal()) { + if (battle.getStage().getStageType() == StageType.Maze) { teleportToAnchor = true; } } diff --git a/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java b/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java index 469d87958..471576053 100644 --- a/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java +++ b/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java @@ -68,6 +68,7 @@ private void setCurrentExtraLineup(ExtraLineupType type) { this.currentExtraLineup = type.getNumber(); } + @SuppressWarnings("unused") private int getRoundsElapsed() { return getExcel().getChallengeCountDown() - this.roundsLeft; } diff --git a/src/main/java/emu/lunarcore/game/enums/StageType.java b/src/main/java/emu/lunarcore/game/enums/StageType.java index 623b72210..e9c7659ce 100644 --- a/src/main/java/emu/lunarcore/game/enums/StageType.java +++ b/src/main/java/emu/lunarcore/game/enums/StageType.java @@ -24,7 +24,9 @@ public enum StageType { FantasticStory (18), BattleCollege (19), Heliobus (20), - RogueEndlessActivity (21); + RogueEndlessActivity (21), + StrongChallengeActivity (22), + Challenge (23); @Getter private final int val; diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetDailyActiveInfoCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetDailyActiveInfoCsReq.java index 30691ac7c..015bdf692 100644 --- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetDailyActiveInfoCsReq.java +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetDailyActiveInfoCsReq.java @@ -11,6 +11,6 @@ public class HandlerGetDailyActiveInfoCsReq extends PacketHandler { @Override public void handle(GameSession session, byte[] data) throws Exception { - session.send(new PacketGetDailyActiveInfoScRsp(session.getPlayer())); + //session.send(new PacketGetDailyActiveInfoScRsp(session.getPlayer())); } } diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetRogueInfoCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetRogueInfoCsReq.java index c1ee61b23..c8518ec91 100644 --- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetRogueInfoCsReq.java +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetRogueInfoCsReq.java @@ -11,7 +11,8 @@ public class HandlerGetRogueInfoCsReq extends PacketHandler { @Override public void handle(GameSession session, byte[] data) throws Exception { - session.send(new PacketGetRogueInfoScRsp(session.getPlayer())); + session.send(CmdId.GetRogueInfoScRsp); + //session.send(new PacketGetRogueInfoScRsp(session.getPlayer())); } } diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerPlayerLoginFinishCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerPlayerLoginFinishCsReq.java index 9db5934fd..89fc46ab1 100644 --- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerPlayerLoginFinishCsReq.java +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerPlayerLoginFinishCsReq.java @@ -4,7 +4,6 @@ import emu.lunarcore.server.packet.CmdId; import emu.lunarcore.server.packet.Opcodes; import emu.lunarcore.server.packet.PacketHandler; -import emu.lunarcore.server.packet.send.PacketBattlePassInfoNotify; @Opcodes(CmdId.PlayerLoginFinishCsReq) public class HandlerPlayerLoginFinishCsReq extends PacketHandler { @@ -13,7 +12,7 @@ public class HandlerPlayerLoginFinishCsReq extends PacketHandler { public void handle(GameSession session, byte[] data) throws Exception { session.send(CmdId.PlayerLoginFinishScRsp); session.send(CmdId.GetArchiveDataScRsp); - session.send(new PacketBattlePassInfoNotify()); + //session.send(new PacketBattlePassInfoNotify()); } }