mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-13 05:44:36 +01:00
Fix some teleports not being unlocked on the map
This commit is contained in:
@@ -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<GroupInfo> groups;
|
||||
private transient Int2ObjectMap<PropInfo> cachedTeleports;
|
||||
private transient List<PropInfo> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user