mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-23 10:44:36 +01:00
Refactor map info handler
This commit is contained in:
@@ -23,43 +23,56 @@ public class PacketGetSceneMapInfoScRsp extends BasePacket {
|
||||
var data = GetSceneMapInfoScRsp.newInstance();
|
||||
|
||||
for (int entryId : list) {
|
||||
// Create maze map
|
||||
var mazeMap = MazeMapData.newInstance()
|
||||
.addUnlockedChestList(MazeChest.newInstance().setMapInfoChestType(MapInfoChestType.MAP_INFO_CHEST_TYPE_NORMAL))
|
||||
.addUnlockedChestList(MazeChest.newInstance().setMapInfoChestType(MapInfoChestType.MAP_INFO_CHEST_TYPE_PUZZLE))
|
||||
.addUnlockedChestList(MazeChest.newInstance().setMapInfoChestType(MapInfoChestType.MAP_INFO_CHEST_TYPE_CHALLENGE))
|
||||
.setEntryId(entryId);
|
||||
|
||||
// Map sections. TODO un hardcode
|
||||
// Get map entrance excel
|
||||
MapEntranceExcel excel = GameData.getMapEntranceExcelMap().get(entryId);
|
||||
if (excel == null) {
|
||||
data.addMapList(mazeMap);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get floor info
|
||||
FloorInfo floorInfo = GameData.getFloorInfo(excel.getPlaneID(), excel.getFloorID());
|
||||
if (floorInfo == null) {
|
||||
data.addMapList(mazeMap);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Chest counts
|
||||
mazeMap.addUnlockedChestList(MazeChest.newInstance().setMapInfoChestType(MapInfoChestType.MAP_INFO_CHEST_TYPE_NORMAL).setTotalAmountList(1));
|
||||
mazeMap.addUnlockedChestList(MazeChest.newInstance().setMapInfoChestType(MapInfoChestType.MAP_INFO_CHEST_TYPE_PUZZLE).setTotalAmountList(1));
|
||||
mazeMap.addUnlockedChestList(MazeChest.newInstance().setMapInfoChestType(MapInfoChestType.MAP_INFO_CHEST_TYPE_CHALLENGE).setTotalAmountList(1));
|
||||
|
||||
// Add groups (Npc icons on the map, etc)
|
||||
for (GroupInfo groupInfo : floorInfo.getGroups().values()) {
|
||||
var mazeGroup = MazeGroup.newInstance().setGroupId(groupInfo.getId());
|
||||
mazeMap.addMazeGroupList(mazeGroup);
|
||||
}
|
||||
|
||||
// Map unlocked teleports
|
||||
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);
|
||||
}
|
||||
|
||||
// Lighten sections
|
||||
for (int i = 0; i < 100; i++) {
|
||||
mazeMap.addAllLightenSectionList(i);
|
||||
}
|
||||
|
||||
// Maze groups (Npc icons on the map, etc)
|
||||
MapEntranceExcel excel = GameData.getMapEntranceExcelMap().get(entryId);
|
||||
if (excel != null) {
|
||||
FloorInfo floorInfo = GameData.getFloorInfo(excel.getPlaneID(), excel.getFloorID());
|
||||
if (floorInfo != null) {
|
||||
// Add groups
|
||||
for (GroupInfo groupInfo : floorInfo.getGroups().values()) {
|
||||
var mazeGroup = MazeGroup.newInstance().setGroupId(groupInfo.getId());
|
||||
mazeMap.addMazeGroupList(mazeGroup);
|
||||
}
|
||||
// Map unlocked teleports
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add to proto
|
||||
data.addMapList(mazeMap);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user