summaryrefslogtreecommitdiff
path: root/src/being/playerinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/being/playerinfo.cpp')
-rw-r--r--src/being/playerinfo.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index be9087b77..954cb20f4 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -245,6 +245,59 @@ void setEquipmentBackend(Equipment::Backend *const backend)
mEquipment->setBackend(backend);
}
+void equipItem(const Item *const item)
+{
+ Net::getInventoryHandler()->equipItem(item);
+}
+
+void unequipItem(const Item *const item)
+{
+ Net::getInventoryHandler()->unequipItem(item);
+}
+
+void useItem(const Item *const item)
+{
+ Net::getInventoryHandler()->useItem(item);
+}
+
+void useEquipItem(const Item *const item)
+{
+ if (item)
+ {
+ if (item->isEquipment())
+ {
+ if (item->isEquipped())
+ Net::getInventoryHandler()->unequipItem(item);
+ else
+ Net::getInventoryHandler()->equipItem(item);
+ }
+ else
+ {
+ if (mProtectedItems.find(item->getId()) == mProtectedItems.end())
+ Net::getInventoryHandler()->useItem(item);
+ }
+ }
+}
+
+void useEquipItem2(const Item *const item)
+{
+ if (item)
+ {
+ if (!item->isEquipment())
+ {
+ if (item->isEquipped())
+ Net::getInventoryHandler()->unequipItem(item);
+ else
+ Net::getInventoryHandler()->equipItem(item);
+ }
+ else
+ {
+ if (mProtectedItems.find(item->getId()) == mProtectedItems.end())
+ Net::getInventoryHandler()->useItem(item);
+ }
+ }
+}
+
// --- Misc -------------------------------------------------------------------
void setBackend(const PlayerInfoBackend &backend)