Compare commits

...

1 Commits

Author SHA1 Message Date
memetrollsXD
f7d827e991
Daily missions testing
Still not working. More research TBD
2022-08-02 21:33:16 +02:00
5 changed files with 108 additions and 19 deletions

View File

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

View File

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

View File

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

View File

@ -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";

View 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];
}
}