Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

World Items object adds unnecessary information to items #83

Open
djasnowski opened this issue May 24, 2019 · 4 comments
Open

World Items object adds unnecessary information to items #83

djasnowski opened this issue May 24, 2019 · 4 comments
Labels
backend Node.js-related or anything to do in the server bug "Hey, that's not suppose to happen." easy Issue/feature that is easy to fix or implement. Good for 1st-time contributors. Hacktoberfest help wanted Issues that we need multiple opinions on. low priority Nice-to-have issues and features. map Issues or features relating to the game map (canvas or code). player Features/issues relating to the player of Delaford.
Milestone

Comments

@djasnowski
Copy link
Member

What is the current behavior?

The world.items object on the server (can be accessed via http://localhost:4000/world/items populates the items on the map. When viewed, some items have extraneous information like so:

[
  {
    "id": "bronze-pickaxe",
    "respawnIn": "8s",
    "x": 20,
    "y": 112,
    "uuid": "26a4ead5-4fd1-49bd-b2bc-6db2d792f613",
    "respawn": true,
    "pickedUp": false,
    "timestamp": 1558666693612
  },
  {
    "id": "bronze-shield",
    "respawnIn": "1m 30s",
    "x": 18,
    "y": 113,
    "uuid": "fa4990da-859a-46b3-b2e2-93aa5517933d",
    "respawn": true,
    "pickedUp": false,
    "timestamp": 1558666693612,
    "context": "item",
    "name": "Bronze Shield",
    "examine": "Reliable shield for all-around combat made of Bronze.",
    "price": 41,
    "type": "armor",
    "slot": "left_hand",
    "stats": {
      "attack": {
        "stab": 0,
        "slash": 0,
        "crush": 0,
        "range": 0
      },
      "defense": {
        "stab": 3,
        "slash": 5,
        "crush": 10,
        "range": 6
      }
    },
    "graphics": {
      "tileset": "armor",
      "row": 6,
      "column": 0
    },
    "actions": [
      "take",
      "examine",
      "drop",
      "equip",
      "unequip",
      "deposit",
      "withdraw",
      "buy",
      "sell",
      "value"
    ]
  }
]

If the current behavior is a bug, please provide the exact steps to reproduce.

Drop items. Observe world.items value. (itemsDropped)

What is the expected behavior?

To only contain needed information.

Additional context
Add any other context about the problem here.

@djasnowski djasnowski added backend Node.js-related or anything to do in the server bug "Hey, that's not suppose to happen." help wanted Issues that we need multiple opinions on. low priority Nice-to-have issues and features. map Issues or features relating to the game map (canvas or code). player Features/issues relating to the player of Delaford. labels May 24, 2019
@djasnowski djasnowski added this to the v0.1.0 milestone May 24, 2019
@djasnowski djasnowski pinned this issue Jun 7, 2019
@djasnowski djasnowski added Hacktoberfest easy Issue/feature that is easy to fix or implement. Good for 1st-time contributors. labels Sep 26, 2019
@Jaace
Copy link

Jaace commented Oct 2, 2019

I can maybe also take a look at this one - seems easier barrier to entry since this codebase is completely new to me :)

@Jaace
Copy link

Jaace commented Oct 3, 2019

Looking at this locally I'm not fully understanding the issue that needs to be fixed? I dropped the Bronze Chainmail and I now see:

[
{
"id": "bronze-pickaxe",
"respawnIn": "8s",
"x": 20,
"y": 112,
"uuid": "2cdca132-91b8-454a-89f3-9238648597de",
"respawn": true,
"pickedUp": false,
"timestamp": 1570063100815
},
{
"id": "bronze-shield",
"respawnIn": "1m 30s",
"x": 18,
"y": 113,
"uuid": "8e4f035d-af79-4023-a8c3-bf87adfc4b5b",
"respawn": true,
"pickedUp": false,
"timestamp": 1570063100815
},
{
"id": "bronze-chainmail",
"uuid": "q51f8283-9ca7-4aa4-b984-d0192a2164fc",
"qty": null,
"x": 24,
"y": 109,
"timestamp": 1570064622710
}
]

What information is missing or incorrect?

@djasnowski
Copy link
Member Author

@Jaace I would keep messing with it. Drop items that you bought. Or equip/unequip and drop. I'm sure it's bound to happen.

@djasnowski
Copy link
Member Author

I think the reason this is happening is because we are passing, at some point, a reference by value, which then links to existing points (of when it's dropped) then equipped or vice-versa.

We would need to attach to the dropped list using a spread operator or such.

@djasnowski djasnowski unpinned this issue Dec 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Node.js-related or anything to do in the server bug "Hey, that's not suppose to happen." easy Issue/feature that is easy to fix or implement. Good for 1st-time contributors. Hacktoberfest help wanted Issues that we need multiple opinions on. low priority Nice-to-have issues and features. map Issues or features relating to the game map (canvas or code). player Features/issues relating to the player of Delaford.
Projects
None yet
Development

No branches or pull requests

2 participants