00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef INVENTORY_H
00023 #define INVENTORY_H
00024
00025 #include "game-server/character.hpp"
00026 #include "net/messageout.hpp"
00027
00028 enum
00029 {
00030
00031
00032 EQUIP_TORSO_SLOT = 0,
00033
00034 EQUIP_ARMS_SLOT = 1,
00035
00036 EQUIP_HEAD_SLOT = 2,
00037
00038 EQUIP_LEGS_SLOT = 3,
00039
00040 EQUIP_FEET_SLOT = 4,
00041
00042 EQUIP_RING1_SLOT = 5,
00043 EQUIP_RING2_SLOT = 6,
00044
00045 EQUIP_NECKLACE_SLOT = 7,
00046
00047
00048
00049
00050 EQUIP_FIGHT1_SLOT = 8,
00051 EQUIP_FIGHT2_SLOT = 9,
00052
00053
00054 EQUIP_PROJECTILE_SLOT = 10,
00055
00056 EQUIP_CLIENT_INVENTORY = 32
00057 };
00058
00059 class GameClient;
00060
00064 class Inventory
00065 {
00066 public:
00067
00072 Inventory(Character *, bool delayed = false);
00073
00078 ~Inventory();
00079
00083 void commit();
00084
00088 void cancel();
00089
00093 void sendFull() const;
00094
00099 void initialize();
00100
00104 void equip(int slot);
00105
00109 void unequip(int slot);
00110
00115 int fireProjectile();
00116
00121 int insert(int itemId, int amount);
00122
00127 int remove(int itemId, int amount);
00128
00133 int move(int slot1, int slot2, int amount);
00134
00139 int removeFromSlot(int slot, int amount);
00140
00144 int count(int itemId) const;
00145
00149 int getItem(int slot) const;
00150
00155 bool changeMoney(int);
00156
00157 private:
00158
00162 void prepare();
00163
00167 void update();
00168
00172 void restart();
00173
00178 int fillFreeSlot(int itemId, int amount, int MaxPerSlot);
00179
00183 void freeIndex(int index);
00184
00188 int getIndex(int slot) const;
00189
00193 int getSlot(int index) const;
00194
00198 void replaceInSlot(int slot, int itemId, int amount);
00199
00203 void changeEquipment(int slot, int itemId);
00204
00205 Possessions *mPoss;
00206 MessageOut msg;
00207 Character *mClient;
00208 bool mDelayed;
00209 bool mChangedLook;
00210 };
00211
00212
00213 #endif