Give more information on GetMazeMapInfoCsReq

This commit is contained in:
memetrollsXD 2022-08-03 03:56:29 +02:00
parent 994c8448bc
commit 73593ef8e0
No known key found for this signature in database
GPG Key ID: 105C2F3417AC32CD
4 changed files with 67 additions and 6 deletions

View File

@ -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 Packet from "../kcp/Packet";
import Session from "../kcp/Session"; import Session from "../kcp/Session";
export default async function handle(session: Session, packet: Packet) { 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 = { const dataObj = {
retcode: 0, retcode: 0,
entryId: body.entryId, entryId: body.entryId,
lightenSectionList: [], lightenSectionList: [],
mazePropList: [{ groupId: 0, configId: 0, state: 0 }], mazePropList: [{ groupId: mapping.GroupID, configId: mapping.ConfigID, state: 0 }],
mazeGroupList: [{ groupId: 0, modifyTime: 0 }], mazeGroupList: [{ groupId: mapping.GroupID, modifyTime: 0 }],
opendChestNum: 0, opendChestNum: 69,
unlockTeleportList: [] unlockTeleportList: []
} as GetMazeMapInfoScRsp; } as GetMazeMapInfoScRsp;
// TODO: No excel info atm // TODO: No excel info atm
for (let i = 0; i < 20; i++) { for (let i = 0; i < 500; i++) {
dataObj.lightenSectionList.push(i) dataObj.lightenSectionList.push(i)
} }
dataObj.unlockTeleportList = MazePlaneExcel.getAllEntries().map(x => x.ID);
session.send("GetMazeMapInfoScRsp", dataObj); session.send("GetMazeMapInfoScRsp", dataObj);
} }

View File

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

View File

@ -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`];
}
}

View File

@ -59,4 +59,8 @@ export default class MazePlaneExcel {
public static getEntry(entryId: number): MapEntryExcelTableEntry { public static getEntry(entryId: number): MapEntryExcelTableEntry {
return MapEntryExcelTable[entryId.toString()]; return MapEntryExcelTable[entryId.toString()];
} }
public static getAllEntries(): MapEntryExcelTableEntry[] {
return Object.values(MapEntryExcelTable);
}
} }