cnelsonsic/SimpleMMO

Character Inventory

Opened this issue · 0 comments

There is currently no way to manage character inventory.

I think there should be some sort of "Inventory Server", that loot-creating processes like ScriptedObjects talk to to create loot subject to a few general rules:

Creating the loot itself, and creating a rule allowing someone to claim it are separate insertion statements.
The creating object should send some info like the item's id, the characters allowed to take it, how many times they can take it, the loot's position, and maximum distance away from its location that players are allowed to take it.

It should work something like this:
At startup, ZoneServer tells InventoryServer to store a piece of loot, the "Grand Blade of Erkinaz" into its loot database. This has all the stats that all copies of "Grand Blade of Erkinaz" have.
The character opens a chest for the first time and the chest determines that they should get a "Grand Blade of Erkinaz". It tells InventoryServer to insert a record pointing at the "Grand Blade of Erkinaz" entry, and that only that character can take it, and that it may only be claimed if the character is within 2m of the chest's current location. As part of the chest's activation method, it returns a message to the client indicating that it inserted awaiting loot rows, and that they can claim them.
The Client is presented with a notification that there are awaiting loot rows, and are presented with a list of items to choose from. Specifically a list with only one item: "Grand Blade of Erkinaz". The client elects to take the item this time, and asks InventoryServer to place the item into the character's inventory.
The InventoryServer checks the restrictions (Character, position, phase of the moon, etc) and agrees with the player. It marks the row as "looted", stores which character it went to, and when, and then updates the character's inventory appropriately.