Skip to content

Commit

Permalink
Fix teleporting to the wrong scene when leaving pure fiction
Browse files Browse the repository at this point in the history
  • Loading branch information
Melledy committed Jan 10, 2024
1 parent cd688dc commit 9300094
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/emu/lunarcore/game/scene/Scene.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9300094

Please sign in to comment.