Unlock all teleports in the guide menu

This commit is contained in:
Melledy
2023-11-24 16:28:24 -08:00
parent b7fc8b6a32
commit e1c203a165
4 changed files with 735 additions and 0 deletions

View File

@@ -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()));
}
}

View File

@@ -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);
}
}