ManaPlus
Public Member Functions | Data Fields
StatusEffect Class Reference

#include <statuseffect.h>

Public Member Functions

 StatusEffect ()
 
 ~StatusEffect ()
 
void playSFX () const
 
void deliverMessage () const
 
ParticlegetStartParticle () const
 
ParticlegetParticle () const
 
AnimatedSpritegetIcon () const
 
std::string getAction () const
 

Data Fields

std::string mMessage
 
std::string mSFXEffect
 
std::string mStartParticleEffect
 
std::string mParticleEffect
 
std::string mIcon
 
std::string mAction
 
std::string mName
 
bool mIsPersistent
 
bool mIsPoison
 
bool mIsCart
 
bool mIsRiding
 
bool mIsTrickDead
 
bool mIsPostDelay
 

Detailed Description

Definition at line 33 of file statuseffect.h.

Constructor & Destructor Documentation

◆ StatusEffect()

StatusEffect::StatusEffect ( )

Definition at line 38 of file statuseffect.cpp.

38  :
39  mMessage(),
40  mSFXEffect(),
43  mIcon(),
44  mAction(),
45  mName(),
46  mIsPersistent(false),
47  mIsPoison(false),
48  mIsCart(false),
49  mIsRiding(false),
50  mIsTrickDead(false),
51  mIsPostDelay(false)
52 {
53 }
std::string mMessage
Definition: statuseffect.h:76
std::string mName
Definition: statuseffect.h:82
std::string mAction
Definition: statuseffect.h:81
std::string mParticleEffect
Definition: statuseffect.h:79
std::string mStartParticleEffect
Definition: statuseffect.h:78
std::string mSFXEffect
Definition: statuseffect.h:77
bool mIsPersistent
Definition: statuseffect.h:83
bool mIsTrickDead
Definition: statuseffect.h:87
bool mIsPostDelay
Definition: statuseffect.h:88
std::string mIcon
Definition: statuseffect.h:80

◆ ~StatusEffect()

StatusEffect::~StatusEffect ( )

Definition at line 55 of file statuseffect.cpp.

56 {
57 }

Member Function Documentation

◆ deliverMessage()

void StatusEffect::deliverMessage ( ) const

Delivers the chat message associated with this status effect, if possible.

Definition at line 65 of file statuseffect.cpp.

References ChatMsgType::BY_SERVER, ChatTab::chatLog(), IgnoreRecord_false, localChatTab, mMessage, and TryRemoveColors_true.

Referenced by LocalPlayer::handleStatusEffect().

66 {
67  if (!mMessage.empty() &&
68  localChatTab != nullptr)
69  {
74  }
75 }
std::string mMessage
Definition: statuseffect.h:76
ChatTab * localChatTab
Definition: chattab.cpp:61
const bool TryRemoveColors_true
void chatLog(std::string line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
Definition: chattab.cpp:110
const bool IgnoreRecord_false
Definition: ignorerecord.h:29

◆ getAction()

std::string StatusEffect::getAction ( ) const

Retrieves an action to perform, or SpriteAction::INVALID

Definition at line 102 of file statuseffect.cpp.

References SpriteAction::INVALID, and mAction.

103 {
104  if (mAction.empty())
105  return SpriteAction::INVALID;
106  return mAction;
107 }
std::string mAction
Definition: statuseffect.h:81
static const std::string INVALID
Definition: spriteaction.h:71

◆ getIcon()

AnimatedSprite * StatusEffect::getIcon ( ) const

Retrieves the status icon for this effect, if applicable

Definition at line 91 of file statuseffect.cpp.

References Configuration::getStringValue(), AnimatedSprite::load(), mIcon, pathJoin(), and paths.

Referenced by LocalPlayer::handleStatusEffect().

92 {
93  if (mIcon.empty())
94  {
95  return nullptr;
96  }
97  return AnimatedSprite::load(
98  pathJoin(paths.getStringValue("sprites"), mIcon),
99  0);
100 }
std::string getStringValue(const std::string &key) const
std::string pathJoin(std::string str1, const std::string &str2)
static AnimatedSprite * load(const std::string &filename, const int variant)
Configuration paths
std::string mIcon
Definition: statuseffect.h:80

◆ getParticle()

Particle * StatusEffect::getParticle ( ) const

Creates the particle effect associated with this status effect, if possible.

Definition at line 84 of file statuseffect.cpp.

References ParticleEngine::addEffect(), mParticleEffect, and particleEngine.

Referenced by ActorSprite::handleStatusEffect().

85 {
86  if (particleEngine == nullptr || mParticleEffect.empty())
87  return nullptr;
88  return particleEngine->addEffect(mParticleEffect, 0, 0, 0);
89 }
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation)
ParticleEngine * particleEngine
std::string mParticleEffect
Definition: statuseffect.h:79

◆ getStartParticle()

Particle * StatusEffect::getStartParticle ( ) const

Creates the particle effect associated with this status effect, if possible.

Definition at line 77 of file statuseffect.cpp.

References ParticleEngine::addEffect(), mStartParticleEffect, and particleEngine.

Referenced by ActorSprite::handleStatusEffect().

78 {
79  if (particleEngine == nullptr || mStartParticleEffect.empty())
80  return nullptr;
82 }
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation)
ParticleEngine * particleEngine
std::string mStartParticleEffect
Definition: statuseffect.h:78

◆ playSFX()

void StatusEffect::playSFX ( ) const

Plays the sound effect associated with this status effect, if possible.

Definition at line 59 of file statuseffect.cpp.

References mSFXEffect, SoundManager::playSfx(), and soundManager.

Referenced by LocalPlayer::handleStatusEffect().

60 {
61  if (!mSFXEffect.empty())
63 }
SoundManager soundManager
std::string mSFXEffect
Definition: statuseffect.h:77
void playSfx(const std::string &path, const int x, const int y) const

Field Documentation

◆ mAction

std::string StatusEffect::mAction

Definition at line 81 of file statuseffect.h.

Referenced by getAction(), and StatusEffectDB::loadXmlFile().

◆ mIcon

std::string StatusEffect::mIcon

Definition at line 80 of file statuseffect.h.

Referenced by getIcon(), and StatusEffectDB::loadXmlFile().

◆ mIsCart

bool StatusEffect::mIsCart

Definition at line 85 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::updateStatusEffect().

◆ mIsPersistent

bool StatusEffect::mIsPersistent

Definition at line 83 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::logic().

◆ mIsPoison

bool StatusEffect::mIsPoison

Definition at line 84 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::updateStatusEffect().

◆ mIsPostDelay

bool StatusEffect::mIsPostDelay

Definition at line 88 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::updateStatusEffect().

◆ mIsRiding

bool StatusEffect::mIsRiding

Definition at line 86 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::updateStatusEffect().

◆ mIsTrickDead

bool StatusEffect::mIsTrickDead

Definition at line 87 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and ActorSprite::updateStatusEffect().

◆ mMessage

std::string StatusEffect::mMessage

Definition at line 76 of file statuseffect.h.

Referenced by deliverMessage(), and StatusEffectDB::loadXmlFile().

◆ mName

std::string StatusEffect::mName

◆ mParticleEffect

std::string StatusEffect::mParticleEffect

Definition at line 79 of file statuseffect.h.

Referenced by getParticle(), and StatusEffectDB::loadXmlFile().

◆ mSFXEffect

std::string StatusEffect::mSFXEffect

Definition at line 77 of file statuseffect.h.

Referenced by StatusEffectDB::loadXmlFile(), and playSFX().

◆ mStartParticleEffect

std::string StatusEffect::mStartParticleEffect

Definition at line 78 of file statuseffect.h.

Referenced by getStartParticle(), and StatusEffectDB::loadXmlFile().


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