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
|
targetPlayer
|
||||||
.getServer()
|
.getServer()
|
||||||
.getDungeonSystem()
|
.getDungeonSystem()
|
||||||
.enterDungeon(targetPlayer.getSession().getPlayer(), 0, dungeonId);
|
.enterDungeon(targetPlayer.getSession().getPlayer(), 0, dungeonId, true);
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
CommandHandler.sendMessage(
|
CommandHandler.sendMessage(
|
||||||
|
@ -22,6 +22,7 @@ public class DungeonData extends GameResource {
|
|||||||
private DungeonInvolveType involveType;
|
private DungeonInvolveType involveType;
|
||||||
@Getter private int limitLevel;
|
@Getter private int limitLevel;
|
||||||
@Getter private int passCond;
|
@Getter private int passCond;
|
||||||
|
@Getter private int passJumpDungeon;
|
||||||
@Getter private int reviveMaxCount;
|
@Getter private int reviveMaxCount;
|
||||||
@Getter private int settleCountdownTime;
|
@Getter private int settleCountdownTime;
|
||||||
@Getter private int failSettleCountdownTime;
|
@Getter private int failSettleCountdownTime;
|
||||||
|
@ -80,7 +80,7 @@ public class TrialAvatarActivityHandler extends ActivityHandler {
|
|||||||
if (!player
|
if (!player
|
||||||
.getServer()
|
.getServer()
|
||||||
.getDungeonSystem()
|
.getDungeonSystem()
|
||||||
.enterDungeon(player, enterPointId, getTrialActivityDungeonId(trialAvatarIndexId)))
|
.enterDungeon(player, enterPointId, getTrialActivityDungeonId(trialAvatarIndexId), true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
setSelectedTrialAvatarIndex(trialAvatarIndexId);
|
setSelectedTrialAvatarIndex(trialAvatarIndexId);
|
||||||
|
@ -282,6 +282,13 @@ public final class DungeonManager {
|
|||||||
|
|
||||||
// Call PlayerFinishDungeonEvent.
|
// Call PlayerFinishDungeonEvent.
|
||||||
new PlayerFinishDungeonEvent(this.getScene().getPlayers(), this.getScene(), this).call();
|
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() {
|
public void quitDungeon() {
|
||||||
|
@ -88,7 +88,7 @@ public final class DungeonSystem extends BaseGameSystem {
|
|||||||
return handler.execute(condition, params);
|
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);
|
DungeonData data = GameData.getDungeonDataMap().get(dungeonId);
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
@ -103,7 +103,7 @@ public final class DungeonSystem extends BaseGameSystem {
|
|||||||
|
|
||||||
var sceneId = data.getSceneId();
|
var sceneId = data.getSceneId();
|
||||||
var scene = player.getScene();
|
var scene = player.getScene();
|
||||||
scene.setPrevScene(sceneId);
|
if (savePrevious) scene.setPrevScene(scene.getId());
|
||||||
|
|
||||||
if (player.getWorld().transferPlayerToScene(player, sceneId, data)) {
|
if (player.getWorld().transferPlayerToScene(player, sceneId, data)) {
|
||||||
scene = player.getScene();
|
scene = player.getScene();
|
||||||
@ -111,7 +111,7 @@ public final class DungeonSystem extends BaseGameSystem {
|
|||||||
scene.addDungeonSettleObserver(basicDungeonSettleObserver);
|
scene.addDungeonSettleObserver(basicDungeonSettleObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.setPrevScenePoint(pointId);
|
if (savePrevious) scene.setPrevScenePoint(pointId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ public class World implements Iterable<Player> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (oldScene != null && newScene != oldScene) {
|
if (oldScene != null && newScene != oldScene) {
|
||||||
newScene.setPrevScene(oldScene.getId());
|
newScene.setPrevScenePoint(oldScene.getPrevScenePoint());
|
||||||
oldScene.setDontDestroyWhenEmpty(false);
|
oldScene.setDontDestroyWhenEmpty(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public class HandlerPlayerEnterDungeonReq extends PacketHandler {
|
|||||||
session
|
session
|
||||||
.getServer()
|
.getServer()
|
||||||
.getDungeonSystem()
|
.getDungeonSystem()
|
||||||
.enterDungeon(session.getPlayer(), req.getPointId(), req.getDungeonId());
|
.enterDungeon(session.getPlayer(), req.getPointId(), req.getDungeonId(), true);
|
||||||
session
|
session
|
||||||
.getPlayer()
|
.getPlayer()
|
||||||
.sendPacket(new PacketPlayerEnterDungeonRsp(req.getPointId(), req.getDungeonId(), success));
|
.sendPacket(new PacketPlayerEnterDungeonRsp(req.getPointId(), req.getDungeonId(), success));
|
||||||
|
Loading…
Reference in New Issue
Block a user