Mana
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ItemDB Class Referenceabstract

Item information database generic definition. More...

#include <itemdb.h>

Inheritance diagram for ItemDB:
ManaServ::ManaServItemDB TmwAthena::TaItemDB

Public Member Functions

 ItemDB ()=default
 
virtual ~ItemDB ()=default
 
virtual void unload ()
 Frees item data.
 
bool isLoaded () const
 Tells whether the item database is loaded.
 
bool exists (int id) const
 
const ItemInfoget (int id) const
 
const ItemInfoget (const std::string &name) const
 
virtual void init ()=0
 
virtual void readItemNode (XML::Node node, const std::string &filename)=0
 
virtual void checkStatus ()=0
 

Protected Member Functions

void loadCommonRef (ItemInfo &itemInfo, XML::Node node, const std::string &filename)
 Permits to load item definitions which are common for each protocols to avoid code duplication.
 
virtual void checkItemInfo (ItemInfo &itemInfo)
 Checks the items parameters consistency.
 
void addItem (ItemInfo *itemInfo)
 Registers the item to mItemInfos and mNamedItemsInfos.
 
void loadEmptyItemDefinition ()
 Loads the empty item definition.
 

Protected Attributes

ItemInfomUnknown = nullptr
 
bool mLoaded = false
 

Private Member Functions

void loadSpriteRef (ItemInfo &itemInfo, XML::Node node)
 Loads the sprite references contained in a <sprite> tag.
 
void loadSoundRef (ItemInfo &itemInfo, XML::Node node)
 Loads the sound references contained in a <sound> tag.
 
void loadFloorSprite (SpriteDisplay &display, XML::Node node)
 Loads the floor item references contained in a <floor> tag.
 
void loadReplacement (ItemInfo &info, XML::Node replaceNode)
 Loads the <replace> tag.
 

Private Attributes

std::map< int, ItemInfo * > mItemInfos
 
std::map< std::string, ItemInfo * > mNamedItemInfos
 

Detailed Description

Item information database generic definition.

Definition at line 72 of file itemdb.h.

Constructor & Destructor Documentation

◆ ItemDB()

ItemDB::ItemDB ( )
default

◆ ~ItemDB()

virtual ItemDB::~ItemDB ( )
virtualdefault

Member Function Documentation

◆ addItem()

void ItemDB::addItem ( ItemInfo itemInfo)
protected

Registers the item to mItemInfos and mNamedItemsInfos.

Definition at line 337 of file itemdb.cpp.

◆ checkItemInfo()

void ItemDB::checkItemInfo ( ItemInfo itemInfo)
protectedvirtual

Checks the items parameters consistency.

Reimplemented in TmwAthena::TaItemDB, and ManaServ::ManaServItemDB.

Definition at line 367 of file itemdb.cpp.

◆ checkStatus()

virtual void ItemDB::checkStatus ( )
pure virtual

◆ exists()

bool ItemDB::exists ( int  id) const

Definition at line 138 of file itemdb.cpp.

◆ get() [1/2]

const ItemInfo & ItemDB::get ( const std::string &  name) const

Definition at line 159 of file itemdb.cpp.

◆ get() [2/2]

const ItemInfo & ItemDB::get ( int  id) const

Definition at line 145 of file itemdb.cpp.

◆ init()

virtual void ItemDB::init ( )
pure virtual

◆ isLoaded()

bool ItemDB::isLoaded ( ) const
inline

Tells whether the item database is loaded.

Definition at line 86 of file itemdb.h.

◆ loadCommonRef()

void ItemDB::loadCommonRef ( ItemInfo itemInfo,
XML::Node  node,
const std::string &  filename 
)
protected

Permits to load item definitions which are common for each protocols to avoid code duplication.

Definition at line 281 of file itemdb.cpp.

◆ loadEmptyItemDefinition()

void ItemDB::loadEmptyItemDefinition ( )
protected

Loads the empty item definition.

Definition at line 122 of file itemdb.cpp.

◆ loadFloorSprite()

void ItemDB::loadFloorSprite ( SpriteDisplay display,
XML::Node  node 
)
private

Loads the floor item references contained in a <floor> tag.

Definition at line 211 of file itemdb.cpp.

◆ loadReplacement()

void ItemDB::loadReplacement ( ItemInfo info,
XML::Node  replaceNode 
)
private

Loads the <replace> tag.

Definition at line 228 of file itemdb.cpp.

◆ loadSoundRef()

void ItemDB::loadSoundRef ( ItemInfo itemInfo,
XML::Node  node 
)
private

Loads the sound references contained in a <sound> tag.

Definition at line 191 of file itemdb.cpp.

◆ loadSpriteRef()

void ItemDB::loadSpriteRef ( ItemInfo itemInfo,
XML::Node  node 
)
private

Loads the sprite references contained in a <sprite> tag.

Definition at line 177 of file itemdb.cpp.

◆ readItemNode()

virtual void ItemDB::readItemNode ( XML::Node  node,
const std::string &  filename 
)
pure virtual

◆ unload()

void ItemDB::unload ( )
virtual

Frees item data.

Definition at line 268 of file itemdb.cpp.

Member Data Documentation

◆ mItemInfos

std::map<int, ItemInfo *> ItemDB::mItemInfos
private

Definition at line 149 of file itemdb.h.

◆ mLoaded

bool ItemDB::mLoaded = false
protected

Definition at line 125 of file itemdb.h.

◆ mNamedItemInfos

std::map<std::string, ItemInfo *> ItemDB::mNamedItemInfos
private

Definition at line 150 of file itemdb.h.

◆ mUnknown

ItemInfo* ItemDB::mUnknown = nullptr
protected

Definition at line 123 of file itemdb.h.


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