ManaPlus
Public Member Functions | Data Fields | Static Private Member Functions | Private Attributes
ItemInfo Class Reference

#include <iteminfo.h>

Public Member Functions

 ItemInfo ()
 
 ~ItemInfo ()
 
void setId (const int id)
 
int getId () const
 
void setName (const std::string &name)
 
const std::string & getName () const
 
const std::string getName (const ItemColor color) const
 
void setNameEn (const std::string &name)
 
const std::string & getNameEn () const
 
const std::string getNameEn (const ItemColor color) const
 
const std::string getLink () const
 
void setDisplay (const SpriteDisplay &display)
 
const SpriteDisplaygetDisplay () const
 
void setDescription (const std::string &description)
 
const std::string & getDescription () const
 
const std::string getDescription (const ItemColor color) const
 
void setEffect (const std::string &effect)
 
const std::string & getEffect () const
 
void setType (const ItemDbTypeT type)
 
void setUseButton (const std::string &str)
 
const std::string & getUseButton () const
 
void setUseButton2 (const std::string &str)
 
const std::string & getUseButton2 () const
 
ItemDbTypeT getType () const
 
void setWeight (const int weight)
 
int getWeight () const
 
int getView () const
 
void setView (const int view)
 
void setSprite (const std::string &animationFile, const GenderT gender, const int race)
 
const std::string & getSprite (const GenderT gender, const BeingTypeId race) const
 
void setAttackAction (const std::string &attackAction)
 
void setSkyAttackAction (const std::string &attackAction)
 
void setWaterAttackAction (const std::string &attackAction)
 
void setRideAttackAction (const std::string &attackAction)
 
void setMissileParticleFile (const std::string &s)
 
MissileInfogetMissile ()
 
const MissileInfogetMissileConst () const
 
void setHitEffectId (const int s)
 
int getHitEffectId () const
 
void setCriticalHitEffectId (const int s)
 
int getCriticalHitEffectId () const
 
void setMissEffectId (const int s)
 
int getMissEffectId () const
 
const std::string & getAttackAction () const
 
const std::string & getSkyAttackAction () const
 
const std::string & getWaterAttackAction () const
 
const std::string & getRideAttackAction () const
 
int getAttackRange () const
 
void setAttackRange (const int r)
 
void addSound (const ItemSoundEvent::Type event, const std::string &filename, const int delay)
 
const SoundInfogetSound (const ItemSoundEvent::Type event) const
 
int getDrawBefore (const int direction) const
 
void setDrawBefore (const int direction, const int n)
 
int getDrawAfter (const int direction) const
 
void setDrawAfter (const int direction, const int n)
 
int getDrawPriority (const int direction) const
 
void setDrawPriority (const int direction, const int n)
 
const IntMapgetTags () const
 
void addTag (const int tag)
 
void setRemoveSprites ()
 
bool isRemoveSprites () const
 
void setMaxFloorOffsetX (const int i)
 
void setMaxFloorOffsetY (const int i)
 
int getMaxFloorOffsetX () const
 
int getMaxFloorOffsetY () const
 
bool isRemoveItemId (int id) const
 
void setCardColor (const ItemColor color)
 
ItemColor getCardColor () const
 
int getReplaceToSpriteId (int id) const
 
IntMapaddReplaceSprite (const int sprite, const int direction)
 
const SpriteToItemMapgetSpriteToItemReplaceMap (const int directions) const
 
std::string getDyeColorsString (const ItemColor color) const
 
std::string getDyeIconColorsString (const ItemColor color) const
 
void setColorsList (const std::string &name)
 
void setIconColorsList (const std::string &name)
 
bool isHaveColors () const
 
bool isHaveIconColors () const
 
std::string getColorsListName () const
 
std::string getIconColorsListName () const
 
const std::string replaceColors (std::string str, const ItemColor color) const
 
void setPickupCursor (const std::string &cursor)
 
void setPickupCursor (const CursorT &cursor)
 
CursorT getPickupCursor () const
 
void setProtected (const bool b)
 
bool isProtected () const
 
int getColorsSize () const
 
int getIconColorsSize () const
 
std::string getColorName (const ItemColor idx) const
 
std::string getColor (const ItemColor idx) const
 
std::string getIconColorName (const ItemColor idx) const
 
std::string getIconColor (const ItemColor idx) const
 
std::vector< ItemMenuItem > & getInventoryMenu ()
 
std::vector< ItemMenuItem > & getStorageMenu ()
 
std::vector< ItemMenuItem > & getCartMenu ()
 
const std::vector< ItemMenuItem > & getInventoryMenuConst () const A_CONST
 
const std::vector< ItemMenuItem > & getStorageMenuConst () const A_CONST
 
const std::vector< ItemMenuItem > & getCartMenuConst () const A_CONST
 

Data Fields

int mDrawBefore [10]
 
int mDrawAfter [10]
 
int mDrawPriority [10]
 

Static Private Member Functions

static void setSpriteOrder (int *const ptr, const int direction, const int n, const int def=-1)
 

Private Attributes

SpriteDisplay mDisplay
 
MissileInfo mMissile
 
std::string mName
 
std::string mNameEn
 
std::string mDescription
 
std::string mEffect
 
std::string mUseButton
 
std::string mUseButton2
 
ItemDbTypeT mType
 
int mWeight
 
int mView
 
int mId
 
bool mIsRemoveSprites
 
SpriteToItemMapmSpriteToItemReplaceMap [10]
 
std::vector< SpriteToItemMap * > mSpriteToItemReplaceList
 
std::string mAttackAction
 
std::string mSkyAttackAction
 
std::string mWaterAttackAction
 
std::string mRideAttackAction
 
int mAttackRange
 
std::string mMissileParticle
 
std::map< int, std::string > mAnimationFiles
 
std::map< ItemSoundEvent::Type, SoundInfoVectmSounds
 
std::map< int, int > mTags
 
const std::map< ItemColor, ItemColorData > * mColorsList
 
const std::map< ItemColor, ItemColorData > * mIconColorsList
 
std::vector< ItemMenuItemmInventoryMenu
 
std::vector< ItemMenuItemmStorageMenu
 
std::vector< ItemMenuItemmCartMenu
 
std::string mColorsListName
 
std::string mIconColorsListName
 
ItemColor mCardColor
 
int mHitEffectId
 
int mCriticalHitEffectId
 
int mMissEffectId
 
int maxFloorOffsetX
 
int maxFloorOffsetY
 
CursorT mPickupCursor
 
bool mProtected
 

Detailed Description

Defines a class for storing item infos. This includes information used when the item is equipped.

Definition at line 52 of file iteminfo.h.

Constructor & Destructor Documentation

◆ ItemInfo()

ItemInfo::ItemInfo ( )

Constructor.

Definition at line 42 of file iteminfo.cpp.

References mDrawAfter, mDrawBefore, mDrawPriority, and mSpriteToItemReplaceMap.

42  :
43  mDisplay(),
44  mMissile(),
45  mName(),
46  mNameEn(),
47  mDescription(),
48  mEffect(),
49  mUseButton(),
50  mUseButton2(),
52  mWeight(0),
53  mView(0),
54  mId(0),
55  mIsRemoveSprites(false),
61  mAttackRange(0),
64  mSounds(),
65  mTags(),
66  mColorsList(nullptr),
67  mIconColorsList(nullptr),
69  mStorageMenu(),
70  mCartMenu(),
74  mHitEffectId(-1),
76  mMissEffectId(-1),
80  mProtected(false)
81 {
82  for (int f = 0; f < 10; f ++)
83  {
84  mSpriteToItemReplaceMap[f] = nullptr;
85  mDrawBefore[f] = -1;
86  mDrawAfter[f] = -1;
87  mDrawPriority[f] = 0;
88  }
89 }
std::string mWaterAttackAction
Definition: iteminfo.h:367
std::string mIconColorsListName
Definition: iteminfo.h:386
int mCriticalHitEffectId
Definition: iteminfo.h:389
std::string mNameEn
Definition: iteminfo.h:345
int mDrawPriority[10]
Definition: iteminfo.h:334
std::string mRideAttackAction
Definition: iteminfo.h:368
std::map< ItemSoundEvent::Type, SoundInfoVect > mSounds
Definition: iteminfo.h:378
std::string mAttackAction
Definition: iteminfo.h:365
int mHitEffectId
Definition: iteminfo.h:388
ItemDbTypeT mType
Definition: iteminfo.h:350
const ItemColor ItemColor_zero
Definition: itemcolor.h:29
ItemColor mCardColor
Definition: iteminfo.h:387
std::string mDescription
Definition: iteminfo.h:346
int maxFloorOffsetX
Definition: iteminfo.h:391
std::vector< ItemMenuItem > mCartMenu
Definition: iteminfo.h:384
std::string mMissileParticle
Definition: iteminfo.h:372
std::string mSkyAttackAction
Definition: iteminfo.h:366
std::vector< SpriteToItemMap * > mSpriteToItemReplaceList
Definition: iteminfo.h:358
SpriteToItemMap * mSpriteToItemReplaceMap[10]
Definition: iteminfo.h:356
int mDrawBefore[10]
Definition: iteminfo.h:332
MissileInfo mMissile
Definition: iteminfo.h:343
int mId
Definition: iteminfo.h:353
bool mProtected
Definition: iteminfo.h:394
int mMissEffectId
Definition: iteminfo.h:390
bool mIsRemoveSprites
Definition: iteminfo.h:354
static const std::string INVALID
Definition: spriteaction.h:71
int mDrawAfter[10]
Definition: iteminfo.h:333
std::string mName
Definition: iteminfo.h:344
SpriteDisplay mDisplay
Definition: iteminfo.h:342
int mWeight
Definition: iteminfo.h:351
std::map< int, std::string > mAnimationFiles
Definition: iteminfo.h:375
int mAttackRange
Definition: iteminfo.h:369
static const int mapTileSize
Definition: map.h:26
const std::map< ItemColor, ItemColorData > * mColorsList
Definition: iteminfo.h:380
std::string mUseButton2
Definition: iteminfo.h:349
int maxFloorOffsetY
Definition: iteminfo.h:392
const std::map< ItemColor, ItemColorData > * mIconColorsList
Definition: iteminfo.h:381
std::string mEffect
Definition: iteminfo.h:347
std::vector< ItemMenuItem > mInventoryMenu
Definition: iteminfo.h:382
std::string mUseButton
Definition: iteminfo.h:348
std::vector< ItemMenuItem > mStorageMenu
Definition: iteminfo.h:383
std::string mColorsListName
Definition: iteminfo.h:385
CursorT mPickupCursor
Definition: iteminfo.h:393
std::map< int, int > mTags
Definition: iteminfo.h:379
int mView
Definition: iteminfo.h:352

◆ ~ItemInfo()

ItemInfo::~ItemInfo ( )

Definition at line 91 of file iteminfo.cpp.

References delete_all(), mSpriteToItemReplaceList, and mSpriteToItemReplaceMap.

92 {
95  for (int f = 0; f < 10; f ++)
96  mSpriteToItemReplaceMap[f] = nullptr;
97 }
void delete_all(Container &c)
Definition: dtor.h:55
std::vector< SpriteToItemMap * > mSpriteToItemReplaceList
Definition: iteminfo.h:358
SpriteToItemMap * mSpriteToItemReplaceMap[10]
Definition: iteminfo.h:356

Member Function Documentation

◆ addReplaceSprite()

IntMap * ItemInfo::addReplaceSprite ( const int  sprite,
const int  direction 
)

Definition at line 173 of file iteminfo.cpp.

References mSpriteToItemReplaceList, and mSpriteToItemReplaceMap.

Referenced by getCardColor(), and loadReplaceSprite().

175 {
176  if (direction < 0 || direction >= 10)
177  return nullptr;
178 
179  SpriteToItemMap *spMap = mSpriteToItemReplaceMap[direction];
180 
181  if (spMap == nullptr)
182  {
183  spMap = new SpriteToItemMap;
184  mSpriteToItemReplaceMap[direction] = spMap;
185  mSpriteToItemReplaceList.push_back(spMap);
186  }
187 
188  SpriteToItemMap::iterator it = spMap->find(sprite);
189  if (it == spMap->end())
190  {
191  IntMap tmp;
192  (*mSpriteToItemReplaceMap[direction])[sprite] = tmp;
193  it = mSpriteToItemReplaceMap[direction]->find(sprite);
194  }
195  return &it->second;
196 }
std::map< int, int > IntMap
Definition: intmap.h:26
std::vector< SpriteToItemMap * > mSpriteToItemReplaceList
Definition: iteminfo.h:358
SpriteToItemMap * mSpriteToItemReplaceMap[10]
Definition: iteminfo.h:356
std::map< int, IntMap > SpriteToItemMap
Definition: iteminfo.h:42

◆ addSound()

void ItemInfo::addSound ( const ItemSoundEvent::Type  event,
const std::string &  filename,
const int  delay 
)

Definition at line 152 of file iteminfo.cpp.

References mSounds.

Referenced by loadSoundRef(), and setAttackRange().

154 {
155  mSounds[event].push_back(SoundInfo(
156  filename,
157  delay));
158 }
std::map< ItemSoundEvent::Type, SoundInfoVect > mSounds
Definition: iteminfo.h:378

◆ addTag()

void ItemInfo::addTag ( const int  tag)
inline

Definition at line 225 of file iteminfo.h.

References mTags.

Referenced by ItemDB::load(), and ItemDB::loadXmlFile().

226  { mTags[tag] = 1; }
std::map< int, int > mTags
Definition: iteminfo.h:379

◆ getAttackAction()

const std::string& ItemInfo::getAttackAction ( ) const
inline

Definition at line 185 of file iteminfo.h.

References mAttackAction.

Referenced by ItemDB::loadXmlFile().

186  { return mAttackAction; }
std::string mAttackAction
Definition: iteminfo.h:365

◆ getAttackRange()

int ItemInfo::getAttackRange ( ) const
inline

Definition at line 197 of file iteminfo.h.

References mAttackRange.

Referenced by LocalPlayer::getAttackRange(), and ItemDB::loadXmlFile().

198  { return mAttackRange; }
int mAttackRange
Definition: iteminfo.h:369

◆ getCardColor()

ItemColor ItemInfo::getCardColor ( ) const
inline

◆ getCartMenu()

std::vector<ItemMenuItem>& ItemInfo::getCartMenu ( )
inline

Definition at line 322 of file iteminfo.h.

References mCartMenu.

Referenced by ItemDB::loadXmlFile().

323  { return mCartMenu; }
std::vector< ItemMenuItem > mCartMenu
Definition: iteminfo.h:384

◆ getCartMenuConst()

const std::vector<ItemMenuItem>& ItemInfo::getCartMenuConst ( ) const
inline

Definition at line 329 of file iteminfo.h.

References mCartMenu.

Referenced by PopupMenu::addItemMenu().

330  { return mCartMenu; }
std::vector< ItemMenuItem > mCartMenu
Definition: iteminfo.h:384

◆ getColor()

std::string ItemInfo::getColor ( const ItemColor  idx) const

Definition at line 429 of file iteminfo.cpp.

References CAST_S32, mColorsList, mColorsListName, and reportAlways.

Referenced by getIconColorsSize().

430 {
431  if (mColorsList == nullptr)
432  return std::string();
433 
434  const std::map <ItemColor, ItemColorData>::const_iterator
435  it = mColorsList->find(idx);
436  if (it == mColorsList->end())
437  {
438  reportAlways("Color %d for palette %s not found",
439  CAST_S32(idx),
440  mColorsListName.c_str());
441  return std::string();
442  }
443  return it->second.color;
444 }
#define CAST_S32
Definition: cast.h:29
const std::map< ItemColor, ItemColorData > * mColorsList
Definition: iteminfo.h:380
std::string mColorsListName
Definition: iteminfo.h:385
#define reportAlways(...)
Definition: checkutils.h:252

◆ getColorName()

std::string ItemInfo::getColorName ( const ItemColor  idx) const

Definition at line 412 of file iteminfo.cpp.

References CAST_S32, mColorsList, mColorsListName, and reportAlways.

Referenced by getIconColorsSize(), and CharCreateDialog::updateLook().

413 {
414  if (mColorsList == nullptr)
415  return std::string();
416 
417  const std::map <ItemColor, ItemColorData>::const_iterator
418  it = mColorsList->find(idx);
419  if (it == mColorsList->end())
420  {
421  reportAlways("Color %d for palette %s not found",
422  CAST_S32(idx),
423  mColorsListName.c_str());
424  return std::string();
425  }
426  return it->second.name;
427 }
#define CAST_S32
Definition: cast.h:29
const std::map< ItemColor, ItemColorData > * mColorsList
Definition: iteminfo.h:380
std::string mColorsListName
Definition: iteminfo.h:385
#define reportAlways(...)
Definition: checkutils.h:252

◆ getColorsListName()

std::string ItemInfo::getColorsListName ( ) const
inline

Definition at line 278 of file iteminfo.h.

References mColorsListName.

Referenced by ItemDB::loadXmlFile().

279  { return mColorsListName; }
std::string mColorsListName
Definition: iteminfo.h:385

◆ getColorsSize()

int ItemInfo::getColorsSize ( ) const
inline

Definition at line 303 of file iteminfo.h.

References CAST_S32, and mColorsList.

Referenced by CharCreateDialog::updateLook().

304  { return mColorsList != nullptr ? CAST_S32(mColorsList->size()) : 0; }
#define CAST_S32
Definition: cast.h:29
const std::map< ItemColor, ItemColorData > * mColorsList
Definition: iteminfo.h:380

◆ getCriticalHitEffectId()

int ItemInfo::getCriticalHitEffectId ( ) const
inline

Definition at line 176 of file iteminfo.h.

References mCriticalHitEffectId.

Referenced by ItemDB::loadXmlFile().

177  { return mCriticalHitEffectId; }
int mCriticalHitEffectId
Definition: iteminfo.h:389

◆ getDescription() [1/2]

const std::string& ItemInfo::getDescription ( ) const
inline

Definition at line 99 of file iteminfo.h.

References A_WARN_UNUSED, and mDescription.

Referenced by ItemDB::loadXmlFile(), and ItemPopup::setItem().

100  { return mDescription; }
std::string mDescription
Definition: iteminfo.h:346

◆ getDescription() [2/2]

const std::string ItemInfo::getDescription ( const ItemColor  color) const

Definition at line 252 of file iteminfo.cpp.

References mDescription, and replaceColors().

253 {
254  return replaceColors(mDescription, color);
255 }
const std::string replaceColors(std::string str, const ItemColor color) const
Definition: iteminfo.cpp:267
std::string mDescription
Definition: iteminfo.h:346

◆ getDisplay()

const SpriteDisplay& ItemInfo::getDisplay ( ) const
inline

◆ getDrawAfter()

int ItemInfo::getDrawAfter ( const int  direction) const

Definition at line 391 of file iteminfo.cpp.

References mDrawAfter.

Referenced by setAttackRange().

392 {
393  if (direction < 0 || direction >= 10)
394  return -1;
395  return mDrawAfter[direction];
396 }
int mDrawAfter[10]
Definition: iteminfo.h:333

◆ getDrawBefore()

int ItemInfo::getDrawBefore ( const int  direction) const

Definition at line 384 of file iteminfo.cpp.

References mDrawBefore.

Referenced by setAttackRange().

385 {
386  if (direction < 0 || direction >= 10)
387  return -1;
388  return mDrawBefore[direction];
389 }
int mDrawBefore[10]
Definition: iteminfo.h:332

◆ getDrawPriority()

int ItemInfo::getDrawPriority ( const int  direction) const

Definition at line 398 of file iteminfo.cpp.

References mDrawPriority.

Referenced by setAttackRange().

399 {
400  if (direction < 0 || direction >= 10)
401  return 0;
402  return mDrawPriority[direction];
403 }
int mDrawPriority[10]
Definition: iteminfo.h:334

◆ getDyeColorsString()

std::string ItemInfo::getDyeColorsString ( const ItemColor  color) const

Definition at line 226 of file iteminfo.cpp.

References mColorsList, and mColorsListName.

Referenced by getCardColor(), Being::setHairTempSprite(), Being::setSpriteCards(), Being::setSpriteColorId(), Being::setTempSprite(), and CharCreateDialog::updateHair().

227 {
228  if ((mColorsList == nullptr) || mColorsListName.empty())
229  return "";
230 
231  const std::map <ItemColor, ItemColorData>::const_iterator
232  it = mColorsList->find(color);
233  if (it == mColorsList->end())
234  return "";
235 
236  return it->second.color;
237 }
const std::map< ItemColor, ItemColorData > * mColorsList
Definition: iteminfo.h:380
std::string mColorsListName
Definition: iteminfo.h:385

◆ getDyeIconColorsString()

std::string ItemInfo::getDyeIconColorsString ( const ItemColor  color) const

Definition at line 239 of file iteminfo.cpp.

References mIconColorsList, and mIconColorsListName.

Referenced by getCardColor(), Item::getImage(), FloorItem::postInit(), Item::setId(), and ItemPopup::setItem().

240 {
241  if ((mIconColorsList == nullptr) || mIconColorsListName.empty())
242  return "";
243 
244  const std::map <ItemColor, ItemColorData>::const_iterator
245  it = mIconColorsList->find(color);
246  if (it == mIconColorsList->end())
247  return "";
248 
249  return it->second.color;
250 }
std::string mIconColorsListName
Definition: iteminfo.h:386
const std::map< ItemColor, ItemColorData > * mIconColorsList
Definition: iteminfo.h:381

◆ getEffect()

const std::string& ItemInfo::getEffect ( ) const
inline

Definition at line 108 of file iteminfo.h.

References mEffect.

Referenced by ItemDB::loadXmlFile(), and ItemPopup::setItem().

109  { return mEffect; }
std::string mEffect
Definition: iteminfo.h:347

◆ getHitEffectId()

int ItemInfo::getHitEffectId ( ) const
inline

Definition at line 170 of file iteminfo.h.

References mHitEffectId.

Referenced by ItemDB::loadXmlFile().

171  { return mHitEffectId; }
int mHitEffectId
Definition: iteminfo.h:388

◆ getIconColor()

std::string ItemInfo::getIconColor ( const ItemColor  idx) const

Definition at line 463 of file iteminfo.cpp.

References CAST_S32, mColorsListName, mIconColorsList, and reportAlways.

Referenced by getIconColorsSize().

464 {
465  if (mIconColorsList == nullptr)
466  return std::string();
467 
468  const std::map <ItemColor, ItemColorData>::const_iterator
469  it = mIconColorsList->find(idx);
470  if (it == mIconColorsList->end())
471  {
472  reportAlways("Color %d for palette %s not found",
473  CAST_S32(idx),
474  mColorsListName.c_str());
475  return std::string();
476  }
477  return it->second.color;
478 }
#define CAST_S32
Definition: cast.h:29
const std::map< ItemColor, ItemColorData > * mIconColorsList
Definition: iteminfo.h:381
std::string mColorsListName
Definition: iteminfo.h:385
#define reportAlways(...)
Definition: checkutils.h:252

◆ getIconColorName()

std::string ItemInfo::getIconColorName ( const ItemColor  idx) const

Definition at line 446 of file iteminfo.cpp.

References CAST_S32, mColorsListName, mIconColorsList, and reportAlways.

Referenced by getIconColorsSize().

447 {
448  if (mIconColorsList == nullptr)
449  return std::string();
450 
451  const std::map <ItemColor, ItemColorData>::const_iterator
452  it = mIconColorsList->find(idx);
453  if (it == mIconColorsList->end())
454  {
455  reportAlways("Color %d for palette %s not found",
456  CAST_S32(idx),
457  mColorsListName.c_str());
458  return std::string();
459  }
460  return it->second.name;
461 }
#define CAST_S32
Definition: cast.h:29
const std::map< ItemColor, ItemColorData > * mIconColorsList
Definition: iteminfo.h:381
std::string mColorsListName
Definition: iteminfo.h:385
#define reportAlways(...)
Definition: checkutils.h:252

◆ getIconColorsListName()

std::string ItemInfo::getIconColorsListName ( ) const
inline

Definition at line 281 of file iteminfo.h.

References A_WARN_UNUSED, mIconColorsListName, replaceColors(), and ServerCommandType::str.

Referenced by ItemDB::loadXmlFile().

282  { return mIconColorsListName; }
std::string mIconColorsListName
Definition: iteminfo.h:386

◆ getIconColorsSize()

int ItemInfo::getIconColorsSize ( ) const
inline

Definition at line 306 of file iteminfo.h.

References CAST_S32, getColor(), getColorName(), getIconColor(), getIconColorName(), and mIconColorsList.

307  {
308  return mIconColorsList != nullptr ?
309  CAST_S32(mIconColorsList->size()) : 0;
310  }
#define CAST_S32
Definition: cast.h:29
const std::map< ItemColor, ItemColorData > * mIconColorsList
Definition: iteminfo.h:381

◆ getId()

int ItemInfo::getId ( ) const
inline

Definition at line 67 of file iteminfo.h.

References mId.

Referenced by ItemAmountWindow::action(), Actions::doSit(), LocalPlayer::pickedUp(), replaceItemLinks(), and ItemPopup::setItem().

68  { return mId; }
int mId
Definition: iteminfo.h:353

◆ getInventoryMenu()

std::vector<ItemMenuItem>& ItemInfo::getInventoryMenu ( )
inline

Definition at line 318 of file iteminfo.h.

References mInventoryMenu.

Referenced by ItemDB::loadXmlFile().

319  { return mInventoryMenu; }
std::vector< ItemMenuItem > mInventoryMenu
Definition: iteminfo.h:382

◆ getInventoryMenuConst()

const std::vector<ItemMenuItem>& ItemInfo::getInventoryMenuConst ( ) const
inline

Definition at line 325 of file iteminfo.h.

References mInventoryMenu.

Referenced by PopupMenu::addItemMenu().

326  { return mInventoryMenu; }
std::vector< ItemMenuItem > mInventoryMenu
Definition: iteminfo.h:382

◆ getLink()

const std::string ItemInfo::getLink ( ) const

Definition at line 480 of file iteminfo.cpp.

References mId, mName, and strprintf().

Referenced by getNameEn(), EAthena::VendingRecv::processReport(), and EAthena::SkillRecv::processSkillFailed().

481 {
482  return strprintf("[@@%d|%[email protected]@]", mId, mName.c_str());
483 }
std::string strprintf(const char *const format,...)
Definition: stringutils.cpp:99
int mId
Definition: iteminfo.h:353
std::string mName
Definition: iteminfo.h:344

◆ getMaxFloorOffsetX()

int ItemInfo::getMaxFloorOffsetX ( ) const
inline

Definition at line 240 of file iteminfo.h.

References maxFloorOffsetX.

Referenced by FloorItem::postInit().

241  { return maxFloorOffsetX; }
int maxFloorOffsetX
Definition: iteminfo.h:391

◆ getMaxFloorOffsetY()

int ItemInfo::getMaxFloorOffsetY ( ) const
inline

Definition at line 243 of file iteminfo.h.

References A_WARN_UNUSED, isRemoveItemId(), and maxFloorOffsetY.

Referenced by FloorItem::postInit().

244  { return maxFloorOffsetY; }
int maxFloorOffsetY
Definition: iteminfo.h:392

◆ getMissEffectId()

int ItemInfo::getMissEffectId ( ) const
inline

Definition at line 182 of file iteminfo.h.

References mMissEffectId.

Referenced by ItemDB::loadXmlFile().

183  { return mMissEffectId; }
int mMissEffectId
Definition: iteminfo.h:390

◆ getMissile()

MissileInfo& ItemInfo::getMissile ( )
inline

Definition at line 161 of file iteminfo.h.

References mMissile.

Referenced by ItemDB::loadXmlFile().

162  { return mMissile; }
MissileInfo mMissile
Definition: iteminfo.h:343

◆ getMissileConst()

const MissileInfo& ItemInfo::getMissileConst ( ) const
inline

Definition at line 164 of file iteminfo.h.

References mMissile.

Referenced by Being::handleAttack(), and ItemDB::loadXmlFile().

165  { return mMissile; }
MissileInfo mMissile
Definition: iteminfo.h:343

◆ getName() [1/2]

const std::string& ItemInfo::getName ( ) const
inline

◆ getName() [2/2]

const std::string ItemInfo::getName ( const ItemColor  color) const

Definition at line 257 of file iteminfo.cpp.

References mName, and replaceColors().

258 {
259  return replaceColors(mName, color);
260 }
const std::string replaceColors(std::string str, const ItemColor color) const
Definition: iteminfo.cpp:267
std::string mName
Definition: iteminfo.h:344

◆ getNameEn() [1/2]

const std::string& ItemInfo::getNameEn ( ) const
inline

Definition at line 82 of file iteminfo.h.

References A_WARN_UNUSED, getLink(), and mNameEn.

83  { return mNameEn; }
std::string mNameEn
Definition: iteminfo.h:345

◆ getNameEn() [2/2]

const std::string ItemInfo::getNameEn ( const ItemColor  color) const

Definition at line 262 of file iteminfo.cpp.

References mNameEn, and replaceColors().

263 {
264  return replaceColors(mNameEn, color);
265 }
std::string mNameEn
Definition: iteminfo.h:345
const std::string replaceColors(std::string str, const ItemColor color) const
Definition: iteminfo.cpp:267

◆ getPickupCursor()

CursorT ItemInfo::getPickupCursor ( ) const
inline

Definition at line 294 of file iteminfo.h.

References mPickupCursor.

Referenced by FloorItem::postInit().

295  { return mPickupCursor; }
CursorT mPickupCursor
Definition: iteminfo.h:393

◆ getReplaceToSpriteId()

int ItemInfo::getReplaceToSpriteId ( int  id) const

Referenced by getCardColor().

◆ getRideAttackAction()

const std::string& ItemInfo::getRideAttackAction ( ) const
inline

Definition at line 194 of file iteminfo.h.

References mRideAttackAction.

Referenced by ItemDB::loadXmlFile().

195  { return mRideAttackAction; }
std::string mRideAttackAction
Definition: iteminfo.h:368

◆ getSkyAttackAction()

const std::string& ItemInfo::getSkyAttackAction ( ) const
inline

Definition at line 188 of file iteminfo.h.

References mSkyAttackAction.

Referenced by ItemDB::loadXmlFile().

189  { return mSkyAttackAction; }
std::string mSkyAttackAction
Definition: iteminfo.h:366

◆ getSound()

const SoundInfo & ItemInfo::getSound ( const ItemSoundEvent::Type  event) const

Definition at line 160 of file iteminfo.cpp.

References CAST_U32, empty, and mSounds.

Referenced by Being::handleAttack(), ItemSoundManager::playSfx(), and setAttackRange().

161 {
162  static const SoundInfo empty("", 0);
163  std::map<ItemSoundEvent::Type, SoundInfoVect>::const_iterator i;
164 
165  i = mSounds.find(event);
166 
167  if (i == mSounds.end())
168  return empty;
169  return (!i->second.empty()) ? i->second[CAST_U32(rand())
170  % i->second.size()] : empty;
171 }
#define CAST_U32
Definition: cast.h:30
std::map< ItemSoundEvent::Type, SoundInfoVect > mSounds
Definition: iteminfo.h:378
std::string empty
Definition: podict.cpp:25

◆ getSprite()

const std::string & ItemInfo::getSprite ( const GenderT  gender,
const BeingTypeId  race 
) const

Definition at line 99 of file iteminfo.cpp.

References CAST_S32, empty, ItemDB::get(), getSprite(), mAnimationFiles, mView, and toInt.

Referenced by Inventory::findItemBySprite(), getSprite(), ItemDB::load(), Being::setGender(), Being::setHairTempSprite(), Being::setSpriteCards(), Being::setSpriteColor(), Being::setSpriteColorId(), Being::setSpriteId(), Being::setTempSprite(), and setView().

101 {
102  if (mView != 0)
103  {
104  // Forward the request to the item defining how to view this item
105  return ItemDB::get(mView).getSprite(gender, race);
106  }
107  static const std::string empty;
108  std::map<int, std::string>::const_iterator i =
109  mAnimationFiles.find(CAST_S32(gender) +
110  toInt(race, int) * 4);
111 
112  if (i != mAnimationFiles.end())
113  return i->second;
114  i = mAnimationFiles.find(CAST_S32(gender));
115  if (i != mAnimationFiles.end())
116  return i->second;
117  return empty;
118 }
const ItemInfo & get(const int id)
Definition: itemdb.cpp:814
const std::string & getSprite(const GenderT gender, const BeingTypeId race) const
Definition: iteminfo.cpp:99
#define toInt(val, name)
Definition: intdefines.h:46
#define CAST_S32
Definition: cast.h:29
std::string empty
Definition: podict.cpp:25
std::map< int, std::string > mAnimationFiles
Definition: iteminfo.h:375
int mView
Definition: iteminfo.h:352

◆ getSpriteToItemReplaceMap()

const SpriteToItemMap * ItemInfo::getSpriteToItemReplaceMap ( const int  directions) const

Definition at line 292 of file iteminfo.cpp.

References SpriteDirection::DOWN, SpriteDirection::DOWNLEFT, SpriteDirection::DOWNRIGHT, mSpriteToItemReplaceMap, SpriteDirection::UP, SpriteDirection::UPLEFT, and SpriteDirection::UPRIGHT.

Referenced by getCardColor(), and Being::recalcSpritesOrder().

294 {
295  if (direction < 0 || direction >= 10)
296  return nullptr;
297 
298  const SpriteToItemMap *const spMap = mSpriteToItemReplaceMap[direction];
299  if (spMap != nullptr)
300  return spMap;
301  if (direction == SpriteDirection::UPLEFT
302  || direction == SpriteDirection::UPRIGHT)
303  {
305  }
306 
307  if (direction == SpriteDirection::DOWNLEFT
308  || direction == SpriteDirection::DOWNRIGHT)
309  {
311  }
312 
313  return nullptr;
314 }
SpriteToItemMap * mSpriteToItemReplaceMap[10]
Definition: iteminfo.h:356
std::map< int, IntMap > SpriteToItemMap
Definition: iteminfo.h:42

◆ getStorageMenu()

std::vector<ItemMenuItem>& ItemInfo::getStorageMenu ( )
inline

Definition at line 320 of file iteminfo.h.

References mStorageMenu.

Referenced by ItemDB::loadXmlFile().

321  { return mStorageMenu; }
std::vector< ItemMenuItem > mStorageMenu
Definition: iteminfo.h:383

◆ getStorageMenuConst()

const std::vector<ItemMenuItem>& ItemInfo::getStorageMenuConst ( ) const
inline

Definition at line 327 of file iteminfo.h.

References mStorageMenu.

Referenced by PopupMenu::addItemMenu().

328  { return mStorageMenu; }
std::vector< ItemMenuItem > mStorageMenu
Definition: iteminfo.h:383

◆ getTags()

const IntMap& ItemInfo::getTags ( ) const
inline

Definition at line 222 of file iteminfo.h.

References mTags.

Referenced by Item::setId().

223  { return mTags; }
std::map< int, int > mTags
Definition: iteminfo.h:379

◆ getType()

ItemDbTypeT ItemInfo::getType ( ) const
inline

Definition at line 126 of file iteminfo.h.

References mType.

Referenced by ItemDB::loadXmlFile(), anonymous_namespace{itemcontainer.cpp}::SortItemTypeFunctor::operator()(), and ItemPopup::setItem().

127  { return mType; }
ItemDbTypeT mType
Definition: iteminfo.h:350

◆ getUseButton()

const std::string& ItemInfo::getUseButton ( ) const
inline

Definition at line 117 of file iteminfo.h.

References mUseButton.

Referenced by PopupMenu::addUse(), ItemDB::loadXmlFile(), and InventoryWindow::updateButtons().

118  { return mUseButton; }
std::string mUseButton
Definition: iteminfo.h:348

◆ getUseButton2()

const std::string& ItemInfo::getUseButton2 ( ) const
inline

Definition at line 123 of file iteminfo.h.

References mUseButton2.

Referenced by PopupMenu::addUse(), ItemDB::loadXmlFile(), and InventoryWindow::updateButtons().

124  { return mUseButton2; }
std::string mUseButton2
Definition: iteminfo.h:349

◆ getView()

int ItemInfo::getView ( ) const
inline

Definition at line 135 of file iteminfo.h.

References mView.

Referenced by ItemDB::loadXmlFile().

136  { return mView; }
int mView
Definition: iteminfo.h:352

◆ getWaterAttackAction()

const std::string& ItemInfo::getWaterAttackAction ( ) const
inline

Definition at line 191 of file iteminfo.h.

References mWaterAttackAction.

Referenced by ItemDB::loadXmlFile().

192  { return mWaterAttackAction; }
std::string mWaterAttackAction
Definition: iteminfo.h:367

◆ getWeight()

int ItemInfo::getWeight ( ) const
inline

Definition at line 132 of file iteminfo.h.

References mWeight.

Referenced by ItemDB::loadXmlFile(), and ItemPopup::setItem().

133  { return mWeight; }
int mWeight
Definition: iteminfo.h:351

◆ isHaveColors()

bool ItemInfo::isHaveColors ( ) const
inline

Definition at line 272 of file iteminfo.h.

References mColorsListName.

273  { return !mColorsListName.empty(); }
std::string mColorsListName
Definition: iteminfo.h:385

◆ isHaveIconColors()

bool ItemInfo::isHaveIconColors ( ) const
inline

Definition at line 275 of file iteminfo.h.

References mIconColorsListName.

276  { return !mIconColorsListName.empty(); }
std::string mIconColorsListName
Definition: iteminfo.h:386

◆ isProtected()

bool ItemInfo::isProtected ( ) const
inline

Definition at line 300 of file iteminfo.h.

References mProtected.

Referenced by NpcSellDialog::sellAction().

301  { return mProtected; }
bool mProtected
Definition: iteminfo.h:394

◆ isRemoveItemId()

bool ItemInfo::isRemoveItemId ( int  id) const

Referenced by getMaxFloorOffsetY().

◆ isRemoveSprites()

bool ItemInfo::isRemoveSprites ( ) const
inline

Definition at line 231 of file iteminfo.h.

References mIsRemoveSprites.

Referenced by Being::recalcSpritesOrder().

232  { return mIsRemoveSprites; }
bool mIsRemoveSprites
Definition: iteminfo.h:354

◆ replaceColors()

const std::string ItemInfo::replaceColors ( std::string  str,
const ItemColor  color 
) const

Definition at line 267 of file iteminfo.cpp.

References CAST_S8, mColorsList, mColorsListName, and replaceAll().

Referenced by getDescription(), getIconColorsListName(), getName(), and getNameEn().

269 {
270  std::string name;
271  if ((mColorsList != nullptr) && !mColorsListName.empty())
272  {
273  const std::map <ItemColor, ItemColorData>::const_iterator
274  it = mColorsList->find(color);
275  if (it == mColorsList->end())
276  name = "unknown";
277  else
278  name = it->second.name;
279  }
280  else
281  {
282  name = "unknown";
283  }
284 
285  str = replaceAll(str, "%color%", name);
286  if (!name.empty())
287  name[0] = CAST_S8(toupper(name[0]));
288 
289  return replaceAll(str, "%Color%", name);
290 }
std::string & replaceAll(std::string &context, const std::string &from, const std::string &to)
#define CAST_S8
Definition: cast.h:25
const std::map< ItemColor, ItemColorData > * mColorsList
Definition: iteminfo.h:380
std::string mColorsListName
Definition: iteminfo.h:385

◆ setAttackAction()

void ItemInfo::setAttackAction ( const std::string &  attackAction)

Definition at line 120 of file iteminfo.cpp.

References SpriteAction::ATTACK(), and mAttackAction.

Referenced by ItemDB::loadXmlFile(), and setView().

121 {
122  if (attackAction.empty())
123  mAttackAction = SpriteAction::ATTACK; // (Equal to unarmed animation)
124  else
125  mAttackAction = attackAction;
126 }
std::string mAttackAction
Definition: iteminfo.h:365
static const std::string ATTACK("attack")

◆ setAttackRange()

void ItemInfo::setAttackRange ( const int  r)
inline

◆ setCardColor()

void ItemInfo::setCardColor ( const ItemColor  color)
inline

Definition at line 248 of file iteminfo.h.

References mCardColor.

Referenced by ItemDB::loadXmlFile().

249  { mCardColor = color; }
ItemColor mCardColor
Definition: iteminfo.h:387

◆ setColorsList()

void ItemInfo::setColorsList ( const std::string &  name)

Definition at line 198 of file iteminfo.cpp.

References ColorDB::getColorsList(), mColorsList, and mColorsListName.

Referenced by getCardColor(), and ItemDB::loadXmlFile().

199 {
200  if (name.empty())
201  {
202  mColorsList = nullptr;
203  mColorsListName.clear();
204  }
205  else
206  {
208  mColorsListName = name;
209  }
210 }
const std::map< ItemColor, ItemColorData > * getColorsList(const std::string &name)
Definition: colordb.cpp:218
const std::map< ItemColor, ItemColorData > * mColorsList
Definition: iteminfo.h:380
std::string mColorsListName
Definition: iteminfo.h:385

◆ setCriticalHitEffectId()

void ItemInfo::setCriticalHitEffectId ( const int  s)
inline

Definition at line 173 of file iteminfo.h.

References mCriticalHitEffectId.

Referenced by ItemDB::loadXmlFile().

174  { mCriticalHitEffectId = s; }
int mCriticalHitEffectId
Definition: iteminfo.h:389

◆ setDescription()

void ItemInfo::setDescription ( const std::string &  description)
inline

Definition at line 96 of file iteminfo.h.

References mDescription.

Referenced by ItemDB::loadXmlFile().

97  { mDescription = description; }
std::string mDescription
Definition: iteminfo.h:346

◆ setDisplay()

void ItemInfo::setDisplay ( const SpriteDisplay display)
inline

Definition at line 90 of file iteminfo.h.

References mDisplay.

Referenced by ItemDB::load(), and ItemDB::loadXmlFile().

91  { mDisplay = display; }
SpriteDisplay mDisplay
Definition: iteminfo.h:342

◆ setDrawAfter()

void ItemInfo::setDrawAfter ( const int  direction,
const int  n 
)

Definition at line 374 of file iteminfo.cpp.

References mDrawAfter, and setSpriteOrder().

Referenced by loadOrderSprite(), ItemDB::loadXmlFile(), and setAttackRange().

375 {
376  setSpriteOrder(&mDrawAfter[0], direction, n);
377 }
static void setSpriteOrder(int *const ptr, const int direction, const int n, const int def=-1)
Definition: iteminfo.cpp:316
int mDrawAfter[10]
Definition: iteminfo.h:333

◆ setDrawBefore()

void ItemInfo::setDrawBefore ( const int  direction,
const int  n 
)

Definition at line 369 of file iteminfo.cpp.

References mDrawBefore, and setSpriteOrder().

Referenced by loadOrderSprite(), ItemDB::loadXmlFile(), and setAttackRange().

370 {
371  setSpriteOrder(&mDrawBefore[0], direction, n);
372 }
static void setSpriteOrder(int *const ptr, const int direction, const int n, const int def=-1)
Definition: iteminfo.cpp:316
int mDrawBefore[10]
Definition: iteminfo.h:332

◆ setDrawPriority()

void ItemInfo::setDrawPriority ( const int  direction,
const int  n 
)

Definition at line 379 of file iteminfo.cpp.

References mDrawPriority, and setSpriteOrder().

Referenced by loadOrderSprite(), ItemDB::loadXmlFile(), and setAttackRange().

380 {
381  setSpriteOrder(&mDrawPriority[0], direction, n, 0);
382 }
int mDrawPriority[10]
Definition: iteminfo.h:334
static void setSpriteOrder(int *const ptr, const int direction, const int n, const int def=-1)
Definition: iteminfo.cpp:316

◆ setEffect()

void ItemInfo::setEffect ( const std::string &  effect)
inline

Definition at line 105 of file iteminfo.h.

References ServerCommandType::effect, and mEffect.

Referenced by ItemDB::loadXmlFile().

◆ setHitEffectId()

void ItemInfo::setHitEffectId ( const int  s)
inline

Definition at line 167 of file iteminfo.h.

References mHitEffectId.

Referenced by ItemDB::loadXmlFile().

168  { mHitEffectId = s; }
int mHitEffectId
Definition: iteminfo.h:388

◆ setIconColorsList()

void ItemInfo::setIconColorsList ( const std::string &  name)

Definition at line 212 of file iteminfo.cpp.

References ColorDB::getColorsList(), mIconColorsList, and mIconColorsListName.

Referenced by getCardColor(), and ItemDB::loadXmlFile().

213 {
214  if (name.empty())
215  {
216  mIconColorsList = nullptr;
217  mIconColorsListName.clear();
218  }
219  else
220  {
222  mIconColorsListName = name;
223  }
224 }
std::string mIconColorsListName
Definition: iteminfo.h:386
const std::map< ItemColor, ItemColorData > * getColorsList(const std::string &name)
Definition: colordb.cpp:218
const std::map< ItemColor, ItemColorData > * mIconColorsList
Definition: iteminfo.h:381

◆ setId()

void ItemInfo::setId ( const int  id)
inline

Definition at line 64 of file iteminfo.h.

References mId.

Referenced by ItemDB::loadXmlFile().

65  { mId = id; }
int mId
Definition: iteminfo.h:353

◆ setMaxFloorOffsetX()

void ItemInfo::setMaxFloorOffsetX ( const int  i)
inline

Definition at line 234 of file iteminfo.h.

References maxFloorOffsetX.

Referenced by ItemDB::loadXmlFile().

235  { maxFloorOffsetX = i; }
int maxFloorOffsetX
Definition: iteminfo.h:391

◆ setMaxFloorOffsetY()

void ItemInfo::setMaxFloorOffsetY ( const int  i)
inline

Definition at line 237 of file iteminfo.h.

References maxFloorOffsetY.

Referenced by ItemDB::loadXmlFile().

238  { maxFloorOffsetY = i; }
int maxFloorOffsetY
Definition: iteminfo.h:392

◆ setMissEffectId()

void ItemInfo::setMissEffectId ( const int  s)
inline

Definition at line 179 of file iteminfo.h.

References mMissEffectId.

Referenced by ItemDB::loadXmlFile().

180  { mMissEffectId = s; }
int mMissEffectId
Definition: iteminfo.h:390

◆ setMissileParticleFile()

void ItemInfo::setMissileParticleFile ( const std::string &  s)
inline

Definition at line 158 of file iteminfo.h.

References mMissile, and MissileInfo::particle.

159  { mMissile.particle = s; }
MissileInfo mMissile
Definition: iteminfo.h:343
std::string particle
Definition: missileinfo.h:40

◆ setName()

void ItemInfo::setName ( const std::string &  name)
inline

Definition at line 70 of file iteminfo.h.

References mName.

Referenced by ItemDB::load(), and ItemDB::loadXmlFile().

71  { mName = name; }
std::string mName
Definition: iteminfo.h:344

◆ setNameEn()

void ItemInfo::setNameEn ( const std::string &  name)
inline

Definition at line 79 of file iteminfo.h.

References mNameEn.

Referenced by ItemDB::loadXmlFile().

80  { mNameEn = name; }
std::string mNameEn
Definition: iteminfo.h:345

◆ setPickupCursor() [1/2]

void ItemInfo::setPickupCursor ( const std::string &  cursor)
inline

Definition at line 288 of file iteminfo.h.

References Cursors::stringToCursor().

Referenced by ItemDB::loadXmlFile().

289  { return setPickupCursor(Cursors::stringToCursor(cursor)); }
CursorT stringToCursor(const std::string &name)
Definition: cursors.cpp:59
void setPickupCursor(const std::string &cursor)
Definition: iteminfo.h:288

◆ setPickupCursor() [2/2]

void ItemInfo::setPickupCursor ( const CursorT cursor)
inline

Definition at line 291 of file iteminfo.h.

References mPickupCursor.

292  { mPickupCursor = cursor; }
CursorT mPickupCursor
Definition: iteminfo.h:393

◆ setProtected()

void ItemInfo::setProtected ( const bool  b)
inline

Definition at line 297 of file iteminfo.h.

References mProtected.

Referenced by ItemDB::loadXmlFile().

298  { mProtected = b; }
bool mProtected
Definition: iteminfo.h:394

◆ setRemoveSprites()

void ItemInfo::setRemoveSprites ( )
inline

Definition at line 228 of file iteminfo.h.

References mIsRemoveSprites.

Referenced by loadReplaceSprite().

229  { mIsRemoveSprites = true; }
bool mIsRemoveSprites
Definition: iteminfo.h:354

◆ setRideAttackAction()

void ItemInfo::setRideAttackAction ( const std::string &  attackAction)

Definition at line 144 of file iteminfo.cpp.

References SpriteAction::ATTACKRIDE(), and mRideAttackAction.

Referenced by ItemDB::loadXmlFile(), and setView().

145 {
146  if (attackAction.empty())
148  else
149  mRideAttackAction = attackAction;
150 }
std::string mRideAttackAction
Definition: iteminfo.h:368
static const std::string ATTACKRIDE("attackride")

◆ setSkyAttackAction()

void ItemInfo::setSkyAttackAction ( const std::string &  attackAction)

Definition at line 128 of file iteminfo.cpp.

References SpriteAction::ATTACKSKY(), and mSkyAttackAction.

Referenced by ItemDB::loadXmlFile(), and setView().

129 {
130  if (attackAction.empty())
132  else
133  mSkyAttackAction = attackAction;
134 }
std::string mSkyAttackAction
Definition: iteminfo.h:366
static const std::string ATTACKSKY("attacksky")

◆ setSprite()

void ItemInfo::setSprite ( const std::string &  animationFile,
const GenderT  gender,
const int  race 
)

Definition at line 405 of file iteminfo.cpp.

References CAST_S32, and mAnimationFiles.

Referenced by ItemDB::load(), loadSpriteRef(), and setView().

408 {
409  mAnimationFiles[CAST_S32(gender) + race * 4] = animationFile;
410 }
#define CAST_S32
Definition: cast.h:29
std::map< int, std::string > mAnimationFiles
Definition: iteminfo.h:375

◆ setSpriteOrder()

void ItemInfo::setSpriteOrder ( int *const  ptr,
const int  direction,
const int  n,
const int  def = -1 
)
staticprivate

Definition at line 316 of file iteminfo.cpp.

References SpriteDirection::DOWN, SpriteDirection::DOWNLEFT, SpriteDirection::DOWNRIGHT, SpriteDirection::UP, SpriteDirection::UPLEFT, and SpriteDirection::UPRIGHT.

Referenced by setDrawAfter(), setDrawBefore(), and setDrawPriority().

320 {
321  switch (direction)
322  {
323  case -1:
324  {
325  for (int f = 0; f < 10; f ++)
326  {
327  if (ptr[f] == def)
328  ptr[f] = n;
329  }
330  return;
331  }
332  case -2:
333  {
334  ptr[SpriteDirection::DOWN] = n;
335  ptr[SpriteDirection::DOWNLEFT] = n;
337  return;
338  }
339  case -3:
340  {
341  ptr[SpriteDirection::UP] = n;
342  ptr[SpriteDirection::UPLEFT] = n;
343  ptr[SpriteDirection::UPRIGHT] = n;
344  return;
345  }
346  default:
347  break;
348  }
349  if (direction < 0 || direction >= 9)
350  return;
351 
352  if (direction == SpriteDirection::UP)
353  {
354  if (ptr[SpriteDirection::UPLEFT] == def)
355  ptr[SpriteDirection::UPLEFT] = n;
356  if (ptr[SpriteDirection::UPRIGHT] == def)
357  ptr[SpriteDirection::UPRIGHT] = n;
358  }
359  else if (direction == SpriteDirection::DOWN)
360  {
361  if (ptr[SpriteDirection::DOWNLEFT] == def)
362  ptr[SpriteDirection::DOWNLEFT] = n;
363  if (ptr[SpriteDirection::DOWNRIGHT] == def)
365  }
366  ptr[direction] = n;
367 }

◆ setType()

void ItemInfo::setType ( const ItemDbTypeT  type)
inline

Definition at line 111 of file iteminfo.h.

References mType.

Referenced by ItemDB::loadXmlFile().

112  { mType = type; }
ItemDbTypeT mType
Definition: iteminfo.h:350

◆ setUseButton()

void ItemInfo::setUseButton ( const std::string &  str)
inline

Definition at line 114 of file iteminfo.h.

References mUseButton, and ServerCommandType::str.

Referenced by ItemDB::loadXmlFile().

115  { mUseButton = str; }
std::string mUseButton
Definition: iteminfo.h:348

◆ setUseButton2()

void ItemInfo::setUseButton2 ( const std::string &  str)
inline

Definition at line 120 of file iteminfo.h.

References mUseButton2, and ServerCommandType::str.

Referenced by ItemDB::loadXmlFile().

121  { mUseButton2 = str; }
std::string mUseButton2
Definition: iteminfo.h:349

◆ setView()

void ItemInfo::setView ( const int  view)
inline

◆ setWaterAttackAction()

void ItemInfo::setWaterAttackAction ( const std::string &  attackAction)

Definition at line 136 of file iteminfo.cpp.

References SpriteAction::ATTACKWATER(), and mWaterAttackAction.

Referenced by ItemDB::loadXmlFile(), and setView().

137 {
138  if (attackAction.empty())
140  else
141  mWaterAttackAction = attackAction;
142 }
std::string mWaterAttackAction
Definition: iteminfo.h:367
static const std::string ATTACKWATER("attackwater")

◆ setWeight()

void ItemInfo::setWeight ( const int  weight)
inline

Definition at line 129 of file iteminfo.h.

References mWeight.

Referenced by ItemDB::loadXmlFile().

130  { mWeight = weight; }
int mWeight
Definition: iteminfo.h:351

Field Documentation

◆ mAnimationFiles

std::map<int, std::string> ItemInfo::mAnimationFiles
private

Maps gender to sprite filenames.

Definition at line 375 of file iteminfo.h.

Referenced by getSprite(), and setSprite().

◆ mAttackAction

std::string ItemInfo::mAttackAction
private

Attack type, in case of weapon. See SpriteAction in spritedef.h for more info. Attack action sub-types (bow, sword, ...) are defined in items.xml.

Definition at line 365 of file iteminfo.h.

Referenced by getAttackAction(), and setAttackAction().

◆ mAttackRange

int ItemInfo::mAttackRange
private

Attack range, will be zero if non weapon.

Definition at line 369 of file iteminfo.h.

Referenced by getAttackRange(), and setAttackRange().

◆ maxFloorOffsetX

int ItemInfo::maxFloorOffsetX
private

Definition at line 391 of file iteminfo.h.

Referenced by getMaxFloorOffsetX(), and setMaxFloorOffsetX().

◆ maxFloorOffsetY

int ItemInfo::maxFloorOffsetY
private

Definition at line 392 of file iteminfo.h.

Referenced by getMaxFloorOffsetY(), and setMaxFloorOffsetY().

◆ mCardColor

ItemColor ItemInfo::mCardColor
private

Definition at line 387 of file iteminfo.h.

Referenced by getCardColor(), and setCardColor().

◆ mCartMenu

std::vector<ItemMenuItem> ItemInfo::mCartMenu
private

Definition at line 384 of file iteminfo.h.

Referenced by getCartMenu(), and getCartMenuConst().

◆ mColorsList

const std::map<ItemColor, ItemColorData>* ItemInfo::mColorsList
private

◆ mColorsListName

std::string ItemInfo::mColorsListName
private

◆ mCriticalHitEffectId

int ItemInfo::mCriticalHitEffectId
private

Definition at line 389 of file iteminfo.h.

Referenced by getCriticalHitEffectId(), and setCriticalHitEffectId().

◆ mDescription

std::string ItemInfo::mDescription
private

Short description.

Definition at line 346 of file iteminfo.h.

Referenced by getDescription(), and setDescription().

◆ mDisplay

SpriteDisplay ItemInfo::mDisplay
private

Display info (like icon)

Definition at line 342 of file iteminfo.h.

Referenced by getDisplay(), and setDisplay().

◆ mDrawAfter

int ItemInfo::mDrawAfter[10]

Definition at line 333 of file iteminfo.h.

Referenced by getDrawAfter(), ItemInfo(), Being::recalcSpritesOrder(), and setDrawAfter().

◆ mDrawBefore

int ItemInfo::mDrawBefore[10]

Definition at line 332 of file iteminfo.h.

Referenced by getDrawBefore(), ItemInfo(), Being::recalcSpritesOrder(), and setDrawBefore().

◆ mDrawPriority

int ItemInfo::mDrawPriority[10]

Definition at line 334 of file iteminfo.h.

Referenced by getDrawPriority(), ItemInfo(), Being::recalcSpritesOrder(), and setDrawPriority().

◆ mEffect

std::string ItemInfo::mEffect
private

Description of effects.

Definition at line 347 of file iteminfo.h.

Referenced by getEffect(), and setEffect().

◆ mHitEffectId

int ItemInfo::mHitEffectId
private

Definition at line 388 of file iteminfo.h.

Referenced by getHitEffectId(), and setHitEffectId().

◆ mIconColorsList

const std::map<ItemColor, ItemColorData>* ItemInfo::mIconColorsList
private

◆ mIconColorsListName

std::string ItemInfo::mIconColorsListName
private

◆ mId

int ItemInfo::mId
private

Item ID

Definition at line 353 of file iteminfo.h.

Referenced by getId(), getLink(), and setId().

◆ mInventoryMenu

std::vector<ItemMenuItem> ItemInfo::mInventoryMenu
private

Definition at line 382 of file iteminfo.h.

Referenced by getInventoryMenu(), and getInventoryMenuConst().

◆ mIsRemoveSprites

bool ItemInfo::mIsRemoveSprites
private

Definition at line 354 of file iteminfo.h.

Referenced by isRemoveSprites(), and setRemoveSprites().

◆ mMissEffectId

int ItemInfo::mMissEffectId
private

Definition at line 390 of file iteminfo.h.

Referenced by getMissEffectId(), and setMissEffectId().

◆ mMissile

MissileInfo ItemInfo::mMissile
private

Definition at line 343 of file iteminfo.h.

Referenced by getMissile(), getMissileConst(), and setMissileParticleFile().

◆ mMissileParticle

std::string ItemInfo::mMissileParticle
private

Definition at line 372 of file iteminfo.h.

◆ mName

std::string ItemInfo::mName
private

Definition at line 344 of file iteminfo.h.

Referenced by getLink(), getName(), and setName().

◆ mNameEn

std::string ItemInfo::mNameEn
private

Definition at line 345 of file iteminfo.h.

Referenced by getNameEn(), and setNameEn().

◆ mPickupCursor

CursorT ItemInfo::mPickupCursor
private

Definition at line 393 of file iteminfo.h.

Referenced by getPickupCursor(), and setPickupCursor().

◆ mProtected

bool ItemInfo::mProtected
private

Definition at line 394 of file iteminfo.h.

Referenced by isProtected(), and setProtected().

◆ mRideAttackAction

std::string ItemInfo::mRideAttackAction
private

Definition at line 368 of file iteminfo.h.

Referenced by getRideAttackAction(), and setRideAttackAction().

◆ mSkyAttackAction

std::string ItemInfo::mSkyAttackAction
private

Definition at line 366 of file iteminfo.h.

Referenced by getSkyAttackAction(), and setSkyAttackAction().

◆ mSounds

std::map<ItemSoundEvent::Type, SoundInfoVect> ItemInfo::mSounds
private

Stores the names of sounds to be played at certain event.

Definition at line 378 of file iteminfo.h.

Referenced by addSound(), and getSound().

◆ mSpriteToItemReplaceList

std::vector<SpriteToItemMap*> ItemInfo::mSpriteToItemReplaceList
private

Definition at line 358 of file iteminfo.h.

Referenced by addReplaceSprite(), and ~ItemInfo().

◆ mSpriteToItemReplaceMap

SpriteToItemMap* ItemInfo::mSpriteToItemReplaceMap[10]
private

Definition at line 356 of file iteminfo.h.

Referenced by addReplaceSprite(), getSpriteToItemReplaceMap(), ItemInfo(), and ~ItemInfo().

◆ mStorageMenu

std::vector<ItemMenuItem> ItemInfo::mStorageMenu
private

Definition at line 383 of file iteminfo.h.

Referenced by getStorageMenu(), and getStorageMenuConst().

◆ mTags

std::map<int, int> ItemInfo::mTags
private

Definition at line 379 of file iteminfo.h.

Referenced by addTag(), and getTags().

◆ mType

ItemDbTypeT ItemInfo::mType
private

Item type.

Definition at line 350 of file iteminfo.h.

Referenced by getType(), and setType().

◆ mUseButton

std::string ItemInfo::mUseButton
private

Definition at line 348 of file iteminfo.h.

Referenced by getUseButton(), and setUseButton().

◆ mUseButton2

std::string ItemInfo::mUseButton2
private

Definition at line 349 of file iteminfo.h.

Referenced by getUseButton2(), and setUseButton2().

◆ mView

int ItemInfo::mView
private

Item ID of how this item looks.

Definition at line 352 of file iteminfo.h.

Referenced by getSprite(), getView(), and setView().

◆ mWaterAttackAction

std::string ItemInfo::mWaterAttackAction
private

Definition at line 367 of file iteminfo.h.

Referenced by getWaterAttackAction(), and setWaterAttackAction().

◆ mWeight

int ItemInfo::mWeight
private

Weight in grams.

Definition at line 351 of file iteminfo.h.

Referenced by getWeight(), and setWeight().


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