From 8766149dc12d197205b1632ec6e9fc663de05990 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Thu, 11 Aug 2011 02:20:39 +0200 Subject: 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. --- src/common/inventorydata.h | 6 ++++++ src/common/manaserv_protocol.h | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src/common') 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 -- cgit