Is it possible to extend information send to GUI about items that the player has?
Currently, it is:
this.obsCurrentPlayer = this.rpgCurrentPlayer
.subscribe((obj) => {
if (!obj || !obj.object) return;
this.items = obj.object.items;
})
consumable: null
description: "Gives 10 atk"
id: "sword-id"
name: "Sword"
price: 2000
I would like to build GUI with graphics of items.
I extended the decorator on the backend to set graphic on an item, described here: https://community.rpgjs.dev/d/142-mobs-dropping-items
And now I would like to display inventory with graphics of those items.
Is it possible to include a graphic name in the data returned to the client?
Later I would need more info than graphics.
At first, I wanted to set graphics based on id
, but I want to have unique items, for example with custom bonuses, so I will generate uuid
here.
I see that I can pass data through gui.open({ items: mapItems(player.items) })
and then on client side take it from props:
props: ['items'],
but if my player will pick up something this won't be updated to this variable.
Is it possible to implement a custom inject
by myself?