diff --git a/src/main/java/emu/lunarcore/game/challenge/ChallengeEntityLoader.java b/src/main/java/emu/lunarcore/game/challenge/ChallengeEntityLoader.java index 6d366768f..ccb23e608 100644 --- a/src/main/java/emu/lunarcore/game/challenge/ChallengeEntityLoader.java +++ b/src/main/java/emu/lunarcore/game/challenge/ChallengeEntityLoader.java @@ -1,5 +1,6 @@ package emu.lunarcore.game.challenge; +import emu.lunarcore.GameConstants; import emu.lunarcore.data.GameData; import emu.lunarcore.data.config.GroupInfo; import emu.lunarcore.data.config.MonsterInfo; @@ -24,6 +25,9 @@ public void onSceneLoad(Scene scene) { // Setup first stage scene.loadGroup(instance.getExcel().getMazeGroupID1()); + // Set leave entry + scene.setLeaveEntryId(instance.isStory() ? GameConstants.CHALLENGE_STORY_ENTRANCE : GameConstants.CHALLENGE_ENTRANCE); + // Load all groups with props for (var group : scene.getFloorInfo().getGroups().values()) { // Skip non-server groups diff --git a/src/main/java/emu/lunarcore/game/scene/Scene.java b/src/main/java/emu/lunarcore/game/scene/Scene.java index 0354f370a..bb5d5b856 100644 --- a/src/main/java/emu/lunarcore/game/scene/Scene.java +++ b/src/main/java/emu/lunarcore/game/scene/Scene.java @@ -27,6 +27,7 @@ import it.unimi.dsi.fastutil.ints.*; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.Getter; +import lombok.Setter; import us.hebi.quickbuf.RepeatedInt; @Getter @@ -38,6 +39,7 @@ public class Scene implements Tickable { private final int planeId; private final int floorId; private int entryId; + @Setter private int leaveEntryId; private int lastEntityId = 0; private boolean loaded = false; diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerLeaveChallengeCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerLeaveChallengeCsReq.java index 656e26e49..9c5c13078 100644 --- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerLeaveChallengeCsReq.java +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerLeaveChallengeCsReq.java @@ -19,10 +19,8 @@ public void handle(GameSession session, byte[] data) throws Exception { // Get entry id int leaveEntryId = GameConstants.CHALLENGE_ENTRANCE; - if (session.getPlayer().getChallengeInstance() != null) { - if (session.getPlayer().getChallengeInstance().getExcel().isStory()) { - leaveEntryId = GameConstants.CHALLENGE_STORY_ENTRANCE; - } + if (session.getPlayer().getScene().getLeaveEntryId() != 0) { + leaveEntryId = session.getPlayer().getScene().getLeaveEntryId(); } // Leave scene