Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
Item.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 
5 #include "RehtiReader.hpp"
6 
7 class Entity;
8 
12 class Item
13 {
14 public:
15  Item(int id, std::string name, bool isStackable = false);
16 
17  Item(const GeneralItemStruct& generalItem);
18 
23  const int& getId();
24 
29  const int& getInstanceId();
30 
35  const unsigned int& getStackSize();
36 
41  const std::string& getName();
42 
47  const bool& IsStackable();
48 
55  virtual bool use(Entity* user);
56 
57 protected:
58  int idM;
60 
61  const unsigned int stackSizeM = 1;
62 
63  std::string nameM;
64 
66 
67  inline static int nextInstanceIdM = 0;
68 };
Base pure virtual Entity class. Different types of enities inherit this.
Definition: Entity.hpp:17
Base class for items.
Definition: Item.hpp:13
const unsigned int & getStackSize()
Get the stack size of the item.
Definition: Item.cpp:33
const int & getInstanceId()
Get the instance id of the item.
Definition: Item.cpp:28
const bool & IsStackable()
Get whether the item is stackable or not.
Definition: Item.cpp:17
const int & getId()
Get the type id of the item.
Definition: Item.cpp:7
std::string nameM
Definition: Item.hpp:63
Item(int id, std::string name, bool isStackable=false)
Definition: Item.cpp:3
static int nextInstanceIdM
Definition: Item.hpp:67
const std::string & getName()
Get the name of the item.
Definition: Item.cpp:12
bool isStackableM
Definition: Item.hpp:65
const unsigned int stackSizeM
TODO: Implement amount functionality for stackable items.
Definition: Item.hpp:61
int instanceIdM
Definition: Item.hpp:59
int idM
Definition: Item.hpp:58
virtual bool use(Entity *user)
Function for using the item. This base class of items cannot be used, but derived classes should over...
Definition: Item.cpp:22
Definition: ItemReader.hpp:52