Monday, March 21, 2016

Documentation - Inventory System

This entry is to document one of the basic systems that are in place so that the information exists in more than just a notebook.

Inventory

player.js

Objects

invSlot

item

Variables:

  • name
  • desc
  • img

Methods:

  • getItem: (display the item information in a new action window)
  • setItem: (sets the variables of the item object)
  • delItem: (empties the variables of the item object)

Variables:

  • slot
  • qty

Methods:

  • getSlot: (display the slot information on the screen)
  • setSlot: (sets the variables of the slot object including the item variables)

Process

initialization.js -> Create x number of inventory objects
-> Fill slots from API: /character/inventory
ui.js:InventoryClick -> Create a new action window and load inventory.html
-> Loop through all inventory objects and initiate getSlot()

Data Structure

a
characters
P K id
U name
K user_id
K city_id
id--->character_id
b
inventory
P K id
K character_id
K item_id
item_count
slot
item_id<---id
c
item
P K id
U name
description
stackable
icon

API: GET /Character/Inventory

Returns the following structure:

c.name c.description c.icon b.item_count b.slot
item_name item_desc item_icon item_count inv_slot

No comments:

Post a Comment