diff --git a/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java b/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java index 5e12ee150..c61923452 100644 --- a/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java +++ b/src/main/java/emu/grasscutter/command/commands/EnterDungeonCommand.java @@ -33,7 +33,7 @@ public final class EnterDungeonCommand implements CommandHandler { targetPlayer .getServer() .getDungeonSystem() - .enterDungeon(targetPlayer.getSession().getPlayer(), 0, dungeonId); + .enterDungeon(targetPlayer.getSession().getPlayer(), 0, dungeonId, true); if (!result) { CommandHandler.sendMessage( diff --git a/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonData.java b/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonData.java index 65b4b79e7..ad4d651c9 100644 --- a/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonData.java +++ b/src/main/java/emu/grasscutter/data/excels/dungeon/DungeonData.java @@ -22,6 +22,7 @@ public class DungeonData extends GameResource { private DungeonInvolveType involveType; @Getter private int limitLevel; @Getter private int passCond; + @Getter private int passJumpDungeon; @Getter private int reviveMaxCount; @Getter private int settleCountdownTime; @Getter private int failSettleCountdownTime; diff --git a/src/main/java/emu/grasscutter/game/activity/trialavatar/TrialAvatarActivityHandler.java b/src/main/java/emu/grasscutter/game/activity/trialavatar/TrialAvatarActivityHandler.java index 6b2a194c8..719607721 100644 --- a/src/main/java/emu/grasscutter/game/activity/trialavatar/TrialAvatarActivityHandler.java +++ b/src/main/java/emu/grasscutter/game/activity/trialavatar/TrialAvatarActivityHandler.java @@ -80,7 +80,7 @@ public class TrialAvatarActivityHandler extends ActivityHandler { if (!player .getServer() .getDungeonSystem() - .enterDungeon(player, enterPointId, getTrialActivityDungeonId(trialAvatarIndexId))) + .enterDungeon(player, enterPointId, getTrialActivityDungeonId(trialAvatarIndexId), true)) return false; setSelectedTrialAvatarIndex(trialAvatarIndexId); diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java index 714ceb9b2..f76651ba2 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonManager.java @@ -282,6 +282,13 @@ public final class DungeonManager { // Call PlayerFinishDungeonEvent. new PlayerFinishDungeonEvent(this.getScene().getPlayers(), this.getScene(), this).call(); + + // jump players to next dungeon if available + if (this.dungeonData.getPassJumpDungeon() != 0) { + for (var player : this.getScene().getPlayers()) { + player.getServer().getDungeonSystem().enterDungeon(player, 0, this.dungeonData.getPassJumpDungeon(), false); + } + } } public void quitDungeon() { diff --git a/src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java b/src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java index 7135ac7aa..228534f19 100644 --- a/src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java +++ b/src/main/java/emu/grasscutter/game/dungeons/DungeonSystem.java @@ -88,7 +88,7 @@ public final class DungeonSystem extends BaseGameSystem { return handler.execute(condition, params); } - public boolean enterDungeon(Player player, int pointId, int dungeonId) { + public boolean enterDungeon(Player player, int pointId, int dungeonId, boolean savePrevious) { DungeonData data = GameData.getDungeonDataMap().get(dungeonId); if (data == null) { @@ -103,7 +103,7 @@ public final class DungeonSystem extends BaseGameSystem { var sceneId = data.getSceneId(); var scene = player.getScene(); - scene.setPrevScene(sceneId); + if (savePrevious) scene.setPrevScene(scene.getId()); if (player.getWorld().transferPlayerToScene(player, sceneId, data)) { scene = player.getScene(); @@ -111,7 +111,7 @@ public final class DungeonSystem extends BaseGameSystem { scene.addDungeonSettleObserver(basicDungeonSettleObserver); } - scene.setPrevScenePoint(pointId); + if (savePrevious) scene.setPrevScenePoint(pointId); return true; } diff --git a/src/main/java/emu/grasscutter/game/world/World.java b/src/main/java/emu/grasscutter/game/world/World.java index 085e60fe7..5664e1282 100644 --- a/src/main/java/emu/grasscutter/game/world/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -439,7 +439,7 @@ public class World implements Iterable { } if (oldScene != null && newScene != oldScene) { - newScene.setPrevScene(oldScene.getId()); + newScene.setPrevScenePoint(oldScene.getPrevScenePoint()); oldScene.setDontDestroyWhenEmpty(false); } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerEnterDungeonReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerEnterDungeonReq.java index 5aa15e2de..9941fc389 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerEnterDungeonReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerPlayerEnterDungeonReq.java @@ -17,7 +17,7 @@ public class HandlerPlayerEnterDungeonReq extends PacketHandler { session .getServer() .getDungeonSystem() - .enterDungeon(session.getPlayer(), req.getPointId(), req.getDungeonId()); + .enterDungeon(session.getPlayer(), req.getPointId(), req.getDungeonId(), true); session .getPlayer() .sendPacket(new PacketPlayerEnterDungeonRsp(req.getPointId(), req.getDungeonId(), success));