So, I've been basically doing another side-quest with the code over the past few evenings and Saturday, writing up all the code for the most banal user-interaction that it's boggling how much code went into it - views and stacking items.
As the server needs to be aware, and is the source of truth for all the data in the app, picking up loot (or buying items from a vendor) needs to check if you already have the item, create a new one if you don't, or stack it on top of what you've got if it is stackable. That needs to happen in the app first, then fire off a bit of info to the server, wait till that's processed, get the reply confirmation, then finalize the process in the app with the new ID keys for the items, and the update the views in the app to show what's happened.
While I was doing that, I also wrote up some code and created a user-interface that lets you do stuff with items in your inventory - like combining all items of one type into a single stack, or splitting a stack up into two. Again, such a simple action, but one that requires more server calls, items to be deleted or created with new keys, quantities updated and again, finally all confirmed back in the app and the views updated to show what's happened.
Anyhow, that's all working nicely enough right now, so I guess the next bit to focus on is "using" items such as potions, and the code to support items that have permanent effects (like teaching a spell for example). As I make those amendments to the items tables and editor interfaces, I should also fix up a few gaps that I have to fix on the back-burner for items.
Sometimes it seems never-ending, but with each section, the app starts to feel more and more like a fully fledged game - and that's a pretty stunning feeling.
No comments:
Post a Comment