summaryrefslogtreecommitdiff
path: root/src/being/playerinfo.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-04 15:19:53 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-04 15:19:53 +0300
commita553b3cda91aa095d88e22abcaa81701c2894334 (patch)
treecb44d56a66896fdbf4eaf9673901ee9cf3a60a73 /src/being/playerinfo.cpp
parent343809fe458a08bf96fe4f537db2d81d7523632e (diff)
downloadplus-a553b3cda91aa095d88e22abcaa81701c2894334.tar.gz
plus-a553b3cda91aa095d88e22abcaa81701c2894334.tar.bz2
plus-a553b3cda91aa095d88e22abcaa81701c2894334.tar.xz
plus-a553b3cda91aa095d88e22abcaa81701c2894334.zip
move equip/unequip/use calls into playerinfo.
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)