Automatic lineup ccreating

This commit is contained in:
memetrollsXD 2022-08-02 16:35:06 +02:00
parent 67d43bc0a1
commit d3b6b3c2d7
No known key found for this signature in database
GPG Key ID: 105C2F3417AC32CD
2 changed files with 41 additions and 24 deletions

View File

@ -115,18 +115,7 @@ export default class Player {
},
lineup: {
curIndex: 0,
lineups: {
0: {
avatarList: [1001],
extraLineupType: ExtraLineupType.LINEUP_NONE,
index: 0,
isVirtual: false,
leaderSlot: 0,
mp: 100, // ?? Not sure what this is
name: "Default Lineup",
planeId: 10001
}
}
lineups: {}
},
posData: {
floorID: 10001001,
@ -135,6 +124,28 @@ export default class Player {
banned: false
} as PlayerI
const baseLineup = {
avatarList: [1001],
extraLineupType: ExtraLineupType.LINEUP_NONE,
index: 0,
isVirtual: false,
leaderSlot: 0,
mp: 100, // ?? Not sure what this is
name: "",
planeId: 10001
}
const LINEUPS = 4;
let slot = 0;
dataObj.lineup = {
curIndex: 0,
lineups: {}
}
for (let i = 0; i <= LINEUPS; i++) {
let copy = baseLineup;
copy.index = slot++;
dataObj.lineup.lineups[i] = copy;
}
await db.set("players", dataObj);
return new Player(dataObj);
}

View File

@ -46,20 +46,26 @@ export default async function handle(session: Session, packet: Packet) {
if (!plr.db.lineup) {
Avatar.create(plr.db._id);
plr.db.lineup = {
curIndex: 0,
lineups: {
0: {
const baseLineup = {
avatarList: [1001],
extraLineupType: ExtraLineupType.LINEUP_NONE,
index: 0,
isVirtual: false,
leaderSlot: 0,
mp: 100, // ?? Not sure what this is
name: "Default Lineup",
name: "",
planeId: 10001
}
const LINEUPS = 4;
let slot = 0;
plr.db.lineup = {
curIndex: 0,
lineups: {}
}
for (let i = 0; i <= LINEUPS; i++) {
let copy = baseLineup;
copy.index = slot++;
plr.db.lineup.lineups[i] = copy;
}
plr.save();
}