summaryrefslogblamecommitdiff
path: root/docs/items.txt
blob: 9b760f0d04f161da7133754509ede168b9ff42f6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11





                               




                 
 




                                           
 


                                                    
 




                                                                            
 
                                
 





























                                                                          
                                      












                                                                         
 
            
 




                                                                                 
 
 
            
 

                                                                             

















































                                                                                
 
             
-------------------------------
THE MANA WORLD INVENTORY SYSTEM
-------------------------------

1. INTRODUCTION
2. DATABASE
3. INVENTORY
4. EQUIPMENT
5. IMPLEMENTATION
6. SPECIAL ITEMS
7. PROTOCOL

An item will have the following properties:
    
C   means info is used only by the client
S   means info is used only by the server
C&S means info is used by both

- id           (C&S) -> unsigned int
  
    a positive integer uniquely identifying an item.

- image        (C)   -> unsigned int
  
    used if same images are used for different items.
    Maybe we need more image ids to tell which image (bigger one) to show in
    equipment window or when equipping items in weapon slot.

- name         (C)   -> char[30]

    to be shown in inventory.

- description  (C)   -> char[100]
  
    a brief description shown in shops, or in the inventory

- type         (S)   -> unsigned char
   
    server uses it to check if is an item or an equipment and send the
    appropriate packet.

    * USABLE_ITEM (food, potions, ...)
    * EQUIPMENT_ITEM (weapons, armors, ...)
    * SLOT_ITEM (cards, materias, summoned beings, ...)
    * SLOTTED_ITEM (bags, small chests, ...)
    
- identify     (S)   -> unsigned char

    the server will check this flag if the items can be identified by the
    player.
    
    * IDENTIFIED         no need to identify the item
    * IDENTIFY_ITEM      you can identify it by using a special item
    * IDENTIFY_MAGIC     you can identify it by using a particular spell
    * BLACKSMITH         needs a blacksmith to be identified
    * WIZARD             needs a wizard to be identified (enchanted items)
    * ANCIENT_BLACKSMITH
    * ANCIENT_WIZARD
    * NOT_IDENTIFIABLE   reserved for future use
    
- weight       (S)   -> unsigned short

    used by server to calculate if the being can carry more items.
    
- # of slots   (C&S) -> unsigned char

    if this field is greater than 0 it means this one is a slotted item.
    (Probably we can remove SLOTTED_ITEM from the type enumeration)
    For example a bag will have 4 slots, while a chest about 10.

- script       (S)   -> probably a file name to reference the script file

    script to be executed when item is used/equipped.
    

3. INVENTORY

Inventory will contain any kind of weapons including non equipped items and
slotted items. Every being will have a variable number of slots to store items.
For example a maggot won't have any slot, while players could have a number of
slots depending on his strength. A pet could have one slot used to add a bag and 
help the player carrying items.


4. EQUIPMENT

Every being will have a variable number of slots to equip items. For a player
we will have 6 slots: head, upper body, lower body, feet, left hand, right
hand. We can also add slots to equip rings, whistlet and elbowpad.


5. IMPLEMENTATION

Since both client and server will only need to store item ids, inventory and
equipment can be easily coded as unsigned int arrays. The only problem is
about slotted items. They for sure can't store another slotted item, but it's
hard to represent them as an int. Probably a more complex structure is needed.

struct ITEM_HOLDER {
    int id;
    int quantity;
    ITEM_HOLDER *item;    
}

ITEM_HOLDER inventory[number_of_slots];
ITEM_HOLDER equipment[number_of_slots];

If item is not NULL it will reference an array of items stored in the slotted
item.

How to limit the quantity of items? We could have a fixed number of slots in the
inventory. In one slot you can store only items with the same id (except slotted
items which need separate slots). When you pick up/receive a new item, total
weigth you can carry is checked if the item can be stored.

6. SPECIAL ITEMS

A special case is represented by arrows holder. Three solutions will apply:
    
    - equipment will have a special slot where you can equip only arrows
     (or stones)
     
    - item with one slot
    
    - arrows can be simply stored in inventory
    
Weapons can store a limited number of items in their slots. In this kind of
slots you can store materia, demons or arrows. Some examples:
    
    * arrows holder = max 100 arrows (1 slot)
    
    * sword = max 1 materia + 1 demon (2 slot)
    
    * magic sword = max 2 materias (1 slot)
    
    * sword of cahos = max 1 materia + 2 demons (2 slot)

7. PROTOCOL

To be defined.