Fix train parlor map UI

This commit is contained in:
Melledy
2024-07-31 04:00:21 -07:00
parent e80b0fd6eb
commit a1be806ea1
3 changed files with 22 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ public class GameConstants {
// Game
public static final String DEFAULT_NAME = "A Nameless";
public static final int[] DEFAULT_HEAD_ICONS = {208001, 208002};
public static final int DEFAULT_WORLD_ID = 101;
public static final int TRAILBLAZER_AVATAR_ID = 8001;
public static final int MAX_TRAILBLAZER_LEVEL = 70;
public static final int[] WORLD_LEVEL_UPGRADES = {0, 20, 30, 40, 50, 60, 65};

View File

@@ -112,6 +112,7 @@ public class Player implements Tickable {
private int planeId;
private int floorId;
private int entryId;
private int worldId;
private long lastActiveTime;
@@ -800,6 +801,11 @@ public class Player implements Tickable {
nextScene = new Scene(this, planeExcel, floorId);
}
// Set world id
if (planeExcel.getPlaneType() == PlaneType.Town || planeExcel.getPlaneType() == PlaneType.Maze) {
this.worldId = planeExcel.getWorldID();
}
// Set player position
this.getPos().set(pos);
this.getRot().set(rot);
@@ -918,6 +924,11 @@ public class Player implements Tickable {
this.challengeInstance = null;
}
// Set default world id if we don't have it
if (this.worldId == 0) {
this.worldId = GameConstants.DEFAULT_WORLD_ID;
}
// Unstuck check, dont load player into raid scenes
MazePlaneExcel planeExcel = GameData.getMazePlaneExcelMap().get(planeId);
if (planeExcel == null || planeExcel.getPlaneType().getVal() >= PlaneType.Raid.getVal()) {

View File

@@ -39,6 +39,7 @@ public class Scene implements Tickable {
private final int planeId;
private final int floorId;
private int entryId;
private int worldId;
@Setter private int leaveEntryId;
private int lastEntityId = 0;
@@ -72,6 +73,13 @@ public class Scene implements Tickable {
this.healingSprings = new ObjectArrayList<>();
this.triggers = new ObjectArrayList<>();
// Set world id
if (this.getExcel().getPlaneType() == PlaneType.Train) {
this.worldId = player.getWorldId();
} else {
this.worldId = this.getExcel().getWorldID();
}
// Use singleton to avoid allocating memory for a new entity loader everytime we create a scene
this.entityLoader = getExcel().getPlaneType().getSceneEntityLoader();
@@ -391,10 +399,10 @@ public class Scene implements Tickable {
public synchronized SceneInfo toProto() {
// Set loaded flag
this.loaded = true;
// Proto
var proto = SceneInfo.newInstance()
.setWorldId(this.getExcel().getWorldID())
.setWorldId(this.getWorldId())
.setGameModeType(this.getExcel().getPlaneType().getVal())
.setPlaneId(this.getPlaneId())
.setFloorId(this.getFloorId())