diff --git a/src/server/packets/GetCurSceneInfoCsReq.ts b/src/server/packets/GetCurSceneInfoCsReq.ts index 175f3fe..046160f 100644 --- a/src/server/packets/GetCurSceneInfoCsReq.ts +++ b/src/server/packets/GetCurSceneInfoCsReq.ts @@ -1,5 +1,6 @@ -import { GetCurSceneInfoScRsp, Vector } from "../../data/proto/StarRail"; +import { DailyTaskDataScNotify, GetCurSceneInfoScRsp, Vector } from "../../data/proto/StarRail"; import { ActorEntity } from "../../game/entities/Actor"; +import DailyMissionDataExcel from "../../util/excel/DailyMissionDataExcel"; import Packet from "../kcp/Packet"; import Session from "../kcp/Session"; @@ -25,4 +26,35 @@ export default async function handle(session: Session, packet: Packet) { } as unknown as GetCurSceneInfoScRsp); session.player.scene.spawnEntity(curAvatarEntity, true); session.player.scene.entryId = 10001; + + // Daily Tasks + const dailyTasks = DailyMissionDataExcel.random(); + + const dataObj: DailyTaskDataScNotify = { + dailyTaskList: [{ + mainMissionId: 3010201, + isFinished: false + }, + { + mainMissionId: 3010202, + isFinished: false + }, + { + mainMissionId: 3010203, + isFinished: false + }, + { + mainMissionId: 3010204, + isFinished: false + }, + { + mainMissionId: 3010205, + isFinished: false + } + ], + isTakenExtraReward: false, + finishedNum: 0 + } + + session.send("DailyTaskDataScNotify", dataObj); } \ No newline at end of file diff --git a/src/server/packets/GetMissionDataCsReq.ts b/src/server/packets/GetMissionDataCsReq.ts index 982eb01..4263533 100644 --- a/src/server/packets/GetMissionDataCsReq.ts +++ b/src/server/packets/GetMissionDataCsReq.ts @@ -1,10 +1,34 @@ -import { GetMissionDataScRsp } from "../../data/proto/StarRail"; +import { GetMissionDataScRsp, MissionStatus } from "../../data/proto/StarRail"; import Packet from "../kcp/Packet"; import Session from "../kcp/Session"; export default async function handle(session: Session, packet: Packet) { session.send("GetMissionDataScRsp", { retcode: 0, - missionList: [] + missionList: [{ + id: 3010201, + progress: 0, + status: MissionStatus.MISSION_DOING + }, + { + id: 3010202, + progress: 0, + status: MissionStatus.MISSION_DOING + }, + { + id: 3010203, + progress: 0, + status: MissionStatus.MISSION_DOING + }, + { + id: 3010204, + progress: 0, + status: MissionStatus.MISSION_DOING + }, + { + id: 3010205, + progress: 0, + status: MissionStatus.MISSION_DOING + }] } as GetMissionDataScRsp); } \ No newline at end of file diff --git a/src/server/packets/GetMissionStatusCsReq.ts b/src/server/packets/GetMissionStatusCsReq.ts index 6bf1c29..10d1476 100644 --- a/src/server/packets/GetMissionStatusCsReq.ts +++ b/src/server/packets/GetMissionStatusCsReq.ts @@ -8,22 +8,22 @@ export default async function handle(session: Session, packet: Packet) { const dataObj = { retcode: 0, finishedMainMissionIdList: [ - 1000101, - 1000112, - 1000113, - 1000201, - 1000202, - 1000204, - 1000301, - 1000401, - 1000402, - 1000410, + 1000101, + 1000112, + 1000113, + 1000201, + 1000202, + 1000204, + 1000301, + 1000401, + 1000402, + 1000410, 1000510, 1000601, - 1010301, - 1010302, + 1010301, + 1010302, 1010401, - 1010403, + 1010403, 1010701, 1011403, 1010202, @@ -42,7 +42,7 @@ export default async function handle(session: Session, packet: Packet) { dataObj.missionEventStatusList.push({ id: id, progress: 0, - status: MissionStatus.MISSION_FINISH + status: MissionStatus.MISSION_DOING }); }); @@ -50,7 +50,7 @@ export default async function handle(session: Session, packet: Packet) { dataObj.subMissionStatusList.push({ id: id, progress: 0, - status: MissionStatus.MISSION_FINISH + status: MissionStatus.MISSION_DOING }); }); diff --git a/src/server/packets/PlayerLoginCsReq.ts b/src/server/packets/PlayerLoginCsReq.ts index 50710ef..cb7fca3 100644 --- a/src/server/packets/PlayerLoginCsReq.ts +++ b/src/server/packets/PlayerLoginCsReq.ts @@ -1,4 +1,4 @@ -import { AvatarType, ExtraLineupType, HeroBasicType, PlayerBasicInfo, PlayerLoginCsReq, PlayerLoginScRsp } from "../../data/proto/StarRail"; +import { ExtraLineupType, HeroBasicType, PlayerBasicInfo, PlayerLoginCsReq, PlayerLoginScRsp } from "../../data/proto/StarRail"; import Avatar from "../../db/Avatar"; import Player from "../../db/Player"; import Packet from "../kcp/Packet"; diff --git a/src/util/excel/DailyMissionDataExcel.ts b/src/util/excel/DailyMissionDataExcel.ts new file mode 100644 index 0000000..b551867 --- /dev/null +++ b/src/util/excel/DailyMissionDataExcel.ts @@ -0,0 +1,33 @@ +import DailyMissionDataExcelTable from "../../data/excel/DailyMissionDataExcelTable.json"; +import _DailyMissionRewardExcelTable from "../../data/excel/DailyMissionRewardExcelTable.json"; +const DailyMissionRewardExcelTable: { [key: string]: DailyMissionRewardExcelTableEntry } = _DailyMissionRewardExcelTable; + +interface DailyMissionRewardExcelTableEntry { + WorldLevel: number; + FinishCount: number; + RewardID: number; + ExtraRewardID: number; +} + +export default class DailyMissionDataExcel { + private constructor() { } + + public static fromId(id: number) { + return Object.values(DailyMissionDataExcelTable).find(x => x.ID === id); + } + + public static random(amount: number = 5) { + const ids = Object.keys(DailyMissionDataExcelTable); + const randomIds = []; + for (let i = 0; i < amount; i++) { + const id = ids[Math.floor(Math.random() * ids.length)]; + if (randomIds.indexOf(id) === -1) randomIds.push(id); + } + return randomIds.map(x => DailyMissionDataExcel.fromId(Number(x))); + } + + public static getReward(finished: number, wl: number = 1) { + const key = `${wl}:${finished}`; + return DailyMissionRewardExcelTable[key]; + } +} \ No newline at end of file