From 73593ef8e097f07448546d8955ceebc6f60b0db7 Mon Sep 17 00:00:00 2001 From: memetrollsXD Date: Wed, 3 Aug 2022 03:56:29 +0200 Subject: [PATCH] Give more information on GetMazeMapInfoCsReq --- src/server/packets/GetMazeMapInfoCsReq.ts | 18 ++++++---- .../packets/UnlockTutorialGuideCsReq.ts | 15 ++++++++ src/util/excel/MappingInfoExcel.ts | 36 +++++++++++++++++++ src/util/excel/MazePlaneExcel.ts | 4 +++ 4 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 src/server/packets/UnlockTutorialGuideCsReq.ts create mode 100644 src/util/excel/MappingInfoExcel.ts diff --git a/src/server/packets/GetMazeMapInfoCsReq.ts b/src/server/packets/GetMazeMapInfoCsReq.ts index 7875f10..e6a8935 100644 --- a/src/server/packets/GetMazeMapInfoCsReq.ts +++ b/src/server/packets/GetMazeMapInfoCsReq.ts @@ -1,24 +1,30 @@ -import { GetMazeMapInfoScRsp } from "../../data/proto/StarRail"; +import { GetMazeMapInfoCsReq, GetMazeMapInfoScRsp } from "../../data/proto/StarRail"; +import MappingInfoExcel from "../../util/excel/MappingInfoExcel"; +import MazePlaneExcel from "../../util/excel/MazePlaneExcel"; import Packet from "../kcp/Packet"; import Session from "../kcp/Session"; export default async function handle(session: Session, packet: Packet) { - const body = packet.body as GetMazeMapInfoScRsp; + const body = packet.body as GetMazeMapInfoCsReq; + + const mapping = MappingInfoExcel.fromId(body.entryId, session.player.db.basicInfo.worldLevel) || MappingInfoExcel.fromId(1001); const dataObj = { retcode: 0, entryId: body.entryId, lightenSectionList: [], - mazePropList: [{ groupId: 0, configId: 0, state: 0 }], - mazeGroupList: [{ groupId: 0, modifyTime: 0 }], - opendChestNum: 0, + mazePropList: [{ groupId: mapping.GroupID, configId: mapping.ConfigID, state: 0 }], + mazeGroupList: [{ groupId: mapping.GroupID, modifyTime: 0 }], + opendChestNum: 69, unlockTeleportList: [] } as GetMazeMapInfoScRsp; // TODO: No excel info atm - for (let i = 0; i < 20; i++) { + for (let i = 0; i < 500; i++) { dataObj.lightenSectionList.push(i) } + dataObj.unlockTeleportList = MazePlaneExcel.getAllEntries().map(x => x.ID); + session.send("GetMazeMapInfoScRsp", dataObj); } \ No newline at end of file diff --git a/src/server/packets/UnlockTutorialGuideCsReq.ts b/src/server/packets/UnlockTutorialGuideCsReq.ts new file mode 100644 index 0000000..6268c08 --- /dev/null +++ b/src/server/packets/UnlockTutorialGuideCsReq.ts @@ -0,0 +1,15 @@ +import { TutorialStatus, UnlockTutorialGuideCsReq, UnlockTutorialGuideScRsp } from "../../data/proto/StarRail"; +import Packet from "../kcp/Packet"; +import Session from "../kcp/Session"; + +export default async function handle(session: Session, packet: Packet) { + const body = packet.body as UnlockTutorialGuideCsReq; + + session.send("UnlockTutorialGuideScRsp", { + retcode: 0, + tutorialGuide: { + id: body.groupId, + status: TutorialStatus.TUTORIAL_FINISH + } + } as UnlockTutorialGuideScRsp); +} \ No newline at end of file diff --git a/src/util/excel/MappingInfoExcel.ts b/src/util/excel/MappingInfoExcel.ts new file mode 100644 index 0000000..38ded12 --- /dev/null +++ b/src/util/excel/MappingInfoExcel.ts @@ -0,0 +1,36 @@ +import _MappingInfoExcelTable from "../../data/excel/MappingInfoExcelTable.json"; + +interface TextMap { + hash: number; +} + +interface MappingInfoExcelEntry { + ID: number; + WorldLevel: number; + Type: "TYPE_COCOON" | "TYPE_TOWN"; + IsTeleport: boolean; + IsShowInFog: boolean; + PlaneID: number; + FloorID: number; + GroupID: number; + ConfigID: number; + InitialEnable: boolean; + Name: TextMap; + Desc: TextMap; + ShowMonsterList: number[]; + RewardList: number[]; + IsShowRewardCount: boolean; + isShowCleared: boolean; +} + +const MappingInfoExcelTable = _MappingInfoExcelTable as { [key: `${number}:${number}`]: MappingInfoExcelEntry }; + + +export default class MappingInfoExcel { + private constructor() { } + + public static fromId(id: number, wl: number = 0) { + const query = MappingInfoExcelTable[`${id}:${wl}`]; + return query || MappingInfoExcelTable[`${id}:0`]; + } +} \ No newline at end of file diff --git a/src/util/excel/MazePlaneExcel.ts b/src/util/excel/MazePlaneExcel.ts index 46c9dda..03d3bd6 100644 --- a/src/util/excel/MazePlaneExcel.ts +++ b/src/util/excel/MazePlaneExcel.ts @@ -59,4 +59,8 @@ export default class MazePlaneExcel { public static getEntry(entryId: number): MapEntryExcelTableEntry { return MapEntryExcelTable[entryId.toString()]; } + + public static getAllEntries(): MapEntryExcelTableEntry[] { + return Object.values(MapEntryExcelTable); + } } \ No newline at end of file