mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-25 04:19:40 +00:00
Implement passJumpDungeon. Make dungeons kick you out to the correct scene (#2366)
This commit is contained in:
parent
2643c6b3b7
commit
c4dbb6851b
@ -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(
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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() {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user