diff --git a/src/commands/scene.ts b/src/commands/scene.ts index beaaa8f..cfe29df 100644 --- a/src/commands/scene.ts +++ b/src/commands/scene.ts @@ -22,8 +22,11 @@ export default async function handle(command: Command, session: Session) { if (!planeID) return c.log("Usage: /scene "); - const db = Database.getInstance(); - await db.update('players',{_id:uid},{posData: { floorID: Number(planeID!.StartFloorID), planeID: Number(planeID!.PlaneID)}}) + Interface.target.player.db.posData = { + floorID: Number(planeID!.StartFloorID), + planeID: Number(planeID!.PlaneID), + pos: Interface.target.player.db.posData.pos + }; await Interface.target.player.save() //ty for tamilpp25 scene diff --git a/src/commands/target.ts b/src/commands/target.ts index 09e1e61..ce3e983 100644 --- a/src/commands/target.ts +++ b/src/commands/target.ts @@ -16,7 +16,7 @@ export default async function handle(command: Command) { SRServer.getInstance().sessions.forEach(client => { possibleTargets.push({ id: `${client.ctx.address}:${client.ctx.port}`, - uid: Number(client.player.db._id), + uid: client.player.uid, session: client }); }); diff --git a/src/db/Database.ts b/src/db/Database.ts index 3b8bec8..c5d160e 100644 --- a/src/db/Database.ts +++ b/src/db/Database.ts @@ -64,8 +64,6 @@ export default class Database { } return await _collection.insertOne(payload); } catch (e) { - c.error("In set.") - c.error(payload) c.error(e as Error); } } diff --git a/src/db/Player.ts b/src/db/Player.ts index d23647c..7b054e3 100644 --- a/src/db/Player.ts +++ b/src/db/Player.ts @@ -94,7 +94,7 @@ export default class Player { return { ...lineup, - index: 0, + index: index, avatarList: lineupAvatars } } @@ -172,7 +172,7 @@ export default class Player { for (let i = 0; i < LINEUPS; i++) { const copy = { ...baseLineup, - index: 0, + index: i, name: `Team ${i}` }; dataObj.lineup.lineups[i] = copy; diff --git a/src/server/packets/JoinLineupCsReq.ts b/src/server/packets/JoinLineupCsReq.ts index a8a4184..0c72416 100644 --- a/src/server/packets/JoinLineupCsReq.ts +++ b/src/server/packets/JoinLineupCsReq.ts @@ -36,7 +36,7 @@ export default async function handle(session: Session, packet: Packet) { session.player.setLineup(lineup); */ - session.player.save(); + await session.player.save(); session.send(SyncLineupNotify, { lineup: await session.player.getLineup(),