Fix teleporting to the wrong scene when leaving pure fiction

This commit is contained in:
Melledy 2024-01-09 23:33:34 -08:00
parent cd688dc5a0
commit 9300094362
3 changed files with 8 additions and 4 deletions

View File

@ -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;
@ -24,6 +25,9 @@ public class ChallengeEntityLoader extends SceneEntityLoader {
// 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

View File

@ -27,6 +27,7 @@ import emu.lunarcore.util.Position;
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
@ -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;

View File

@ -19,10 +19,8 @@ public class HandlerLeaveChallengeCsReq extends PacketHandler {
// 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