diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-08-09 21:31:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-08-09 21:31:02 +0300 |
commit | 90705929b29445a4569ff5c9ad13b7efcb304e0a (patch) | |
tree | 0dae1643b0fb33131fb918fe3a1729e879379e26 /src/net/tmwa | |
parent | b3fa7a53a29a1001935514a38f140af2b816771a (diff) | |
download | manaverse-90705929b29445a4569ff5c9ad13b7efcb304e0a.tar.gz manaverse-90705929b29445a4569ff5c9ad13b7efcb304e0a.tar.bz2 manaverse-90705929b29445a4569ff5c9ad13b7efcb304e0a.tar.xz manaverse-90705929b29445a4569ff5c9ad13b7efcb304e0a.zip |
Add different use actions for items.
Can be used from chat or from custom item menu from items.xml
Diffstat (limited to 'src/net/tmwa')
-rw-r--r-- | src/net/tmwa/inventoryhandler.cpp | 12 | ||||
-rw-r--r-- | src/net/tmwa/inventoryhandler.h | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index e87b748c7..7afbf746e 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -98,6 +98,18 @@ void InventoryHandler::useItem(const Item *const item) const outMsg.writeInt32(item->getId(), "item id"); } +void InventoryHandler::useItem(const Item *const item, + const int16_t useType A_UNUSED) const +{ + if (item == nullptr) + return; + + createOutPacket(CMSG_PLAYER_INVENTORY_USE); + outMsg.writeInt16(CAST_S16( + item->getInvIndex() + INVENTORY_OFFSET), "index"); + outMsg.writeInt32(item->getId(), "item id"); +} + void InventoryHandler::dropItem(const Item *const item, const int amount) const { if (item == nullptr) diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index 302c52ca0..5bf67f9f1 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -43,6 +43,9 @@ class InventoryHandler final : public Ea::InventoryHandler void useItem(const Item *const item) const override final; + void useItem(const Item *const item, + const int16_t useType) const override final; + void dropItem(const Item *const item, const int amount) const override final; |