dominx99
My bad, it is saved properly to the database in data
field.
But I have a problem with login after saving some data.
I registered and logged in, next, I put this code to the player hook:
async onJoinMap(player: RpgPlayer, map: RpgMap) {
player.addItem(Sword);
player.addItem(Shield);
player.save();
},
Next, I rebuild the game and try to log in and I get An error has occurred
.
I think something does not working with loading data back because when I put wrong credentials then I am getting other error
Also without saving data I can login that many times I want
Here is JSON from database if needed to reproduce:
{
"position": {
"x": 706.261,
"y": 378.63,
"z": 0
},
"direction": 3,
"param": {
"maxHp": 700,
"maxSp": 534,
"str": 67,
"int": 36,
"dex": 54,
"agi": 58
},
"hp": 700,
"sp": 534,
"gold": 0,
"level": 1,
"expForNextlevel": 50,
"exp": 0,
"name": "dominik3",
"items": [
{
"nb": 1,
"item": {
"name": "Sword",
"description": "Attack 10",
"price": 2000,
"id": "sword"
}
},
{
"nb": 1,
"item": {
"name": "Shield",
"id": "shield"
}
}
],
"_class": {
"name": "Warrior",
"description": "A warrior is a person specializing in combat or warfare, especially within the context of a tribal or clan-based warrior culture society that recognizes a separate warrior class or caste.",
"id": "warriorclass"
},
"layout": {
"top": {
"lines": [
{
"col": [
{
"id": "text",
"value": {
"text": "{name}",
"style": {
"fill": "#ffffff",
"fontSize": 15
}
}
}
]
}
]
},
"bottom": {},
"left": {},
"right": {},
"center": {
"lines": [
{
"col": [
{
"id": "graphic",
"value": "hero"
}
]
},
{
"col": [
{
"id": "graphic",
"value": "robe"
}
]
},
{
"col": [
{
"id": "graphic",
"value": "fire-bullet"
}
]
}
]
}
},
"map": "map1",
"speed": 3,
"frequency": 0,
"canMove": true,
"through": false,
"throughOtherPlayer": true,
"width": 32,
"height": 32,
"wHitbox": 32,
"hHitbox": 32,
"tmpPositions": null,
"initialLevel": 1,
"finalLevel": 99,
"mongoId": "64c170c2bd9c5c70c9585cdf",
"variables": []
}