Basic login sequence
This commit is contained in:
parent
f7bce82c44
commit
9b5ed65d47
2
.gitignore
vendored
2
.gitignore
vendored
@ -106,4 +106,4 @@ dist
|
||||
|
||||
# CrepeSR
|
||||
config.json
|
||||
src/data/proto
|
||||
src/data/*
|
@ -14,6 +14,7 @@ export default async function handle(command: Command) {
|
||||
}
|
||||
|
||||
Config.VERBOSE_LEVEL = level as unknown as VerboseLevel;
|
||||
Logger.VERBOSE_LEVEL = level as unknown as VerboseLevel;
|
||||
c.log(`VerboseLevel set to ${Config.VERBOSE_LEVEL} (${VerboseLevel[level]})`);
|
||||
}
|
||||
}
|
@ -64,6 +64,11 @@ export default class Account {
|
||||
}
|
||||
await db.delete("accounts", { _id: Number(uid) });
|
||||
}
|
||||
|
||||
public async save() {
|
||||
const db = Database.getInstance();
|
||||
await db.update("accounts", { _id: Number(this.uid) }, this);
|
||||
}
|
||||
}
|
||||
|
||||
function generateToken(): string {
|
||||
|
@ -65,4 +65,18 @@ export default class Database {
|
||||
c.error(e as Error);
|
||||
}
|
||||
}
|
||||
|
||||
public async update(collection: string, query: {}, payload: {}) {
|
||||
try {
|
||||
const db = await Database.client.db();
|
||||
const _collection = db.collection(collection);
|
||||
if (!(await db.listCollections({ name: collection }).toArray()).length) {
|
||||
c.warn(`Collection ${collection} does not exist. Creating...`);
|
||||
await _collection.createIndexes([{ key: { id: 1 }, unique: true }]);
|
||||
}
|
||||
return await _collection.updateOne(query, { $set: payload }, { upsert: true });
|
||||
} catch (e) {
|
||||
c.error(e as Error);
|
||||
}
|
||||
}
|
||||
}
|
@ -63,6 +63,6 @@ export default class Player {
|
||||
|
||||
public async save() {
|
||||
const db = Database.getInstance();
|
||||
await db.set("players", this.db);
|
||||
await db.update("players", { _id: this.db._id } , this.db);
|
||||
}
|
||||
}
|
12
src/server/packets/GetAllLineupDataCsReq.ts
Normal file
12
src/server/packets/GetAllLineupDataCsReq.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { GetAllLineupDataCsReq, GetAllLineupDataScRsp } 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 GetAllLineupDataCsReq;
|
||||
|
||||
session.send("GetAllLineupDataScRsp", {
|
||||
retcode: 0,
|
||||
lineupList: []
|
||||
} as unknown as GetAllLineupDataScRsp);
|
||||
}
|
31
src/server/packets/GetAvatarDataCsReq.ts
Normal file
31
src/server/packets/GetAvatarDataCsReq.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { ActivateFarmElementCsReq, GetAvatarDataCsReq, GetAvatarDataScRsp } from "../../data/proto/StarRail";
|
||||
import AvatarExcelTable from "../../data/excel/AvatarExcelTable.json";
|
||||
import Packet from "../kcp/Packet";
|
||||
import Session from "../kcp/Session";
|
||||
|
||||
export default async function handle(session: Session, packet: Packet) {
|
||||
const body = packet.body as GetAvatarDataCsReq;
|
||||
|
||||
const dataObj = {
|
||||
retcode: 0,
|
||||
avatarList: [{
|
||||
|
||||
}],
|
||||
isAll: false
|
||||
} as GetAvatarDataScRsp;
|
||||
|
||||
Object.values(AvatarExcelTable).forEach(avatar => {
|
||||
dataObj.avatarList.push({
|
||||
baseAvatarId: avatar.AvatarID,
|
||||
equipmentUniqueId: 13501,
|
||||
equipRelicList: [],
|
||||
exp: 0,
|
||||
level: 1,
|
||||
promotion: 1,
|
||||
rank: 100101,
|
||||
skilltreeList: avatar.SkillList.map(skill => ({level: 1, pointId: skill})),
|
||||
})
|
||||
});
|
||||
|
||||
session.send("GetAvatarDataScRsp", dataObj);
|
||||
}
|
16
src/server/packets/GetBagCsReq.ts
Normal file
16
src/server/packets/GetBagCsReq.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { GetBagCsReq, GetBagScRsp } 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 GetBagCsReq;
|
||||
|
||||
session.send("GetBagScRsp", {
|
||||
equipmentList: [],
|
||||
materialList: [],
|
||||
relicList: [],
|
||||
retcode: 0,
|
||||
rogueItemList: [],
|
||||
waitDelResourceList: []
|
||||
} as GetBagScRsp);
|
||||
}
|
15
src/server/packets/GetBasicInfoCsReq.ts
Normal file
15
src/server/packets/GetBasicInfoCsReq.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { GetBasicInfoCsReq, GetBasicInfoScRsp } 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 GetBasicInfoCsReq;
|
||||
|
||||
session.send("GetBasicInfoScRsp", {
|
||||
curDay: 1,
|
||||
exchangeTimes: 0,
|
||||
retcode: 0,
|
||||
nextRecoverTime: Math.round(new Date().getTime() / 1000) + 100000,
|
||||
weekCocoonFinishedCount: 0
|
||||
} as GetBasicInfoScRsp)
|
||||
}
|
12
src/server/packets/GetChallengeCsReq.ts
Normal file
12
src/server/packets/GetChallengeCsReq.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { GetChallengeCsReq, GetChallengeScRsp } 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 GetChallengeCsReq;
|
||||
|
||||
session.send("GetChallengeScRsp", {
|
||||
retcode: 0,
|
||||
challengeList: []
|
||||
} as GetChallengeScRsp);
|
||||
}
|
13
src/server/packets/GetChallengeRaidInfoCsReq.ts
Normal file
13
src/server/packets/GetChallengeRaidInfoCsReq.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { GetChallengeRaidInfoCsReq, GetChallengeRaidInfoScRsp } 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 GetChallengeRaidInfoCsReq;
|
||||
|
||||
session.send("GetChallengeRaidInfoScRsp", {
|
||||
retcode: 0,
|
||||
challengeRaidList: [],
|
||||
takenRewardIdList: []
|
||||
} as GetChallengeRaidInfoScRsp);
|
||||
}
|
26
src/server/packets/GetCurBattleInfoCsReq.ts
Normal file
26
src/server/packets/GetCurBattleInfoCsReq.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { AvatarType, GetCurBattleInfoCsReq, GetCurBattleInfoScRsp } 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 GetCurBattleInfoCsReq;
|
||||
|
||||
session.send("GetCurBattleInfoScRsp", {
|
||||
retcode: 0,
|
||||
avatarList: [{
|
||||
avatarType: AvatarType.AVATAR_TRIAL_TYPE,
|
||||
hp: 1000,
|
||||
id: 1001,
|
||||
index: 1,
|
||||
sp: 100,
|
||||
level: 1,
|
||||
promotion: 1,
|
||||
rank: 100101,
|
||||
equipmentList: [],
|
||||
relicList: [],
|
||||
skilltreeList: [100101]
|
||||
}],
|
||||
stageId: 10000,
|
||||
logicRandomSeed: 2503
|
||||
} as unknown as GetCurBattleInfoScRsp);
|
||||
}
|
20
src/server/packets/GetCurLineupDataCsReq.ts
Normal file
20
src/server/packets/GetCurLineupDataCsReq.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { GetCurLineupDataCsReq, GetCurLineupDataScRsp } 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 GetCurLineupDataCsReq;
|
||||
|
||||
session.send("GetCurLineupDataScRsp", {
|
||||
retcode: 0,
|
||||
lineup: {
|
||||
avatarList: [1001, 1002],
|
||||
index: 1,
|
||||
isVirtual: false,
|
||||
mp: 100,
|
||||
name: "lineuprspname",
|
||||
planeId: 10000,
|
||||
leaderSlot: 1,
|
||||
}
|
||||
} as unknown as GetCurLineupDataScRsp);
|
||||
}
|
21
src/server/packets/GetCurSceneInfoCsReq.ts
Normal file
21
src/server/packets/GetCurSceneInfoCsReq.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { GetCurSceneInfoCsReq, GetCurSceneInfoScRsp } 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 GetCurSceneInfoCsReq;
|
||||
|
||||
session.send("GetCurSceneInfoScRsp", {
|
||||
retcode: 0,
|
||||
scene: {
|
||||
planeId: 10000,
|
||||
floorId: 10000000,
|
||||
entityList: [],
|
||||
entityBuffList: [],
|
||||
entryId: 10001,
|
||||
envBuffList: [],
|
||||
gameModeType: 1,
|
||||
lightenSectionList: []
|
||||
},
|
||||
} as unknown as GetCurSceneInfoScRsp);
|
||||
}
|
12
src/server/packets/GetDialogueEventDataCsReq.ts
Normal file
12
src/server/packets/GetDialogueEventDataCsReq.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { GetDialogueEventDataCsReq, GetDialogueEventDataScRsp } 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 GetDialogueEventDataCsReq;
|
||||
|
||||
session.send("GetDialogueEventDataScRsp", {
|
||||
dialogueEventList: [],
|
||||
retcode: 0
|
||||
} as GetDialogueEventDataScRsp);
|
||||
}
|
14
src/server/packets/GetExpeditionDataCsReq.ts
Normal file
14
src/server/packets/GetExpeditionDataCsReq.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { GetExpeditionDataCsReq, GetExpeditionDataScRsp } 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 GetExpeditionDataCsReq;
|
||||
|
||||
session.send("GetExpeditionDataScRsp", {
|
||||
retcode: 0,
|
||||
expedtionList: [],
|
||||
unlockedExpeditionIdList: [],
|
||||
teamCount: 4
|
||||
} as GetExpeditionDataScRsp);
|
||||
}
|
11
src/server/packets/GetFirstTalkNpcCsReq.ts
Normal file
11
src/server/packets/GetFirstTalkNpcCsReq.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { GetFirstTalkNpcCsReq, GetFirstTalkNpcScRsp } 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 GetFirstTalkNpcCsReq;
|
||||
|
||||
session.send("GetFirstTalkNpcScRsp", {
|
||||
retcode: 0,
|
||||
} as GetFirstTalkNpcScRsp);
|
||||
}
|
28
src/server/packets/GetHeroBasicTypeInfoCsReq.ts
Normal file
28
src/server/packets/GetHeroBasicTypeInfoCsReq.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import { Gender, GetHeroBasicTypeInfoCsReq, GetHeroBasicTypeInfoScRsp, HeroBasicType } 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 GetHeroBasicTypeInfoCsReq;
|
||||
|
||||
session.send("GetHeroBasicTypeInfoScRsp", {
|
||||
retcode: 0,
|
||||
gender: Gender.GenderMan,
|
||||
basicTypeInfoList: [{
|
||||
basicType: HeroBasicType.BoyMage,
|
||||
rank: 1,
|
||||
skillTreeList: [{
|
||||
level: 1,
|
||||
pointId: 1
|
||||
}]
|
||||
}],
|
||||
curBasicType: HeroBasicType.BoyMage,
|
||||
heroPathList: [{
|
||||
exp: 0,
|
||||
level: 1,
|
||||
heroPathType: 1
|
||||
}],
|
||||
isPlayerInfoModified: false,
|
||||
isGenderModified: false
|
||||
} as GetHeroBasicTypeInfoScRsp);
|
||||
}
|
16
src/server/packets/GetHeroPathCsReq.ts
Normal file
16
src/server/packets/GetHeroPathCsReq.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { GetHeroPathCsReq, GetHeroPathScRsp } 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 GetHeroPathCsReq;
|
||||
|
||||
session.send("GetHeroPathScRsp", {
|
||||
retcode: 0,
|
||||
heroPathList: [{
|
||||
exp: 0,
|
||||
level: 1,
|
||||
heroPathType: 1
|
||||
}]
|
||||
} as GetHeroPathScRsp);
|
||||
}
|
12
src/server/packets/GetLevelRewardTakenListCsReq.ts
Normal file
12
src/server/packets/GetLevelRewardTakenListCsReq.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { GetLevelRewardTakenListCsReq, GetLevelRewardTakenListScRsp } 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 GetLevelRewardTakenListCsReq;
|
||||
|
||||
session.send("GetLevelRewardTakenListScRsp", {
|
||||
retcode: 0,
|
||||
takenLevelList: []
|
||||
} as GetLevelRewardTakenListScRsp);
|
||||
}
|
16
src/server/packets/GetLoginActivityCsReq.ts
Normal file
16
src/server/packets/GetLoginActivityCsReq.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { GetLoginActivityCsReq, GetLoginActivityScRsp } 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 GetLoginActivityCsReq;
|
||||
|
||||
session.send("GetLoginActivityScRsp", {
|
||||
retcode: 0,
|
||||
loginActivityList: [{
|
||||
hasTakenLoginActivityRewardDaysList: [],
|
||||
id: 1000,
|
||||
loginDays: 1,
|
||||
}]
|
||||
} as GetLoginActivityScRsp);
|
||||
}
|
16
src/server/packets/GetMailCsReq.ts
Normal file
16
src/server/packets/GetMailCsReq.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { GetMailCsReq, GetMailScRsp } 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 GetMailCsReq;
|
||||
|
||||
session.send("GetMailScRsp", {
|
||||
retcode: 0,
|
||||
mailList: [],
|
||||
noticeMailList: [],
|
||||
start: 0,
|
||||
totalNum: 0,
|
||||
isEnd: false
|
||||
} as GetMailScRsp);
|
||||
}
|
12
src/server/packets/GetMazeTimeOfDayCsReq.ts
Normal file
12
src/server/packets/GetMazeTimeOfDayCsReq.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { GetMazeTimeOfDayCsReq, GetMazeTimeOfDayScRsp } 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 GetMazeTimeOfDayCsReq;
|
||||
|
||||
session.send("GetMazeTimeOfDayScRsp", {
|
||||
retcode: 0,
|
||||
mazeTimeOfDayMap: {}
|
||||
} as GetMazeTimeOfDayScRsp);
|
||||
}
|
12
src/server/packets/GetMissionDataCsReq.ts
Normal file
12
src/server/packets/GetMissionDataCsReq.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { GetMissionDataCsReq, GetMissionDataScRsp } 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 GetMissionDataCsReq;
|
||||
|
||||
session.send("GetMissionDataScRsp", {
|
||||
retcode: 0,
|
||||
missionList: []
|
||||
} as unknown as GetMissionDataScRsp);
|
||||
}
|
12
src/server/packets/GetMissionEventDataCsReq.ts
Normal file
12
src/server/packets/GetMissionEventDataCsReq.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { GetMissionEventDataCsReq, GetMissionEventDataScRsp } 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 GetMissionEventDataCsReq;
|
||||
|
||||
session.send("GetMissionEventDataScRsp", {
|
||||
retcode: 0,
|
||||
missionEventList: []
|
||||
} as unknown as GetMissionEventDataScRsp);
|
||||
}
|
15
src/server/packets/GetMissionStatusCsReq.ts
Normal file
15
src/server/packets/GetMissionStatusCsReq.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { GetMissionStatusCsReq, GetMissionStatusScRsp } 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 GetMissionStatusCsReq;
|
||||
|
||||
session.send("GetMissionStatusScRsp", {
|
||||
retcode: 0,
|
||||
finishedMainMissionIdList: [],
|
||||
missionEventStatusList: [],
|
||||
subMissionStatusList: [],
|
||||
unfinishedMainMissionIdList: []
|
||||
} as GetMissionStatusScRsp);
|
||||
}
|
12
src/server/packets/GetNpcStatusCsReq.ts
Normal file
12
src/server/packets/GetNpcStatusCsReq.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { GetNpcStatusCsReq, GetNpcStatusScRsp } 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 GetNpcStatusCsReq;
|
||||
|
||||
session.send("GetNpcStatusScRsp", {
|
||||
retcode: 0,
|
||||
messageStatusList: []
|
||||
} as GetNpcStatusScRsp);
|
||||
}
|
14
src/server/packets/GetQuestDataCsReq.ts
Normal file
14
src/server/packets/GetQuestDataCsReq.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { GetQuestDataCsReq, GetQuestDataScRsp } 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 GetQuestDataCsReq;
|
||||
|
||||
session.send("GetQuestDataScRsp", {
|
||||
questList: [],
|
||||
retcode: 0,
|
||||
takenAchievementLevelList: [],
|
||||
totalAchievementExp: 1,
|
||||
} as GetQuestDataScRsp);
|
||||
}
|
12
src/server/packets/GetRogueInfoCsReq.ts
Normal file
12
src/server/packets/GetRogueInfoCsReq.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { GetRogueInfoCsReq, GetRogueInfoScRsp } 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 GetRogueInfoCsReq;
|
||||
|
||||
session.send("GetRogueInfoScRsp", {
|
||||
retcode: 0,
|
||||
|
||||
} as GetRogueInfoScRsp);
|
||||
}
|
20
src/server/packets/GetSpringRecoverDataCsReq.ts
Normal file
20
src/server/packets/GetSpringRecoverDataCsReq.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { GetSpringRecoverDataCsReq, GetSpringRecoverDataScRsp } 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 GetSpringRecoverDataCsReq;
|
||||
|
||||
session.send("GetSpringRecoverDataScRsp", {
|
||||
retcode: 0,
|
||||
healPoolInfo: {
|
||||
healPool: 0,
|
||||
refreshTime: 600,
|
||||
},
|
||||
springRecoverConfig: {
|
||||
autoRecoverHp: true,
|
||||
defaultHp: 100,
|
||||
avatarPresetHpList: []
|
||||
}
|
||||
} as GetSpringRecoverDataScRsp);
|
||||
}
|
9
src/server/packets/PlayerKeepAliveNotify.ts
Normal file
9
src/server/packets/PlayerKeepAliveNotify.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { PlayerKeepAliveNotify } 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 PlayerKeepAliveNotify;
|
||||
|
||||
// We actually don't need to handle this
|
||||
}
|
13
src/server/packets/SyncTimeCsReq.ts
Normal file
13
src/server/packets/SyncTimeCsReq.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { SyncTimeCsReq, SyncTimeScRsp } 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 SyncTimeCsReq;
|
||||
|
||||
session.send("SyncTimeScRsp", {
|
||||
retcode: 0,
|
||||
clientTimeMs: body.clientTimeMs,
|
||||
serverTimeMs: Math.round(new Date().getTime() / 1000).toString()
|
||||
} as unknown as SyncTimeScRsp);
|
||||
}
|
Loading…
Reference in New Issue
Block a user