Fix lineup index. (#38)

This commit is contained in:
GanyusLeftHorn 2022-08-04 05:37:57 +02:00 committed by GitHub
parent 4738e7c44a
commit 77d6b6dcee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 8 deletions

View File

@ -22,8 +22,11 @@ export default async function handle(command: Command, session: Session) {
if (!planeID) return c.log("Usage: /scene <planeID>"); if (!planeID) return c.log("Usage: /scene <planeID>");
const db = Database.getInstance(); Interface.target.player.db.posData = {
await db.update('players',{_id:uid},{posData: { floorID: Number(planeID!.StartFloorID), planeID: Number(planeID!.PlaneID)}}) floorID: Number(planeID!.StartFloorID),
planeID: Number(planeID!.PlaneID),
pos: Interface.target.player.db.posData.pos
};
await Interface.target.player.save() await Interface.target.player.save()
//ty for tamilpp25 scene //ty for tamilpp25 scene

View File

@ -16,7 +16,7 @@ export default async function handle(command: Command) {
SRServer.getInstance().sessions.forEach(client => { SRServer.getInstance().sessions.forEach(client => {
possibleTargets.push({ possibleTargets.push({
id: `${client.ctx.address}:${client.ctx.port}`, id: `${client.ctx.address}:${client.ctx.port}`,
uid: Number(client.player.db._id), uid: client.player.uid,
session: client session: client
}); });
}); });

View File

@ -64,8 +64,6 @@ export default class Database {
} }
return await _collection.insertOne(payload); return await _collection.insertOne(payload);
} catch (e) { } catch (e) {
c.error("In set.")
c.error(payload)
c.error(e as Error); c.error(e as Error);
} }
} }

View File

@ -94,7 +94,7 @@ export default class Player {
return { return {
...lineup, ...lineup,
index: 0, index: index,
avatarList: lineupAvatars avatarList: lineupAvatars
} }
} }
@ -172,7 +172,7 @@ export default class Player {
for (let i = 0; i < LINEUPS; i++) { for (let i = 0; i < LINEUPS; i++) {
const copy = { const copy = {
...baseLineup, ...baseLineup,
index: 0, index: i,
name: `Team ${i}` name: `Team ${i}`
}; };
dataObj.lineup.lineups[i] = copy; dataObj.lineup.lineups[i] = copy;

View File

@ -36,7 +36,7 @@ export default async function handle(session: Session, packet: Packet) {
session.player.setLineup(lineup); session.player.setLineup(lineup);
*/ */
session.player.save(); await session.player.save();
session.send(SyncLineupNotify, { session.send(SyncLineupNotify, {
lineup: await session.player.getLineup(), lineup: await session.player.getLineup(),