summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-11 02:20:39 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-11 02:20:39 +0200
commit8766149dc12d197205b1632ec6e9fc663de05990 (patch)
tree56594a56e8602a1146d739bf155fbc6f7a5d385f /src/common
parentdfe18975cf97d31005354cfeaac45cb66388e105 (diff)
downloadmanaserv-8766149dc12d197205b1632ec6e9fc663de05990.tar.gz
manaserv-8766149dc12d197205b1632ec6e9fc663de05990.tar.xz
manaserv-8766149dc12d197205b1632ec6e9fc663de05990.zip
Basically redid equip and unequip functions().
I made the system handle the fact that equipment item are completely unlinked to the inventory items. Equip items now have a unique itemInstance number permitting to equip the same item type multiple time when the slot capacity is wide enough to do so. I also prepared the functions to welcome in the near tests against scripted equipment. The equip process is known to be working server-side but the unequip process has yet to be reviewed, even if implemented.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/inventorydata.h6
-rw-r--r--src/common/manaserv_protocol.h4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/common/inventorydata.h b/src/common/inventorydata.h
index e7c8117..e1c5bfa 100644
--- a/src/common/inventorydata.h
+++ b/src/common/inventorydata.h
@@ -49,6 +49,12 @@ struct EquipmentItem
itemId(0), itemInstance(0)
{}
+ EquipmentItem(unsigned int itemId, unsigned int itemInstance)
+ {
+ this->itemId = itemId;
+ this->itemInstance = itemInstance;
+ }
+
// The item id taken from the item db.
unsigned int itemId;
// A unique instance number used to separate items when equipping the same
diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h
index 786330c..6c51aef 100644
--- a/src/common/manaserv_protocol.h
+++ b/src/common/manaserv_protocol.h
@@ -94,8 +94,8 @@ enum {
PGMSG_UNEQUIP = 0x0113, // W equipment slot
PGMSG_MOVE_ITEM = 0x0114, // W slot1, W slot2, W amount
GPMSG_INVENTORY = 0x0120, // { W slot, W item id [, W amount] (if item id is nonzero) }*
- GPMSG_INVENTORY_FULL = 0x0121, // W inventory slot count { W slot, W itemId, W amount }, { W equip slot, W invy slot}*
- GPMSG_EQUIP = 0x0122, // { W Invy slot, W equip slot type count { W equip slot, W number used} }*
+ GPMSG_INVENTORY_FULL = 0x0121, // W inventory slot count { W slot, W itemId, W amount }, { W equip slot, W item Id, W item Instance}*
+ GPMSG_EQUIP = 0x0122, // W item Id, W equip slot type count { W equip slot, W capacity used}*
GPMSG_PLAYER_ATTRIBUTE_CHANGE = 0x0130, // { W attribute, D base value (in 1/256ths), D modified value (in 1/256ths)}*
GPMSG_PLAYER_EXP_CHANGE = 0x0140, // { W skill, D exp got, D exp needed }*
GPMSG_LEVELUP = 0x0150, // W new level, W character points, W correction points