From 0b0313bf295af2ff45f0256abd2f0ea6b22fadfd Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Fri, 29 Sep 2023 06:39:24 -0700 Subject: [PATCH] Fix some teleports not being unlocked on the map --- .../java/emu/lunarcore/data/config/FloorInfo.java | 10 ++++++++++ src/main/java/emu/lunarcore/data/config/PropInfo.java | 6 +++++- src/main/java/emu/lunarcore/game/scene/Scene.java | 2 +- .../packet/send/PacketGetSceneMapInfoScRsp.java | 11 +++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/main/java/emu/lunarcore/data/config/FloorInfo.java b/src/main/java/emu/lunarcore/data/config/FloorInfo.java index a282acb..70b2446 100644 --- a/src/main/java/emu/lunarcore/data/config/FloorInfo.java +++ b/src/main/java/emu/lunarcore/data/config/FloorInfo.java @@ -1,9 +1,11 @@ package emu.lunarcore.data.config; +import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.SerializedName; +import emu.lunarcore.game.enums.PropState; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @@ -19,10 +21,12 @@ public class FloorInfo { private transient boolean loaded; private transient Int2ObjectMap groups; private transient Int2ObjectMap cachedTeleports; + private transient List unlockedCheckpoints; // DEBUG public FloorInfo() { this.groups = new Int2ObjectOpenHashMap<>(); this.cachedTeleports = new Int2ObjectOpenHashMap<>(); + this.unlockedCheckpoints = new ArrayList<>(); } public AnchorInfo getAnchorInfo(int groupId, int anchorId) { @@ -42,8 +46,14 @@ public class FloorInfo { } for (PropInfo prop : group.getPropList()) { + // Check if prop can be teleported to if (prop.getAnchorID() > 0) { + // Put inside cached teleport list to send to client when they request map info this.cachedTeleports.put(prop.getMappingInfoID(), prop); + this.unlockedCheckpoints.add(prop); + + // Force prop to be in the unlocked state + prop.setState(PropState.CheckPointEnable); } } } diff --git a/src/main/java/emu/lunarcore/data/config/PropInfo.java b/src/main/java/emu/lunarcore/data/config/PropInfo.java index 93ed697..4ad2047 100644 --- a/src/main/java/emu/lunarcore/data/config/PropInfo.java +++ b/src/main/java/emu/lunarcore/data/config/PropInfo.java @@ -2,6 +2,7 @@ package emu.lunarcore.data.config; import emu.lunarcore.game.enums.PropState; import lombok.Getter; +import lombok.Setter; @Getter public class PropInfo extends ObjectInfo { @@ -12,6 +13,9 @@ public class PropInfo extends ObjectInfo { private int AnchorID; private int PropID; private int EventID; + private int CocoonID; + private int FarmElementID; + + @Setter private PropState State = PropState.Closed; - private boolean IsDelete; } diff --git a/src/main/java/emu/lunarcore/game/scene/Scene.java b/src/main/java/emu/lunarcore/game/scene/Scene.java index f51012a..66df2e2 100644 --- a/src/main/java/emu/lunarcore/game/scene/Scene.java +++ b/src/main/java/emu/lunarcore/game/scene/Scene.java @@ -222,7 +222,7 @@ public class Scene { // Proto var proto = SceneInfo.newInstance() .setWorldId(this.getExcel().getWorldID()) - .setLCMMECNPOBA(this.getExcel().getPlaneType().getVal()) + .setGameModeType(this.getExcel().getPlaneType().getVal()) .setPlaneId(this.getPlaneId()) .setFloorId(this.getFloorId()) .setEntryId(this.getEntryId()); diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketGetSceneMapInfoScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketGetSceneMapInfoScRsp.java index a49c932..0232807 100644 --- a/src/main/java/emu/lunarcore/server/packet/send/PacketGetSceneMapInfoScRsp.java +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketGetSceneMapInfoScRsp.java @@ -4,11 +4,13 @@ import emu.lunarcore.data.GameData; import emu.lunarcore.data.config.FloorInfo; import emu.lunarcore.data.config.GroupInfo; import emu.lunarcore.data.excel.MapEntranceExcel; +import emu.lunarcore.game.enums.PropState; import emu.lunarcore.proto.GetSceneMapInfoScRspOuterClass.GetSceneMapInfoScRsp; import emu.lunarcore.proto.MapInfoChestTypeOuterClass.MapInfoChestType; import emu.lunarcore.proto.MazeChestOuterClass.MazeChest; import emu.lunarcore.proto.MazeGroupOuterClass.MazeGroup; import emu.lunarcore.proto.MazeMapDataOuterClass.MazeMapData; +import emu.lunarcore.proto.MazePropOuterClass.MazeProp; import emu.lunarcore.server.packet.BasePacket; import emu.lunarcore.server.packet.CmdId; import us.hebi.quickbuf.RepeatedInt; @@ -46,6 +48,15 @@ public class PacketGetSceneMapInfoScRsp extends BasePacket { for (var teleport : floorInfo.getCachedTeleports().values()) { mazeMap.addAllUnlockedTeleportList(teleport.getMappingInfoID()); } + // Map unlocked checkpoints that are not unlocked normally + for (var prop : floorInfo.getUnlockedCheckpoints()) { + var mazeProp = MazeProp.newInstance() + .setGroupId(prop.getAnchorGroupID()) + .setConfigId(prop.getID()) + .setState(PropState.CheckPointEnable.getVal()); + + mazeMap.addMazePropList(mazeProp); + } } }