summaryrefslogtreecommitdiff
path: root/src/net/manaserv/inventoryhandler.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-04 16:32:40 +0300
committerAndrei Karas <akaras@inbox.ru>2012-03-04 16:33:19 +0300
commit8fd450f698f8277eb8348da914d3dcbc11890ea6 (patch)
treeebaddac087d5e5b29f23a2aa01dd2758c3b8f68a /src/net/manaserv/inventoryhandler.h
parentc6d7f7ed3d6d7827b820670faf6c48f0689fd5c2 (diff)
parentf74202392745923f9ce372a6bdcd0a45db6bcd08 (diff)
downloadmanaplus-8fd450f698f8277eb8348da914d3dcbc11890ea6.tar.gz
manaplus-8fd450f698f8277eb8348da914d3dcbc11890ea6.tar.bz2
manaplus-8fd450f698f8277eb8348da914d3dcbc11890ea6.tar.xz
manaplus-8fd450f698f8277eb8348da914d3dcbc11890ea6.zip
Merge branch 'master' into stripped
Conflicts: configure.ac data/Makefile.am data/fonts/liberationsans-bold.ttf data/fonts/liberationsans.ttf data/fonts/liberationsansmono-bold.ttf data/fonts/liberationsansmono.ttf data/themes/redandblack/CMakeLists.txt data/themes/redandblack/Makefile.am po/cs.po po/de.po po/es.po po/fi.po po/fr.po po/id.po po/ja.po po/manaplus.pot po/nl_BE.po po/pl.po po/pt.po po/pt_BR.po po/ru.po po/zh_CN.po src/guichan/color.cpp src/guichan/defaultfont.cpp src/guichan/focushandler.cpp src/guichan/include/guichan/actionlistener.hpp src/guichan/include/guichan/deathlistener.hpp src/guichan/include/guichan/focushandler.hpp src/guichan/include/guichan/focuslistener.hpp src/guichan/include/guichan/graphics.hpp src/guichan/include/guichan/keylistener.hpp src/guichan/include/guichan/listmodel.hpp src/guichan/include/guichan/mouselistener.hpp src/guichan/include/guichan/sdl/sdlpixel.hpp src/guichan/include/guichan/widget.hpp src/guichan/include/guichan/widgetlistener.hpp src/guichan/include/guichan/widgets/listbox.hpp src/guichan/include/guichan/widgets/slider.hpp src/guichan/sdl/sdlgraphics.cpp src/guichan/sdl/sdlimage.cpp src/guichan/widgets/scrollarea.cpp src/guichan/widgets/slider.cpp src/guichan/widgets/tabbedarea.cpp src/guichan/widgets/textbox.cpp src/guichan/widgets/window.cpp src/net/manaserv/attributes.cpp src/net/manaserv/beinghandler.cpp src/net/manaserv/charhandler.cpp src/net/manaserv/gamehandler.h src/net/manaserv/inventoryhandler.cpp src/net/manaserv/inventoryhandler.h src/net/manaserv/itemhandler.cpp src/net/manaserv/loginhandler.cpp src/net/manaserv/network.cpp
Diffstat (limited to 'src/net/manaserv/inventoryhandler.h')
-rw-r--r--src/net/manaserv/inventoryhandler.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h
new file mode 100644
index 000000000..af340399e
--- /dev/null
+++ b/src/net/manaserv/inventoryhandler.h
@@ -0,0 +1,104 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2012 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NET_MANASERV_INVENTORYHANDLER_H
+#define NET_MANASERV_INVENTORYHANDLER_H
+
+#include "equipment.h"
+
+#include "net/inventoryhandler.h"
+
+#include "net/manaserv/messagehandler.h"
+
+namespace ManaServ
+{
+
+class EquipBackend : public Equipment::Backend
+{
+ public:
+ EquipBackend()
+ { memset(mEquipment, 0, sizeof(mEquipment)); }
+
+ Item *getEquipment(int index) const
+ { return mEquipment[index]; }
+
+ void clear()
+ {
+ for (int i = 0; i < EQUIPMENT_SIZE; ++i)
+ delete mEquipment[i];
+
+ std::fill_n(mEquipment, EQUIPMENT_SIZE, (Item*) 0);
+ }
+
+ void setEquipment(unsigned int slot, unsigned int used, int reference)
+ {
+ printf("Equip: %d at %dx%d\n", reference, slot, used);
+ }
+
+ void addEquipment(unsigned int slot, int reference)
+ {
+ printf("Equip: %d at %d\n", reference, slot);
+ }
+
+ private:
+ Item *mEquipment[EQUIPMENT_SIZE];
+};
+
+class InventoryHandler : public MessageHandler, Net::InventoryHandler
+{
+ public:
+ InventoryHandler();
+
+ void handleMessage(Net::MessageIn &msg);
+
+ void equipItem(const Item *item);
+
+ void unequipItem(const Item *item);
+
+ void useItem(const Item *item);
+
+ void dropItem(const Item *item, int amount);
+
+ bool canSplit(const Item *item) const;
+
+ void splitItem(const Item *item, int amount);
+
+ void moveItem(int oldIndex, int newIndex);
+
+ void openStorage(int type);
+
+ void closeStorage(int type);
+
+ void moveItem2(int source, int slot, int amount,
+ int destination);
+
+ size_t getSize(int type) const;
+
+ int convertFromServerSlot(int eAthenaSlot) const;
+
+ private:
+ EquipBackend mEquips;
+};
+
+} // namespace ManaServ
+
+#endif // NET_MANASERV_INVENTORYHANDLER_H