Automatic lineup ccreating
This commit is contained in:
parent
67d43bc0a1
commit
d3b6b3c2d7
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user