fix more factoring issues

This commit is contained in:
memetrollsXD 2022-07-31 18:29:57 +02:00
parent 69b014a718
commit f5d5808ca9
No known key found for this signature in database
GPG Key ID: 105C2F3417AC32CD
26 changed files with 27 additions and 76 deletions

View File

@ -22,7 +22,7 @@ export default class Database {
return Database.instance;
}
public async get(collection: string, query?: {}) {
public async get(collection: string, query?: object) {
try {
const db = await Database.client.db();
const _collection = db.collection(collection);
@ -52,7 +52,7 @@ export default class Database {
}
}
public async delete(collection: string, query: {}) {
public async delete(collection: string, query: object) {
try {
const db = await Database.client.db();
const _collection = db.collection(collection);
@ -66,7 +66,7 @@ export default class Database {
}
}
public async update(collection: string, query: {}, payload: {}) {
public async update(collection: string, query: object, payload: object) {
try {
const db = await Database.client.db();
const _collection = db.collection(collection);

View File

@ -1,10 +1,8 @@
import { GetAllLineupDataCsReq, GetAllLineupDataScRsp } from "../../data/proto/StarRail";
import { 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: []

View File

@ -1,4 +1,4 @@
import { ActivateFarmElementCsReq, GetAvatarDataCsReq, GetAvatarDataScRsp } from "../../data/proto/StarRail";
import { GetAvatarDataCsReq, GetAvatarDataScRsp } from "../../data/proto/StarRail";
import AvatarExcelTable from "../../data/excel/AvatarExcelTable.json";
import Packet from "../kcp/Packet";
import Session from "../kcp/Session";

View File

@ -1,10 +1,8 @@
import { GetBagCsReq, GetBagScRsp } from "../../data/proto/StarRail";
import { 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: [],

View File

@ -1,10 +1,8 @@
import { GetBasicInfoCsReq, GetBasicInfoScRsp } from "../../data/proto/StarRail";
import { 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,

View File

@ -1,10 +1,8 @@
import { GetChallengeCsReq, GetChallengeScRsp } from "../../data/proto/StarRail";
import { 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: []

View File

@ -1,10 +1,8 @@
import { GetChallengeRaidInfoCsReq, GetChallengeRaidInfoScRsp } from "../../data/proto/StarRail";
import { 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: [],

View File

@ -1,10 +1,8 @@
import { AvatarType, BattleEndStatus, GetCurBattleInfoCsReq, GetCurBattleInfoScRsp } from "../../data/proto/StarRail";
import { AvatarType, BattleEndStatus, 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: [{

View File

@ -1,10 +1,8 @@
import { AvatarSlotType, AvatarType, GetCurLineupDataCsReq, GetCurLineupDataScRsp } from "../../data/proto/StarRail";
import { AvatarType, 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: {

View File

@ -1,10 +1,8 @@
import { GetCurSceneInfoCsReq, GetCurSceneInfoScRsp } from "../../data/proto/StarRail";
import { 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: {

View File

@ -1,10 +1,8 @@
import { GetDialogueEventDataCsReq, GetDialogueEventDataScRsp } from "../../data/proto/StarRail";
import { 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

View File

@ -1,10 +1,8 @@
import { GetExpeditionDataCsReq, GetExpeditionDataScRsp } from "../../data/proto/StarRail";
import { 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: [],

View File

@ -1,10 +1,8 @@
import { GetFirstTalkNpcCsReq, GetFirstTalkNpcScRsp } from "../../data/proto/StarRail";
import { 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);

View File

@ -1,10 +1,8 @@
import { Gender, GetHeroBasicTypeInfoCsReq, GetHeroBasicTypeInfoScRsp, HeroBasicType } from "../../data/proto/StarRail";
import { Gender, 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,

View File

@ -1,10 +1,8 @@
import { GetHeroPathCsReq, GetHeroPathScRsp } from "../../data/proto/StarRail";
import { 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: []

View File

@ -1,10 +1,8 @@
import { GetLevelRewardTakenListCsReq, GetLevelRewardTakenListScRsp } from "../../data/proto/StarRail";
import { 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: []

View File

@ -1,10 +1,8 @@
import { GetLoginActivityCsReq, GetLoginActivityScRsp } from "../../data/proto/StarRail";
import { 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: []

View File

@ -1,10 +1,8 @@
import { GetMailCsReq, GetMailScRsp } from "../../data/proto/StarRail";
import { 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: [],

View File

@ -1,10 +1,8 @@
import { GetMazeTimeOfDayCsReq, GetMazeTimeOfDayScRsp } from "../../data/proto/StarRail";
import { 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: {}

View File

@ -1,10 +1,8 @@
import { GetMissionDataCsReq, GetMissionDataScRsp } from "../../data/proto/StarRail";
import { 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: []

View File

@ -1,10 +1,8 @@
import { GetMissionEventDataCsReq, GetMissionEventDataScRsp } from "../../data/proto/StarRail";
import { 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: []

View File

@ -1,10 +1,8 @@
import { GetNpcStatusCsReq, GetNpcStatusScRsp } from "../../data/proto/StarRail";
import { 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: []

View File

@ -1,10 +1,8 @@
import { GetQuestDataCsReq, GetQuestDataScRsp } from "../../data/proto/StarRail";
import { 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,

View File

@ -1,10 +1,8 @@
import { GetRogueInfoCsReq, GetRogueInfoScRsp, RogueStatus } from "../../data/proto/StarRail";
import { GetRogueInfoScRsp, RogueStatus } 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,
rogueInfo: {

View File

@ -1,10 +1,8 @@
import { GetSpringRecoverDataCsReq, GetSpringRecoverDataScRsp } from "../../data/proto/StarRail";
import { 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: {

View File

@ -1,9 +1,6 @@
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
}