<pre>

# Item Database Reference
# Last Modified:
#  2004 Michael Wigley


ITEM ATTRIBUTES:

Variables that can be assigned to items in the game to handle special cases and/or
other times when flagging an item would be useful.

    CREATE TABLE $prefix_item_attribs (
      ItemAttribId      int               unsigned NOT NULL auto_increment,
      ItemAttribTarget  mediumint         unsigned NOT NULL default '0',
      ItemAttribDeath   int               unsigned NOT NULL default '0',
      ItemAttribKey     varchar(32)       NOT NULL default '',
      ItemAttribValue   text              default NULL,
      PRIMARY KEY      (ItemAttribId),
      KEY               ItemAttribTarget (ItemAttribTarget),
      KEY               ItemAttribKey    (ItemAttribKey)
    ) TYPE=MyISAM;

ItemAttribId:
Primary index

ItemAttribTarget:
Numeric reference to $prefix_items.ItemId for which item this attribute modifies.

ItmAttribDeath:
Numeric time stamp representing the UNIX time that the attribute should expire.

ItemAttribKey:
Text reference for this attribute

ItemAttribValue:
Text field for storing the attribute value data


###############################################################################

ITEM IMAGES:

Primary Database for storing item images.

    CREATE TABLE $prefix_item_images (
      ItemImageId       mediumint      unsigned NOT NULL auto_increment,
      ItemImageType     tinyint(1)     NOT NULL default '0',
      ItemImageSet      varchar(32)    NOT NULL default '',
      ItemImagePath     varchar(128)   NOT NULL default '',
      PRIMARY KEY      (ItemImageId),
      UNIQUE KEY        TileImagePath (ItemImagePath),
      KEY TileImageSet (ItemImageSet)
    ) TYPE=MyISAMs;

ItemImageId:
Primary index

ItemImageType:
Boolean field representing the type of an item be it a merge image, true (one), or
a icon image, false (zero).  Merge images should be used in sprite creation where
the icon image is the image use by most internal game components.

ItemImageSet:
Text entry that should hold a organizational tag set by the item image editor.  Has
no real game functionality.

ItemImagePath:
Physical path to the tiles image or image template if ItemImagePR and/ or
ItemImageHL is set; file paths are relative to PHPRPG_DIR.'/share/images/items/'


###############################################################################

ITEM EVENTS:

This table holds the default references to $prefix_scripts.ScriptId that will hold
the script data to exec() when the named event is reached.

    CREATE TABLE $prefix_item_event (
      ItemEventId        mediumint unsigned NOT NULL auto_increment,
      ItemEventEquip     int       unsigned NOT NULL default '0',
      ItemEventUnequip   int       unsigned NOT NULL default '0',
      ItemEventPickup    int       unsigned NOT NULL default '0',
      ItemEventDrop      int       unsigned NOT NULL default '0',
      ItemEventCreate    int       unsigned NOT NULL default '0',
      ItemEventDestroy   int       unsigned NOT NULL default '0',
      ItemEventUse       int       unsigned NOT NULL default '0',
      PRIMARY KEY       (ItemEventId)
    ) TYPE=MyISAM;

ItemEventId:
Primary index

ItemEventEquip:
Numeric reference to $prefix_scripts.ScriptId for exec() information when a player
equips this item

ItemEventUnequip:
Numeric reference to $prefix_scripts.ScriptId for exec() information when a player
un-equips this item

ItemEventPickup:
Numeric reference to $prefix_scripts.ScriptId for exec() information when a player
picks this item up from the ground or out of a container

ItemEventDrop:
Numeric reference to $prefix_scripts.ScriptId for exec() information when a player
drops this item on the ground or into a container

ItemEventCreate:
Numeric reference to $prefix_scripts.ScriptId for exec() information when an item
is created by a player or otherwise.

ItemEventDestoy:
Numeric reference to $prefix_scripts.ScriptId for exec() information when an item
is destroy by a player or otherwise.

ItemEventUse:
Numeric reference to $prefix_scripts.ScriptId for exec() information when a player
uses this item.


###############################################################################

ITEM TEMPLATES:

This table holds the base information on any item that could exist in the game
world.  These records to not represent items that exist only serves as an outline
for them.

    CREATE TABLE $prefix_item_info (
      ItemInfoId        mediumint     unsigned NOT NULL auto_increment,
      ItemInfoSize      tinyint       unsigned NOT NULL default '0',
      ItemInfoWeight    mediumint     unsigned NOT NULL default '0',
      ItemInfoValue     mediumint     unsigned NOT NULL default '0',
      ItemInfoStackable tinyint(1)    unsigned NOT NULL default '0',
      ItemInfoEvent     int           unsigned NOT NULL default '0',
      ItemInfoContainer tinyint(1)    unsigned NOT NULL default '0',
      ItemInfoAR        mediumint     unsigned NOT NULL default '0',
      ItemInfoHP        mediumint     unsigned NOT NULL default '0',
      ItemInfoDmgMin    mediumint     unsigned NOT NULL default '0',
      ItemInfoDmgMax    mediumint     unsigned NOT NULL default '0',
      ItemInfoDmgAdj    mediumint     NOT NULL default '0',
      ItemInfoMaxCC     smallint      unsigned NOT NULL default '0',
      ItemInfoMaxSlots  smallint      unsigned NOT NULL default '0',
      ItemInfoEquipLoc  tinyint       unsigned NOT NULL default '0',
      ItemInfoTwoHanded tinyint(1)    unsigned NOT NULL default '0',
      ItemInfoImageIcon mediumint     unsigned NOT NULL default '0',
      ItemInfoImageMerg mediumint     unsigned NOT NULL default '0',
      ItemInfoName      varchar(32)   NOT NULL default '',
      ItemInfoAttribs   text          NOT NULL,
      PRIMARY KEY      (ItemInfoId),
      UNIQUE KEY        ItemInfoName (ItemInfoName)
    ) TYPE=MyISAM;

ItemInfoId:
Primary index

ItemInfoSize:
Numeric value representing the relative sizes of items in the game world;
microscopic = zero, tiny = one, small = two, normal = three, large = four, huge =
five, gigantic = six, colossal = seven.  Should be used by the equipping functions
to limit character size and item size so that small characters aren't generally
able to use gigantic things etc.

ItemInfoWeight:
Numeric value representing the weight of the item If

ItemInfoValue:
Numeric value representing the base value of this item.

ItemInfoEvent:
Numeric reference to $prefix_item_events.ItemEventId

ItemInfoContainer:
Boolean value for whether this item can contain other items; no = false
(zero), yes = true (one)

ItemInfoAR:
Numeric value representing the base ArmorRating of the item

ItemInfoHP:
Numeric value representing the base HitPoints of this item

ItemInfoDmgMin:
Numeric value representing the minimum HitPoints to subtract from the target on a
successful attack with this item

ItemInfoDmgMax:
Numeric value representing the maximum HitPoints to subtract from the target on a
successful attack

ItemInfoDmgAdj:
Number value to add to the total target damage on a successful attack; can be a
negative value.

ItemInfoMaxCC:
Numeric value representing the maximum amount of weight this item can hold acting
as a container (e.g. backpack, box, chest). if this is set to zero the item is
assumed to be incapable of being a container at all.

ItemInfoMaxSlots:
Numeric value representing the number of item slots this particular item has.  Item
slots differ from the concept of a normal container in that the container is
limited by number (not weight) and weight restrictions are generally not applied.
This should be used to facilitate weapon or other item upgrades by way of other
game items (e.g. swords with stones/ jewels as upgrades etc).  If this value is set
to zero the item has no slots.

ItemInfoEquipLoc:
Numeric value representing the location on a character that the item should be
placed when equipping, head = one, neck = two, chest = three, hand = four, finger =
five, belt = six, feet = seven. If it's not equipable the value should be set to
zero

ItemInfoTwoHanded:
Boolean value for whether this item is one or two handed; one handed = false
(zero), two handed = true (one)

ItemInfoIcon:
Numeric reference to $prefix_item_images.ItemImageId with the type of 'Icon'.  Used
as the default image to use when displaying an item to a user.

ItemInfoMerg:
Numeric reference to $prefix_item_images.ItemImageId with the type of 'Icon'.  Used
as the default image to use when merging items to create sprites.

ItemInfoName:
Text name of the item

ItemInfoAttribs:
PHP serialized array storing the default attributes for a given item, the array is
in $KEY=>$VALUE format


###############################################################################

GAME ITEMS:

Records for all real time, in game items

    CREATE TABLE $prefix_items (
      ItemId             int              unsigned NOT NULL auto_increment,
      ItemInfo           mediumint        unsigned NOT NULL default '0',
      ItemMadeBy         mediumint        unsigned NOT NULL default '0',
      ItemQuality        tinyint          unsigned NOT NULL default '0',
      ItemCount          mediumint        unsigned NOT NULL default '0',
      ItemCursed         tinyint(1)       unsigned NOT NULL default '0',
      ItemCurHP          mediumint        unsigned NOT NULL default '0',
      ItemCurAR          mediumint        unsigned NOT NULL default '0',
      ItemCurWeight      mediumint        unsigned NOT NULL default '0',
      ItemCurSlots       smallint         unsigned NOT NULL default '0',
      ItemCurValue       mediumint        unsigned NOT NULL default '0',
      ItemLocType        smallint         unsigned NOT NULL default '0',
      ItemLocId          mediumint        unsigned NOT NULL default '0',
      ItemLocation       int              unsigned NOT NULL default '0',
      ItemImagePF        varchar(64)      NOT NULL default '',
      ItemImageHF        varchar(64)      NOT NULL default '',
      ItemGDImage        varchar(128)     NOT NULL default '',
      PRIMARY KEY       (ItemId)
    ) TYPE=MyISAM;

ItemId:
Primary index

ItemInfo:
Numeric reference to $prefix_item_info.ItemInfoId that holds the base information
for this item

ItemMadeBy:
Numeric reference to (yet to be developed) character table as a method of marking
who crafted a particular item

ItemQuality:
Numeric value representing the items current overall condition; Worthless = zero,
Poor = one, Fair = two, Average = three, Good = four, Excellent = five, Superior =
six, Flawless = seven

ItemCount:
If $prefix_item_info.ItemInfoMaxCount is set to a non negative value this field
represents the actual number of stacked items this particular item record controls.

ItemCursed:
Boolean value representing if an item is cursed or not, this field does not say
what the effects of this state are but only that the item is or is not cursed;
cursed = true (one), not cursed = false (zero)

ItemCurHP:
Numeric value for the current number of HitPoints this item has

ItemCurAR:
Numeric value for the current ArmorRating of this item

ItemCurWeight:
Numeric value for the current weight of this object.  This value may be effected by
damage, slot information or if stack-able items, the number of items this record
represents.

ItemCurSlots:
If $prefix_item_info.ItemInfoMaxSlots is set then the number of children items
already associated to this item.

ItemCurValue:
Numeric value representing the value of this item in the lowest accuracy
denomination

ItemLocType:
Numerical reference representing the object type of the owner of this item;

ItemLocId:
Numeric reference to the id of the type being addresses (if necessary); used mainly
for locating the map where the item resides (i.e. when a map id is needed)

ItemLocation:
Numerical reference to the primary index of the owner given ItemLocType

ItemImagePF:
serialized array of the RGB values for the Primary Fill color (index (255,255,255))
if using GD enhanced item images.  The array should be of the format array("RED"=>
$rVal,"BLUE"=>$bVal,"GREEN"=>$gVal);

ItemImageHF:
serialized array of the RGB values for the Highlight Fill color (index
(128,128,128)) if using GD enhanced item images.  The array should be of the format
array("RED"=>$rVal,"BLUE"=>$bVal,"GREEN"=>$gVal);

ItemGDImage:
If item templates images are used then items will be able to assign different
colors to items (generate by GD) without having to posses an image for every color.
Image templates replace a standard image color [primary fill RGB index
(255,255,255) and highlight fill RGB (128,128,128)] with a specific RGB
replacements as defined in ItemImagePR and ItemImageHL. If both of these values are
not set the image may or may not be a template and thus no GD processing is
preformed.  The GD created images are stored in PHPRPG_DIR.'/tmp/items/'


###############################################################################

</pre>