summaryrefslogtreecommitdiff
path: root/src/net/manaserv/inventoryhandler.h
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-18 02:24:44 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-18 02:24:44 +0200
commitf8551d9ef4a745327bccb9e4cb54a22f6a28cf80 (patch)
tree9af300838e58e2e2c7aeaca5765e7dbbb30d8b6d /src/net/manaserv/inventoryhandler.h
parent3b7740f133e195b0a0b11090ea8c2b8a7b64411c (diff)
downloadmana-client-f8551d9ef4a745327bccb9e4cb54a22f6a28cf80.tar.gz
mana-client-f8551d9ef4a745327bccb9e4cb54a22f6a28cf80.tar.bz2
mana-client-f8551d9ef4a745327bccb9e4cb54a22f6a28cf80.tar.xz
mana-client-f8551d9ef4a745327bccb9e4cb54a22f6a28cf80.zip
Made the client able to successfully equip/unequip!
Diffstat (limited to 'src/net/manaserv/inventoryhandler.h')
-rw-r--r--src/net/manaserv/inventoryhandler.h53
1 files changed, 43 insertions, 10 deletions
diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h
index a57b493a..aed41d6c 100644
--- a/src/net/manaserv/inventoryhandler.h
+++ b/src/net/manaserv/inventoryhandler.h
@@ -38,26 +38,59 @@ class EquipBackend : public Equipment::Backend, public EventListener
public:
EquipBackend();
- Item *getEquipment(int index) const;
+ Item *getEquipment(int slotIndex) const;
+ std::string getSlotName(int slotIndex) const;
void clear();
- void equip(int itemId, int equipSlot, int amountUsed = 1);
- void unequip(int equipSlot);
+ void equip(int itemId, int slotTypeId, int amountUsed = 1,
+ int itemInstance = 0);
+ void unequip(int slotTypeId);
void event(Event::Channel channel, const Event &event);
+ int getSlotNumber() const
+ { return mSlots.size(); }
+
+ void triggerUnequip(int slotIndex) const;
+
private:
void readEquipFile();
- struct SlotType {
+ struct Slot {
+ Slot():
+ item(0),
+ slotTypeId(0),
+ subId(0),
+ itemInstance(0)
+ {}
+
+ // Generic info
std::string name;
- int count;
- bool visible;
- int firstIndex;
- };
- std::vector<Item*> mSlots;
- std::vector<SlotType> mSlotTypes;
+ // The Item reference, used for graphical representation
+ // and info.
+ Item *item;
+
+ // Manaserv specific info
+
+ // Used to know which (server-side) slot id it is.
+ unsigned int slotTypeId;
+ // Static part
+ // The sub id is used to know in which order the slots are
+ // when the slotType has more than one slot capacity:
+ // I.e.: capacity = 6, subId will be between 1 and 6
+ // for each slots in the map.
+ // This is used to sort the multimap along with the slot id.
+ unsigned int subId;
+
+ // This is the (per character) unique item Id, used especially when
+ // equipping the same item multiple times on the same slot type.
+ unsigned int itemInstance;
+ };
+
+ // slot client index, slot info
+ typedef std::map<unsigned int, Slot> Slots;
+ Slots mSlots;
};
class InventoryHandler : public MessageHandler, Net::InventoryHandler,