Inventory system improvements,

stats
This commit is contained in:
2023-09-18 12:33:06 +02:00
parent 870aa12161
commit 0beec15332
14 changed files with 203 additions and 81 deletions

View File

@@ -1,5 +1,4 @@
import { game } from "../game";
import { userData } from "../Classes/userData";
import { playerData } from "../Classes/playerData";
const fs = require('fs');
@@ -34,13 +33,14 @@ export class players{
files.forEach(file => {
fs.readFile(`Database/Players/${file}`, (err, data) => {
if (err) throw err;
let player : playerData = JSON.parse(data);
let player : playerData = new playerData(JSON.parse(data));
game.playersDB.push(player);
player.inventory.items.forEach(i=>{
if(i.id > game.itemCount){
game.itemCount = i.id
}
})
player.validateEquipment()
console.log(`Loaded pl ${player.id}`);
});
});