mirror of
https://github.com/laochan-eacnet/backend.git
synced 2026-09-29 10:18:00 +03:00
fix p2d breaks due to fromKBinXml nolonger calls toObject
This commit is contained in:
+2
-2
@@ -2,7 +2,7 @@ import { Logger } from "@cordisjs/logger";
|
||||
import { MongoClient } from "mongodb";
|
||||
import config from "./utils/config.js";
|
||||
import { PlayerPlayData } from "./types/p2d/index.js";
|
||||
import { fromKBinXml } from "./utils/kbinxml.js";
|
||||
import { fromKBinXml, toObject } from "./utils/kbinxml.js";
|
||||
import { Pdata } from "./types/p2d/pdata.js";
|
||||
|
||||
interface DatabaseMeta {
|
||||
@@ -27,7 +27,7 @@ export async function initMongoDb() {
|
||||
const cursor = playDataCol.find({});
|
||||
const tasks = [];
|
||||
for await (const player of cursor) {
|
||||
const { pdata } = fromKBinXml(player.pdata.buffer) as { pdata: Pdata };
|
||||
const { pdata } = toObject(fromKBinXml(player.pdata.buffer)) as { pdata: Pdata };
|
||||
|
||||
tasks.push(playDataCol.updateOne({ _id: player._id }, {
|
||||
$set: {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Binary, Db } from "mongodb";
|
||||
import { inject, injectable } from "tsyringe";
|
||||
import { PlayerPlayData, PlayerMusicData, PlayerPlayLog, PlayerCourseLog, PlayerCustomizeSetting, PlayerRivalData } from "../../types/p2d/index.js";
|
||||
import { Pdata } from "../../types/p2d/pdata.js";
|
||||
import { fromKBinXml } from "../../utils/kbinxml.js";
|
||||
import { fromKBinXml, toObject } from "../../utils/kbinxml.js";
|
||||
|
||||
@injectable()
|
||||
export class UserService {
|
||||
@@ -153,11 +153,11 @@ export class UserService {
|
||||
const binary = await this.getPDataBinary(player);
|
||||
if (!binary) return undefined;
|
||||
|
||||
return fromKBinXml(binary.pdata).pdata;
|
||||
return toObject(fromKBinXml(binary.pdata)).pdata;
|
||||
}
|
||||
|
||||
upsertPDataBinary(player: string, pdata: Buffer, check_sum: string) {
|
||||
const unpacked = fromKBinXml(pdata) as { pdata: Pdata };
|
||||
const unpacked = toObject(fromKBinXml(pdata)) as { pdata: Pdata };
|
||||
const { djname, infinitas_id } = unpacked.pdata.player;
|
||||
|
||||
return this.playDataCol
|
||||
|
||||
Reference in New Issue
Block a user