mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-23 10:44:36 +01:00
Unlock all teleports in the guide menu
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package emu.lunarcore.server.packet.recv;
|
||||
|
||||
import emu.lunarcore.proto.GetUnlockTeleportCsReqOuterClass.GetUnlockTeleportCsReq;
|
||||
import emu.lunarcore.server.game.GameSession;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import emu.lunarcore.server.packet.Opcodes;
|
||||
import emu.lunarcore.server.packet.PacketHandler;
|
||||
import emu.lunarcore.server.packet.send.PacketGetUnlockTeleportScRsp;
|
||||
|
||||
@Opcodes(CmdId.GetUnlockTeleportCsReq)
|
||||
public class HandlerGetUnlockTeleportCsReq extends PacketHandler {
|
||||
|
||||
@Override
|
||||
public void handle(GameSession session, byte[] data) throws Exception {
|
||||
var req = GetUnlockTeleportCsReq.parseFrom(data);
|
||||
|
||||
session.send(new PacketGetUnlockTeleportScRsp(req.getEntryIdList()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package emu.lunarcore.server.packet.send;
|
||||
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.config.FloorInfo;
|
||||
import emu.lunarcore.data.excel.MapEntranceExcel;
|
||||
import emu.lunarcore.proto.GetUnlockTeleportScRspOuterClass.GetUnlockTeleportScRsp;
|
||||
import emu.lunarcore.server.packet.BasePacket;
|
||||
import emu.lunarcore.server.packet.CmdId;
|
||||
import us.hebi.quickbuf.RepeatedInt;
|
||||
|
||||
public class PacketGetUnlockTeleportScRsp extends BasePacket {
|
||||
|
||||
public PacketGetUnlockTeleportScRsp(RepeatedInt list) {
|
||||
super(CmdId.GetUnlockTeleportScRsp);
|
||||
|
||||
var data = GetUnlockTeleportScRsp.newInstance();
|
||||
|
||||
for (int entryId : list) {
|
||||
MapEntranceExcel excel = GameData.getMapEntranceExcelMap().get(entryId);
|
||||
if (excel == null) continue;
|
||||
|
||||
FloorInfo floorInfo = GameData.getFloorInfo(excel.getPlaneID(), excel.getFloorID());
|
||||
if (floorInfo == null) continue;
|
||||
|
||||
// Add unlocked teleport ids
|
||||
for (var teleport : floorInfo.getCachedTeleports().values()) {
|
||||
data.addAllUnlockedTeleportList(teleport.getMappingInfoID());
|
||||
}
|
||||
}
|
||||
|
||||
this.setData(data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user