Implement passJumpDungeon. Make dungeons kick you out to the correct scene (#2366)

This commit is contained in:
Nazrin 2023-09-15 17:50:56 -07:00 committed by GitHub
parent 2643c6b3b7
commit c4dbb6851b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 7 deletions

View File

@ -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(

View File

@ -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;

View File

@ -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);

View File

@ -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() {

View File

@ -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;
}

View File

@ -439,7 +439,7 @@ public class World implements Iterable<Player> {
}
if (oldScene != null && newScene != oldScene) {
newScene.setPrevScene(oldScene.getId());
newScene.setPrevScenePoint(oldScene.getPrevScenePoint());
oldScene.setDontDestroyWhenEmpty(false);
}

View File

@ -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));