Rehti MMORPG  1.0.0
Rehti MMORPG is a free and open source MMORPG game.
Item Class Reference

Base class for items. More...

#include <Item.hpp>

Inheritance diagram for Item:
Inheritance graph
Collaboration diagram for Item:
Collaboration graph

Public Member Functions

 Item (int id, std::string name, bool isStackable=false)
 
 Item (const GeneralItemStruct &generalItem)
 
const int & getId ()
 Get the type id of the item. More...
 
const int & getInstanceId ()
 Get the instance id of the item. More...
 
const unsigned int & getStackSize ()
 Get the stack size of the item. More...
 
const std::string & getName ()
 Get the name of the item. More...
 
const bool & IsStackable ()
 Get whether the item is stackable or not. More...
 
virtual bool use (Entity *user)
 Function for using the item. This base class of items cannot be used, but derived classes should override this function. More...
 

Protected Attributes

int idM
 
int instanceIdM
 
const unsigned int stackSizeM = 1
 TODO: Implement amount functionality for stackable items. More...
 
std::string nameM
 
bool isStackableM
 

Static Protected Attributes

static int nextInstanceIdM = 0
 

Detailed Description

Base class for items.

Constructor & Destructor Documentation

◆ Item() [1/2]

Item::Item ( int  id,
std::string  name,
bool  isStackable = false 
)

◆ Item() [2/2]

Item::Item ( const GeneralItemStruct generalItem)

Member Function Documentation

◆ getId()

const int & Item::getId ( )

Get the type id of the item.

Returns
const int&

◆ getInstanceId()

const int & Item::getInstanceId ( )

Get the instance id of the item.

Returns
const int&

◆ getName()

const std::string & Item::getName ( )

Get the name of the item.

Returns
const std::string&

◆ getStackSize()

const unsigned int & Item::getStackSize ( )

Get the stack size of the item.

Returns
const unsigned int&

◆ IsStackable()

const bool & Item::IsStackable ( )

Get whether the item is stackable or not.

Returns
const bool&

◆ use()

bool Item::use ( Entity user)
virtual

Function for using the item. This base class of items cannot be used, but derived classes should override this function.

Parameters
userthat uses the item
Returns
bool (if returns true, item should be deleted)

Reimplemented in FoodItem, and EquippableItem.

Member Data Documentation

◆ idM

int Item::idM
protected

◆ instanceIdM

int Item::instanceIdM
protected

◆ isStackableM

bool Item::isStackableM
protected

◆ nameM

std::string Item::nameM
protected

◆ nextInstanceIdM

int Item::nextInstanceIdM = 0
inlinestaticprotected

◆ stackSizeM

const unsigned int Item::stackSizeM = 1
protected

TODO: Implement amount functionality for stackable items.


The documentation for this class was generated from the following files: