Compare commits
1 Commits
main
...
daily-miss
Author | SHA1 | Date | |
---|---|---|---|
|
f7d827e991 |
@ -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 { ActorEntity } from "../../game/entities/Actor";
|
||||||
|
import DailyMissionDataExcel from "../../util/excel/DailyMissionDataExcel";
|
||||||
import Packet from "../kcp/Packet";
|
import Packet from "../kcp/Packet";
|
||||||
import Session from "../kcp/Session";
|
import Session from "../kcp/Session";
|
||||||
|
|
||||||
@ -25,4 +26,35 @@ export default async function handle(session: Session, packet: Packet) {
|
|||||||
} as unknown as GetCurSceneInfoScRsp);
|
} as unknown as GetCurSceneInfoScRsp);
|
||||||
session.player.scene.spawnEntity(curAvatarEntity, true);
|
session.player.scene.spawnEntity(curAvatarEntity, true);
|
||||||
session.player.scene.entryId = 10001;
|
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);
|
||||||
}
|
}
|
@ -1,10 +1,34 @@
|
|||||||
import { GetMissionDataScRsp } from "../../data/proto/StarRail";
|
import { GetMissionDataScRsp, MissionStatus } from "../../data/proto/StarRail";
|
||||||
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) {
|
||||||
session.send("GetMissionDataScRsp", {
|
session.send("GetMissionDataScRsp", {
|
||||||
retcode: 0,
|
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);
|
} as GetMissionDataScRsp);
|
||||||
}
|
}
|
@ -42,7 +42,7 @@ export default async function handle(session: Session, packet: Packet) {
|
|||||||
dataObj.missionEventStatusList.push({
|
dataObj.missionEventStatusList.push({
|
||||||
id: id,
|
id: id,
|
||||||
progress: 0,
|
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({
|
dataObj.subMissionStatusList.push({
|
||||||
id: id,
|
id: id,
|
||||||
progress: 0,
|
progress: 0,
|
||||||
status: MissionStatus.MISSION_FINISH
|
status: MissionStatus.MISSION_DOING
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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 Avatar from "../../db/Avatar";
|
||||||
import Player from "../../db/Player";
|
import Player from "../../db/Player";
|
||||||
import Packet from "../kcp/Packet";
|
import Packet from "../kcp/Packet";
|
||||||
|
33
src/util/excel/DailyMissionDataExcel.ts
Normal file
33
src/util/excel/DailyMissionDataExcel.ts
Normal file
@ -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];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user