ManaPlus
Public Member Functions | Static Public Member Functions | Data Fields | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
Being Class Reference

#include <being.h>

Inheritance diagram for Being:
ActorSprite ConfigListener CompoundSprite Actor Sprite LocalPlayer

Public Member Functions

 Being (const BeingId id, const ActorTypeT type)
 
 ~Being ()
 
ActorTypeT getType () const
 
void clearPath ()
 
int getActionTime () const
 
void setActionTime (const int actionTime)
 
virtual void nextTile ()
 
void setDestination (const int dstX, const int dstY)
 
void setCachedDestination (const int dstX, const int dstY)
 
int getCachedX () const
 
int getCachedY () const
 
const VectorgetDestination () const
 
int getTileX () const
 
int getTileY () const
 
virtual void setTileCoords (const int x, const int y)
 
void setSpeech (const std::string &text)
 
void takeDamage (Being *const attacker, const int amount, const AttackTypeT type, const int attackId, const int level)
 
void handleAttack (Being *const victim, const int damage, const int attackId)
 
void handleSkillCasting (Being *const victim, const int skillId, const int skillLevel)
 
void handleSkill (Being *const victim, const int damage, const int skillId, const int skillLevel)
 
const ItemInfogetEquippedWeapon () const
 
const std::string & getName () const
 
const std::string & getExtName () const
 
void setName (const std::string &name)
 
bool getShowName () const
 
void setShowName (const bool doShowName)
 
void setPartyName (const std::string &name)
 
const std::string & getPartyName () const
 
const std::string & getGuildName () const
 
const std::string & getClanName () const
 
void setGuildName (const std::string &name)
 
void setGuildPos (const std::string &pos)
 
void setClanName (const std::string &name)
 
void addGuild (Guild *const guild)
 
void removeGuild (const int id)
 
const GuildgetGuild (const std::string &guildName) const
 
const GuildgetGuild (const int id) const
 
GuildgetGuild () const
 
const std::map< int, Guild * > & getGuilds () const
 
void clearGuilds ()
 
int16_t getNumberOfGuilds () const
 
bool isInParty () const
 
void setParty (Party *const party)
 
void setGuild (Guild *const guild)
 
void updateGuild ()
 
PartygetParty () const
 
void setSprite (const unsigned int slot, const int id, std::string color, ItemColor colorId)
 
void setSpriteColor (const unsigned int slot, const int id, const std::string &color)
 
void setSpriteColorId (const unsigned int slot, const int id, ItemColor colorId)
 
void setSpriteCards (const unsigned int slot, const int id, const CardsList &cards)
 
void setSpriteId (const unsigned int slot, const int id)
 
void unSetSprite (const unsigned int slot)
 
void setWeaponId (const int id)
 
void setTempSprite (const unsigned int slot, const int id)
 
void setHairTempSprite (const unsigned int slot, const int id)
 
void updateSprite (const unsigned int slot, const int id, const std::string &color)
 
void setHairColorSpriteID (const unsigned int slot, const int id)
 
void setSpriteColor (const unsigned int slot, const std::string &color)
 
int getNumberOfLayers () const
 
void logic ()
 
void botLogic ()
 
void drawSpeech (const int offsetX, const int offsetY)
 
void drawEmotion (Graphics *const graphics, const int offsetX, const int offsetY) const
 
BeingTypeId getSubType () const
 
void setSubtype (const BeingTypeId subtype, const uint16_t look)
 
const BeingInfogetInfo () const
 
TargetCursorSizeT getTargetCursorSize () const
 
int getTargetOffsetX () const
 
int getTargetOffsetY () const
 
virtual unsigned char getBlockWalkMask () const
 
BlockTypeT getBlockType () const
 
void setWalkSpeed (const int speed)
 
int getWalkSpeed () const
 
void setAttackSpeed (const int speed)
 
int getAttackSpeed () const
 
virtual void setAction (const BeingActionT &action, const int attackId)
 
BeingActionT getCurrentAction () const
 
bool isAlive () const
 
uint8_t getDirection () const
 
virtual void setDirection (const uint8_t direction)
 
void setDirectionDelayed (const uint8_t direction)
 
uint8_t getDirectionDelayed () const
 
SpriteDirection::Type getSpriteDirection () const
 
void setPixelPositionF (const Vector &pos)
 
void setPixelPositionF (const float x, const float y, const float z) A_INLINE
 
int getWidth () const
 
int getHeight () const
 
void fireMissile (Being *const victim, const MissileInfo &missile) const
 
const PathgetPath () const
 
int getDistance () const
 
void setDistance (const int n)
 
void setEmote (const uint8_t emotion, const int emote_time)
 
void setState (const uint8_t state)
 
void drawPlayerSprites (Graphics *const graphics, const int posX, const int posY) const
 
void drawSpritesSDL (Graphics *const graphics, const int posX, const int posY) const
 
void drawHpBar (Graphics *const graphics, const int maxHP, const int hp, const int damage, const UserColorIdT color1, const UserColorIdT color2, const int x, const int y, const int width, const int height) const
 
void optionChanged (const std::string &value)
 
void flashName (const int time)
 
int getDamageTaken () const
 
void setDamageTaken (const int damage)
 
void updateName ()
 
void setLevel (const int n)
 
virtual int getLevel () const
 
void setReachable (const ReachableT n)
 
ReachableT getReachable () const
 
void addToCache () const
 
bool updateFromCache ()
 
virtual void setGender (const GenderT gender)
 
GenderT getGender () const
 
std::string getSitAction () const
 
std::string getCastAction () const
 
std::string getCastAction (const SkillInfo *const skill) const
 
std::string getMoveAction () const
 
std::string getDeadAction () const
 
std::string getStandAction () const
 
std::string getSpawnAction () const
 
std::string getWeaponAttackAction (const ItemInfo *const weapon) const
 
std::string getAttackAction () const
 
std::string getAttackAction (const Attack *const attack1) const
 
bool isGM () const
 
void setGM (const bool gm)
 
bool canTalk () const
 
void talkTo () const
 
void draw (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void drawPlayer (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void drawOther (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void drawNpc (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void drawMonster (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void drawPortal (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void drawBasic (Graphics *const graphics, const int x, const int y) const
 
void setMoveTime ()
 
void setAttackTime ()
 
void setTalkTime ()
 
void setTestTime ()
 
void setOtherTime ()
 
time_t getMoveTime () const
 
time_t getAttackTime () const
 
time_t getTalkTime () const
 
time_t getTestTime () const
 
time_t getOtherTime () const
 
void resetCounters ()
 
void updateColors ()
 
void setEnemy (const bool n)
 
const std::string & getIp () const
 
void setIp (const std::string &ip)
 
unsigned int getPvpRank () const
 
void setPvpRank (const unsigned int rank)
 
void setHP (const int hp)
 
void setMaxHP (const int hp)
 
int getHP () const
 
int getMaxHP () const
 
uint8_t calcDirection (const int dstX, const int dstY) const
 
uint8_t calcDirection () const
 
void setAttackDelay (const int n)
 
int getAttackDelay () const
 
int getMinHit () const
 
void setMinHit (const int n)
 
int getMaxHit () const
 
void setMaxHit (const int n)
 
int getCriticalHit () const
 
void setCriticalHit (const int n)
 
void updateHit (const int amount)
 
EquipmentgetEquipment ()
 
void undressItemById (const int id)
 
int getGoodStatus () const
 
void setGoodStatus (const int n)
 
std::string getGenderSign () const
 
std::string getGenderSignWithSpace () const
 
void updateComment ()
 
const std::string getComment () const
 
void setComment (const std::string &n)
 
bool isAdvanced () const
 
void setAdvanced (const bool n)
 
bool isBuyShopEnabled () const
 
bool isSellShopEnabled () const
 
void enableShop (const bool b)
 
void setAttackRange (const int range)
 
void updatePercentHP ()
 
void setRaceName (const std::string &name)
 
std::string getRaceName () const
 
int getSpriteID (const int slot) const
 
const BeingSlotgetSpriteSlot (const int slot) const
 
ItemColor getSpriteColor (const int slot) const
 
void setHairStyle (const unsigned int slot, const int id)
 
void setHairColor (const unsigned int slot, const ItemColor color)
 
void setHairColor (const ItemColor color)
 
void setSpriteSlot (const unsigned int slot, const BeingSlot &beingSlot)
 
ItemColor getHairColor () const
 
void recalcSpritesOrder ()
 
CursorT getHoverCursor () const
 
void addAfkEffect ()
 
void removeAfkEffect ()
 
void updateAwayEffect ()
 
void addSpecialEffect (const int effect)
 
void removeSpecialEffect ()
 
void addEffect (const std::string &name)
 
void setOwner (Being *const owner)
 
BeinggetOwner () const
 
void playSfx (const SoundInfo &sound, Being *const being, const bool main, const int x, const int y) const
 
uint16_t getLook () const
 
void setLook (const uint16_t look)
 
void setPath (const Path &path)
 
int getSortPixelY () const
 
void setMap (Map *const map)
 
void recreateItemParticles ()
 
void incUsage ()
 
int decUsage ()
 
virtual int getLastAttackX () const
 
virtual int getLastAttackY () const
 
void drawHomunculus (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void drawMercenary (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void drawElemental (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void setTrickDead (const bool b)
 
void setChat (ChatObject *const obj)
 
ChatObjectgetChat () const
 
void setRiding (const bool b)
 
void setHorse (const int horseId)
 
void removeHorse ()
 
void setSellBoard (const std::string &text)
 
std::string getSellBoard () const
 
void setBuyBoard (const std::string &text)
 
std::string getBuyBoard () const
 
void setSpiritBalls (const unsigned int balls)
 
unsigned int getSpiritBalls () const
 
void stopCast (const bool b)
 
void setCreatorId (const BeingId id)
 
BeingId getCreatorId () const
 
void setKarma (const int karma)
 
int getKarma () const
 
void setManner (const int manner)
 
int getManner () const
 
void disableBotAi ()
 
void enableBotAi ()
 
int getAreaSize () const
 
void setAreaSize (const int areaSize)
 
void setTeamId (const uint16_t teamId)
 
void showTeamBadge (const bool show)
 
void showGuildBadge (const bool show)
 
void showClanBadge (const bool show)
 
void showGmBadge (const bool show)
 
void showPartyBadge (const bool show)
 
void showNameBadge (const bool show)
 
void showShopBadge (const bool show)
 
void showInactiveBadge (const bool show)
 
void showAwayBadge (const bool show)
 
void showBadges (const bool show)
 
void setLanguageId (const int lang)
 
int getLanguageId ()
 
uint16_t getTeamId () const
 
virtual void setGroupId (const int id)
 
int getGroupId () const
 
void serverRemove ()
 
void addCast (const int dstX, const int dstY, const int skillId, const int skillLevel, const int range, const int waitTimeTicks)
 
void fixDirectionOffsets (int &offsetX, int &offsetY) const
 
bool getAllowNpcEquipment () const
 
- Public Member Functions inherited from ActorSprite
 ActorSprite (const BeingId id)
 
 ~ActorSprite ()
 
BeingId getId () const
 
void setId (const BeingId id)
 
void controlAutoParticle (Particle *const particle)
 
void controlCustomParticle (Particle *const particle)
 
void setTargetType (const TargetCursorTypeT type)
 
void untarget ()
 
void setStatusEffect (const int32_t index, const Enable active, const IsStart start)
 
void setStatusEffectOpitons (const uint32_t option, const uint32_t opt1, const uint32_t opt2, const uint32_t opt3)
 
void setStatusEffectOpitons (const uint32_t option, const uint32_t opt1, const uint32_t opt2)
 
void setStatusEffectOpiton0 (const uint32_t option)
 
void setAlpha (const float alpha)
 
float getAlpha () const
 
void addActorSpriteListener (ActorSpriteListener *const listener)
 
void removeActorSpriteListener (ActorSpriteListener *const listener)
 
int getActorX () const
 
int getActorY () const
 
void setPoison (const bool b)
 
bool getPoison () const
 
void setHaveCart (const bool b)
 
bool getHaveCart () const
 
bool isTrickDead () const
 
const std::set< int32_t > & getStatusEffects () const
 
std::string getStatusEffectsString () const
 
size_t getParticlesCount () const
 
void controlParticleDeleted (const Particle *const particle)
 
- Public Member Functions inherited from CompoundSprite
 CompoundSprite ()
 
 ~CompoundSprite ()
 
bool reset ()
 
bool play (const std::string &action)
 
bool update (const int time)
 
void drawSimple (Graphics *const graphics, const int posX, const int posY) const
 
int getWidth () const
 
int getHeight () const
 
const ImagegetImage () const
 
bool setSpriteDirection (const SpriteDirection::Type direction)
 
int getNumberOfLayers () const
 
unsigned int getCurrentFrame () const
 
unsigned int getFrameCount () const
 
void addSprite (Sprite *const sprite)
 
void setSprite (const size_t layer, Sprite *const sprite)
 
void removeSprite (const int layer)
 
void clear ()
 
void ensureSize (const size_t layerCount)
 
void drawSprites (Graphics *const graphics, const int posX, const int posY) const
 
void setAlpha (float alpha)
 
bool updateNumber (const unsigned num)
 
int getLastTime () const
 
int getStartTime () const
 
- Public Member Functions inherited from Sprite
virtual ~Sprite ()
 
virtual const void * getHash () const
 
virtual const void * getHash2 () const
 
- Public Member Functions inherited from Actor
virtual ~Actor ()
 
const VectorgetPixelPositionF () const
 
int getPixelX () const
 
virtual int getPixelY () const
 
const MapgetMap () const
 
- Public Member Functions inherited from ConfigListener
 ConfigListener ()
 
virtual ~ConfigListener ()
 

Static Public Member Functions

static void reReadConfig ()
 
static BeingCacheEntrygetCacheEntry (const BeingId id)
 
static void clearCache ()
 
static std::string loadComment (const std::string &name, const ActorTypeT &type)
 
static void saveComment (const std::string &name, const std::string &comment, const ActorTypeT &type)
 
static int getHitEffect (const Being *const attacker, const AttackTypeT type, const int attackId, const int level)
 
static uint8_t genderToInt (const GenderT sex) A_CONST
 
static GenderT intToGender (const uint8_t sex) A_CONST
 
static BeingcreateBeing (const BeingId id, const ActorTypeT type, const BeingTypeId subtype, Map *const map)
 
- Static Public Member Functions inherited from ActorSprite
static void load ()
 
static void unload ()
 
- Static Public Member Functions inherited from CompoundSprite
static void setEnableDelay (bool b)
 

Data Fields

NextSoundInfo mNextSound
 
- Data Fields inherited from CompoundSprite
std::vector< Sprite * > mSprites
 
- Data Fields inherited from Actor
int mPixelX
 
int mPixelY
 

Protected Types

typedef std::map< int, ParticleInfo * > SpriteParticleInfo
 
typedef SpriteParticleInfo::iterator SpriteParticleInfoIter
 
- Protected Types inherited from ActorSprite
typedef std::list< ActorSpriteListener * > ActorSpriteListeners
 
typedef ActorSpriteListeners::iterator ActorSpriteListenerIterator
 
- Protected Types inherited from CompoundSprite
typedef std::list< CompoundItem * > ImagesCache
 

Protected Member Functions

void drawPlayerSpriteAt (Graphics *const graphics, const int x, const int y) const
 
void drawOtherSpriteAt (Graphics *const graphics, const int x, const int y) const
 
void drawNpcSpriteAt (Graphics *const graphics, const int x, const int y) const
 
void drawPortalSpriteAt (Graphics *const graphics, const int x, const int y) const
 
void drawMonsterSpriteAt (Graphics *const graphics, const int x, const int y) const
 
void drawHomunculusSpriteAt (Graphics *const graphics, const int x, const int y) const
 
void drawMercenarySpriteAt (Graphics *const graphics, const int x, const int y) const
 
void drawElementalSpriteAt (Graphics *const graphics, const int x, const int y) const
 
void drawCompound (Graphics *const graphics, const int posX, const int posY) const
 
virtual void updateCoords ()
 
void showName ()
 
void addItemParticles (const int id, const SpriteDisplay &display)
 
void addItemParticlesCards (const int id, const SpriteDisplay &display, const CardsList &cards)
 
void removeAllItemsParticles ()
 
void removeItemParticles (const int id)
 
void createSpeechBubble ()
 
void setDefaultNameColor (const UserColorIdT defaultColor)
 
void updateBadgesCount ()
 
void postInit (const BeingTypeId subType, Map *const map)
 
void updateBadgesPosition ()
 
template<signed char pos, signed char neg>
int getOffset () const
 
int searchSlotValue (const std::vector< int > &slotRemap, const int val) const
 
void addSpiritBalls (const unsigned int balls, const int effectId)
 
void removeSpiritBalls (const unsigned int balls)
 
void dumpSprites () const
 
void drawBeingCursor (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void drawCasting (Graphics *const graphics, const int offsetX, const int offsetY) const
 
void updateBotFollow (int dstX, int dstY, const int divX, const int divY)
 
void moveBotTo (int dstX, int dstY)
 
void updateBotDirection (const int dstX, const int dstY)
 
void botFixOffset (int &dstX, int &dstY) const
 
- Protected Member Functions inherited from ActorSprite
virtual void updateStatusEffect (const int32_t index, const Enable newStatus, const IsStart start)
 
virtual void handleStatusEffect (const StatusEffect *const effect, const int32_t effectId, const Enable newStatus, const IsStart start)
 
void setupSpriteDisplay (const SpriteDisplay &display, const ForceDisplay forceDisplay, const DisplayTypeT displayType, const std::string &color)
 
- Protected Member Functions inherited from CompoundSprite
void redraw () const
 
void updateImages () const
 
bool updateFromCache () const
 
void initCurrentCacheItem () const
 
- Protected Member Functions inherited from Sprite
 Sprite ()
 
- Protected Member Functions inherited from Actor
 Actor ()
 

Static Protected Member Functions

static int getDefaultEffectId (const AttackTypeT &type)
 
static void searchSlotValueItr (std::vector< int >::iterator &it, int &idx, std::vector< int > &slotRemap, const int val)
 
- Static Protected Member Functions inherited from ActorSprite
static void initTargetCursor ()
 
static void cleanupTargetCursors ()
 

Protected Attributes

BeingInfomInfo
 
AnimatedSpritemEmotionSprite
 
AnimatedSpritemAnimationEffect
 
CastingEffectmCastingEffect
 
AnimatedSpritemBadges [BadgeIndex::BadgeIndexSize]
 
std::string mSpriteAction
 
std::string mName
 
std::string mExtName
 
std::string mRaceName
 
std::string mPartyName
 
std::string mGuildName
 
std::string mClanName
 
std::string mSpeech
 
FlashTextmDispName
 
const ColormNameColor
 
const ItemInfomEquippedWeapon
 
Path mPath
 
TextmText
 
const ColormTextColor
 
Vector mDest
 
std::vector< BeingSlotmSlots
 
SpriteParticleInfo mSpriteParticles
 
std::map< int, Guild * > mGuilds
 
PartymParty
 
int mActionTime
 
int mEmotionTime
 
int mSpeechTime
 
int mAttackSpeed
 
int mLevel
 
int mGroupId
 
int mAttackRange
 
int mLastAttackX
 
int mLastAttackY
 
int mPreStandTime
 
GenderT mGender
 
BeingActionT mAction
 
BeingTypeId mSubType
 
uint8_t mDirection
 
uint8_t mDirectionDelayed
 
SpriteDirection::Type mSpriteDirection
 
bool mShowName
 
bool mIsGM
 
const ActorTypeT mType
 
SpeechBubblemSpeechBubble
 
int mWalkSpeed
 
int mSpeed
 
std::string mIp
 
int * mSpriteRemap
 
int * mSpriteHide
 
int * mSpriteDraw
 
std::string mComment
 
std::string mBuyBoard
 
std::string mSellBoard
 
BeingmOwner
 
ParticlemSpecialParticle
 
ChatObjectmChat
 
HorseInfomHorseInfo
 
std::vector< AnimatedSprite * > mDownHorseSprites
 
std::vector< AnimatedSprite * > mUpHorseSprites
 
std::vector< Particle * > mSpiritParticles
 
int mX
 
int mY
 
int mCachedX
 
int mCachedY
 
int mSortOffsetY
 
int mPixelOffsetY
 
int mFixedOffsetY
 
uint8_t mOldHeight
 
int mDamageTaken
 
int mHP
 
int mMaxHP
 
int mDistance
 
ReachableT mReachable
 
int mGoodStatus
 
time_t mMoveTime
 
time_t mAttackTime
 
time_t mTalkTime
 
time_t mOtherTime
 
time_t mTestTime
 
int mAttackDelay
 
int mMinHit
 
int mMaxHit
 
int mCriticalHit
 
unsigned int mPvpRank
 
unsigned int mNumber
 
unsigned int mSpiritBalls
 
int mUsageCounter
 
int mKarma
 
int mManner
 
int mAreaSize
 
int mCastEndTime
 
int mLanguageId
 
int mBadgesX
 
int mBadgesY
 
BeingId mCreatorId
 
uint16_t mTeamId
 
uint16_t mLook
 
uint16_t mBadgesCount
 
ItemColor mHairColor
 
bool mErased
 
bool mEnemy
 
bool mGotComment
 
bool mAdvanced
 
bool mShop
 
bool mAway
 
bool mInactive
 
bool mNeedPosUpdate
 
bool mBotAi
 
bool mAllowNpcEquipment
 
- Protected Attributes inherited from ActorSprite
std::set< int32_t > mStatusEffects
 
ParticleVector mStatusParticleEffects
 
ParticleList mChildParticleEffects
 
int mHorseId
 
BeingId mId
 
AnimatedSpritemUsedTargetCursor
 
ActorSpriteListeners mActorSpriteListeners
 
int mCursorPaddingX
 
int mCursorPaddingY
 
bool mMustResetParticles
 
bool mPoison
 
bool mHaveCart
 
bool mTrickDead
 
- Protected Attributes inherited from CompoundSprite
ImagesCache imagesCache
 
CompoundItemmCacheItem
 
ImagemImage
 
ImagemAlphaImage
 
int mOffsetX
 
int mOffsetY
 
int mStartTime
 
int mLastTime
 
int mNextRedrawTime
 
bool mNeedsRedraw
 
bool mEnableAlphaFix
 
bool mDisableAdvBeingCaching
 
bool mDisableBeingCaching
 
- Protected Attributes inherited from Sprite
float mAlpha
 
- Protected Attributes inherited from Actor
MapmMap
 
Vector mPos
 
int mYDiff
 

Static Protected Attributes

static time_t mUpdateConfigTime = 0
 
static unsigned int mConfLineLim = 0
 
static int mSpeechType = 0
 
static bool mHighlightMapPortals = false
 
static bool mHighlightMonsterAttackRange = false
 
static bool mLowTraffic = true
 
static bool mDrawHotKeys = true
 
static bool mShowBattleEvents = false
 
static bool mShowMobHP = false
 
static bool mShowOwnHP = false
 
static bool mShowGender = false
 
static bool mShowLevel = false
 
static bool mShowPlayersStatus = false
 
static bool mEnableReorderSprites = true
 
static bool mHideErased = false
 
static Move mMoveNames = Move_false
 
static bool mUseDiagonal = true
 
static BadgeDrawType::Type mShowBadges = BadgeDrawType::Top
 
static int mAwayEffect = -1
 
static VisibleNamePos::Type mVisibleNamePos = VisibleNamePos::Bottom
 
- Static Protected Attributes inherited from ActorSprite
static AnimatedSpritetargetCursor [static_cast< size_t >(TargetCursorType::NUM_TCT)][static_cast< size_t >(TargetCursorSize::NUM_TC)]
 
static bool loaded = false
 
- Static Protected Attributes inherited from CompoundSprite
static bool mEnableDelay = true
 

Friends

class ActorManager
 
class BeingEquipBackend
 
class LocalPlayer
 

Additional Inherited Members

- Public Types inherited from CompoundSprite
typedef std::vector< Sprite * >::iterator SpriteIterator
 
typedef std::vector< Sprite * >::const_iterator SpriteConstIterator
 

Detailed Description

Definition at line 94 of file being.h.

Member Typedef Documentation

◆ SpriteParticleInfo

typedef std::map<int, ParticleInfo*> Being::SpriteParticleInfo
protected

Definition at line 1203 of file being.h.

◆ SpriteParticleInfoIter

typedef SpriteParticleInfo::iterator Being::SpriteParticleInfoIter
protected

Definition at line 1204 of file being.h.

Constructor & Destructor Documentation

◆ Being()

Being::Being ( const BeingId  id,
const ActorTypeT  type 
)

Constructor.

Parameters
ida unique being id
subtypepartly determines the type of the being
mapthe map the being is on

Definition at line 162 of file being.cpp.

163  :
164  ActorSprite(id),
165  mNextSound(),
167  mEmotionSprite(nullptr),
168  mAnimationEffect(nullptr),
169  mCastingEffect(nullptr),
170  mBadges(),
172  mName(),
173  mExtName(),
174  mRaceName(),
175  mPartyName(),
176  mGuildName(),
177  mClanName(),
178  mSpeech(),
179  mDispName(nullptr),
180  mNameColor(nullptr),
181  mEquippedWeapon(nullptr),
182  mPath(),
183  mText(nullptr),
184  mTextColor(nullptr),
185  mDest(),
186  mSlots(),
188  mGuilds(),
189  mParty(nullptr),
190  mActionTime(0),
191  mEmotionTime(0),
192  mSpeechTime(0),
193  mAttackSpeed(350),
194  mLevel(0),
195  mGroupId(0),
196  mAttackRange(1),
197  mLastAttackX(0),
198  mLastAttackY(0),
199  mPreStandTime(0),
202  mSubType(fromInt(0xFFFF, BeingTypeId)),
206  mShowName(false),
207  mIsGM(false),
208  mType(type),
209  mSpeechBubble(nullptr),
210  mWalkSpeed(playerHandler != nullptr ?
212  mSpeed(playerHandler != nullptr ?
214  mIp(),
215  mSpriteRemap(new int[20]),
216  mSpriteHide(new int[20]),
217  mSpriteDraw(new int[20]),
218  mComment(),
219  mBuyBoard(),
220  mSellBoard(),
221  mOwner(nullptr),
222  mSpecialParticle(nullptr),
223  mChat(nullptr),
224  mHorseInfo(nullptr),
226  mUpHorseSprites(),
228  mX(0),
229  mY(0),
230  mCachedX(0),
231  mCachedY(0),
232  mSortOffsetY(0),
233  mPixelOffsetY(0),
234  mFixedOffsetY(0),
235  mOldHeight(0),
236  mDamageTaken(0),
237  mHP(0),
238  mMaxHP(0),
239  mDistance(0),
241  mGoodStatus(-1),
242  mMoveTime(0),
243  mAttackTime(0),
244  mTalkTime(0),
245  mOtherTime(0),
247  mAttackDelay(0),
248  mMinHit(0),
249  mMaxHit(0),
250  mCriticalHit(0),
251  mPvpRank(0),
252  mNumber(100),
253  mSpiritBalls(0U),
254  mUsageCounter(1),
255  mKarma(0),
256  mManner(0),
257  mAreaSize(11),
258  mCastEndTime(0),
259  mLanguageId(-1),
260  mBadgesX(0),
261  mBadgesY(0),
263  mTeamId(0U),
264  mLook(0U),
265  mBadgesCount(0U),
267  mErased(false),
268  mEnemy(false),
269  mGotComment(false),
270  mAdvanced(false),
271  mShop(false),
272  mAway(false),
273  mInactive(false),
274  mNeedPosUpdate(true),
275  mBotAi(true),
276  mAllowNpcEquipment(false)
277 {
278  for (int f = 0; f < 20; f ++)
279  {
280  mSpriteRemap[f] = f;
281  mSpriteHide[f] = 0;
282  mSpriteDraw[f] = 0;
283  }
284 
286  mBadges[f] = nullptr;
287 }
#define for_each_badges()
Definition: being.cpp:156
volatile time_t cur_time
Definition: timer.cpp:58
const BeingId BeingId_zero
Definition: beingid.h:30
int BeingTypeId
Definition: beingtypeid.h:30
ActorSprite(const BeingId id)
Definition: actorsprite.cpp:69
static BeingInfo * unknown
Definition: beinginfo.h:56
bool mNeedPosUpdate
Definition: being.h:1384
uint16_t mLook
Definition: being.h:1374
bool mAway
Definition: being.h:1382
int mLanguageId
Definition: being.h:1369
bool mIsGM
Definition: being.h:1235
Text * mText
Definition: being.h:1198
int mAreaSize
Definition: being.h:1367
SpriteParticleInfo mSpriteParticles
Definition: being.h:1207
time_t mMoveTime
Definition: being.h:1352
ReachableT mReachable
Definition: being.h:1328
int mKarma
Definition: being.h:1365
int mFixedOffsetY
Definition: being.h:1321
int mLastAttackX
Definition: being.h:1223
int mX
Definition: being.h:1314
int mBadgesX
Definition: being.h:1370
int mDamageTaken
Definition: being.h:1324
std::string mPartyName
Definition: being.h:1183
std::string mGuildName
Definition: being.h:1184
int mY
Definition: being.h:1315
int mDistance
Definition: being.h:1327
CastingEffect * mCastingEffect
Definition: being.h:1176
std::string mIp
Definition: being.h:1299
uint8_t mDirectionDelayed
Definition: being.h:1232
int mSpeechTime
Definition: being.h:1217
const Color * mNameColor
Definition: being.h:1192
SpriteDirection::Type mSpriteDirection
Definition: being.h:1233
int mManner
Definition: being.h:1366
AnimatedSprite * mAnimationEffect
Definition: being.h:1175
NextSoundInfo mNextSound
Definition: being.h:954
std::string mSellBoard
Definition: being.h:1305
bool mEnemy
Definition: being.h:1378
bool mErased
Definition: being.h:1377
int * mSpriteHide
Definition: being.h:1301
std::string mSpeech
Definition: being.h:1186
const Color * mTextColor
Definition: being.h:1199
BeingId mCreatorId
Definition: being.h:1372
std::string mClanName
Definition: being.h:1185
ItemColor mHairColor
Definition: being.h:1376
int mUsageCounter
Definition: being.h:1364
bool mGotComment
Definition: being.h:1379
AnimatedSprite * mEmotionSprite
Definition: being.h:1174
bool mBotAi
Definition: being.h:1385
int * mSpriteDraw
Definition: being.h:1302
std::map< int, Guild * > mGuilds
Definition: being.h:1210
std::string mName
Definition: being.h:1180
time_t mTalkTime
Definition: being.h:1354
int mMaxHP
Definition: being.h:1326
SpeechBubble * mSpeechBubble
Definition: being.h:1290
time_t mTestTime
Definition: being.h:1356
int mAttackRange
Definition: being.h:1222
std::vector< Particle * > mSpiritParticles
Definition: being.h:1312
uint16_t mBadgesCount
Definition: being.h:1375
std::string mRaceName
Definition: being.h:1182
unsigned int mPvpRank
Definition: being.h:1361
int mSortOffsetY
Definition: being.h:1318
std::string mBuyBoard
Definition: being.h:1304
GenderT mGender
Definition: being.h:1228
std::vector< BeingSlot > mSlots
Definition: being.h:1206
int mHP
Definition: being.h:1325
const ItemInfo * mEquippedWeapon
Definition: being.h:1195
AnimatedSprite * mBadges[BadgeIndex::BadgeIndexSize]
Definition: being.h:1177
bool mAllowNpcEquipment
Definition: being.h:1386
Vector mDest
Definition: being.h:1201
ChatObject * mChat
Definition: being.h:1308
int mGoodStatus
Definition: being.h:1329
uint16_t mTeamId
Definition: being.h:1373
int mCastEndTime
Definition: being.h:1368
int mActionTime
Definition: being.h:1213
int mLastAttackY
Definition: being.h:1224
Being * mOwner
Definition: being.h:1306
BeingTypeId mSubType
Definition: being.h:1230
HorseInfo * mHorseInfo
Definition: being.h:1309
time_t mOtherTime
Definition: being.h:1355
uint8_t mOldHeight
Definition: being.h:1322
int mGroupId
Definition: being.h:1221
bool mInactive
Definition: being.h:1383
BeingInfo * mInfo
Definition: being.h:1173
std::string mExtName
Definition: being.h:1181
bool mShop
Definition: being.h:1381
int mMaxHit
Definition: being.h:1359
FlashText * mDispName
Definition: being.h:1191
int mEmotionTime
Definition: being.h:1214
int mCachedX
Definition: being.h:1316
std::vector< AnimatedSprite * > mDownHorseSprites
Definition: being.h:1310
std::string mComment
Definition: being.h:1303
Party * mParty
Definition: being.h:1211
int mPixelOffsetY
Definition: being.h:1319
int mCachedY
Definition: being.h:1317
int mCriticalHit
Definition: being.h:1360
const ActorTypeT mType
Definition: being.h:1287
int mPreStandTime
Definition: being.h:1226
Particle * mSpecialParticle
Definition: being.h:1307
bool mAdvanced
Definition: being.h:1380
int mMinHit
Definition: being.h:1358
int mBadgesY
Definition: being.h:1371
uint8_t mDirection
Definition: being.h:1231
int mAttackDelay
Definition: being.h:1357
BeingActionT mAction
Definition: being.h:1229
int * mSpriteRemap
Definition: being.h:1300
int mLevel
Definition: being.h:1220
std::string mSpriteAction
Definition: being.h:1179
unsigned int mNumber
Definition: being.h:1362
int mAttackSpeed
Definition: being.h:1218
time_t mAttackTime
Definition: being.h:1353
int mWalkSpeed
Definition: being.h:1297
std::vector< AnimatedSprite * > mUpHorseSprites
Definition: being.h:1311
bool mShowName
Definition: being.h:1234
Path mPath
Definition: being.h:1197
unsigned int mSpiritBalls
Definition: being.h:1363
int mSpeed
Definition: being.h:1298
virtual int getDefaultWalkSpeed() const =0
#define fromInt(val, name)
Definition: intdefines.h:46
const ItemColor ItemColor_zero
Definition: itemcolor.h:30
@ UNSPECIFIED
Definition: gender.h:33
@ REACH_UNKNOWN
Definition: reachable.h:31
static const std::string STAND("stand")
Net::PlayerHandler * playerHandler
Definition: net.cpp:96

References for_each_badges, mBadges, mSpriteDraw, mSpriteHide, and mSpriteRemap.

Referenced by createBeing().

◆ ~Being()

Being::~Being ( )

Definition at line 337 of file being.cpp.

338 {
339  config.removeListener("visiblenames", this);
341 
342  delete [] mSpriteRemap;
343  mSpriteRemap = nullptr;
344  delete [] mSpriteHide;
345  mSpriteHide = nullptr;
346  delete [] mSpriteDraw;
347  mSpriteDraw = nullptr;
348 
350  delete2(mBadges[f])
351 
354  delete2(mText)
358  mBadgesCount = 0;
359  delete2(mChat)
360  removeHorse();
361 
364 }
void removeAllItemsParticles()
Definition: being.cpp:5037
void removeHorse()
Definition: being.cpp:5404
void removeListener(const std::string &key, ConfigListener *const listener)
Configuration config
#define delete2(var)
Definition: delete2.h:25
#define CHECKLISTENERS
Definition: localconsts.h:277

References CHECKLISTENERS, config, delete2, for_each_badges, mAnimationEffect, mBadges, mBadgesCount, mCastingEffect, mChat, mDispName, mEmotionSprite, mSpeechBubble, mSpiritParticles, mSpriteDraw, mSpriteHide, mSpriteRemap, mText, removeAllItemsParticles(), removeHorse(), and Configuration::removeListener().

Member Function Documentation

◆ addAfkEffect()

void Being::addAfkEffect ( )

Definition at line 4918 of file being.cpp.

4919 {
4921 }
static int mAwayEffect
Definition: being.h:1349
void addSpecialEffect(const int effect)
Definition: being.cpp:4928

References addSpecialEffect(), and mAwayEffect.

Referenced by GameModifiers::changeAwayMode(), and updateAwayEffect().

◆ addCast()

void Being::addCast ( const int  dstX,
const int  dstY,
const int  skillId,
const int  skillLevel,
const int  range,
const int  waitTimeTicks 
)

Definition at line 5369 of file being.cpp.

5375 {
5376  if (waitTimeTicks <= 0)
5377  {
5378  mCastEndTime = 0;
5379  return;
5380  }
5381  mCastEndTime = tick_time + waitTimeTicks;
5383  skillId,
5384  skillLevel);
5386  if (data != nullptr)
5387  {
5388  const std::string castingAnimation = data->castingAnimation;
5389  mCastingEffect = new CastingEffect(skillId,
5390  skillLevel,
5391  castingAnimation,
5392  dstX,
5393  dstY,
5394  range);
5396  }
5397  else
5398  {
5399  reportAlways("Want to draw casting for unknown skill %d",
5400  skillId)
5401  }
5402 }
#define reportAlways(...)
Definition: checkutils.h:253
virtual void setMap(Map *const map)
Definition: actor.cpp:48
Map * mMap
Definition: actor.h:139
SkillData * getSkillDataByLevel(const int id, const int level) const
uint32_t data
volatile int tick_time
Definition: timer.cpp:53
SkillDialog * skillDialog
Definition: skilldialog.cpp:66

References data, delete2, SkillDialog::getSkillDataByLevel(), mCastEndTime, mCastingEffect, Actor::mMap, reportAlways, Actor::setMap(), skillDialog, and tick_time.

Referenced by EAthena::BeingRecv::processSkillCastingContinue().

◆ addEffect()

void Being::addEffect ( const std::string &  name)

Definition at line 4959 of file being.cpp.

4960 {
4961  delete mAnimationEffect;
4963  paths.getStringValue("sprites") + name,
4964  0);
4965 }
static AnimatedSprite * load(const std::string &filename, const int variant)
std::string getStringValue(const std::string &key) const
Configuration paths

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

Referenced by EffectManager::trigger(), and EffectManager::triggerReturn().

◆ addGuild()

void Being::addGuild ( Guild *const  guild)

Adds a guild to the being.

Definition at line 1237 of file being.cpp.

1238 {
1239  if (guild == nullptr)
1240  return;
1241 
1242  mGuilds[guild->getId()] = guild;
1243 
1244  if (this == localPlayer && (socialWindow != nullptr))
1246 }
bool addTab(Guild *const guild)
LocalPlayer * localPlayer
uint32_t guild
SocialWindow * socialWindow

References SocialWindow::addTab(), guild, localPlayer, anonymous_namespace{badgesdb.cpp}::mGuilds, and socialWindow.

Referenced by GuildManager::createTab(), and EAthena::GuildRecv::processGuildPositionInfo().

◆ addItemParticles()

void Being::addItemParticles ( const int  id,
const SpriteDisplay display 
)
protected

Definition at line 5044 of file being.cpp.

5046 {
5047  const SpriteParticleInfoIter it = mSpriteParticles.find(id);
5048  ParticleInfo *restrict pi = nullptr;
5049  if (it == mSpriteParticles.end())
5050  {
5051  pi = new ParticleInfo;
5052  mSpriteParticles[id] = pi;
5053  }
5054  else
5055  {
5056  pi = (*it).second;
5057  }
5058 
5059  if ((pi == nullptr) || !pi->particles.empty())
5060  return;
5061 
5062  // setup particle effects
5064  (particleEngine != nullptr))
5065  {
5066  FOR_EACH (StringVectCIter, itr, display.particles)
5067  {
5068  Particle *const p = particleEngine->addEffect(*itr, 0, 0, 0);
5070  pi->files.push_back(*itr);
5071  pi->particles.push_back(p);
5072  }
5073  }
5074  else
5075  {
5076  FOR_EACH (StringVectCIter, itr, display.particles)
5077  pi->files.push_back(*itr);
5078  }
5079 }
void controlCustomParticle(Particle *const particle)
SpriteParticleInfo::iterator SpriteParticleInfoIter
Definition: being.h:1204
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation)
static bool enabled
#define FOR_EACH(type, iter, array)
Definition: foreach.h:25
#define restrict
Definition: localconsts.h:165
ParticleEngine * particleEngine
StringVect::const_iterator StringVectCIter
Definition: stringvector.h:31
StringVect particles
Definition: spritedisplay.h:48

References ParticleEngine::addEffect(), ParticleEngine::enabled, FOR_EACH, particleEngine, and restrict.

◆ addItemParticlesCards()

void Being::addItemParticlesCards ( const int  id,
const SpriteDisplay display,
const CardsList cards 
)
protected

Definition at line 5081 of file being.cpp.

5084 {
5085  const SpriteParticleInfoIter it = mSpriteParticles.find(id);
5086  ParticleInfo *restrict pi = nullptr;
5087  if (it == mSpriteParticles.end())
5088  {
5089  pi = new ParticleInfo;
5090  mSpriteParticles[id] = pi;
5091  }
5092  else
5093  {
5094  pi = (*it).second;
5095  }
5096 
5097  if ((pi == nullptr) || !pi->particles.empty())
5098  return;
5099 
5100  // setup particle effects
5102  (particleEngine != nullptr))
5103  {
5104  FOR_EACH (StringVectCIter, itr, display.particles)
5105  {
5106  Particle *const p = particleEngine->addEffect(*itr, 0, 0, 0);
5108  pi->files.push_back(*itr);
5109  pi->particles.push_back(p);
5110  }
5111  for (int f = 0; f < maxCards; f ++)
5112  {
5113  const int cardId = cards.cards[f];
5114  if (!Item::isItem(cardId))
5115  continue;
5116  const ItemInfo &info = ItemDB::get(cardId);
5117  const SpriteDisplay &restrict display2 = info.getDisplay();
5118  FOR_EACH (StringVectCIter, itr, display2.particles)
5119  {
5120  Particle *const p = particleEngine->addEffect(*itr, 0, 0, 0);
5122  pi->files.push_back(*itr);
5123  pi->particles.push_back(p);
5124  }
5125  }
5126  }
5127  else
5128  {
5129  FOR_EACH (StringVectCIter, itr, display.particles)
5130  {
5131  pi->files.push_back(*itr);
5132  }
5133  for (int f = 0; f < maxCards; f ++)
5134  {
5135  const int cardId = cards.cards[f];
5136  if (!Item::isItem(cardId))
5137  continue;
5138  const ItemInfo &info = ItemDB::get(cardId);
5139  const SpriteDisplay &restrict display2 = info.getDisplay();
5140  FOR_EACH (StringVectCIter, itr, display2.particles)
5141  {
5142  pi->files.push_back(*itr);
5143  }
5144  }
5145  }
5146 }
#define maxCards
Definition: cards.h:25
static bool isItem(const int id)
Definition: item.h:238
bool info(InputEvent &event)
Definition: commands.cpp:57
const ItemInfo & get(const int id)
Definition: itemdb.cpp:792
int cards[4]
Definition: cardslist.h:68

References ParticleEngine::addEffect(), ParticleEngine::enabled, FOR_EACH, ItemDB::get(), Actions::info(), Item::isItem(), maxCards, particleEngine, and restrict.

◆ addSpecialEffect()

void Being::addSpecialEffect ( const int  effect)

Definition at line 4928 of file being.cpp.

4929 {
4930  if ((effectManager != nullptr) &&
4932  (mSpecialParticle == nullptr) &&
4933  effect != -1)
4934  {
4936  this,
4937  0);
4938  }
4939 }
Particle * triggerReturn(const int id, Being *const being, const int rotation)
EffectManager * effectManager

References effectManager, ParticleEngine::enabled, and EffectManager::triggerReturn().

Referenced by addAfkEffect(), QuestsWindow::addEffect(), and ActorManager::updateEffects().

◆ addSpiritBalls()

void Being::addSpiritBalls ( const unsigned int  balls,
const int  effectId 
)
protected

Definition at line 5495 of file being.cpp.

5497 {
5498  if (effectManager == nullptr)
5499  return;
5500  for (unsigned int f = 0; f < balls; f ++)
5501  {
5502  Particle *const particle = effectManager->triggerReturn(
5503  effectId,
5504  this,
5505  0);
5506  mSpiritParticles.push_back(particle);
5507  }
5508 }

References effectManager, and EffectManager::triggerReturn().

◆ addToCache()

void Being::addToCache ( ) const

Definition at line 3513 of file being.cpp.

3514 {
3515  if (localPlayer == this)
3516  return;
3517 
3519  if (entry == nullptr)
3520  {
3521  entry = new BeingCacheEntry(getId());
3522  beingInfoCache.push_front(entry);
3523 
3524  if (beingInfoCache.size() >= CACHE_SIZE)
3525  {
3526  delete beingInfoCache.back();
3527  beingInfoCache.pop_back();
3528  }
3529  }
3530  if (!mLowTraffic)
3531  return;
3532 
3533  entry->setName(mName);
3534  entry->setLevel(getLevel());
3535  entry->setPartyName(getPartyName());
3536  entry->setGuildName(getGuildName());
3537  entry->setTime(cur_time);
3538  entry->setPvpRank(getPvpRank());
3539  entry->setIp(getIp());
3540  entry->setAdvanced(isAdvanced());
3541  entry->setTeamId(getTeamId());
3542  if (isAdvanced())
3543  {
3544  int flags = 0;
3546  flags += BeingFlag::SHOP;
3547  if (mAway)
3548  flags += BeingFlag::AWAY;
3549  if (mInactive)
3550  flags += BeingFlag::INACTIVE;
3551  entry->setFlags(flags);
3552  }
3553  else
3554  {
3555  entry->setFlags(0);
3556  }
3557 }
const unsigned int CACHE_SIZE
Definition: being.cpp:125
std::list< BeingCacheEntry * > beingInfoCache
Definition: being.cpp:148
BeingId getId() const
Definition: actorsprite.h:64
void setFlags(const int flags)
void setGuildName(const std::string &name)
void setPartyName(const std::string &name)
void setIp(const std::string &ip)
void setLevel(const int n)
void setTime(const time_t n)
void setAdvanced(const bool a)
void setTeamId(const uint16_t teamId)
void setName(const std::string &name)
void setPvpRank(const int r)
static BeingCacheEntry * getCacheEntry(const BeingId id)
Definition: being.cpp:3559
virtual int getLevel() const
Definition: being.h:604
uint16_t getTeamId() const
Definition: being.h:1082
const std::string & getPartyName() const
Definition: being.h:255
const std::string & getGuildName() const
Definition: being.h:259
static bool mLowTraffic
Definition: being.h:1336
const std::string & getIp() const
Definition: being.h:743
bool isAdvanced() const
Definition: being.h:828
unsigned int getPvpRank() const
Definition: being.h:749
@ INACTIVE
Definition: beingflag.h:31
ServerTypeT getNetworkType()
Definition: net.cpp:189

References BeingFlag::AWAY, beingInfoCache, CACHE_SIZE, cur_time, getCacheEntry(), getGuildName(), ActorSprite::getId(), getIp(), getLevel(), Net::getNetworkType(), getPartyName(), getPvpRank(), getTeamId(), BeingFlag::INACTIVE, isAdvanced(), localPlayer, mAway, mInactive, mLowTraffic, mName, mShop, BeingCacheEntry::setAdvanced(), BeingCacheEntry::setFlags(), BeingCacheEntry::setGuildName(), BeingCacheEntry::setIp(), BeingCacheEntry::setLevel(), BeingCacheEntry::setName(), BeingCacheEntry::setPartyName(), BeingCacheEntry::setPvpRank(), BeingCacheEntry::setTeamId(), BeingCacheEntry::setTime(), BeingFlag::SHOP, and ServerType::TMWATHENA.

Referenced by ActorManager::logic(), ActorManager::parseLevels(), EAthena::GuildRecv::processGuildSetPosition(), Ea::BeingRecv::processNameResponse(), EAthena::BeingRecv::processNameResponse2(), EAthena::BeingRecv::processNameResponseTitle(), EAthena::BeingRecv::processPlayerGuilPartyInfo(), TmwAthena::BeingRecv::processPlayerGuilPartyInfo(), EAthena::BeingRecv::processPlayerGuilPartyInfo2(), TmwAthena::BeingRecv::processPvpSet(), and setAdvanced().

◆ botFixOffset()

void Being::botFixOffset ( int &  dstX,
int &  dstY 
) const
protected

Definition at line 2080 of file being.cpp.

2082 {
2083  if ((mInfo == nullptr) || (mOwner == nullptr))
2084  return;
2085 
2086  int offsetX1;
2087  int offsetY1;
2088  switch (mOwner->getCurrentAction())
2089  {
2090  case BeingAction::SIT:
2091  offsetX1 = mInfo->getSitOffsetX();
2092  offsetY1 = mInfo->getSitOffsetY();
2093  break;
2094 
2095  case BeingAction::MOVE:
2096  offsetX1 = mInfo->getMoveOffsetX();
2097  offsetY1 = mInfo->getMoveOffsetY();
2098  break;
2099 
2100  case BeingAction::DEAD:
2101  offsetX1 = mInfo->getDeadOffsetX();
2102  offsetY1 = mInfo->getDeadOffsetY();
2103  break;
2104 
2105  case BeingAction::ATTACK:
2106  offsetX1 = mInfo->getAttackOffsetX();
2107  offsetY1 = mInfo->getAttackOffsetY();
2108  break;
2109 
2110  case BeingAction::SPAWN:
2111  case BeingAction::HURT:
2112  case BeingAction::STAND:
2113  case BeingAction::PRESTAND:
2114  case BeingAction::CAST:
2115  default:
2116  offsetX1 = mInfo->getTargetOffsetX();
2117  offsetY1 = mInfo->getTargetOffsetY();
2118  break;
2119  }
2120 
2121  int offsetX = offsetX1;
2122  int offsetY = offsetY1;
2123  switch (mOwner->mDirection)
2124  {
2125  case BeingDirection::LEFT:
2126  offsetX = -offsetY1;
2127  offsetY = offsetX1;
2128  break;
2129  case BeingDirection::RIGHT:
2130  offsetX = offsetY1;
2131  offsetY = -offsetX1;
2132  break;
2133  case BeingDirection::UP:
2134  offsetY = -offsetY;
2135  offsetX = -offsetX;
2136  break;
2137  default:
2138  case BeingDirection::DOWN:
2139  break;
2140  }
2141  dstX += offsetX;
2142  dstY += offsetY;
2143  if (mMap != nullptr)
2144  {
2145  if (!mMap->getWalk(dstX, dstY, getBlockWalkMask()))
2146  {
2147  dstX = mOwner->mX;
2148  dstY = mOwner->mY;
2149  }
2150  }
2151 }
int getTargetOffsetY() const
Definition: beinginfo.h:141
int getDeadOffsetX() const
Definition: beinginfo.h:267
int getSitOffsetX() const
Definition: beinginfo.h:243
int getSitOffsetY() const
Definition: beinginfo.h:249
int getAttackOffsetX() const
Definition: beinginfo.h:279
int getMoveOffsetY() const
Definition: beinginfo.h:261
int getTargetOffsetX() const
Definition: beinginfo.h:135
int getDeadOffsetY() const
Definition: beinginfo.h:273
int getAttackOffsetY() const
Definition: beinginfo.h:285
int getMoveOffsetX() const
Definition: beinginfo.h:255
virtual unsigned char getBlockWalkMask() const
Definition: being.h:432
BeingActionT getCurrentAction() const
Definition: being.h:482
bool getWalk(const int x, const int y, const unsigned char blockWalkMask) const
Definition: map.cpp:785

References BeingAction::ATTACK, BeingAction::CAST, BeingAction::DEAD, BeingDirection::DOWN, BeingInfo::getAttackOffsetX(), BeingInfo::getAttackOffsetY(), getBlockWalkMask(), getCurrentAction(), BeingInfo::getDeadOffsetX(), BeingInfo::getDeadOffsetY(), BeingInfo::getMoveOffsetX(), BeingInfo::getMoveOffsetY(), BeingInfo::getSitOffsetX(), BeingInfo::getSitOffsetY(), BeingInfo::getTargetOffsetX(), BeingInfo::getTargetOffsetY(), Map::getWalk(), BeingAction::HURT, BeingDirection::LEFT, mDirection, mInfo, Actor::mMap, BeingAction::MOVE, mOwner, mX, mY, BeingAction::PRESTAND, BeingDirection::RIGHT, BeingAction::SIT, BeingAction::SPAWN, BeingAction::STAND, and BeingDirection::UP.

Referenced by botLogic(), and updateBotFollow().

◆ botLogic()

void Being::botLogic ( )

Definition at line 1999 of file being.cpp.

2000 {
2001  if ((mOwner == nullptr) || (mMap == nullptr) || (mInfo == nullptr))
2002  return;
2003 
2004  const int time = tick_time;
2005  const int thinkTime = mInfo->getThinkTime();
2006  if (abs(CAST_S32(mMoveTime) - time) < thinkTime)
2007  return;
2008 
2009  mMoveTime = time;
2010 
2011  int dstX = mOwner->mX;
2012  int dstY = mOwner->mY;
2013  const int warpDist = mInfo->getWarpDist();
2014  const int divX = abs(dstX - mX);
2015  const int divY = abs(dstY - mY);
2016 
2017  if (divX >= warpDist || divY >= warpDist)
2018  {
2021  else
2023  mBotAi = true;
2024  return;
2025  }
2026  if (!mBotAi)
2027  return;
2028  if (mAction == BeingAction::MOVE)
2029  {
2031  {
2032  updateBotFollow(dstX, dstY,
2033  divX, divY);
2034  }
2035  return;
2036  }
2037 
2038  switch (mOwner->mAction)
2039  {
2040  case BeingAction::MOVE:
2041  case BeingAction::PRESTAND:
2042  updateBotFollow(dstX, dstY,
2043  divX, divY);
2044  break;
2045  case BeingAction::STAND:
2046  case BeingAction::SPAWN:
2047  botFixOffset(dstX, dstY);
2048  moveBotTo(dstX, dstY);
2049  break;
2050  case BeingAction::ATTACK:
2051  {
2052  const Being *const target = localPlayer->getTarget();
2053  if (target == nullptr)
2054  return;
2055  const BeingId targetId = target->getId();
2057  {
2058  homunculusHandler->attack(targetId,
2059  Keep_true);
2060  }
2061  else
2062  {
2063  mercenaryHandler->attack(targetId,
2064  Keep_true);
2065  }
2066  break;
2067  }
2068  case BeingAction::SIT:
2069  case BeingAction::DEAD:
2070  botFixOffset(dstX, dstY);
2071  moveBotTo(dstX, dstY);
2072  break;
2073  case BeingAction::CAST:
2074  case BeingAction::HURT:
2075  default:
2076  break;
2077  }
2078 }
int BeingId
Definition: beingid.h:30
#define CAST_S32
Definition: cast.h:30
int getThinkTime() const
Definition: beinginfo.h:291
int getWarpDist() const
Definition: beinginfo.h:237
Definition: being.h:96
void updateBotFollow(int dstX, int dstY, const int divX, const int divY)
Definition: being.cpp:2153
void moveBotTo(int dstX, int dstY)
Definition: being.cpp:2192
void botFixOffset(int &dstX, int &dstY) const
Definition: being.cpp:2080
Being * getTarget() const
virtual void moveToMaster() const =0
virtual void attack(const BeingId targetId, const Keep keep) const =0
virtual void moveToMaster() const =0
virtual void attack(const BeingId targetId, const Keep keep) const =0
Net::HomunculusHandler * homunculusHandler
Definition: net.cpp:112
const bool Keep_true
Definition: keep.h:30
Net::MercenaryHandler * mercenaryHandler
Definition: net.cpp:118
@ Homunculus
Definition: actortype.h:39

References BeingAction::ATTACK, Net::HomunculusHandler::attack(), Net::MercenaryHandler::attack(), botFixOffset(), BeingAction::CAST, CAST_S32, BeingAction::DEAD, ActorSprite::getId(), LocalPlayer::getTarget(), BeingInfo::getThinkTime(), BeingInfo::getWarpDist(), ActorType::Homunculus, homunculusHandler, BeingAction::HURT, Keep_true, localPlayer, mAction, mBotAi, mercenaryHandler, mInfo, Actor::mMap, mMoveTime, BeingAction::MOVE, moveBotTo(), Net::HomunculusHandler::moveToMaster(), Net::MercenaryHandler::moveToMaster(), mOwner, mType, mX, mY, BeingAction::PRESTAND, BeingAction::SIT, BeingAction::SPAWN, BeingAction::STAND, tick_time, and updateBotFollow().

Referenced by logic().

◆ calcDirection() [1/2]

uint8_t Being::calcDirection ( ) const

Definition at line 1753 of file being.cpp.

1754 {
1755  uint8_t dir = 0;
1756  if (mDest.x > mX)
1757  dir |= BeingDirection::RIGHT;
1758  else if (mDest.x < mX)
1759  dir |= BeingDirection::LEFT;
1760  if (mDest.y > mY)
1761  dir |= BeingDirection::DOWN;
1762  else if (mDest.y < mY)
1763  dir |= BeingDirection::UP;
1764  return dir;
1765 }
float y
Definition: vector.h:209
float x
Definition: vector.h:209

References BeingDirection::DOWN, BeingDirection::LEFT, mDest, mX, mY, BeingDirection::RIGHT, BeingDirection::UP, Vector::x, and Vector::y.

Referenced by nextTile().

◆ calcDirection() [2/2]

uint8_t Being::calcDirection ( const int  dstX,
const int  dstY 
) const

Definition at line 1767 of file being.cpp.

1769 {
1770  uint8_t dir = 0;
1771  if (dstX > mX)
1772  dir |= BeingDirection::RIGHT;
1773  else if (dstX < mX)
1774  dir |= BeingDirection::LEFT;
1775  if (dstY > mY)
1776  dir |= BeingDirection::DOWN;
1777  else if (dstY < mY)
1778  dir |= BeingDirection::UP;
1779  return dir;
1780 }

References BeingDirection::DOWN, BeingDirection::LEFT, BeingDirection::RIGHT, and BeingDirection::UP.

Referenced by EAthena::BeingRecv::processBeingMove(), and TmwAthena::BeingRecv::processPlayerMove().

◆ canTalk()

bool Being::canTalk ( ) const
inline

Definition at line 667 of file being.h.

668  { return mType == ActorType::Npc; }

References mType, and ActorType::Npc.

◆ clearCache()

void Being::clearCache ( )
static

Definition at line 4719 of file being.cpp.

4720 {
4722  beingInfoCache.clear();
4723 }
void delete_all(Container &c)
Definition: dtor.h:56

References beingInfoCache, and delete_all().

Referenced by Game::~Game().

◆ clearGuilds()

void Being::clearGuilds ( )

Removes all guilds the being is in.

Definition at line 1289 of file being.cpp.

1290 {
1292  {
1293  Guild *const guild = itr->second;
1294 
1295  if (guild != nullptr)
1296  {
1297  if (this == localPlayer && (socialWindow != nullptr))
1299 
1300  guild->removeMember(mId);
1301  }
1302  }
1303 
1304  mGuilds.clear();
1305 }
std::map< int, Guild * >::const_iterator GuildsMapCIter
Definition: being.cpp:149
BeingId mId
Definition: actorsprite.h:247
Definition: guild.h:70
bool removeTab(Guild *const guild)

References FOR_EACH, guild, localPlayer, mGuilds, ActorSprite::mId, SocialWindow::removeTab(), and socialWindow.

Referenced by GuildManager::afterRemove(), GuildManager::process(), EAthena::GuildRecv::processGuildExpulsionContinue(), EAthena::GuildRecv::processGuildLeave(), EAthena::GuildRecv::processGuildLeave2(), TmwAthena::BeingRecv::processPlayerMove(), TmwAthena::BeingRecv::processPlayerUpdate1(), TmwAthena::BeingRecv::processPlayerUpdate2(), and updateGuild().

◆ clearPath()

void Being::clearPath ( )

Removes all path nodes from this being.

Definition at line 554 of file being.cpp.

555 {
556  mPath.clear();
557 }

References mPath.

Referenced by EAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processBeingVisible(), and LocalPlayer::stopWalking().

◆ createBeing()

Being * Being::createBeing ( const BeingId  id,
const ActorTypeT  type,
const BeingTypeId  subtype,
Map *const  map 
)
static

Definition at line 5575 of file being.cpp.

5579 {
5580  Being *const being = new Being(id,
5581  type);
5582  being->postInit(subType,
5583  map);
5584  return being;
5585 }
Being(const BeingId id, const ActorTypeT type)
Definition: being.cpp:162
void postInit(const BeingTypeId subType, Map *const map)
Definition: being.cpp:289

References Being(), and postInit().

Referenced by ActorManager::createBeing(), and NpcDialog::showAvatar().

◆ createSpeechBubble()

void Being::createSpeechBubble ( )
protected

Definition at line 366 of file being.cpp.

367 {
369 }
#define CREATEWIDGETV0(var, type)
Definition: createwidget.h:32

References CREATEWIDGETV0, and mSpeechBubble.

◆ decUsage()

int Being::decUsage ( )
inline

Definition at line 971 of file being.h.

972  { return --mUsageCounter; }

References mUsageCounter.

◆ disableBotAi()

void Being::disableBotAi ( )
inline

Definition at line 1043 of file being.h.

1044  { mBotAi = false; }

References mBotAi.

◆ draw()

void Being::draw ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const
virtual

Draws the Actor to the given graphics context.

Note: this function could be simplified if the graphics context would support setting a translation offset. It already does this partly with the clipping rectangle support.

Implements Actor.

Definition at line 3839 of file being.cpp.

3842 {
3843  switch (mType)
3844  {
3845  case ActorType::Player:
3846  drawPlayer(graphics,
3847  offsetX,
3848  offsetY);
3849  break;
3850  case ActorType::Portal:
3851  drawPortal(graphics,
3852  offsetX,
3853  offsetY);
3854  break;
3855  case ActorType::Homunculus:
3856  drawHomunculus(graphics,
3857  offsetX,
3858  offsetY);
3859  break;
3860  case ActorType::Mercenary:
3861  drawMercenary(graphics,
3862  offsetX,
3863  offsetY);
3864  break;
3865  case ActorType::Elemental:
3866  drawElemental(graphics,
3867  offsetX,
3868  offsetY);
3869  break;
3870  case ActorType::Monster:
3871  drawMonster(graphics,
3872  offsetX,
3873  offsetY);
3874  break;
3875  case ActorType::Npc:
3876  drawNpc(graphics,
3877  offsetX,
3878  offsetY);
3879  break;
3880  case ActorType::Pet:
3881  case ActorType::SkillUnit:
3882  case ActorType::Unknown:
3883  case ActorType::FloorItem:
3884  case ActorType::Avatar:
3885  default:
3886  drawOther(graphics,
3887  offsetX,
3888  offsetY);
3889  break;
3890  }
3891 }
void drawElemental(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3816
void drawOther(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3756
void drawPlayer(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3694
void drawNpc(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3768
void drawMonster(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3780
void drawHomunculus(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3792
void drawMercenary(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3804
void drawPortal(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3828
@ Mercenary
Definition: actortype.h:38
@ SkillUnit
Definition: actortype.h:40
@ Elemental
Definition: actortype.h:41
@ FloorItem
Definition: actortype.h:34

References ActorType::Avatar, ActorType::Elemental, ActorType::FloorItem, ActorType::Homunculus, ActorType::Mercenary, ActorType::Monster, ActorType::Npc, ActorType::Pet, ActorType::Player, ActorType::Portal, ActorType::SkillUnit, and ActorType::Unknown.

Referenced by DebugWindow::draw(), and DebugWindow::safeDraw().

◆ drawBasic()

void Being::drawBasic ( Graphics *const  graphics,
const int  x,
const int  y 
) const

Definition at line 3930 of file being.cpp.

3933 {
3934  drawCompound(graphics, x, y);
3935 }
void drawCompound(Graphics *const graphics, const int posX, const int posY) const
Definition: being.cpp:3937

References x, and y.

Referenced by PlayerBox::draw().

◆ drawBeingCursor()

void Being::drawBeingCursor ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const
protected

Definition at line 3734 of file being.cpp.

3737 {
3738  if (mUsedTargetCursor != nullptr)
3739  {
3741  if (mInfo == nullptr)
3742  {
3743  mUsedTargetCursor->draw(graphics,
3744  offsetX - mCursorPaddingX,
3745  offsetY - mCursorPaddingY);
3746  }
3747  else
3748  {
3749  mUsedTargetCursor->draw(graphics,
3750  offsetX + mInfo->getTargetOffsetX() - mCursorPaddingX,
3751  offsetY + mInfo->getTargetOffsetY() - mCursorPaddingY);
3752  }
3753  }
3754 }
AnimatedSprite * mUsedTargetCursor
Definition: actorsprite.h:250
int mCursorPaddingY
Definition: actorsprite.h:257
int mCursorPaddingX
Definition: actorsprite.h:256
void draw(Graphics *const graphics, const int posX, const int posY) const
bool update(const int time)
static const int MILLISECONDS_IN_A_TICK
Definition: timer.h:30

References AnimatedSprite::draw(), BeingInfo::getTargetOffsetX(), BeingInfo::getTargetOffsetY(), ActorSprite::mCursorPaddingX, ActorSprite::mCursorPaddingY, MILLISECONDS_IN_A_TICK, mInfo, ActorSprite::mUsedTargetCursor, tick_time, and AnimatedSprite::update().

◆ drawCasting()

void Being::drawCasting ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const
protected

◆ drawCompound()

void Being::drawCompound ( Graphics *const  graphics,
const int  posX,
const int  posY 
) const
protected

Definition at line 3937 of file being.cpp.

3940 {
3941  FUNC_BLOCK("CompoundSprite::draw", 1)
3942  if (mNeedsRedraw)
3943  updateImages();
3944 
3945  if (mSprites.empty()) // Nothing to draw
3946  return;
3947 
3948  if (mAlpha == 1.0F && (mImage != nullptr))
3949  {
3950  graphics->drawImage(mImage,
3951  posX + mOffsetX,
3952  posY + mOffsetY);
3953  }
3954  else if ((mAlpha != 0.0F) && (mAlphaImage != nullptr))
3955  {
3956  mAlphaImage->setAlpha(mAlpha);
3957  graphics->drawImage(mAlphaImage,
3958  posX + mOffsetX,
3959  posY + mOffsetY);
3960  }
3961  else
3962  {
3963  Being::drawPlayerSprites(graphics, posX, posY);
3964  }
3965 }
void drawPlayerSprites(Graphics *const graphics, const int posX, const int posY) const
Definition: being.cpp:3893
void updateImages() const
std::vector< Sprite * > mSprites
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
float mAlpha
Definition: sprite.h:130
if(!vert) return
#define FUNC_BLOCK(name, id)
Definition: perfomance.h:81
std::string empty
Definition: podict.cpp:26

References Graphics::drawImage(), drawPlayerSprites(), FUNC_BLOCK, Sprite::mAlpha, CompoundSprite::mAlphaImage, CompoundSprite::mImage, CompoundSprite::mNeedsRedraw, CompoundSprite::mOffsetX, CompoundSprite::mOffsetY, CompoundSprite::mSprites, and CompoundSprite::updateImages().

◆ drawElemental()

void Being::drawElemental ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const

Definition at line 3816 of file being.cpp.

3819 {
3820  // getActorX() + offsetX;
3821  const int px = mPixelX - mapTileSize / 2 + offsetX;
3822  // getActorY() + offsetY;
3823  const int py = mPixelY - mapTileSize + offsetY;
3824  drawBeingCursor(graphics, px, py);
3825  drawElementalSpriteAt(graphics, px, py);
3826 }
int mPixelX
Definition: actor.h:133
int mPixelY
Definition: actor.h:134
void drawBeingCursor(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3734
void drawElementalSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:4169
static const int mapTileSize
Definition: map.h:27

References mapTileSize.

◆ drawElementalSpriteAt()

void Being::drawElementalSpriteAt ( Graphics *const  graphics,
const int  x,
const int  y 
) const
protected

Definition at line 4169 of file being.cpp.

4172 {
4175  {
4176  if (userPalette == nullptr)
4177  {
4178  CompoundSprite::drawSimple(graphics, x, y);
4179  return;
4180  }
4181 
4182  int attackRange;
4183  if (mAttackRange != 0)
4184  attackRange = mapTileSize * mAttackRange;
4185  else
4186  attackRange = mapTileSize;
4187 
4190 
4191  graphics->fillRectangle(Rect(
4192  x - attackRange, y - attackRange,
4193  2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
4194  }
4195 
4196  CompoundSprite::drawSimple(graphics, x, y);
4197 
4198  if (mShowMobHP &&
4199  (mInfo != nullptr))
4200  {
4202  {
4203  // show hp bar here
4205  if (maxHP == 0)
4206  maxHP = mInfo->getMaxHP();
4207 
4208  drawHpBar(graphics,
4209  maxHP,
4211  mDamageTaken,
4214  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
4215  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
4216  2 * 50,
4217  4);
4218  }
4219  }
4220 }
int getHpBarOffsetY() const
Definition: beinginfo.h:165
int getMaxHP() const
Definition: beinginfo.h:171
int getHpBarOffsetX() const
Definition: beinginfo.h:159
static bool mHighlightMonsterAttackRange
Definition: being.h:1335
void drawHpBar(Graphics *const graphics, const int maxHP, const int hp, const int damage, const UserColorIdT color1, const UserColorIdT color2, const int x, const int y, const int width, const int height) const
Definition: being.cpp:4253
static bool mShowMobHP
Definition: being.h:1339
void drawSimple(Graphics *const graphics, const int posX, const int posY) const
virtual void fillRectangle(const Rect &rectangle)=0
virtual void setColor(const Color &color)
Definition: graphics.h:320
Definition: rect.h:74
const Color & getColorWithAlpha(const UserColorIdT type)
Definition: userpalette.h:200
@ ELEMENTAL_MAX_HP
Definition: attributes.h:112
int getStatBase(const AttributesT id)
Definition: playerinfo.cpp:135
BeingId getElementalId()
Definition: playerinfo.cpp:544
@ MONSTER_ATTACK_RANGE
Definition: usercolorid.h:90
UserPalette * userPalette
Definition: userpalette.cpp:34

References BeingAction::DEAD, CompoundSprite::drawSimple(), Attributes::ELEMENTAL_HP, UserColorId::ELEMENTAL_HP, UserColorId::ELEMENTAL_HP2, Attributes::ELEMENTAL_MAX_HP, UserPalette::getColorWithAlpha(), PlayerInfo::getElementalId(), PlayerInfo::getStatBase(), mapTileSize, UserColorId::MONSTER_ATTACK_RANGE, userPalette, x, and y.

◆ drawEmotion()

void Being::drawEmotion ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const

Draws the emotion picture above the being.

Definition at line 2375 of file being.cpp.

2378 {
2379  if (mErased)
2380  return;
2381 
2382  const int px = mPixelX - offsetX - mapTileSize / 2;
2383  const int py = mPixelY - offsetY - mapTileSize * 2 - mapTileSize;
2384  if (mAnimationEffect != nullptr)
2385  mAnimationEffect->draw(graphics, px, py);
2387  mBadgesCount != 0U)
2388  {
2389  int x = mBadgesX - offsetX;
2390  const int y = mBadgesY - offsetY;
2391  for_each_badges()
2392  {
2393  const AnimatedSprite *restrict const sprite = mBadges[f];
2394  if (sprite != nullptr)
2395  {
2396  sprite->draw(graphics, x, y);
2397  x += 16;
2398  }
2399  }
2400  }
2401  if (mEmotionSprite != nullptr)
2402  mEmotionSprite->draw(graphics, px, py);
2403 }
static BadgeDrawType::Type mShowBadges
Definition: being.h:1348

References for_each_badges, BadgeDrawType::Hide, mapTileSize, restrict, x, and y.

◆ drawHomunculus()

void Being::drawHomunculus ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const

Definition at line 3792 of file being.cpp.

3795 {
3796  // getActorX() + offsetX;
3797  const int px = mPixelX - mapTileSize / 2 + offsetX;
3798  // getActorY() + offsetY;
3799  const int py = mPixelY - mapTileSize + offsetY;
3800  drawBeingCursor(graphics, px, py);
3801  drawHomunculusSpriteAt(graphics, px, py);
3802 }
void drawHomunculusSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:4059

References mapTileSize.

◆ drawHomunculusSpriteAt()

void Being::drawHomunculusSpriteAt ( Graphics *const  graphics,
const int  x,
const int  y 
) const
protected

Definition at line 4059 of file being.cpp.

4062 {
4065  {
4066  if (userPalette == nullptr)
4067  {
4068  CompoundSprite::drawSimple(graphics, x, y);
4069  return;
4070  }
4071 
4072  int attackRange;
4073  if (mAttackRange != 0)
4074  attackRange = mapTileSize * mAttackRange;
4075  else
4076  attackRange = mapTileSize;
4077 
4080 
4081  graphics->fillRectangle(Rect(
4082  x - attackRange, y - attackRange,
4083  2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
4084  }
4085 
4086  CompoundSprite::drawSimple(graphics, x, y);
4087 
4088  if (mShowMobHP &&
4089  (mInfo != nullptr))
4090  {
4092  if ((info != nullptr) &&
4093  mId == info->id)
4094  {
4095  // show hp bar here
4097  if (maxHP == 0)
4098  maxHP = mInfo->getMaxHP();
4099 
4100  drawHpBar(graphics,
4101  maxHP,
4103  mDamageTaken,
4106  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
4107  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
4108  2 * 50,
4109  4);
4110  }
4111  }
4112 }
@ HOMUN_MAX_HP
Definition: attributes.h:72
HomunculusInfo * getHomunculus()
Definition: playerinfo.cpp:603

References BeingAction::DEAD, CompoundSprite::drawSimple(), UserPalette::getColorWithAlpha(), PlayerInfo::getHomunculus(), PlayerInfo::getStatBase(), Attributes::HOMUN_HP, UserColorId::HOMUN_HP, UserColorId::HOMUN_HP2, Attributes::HOMUN_MAX_HP, Actions::info(), mapTileSize, UserColorId::MONSTER_ATTACK_RANGE, userPalette, x, and y.

◆ drawHpBar()

void Being::drawHpBar ( Graphics *const  graphics,
const int  maxHP,
const int  hp,
const int  damage,
const UserColorIdT  color1,
const UserColorIdT  color2,
const int  x,
const int  y,
const int  width,
const int  height 
) const

Definition at line 4253 of file being.cpp.

4263 {
4264  if (maxHP <= 0 || (userPalette == nullptr))
4265  return;
4266 
4267  float p;
4268 
4269  if (hp != 0)
4270  {
4271  p = static_cast<float>(maxHP) / static_cast<float>(hp);
4272  }
4273  else if (maxHP != damage)
4274  {
4275  p = static_cast<float>(maxHP)
4276  / static_cast<float>(maxHP - damage);
4277  }
4278  else
4279  {
4280  p = 1;
4281  }
4282 
4283  if (p <= 0 || p > width)
4284  return;
4285 
4286  const int dx = static_cast<int>(static_cast<float>(width) / p);
4287 
4288 #ifdef TMWA_SUPPORT
4289  if (!serverFeatures->haveServerHp())
4290  { // old servers
4291  if ((damage == 0 && (this != localPlayer || hp == maxHP))
4292  || (hp == 0 && maxHP == damage))
4293  {
4294  graphics->setColor(userPalette->getColorWithAlpha(color1));
4295  graphics->fillRectangle(Rect(
4296  x, y, dx, height));
4297  return;
4298  }
4299  else if (width - dx <= 0)
4300  {
4301  graphics->setColor(userPalette->getColorWithAlpha(color2));
4302  graphics->fillRectangle(Rect(
4303  x, y, width, height));
4304  return;
4305  }
4306  }
4307  else
4308 #endif // TMWA_SUPPORT
4309  {
4310  if (hp == maxHP)
4311  {
4312  graphics->setColor(userPalette->getColorWithAlpha(color1));
4313  graphics->fillRectangle(Rect(
4314  x, y, dx, height));
4315  return;
4316  }
4317  else if (width - dx <= 0)
4318  {
4319  graphics->setColor(userPalette->getColorWithAlpha(color2));
4320  graphics->fillRectangle(Rect(
4321  x, y, width, height));
4322  return;
4323  }
4324  }
4325 
4326  graphics->setColor(userPalette->getColorWithAlpha(color1));
4327  graphics->fillRectangle(Rect(
4328  x, y, dx, height));
4329 
4330  graphics->setColor(userPalette->getColorWithAlpha(color2));
4331  graphics->fillRectangle(Rect(x + dx, y, width - dx, height));
4332 }
virtual bool haveServerHp() const =0
Net::ServerFeatures * serverFeatures
Definition: net.cpp:101

References UserPalette::getColorWithAlpha(), Net::ServerFeatures::haveServerHp(), localPlayer, serverFeatures, userPalette, x, and y.

◆ drawMercenary()

void Being::drawMercenary ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const

Definition at line 3804 of file being.cpp.

3807 {
3808  // getActorX() + offsetX;
3809  const int px = mPixelX - mapTileSize / 2 + offsetX;
3810  // getActorY() + offsetY;
3811  const int py = mPixelY - mapTileSize + offsetY;
3812  drawBeingCursor(graphics, px, py);
3813  drawMercenarySpriteAt(graphics, px, py);
3814 }
void drawMercenarySpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:4114

References mapTileSize.

◆ drawMercenarySpriteAt()

void Being::drawMercenarySpriteAt ( Graphics *const  graphics,
const int  x,
const int  y 
) const
protected

Definition at line 4114 of file being.cpp.

4117 {
4120  {
4121  if (userPalette == nullptr)
4122  {
4123  CompoundSprite::drawSimple(graphics, x, y);
4124  return;
4125  }
4126 
4127  int attackRange;
4128  if (mAttackRange != 0)
4129  attackRange = mapTileSize * mAttackRange;
4130  else
4131  attackRange = mapTileSize;
4132 
4135 
4136  graphics->fillRectangle(Rect(
4137  x - attackRange, y - attackRange,
4138  2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
4139  }
4140 
4141  CompoundSprite::drawSimple(graphics, x, y);
4142 
4143  if (mShowMobHP &&
4144  (mInfo != nullptr))
4145  {
4146  const MercenaryInfo *const info = PlayerInfo::getMercenary();
4147  if ((info != nullptr) &&
4148  mId == info->id)
4149  {
4150  // show hp bar here
4152  if (maxHP == 0)
4153  maxHP = mInfo->getMaxHP();
4154 
4155  drawHpBar(graphics,
4156  maxHP,
4158  mDamageTaken,
4161  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
4162  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
4163  2 * 50,
4164  4);
4165  }
4166  }
4167 }
MercenaryInfo * getMercenary()
Definition: playerinfo.cpp:549

References BeingAction::DEAD, CompoundSprite::drawSimple(), UserPalette::getColorWithAlpha(), PlayerInfo::getMercenary(), PlayerInfo::getStatBase(), Actions::info(), mapTileSize, Attributes::MERC_HP, UserColorId::MERC_HP, UserColorId::MERC_HP2, Attributes::MERC_MAX_HP, UserColorId::MONSTER_ATTACK_RANGE, userPalette, x, and y.

◆ drawMonster()

void Being::drawMonster ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const

Definition at line 3780 of file being.cpp.

3783 {
3784  // getActorX() + offsetX;
3785  const int px = mPixelX - mapTileSize / 2 + offsetX;
3786  // getActorY() + offsetY;
3787  const int py = mPixelY - mapTileSize + offsetY;
3788  drawBeingCursor(graphics, px, py);
3789  drawMonsterSpriteAt(graphics, px, py);
3790 }
void drawMonsterSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:4005

References mapTileSize.

◆ drawMonsterSpriteAt()

void Being::drawMonsterSpriteAt ( Graphics *const  graphics,
const int  x,
const int  y 
) const
protected

Definition at line 4005 of file being.cpp.

4008 {
4012  {
4013  if (userPalette == nullptr)
4014  {
4015  CompoundSprite::drawSimple(graphics, x, y);
4016  return;
4017  }
4018 
4019  int attackRange;
4020  if (mAttackRange != 0)
4021  attackRange = mapTileSize * mAttackRange;
4022  else
4023  attackRange = mapTileSize;
4024 
4027 
4028  graphics->fillRectangle(Rect(
4029  x - attackRange, y - attackRange,
4030  2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
4031  }
4032 
4033  CompoundSprite::drawSimple(graphics, x, y);
4034 
4035  if (mShowMobHP &&
4036  (mInfo != nullptr) &&
4037  (localPlayer != nullptr) &&
4038  localPlayer->getTarget() == this &&
4040  {
4041  // show hp bar here
4042  int maxHP = mMaxHP;
4043  if (maxHP == 0)
4044  maxHP = mInfo->getMaxHP();
4045 
4046  drawHpBar(graphics,
4047  maxHP,
4048  mHP,
4049  mDamageTaken,
4052  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
4053  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
4054  2 * 50,
4055  4);
4056  }
4057 }

References BeingAction::DEAD, CompoundSprite::drawSimple(), UserPalette::getColorWithAlpha(), LocalPlayer::getTarget(), localPlayer, mapTileSize, ActorType::Monster, UserColorId::MONSTER_ATTACK_RANGE, UserColorId::MONSTER_HP, UserColorId::MONSTER_HP2, userPalette, x, and y.

◆ drawNpc()

void Being::drawNpc ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const

Definition at line 3768 of file being.cpp.

3771 {
3772  // getActorX() + offsetX;
3773  const int px = mPixelX - mapTileSize / 2 + offsetX;
3774  // getActorY() + offsetY;
3775  const int py = mPixelY - mapTileSize + offsetY;
3776  drawBeingCursor(graphics, px, py);
3777  drawNpcSpriteAt(graphics, px, py);
3778 }
void drawNpcSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:3998

References mapTileSize.

◆ drawNpcSpriteAt()

void Being::drawNpcSpriteAt ( Graphics *const  graphics,
const int  x,
const int  y 
) const
protected

Definition at line 3998 of file being.cpp.

4001 {
4002  drawCompound(graphics, x, y);
4003 }

References x, and y.

◆ drawOther()

void Being::drawOther ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const

Definition at line 3756 of file being.cpp.

3759 {
3760  // getActorX() + offsetX;
3761  const int px = mPixelX - mapTileSize / 2 + offsetX;
3762  // getActorY() + offsetY;
3763  const int py = mPixelY - mapTileSize + offsetY;
3764  drawBeingCursor(graphics, px, py);
3765  drawOtherSpriteAt(graphics, px, py);
3766 }
void drawOtherSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:3991

References mapTileSize.

◆ drawOtherSpriteAt()

void Being::drawOtherSpriteAt ( Graphics *const  graphics,
const int  x,
const int  y 
) const
protected

Definition at line 3991 of file being.cpp.

3994 {
3995  CompoundSprite::drawSimple(graphics, x, y);
3996 }

References CompoundSprite::drawSimple(), x, and y.

◆ drawPlayer()

void Being::drawPlayer ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const

Definition at line 3694 of file being.cpp.

3697 {
3698  if (!mErased)
3699  {
3700  // getActorX() + offsetX;
3701  const int px = mPixelX - mapTileSize / 2 + offsetX;
3702  // getActorY() + offsetY;
3703  const int py = mPixelY - mapTileSize + offsetY;
3704  if (mHorseInfo != nullptr)
3705  {
3708  {
3709  (*it)->draw(graphics,
3710  px + offset.downOffsetX,
3711  py + offset.downOffsetY);
3712  }
3713 
3714  drawBeingCursor(graphics, px, py);
3715  drawPlayerSpriteAt(graphics,
3716  px + offset.riderOffsetX,
3717  py + offset.riderOffsetY);
3718 
3720  {
3721  (*it)->draw(graphics,
3722  px + offset.upOffsetX,
3723  py + offset.upOffsetY);
3724  }
3725  }
3726  else
3727  {
3728  drawBeingCursor(graphics, px, py);
3729  drawPlayerSpriteAt(graphics, px, py);
3730  }
3731  }
3732 }
#define for_each_horses(name)
Definition: being.cpp:159
void drawPlayerSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:3967
HorseOffset offsets[10]
Definition: horseinfo.h:54
int downOffsetY
Definition: horseoffset.h:43
int riderOffsetY
Definition: horseoffset.h:45
int downOffsetX
Definition: horseoffset.h:42
int riderOffsetX
Definition: horseoffset.h:44

References HorseOffset::downOffsetX, HorseOffset::downOffsetY, for_each_horses, mapTileSize, HorseOffset::riderOffsetX, HorseOffset::riderOffsetY, HorseOffset::upOffsetX, and HorseOffset::upOffsetY.

◆ drawPlayerSpriteAt()

void Being::drawPlayerSpriteAt ( Graphics *const  graphics,
const int  x,
const int  y 
) const
protected

Definition at line 3967 of file being.cpp.

3970 {
3971  drawCompound(graphics, x, y);
3972 
3973  if (mShowOwnHP &&
3974  (mInfo != nullptr) &&
3975  localPlayer == this &&
3977  {
3978  drawHpBar(graphics,
3981  0,
3984  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
3985  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
3986  2 * 50,
3987  4);
3988  }
3989 }
static bool mShowOwnHP
Definition: being.h:1340
@ PLAYER_MAX_HP
Definition: attributes.h:33
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:102

References BeingAction::DEAD, PlayerInfo::getAttribute(), localPlayer, mapTileSize, Attributes::PLAYER_HP, UserColorId::PLAYER_HP, UserColorId::PLAYER_HP2, Attributes::PLAYER_MAX_HP, x, and y.

◆ drawPlayerSprites()

void Being::drawPlayerSprites ( Graphics *const  graphics,
const int  posX,
const int  posY 
) const

Definition at line 3893 of file being.cpp.

3896 {
3897  const int sz = CompoundSprite::getNumberOfLayers();
3898  for (int f = 0; f < sz; f ++)
3899  {
3900  const int rSprite = mSpriteHide[mSpriteRemap[f]];
3901  if (rSprite == 1)
3902  continue;
3903 
3904  Sprite *restrict const sprite = mSprites[mSpriteRemap[f]];
3905  if (sprite != nullptr)
3906  {
3907  sprite->setAlpha(mAlpha);
3908  sprite->draw(graphics, posX, posY);
3909  }
3910  }
3911 }
int getNumberOfLayers() const
Definition: sprite.h:34

References CompoundSprite::getNumberOfLayers(), and restrict.

Referenced by drawCompound().

◆ drawPortal()

void Being::drawPortal ( Graphics *const  graphics,
const int  offsetX,
const int  offsetY 
) const

Definition at line 3828 of file being.cpp.

3831 {
3832  // getActorX() + offsetX;
3833  const int px = mPixelX - mapTileSize / 2 + offsetX;
3834  // getActorY() + offsetY;
3835  const int py = mPixelY - mapTileSize + offsetY;
3836  drawPortalSpriteAt(graphics, px, py);
3837 }
void drawPortalSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:4222

References mapTileSize.

◆ drawPortalSpriteAt()

void Being::drawPortalSpriteAt ( Graphics *const  graphics,
const int  x,
const int  y 
) const
protected

Definition at line 4222 of file being.cpp.

4225 {
4226  if (mHighlightMapPortals &&
4227  (mMap != nullptr) &&
4228  !mMap->getHasWarps())
4229  {
4230  if (userPalette == nullptr)
4231  {
4232  CompoundSprite::drawSimple(graphics, x, y);
4233  return;
4234  }
4235 
4236  graphics->setColor(userPalette->
4237  getColorWithAlpha(UserColorId::PORTAL_HIGHLIGHT));
4238 
4239  graphics->fillRectangle(Rect(x, y,
4241 
4242  if (mDrawHotKeys && !mName.empty())
4243  {
4244  const Color &color = userPalette->getColor(UserColorId::BEING,
4245  255U);
4246  gui->getFont()->drawString(graphics, color, color, mName, x, y);
4247  }
4248  }
4249 
4250  CompoundSprite::drawSimple(graphics, x, y);
4251 }
static bool mDrawHotKeys
Definition: being.h:1337
static bool mHighlightMapPortals
Definition: being.h:1334
Definition: color.h:76
void drawString(Graphics *const graphics, Color col, const Color &col2, const std::string &text, const int x, const int y)
Definition: font.cpp:254
Font * getFont() const
Definition: gui.h:160
bool getHasWarps() const
Definition: map.h:247
const Color & getColor(UserColorIdT type, const unsigned int alpha)
Definition: userpalette.h:160
Gui * gui
Definition: gui.cpp:111
@ PORTAL_HIGHLIGHT
Definition: usercolorid.h:79

References UserColorId::BEING, CompoundSprite::drawSimple(), Font::drawString(), UserPalette::getColor(), Gui::getFont(), gui, mapTileSize, Ea::GameRecv::mMap, UserColorId::PORTAL_HIGHLIGHT, userPalette, x, and y.

◆ drawSpeech()

void Being::drawSpeech ( const int  offsetX,
const int  offsetY 
)

Draws the speech text above the being.

Definition at line 2405 of file being.cpp.

2407 {
2408  if (mErased)
2409  return;
2410  if (mSpeech.empty())
2411  return;
2412 
2413  const int px = mPixelX - offsetX;
2414  const int py = mPixelY - offsetY;
2415  const int speech = mSpeechType;
2416 
2417  // Draw speech above this being
2418  if (mSpeechTime == 0)
2419  {
2420  if (mSpeechBubble != nullptr &&
2422  {
2424  }
2425  mSpeech.clear();
2426  }
2427  else if (mSpeechTime > 0 && (speech == BeingSpeech::NAME_IN_BUBBLE ||
2428  speech == BeingSpeech::NO_NAME_IN_BUBBLE))
2429  {
2430  delete2(mText)
2431 
2432  if (mSpeechBubble != nullptr)
2433  {
2435  py - getHeight() - (mSpeechBubble->getHeight()));
2437  }
2438  }
2439  else if (mSpeechTime > 0 && speech == BeingSpeech::TEXT_OVERHEAD)
2440  {
2441  if (mSpeechBubble != nullptr)
2443 
2444  if ((mText == nullptr) && (userPalette != nullptr))
2445  {
2446  mText = new Text(mSpeech,
2447  mPixelX,
2448  mPixelY - getHeight(),
2450  &theme->getColor(ThemeColorId::BUBBLE_TEXT, 255),
2451  Speech_true,
2452  nullptr);
2454  (mY + 1) * mapTileSize - getHeight() - mText->getHeight() - 9,
2455  mMoveNames);
2456  }
2457  }
2458  else if (speech == BeingSpeech::NO_SPEECH)
2459  {
2460  if (mSpeechBubble != nullptr)
2462  delete2(mText)
2463  }
2464 }
static int mSpeechType
Definition: being.h:1333
static Move mMoveNames
Definition: being.h:1346
int getHeight() const
Definition: being.h:536
@ CENTER
Definition: graphics.h:132
int getHeight() const
Definition: text.h:66
void adviseXY(const int x, const int y, const Move move)
Definition: text.cpp:144
const Color & getColor(const ThemeColorIdT type, const unsigned int alpha)
Definition: theme.h:136
void setVisible(Visible visible)
Definition: widget.cpp:225
Visible mVisible
Definition: widget.h:963
void setPosition(const int x, const int y)
Definition: widget.cpp:161
int getHeight() const
Definition: widget.h:240
int getWidth() const
Definition: widget.h:221
@ NO_NAME_IN_BUBBLE
Definition: beingspeech.h:33
const bool Speech_true
Definition: speech.h:30
Theme * theme
Definition: theme.cpp:62
const bool Visible_false
Definition: visible.h:30
const bool Visible_true
Definition: visible.h:30

References Graphics::CENTER, delete2, Theme::getColor(), mapTileSize, BeingSpeech::NAME_IN_BUBBLE, BeingSpeech::NO_NAME_IN_BUBBLE, BeingSpeech::NO_SPEECH, Speech_true, MailMessageType::Text, BeingSpeech::TEXT_OVERHEAD, theme, userPalette, Visible_false, and Visible_true.

◆ drawSpritesSDL()

void Being::drawSpritesSDL ( Graphics *const  graphics,
const int  posX,
const int  posY 
) const
virtual

Reimplemented from CompoundSprite.

Definition at line 3913 of file being.cpp.

3916 {
3917  const size_t sz = mSprites.size();
3918  for (size_t f = 0; f < sz; f ++)
3919  {
3920  const int rSprite = mSpriteHide[mSpriteRemap[f]];
3921  if (rSprite == 1)
3922  continue;
3923 
3924  const Sprite *restrict const sprite = mSprites[mSpriteRemap[f]];
3925  if (sprite != nullptr)
3926  sprite->draw(graphics, posX, posY);
3927  }
3928 }

References restrict.

◆ dumpSprites()

void Being::dumpSprites ( ) const
protected

Definition at line 3409 of file being.cpp.

3410 {
3411  STD_VECTOR<BeingSlot>::const_iterator it1 = mSlots.begin();
3412  const STD_VECTOR<BeingSlot>::const_iterator it1_end = mSlots.end();
3413 
3414  logger->log("sprites");
3415  for (; it1 != it1_end;
3416  ++ it1)
3417  {
3418  logger->log("%d,%s,%d",
3419  (*it1).spriteId,
3420  (*it1).color.c_str(),
3421  toInt((*it1).colorId, int));
3422  }
3423 }
void log(const char *const log_text,...)
Definition: logger.cpp:269
#define toInt(val, name)
Definition: intdefines.h:47
Logger * logger
Definition: logger.cpp:89

References Logger::log(), logger, mSlots, and toInt.

◆ enableBotAi()

void Being::enableBotAi ( )
inline

Definition at line 1046 of file being.h.

1047  { mBotAi = true; }

References mBotAi.

◆ enableShop()

void Being::enableShop ( const bool  b)

Definition at line 5344 of file being.cpp.

5345 {
5346  mShop = b;
5347  updateName();
5349 }
void updateName()
Definition: being.cpp:3425
void showShopBadge(const bool show)
Definition: being.cpp:5255

Referenced by ShopWindow::buyingStoreEnabled(), and ShopWindow::vendingEnabled().

◆ fireMissile()

void Being::fireMissile ( Being *const  victim,
const MissileInfo missile 
) const

Shoots a missile particle from this being, to target being

Definition at line 1378 of file being.cpp.

1380 {
1381  BLOCK_START("Being::fireMissile")
1382 
1383  if (victim == nullptr ||
1384  missile.particle.empty() ||
1385  particleEngine == nullptr)
1386  {
1387  BLOCK_END("Being::fireMissile")
1388  return;
1389  }
1390 
1391  Particle *restrict const target = particleEngine->createChild();
1392 
1393  if (target == nullptr)
1394  {
1395  BLOCK_END("Being::fireMissile")
1396  return;
1397  }
1398 
1399  // +++ add z particle position?
1400  Particle *restrict const missileParticle = target->addEffect(
1401  missile.particle,
1402  mPixelX,
1403  mPixelY,
1404  0);
1405 
1406  target->moveBy(Vector(0.0F, 0.0F, missile.z));
1407  target->setLifetime(missile.lifeTime);
1408  victim->controlAutoParticle(target);
1409 
1410  if (missileParticle != nullptr)
1411  {
1412  missileParticle->setDestination(target, missile.speed, 0.0F);
1413  missileParticle->setDieDistance(missile.dieDistance);
1414  missileParticle->setLifetime(missile.lifeTime);
1415  }
1416  BLOCK_END("Being::fireMissile")
1417 }
void controlAutoParticle(Particle *const particle)
void addEffect(const std::string &name)
Definition: being.cpp:4959
Definition: vector.h:40
#define BLOCK_END(name)
Definition: perfomance.h:80
#define BLOCK_START(name)
Definition: perfomance.h:79
float dieDistance
Definition: missileinfo.h:44
float speed
Definition: missileinfo.h:43

References BLOCK_END, BLOCK_START, ParticleEngine::createChild(), particleEngine, and restrict.

◆ fixDirectionOffsets()

void Being::fixDirectionOffsets ( int &  offsetX,
int &  offsetY 
) const

Definition at line 5528 of file being.cpp.

5530 {
5531  const uint8_t dir = mDirection;
5532  if ((dir & BeingDirection::DOWN) != 0)
5533  {
5534  // do nothing
5535  }
5536  else if ((dir & BeingDirection::UP) != 0)
5537  {
5538  offsetX = -offsetX;
5539  offsetY = -offsetY;
5540  }
5541  else if ((dir & BeingDirection::LEFT) != 0)
5542  {
5543  const int tmp = offsetY;
5544  offsetY = offsetX;
5545  offsetX = -tmp;
5546  }
5547  else if ((dir & BeingDirection::RIGHT) != 0)
5548  {
5549  const int tmp = offsetY;
5550  offsetY = -offsetX;
5551  offsetX = tmp;
5552  }
5553 }

References BeingDirection::DOWN, BeingDirection::LEFT, mDirection, BeingDirection::RIGHT, and BeingDirection::UP.

Referenced by SkillDialog::useSkillDefault(), SkillDialog::useSkillPosition(), and SkillDialog::useSkillTarget().

◆ flashName()

void Being::flashName ( const int  time)

Definition at line 2532 of file being.cpp.

2533 {
2534  if (mDispName != nullptr)
2535  mDispName->flash(time);
2536 }
void flash(const int time)
Definition: text.h:120

◆ genderToInt()

static uint8_t Being::genderToInt ( const GenderT  sex)
inlinestatic

Definition at line 927 of file being.h.

929  {
930  switch (sex)
931  {
932  case Gender::FEMALE:
933  case Gender::UNSPECIFIED:
934  default:
935  return 0;
936  case Gender::MALE:
937  return 1;
938  }
939  }
@ MALE
Definition: gender.h:31
@ FEMALE
Definition: gender.h:32

References Gender::FEMALE, Gender::MALE, and Gender::UNSPECIFIED.

Referenced by EAthena::CharServerHandler::connect(), EAthena::GameHandler::connect(), TmwAthena::CharServerHandler::connect(), TmwAthena::GameHandler::connect(), and EAthena::CharServerHandler::newCharacter().

◆ getActionTime()

int Being::getActionTime ( ) const
inline

Returns the time spent in the current action.

Definition at line 128 of file being.h.

129  { return mActionTime; }

References mActionTime.

◆ getAllowNpcEquipment()

bool Being::getAllowNpcEquipment ( ) const
inline

Definition at line 1102 of file being.h.

1103  { return mAllowNpcEquipment; }

References mAllowNpcEquipment.

◆ getAreaSize()

int Being::getAreaSize ( ) const
inline

Definition at line 1049 of file being.h.

1050  { return mAreaSize; }

References mAreaSize.

◆ getAttackAction() [1/2]

std::string Being::getAttackAction ( ) const

Definition at line 1525 of file being.cpp.

◆ getAttackAction() [2/2]

std::string Being::getAttackAction ( const Attack *const  attack1) const

Definition at line 1471 of file being.cpp.

1473 {
1474  if (attack1 == nullptr)
1475  return getAttackAction();
1476 
1477  if (mHorseId != 0)
1478  return attack1->mRideAction;
1479  if (mMap != nullptr)
1480  {
1481  const unsigned char mask = mMap->getBlockMask(mX, mY);
1482  if ((mask & BlockMask::AIR) != 0)
1483  return attack1->mSkyAction;
1484  else if ((mask & BlockMask::WATER) != 0)
1485  return attack1->mWaterAction;
1486  }
1487  return attack1->mAction;
1488 }
std::string getAttackAction() const
Definition: being.cpp:1525
unsigned char getBlockMask(const int x, const int y) const
Definition: map.cpp:796
std::string mRideAction
Definition: attack.h:34
std::string mWaterAction
Definition: attack.h:33
std::string mAction
Definition: attack.h:31
std::string mSkyAction
Definition: attack.h:32

References BlockMask::AIR, Ea::GameRecv::mMap, and BlockMask::WATER.

◆ getAttackDelay()

int Being::getAttackDelay ( ) const
inline

Definition at line 773 of file being.h.

774  { return mAttackDelay; }

References mAttackDelay.

Referenced by TargetDebugTab::logic().

◆ getAttackSpeed()

int Being::getAttackSpeed ( ) const
inline

Gets the attack speed.

Definition at line 470 of file being.h.

471  { return mAttackSpeed; }

References mAttackSpeed.

◆ getAttackTime()

time_t Being::getAttackTime ( ) const
inline

Definition at line 724 of file being.h.

725  { return mAttackTime; }

References mAttackTime.

◆ getBlockType()

BlockTypeT Being::getBlockType ( ) const
inlinevirtual

Gets the way the monster blocks pathfinding for other objects

Reimplemented from ActorSprite.

Definition at line 442 of file being.h.

443  {
444  if (mInfo == nullptr)
445  return BlockType::NONE;
446  return mInfo->getBlockType();
447  }
BlockTypeT getBlockType() const
Definition: beinginfo.h:129

References BeingInfo::getBlockType(), mInfo, and BlockType::NONE.

◆ getBlockWalkMask()

virtual unsigned char Being::getBlockWalkMask ( ) const
inlinevirtual

Gets the way the object is blocked by other objects.

Reimplemented in LocalPlayer.

Definition at line 432 of file being.h.

433  {
434  if (mInfo == nullptr)
435  return 0;
436  return mInfo->getBlockWalkMask();
437  }
unsigned char getBlockWalkMask() const
Definition: beinginfo.h:123

References BeingInfo::getBlockWalkMask(), and mInfo.

Referenced by botFixOffset(), moveBotTo(), and nextTile().

◆ getBuyBoard()

std::string Being::getBuyBoard ( ) const
inline

Definition at line 1015 of file being.h.

1016  { return mBuyBoard; }

References mBuyBoard.

Referenced by BeingPopup::show().

◆ getCachedX()

int Being::getCachedX ( ) const
inline

Definition at line 153 of file being.h.

154  { return mCachedX; }

References mCachedX.

Referenced by Ea::BeingRecv::processBeingMove3().

◆ getCachedY()

int Being::getCachedY ( ) const
inline

Definition at line 156 of file being.h.

157  { return mCachedY; }

References mCachedY.

Referenced by Ea::BeingRecv::processBeingMove3().

◆ getCacheEntry()

BeingCacheEntry * Being::getCacheEntry ( const BeingId  id)
static

Definition at line 3559 of file being.cpp.

3560 {
3561  FOR_EACH (std::list<BeingCacheEntry*>::iterator, i, beingInfoCache)
3562  {
3563  if (*i == nullptr)
3564  continue;
3565 
3566  if (id == (*i)->getId())
3567  {
3568  // Raise priority: move it to front
3569  if ((*i)->getTime() + 120 < cur_time)
3570  {
3571  beingInfoCache.splice(beingInfoCache.begin(),
3572  beingInfoCache, i);
3573  }
3574  return *i;
3575  }
3576  }
3577  return nullptr;
3578 }

References beingInfoCache, cur_time, and FOR_EACH.

Referenced by addToCache(), and updateFromCache().

◆ getCastAction() [1/2]

std::string Being::getCastAction ( ) const

Definition at line 1526 of file being.cpp.

◆ getCastAction() [2/2]

std::string Being::getCastAction ( const SkillInfo *const  skill) const

Definition at line 1490 of file being.cpp.

1492 {
1493  if (skill == nullptr)
1494  return getCastAction();
1495 
1496  if (mHorseId != 0)
1497  return skill->castingRideAction;
1498  if (mMap != nullptr)
1499  {
1500  const unsigned char mask = mMap->getBlockMask(mX, mY);
1501  if ((mask & BlockMask::AIR) != 0)
1502  return skill->castingSkyAction;
1503  else if ((mask & BlockMask::WATER) != 0)
1504  return skill->castingWaterAction;
1505  }
1506  return skill->castingAction;
1507 }
std::string getCastAction() const
Definition: being.cpp:1526
bool skill(InputEvent &event)
Definition: commands.cpp:97

References BlockMask::AIR, Ea::GameRecv::mMap, Actions::skill(), and BlockMask::WATER.

◆ getChat()

ChatObject* Being::getChat ( ) const
inline

◆ getClanName()

const std::string& Being::getClanName ( ) const
inline

Definition at line 263 of file being.h.

265  { return mClanName; }

References mClanName.

Referenced by BeingPopup::show().

◆ getComment()

const std::string Being::getComment ( ) const
inline

Definition at line 812 of file being.h.

813  { return mComment; }

References mComment.

Referenced by PopupMenu::handleLink(), and BeingPopup::show().

◆ getCreatorId()

BeingId Being::getCreatorId ( ) const
inline

Definition at line 1028 of file being.h.

1029  { return mCreatorId; }

References mCreatorId.

Referenced by PopupMenu::showPopup().

◆ getCriticalHit()

int Being::getCriticalHit ( ) const
inline

Definition at line 788 of file being.h.

789  { return mCriticalHit; }

References mCriticalHit.

Referenced by TargetDebugTab::logic().

◆ getCurrentAction()

BeingActionT Being::getCurrentAction ( ) const
inline

◆ getDamageTaken()

int Being::getDamageTaken ( ) const
inline

Definition at line 593 of file being.h.

594  { return mDamageTaken; }

References mDamageTaken.

Referenced by ActorManager::findMostDamagedPlayer(), BeingPopup::show(), showName(), and SocialPlayersTab::updateAvatar().

◆ getDeadAction()

std::string Being::getDeadAction ( ) const

Definition at line 1527 of file being.cpp.

◆ getDefaultEffectId()

int Being::getDefaultEffectId ( const AttackTypeT type)
staticprotected

Definition at line 953 of file being.cpp.

954 {
955  if (type == AttackType::MISS)
956  return paths.getIntValue("missEffectId");
957  else if (type != AttackType::CRITICAL)
958  return paths.getIntValue("hitEffectId");
959  else
960  return paths.getIntValue("criticalHitEffectId");
961 }
int getIntValue(const std::string &key) const

References AttackType::CRITICAL, Configuration::getIntValue(), AttackType::MISS, and paths.

Referenced by getHitEffect().

◆ getDestination()

const Vector& Being::getDestination ( ) const
inline

Returns the destination for this being.

Definition at line 162 of file being.h.

163  { return mDest; }

References mDest.

◆ getDirection()

uint8_t Being::getDirection ( ) const
inline

◆ getDirectionDelayed()

uint8_t Being::getDirectionDelayed ( ) const
inline

◆ getDistance()

int Being::getDistance ( ) const
inline

Definition at line 552 of file being.h.

553  { return mDistance; }

References mDistance.

Referenced by ActorManager::findNearestLivingBeing().

◆ getEquipment()

Equipment * Being::getEquipment ( )

Definition at line 4697 of file being.cpp.

4698 {
4699  Equipment *restrict const eq = new Equipment;
4700  Equipment::Backend *restrict const bk = new BeingEquipBackend(this);
4701  eq->setBackend(bk);
4702  return eq;
4703 }
friend class BeingEquipBackend
Definition: being.h:99

References BeingEquipBackend, doctest::detail::binaryAssertComparison::eq, DragDropSource::Equipment, and restrict.

Referenced by EquipmentWindow::setBeing().

◆ getEquippedWeapon()

const ItemInfo* Being::getEquippedWeapon ( ) const
inline

Definition at line 226 of file being.h.

227  { return mEquippedWeapon; }

References mEquippedWeapon.

◆ getExtName()

const std::string& Being::getExtName ( ) const
inline

Definition at line 235 of file being.h.

236  { return mExtName; }

References mExtName.

Referenced by PopupMenu::showChatPopup(), and PopupMenu::showPopup().

◆ getGender()

GenderT Being::getGender ( ) const
inline

Definition at line 626 of file being.h.

627  { return mGender; }

References mGender.

Referenced by ActorManager::cloneBeing(), getGenderSign(), LocalPlayer::imitateOutfit(), and SocialPlayersTab::updateAvatar().

◆ getGenderSign()

std::string Being::getGenderSign ( ) const

Definition at line 2547 of file being.cpp.

2548 {
2549  std::string str;
2550  if (mShowGender)
2551  {
2552  if (getGender() == Gender::FEMALE)
2553  str = "\u2640";
2554  else if (getGender() == Gender::MALE)
2555  str = "\u2642";
2556  else if (mType == ActorType::Player)
2557  str = "\u2640";
2558  }
2559  if (mShowPlayersStatus &&
2561  {
2562  if (mShop)
2563  str.append("$");
2564  if (mAway)
2565  {
2566  // TRANSLATORS: this away status writed in player nick
2567  str.append(_("A"));
2568  }
2569  else if (mInactive)
2570  {
2571  // TRANSLATORS: this inactive status writed in player nick
2572  str.append(_("I"));
2573  }
2574  }
2575  return str;
2576 }
static bool mShowPlayersStatus
Definition: being.h:1343
GenderT getGender() const
Definition: being.h:626
static bool mShowGender
Definition: being.h:1341
#define _(s)
Definition: gettext.h:35

References _, Gender::FEMALE, getGender(), BadgeDrawType::Hide, Gender::MALE, mAway, mInactive, mShop, mShowBadges, mShowGender, mShowPlayersStatus, mType, and ActorType::Player.

Referenced by getGenderSignWithSpace(), and showName().

◆ getGenderSignWithSpace()

std::string Being::getGenderSignWithSpace ( ) const

Definition at line 2538 of file being.cpp.

2539 {
2540  const std::string &restrict str = getGenderSign();
2541  if (str.empty())
2542  return str;
2543  else
2544  return std::string(" ").append(str);
2545 }
std::string getGenderSign() const
Definition: being.cpp:2547

References getGenderSign(), and restrict.

Referenced by BeingPopup::show(), and PopupMenu::showPopup().

◆ getGoodStatus()

int Being::getGoodStatus ( ) const
inline

Definition at line 800 of file being.h.

801  { return mGoodStatus; }

References mGoodStatus.

Referenced by PlayerRelationsManager::isGoodName().

◆ getGroupId()

int Being::getGroupId ( ) const
inline

◆ getGuild() [1/3]

Guild * Being::getGuild ( ) const

Returns a pointer to the specified guild that the being is in.

Definition at line 1280 of file being.cpp.

1281 {
1282  const std::map<int, Guild*>::const_iterator itr = mGuilds.begin();
1283  if (itr != mGuilds.end())
1284  return itr->second;
1285 
1286  return nullptr;
1287 }

References mGuilds.

Referenced by LocalPlayer::checkNewName(), and updateColors().

◆ getGuild() [2/3]

const Guild * Being::getGuild ( const int  id) const

Returns a pointer to the specified guild that the being is in.

Definition at line 1271 of file being.cpp.

1272 {
1273  const std::map<int, Guild*>::const_iterator itr = mGuilds.find(id);
1274  if (itr != mGuilds.end())
1275  return itr->second;
1276 
1277  return nullptr;
1278 }

References anonymous_namespace{badgesdb.cpp}::mGuilds.

◆ getGuild() [3/3]

const Guild * Being::getGuild ( const std::string &  guildName) const

◆ getGuildName()

const std::string& Being::getGuildName ( ) const
inline

Definition at line 259 of file being.h.

261  { return mGuildName; }

References mGuildName.

Referenced by addToCache(), Minimap::draw2(), TargetDebugTab::logic(), BeingPopup::show(), and PopupMenu::showPlayerGMCommands().

◆ getGuilds()

const std::map<int, Guild*>& Being::getGuilds ( ) const
inline

Returns all guilds the being is in.

Definition at line 306 of file being.h.

308  { return mGuilds; }

References anonymous_namespace{badgesdb.cpp}::mGuilds.

◆ getHairColor()

ItemColor Being::getHairColor ( ) const
inline

Definition at line 883 of file being.h.

884  { return mHairColor; }

References mHairColor.

Referenced by ActorManager::cloneBeing().

◆ getHeight()

int Being::getHeight ( ) const
inlinevirtual

Returns the vertical size of the current base sprite of the being.

Reimplemented from ActorSprite.

Definition at line 536 of file being.h.

537  { return std::max(CompoundSprite::getHeight(), DEFAULT_BEING_HEIGHT); }
static const int DEFAULT_BEING_HEIGHT
Definition: being.h:53
int getHeight() const

References DEFAULT_BEING_HEIGHT, and CompoundSprite::getHeight().

◆ getHitEffect()

int Being::getHitEffect ( const Being *const  attacker,
const AttackTypeT  type,
const int  attackId,
const int  level 
)
static

Definition at line 870 of file being.cpp.

874 {
875  if (effectManager == nullptr)
876  return 0;
877 
878  BLOCK_START("Being::getHitEffect")
879  // Init the particle effect path based on current
880  // weapon or default.
881  int hitEffectId = 0;
882  if (type == AttackType::SKILL || type == AttackType::SKILLMISS)
883  {
884  const SkillData *restrict const data =
885  skillDialog->getSkillDataByLevel(attackId, level);
886  if (data == nullptr)
887  return -1;
888  if (type == AttackType::SKILL)
889  {
890  hitEffectId = data->hitEffectId;
891  if (hitEffectId == -1)
892  hitEffectId = paths.getIntValue("skillHitEffectId");
893  }
894  else
895  {
896  hitEffectId = data->missEffectId;
897  if (hitEffectId == -1)
898  hitEffectId = paths.getIntValue("skillMissEffectId");
899  }
900  }
901  else
902  {
903  if (attacker != nullptr)
904  {
905  const ItemInfo *restrict const attackerWeapon
906  = attacker->getEquippedWeapon();
907  if (attackerWeapon != nullptr &&
908  attacker->getType() == ActorType::Player)
909  {
910  if (type == AttackType::MISS)
911  hitEffectId = attackerWeapon->getMissEffectId();
912  else if (type != AttackType::CRITICAL)
913  hitEffectId = attackerWeapon->getHitEffectId();
914  else
915  hitEffectId = attackerWeapon->getCriticalHitEffectId();
916  }
917  else if (attacker->getType() == ActorType::Monster)
918  {
919  const BeingInfo *restrict const info = attacker->getInfo();
920  if (info != nullptr)
921  {
922  const Attack *restrict const atk =
923  info->getAttack(attackId);
924  if (atk != nullptr)
925  {
926  if (type == AttackType::MISS)
927  hitEffectId = atk->mMissEffectId;
928  else if (type != AttackType::CRITICAL)
929  hitEffectId = atk->mHitEffectId;
930  else
931  hitEffectId = atk->mCriticalHitEffectId;
932  }
933  else
934  {
935  hitEffectId = getDefaultEffectId(type);
936  }
937  }
938  }
939  else
940  {
941  hitEffectId = getDefaultEffectId(type);
942  }
943  }
944  else
945  {
946  hitEffectId = getDefaultEffectId(type);
947  }
948  }
949  BLOCK_END("Being::getHitEffect")
950  return hitEffectId;
951 }
static int getDefaultEffectId(const AttackTypeT &type)
Definition: being.cpp:953
ActorTypeT getType() const
Definition: being.h:116
const BeingInfo * getInfo() const
Definition: being.h:409
const ItemInfo * getEquippedWeapon() const
Definition: being.h:226
int getMissEffectId() const
Definition: iteminfo.h:183
Definition: attack.h:30

References BLOCK_END, BLOCK_START, AttackType::CRITICAL, data, effectManager, getDefaultEffectId(), Configuration::getIntValue(), SkillDialog::getSkillDataByLevel(), Actions::info(), AttackType::MISS, ActorType::Monster, paths, ActorType::Player, restrict, AttackType::SKILL, skillDialog, and AttackType::SKILLMISS.

◆ getHoverCursor()

CursorT Being::getHoverCursor ( ) const
inline

Definition at line 893 of file being.h.

894  {
895  return mInfo != nullptr ?
897  }
CursorT getHoverCursor() const
Definition: beinginfo.h:87
@ CURSOR_POINTER
Definition: cursor.h:29

References Cursor::CURSOR_POINTER, BeingInfo::getHoverCursor(), and mInfo.

◆ getHP()

int Being::getHP ( ) const
inline

Definition at line 759 of file being.h.

760  { return mHP; }

References mHP.

Referenced by TmwAthena::BeingRecv::processBeingMove(), TmwAthena::BeingRecv::processBeingVisible(), and BeingPopup::show().

◆ getInfo()

const BeingInfo* Being::getInfo ( ) const
inline

◆ getIp()

const std::string& Being::getIp ( ) const
inline

Definition at line 743 of file being.h.

744  { return mIp; }

References mIp.

Referenced by addToCache(), and SocialPlayersTab::updateAvatar().

◆ getKarma()

int Being::getKarma ( ) const
inline

Definition at line 1034 of file being.h.

1035  { return mKarma; }

References mKarma.

Referenced by TargetDebugTab::logic().

◆ getLanguageId()

int Being::getLanguageId ( )
inline

Definition at line 1079 of file being.h.

1080  { return mLanguageId; }

References mLanguageId.

◆ getLastAttackX()

virtual int Being::getLastAttackX ( ) const
inlinevirtual

Reimplemented in LocalPlayer.

Definition at line 974 of file being.h.

975  { return mLastAttackX; }

References mLastAttackX.

Referenced by updateBotDirection().

◆ getLastAttackY()

virtual int Being::getLastAttackY ( ) const
inlinevirtual

Reimplemented in LocalPlayer.

Definition at line 977 of file being.h.

978  { return mLastAttackY; }

References mLastAttackY.

Referenced by updateBotDirection().

◆ getLevel()

virtual int Being::getLevel ( ) const
inlinevirtual

◆ getLook()

uint16_t Being::getLook ( ) const
inline

Definition at line 922 of file being.h.

923  { return mLook; }

References mLook.

Referenced by TmwAthena::BeingRecv::processBeingChangeLookContinue(), and EAthena::BeingRecv::processBeingChangeLookContinue().

◆ getManner()

int Being::getManner ( ) const
inline

Definition at line 1040 of file being.h.

1041  { return mManner; }

References mManner.

Referenced by TargetDebugTab::logic().

◆ getMaxHit()

int Being::getMaxHit ( ) const
inline

Definition at line 782 of file being.h.

783  { return mMaxHit; }

References mMaxHit.

Referenced by TargetDebugTab::logic().

◆ getMaxHP()

int Being::getMaxHP ( ) const
inline

Definition at line 762 of file being.h.

763  { return mMaxHP; }

References mMaxHP.

Referenced by BeingPopup::show().

◆ getMinHit()

int Being::getMinHit ( ) const
inline

Definition at line 776 of file being.h.

777  { return mMinHit; }

References mMinHit.

Referenced by TargetDebugTab::logic().

◆ getMoveAction()

std::string Being::getMoveAction ( ) const

Definition at line 1437 of file being.cpp.

1438 {
1439  if (mHorseId != 0)
1440  return SpriteAction::RIDE;
1441  if (mMap != nullptr)
1442  {
1443  const unsigned char mask = mMap->getBlockMask(mX, mY);
1444  if ((mask & BlockMask::AIR) != 0)
1445  return SpriteAction::FLY;
1446  else if ((mask & BlockMask::WATER) != 0)
1447  return SpriteAction::SWIM;
1448  }
1449  return SpriteAction::MOVE;
1450 }
static const std::string RIDE("ride")
static const std::string SWIM("swim")
static const std::string FLY("fly")
static const std::string MOVE("walk")

References BlockMask::AIR, SpriteAction::FLY(), Map::getBlockMask(), ActorSprite::mHorseId, Actor::mMap, SpriteAction::MOVE(), mX, mY, SpriteAction::RIDE(), SpriteAction::SWIM(), and BlockMask::WATER.

◆ getMoveTime()

time_t Being::getMoveTime ( ) const
inline

Definition at line 721 of file being.h.

722  { return mMoveTime; }

References mMoveTime.

◆ getName()

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

Returns the name of the being.

Definition at line 232 of file being.h.

233  { return mName; }

References mName.

Referenced by CharSelectDialog::action(), PlayerPostDeathListener::action(), ChatWindow::addWhisper(), ChatWindow::addWhisperTab(), EAthena::ChatHandler::battleTalk(), GuildManager::chat(), EAthena::ClanHandler::chat(), EAthena::GuildHandler::chat(), EAthena::PartyHandler::chat(), ChatTab::chatLog(), ActorManager::cloneBeing(), ChatWindow::doPresent(), AvatarListBox::draw(), Minimap::draw2(), ActorManager::findBeingByName(), ActorManager::findMostDamagedPlayer(), ActorManager::findNearestByName(), ActorManager::findNearestLivingBeing(), ActorManager::getMobNames(), ActorManager::getPlayerNames(), ChatWindow::getWhisperTab(), WhisperTab::handleCommandStr(), WhisperTab::handleInput(), PopupMenu::handleLink(), WhoIsOnline::handleLink(), PlayerRelationsManager::hasPermission(), ActorManager::heal(), PopupMenu::isAllowOtherCommand(), PlayerRelationsManager::isGoodName(), EAthena::PartyHandler::kick(), TargetDebugTab::logic(), outStringNormal(), SpellManager::parseCommand(), ChatWindow::parseGlobalsFilter(), ChatWindow::parseHighlights(), NpcDialog::postInit(), ActorManager::printBeingsToChat(), EAthena::ChatRecv::processBeingChat(), TmwAthena::ChatRecv::processBeingChat(), Ea::BeingRecv::processBeingRemove(), TmwAthena::BeingRecv::processBeingSelfEffect(), EAthena::BeingRecv::processBeingSpecialEffect(), EAthena::FamilyRecv::processCallPartner(), EAthena::CharServerRecv::processCharCharacters(), EAthena::CharServerRecv::processCharLogin(), TmwAthena::CharServerRecv::processCharLogin(), EAthena::ChatRecv::processChatRoomLeave(), EAthena::ChatRecv::processColorChat(), EAthena::GuildRecv::processGuildExpulsionContinue(), EAthena::GuildRecv::processGuildLeave(), EAthena::PlayerRecv::processKilledBy(), Ea::ChatRecv::processMVPEffect(), Ea::BeingRecv::processNameResponse(), EAthena::BeingRecv::processNameResponse2(), EAthena::BeingRecv::processNameResponseTitle(), EAthena::PartyRecv::processPartyInfo(), TmwAthena::PartyRecv::processPartyInfo(), TmwAthena::PartyRecv::processPartyInvited(), replaceVars(), ChatWindow::resortChatLog(), Gm::runCharCommand(), AvatarListBox::safeDraw(), CharSelectDialog::selectByName(), EAthena::Mail2Handler::sendMail(), WhoIsOnline::setNeutralColor(), PlayerRelationsManager::setRelation(), BeingPopup::show(), PopupMenu::showChatPopup(), PopupMenu::showPlayerGMCommands(), PopupMenu::showPlayerPopup(), PopupMenu::showPopup(), Actions::splitWhisper(), StatusWindow::StatusWindow(), EAthena::ChatHandler::talk(), TmwAthena::ChatHandler::talk(), CharacterDisplay::update(), GuildManager::updateList(), ActorManager::updatePlayerColors(), ActorManager::updatePlayerGuild(), and ActorManager::updatePlayerNames().

◆ getNumberOfGuilds()

int16_t Being::getNumberOfGuilds ( ) const
inline

Get number of guilds the being belongs to.

Definition at line 318 of file being.h.

319  { return CAST_S16(mGuilds.size()); }
#define CAST_S16
Definition: cast.h:28

References CAST_S16, and anonymous_namespace{badgesdb.cpp}::mGuilds.

◆ getNumberOfLayers()

int Being::getNumberOfLayers ( ) const
inlinevirtual

Get the number of layers used to draw the being

Reimplemented from Actor.

Definition at line 377 of file being.h.

References CompoundSprite::getNumberOfLayers().

Referenced by LocalPlayer::imitateOutfit().

◆ getOffset()

template<signed char pos, signed char neg>
int Being::getOffset
protected

Calculates the offset in the given directions. If walking in direction 'neg' the value is negated.

Definition at line 2467 of file being.cpp.

2468 {
2469  // Check whether we're walking in the requested direction
2470  if (mAction != BeingAction::MOVE || !(mDirection & (pos | neg)))
2471  return 0;
2472 
2473  int offset = 0;
2474 
2475  if (mMap && mSpeed)
2476  {
2477  const int time = get_elapsed_time(mActionTime);
2478  offset = (pos == BeingDirection::LEFT &&
2479  neg == BeingDirection::RIGHT) ?
2480  (time * mMap->getTileWidth() / mSpeed)
2481  : (time * mMap->getTileHeight() / mSpeed);
2482  }
2483 
2484  // We calculate the offset _from_ the _target_ location
2485  offset -= mapTileSize;
2486  if (offset > 0)
2487  offset = 0;
2488 
2489  // Going into negative direction? Invert the offset.
2490  if (mDirection & pos)
2491  offset = -offset;
2492 
2493  if (offset > mapTileSize)
2494  offset = mapTileSize;
2495  if (offset < -mapTileSize)
2496  offset = -mapTileSize;
2497 
2498  return offset;
2499 }
int getTileHeight() const
Definition: map.h:184
int getTileWidth() const
Definition: map.h:178
int get_elapsed_time(const int startTime)
Definition: timer.cpp:94

References get_elapsed_time(), Map::getTileHeight(), Map::getTileWidth(), BeingDirection::LEFT, mAction, mActionTime, mapTileSize, mDirection, Actor::mMap, BeingAction::MOVE, mSpeed, and BeingDirection::RIGHT.

Referenced by logic().

◆ getOtherTime()

time_t Being::getOtherTime ( ) const
inline

Definition at line 733 of file being.h.

734  { return mOtherTime; }

References mOtherTime.

◆ getOwner()

Being* Being::getOwner ( ) const
inline

Definition at line 914 of file being.h.

915  { return mOwner; }

References mOwner.

Referenced by PopupMenu::showPopup().

◆ getParty()

Party* Being::getParty ( ) const
inline

◆ getPartyName()

const std::string& Being::getPartyName ( ) const
inline

◆ getPath()

const Path& Being::getPath ( ) const
inline

Returns the path this being is following. An empty path is returned when this being isn't following any path currently.

Definition at line 549 of file being.h.

550  { return mPath; }

References mPath.

◆ getPvpRank()

unsigned int Being::getPvpRank ( ) const
inline

Definition at line 749 of file being.h.

750  { return mPvpRank; }

References mPvpRank.

Referenced by addToCache(), and BeingPopup::show().

◆ getRaceName()

std::string Being::getRaceName ( ) const
inline

Definition at line 861 of file being.h.

862  { return mRaceName; }

References mRaceName.

Referenced by TargetDebugTab::logic(), and StatusWindow::StatusWindow().

◆ getReachable()

ReachableT Being::getReachable ( ) const
inline

Definition at line 610 of file being.h.

611  { return mReachable; }

References mReachable.

Referenced by LocalPlayer::isReachable().

◆ getSellBoard()

std::string Being::getSellBoard ( ) const
inline

Definition at line 1010 of file being.h.

1011  { return mSellBoard; }

References mSellBoard.

Referenced by BeingPopup::show().

◆ getShowName()

bool Being::getShowName ( ) const
inline

Definition at line 245 of file being.h.

246  { return mShowName; }

References mShowName.

◆ getSitAction()

std::string Being::getSitAction ( ) const

Return sprite sit action for current environment.

Definition at line 1419 of file being.cpp.

1420 {
1421  if (mHorseId != 0)
1422  return SpriteAction::SITRIDE;
1423  if (mMap != nullptr)
1424  {
1425  const unsigned char mask = mMap->getBlockMask(mX, mY);
1426  if ((mask & BlockMask::GROUNDTOP) != 0)
1427  return SpriteAction::SITTOP;
1428  else if ((mask & BlockMask::AIR) != 0)
1429  return SpriteAction::SITSKY;
1430  else if ((mask & BlockMask::WATER) != 0)
1431  return SpriteAction::SITWATER;
1432  }
1433  return SpriteAction::SIT;
1434 }
@ GROUNDTOP
Definition: blockmask.h:35
static const std::string SIT("sit")
static const std::string SITRIDE("sitride")
static const std::string SITSKY("sitsky")
static const std::string SITWATER("sitwater")
static const std::string SITTOP("sittop")

References BlockMask::AIR, Map::getBlockMask(), BlockMask::GROUNDTOP, ActorSprite::mHorseId, Actor::mMap, mX, mY, SpriteAction::SIT(), SpriteAction::SITRIDE(), SpriteAction::SITSKY(), SpriteAction::SITTOP(), SpriteAction::SITWATER(), and BlockMask::WATER.

◆ getSortPixelY()

int Being::getSortPixelY ( ) const
inlinevirtual

Returns the pixel Y coordinate of the actor for sorting only.

Reimplemented from Actor.

Definition at line 961 of file being.h.

962  { return CAST_S32(mPos.y) - mYDiff - mSortOffsetY; }
Vector mPos
Definition: actor.h:140
int mYDiff
Definition: actor.h:141

References CAST_S32, anonymous_namespace{mrand.cpp}::mPos, mSortOffsetY, and Actor::mYDiff.

◆ getSpawnAction()

std::string Being::getSpawnAction ( ) const

Definition at line 1528 of file being.cpp.

◆ getSpiritBalls()

unsigned int Being::getSpiritBalls ( ) const
inline

Definition at line 1020 of file being.h.

1021  { return mSpiritBalls; }

References mSpiritBalls.

◆ getSpriteColor()

ItemColor Being::getSpriteColor ( const int  slot) const

Definition at line 4910 of file being.cpp.

4911 {
4912  if (slot < 0 || CAST_SIZE(slot) >= mSlots.size())
4913  return ItemColor_one;
4914 
4915  return mSlots[slot].colorId;
4916 }
#define CAST_SIZE
Definition: cast.h:34
const ItemColor ItemColor_one
Definition: itemcolor.h:30

References CAST_SIZE, and ItemColor_one.

Referenced by ActorManager::cloneBeing().

◆ getSpriteDirection()

SpriteDirection::Type Being::getSpriteDirection ( ) const
inline

Returns the direction the being is facing.

Definition at line 511 of file being.h.

513  { return mSpriteDirection; }

References mSpriteDirection.

◆ getSpriteID()

int Being::getSpriteID ( const int  slot) const

Definition at line 4894 of file being.cpp.

4895 {
4896  if (slot < 0 || CAST_SIZE(slot) >= mSlots.size())
4897  return -1;
4898 
4899  return mSlots[slot].spriteId;
4900 }

References CAST_SIZE.

Referenced by ActorManager::cloneBeing(), and EAthena::BeingRecv::processBeingChangeLookContinue().

◆ getSpriteSlot()

const BeingSlot & Being::getSpriteSlot ( const int  slot) const

Definition at line 4902 of file being.cpp.

4903 {
4904  if (slot < 0 || CAST_SIZE(slot) >= mSlots.size())
4905  return *emptyBeingSlot;
4906 
4907  return mSlots[slot];
4908 }
BeingSlot * emptyBeingSlot
Definition: beingslot.cpp:26

References CAST_SIZE, and emptyBeingSlot.

◆ getStandAction()

std::string Being::getStandAction ( ) const

Definition at line 1530 of file being.cpp.

1531 {
1532  if (mHorseId != 0)
1533  return SpriteAction::STANDRIDE;
1534  if (mMap != nullptr)
1535  {
1536  const unsigned char mask = mMap->getBlockMask(mX, mY);
1537  if (mTrickDead)
1538  {
1539  if ((mask & BlockMask::AIR) != 0)
1540  return SpriteAction::DEADSKY;
1541  else if ((mask & BlockMask::WATER) != 0)
1542  return SpriteAction::DEADWATER;
1543  else
1544  return SpriteAction::DEAD;
1545  }
1546  if ((mask & BlockMask::AIR) != 0)
1547  return SpriteAction::STANDSKY;
1548  else if ((mask & BlockMask::WATER) != 0)
1549  return SpriteAction::STANDWATER;
1550  }
1551  return SpriteAction::STAND;
1552 }
bool mTrickDead
Definition: actorsprite.h:263
static const std::string STANDWATER("standwater")
static const std::string STANDRIDE("standride")
static const std::string DEAD("dead")
static const std::string STANDSKY("standsky")
static const std::string DEADSKY("deadsky")
static const std::string DEADWATER("deadwater")

References BlockMask::AIR, SpriteAction::DEAD(), SpriteAction::DEADSKY(), SpriteAction::DEADWATER(), Ea::GameRecv::mMap, SpriteAction::STAND(), SpriteAction::STANDRIDE(), SpriteAction::STANDSKY(), SpriteAction::STANDWATER(), and BlockMask::WATER.

◆ getSubType()

BeingTypeId Being::getSubType ( ) const
inline

◆ getTalkTime()

time_t Being::getTalkTime ( ) const
inline

Definition at line 727 of file being.h.

728  { return mTalkTime; }

References mTalkTime.

◆ getTargetCursorSize()

TargetCursorSizeT Being::getTargetCursorSize ( ) const
virtual

Returns the required size of a target cursor for this being.

Reimplemented from ActorSprite.

Definition at line 518 of file being.cpp.

519 {
520  if (mInfo == nullptr)
522 
523  return mInfo->getTargetCursorSize();
524 }
TargetCursorSizeT getTargetCursorSize() const
Definition: beinginfo.h:90

References BeingInfo::getTargetCursorSize(), mInfo, and TargetCursorSize::SMALL.

◆ getTargetOffsetX()

int Being::getTargetOffsetX ( ) const
inlinevirtual

Reimplemented from ActorSprite.

Definition at line 415 of file being.h.

416  {
417  if (mInfo == nullptr)
418  return 0;
419  return mInfo->getTargetOffsetX();
420  }

References BeingInfo::getTargetOffsetX(), and mInfo.

◆ getTargetOffsetY()

int Being::getTargetOffsetY ( ) const
inlinevirtual

Reimplemented from ActorSprite.

Definition at line 422 of file being.h.

423  {
424  if (mInfo == nullptr)
425  return 0;
426  return mInfo->getTargetOffsetY();
427  }

References BeingInfo::getTargetOffsetY(), and mInfo.

◆ getTeamId()

uint16_t Being::getTeamId ( ) const
inline

Definition at line 1082 of file being.h.

1083  { return mTeamId; }

References mTeamId.

Referenced by addToCache(), and ActorManager::findNearestPvpPlayer().

◆ getTestTime()

time_t Being::getTestTime ( ) const
inline

Definition at line 730 of file being.h.

731  { return mTestTime; }

References mTestTime.

◆ getTileX()

int Being::getTileX ( ) const
inlinevirtual

◆ getTileY()

int Being::getTileY ( ) const
inlinevirtual

◆ getType()

ActorTypeT Being::getType ( ) const
inlinevirtual

Returns the type of the ActorSprite.

Reimplemented from ActorSprite.

Definition at line 116 of file being.h.

118  { return mType; }

References mType.

Referenced by LocalPlayer::attack(), LocalPlayer::attack2(), LocalPlayer::checkNewName(), Minimap::draw2(), ActorManager::findBeingByName(), ActorManager::findBeingByPixel(), ActorManager::findNearestByName(), ActorManager::findNearestLivingBeing(), ActorManager::getMobNames(), ActorManager::getPlayerNames(), PlayerRelationsManager::hasPermission(), ActorManager::heal(), SpellManager::invoke(), LocalPlayer::logic(), FindBeingFunctor::operator()(), Ea::BeingRecv::processBeingAction(), EAthena::BeingRecv::processBeingAction2(), TmwAthena::BeingRecv::processBeingChangeLookContinue(), EAthena::BeingRecv::processBeingChangeLookContinue(), EAthena::ChatRecv::processBeingChat(), TmwAthena::ChatRecv::processBeingChat(), Ea::BeingRecv::processBeingEmotion(), EAthena::BeingRecv::processBeingMove(), TmwAthena::BeingRecv::processBeingMove(), EAthena::BeingRecv::processBeingMove2(), TmwAthena::BeingRecv::processBeingMove2(), Ea::BeingRecv::processBeingRemove(), TmwAthena::BeingRecv::processBeingSelfEffect(), EAthena::BeingRecv::processBeingSpawn(), EAthena::BeingRecv::processBeingSpecialEffect(), EAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processBeingVisible(), Ea::BeingRecv::processNameResponse(), EAthena::BeingRecv::processNameResponse2(), EAthena::BeingRecv::processNameResponseTitle(), TmwAthena::PartyRecv::processPartyInvited(), Ea::PartyRecv::processPartyLeave(), TmwAthena::BeingRecv::processPlayerMove(), replaceVars(), LocalPlayer::setTarget(), BeingPopup::show(), PopupMenu::showChatPopup(), PopupMenu::showPopup(), PlayerRelationsManager::signalUpdate(), ActorManager::updatePlayerColors(), ActorManager::updatePlayerGuild(), ActorManager::updatePlayerNames(), and ActorManager::validateBeing().

◆ getWalkSpeed()

int Being::getWalkSpeed ( ) const
inline

Gets the walk speed in pixels per second.

Definition at line 458 of file being.h.

459  { return mWalkSpeed; }

References mWalkSpeed.

Referenced by LocalPlayer::LocalPlayer().

◆ getWeaponAttackAction()

std::string Being::getWeaponAttackAction ( const ItemInfo *const  weapon) const

Definition at line 1452 of file being.cpp.

1454 {
1455  if (weapon == nullptr)
1456  return getAttackAction();
1457 
1458  if (mHorseId != 0)
1459  return weapon->getRideAttackAction();
1460  if (mMap != nullptr)
1461  {
1462  const unsigned char mask = mMap->getBlockMask(mX, mY);
1463  if ((mask & BlockMask::AIR) != 0)
1464  return weapon->getSkyAttackAction();
1465  else if ((mask & BlockMask::WATER) != 0)
1466  return weapon->getWaterAttackAction();
1467  }
1468  return weapon->getAttackAction();
1469 }
const std::string & getWaterAttackAction() const
Definition: iteminfo.h:192
const std::string & getRideAttackAction() const
Definition: iteminfo.h:195
const std::string & getAttackAction() const
Definition: iteminfo.h:186
const std::string & getSkyAttackAction() const
Definition: iteminfo.h:189

References BlockMask::AIR, Ea::GameRecv::mMap, and BlockMask::WATER.

◆ getWidth()

int Being::getWidth ( ) const
inlinevirtual

Returns the horizontal size of the current base sprite of the being.

Reimplemented from ActorSprite.

Definition at line 530 of file being.h.

531  { return std::max(CompoundSprite::getWidth(), DEFAULT_BEING_WIDTH); }
static const int DEFAULT_BEING_WIDTH
Definition: being.h:52
int getWidth() const

References DEFAULT_BEING_WIDTH, and CompoundSprite::getWidth().

◆ handleAttack()

void Being::handleAttack ( Being *const  victim,
const int  damage,
const int  attackId 
)

Handles an attack of another being by this being.

Parameters
victimthe victim being
damagethe amount of damage dealt (0 means miss)
attackIdthe attack id

Definition at line 963 of file being.cpp.

966 {
967  if ((victim == nullptr) || (mInfo == nullptr))
968  return;
969 
970  BLOCK_START("Being::handleAttack")
971 
972  if (this != localPlayer)
973  setAction(BeingAction::ATTACK, attackId);
974 
975  mLastAttackX = victim->mX;
976  mLastAttackY = victim->mY;
977 
978  if (mType == ActorType::Player && (mEquippedWeapon != nullptr))
979  fireMissile(victim, mEquippedWeapon->getMissileConst());
980  else if (mInfo->getAttack(attackId) != nullptr)
981  fireMissile(victim, mInfo->getAttack(attackId)->mMissile);
982 
983  reset();
985 
987  this != localPlayer)
988  {
989  const uint8_t dir = calcDirection(victim->mX,
990  victim->mY);
991  if (dir != 0U)
992  setDirection(dir);
993  }
994 
995  if ((damage != 0) && victim->mType == ActorType::Player
996  && victim->mAction == BeingAction::SIT)
997  {
998  victim->setAction(BeingAction::STAND, 0);
999  }
1000 
1001  if (mType == ActorType::Player)
1002  {
1003  if (mSlots.size() >= 10)
1004  {
1005  // here 10 is weapon slot
1006  int weaponId = mSlots[10].spriteId;
1007  if (weaponId == 0)
1008  weaponId = -100 - toInt(mSubType, int);
1009  const ItemInfo &info = ItemDB::get(weaponId);
1010  playSfx(info.getSound(
1011  (damage > 0) ? ItemSoundEvent::HIT : ItemSoundEvent::MISS),
1012  victim,
1013  true,
1014  mX, mY);
1015  }
1016  }
1017  else
1018  {
1019  playSfx(mInfo->getSound((damage > 0) ?
1020  ItemSoundEvent::HIT : ItemSoundEvent::MISS), victim, true, mX, mY);
1021  }
1022  BLOCK_END("Being::handleAttack")
1023 }
const SoundInfo & getSound(const ItemSoundEvent::Type event) const
Definition: beinginfo.cpp:165
virtual void setDirection(const uint8_t direction)
Definition: being.cpp:1690
virtual void setAction(const BeingActionT &action, const int attackId)
Definition: being.cpp:1554
void playSfx(const SoundInfo &sound, Being *const being, const bool main, const int x, const int y) const
Definition: being.cpp:4967
uint8_t calcDirection() const
Definition: being.cpp:1753
void fireMissile(Being *const victim, const MissileInfo &missile) const
Definition: being.cpp:1378

References BeingAction::ATTACK, BLOCK_END, BLOCK_START, ItemDB::get(), Net::getNetworkType(), ItemSoundEvent::HIT, Actions::info(), localPlayer, ItemSoundEvent::MISS, ActorType::Player, BeingAction::SIT, BeingAction::STAND, tick_time, ServerType::TMWATHENA, and toInt.

Referenced by Ea::BeingRecv::processBeingAction(), and EAthena::BeingRecv::processBeingAction2().

◆ handleSkill()

void Being::handleSkill ( Being *const  victim,
const int  damage,
const int  skillId,
const int  skillLevel 
)

Definition at line 1050 of file being.cpp.

1054 {
1055  if ((victim == nullptr) || (mInfo == nullptr) || (skillDialog == nullptr))
1056  return;
1057 
1058  const SkillInfo *restrict const skill = skillDialog->getSkill(skillId);
1059  const SkillData *restrict const data = skill != nullptr
1060  ? skill->getData1(skillLevel) : nullptr;
1061  if (data != nullptr)
1062  {
1063  effectManager->triggerDefault(data->srcEffectId,
1064  this,
1065  paths.getIntValue("skillSrcEffectId"));
1066  effectManager->triggerDefault(data->dstEffectId,
1067  victim,
1068  paths.getIntValue("skillDstEffectId"));
1069  fireMissile(victim, data->missile);
1070  }
1071 
1072  if (this != localPlayer && (skill != nullptr))
1073  {
1074  const SkillType::SkillType type = skill->type;
1075  if ((type & SkillType::Attack) != 0 ||
1076  (type & SkillType::Ground) != 0)
1077  {
1079  }
1080  else
1081  {
1083  }
1084  }
1085 
1086  reset();
1088 
1090  this != localPlayer)
1091  {
1092  const uint8_t dir = calcDirection(victim->mX,
1093  victim->mY);
1094  if (dir != 0U)
1095  setDirection(dir);
1096  }
1097  if ((damage != 0) && victim->mType == ActorType::Player
1098  && victim->mAction == BeingAction::SIT)
1099  {
1100  victim->setAction(BeingAction::STAND, 0);
1101  }
1102  if (data != nullptr)
1103  {
1104  if (damage > 0)
1105  playSfx(data->soundHit, victim, true, mX, mY);
1106  else
1107  playSfx(data->soundMiss, victim, true, mX, mY);
1108  }
1109  else
1110  {
1111  playSfx(mInfo->getSound((damage > 0) ?
1113  victim,
1114  true,
1115  mX, mY);
1116  }
1117 }
void triggerDefault(int effectId, Being *const being, const int defaultEffectId)
SkillInfo * getSkill(const int id) const

References BeingAction::ATTACK, SkillType::Attack, data, effectManager, Configuration::getIntValue(), Net::getNetworkType(), SkillDialog::getSkill(), SkillType::Ground, ItemSoundEvent::HIT, localPlayer, ItemSoundEvent::MISS, paths, ActorType::Player, restrict, BeingAction::SIT, Actions::skill(), skillDialog, BeingAction::STAND, tick_time, ServerType::TMWATHENA, and EffectManager::triggerDefault().

Referenced by EAthena::BeingRecv::processSkillAutoCast(), EAthena::BeingRecv::processSkillDamage(), TmwAthena::BeingRecv::processSkillDamage(), and Ea::BeingRecv::processSkillNoDamage().

◆ handleSkillCasting()

void Being::handleSkillCasting ( Being *const  victim,
const int  skillId,
const int  skillLevel 
)

Definition at line 1025 of file being.cpp.

1028 {
1029  if ((victim == nullptr) || (mInfo == nullptr) || (skillDialog == nullptr))
1030  return;
1031 
1032  setAction(BeingAction::CAST, skillId);
1033 
1035  skillId,
1036  skillLevel);
1037 
1038  if (data != nullptr)
1039  {
1040  effectManager->triggerDefault(data->castingSrcEffectId,
1041  this,
1042  paths.getIntValue("skillCastingSrcEffectId"));
1043  effectManager->triggerDefault(data->castingDstEffectId,
1044  victim,
1045  paths.getIntValue("skillCastingDstEffectId"));
1046  fireMissile(victim, data->castingMissile);
1047  }
1048 }

References BeingAction::CAST, data, effectManager, Configuration::getIntValue(), SkillDialog::getSkillDataByLevel(), paths, restrict, skillDialog, and EffectManager::triggerDefault().

Referenced by EAthena::BeingRecv::processSkillCastingContinue().

◆ incUsage()

void Being::incUsage ( )
inline

Definition at line 968 of file being.h.

969  { mUsageCounter ++; }

References mUsageCounter.

◆ intToGender()

static GenderT Being::intToGender ( const uint8_t  sex)
inlinestatic

◆ isAdvanced()

bool Being::isAdvanced ( ) const
inline

Definition at line 828 of file being.h.

829  { return mAdvanced; }

References mAdvanced.

Referenced by addToCache(), and BeingPopup::show().

◆ isAlive()

bool Being::isAlive ( ) const
inline

◆ isBuyShopEnabled()

bool Being::isBuyShopEnabled ( ) const

Definition at line 5351 of file being.cpp.

5352 {
5354  !mBuyBoard.empty());
5355 }

References Net::getNetworkType(), mBuyBoard, mShop, and ServerType::TMWATHENA.

Referenced by PopupMenu::addBuySell().

◆ isGM()

bool Being::isGM ( ) const
inline

◆ isInParty()

bool Being::isInParty ( ) const
inline

◆ isSellShopEnabled()

bool Being::isSellShopEnabled ( ) const

Definition at line 5357 of file being.cpp.

5358 {
5360  !mSellBoard.empty());
5361 }

References Net::getNetworkType(), mSellBoard, mShop, and ServerType::TMWATHENA.

Referenced by PopupMenu::addBuySell().

◆ loadComment()

std::string Being::loadComment ( const std::string &  name,
const ActorTypeT type 
)
static

Definition at line 4734 of file being.cpp.

4736 {
4737  std::string str;
4738  switch (type)
4739  {
4740  case ActorType::Player:
4741  str = settings.usersDir;
4742  break;
4743  case ActorType::Npc:
4744  str = settings.npcsDir;
4745  break;
4746  case ActorType::Unknown:
4747  case ActorType::Monster:
4748  case ActorType::FloorItem:
4749  case ActorType::Portal:
4750  case ActorType::Avatar:
4751  case ActorType::Mercenary:
4752  case ActorType::Homunculus:
4753  case ActorType::Pet:
4754  case ActorType::SkillUnit:
4755  case ActorType::Elemental:
4756  default:
4757  return "";
4758  }
4759 
4760  str = pathJoin(str, stringToHexPath(name), "comment.txt");
4761  if (Files::existsLocal(str))
4762  {
4763  StringVect lines;
4764  Files::loadTextFileLocal(str, lines);
4765  if (lines.size() >= 2)
4766  return lines[1];
4767  }
4768  return std::string();
4769 }
std::string npcsDir
Definition: settings.h:120
std::string usersDir
Definition: settings.h:118
bool loadTextFileLocal(const std::string &fileName, StringVect &lines)
Definition: files.cpp:229
bool existsLocal(const std::string &path)
Definition: files.cpp:209
Settings settings
Definition: settings.cpp:32
std::string stringToHexPath(const std::string &str)
std::string pathJoin(std::string str1, const std::string &str2)
std::vector< std::string > StringVect
Definition: stringvector.h:29

References ActorType::Avatar, ActorType::Elemental, Files::existsLocal(), ActorType::FloorItem, ActorType::Homunculus, Files::loadTextFileLocal(), ActorType::Mercenary, ActorType::Monster, ActorType::Npc, Settings::npcsDir, pathJoin(), ActorType::Pet, ActorType::Player, ActorType::Portal, settings, ActorType::SkillUnit, stringToHexPath(), ActorType::Unknown, and Settings::usersDir.

Referenced by PopupMenu::handleLink(), and updateComment().

◆ logic()

void Being::logic ( )
virtual

Performs being logic.

Reimplemented from ActorSprite.

Reimplemented in LocalPlayer.

Definition at line 1834 of file being.cpp.

1835 {
1836  BLOCK_START("Being::logic")
1837  if (A_UNLIKELY(mSpeechTime != 0))
1838  {
1839  mSpeechTime--;
1840  if (mSpeechTime == 0 && mText != nullptr)
1841  delete2(mText)
1842  }
1843 
1844  if (A_UNLIKELY(mOwner != nullptr))
1845  {
1846  if (mType == ActorType::Homunculus ||
1848  {
1849  botLogic();
1850  }
1851  }
1852 
1853  const int time = tick_time * MILLISECONDS_IN_A_TICK;
1854  if (mEmotionSprite != nullptr)
1855  mEmotionSprite->update(time);
1857  (*it)->update(time);
1859  (*it)->update(time);
1860 
1862  {
1863  mCastEndTime = 0;
1865  }
1866 
1868  {
1869  mAnimationEffect->update(time);
1872  }
1874  {
1875  mCastingEffect->update(time);
1878  }
1879  for_each_badges()
1880  {
1881  AnimatedSprite *restrict const sprite = mBadges[f];
1882  if (sprite != nullptr)
1883  sprite->update(time);
1884  }
1885 
1886  int frameCount = CAST_S32(getFrameCount());
1887 
1888  switch (mAction)
1889  {
1890  case BeingAction::STAND:
1891  case BeingAction::SIT:
1892  case BeingAction::DEAD:
1893  case BeingAction::HURT:
1894  case BeingAction::SPAWN:
1895  case BeingAction::CAST:
1896  default:
1897  break;
1898 
1899  case BeingAction::MOVE:
1900  {
1902  nextTile();
1903  break;
1904  }
1905 
1906  case BeingAction::ATTACK:
1907  {
1908  if (mActionTime == 0)
1909  break;
1910 
1911  int curFrame = 0;
1912  if (mAttackSpeed != 0)
1913  {
1914  curFrame = (get_elapsed_time(mActionTime) * frameCount)
1915  / mAttackSpeed;
1916  }
1917 
1918  if (this == localPlayer && curFrame >= frameCount)
1919  nextTile();
1920 
1921  break;
1922  }
1923 
1924  case BeingAction::PRESTAND:
1925  {
1926  if (get_elapsed_time1(mPreStandTime) > 10)
1928  break;
1929  }
1930  }
1931 
1933  {
1934  const int xOffset = getOffset<BeingDirection::LEFT,
1936  const int yOffset = getOffset<BeingDirection::UP,
1938  int offset = xOffset;
1939  if (offset == 0)
1940  offset = yOffset;
1941 
1942  if ((xOffset == 0) && (yOffset == 0))
1943  mNeedPosUpdate = false;
1944 
1945  const int halfTile = mapTileSize / 2;
1946  const float offset2 = static_cast<float>(
1947  mPixelOffsetY * abs(offset)) / 2;
1948 // mSortOffsetY = (mOldHeight - mFixedOffsetY + mPixelOffsetY)
1949 // * halfTile - offset2;
1950  mSortOffsetY = 0;
1951  const float yOffset3 = (mY + 1) * mapTileSize + yOffset
1952  - (mOldHeight + mPixelOffsetY) * halfTile + offset2;
1953 
1954  // Update pixel coordinates
1955  setPixelPositionF(static_cast<float>(mX * mapTileSize
1956  + mapTileSize / 2 + xOffset),
1957  yOffset3,
1958  0.0F);
1959  }
1960 
1962  {
1963  mEmotionTime--;
1964  if (mEmotionTime == 0)
1966  }
1967 
1969 
1970  if (frameCount < 10)
1971  frameCount = 10;
1972 
1973  if (A_UNLIKELY(!isAlive() &&
1974  mSpeed != 0 &&
1976  get_elapsed_time(mActionTime) / mSpeed >= frameCount))
1977  {
1978  if (mType != ActorType::Player && (actorManager != nullptr))
1979  actorManager->destroy(this);
1980  }
1981 
1982  const SoundInfo *restrict const sound = mNextSound.sound;
1983  if (A_UNLIKELY(sound))
1984  {
1985  const int time2 = tick_time;
1986  if (time2 > mNextSound.time)
1987  {
1988  soundManager.playSfx(sound->sound,
1989  mNextSound.x,
1990  mNextSound.y);
1991  mNextSound.sound = nullptr;
1992  mNextSound.time = time2 + sound->delay;
1993  }
1994  }
1995 
1996  BLOCK_END("Being::logic")
1997 }
ActorManager * actorManager
void destroy(ActorSprite *const actor)
virtual void logic()
bool isTerminated() const
void setPixelPositionF(const Vector &pos)
Definition: being.cpp:526
virtual void nextTile()
Definition: being.cpp:1782
void botLogic()
Definition: being.cpp:1999
int getOffset() const
Definition: being.cpp:2467
bool isAlive() const
Definition: being.h:488
void update(const int time)
bool isTerminated() const
unsigned int getFrameCount() const
virtual bool removeDeadBeings() const =0
void playSfx(const std::string &path, const int x, const int y) const
Net::GameHandler * gameHandler
Definition: net.cpp:91
#define A_UNLIKELY(x)
Definition: likely.h:30
SoundManager soundManager
const SoundInfo * sound
Definition: being.h:88
int time
Definition: being.h:91
int get_elapsed_time1(const int startTime)
Definition: timer.cpp:105

References A_UNLIKELY, actorManager, BeingAction::ATTACK, BLOCK_END, BLOCK_START, botLogic(), BeingAction::CAST, CAST_S32, BeingAction::DEAD, delete2, ActorManager::destroy(), BeingDirection::DOWN, for_each_badges, for_each_horses, gameHandler, get_elapsed_time(), get_elapsed_time1(), CompoundSprite::getFrameCount(), getOffset(), ActorType::Homunculus, BeingAction::HURT, isAlive(), CastingEffect::isTerminated(), AnimatedSprite::isTerminated(), BeingDirection::LEFT, localPlayer, ActorSprite::logic(), mAction, mActionTime, mAnimationEffect, mapTileSize, mAttackSpeed, mBadges, mCastEndTime, mCastingEffect, mDownHorseSprites, mEmotionSprite, mEmotionTime, ActorType::Mercenary, MILLISECONDS_IN_A_TICK, mNeedPosUpdate, mNextSound, mOldHeight, BeingAction::MOVE, mOwner, mPixelOffsetY, mPreStandTime, mSortOffsetY, mSpeechTime, mSpeed, mText, mType, mUpHorseSprites, mX, mY, nextTile(), ActorType::Player, SoundManager::playSfx(), BeingAction::PRESTAND, Net::GameHandler::removeDeadBeings(), restrict, BeingDirection::RIGHT, setAction(), setPixelPositionF(), BeingAction::SIT, NextSoundInfo::sound, soundManager, BeingAction::SPAWN, BeingAction::STAND, tick_time, NextSoundInfo::time, BeingDirection::UP, CastingEffect::update(), AnimatedSprite::update(), NextSoundInfo::x, and NextSoundInfo::y.

Referenced by LocalPlayer::logic(), CharCreateDialog::logic(), NpcDialog::logic(), and NpcDialog::showAvatar().

◆ moveBotTo()

void Being::moveBotTo ( int  dstX,
int  dstY 
)
protected

Definition at line 2192 of file being.cpp.

2194 {
2195  const int dstX0 = mOwner->mX;
2196  const int dstY0 = mOwner->mY;
2197  const unsigned char blockWalkMask = getBlockWalkMask();
2198  if (!mMap->getWalk(dstX, dstY, blockWalkMask))
2199  {
2200  if (dstX != dstX0)
2201  {
2202  dstX = dstX0;
2203  if (!mMap->getWalk(dstX, dstY, blockWalkMask))
2204  dstY = dstY0;
2205  }
2206  else if (dstY != dstY0)
2207  {
2208  dstY = dstY0;
2209  if (!mMap->getWalk(dstX, dstY, blockWalkMask))
2210  dstX = dstX0;
2211  }
2212  }
2213  if (mX != dstX || mY != dstY)
2214  {
2216  homunculusHandler->move(dstX, dstY);
2217  else
2218  mercenaryHandler->move(dstX, dstY);
2219  return;
2220  }
2221  updateBotDirection(dstX, dstY);
2222 }
void updateBotDirection(const int dstX, const int dstY)
Definition: being.cpp:2224
virtual void move(const int x, const int y) const =0
virtual void move(const int x, const int y) const =0
static const int blockWalkMask

References blockWalkMask, getBlockWalkMask(), Map::getWalk(), ActorType::Homunculus, homunculusHandler, mercenaryHandler, Actor::mMap, Net::HomunculusHandler::move(), Net::MercenaryHandler::move(), mOwner, mType, mX, mY, and updateBotDirection().

Referenced by botLogic(), and updateBotFollow().

◆ nextTile()

void Being::nextTile ( )
virtual

Makes this being take the next tile of its path.

Reimplemented in LocalPlayer.

Definition at line 1782 of file being.cpp.

1783 {
1784  if (mPath.empty())
1785  {
1788  return;
1789  }
1790 
1791  const Position pos = mPath.front();
1792  mPath.pop_front();
1793 
1794  const uint8_t dir = calcDirection(pos.x, pos.y);
1795  if (dir != 0U)
1796  setDirection(dir);
1797 
1798  if (mMap == nullptr ||
1799  !mMap->getWalk(pos.x, pos.y, getBlockWalkMask()))
1800  {
1802  return;
1803  }
1804 
1805  mActionTime += mSpeed / 10;
1807  && mX != pos.x && mY != pos.y)
1808  {
1809  mSpeed = mWalkSpeed * 14 / 10;
1810  }
1811  else
1812  {
1813  mSpeed = mWalkSpeed;
1814  }
1815 
1816  if (mX != pos.x || mY != pos.y)
1817  {
1820  mMap->getBlockMask(mX, mY) != mMap->getBlockMask(pos.x, pos.y))
1821  {
1823  }
1824  }
1825  mX = pos.x;
1826  mY = pos.y;
1827  const uint8_t height = mMap->getHeightOffset(mX, mY);
1828  mPixelOffsetY = height - mOldHeight;
1829  mFixedOffsetY = height;
1830  mNeedPosUpdate = true;
1832 }
static bool mUseDiagonal
Definition: being.h:1347
uint8_t getHeightOffset(const int x, const int y) const
Definition: map.cpp:1631
@ REACH_NO
Definition: reachable.h:33
int y
Definition: position.h:46
int x
Definition: position.h:45

References calcDirection(), Map::getBlockMask(), getBlockWalkMask(), Map::getHeightOffset(), Map::getWalk(), mAction, mActionTime, mFixedOffsetY, Actor::mMap, mNeedPosUpdate, mOldHeight, BeingAction::MOVE, mPath, mPixelOffsetY, mPreStandTime, mReachable, mSpeed, mType, mUseDiagonal, mWalkSpeed, mX, mY, ActorType::Player, BeingAction::PRESTAND, Reachable::REACH_NO, Reachable::REACH_UNKNOWN, setAction(), setDirection(), BeingAction::STAND, tick_time, Position::x, and Position::y.

Referenced by logic(), and LocalPlayer::nextTile().

◆ optionChanged()

void Being::optionChanged ( const std::string &  name)
virtual

Called when an option changed. The config listener will have to be registered to the option name first.

Implements ConfigListener.

Reimplemented in LocalPlayer.

Definition at line 2523 of file being.cpp.

2524 {
2525  if (mType == ActorType::Player && value == "visiblenames")
2526  {
2527  setShowName(config.getIntValue("visiblenames") == VisibleName::Show);
2529  }
2530 }
void setShowName(const bool doShowName)
Definition: being.cpp:1166
void updateBadgesPosition()
Definition: being.cpp:2313

References config, Configuration::getIntValue(), ActorType::Player, and VisibleName::Show.

◆ playSfx()

void Being::playSfx ( const SoundInfo sound,
Being *const  being,
const bool  main,
const int  x,
const int  y 
) const

Definition at line 4967 of file being.cpp.

4971 {
4972  BLOCK_START("Being::playSfx")
4973 
4974  if (being != nullptr)
4975  {
4976  // here need add timer and delay sound
4977  const int time = tick_time;
4978  if (main)
4979  {
4980  being->mNextSound.sound = nullptr;
4981  being->mNextSound.time = time + sound.delay;
4982  soundManager.playSfx(sound.sound, x, y);
4983  }
4984  else if (mNextSound.time <= time)
4985  { // old event sound time is gone. we can play new sound
4986  being->mNextSound.sound = nullptr;
4987  being->mNextSound.time = time + sound.delay;
4988  soundManager.playSfx(sound.sound, x, y);
4989  }
4990  else
4991  { // old event sound in progress. need save sound and wait
4992  being->mNextSound.sound = &sound;
4993  being->mNextSound.x = x;
4994  being->mNextSound.y = y;
4995  }
4996  }
4997  else
4998  {
4999  soundManager.playSfx(sound.sound, x, y);
5000  }
5001  BLOCK_END("Being::playSfx")
5002 }
int main(int argc, char *argv[])
Definition: main.cpp:40
std::string sound
Definition: soundinfo.h:45
int delay
Definition: soundinfo.h:46

References BLOCK_END, BLOCK_START, main(), SoundManager::playSfx(), soundManager, tick_time, x, and y.

◆ postInit()

void Being::postInit ( const BeingTypeId  subType,
Map *const  map 
)
protected

Definition at line 289 of file being.cpp.

291 {
292  setMap(map);
293  setSubtype(subtype, 0);
294 
296 
297  switch (mType)
298  {
299  case ActorType::Player:
301  case ActorType::Pet:
304  showName1 = static_cast<VisibleName::Type>(
305  config.getIntValue("visiblenames"));
306  break;
307  case ActorType::Portal:
309  showName1 = VisibleName::Hide;
310  break;
311  default:
312  case ActorType::Unknown:
313  case ActorType::Npc:
314  case ActorType::Monster:
316  case ActorType::Avatar:
317  break;
318  }
319 
320  if (mType != ActorType::Npc)
321  mGotComment = true;
322 
323  config.addListener("visiblenames", this);
324 
325  reReadConfig();
326 
327  if (mType == ActorType::Npc ||
328  showName1 == VisibleName::Show)
329  {
330  setShowName(true);
331  }
332 
333  updateColors();
334  updatePercentHP();
335 }
void updatePercentHP()
Definition: being.cpp:4876
void updateColors()
Definition: being.cpp:2663
void setSubtype(const BeingTypeId subtype, const uint16_t look)
Definition: being.cpp:371
void setMap(Map *const map)
Definition: being.cpp:5023
static void reReadConfig()
Definition: being.cpp:3431
void addListener(const std::string &key, ConfigListener *const listener)

References Configuration::addListener(), ActorType::Avatar, config, ActorType::Elemental, ActorType::FloorItem, Configuration::getIntValue(), VisibleName::Hide, ActorType::Homunculus, ActorType::Mercenary, mGotComment, ActorType::Monster, mType, ActorType::Npc, ActorType::Pet, ActorType::Player, ActorType::Portal, reReadConfig(), setMap(), setShowName(), setSubtype(), VisibleName::Show, ActorType::SkillUnit, ActorType::Unknown, updateColors(), and updatePercentHP().

Referenced by createBeing(), and LocalPlayer::LocalPlayer().

◆ recalcSpritesOrder()

void Being::recalcSpritesOrder ( )

Definition at line 4359 of file being.cpp.

4360 {
4361  if (!mEnableReorderSprites)
4362  return;
4363 
4364 // logger->log("recalcSpritesOrder");
4365  const size_t sz = mSprites.size();
4366  if (sz < 1)
4367  return;
4368 
4369  STD_VECTOR<int> slotRemap;
4370  IntMap itemSlotRemap;
4371 
4372  STD_VECTOR<int>::iterator it;
4373  int oldHide[20];
4374  bool updatedSprite[20];
4375  int dir = mSpriteDirection;
4376  if (dir < 0 || dir >= 9)
4377  dir = 0;
4378  // hack for allow different logic in dead player
4379  if (mAction == BeingAction::DEAD)
4380  dir = 9;
4381 
4382  const unsigned int hairSlot = charServerHandler->hairSprite();
4383 
4384  for (size_t slot = sz; slot < 20; slot ++)
4385  {
4386  oldHide[slot] = 0;
4387  updatedSprite[slot] = false;
4388  }
4389 
4390  for (size_t slot = 0; slot < sz; slot ++)
4391  {
4392  oldHide[slot] = mSpriteHide[slot];
4393  mSpriteHide[slot] = 0;
4394  updatedSprite[slot] = false;
4395  }
4396 
4397  size_t spriteIdSize = mSlots.size();
4398  if (reportTrue(spriteIdSize > 20))
4399  spriteIdSize = 20;
4400 
4401  for (size_t slot = 0; slot < sz; slot ++)
4402  {
4403  slotRemap.push_back(CAST_S32(slot));
4404 
4405  if (spriteIdSize <= slot)
4406  continue;
4407 
4408  const int id = mSlots[slot].spriteId;
4409  if (id == 0)
4410  continue;
4411 
4412  const ItemInfo &info = ItemDB::get(id);
4413 
4414  if (info.isRemoveSprites())
4415  {
4416  const SpriteToItemMap *restrict const spriteToItems
4417  = info.getSpriteToItemReplaceMap(dir);
4418 
4419  if (spriteToItems != nullptr)
4420  {
4421  FOR_EACHP (SpriteToItemMapCIter, itr, spriteToItems)
4422  {
4423  const int remSlot = itr->first;
4424  const IntMap &restrict itemReplacer = itr->second;
4425  if (remSlot >= 0)
4426  { // slot known
4427  if (CAST_U32(remSlot) >= spriteIdSize)
4428  continue;
4429  if (itemReplacer.empty())
4430  {
4431  mSpriteHide[remSlot] = 1;
4432  }
4433  else if (mSpriteHide[remSlot] != 1)
4434  {
4435  IntMapCIter repIt = itemReplacer.find(
4436  mSlots[remSlot].spriteId);
4437  if (repIt == itemReplacer.end())
4438  {
4439  repIt = itemReplacer.find(0);
4440  if (repIt == itemReplacer.end() ||
4441  repIt->second == 0)
4442  {
4443  repIt = itemReplacer.end();
4444  }
4445  }
4446  if (repIt != itemReplacer.end())
4447  {
4448  mSpriteHide[remSlot] = repIt->second;
4449  if (repIt->second != 1)
4450  {
4451  if (CAST_U32(remSlot)
4452  != hairSlot)
4453  {
4454  setTempSprite(remSlot,
4455  repIt->second);
4456  }
4457  else
4458  {
4459  setHairTempSprite(remSlot,
4460  repIt->second);
4461  }
4462  updatedSprite[remSlot] = true;
4463  }
4464  }
4465  }
4466  }
4467  else
4468  { // slot unknown. Search for real slot, this can be slow
4469  FOR_EACH (IntMapCIter, repIt, itemReplacer)
4470  {
4471  for (unsigned int slot2 = 0; slot2 < sz; slot2 ++)
4472  {
4473  if (mSlots[slot2].spriteId == repIt->first)
4474  {
4475  mSpriteHide[slot2] = repIt->second;
4476  if (repIt->second != 1)
4477  {
4478  if (slot2 != hairSlot)
4479  {
4480  setTempSprite(slot2,
4481  repIt->second);
4482  }
4483  else
4484  {
4485  setHairTempSprite(slot2,
4486  repIt->second);
4487  }
4488  updatedSprite[slot2] = true;
4489  }
4490  }
4491  }
4492  }
4493  }
4494  }
4495  }
4496  }
4497 
4498  if (info.mDrawBefore[dir] > 0)
4499  {
4500  const int id2 = mSlots[info.mDrawBefore[dir]].spriteId;
4501  if (itemSlotRemap.find(id2) != itemSlotRemap.end())
4502  {
4503 // logger->log("found duplicate (before)");
4504  const ItemInfo &info2 = ItemDB::get(id2);
4505  if (info.mDrawPriority[dir] < info2.mDrawPriority[dir])
4506  {
4507 // logger->log("old more priority");
4508  continue;
4509  }
4510  else
4511  {
4512 // logger->log("new more priority");
4513  itemSlotRemap.erase(id2);
4514  }
4515  }
4516 
4517  itemSlotRemap[id] = -info.mDrawBefore[dir];
4518  }
4519  else if (info.mDrawAfter[dir] > 0)
4520  {
4521  const int id2 = mSlots[info.mDrawAfter[dir]].spriteId;
4522  if (itemSlotRemap.find(id2) != itemSlotRemap.end())
4523  {
4524  const ItemInfo &info2 = ItemDB::get(id2);
4525  if (info.mDrawPriority[dir] < info2.mDrawPriority[dir])
4526  {
4527 // logger->log("old more priority");
4528  continue;
4529  }
4530  else
4531  {
4532 // logger->log("new more priority");
4533  itemSlotRemap.erase(id2);
4534  }
4535  }
4536 
4537  itemSlotRemap[id] = info.mDrawAfter[dir];
4538 // logger->log("item slot->slot %d %d->%d", id, slot, itemSlotRemap[id]);
4539  }
4540  }
4541 // logger->log("preparation end");
4542 
4543  int lastRemap = 0;
4544  unsigned cnt = 0;
4545 
4546  while (cnt < 15 && lastRemap >= 0)
4547  {
4548  lastRemap = -1;
4549  cnt ++;
4550 // logger->log("iteration");
4551 
4552  for (unsigned int slot0 = 0; slot0 < sz; slot0 ++)
4553  {
4554  const int slot = searchSlotValue(slotRemap, slot0);
4555  const int val = slotRemap.at(slot);
4556  int id = 0;
4557 
4558  if (CAST_S32(spriteIdSize) > val)
4559  id = mSlots[val].spriteId;
4560 
4561  int idx = -1;
4562  int idx1 = -1;
4563 // logger->log("item %d, id=%d", slot, id);
4564  int reorder = 0;
4565  const IntMapCIter orderIt = itemSlotRemap.find(id);
4566  if (orderIt != itemSlotRemap.end())
4567  reorder = orderIt->second;
4568 
4569  if (reorder < 0)
4570  {
4571 // logger->log("move item %d before %d", slot, -reorder);
4572  searchSlotValueItr(it, idx, slotRemap, -reorder);
4573  if (it == slotRemap.end())
4574  return;
4575  searchSlotValueItr(it, idx1, slotRemap, val);
4576  if (it == slotRemap.end())
4577  return;
4578  lastRemap = idx1;
4579  if (idx1 + 1 != idx)
4580  {
4581  slotRemap.erase(it);
4582  searchSlotValueItr(it, idx, slotRemap, -reorder);
4583  slotRemap.insert(it, val);
4584  }
4585  }
4586  else if (reorder > 0)
4587  {
4588 // logger->log("move item %d after %d", slot, reorder);
4589  searchSlotValueItr(it, idx, slotRemap, reorder);
4590  searchSlotValueItr(it, idx1, slotRemap, val);
4591  if (it == slotRemap.end())
4592  return;
4593  lastRemap = idx1;
4594  if (idx1 != idx + 1)
4595  {
4596  slotRemap.erase(it);
4597  searchSlotValueItr(it, idx, slotRemap, reorder);
4598  if (it != slotRemap.end())
4599  {
4600  ++ it;
4601  if (it != slotRemap.end())
4602  slotRemap.insert(it, val);
4603  else
4604  slotRemap.push_back(val);
4605  }
4606  else
4607  {
4608  slotRemap.push_back(val);
4609  }
4610  }
4611  }
4612  }
4613  }
4614 
4615 // logger->log("after remap");
4616  for (unsigned int slot = 0; slot < sz; slot ++)
4617  {
4618  mSpriteRemap[slot] = slotRemap[slot];
4619  if (mSpriteHide[slot] == 0)
4620  {
4621  if (oldHide[slot] != 0 && oldHide[slot] != 1)
4622  {
4623  const BeingSlot &beingSlot = mSlots[slot];
4624  const int id = beingSlot.spriteId;
4625  if (id == 0)
4626  continue;
4627 
4628  updatedSprite[slot] = true;
4629  setTempSprite(slot,
4630  id);
4631  }
4632  }
4633  }
4634  for (size_t slot = 0; slot < spriteIdSize; slot ++)
4635  {
4636  if (mSpriteHide[slot] == 0)
4637  {
4638  const BeingSlot &beingSlot = mSlots[slot];
4639  const int id = beingSlot.spriteId;
4640  if (updatedSprite[slot] == false &&
4641  mSpriteDraw[slot] != id)
4642  {
4643  setTempSprite(static_cast<unsigned int>(slot),
4644  id);
4645  }
4646  }
4647  }
4648 }
std::map< int, int >::const_iterator IntMapCIter
Definition: being.cpp:150
#define CAST_U32
Definition: cast.h:31
Net::CharServerHandler * charServerHandler
Definition: net.cpp:85
#define reportTrue(val)
Definition: checkutils.h:252
void setTempSprite(const unsigned int slot, const int id)
Definition: being.cpp:3143
static void searchSlotValueItr(std::vector< int >::iterator &it, int &idx, std::vector< int > &slotRemap, const int val)
Definition: being.cpp:4662
void setHairTempSprite(const unsigned int slot, const int id)
Definition: being.cpp:3218
static bool mEnableReorderSprites
Definition: being.h:1344
int searchSlotValue(const std::vector< int > &slotRemap, const int val) const
Definition: being.cpp:4650
int mDrawPriority[10]
Definition: iteminfo.h:335
virtual unsigned int hairSprite() const =0
#define FOR_EACHP(type, iter, array)
Definition: foreach.h:31
std::map< int, int > IntMap
Definition: intmap.h:27
SpriteToItemMap::const_iterator SpriteToItemMapCIter
Definition: iteminfo.h:47
std::map< int, IntMap > SpriteToItemMap
Definition: iteminfo.h:43
int spriteId
Definition: beingslot.h:45

References CAST_S32, CAST_U32, charServerHandler, BeingAction::DEAD, FOR_EACH, FOR_EACHP, ItemDB::get(), Net::CharServerHandler::hairSprite(), Actions::info(), mAction, ItemInfo::mDrawPriority, mEnableReorderSprites, mSlots, mSpriteDirection, mSpriteDraw, mSpriteHide, mSpriteRemap, CompoundSprite::mSprites, reportTrue, restrict, searchSlotValue(), searchSlotValueItr(), setHairTempSprite(), setTempSprite(), and BeingSlot::spriteId.

Referenced by EAthena::BeingRecv::applyPlayerAction(), TmwAthena::BeingRecv::applyPlayerAction(), LocalPlayer::playerDeath(), and Ea::BeingRecv::processBeingRemove().

◆ recreateItemParticles()

void Being::recreateItemParticles ( )

Definition at line 5163 of file being.cpp.

5164 {
5166  {
5167  ParticleInfo *restrict const pi = (*it).second;
5168  if ((pi != nullptr) && !pi->files.empty())
5169  {
5170  FOR_EACH (STD_VECTOR<Particle*>::const_iterator,
5171  itp, pi->particles)
5172  {
5174  }
5175 
5176  FOR_EACH (STD_VECTOR<std::string>::const_iterator, str, pi->files)
5177  {
5178  Particle *const p = particleEngine->addEffect(
5179  *str, 0, 0, 0);
5181  pi->particles.push_back(p);
5182  }
5183  }
5184  }
5185 }
ParticleList mChildParticleEffects
Definition: actorsprite.h:245
void removeLocally(const Particle *const particle)

References ParticleEngine::addEffect(), ActorSprite::controlCustomParticle(), FOR_EACH, ActorSprite::mChildParticleEffects, mSpriteParticles, particleEngine, ParticleList::removeLocally(), and restrict.

Referenced by Game::changeMap().

◆ removeAfkEffect()

void Being::removeAfkEffect ( )

Definition at line 4923 of file being.cpp.

4924 {
4926 }
void removeSpecialEffect()
Definition: being.cpp:4941

References removeSpecialEffect().

Referenced by GameModifiers::changeAwayMode(), and updateAwayEffect().

◆ removeAllItemsParticles()

void Being::removeAllItemsParticles ( )
protected

Definition at line 5037 of file being.cpp.

5038 {
5040  delete (*it).second;
5041  mSpriteParticles.clear();
5042 }

References FOR_EACH, and mSpriteParticles.

Referenced by ~Being().

◆ removeGuild()

void Being::removeGuild ( const int  id)

Removers a guild from the being.

Definition at line 1248 of file being.cpp.

1249 {
1250  if (this == localPlayer && (socialWindow != nullptr))
1252 
1253  if (mGuilds[id] != nullptr)
1254  mGuilds[id]->removeMember(mName);
1255  mGuilds.erase(id);
1256 }

References localPlayer, anonymous_namespace{badgesdb.cpp}::mGuilds, SocialWindow::removeTab(), and socialWindow.

Referenced by EAthena::GuildRecv::processGuildLeave(), EAthena::GuildRecv::processGuildLeave2(), and Guild::removeFromMembers().

◆ removeHorse()

void Being::removeHorse ( )

Definition at line 5404 of file being.cpp.

5405 {
5407  mUpHorseSprites.clear();
5409  mDownHorseSprites.clear();
5410 }

References delete_all(), mDownHorseSprites, and mUpHorseSprites.

Referenced by ~Being().

◆ removeItemParticles()

void Being::removeItemParticles ( const int  id)
protected

Definition at line 5148 of file being.cpp.

5149 {
5150  const SpriteParticleInfoIter it = mSpriteParticles.find(id);
5151  if (it == mSpriteParticles.end())
5152  return;
5153  ParticleInfo *restrict const pi = (*it).second;
5154  if (pi != nullptr)
5155  {
5156  FOR_EACH (STD_VECTOR<Particle*>::const_iterator, itp, pi->particles)
5157  mChildParticleEffects.removeLocally(*itp);
5158  delete pi;
5159  }
5160  mSpriteParticles.erase(it);
5161 }

References FOR_EACH, and restrict.

◆ removeSpecialEffect()

void Being::removeSpecialEffect ( )

Definition at line 4941 of file being.cpp.

4942 {
4943  if ((effectManager != nullptr) && (mSpecialParticle != nullptr))
4944  {
4946  mSpecialParticle = nullptr;
4947  }
4949 }

References delete2, effectManager, mAnimationEffect, ActorSprite::mChildParticleEffects, mSpecialParticle, and ParticleList::removeLocally().

Referenced by removeAfkEffect(), and ActorManager::updateEffects().

◆ removeSpiritBalls()

void Being::removeSpiritBalls ( const unsigned int  balls)
protected

Definition at line 5510 of file being.cpp.

5511 {
5512  if (particleEngine == nullptr)
5513  return;
5514  for (unsigned int f = 0; f < balls && !mSpiritParticles.empty(); f ++)
5515  {
5516  const Particle *restrict const particle = mSpiritParticles.back();
5518  mSpiritParticles.pop_back();
5519  }
5520 }

References particleEngine, and restrict.

◆ reReadConfig()

void Being::reReadConfig ( )
static

Definition at line 3431 of file being.cpp.

3432 {
3433  BLOCK_START("Being::reReadConfig")
3434  if (mUpdateConfigTime + 1 < cur_time)
3435  {
3436  mAwayEffect = paths.getIntValue("afkEffectId");
3437  mHighlightMapPortals = config.getBoolValue("highlightMapPortals");
3438  mConfLineLim = config.getIntValue("chatMaxCharLimit");
3439  mSpeechType = config.getIntValue("speech");
3441  config.getBoolValue("highlightMonsterAttackRange");
3442  mLowTraffic = config.getBoolValue("lowTraffic");
3443  mDrawHotKeys = config.getBoolValue("drawHotKeys");
3444  mShowBattleEvents = config.getBoolValue("showBattleEvents");
3445  mShowMobHP = config.getBoolValue("showMobHP");
3446  mShowOwnHP = config.getBoolValue("showOwnHP");
3447  mShowGender = config.getBoolValue("showgender");
3448  mShowLevel = config.getBoolValue("showlevel");
3449  mShowPlayersStatus = config.getBoolValue("showPlayersStatus");
3450  mEnableReorderSprites = config.getBoolValue("enableReorderSprites");
3451  mHideErased = config.getBoolValue("hideErased");
3452  mMoveNames = fromBool(config.getBoolValue("moveNames"), Move);
3453  mUseDiagonal = config.getBoolValue("useDiagonalSpeed");
3454  mShowBadges = static_cast<BadgeDrawType::Type>(
3455  config.getIntValue("showBadges"));
3456  mVisibleNamePos = static_cast<VisibleNamePos::Type>(
3457  config.getIntValue("visiblenamespos"));
3458 
3460  }
3461  BLOCK_END("Being::reReadConfig")
3462 }
#define fromBool(val, name)
Definition: booldefines.h:49
static VisibleNamePos::Type mVisibleNamePos
Definition: being.h:1350
static bool mShowBattleEvents
Definition: being.h:1338
static unsigned int mConfLineLim
Definition: being.h:1332
static bool mHideErased
Definition: being.h:1345
static time_t mUpdateConfigTime
Definition: being.h:1331
static bool mShowLevel
Definition: being.h:1342
bool getBoolValue(const std::string &key) const
bool Move
Definition: move.h:30

References BLOCK_END, BLOCK_START, config, cur_time, fromBool, Configuration::getBoolValue(), Configuration::getIntValue(), mAwayEffect, mConfLineLim, mDrawHotKeys, mEnableReorderSprites, mHideErased, mHighlightMapPortals, mHighlightMonsterAttackRange, mLowTraffic, mMoveNames, mShowBadges, mShowBattleEvents, mShowGender, mShowLevel, mShowMobHP, mShowOwnHP, mShowPlayersStatus, mSpeechType, mUpdateConfigTime, mUseDiagonal, mVisibleNamePos, and paths.

Referenced by postInit(), and Game::slowLogic().

◆ resetCounters()

void Being::resetCounters ( )

Definition at line 4350 of file being.cpp.

4351 {
4352  mMoveTime = 0;
4353  mAttackTime = 0;
4354  mTalkTime = 0;
4355  mOtherTime = 0;
4356  mTestTime = cur_time;
4357 }

References cur_time, mAttackTime, mMoveTime, mOtherTime, mTalkTime, and mTestTime.

◆ saveComment()

void Being::saveComment ( const std::string &  name,
const std::string &  comment,
const ActorTypeT type 
)
static

Definition at line 4771 of file being.cpp.

4774 {
4775  std::string dir;
4776  switch (type)
4777  {
4778  case ActorType::Player:
4779  dir = settings.usersDir;
4780  break;
4781  case ActorType::Npc:
4782  dir = settings.npcsDir;
4783  break;
4784  case ActorType::Monster:
4785  case ActorType::FloorItem:
4786  case ActorType::Portal:
4787  case ActorType::Avatar:
4788  case ActorType::Unknown:
4789  case ActorType::Pet:
4790  case ActorType::Mercenary:
4791  case ActorType::Homunculus:
4792  case ActorType::SkillUnit:
4793  case ActorType::Elemental:
4794  default:
4795  return;
4796  }
4797  dir = pathJoin(dir, stringToHexPath(name));
4798  Files::saveTextFile(dir,
4799  "comment.txt",
4800  (name + "\n").append(comment));
4801 }
void saveTextFile(const std::string &path, const std::string &name, const std::string &text)
Definition: files.cpp:250

References ActorType::Avatar, ActorType::Elemental, ActorType::FloorItem, ActorType::Homunculus, ActorType::Mercenary, ActorType::Monster, ActorType::Npc, Settings::npcsDir, pathJoin(), ActorType::Pet, ActorType::Player, ActorType::Portal, Files::saveTextFile(), settings, ActorType::SkillUnit, stringToHexPath(), ActorType::Unknown, and Settings::usersDir.

Referenced by PlayerListener::action().

◆ searchSlotValue()

int Being::searchSlotValue ( const std::vector< int > &  slotRemap,
const int  val 
) const
protected

Definition at line 4650 of file being.cpp.

4652 {
4653  const size_t sz = mSprites.size();
4654  for (size_t slot = 0; slot < sz; slot ++)
4655  {
4656  if (slotRemap[slot] == val)
4657  return CAST_S32(slot);
4658  }
4659  return CompoundSprite::getNumberOfLayers() - 1;
4660 }

References CAST_S32, and CompoundSprite::getNumberOfLayers().

Referenced by recalcSpritesOrder().

◆ searchSlotValueItr()

void Being::searchSlotValueItr ( std::vector< int >::iterator &  it,
int &  idx,
std::vector< int > &  slotRemap,
const int  val 
)
staticprotected

Definition at line 4662 of file being.cpp.

4666 {
4667 // logger->log("searching %d", val);
4668  it = slotRemap.begin();
4669  const STD_VECTOR<int>::iterator it_end = slotRemap.end();
4670  idx = 0;
4671  while (it != it_end)
4672  {
4673 // logger->log("testing %d", *it);
4674  if (*it == val)
4675  {
4676 // logger->log("found at %d", idx);
4677  return;
4678  }
4679  ++ it;
4680  idx ++;
4681  }
4682 // logger->log("not found");
4683  idx = -1;
4684 }

Referenced by recalcSpritesOrder().

◆ serverRemove()

void Being::serverRemove ( )

Definition at line 5363 of file being.cpp.

5364 {
5365  // remove some flags what can survive player remove and next visible
5366  mTrickDead = false;
5367 }

References ActorSprite::mTrickDead.

Referenced by Ea::BeingRecv::processBeingRemove().

◆ setAction()

void Being::setAction ( const BeingActionT action,
const int  attackId 
)
virtual

Sets the current action.

Reimplemented in LocalPlayer.

Definition at line 1554 of file being.cpp.

1556 {
1557  std::string currentAction = SpriteAction::INVALID;
1558 
1559  switch (action)
1560  {
1561  case BeingAction::MOVE:
1562  if (mInfo != nullptr)
1563  {
1565  ItemSoundEvent::MOVE), nullptr, true, mX, mY);
1566  }
1567  currentAction = getMoveAction();
1568  // Note: When adding a run action,
1569  // Differentiate walk and run with action name,
1570  // while using only the ACTION_MOVE.
1571  break;
1572  case BeingAction::SIT:
1573  currentAction = getSitAction();
1574  if (mInfo != nullptr)
1575  {
1576  ItemSoundEvent::Type event;
1577  if (currentAction == SpriteAction::SITTOP)
1578  event = ItemSoundEvent::SITTOP;
1579  else
1580  event = ItemSoundEvent::SIT;
1581  playSfx(mInfo->getSound(event), nullptr, true, mX, mY);
1582  }
1583  break;
1584  case BeingAction::ATTACK:
1585  if (mEquippedWeapon != nullptr)
1586  {
1587  currentAction = getWeaponAttackAction(mEquippedWeapon);
1588  reset();
1589  }
1590  else
1591  {
1592  if (mInfo == nullptr || mInfo->getAttack(attackId) == nullptr)
1593  break;
1594 
1595  currentAction = getAttackAction(mInfo->getAttack(attackId));
1596  reset();
1597 
1598  // attack particle effect
1599  if (ParticleEngine::enabled && (effectManager != nullptr))
1600  {
1601  const int effectId = mInfo->getAttack(attackId)->mEffectId;
1602  if (effectId >= 0)
1603  {
1604  effectManager->triggerDirection(effectId,
1605  this,
1607  }
1608  }
1609  }
1610  break;
1611  case BeingAction::CAST:
1612  if (skillDialog != nullptr)
1613  {
1614  const SkillInfo *restrict const info =
1615  skillDialog->getSkill(attackId);
1616  currentAction = getCastAction(info);
1617  }
1618  break;
1619  case BeingAction::HURT:
1620  if (mInfo != nullptr)
1621  {
1623  this, false, mX, mY);
1624  }
1625  break;
1626  case BeingAction::DEAD:
1627  currentAction = getDeadAction();
1628  if (mInfo != nullptr)
1629  {
1631  this,
1632  false,
1633  mX, mY);
1634  if (mType == ActorType::Monster ||
1635  mType == ActorType::Npc ||
1637  {
1639  }
1640  }
1641  break;
1642  case BeingAction::STAND:
1643  currentAction = getStandAction();
1644  break;
1645  case BeingAction::SPAWN:
1646  if (mInfo != nullptr)
1647  {
1649  nullptr, true, mX, mY);
1650  }
1651  currentAction = getSpawnAction();
1652  break;
1653  case BeingAction::PRESTAND:
1654  break;
1655  default:
1656  logger->log("Being::setAction unknown action: "
1657  + toString(CAST_U32(action)));
1658  break;
1659  }
1660 
1661  if (currentAction != SpriteAction::INVALID)
1662  {
1663  mSpriteAction = currentAction;
1664  play(currentAction);
1665  if (mEmotionSprite != nullptr)
1666  mEmotionSprite->play(currentAction);
1667  if (mAnimationEffect != nullptr)
1668  mAnimationEffect->play(currentAction);
1669  for_each_badges()
1670  {
1671  AnimatedSprite *const sprite = mBadges[f];
1672  if (sprite != nullptr)
1673  sprite->play(currentAction);
1674  }
1676  (*it)->play(currentAction);
1678  (*it)->play(currentAction);
1679  mAction = action;
1680  }
1681 
1682  if (currentAction != SpriteAction::MOVE
1683  && currentAction != SpriteAction::FLY
1684  && currentAction != SpriteAction::SWIM)
1685  {
1687  }
1688 }
bool play(const std::string &spriteAction)
int getDeadSortOffsetY() const
Definition: beinginfo.h:192
const Attack * getAttack(const int id) const
Definition: beinginfo.cpp:180
std::string getSitAction() const
Definition: being.cpp:1419
std::string getStandAction() const
Definition: being.cpp:1530
std::string getWeaponAttackAction(const ItemInfo *const weapon) const
Definition: being.cpp:1452
std::string getMoveAction() const
Definition: being.cpp:1437
std::string getDeadAction() const
Definition: being.cpp:1527
std::string getSpawnAction() const
Definition: being.cpp:1528
bool play(const std::string &action)
bool triggerDirection(const int id, Being *const being, const SpriteDirection::Type &direction)
std::string toString(T const &value)
converts any type to a string
Definition: catch.hpp:1774
static const std::string INVALID
Definition: spriteaction.h:72
int mEffectId
Definition: attack.h:35

References BeingAction::ATTACK, BeingAction::CAST, CAST_U32, BeingAction::DEAD, ItemSoundEvent::DIE, effectManager, ParticleEngine::enabled, SpriteAction::FLY(), for_each_badges, for_each_horses, SkillDialog::getSkill(), BeingAction::HURT, ItemSoundEvent::HURT, Actions::info(), SpriteAction::INVALID, Logger::log(), logger, ActorType::Monster, SpriteAction::MOVE(), BeingAction::MOVE, ItemSoundEvent::MOVE, ActorType::Npc, AnimatedSprite::play(), BeingAction::PRESTAND, restrict, BeingAction::SIT, ItemSoundEvent::SIT, SpriteAction::SITTOP(), ItemSoundEvent::SITTOP, skillDialog, ActorType::SkillUnit, BeingAction::SPAWN, ItemSoundEvent::SPAWN, BeingAction::STAND, SpriteAction::SWIM(), tick_time, Catch::toString(), and EffectManager::triggerDirection().

Referenced by EAthena::BeingRecv::applyPlayerAction(), TmwAthena::BeingRecv::applyPlayerAction(), ActorManager::cloneBeing(), logic(), nextTile(), Ea::BeingRecv::processBeingAction(), EAthena::BeingRecv::processBeingAction2(), EAthena::BeingRecv::processBeingMove(), TmwAthena::BeingRecv::processBeingMove(), TmwAthena::BeingRecv::processBeingMove2(), Ea::BeingRecv::processBeingMove3(), Ea::BeingRecv::processBeingRemove(), EAthena::BeingRecv::processBeingResurrect(), TmwAthena::BeingRecv::processBeingResurrect(), EAthena::BeingRecv::processBeingSlide(), EAthena::BeingRecv::processBeingSpawn(), EAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processBeingVisible(), EAthena::BeingRecv::processGraffiti(), Ea::BeingRecv::processPlayerStop(), EAthena::BeingRecv::processSkillCastingContinue(), EAthena::BeingRecv::processSkillEntry(), LocalPlayer::setAction(), NpcDialog::setAvatarAction(), stopCast(), updatePercentHP(), and CharCreateDialog::updatePlayer().

◆ setActionTime()

void Being::setActionTime ( const int  actionTime)
inline

◆ setAdvanced()

void Being::setAdvanced ( const bool  n)
inline

Definition at line 831 of file being.h.

832  { mAdvanced = n; addToCache(); }
void addToCache() const
Definition: being.cpp:3513

References addToCache(), and mAdvanced.

Referenced by OnlinePlayer::setText().

◆ setAreaSize()

void Being::setAreaSize ( const int  areaSize)
inline

Definition at line 1052 of file being.h.

1053  { mAreaSize = areaSize; }

References mAreaSize.

Referenced by EAthena::NpcRecv::processArea().

◆ setAttackDelay()

void Being::setAttackDelay ( const int  n)
inline

Definition at line 770 of file being.h.

771  { mAttackDelay = n; }

References mAttackDelay.

Referenced by Ea::BeingRecv::processBeingAction(), and EAthena::BeingRecv::processBeingAction2().

◆ setAttackRange()

void Being::setAttackRange ( const int  range)
inline

◆ setAttackSpeed()

void Being::setAttackSpeed ( const int  speed)
inline

Sets the attack speed.

Definition at line 464 of file being.h.

465  { mAttackSpeed = speed; }

References mAttackSpeed.

Referenced by EAthena::PlayerHandler::setStat(), and TmwAthena::PlayerHandler::setStat().

◆ setAttackTime()

void Being::setAttackTime ( )
inline

Definition at line 709 of file being.h.

710  { mAttackTime = cur_time; }

References cur_time, and mAttackTime.

Referenced by Ea::BeingRecv::processBeingAction(), and EAthena::BeingRecv::processBeingAction2().

◆ setBuyBoard()

void Being::setBuyBoard ( const std::string &  text)

Definition at line 5336 of file being.cpp.

5337 {
5338  mShop = !text.empty() || !mSellBoard.empty();
5339  mBuyBoard = text;
5340  updateName();
5342 }

Referenced by EAthena::BuyingStoreRecv::processBuyingStoreHideBoard(), and EAthena::BuyingStoreRecv::processBuyingStoreShowBoard().

◆ setCachedDestination()

void Being::setCachedDestination ( const int  dstX,
const int  dstY 
)
inline

◆ setChat()

void Being::setChat ( ChatObject *const  obj)

◆ setClanName()

void Being::setClanName ( const std::string &  name)

Definition at line 1223 of file being.cpp.

1224 {
1225  if (mClanName != name)
1226  {
1227  mClanName = name;
1228  showClanBadge(!mClanName.empty());
1230  }
1231 }
void updateBadgesCount()
Definition: being.cpp:5312
void showClanBadge(const bool show)
Definition: being.cpp:1206

Referenced by EAthena::BeingRecv::processBeingAttrs().

◆ setComment()

void Being::setComment ( const std::string &  n)
inline

Definition at line 815 of file being.h.

816  { mComment = n; }

References mComment.

Referenced by PlayerListener::action().

◆ setCreatorId()

void Being::setCreatorId ( const BeingId  id)
inline

Definition at line 1025 of file being.h.

1026  { mCreatorId = id; }

References mCreatorId.

Referenced by EAthena::BeingRecv::processGraffiti(), and EAthena::BeingRecv::processSkillEntry().

◆ setCriticalHit()

void Being::setCriticalHit ( const int  n)
inline

Definition at line 791 of file being.h.

792  { mCriticalHit = n; }

References mCriticalHit.

◆ setDamageTaken()

void Being::setDamageTaken ( const int  damage)
inline

Definition at line 596 of file being.h.

597  { mDamageTaken = damage; }

References mDamageTaken.

Referenced by SocialPlayersTab::resetDamage().

◆ setDefaultNameColor()

void Being::setDefaultNameColor ( const UserColorIdT  defaultColor)
protected

Definition at line 2639 of file being.cpp.

2640 {
2641  switch (mTeamId)
2642  {
2643  case 0:
2644  default:
2645  mNameColor = &userPalette->getColor(defaultColor,
2646  255U);
2647  break;
2648  case 1:
2650  255U);
2651  break;
2652  case 2:
2654  255U);
2655  break;
2656  case 3:
2658  255U);
2659  break;
2660  }
2661 }

References UserPalette::getColor(), UserColorId::TEAM1, UserColorId::TEAM2, UserColorId::TEAM3, and userPalette.

Referenced by updateColors().

◆ setDestination()

void Being::setDestination ( const int  dstX,
const int  dstY 
)

Creates a path for the being from current position to ex and ey

Definition at line 540 of file being.cpp.

542 {
543  if (mMap == nullptr)
544  return;
545 
547  mY,
548  dstX,
549  dstY,
551  20));
552 }
void setPath(const Path &path)
Definition: being.cpp:559
Path findPath(const int startX, const int startY, const int destX, const int destY, const unsigned char blockWalkmask, const int maxCost)
Definition: map.cpp:863

References Ea::GameRecv::mMap.

Referenced by EAthena::BeingRecv::processBeingMove(), TmwAthena::BeingRecv::processBeingMove(), EAthena::BeingRecv::processBeingMove2(), TmwAthena::BeingRecv::processBeingMove2(), TmwAthena::BeingRecv::processPlayerMove(), LocalPlayer::setDestination(), and LocalPlayer::startWalking().

◆ setDirection()

void Being::setDirection ( const uint8_t  direction)
virtual

Sets the current direction.

Definition at line 1690 of file being.cpp.

1691 {
1692  if (mDirection == direction)
1693  return;
1694 
1695  mDirection = direction;
1696 
1697  mDirectionDelayed = 0;
1698 
1699  // if the direction does not change much, keep the common component
1700  int mFaceDirection = mDirection & direction;
1701  if (mFaceDirection == 0)
1702  mFaceDirection = direction;
1703 
1705  if ((mFaceDirection & BeingDirection::UP) != 0)
1706  {
1707  if ((mFaceDirection & BeingDirection::LEFT) != 0)
1709  else if ((mFaceDirection & BeingDirection::RIGHT) != 0)
1711  else
1712  dir = SpriteDirection::UP;
1713  }
1714  else if ((mFaceDirection & BeingDirection::DOWN) != 0)
1715  {
1716  if ((mFaceDirection & BeingDirection::LEFT) != 0)
1718  else if ((mFaceDirection & BeingDirection::RIGHT) != 0)
1720  else
1721  dir = SpriteDirection::DOWN;
1722  }
1723  else if ((mFaceDirection & BeingDirection::RIGHT) != 0)
1724  {
1725  dir = SpriteDirection::RIGHT;
1726  }
1727  else
1728  {
1729  dir = SpriteDirection::LEFT;
1730  }
1731  mSpriteDirection = dir;
1732 
1734  if (mEmotionSprite != nullptr)
1736  if (mAnimationEffect != nullptr)
1738 
1739  for_each_badges()
1740  {
1741  AnimatedSprite *const sprite = mBadges[f];
1742  if (sprite != nullptr)
1743  sprite->setSpriteDirection(dir);
1744  }
1745 
1747  (*it)->setSpriteDirection(dir);
1749  (*it)->setSpriteDirection(dir);
1751 }
bool setSpriteDirection(const SpriteDirection::Type direction)
void recalcSpritesOrder()
Definition: being.cpp:4359
bool setSpriteDirection(const SpriteDirection::Type direction)

References BeingDirection::DOWN, SpriteDirection::DOWN, SpriteDirection::DOWNLEFT, SpriteDirection::DOWNRIGHT, for_each_badges, for_each_horses, BeingDirection::LEFT, SpriteDirection::LEFT, BeingDirection::RIGHT, SpriteDirection::RIGHT, CompoundSprite::setSpriteDirection(), AnimatedSprite::setSpriteDirection(), BeingDirection::UP, SpriteDirection::UP, SpriteDirection::UPLEFT, and SpriteDirection::UPRIGHT.

Referenced by LocalPlayer::attack(), ActorManager::cloneBeing(), CrazyMoves::crazyMove1(), CrazyMoves::crazyMove2(), CrazyMoves::crazyMove3(), CrazyMoves::crazyMoveAd(), LocalPlayer::imitateDirection(), nextTile(), EAthena::BeingRecv::processBeingChangeDirection(), TmwAthena::BeingRecv::processBeingChangeDirection(), EAthena::BeingRecv::processBeingFakeName(), EAthena::BeingRecv::processBeingMove(), EAthena::BeingRecv::processBeingSpawn(), EAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processPlayerMove(), TmwAthena::BeingRecv::processPlayerUpdate1(), TmwAthena::BeingRecv::processPlayerUpdate2(), NpcDialog::setAvatarDirection(), LocalPlayer::setDestination(), LocalPlayer::startWalking(), and CharCreateDialog::updatePlayer().

◆ setDirectionDelayed()

void Being::setDirectionDelayed ( const uint8_t  direction)
inline

Definition at line 502 of file being.h.

503  { mDirectionDelayed = direction; }

References mDirectionDelayed.

Referenced by TmwAthena::BeingRecv::processPlayerMove().

◆ setDistance()

void Being::setDistance ( const int  n)
inline

Definition at line 555 of file being.h.

556  { mDistance = n; }

References mDistance.

Referenced by LocalPlayer::isReachable().

◆ setEmote()

void Being::setEmote ( const uint8_t  emotion,
const int  emote_time 
)

Set the Emoticon type and time displayed above the being.

Definition at line 4829 of file being.cpp.

4831 {
4832  if ((emotion & BeingFlag::SPECIAL) == BeingFlag::SPECIAL)
4833  {
4834  setState(emotion);
4835  mAdvanced = true;
4836  }
4837  else
4838  {
4839  const int emotionIndex = emotion - 1;
4840  if (emotionIndex >= 0 && emotionIndex <= EmoteDB::getLast())
4841  {
4843  const EmoteInfo *const info = EmoteDB::get2(emotionIndex, true);
4844  if (info != nullptr)
4845  {
4846  const EmoteSprite *restrict const sprite =
4847  info->sprites.front();
4848  if (sprite != nullptr)
4849  {
4850  mEmotionSprite = AnimatedSprite::clone(sprite->sprite);
4851  if (mEmotionSprite != nullptr)
4852  mEmotionTime = info->time;
4853  else
4854  mEmotionTime = emote_time;
4855  }
4856  const int effectId = info->effectId;
4857  if (effectId >= 0)
4858  {
4859  effectManager->trigger(effectId, this, 0);
4860  }
4861  }
4862  }
4863 
4864  if (mEmotionSprite != nullptr)
4865  {
4868  }
4869  else
4870  {
4871  mEmotionTime = 0;
4872  }
4873  }
4874 }
static AnimatedSprite * clone(const AnimatedSprite *const anim)
void setState(const uint8_t state)
Definition: being.cpp:4803
bool trigger(const int id, Being *const being, const int rotation)
const int & getLast() A_CONST
Definition: emotedb.cpp:301
const EmoteInfo * get2(int id, const bool allowNull)
Definition: emotedb.cpp:273

References AnimatedSprite::clone(), delete2, effectManager, EmoteDB::get2(), EmoteDB::getLast(), Actions::info(), restrict, BeingFlag::SPECIAL, and EffectManager::trigger().

Referenced by Ea::BeingRecv::processBeingEmotion().

◆ setEnemy()

void Being::setEnemy ( const bool  n)
inline

Definition at line 740 of file being.h.

741  { mEnemy = n; }

References mEnemy.

◆ setGender()

void Being::setGender ( const GenderT  gender)
virtual

Sets the gender of this being.

Definition at line 3581 of file being.cpp.

3582 {
3583  if (charServerHandler == nullptr)
3584  return;
3585 
3586  if (gender != mGender)
3587  {
3588  mGender = gender;
3589 
3590  const unsigned int sz = CAST_U32(mSlots.size());
3591 
3592  if (sz > CAST_U32(mSprites.size()))
3593  ensureSize(sz);
3594 
3595  // Reload all subsprites
3596  for (unsigned int i = 0;
3597  i < sz;
3598  i++)
3599  {
3600  BeingSlot &beingSlot = mSlots[i];
3601  const int id = beingSlot.spriteId;
3602  if (id != 0)
3603  {
3604  const ItemInfo &info = ItemDB::get(id);
3605  const std::string &restrict filename = info.getSprite(
3606  mGender, mSubType);
3607  int lastTime = 0;
3608  int startTime = 0;
3609  AnimatedSprite *restrict equipmentSprite = nullptr;
3610 
3611  if (!filename.empty())
3612  {
3613  equipmentSprite = AnimatedSprite::delayedLoad(
3614  pathJoin(paths.getStringValue("sprites"),
3615  combineDye(filename, beingSlot.color)),
3616  0);
3617  }
3618 
3619  if (equipmentSprite != nullptr)
3620  {
3621  equipmentSprite->setSpriteDirection(getSpriteDirection());
3622  startTime = getStartTime();
3623  lastTime = getLastTime();
3624  }
3625 
3626  CompoundSprite::setSprite(i, equipmentSprite);
3627  setAction(mAction, 0);
3628  if (equipmentSprite != nullptr)
3629  {
3630  if (lastTime > 0)
3631  {
3632  equipmentSprite->setLastTime(startTime);
3633  equipmentSprite->update(lastTime);
3634  }
3635  }
3636 
3637  if (beingEquipmentWindow != nullptr)
3639  }
3640  }
3641 
3642  updateName();
3643  }
3644 }
static AnimatedSprite * delayedLoad(const std::string &filename, const int variant)
SpriteDirection::Type getSpriteDirection() const
Definition: being.h:511
int getStartTime() const
void ensureSize(const size_t layerCount)
int getLastTime() const
void setSprite(const size_t layer, Sprite *const sprite)
void updateBeing(Being *const being)
EquipmentWindow * beingEquipmentWindow
std::string combineDye(std::string file, const std::string &dye)
std::string color
Definition: beingslot.h:48

References beingEquipmentWindow, CAST_U32, charServerHandler, BeingSlot::color, combineDye(), AnimatedSprite::delayedLoad(), ItemDB::get(), Configuration::getStringValue(), Actions::info(), pathJoin(), paths, restrict, CompoundSprite::setSprite(), BeingSlot::spriteId, and EquipmentWindow::updateBeing().

Referenced by CharCreateDialog::action(), CharCreateDialog::CharCreateDialog(), ActorManager::cloneBeing(), TmwAthena::BeingRecv::processBeingMove(), TmwAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processPlayerMove(), TmwAthena::BeingRecv::processPlayerUpdate1(), TmwAthena::BeingRecv::processPlayerUpdate2(), EAthena::CharServerRecv::readPlayerData(), TmwAthena::CharServerRecv::readPlayerData(), CharCreateDialog::setDefaultGender(), and TmwAthena::BeingRecv::setServerGender().

◆ setGM()

void Being::setGM ( const bool  gm)

Triggers whether or not to show the name as a GM name.

Definition at line 3666 of file being.cpp.

3667 {
3668  if (mIsGM != gm)
3669  {
3670  mIsGM = gm;
3671  updateColors();
3672  }
3673 }
bool gm(InputEvent &event)
Definition: commands.cpp:75

References Actions::gm().

◆ setGoodStatus()

void Being::setGoodStatus ( const int  n)
inline

Definition at line 803 of file being.h.

804  { mGoodStatus = n; }

References mGoodStatus.

Referenced by PlayerRelationsManager::isGoodName(), and ActorManager::updatePlayerNames().

◆ setGroupId()

void Being::setGroupId ( const int  id)
virtual

Reimplemented in LocalPlayer.

Definition at line 5587 of file being.cpp.

5588 {
5589  if (mGroupId != id)
5590  {
5591  mGroupId = id;
5592  const bool gm = GroupDb::getHighlightName(mGroupId);
5593  if (mIsGM != gm)
5594  {
5595  mIsGM = gm;
5596  updateColors();
5597  }
5598  showGmBadge(id != 0);
5599  }
5600 }
void showGmBadge(const bool show)
Definition: being.cpp:3646
bool getHighlightName(const int id)
Definition: groupdb.cpp:377

References GroupDb::getHighlightName(), Actions::gm(), mGroupId, mIsGM, showGmBadge(), and updateColors().

Referenced by EAthena::BeingRecv::processBeingAttrs(), TmwAthena::setGm(), and LocalPlayer::setGroupId().

◆ setGuild()

void Being::setGuild ( Guild *const  guild)

Definition at line 1354 of file being.cpp.

1355 {
1356  Guild *restrict const old = getGuild();
1357  if (guild == old)
1358  return;
1359 
1360  clearGuilds();
1361  addGuild(guild);
1362 
1363  if (old != nullptr)
1364  old->removeMember(mName);
1365 
1366  updateColors();
1367 
1368  if (this == localPlayer && (socialWindow != nullptr))
1369  {
1370  if (old != nullptr)
1371  socialWindow->removeTab(old);
1372 
1373  if (guild != nullptr)
1375  }
1376 }
void addGuild(Guild *const guild)
Definition: being.cpp:1237
Guild * getGuild() const
Definition: being.cpp:1280
void clearGuilds()
Definition: being.cpp:1289

References SocialWindow::addTab(), guild, localPlayer, SocialWindow::removeTab(), restrict, and socialWindow.

Referenced by EAthena::GuildRecv::processGuildPositionInfo(), TmwAthena::BeingRecv::processPlayerMove(), TmwAthena::BeingRecv::processPlayerUpdate1(), TmwAthena::BeingRecv::processPlayerUpdate2(), and updateGuild().

◆ setGuildName()

void Being::setGuildName ( const std::string &  name)

Sets the name of the primary guild the being is in. Shown in BeingPopup (eventually).

Definition at line 1196 of file being.cpp.

1197 {
1198  if (mGuildName != name)
1199  {
1200  mGuildName = name;
1201  showGuildBadge(!mGuildName.empty());
1203  }
1204 }
void showGuildBadge(const bool show)
Definition: being.cpp:1179

Referenced by GuildManager::afterRemove(), GuildManager::process(), EAthena::GuildRecv::processGuildMemberList(), EAthena::GuildRecv::processGuildPositionInfo(), EAthena::BeingRecv::processPlayerGuilPartyInfo(), TmwAthena::BeingRecv::processPlayerGuilPartyInfo(), EAthena::BeingRecv::processPlayerGuilPartyInfo2(), updateFromCache(), and updateGuild().

◆ setGuildPos()

void Being::setGuildPos ( const std::string &  pos)

◆ setHairColor() [1/2]

void Being::setHairColor ( const ItemColor  color)
inline

Definition at line 877 of file being.h.

878  { mHairColor = color; }

References mHairColor.

◆ setHairColor() [2/2]

void Being::setHairColor ( const unsigned int  slot,
const ItemColor  color 
)

Definition at line 3389 of file being.cpp.

3391 {
3392  mHairColor = color;
3393  BeingSlot &beingSlot = mSlots[slot];
3394  const int id = beingSlot.spriteId;
3395  if (id != 0)
3396  {
3397  setSpriteColor(slot,
3398  id,
3399  ItemDB::get(id).getDyeColorsString(color));
3400  }
3401 }
void setSpriteColor(const unsigned int slot, const int id, const std::string &color)
Definition: being.cpp:2890

References ItemDB::get(), and BeingSlot::spriteId.

Referenced by ActorManager::cloneBeing(), TmwAthena::BeingRecv::processBeingChangeLookContinue(), EAthena::BeingRecv::processBeingChangeLookContinue(), TmwAthena::BeingRecv::processBeingMove(), TmwAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processPlayerMove(), TmwAthena::BeingRecv::processPlayerUpdate1(), TmwAthena::BeingRecv::processPlayerUpdate2(), EAthena::CharServerRecv::readPlayerData(), and TmwAthena::CharServerRecv::readPlayerData().

◆ setHairColorSpriteID()

void Being::setHairColorSpriteID ( const unsigned int  slot,
const int  id 
)

Definition at line 3291 of file being.cpp.

3293 {
3294  if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
3295  return;
3296 
3297  if (slot >= CAST_U32(mSprites.size()))
3298  ensureSize(slot + 1);
3299 
3300  if (slot >= CAST_U32(mSlots.size()))
3301  mSlots.resize(slot + 1, BeingSlot());
3302 
3303  BeingSlot &beingSlot = mSlots[slot];
3304  setSpriteColor(slot,
3305  id,
3306  beingSlot.color);
3307 }
virtual unsigned int maxSprite() const =0

References CAST_U32, charServerHandler, BeingSlot::color, and Net::CharServerHandler::maxSprite().

Referenced by EAthena::BeingRecv::processBeingChangeLookContinue().

◆ setHairStyle()

void Being::setHairStyle ( const unsigned int  slot,
const int  id 
)

Definition at line 3372 of file being.cpp.

3374 {
3375  if (id != 0)
3376  {
3377  setSpriteColor(slot,
3378  id,
3379  ItemDB::get(id).getDyeColorsString(mHairColor));
3380  }
3381  else
3382  {
3383  setSpriteColor(slot,
3384  0,
3385  std::string());
3386  }
3387 }

References ItemDB::get().

Referenced by TmwAthena::BeingRecv::processBeingChangeLookContinue().

◆ setHairTempSprite()

void Being::setHairTempSprite ( const unsigned int  slot,
const int  id 
)

Definition at line 3218 of file being.cpp.

3220 {
3221  if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
3222  return;
3223 
3224  if (slot >= CAST_U32(mSprites.size()))
3225  ensureSize(slot + 1);
3226 
3227  if (slot >= CAST_U32(mSlots.size()))
3228  mSlots.resize(slot + 1, BeingSlot());
3229 
3230  const CardsList &cards = mSlots[slot].cardsId;
3231 
3232  // id = 0 means unequip
3233  if (id == 0)
3234  {
3235  removeSprite(slot);
3236  mSpriteDraw[slot] = 0;
3237 
3238  const int id1 = mSlots[slot].spriteId;
3239  if (id1 != 0)
3240  removeItemParticles(id1);
3241  }
3242  else
3243  {
3244  const ItemInfo &info = ItemDB::get(id);
3245  const std::string &restrict filename = info.getSprite(
3246  mGender, mSubType);
3247  int lastTime = 0;
3248  int startTime = 0;
3249  AnimatedSprite *restrict equipmentSprite = nullptr;
3250 
3251  if (!filename.empty())
3252  {
3253  ItemColor colorId = ItemColor_one;
3254  if (!cards.isEmpty())
3255  colorId = ItemColorManager::getColorFromCards(cards);
3256 
3257  std::string color = info.getDyeColorsString(mHairColor);
3258  if (color.empty())
3259  color = info.getDyeColorsString(colorId);
3260 
3261  equipmentSprite = AnimatedSprite::delayedLoad(
3262  pathJoin(paths.getStringValue("sprites"),
3263  combineDye(filename, color)),
3264  0);
3265  }
3266 
3267  if (equipmentSprite != nullptr)
3268  {
3269  equipmentSprite->setSpriteDirection(getSpriteDirection());
3270  startTime = getStartTime();
3271  lastTime = getLastTime();
3272  }
3273 
3274  CompoundSprite::setSprite(slot, equipmentSprite);
3275  mSpriteDraw[slot] = id;
3276 
3277  addItemParticles(id, info.getDisplay());
3278 
3279  setAction(mAction, 0);
3280  if (equipmentSprite != nullptr)
3281  {
3282  if (lastTime > 0)
3283  {
3284  equipmentSprite->setLastTime(startTime);
3285  equipmentSprite->update(lastTime);
3286  }
3287  }
3288  }
3289 }
void addItemParticles(const int id, const SpriteDisplay &display)
Definition: being.cpp:5044
void removeItemParticles(const int id)
Definition: being.cpp:5148
void removeSprite(const int layer)
static ItemColor getColorFromCards(const int *const cards)
uint16_t ItemColor
Definition: itemcolor.h:30
bool isEmpty() const
Definition: cardslist.h:60

References CAST_U32, charServerHandler, combineDye(), AnimatedSprite::delayedLoad(), ItemDB::get(), ItemColorManager::getColorFromCards(), Configuration::getStringValue(), Actions::info(), CardsList::isEmpty(), ItemColor_one, Net::CharServerHandler::maxSprite(), pathJoin(), paths, restrict, and CompoundSprite::setSprite().

Referenced by recalcSpritesOrder().

◆ setHorse()

void Being::setHorse ( const int  horseId)

Definition at line 5425 of file being.cpp.

5426 {
5427  if (mHorseId == horseId)
5428  return;
5429  mHorseId = horseId;
5430  setAction(mAction, 0);
5431  removeHorse();
5432  if (mHorseId != 0)
5433  {
5434  mHorseInfo = HorseDB::get(horseId, false);
5435  if (mHorseInfo != nullptr)
5436  {
5438  {
5439  const SpriteReference *restrict const ref = *it;
5440  AnimatedSprite *const sprite = AnimatedSprite::load(
5441  ref->sprite,
5442  ref->variant);
5443  mDownHorseSprites.push_back(sprite);
5444  sprite->play(mSpriteAction);
5446  }
5448  {
5449  const SpriteReference *restrict const ref = *it;
5450  AnimatedSprite *const sprite = AnimatedSprite::load(
5451  ref->sprite,
5452  ref->variant);
5453  mUpHorseSprites.push_back(sprite);
5454  sprite->play(mSpriteAction);
5456  }
5457  }
5458  }
5459  else
5460  {
5461  mHorseInfo = nullptr;
5462  }
5463 }
HorseInfo * get(const int id, const bool allowNull)
Definition: horsedb.cpp:285
std::vector< SpriteReference * >::const_iterator SpriteRefs
std::vector< SpriteReference * > upSprites
Definition: horseinfo.h:53
std::vector< SpriteReference * > downSprites
Definition: horseinfo.h:52

References FOR_EACH, HorseDB::get(), AnimatedSprite::load(), AnimatedSprite::play(), restrict, and AnimatedSprite::setSpriteDirection().

Referenced by EAthena::BeingRecv::processBeingAttrs().

◆ setHP()

void Being::setHP ( const int  hp)

◆ setIp()

void Being::setIp ( const std::string &  ip)
inline

Definition at line 746 of file being.h.

747  { mIp = ip; }

References mIp.

Referenced by TmwAthena::BeingRecv::processIpResponse(), and updateFromCache().

◆ setKarma()

void Being::setKarma ( const int  karma)
inline

◆ setLanguageId()

void Being::setLanguageId ( const int  lang)

Definition at line 5555 of file being.cpp.

5556 {
5557  if (lang != mLanguageId)
5558  {
5560  const std::string &badge = LanguageDb::getIcon(lang);
5561  if (!badge.empty())
5562  {
5564  paths.getStringValue("languageIcons"),
5565  badge),
5566  0);
5567  }
5568 
5569  mLanguageId = lang;
5570  }
5573 }
const std::string & getIcon(const int id)
Definition: languagedb.cpp:111

References delete2, LanguageDb::getIcon(), Configuration::getStringValue(), BadgeIndex::Lang, AnimatedSprite::load(), pathJoin(), and paths.

Referenced by EAthena::BeingRecv::processBeingAttrs().

◆ setLevel()

void Being::setLevel ( const int  n)
inline

◆ setLook()

void Being::setLook ( const uint16_t  look)

◆ setManner()

void Being::setManner ( const int  manner)
inline

◆ setMap()

void Being::setMap ( Map *const  map)
virtual

Reimplemented from ActorSprite.

Reimplemented in LocalPlayer.

Definition at line 5023 of file being.cpp.

5024 {
5025  mCastEndTime = 0;
5027  ActorSprite::setMap(map);
5028  if (mMap != nullptr)
5029  {
5032  mOldHeight = 0;
5033  mNeedPosUpdate = true;
5034  }
5035 }
void setMap(Map *const map)

References delete2, Ea::GameRecv::mMap, and ActorSprite::setMap().

Referenced by postInit(), and LocalPlayer::setMap().

◆ setMaxHit()

void Being::setMaxHit ( const int  n)
inline

Definition at line 785 of file being.h.

786  { mMaxHit = n; }

References mMaxHit.

◆ setMaxHP()

void Being::setMaxHP ( const int  hp)

◆ setMinHit()

void Being::setMinHit ( const int  n)
inline

Definition at line 779 of file being.h.

780  { mMinHit = n; }

References mMinHit.

◆ setMoveTime()

void Being::setMoveTime ( )
inline

◆ setName()

void Being::setName ( const std::string &  name)

Sets the name for the being.

Parameters
nameThe name that should appear.

Definition at line 1136 of file being.cpp.

1137 {
1138  mExtName = name;
1139  if (mType == ActorType::Npc)
1140  {
1141  mName = name.substr(0, name.find('#', 0));
1142  showName();
1143  }
1144  else if (mType == ActorType::Player)
1145  {
1146  if (mName != name)
1147  {
1148  mName = name;
1149  showNameBadge(!mName.empty());
1150  }
1151  if (getShowName())
1152  showName();
1153  }
1154  else
1155  {
1156  if (mType == ActorType::Portal)
1157  mName = name.substr(0, name.find('#', 0));
1158  else
1159  mName = name;
1160 
1161  if (getShowName())
1162  showName();
1163  }
1164 }
void showName()
Definition: being.cpp:2578
void showNameBadge(const bool show)
Definition: being.cpp:1119
bool getShowName() const
Definition: being.h:245

References ActorType::Npc, ActorType::Player, and ActorType::Portal.

Referenced by ActorManager::cloneBeing(), EAthena::BeingRecv::processBeingSpawn(), EAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processBeingVisible(), EAthena::BeingRecv::processGraffiti(), Ea::BeingRecv::processNameResponse(), EAthena::BeingRecv::processNameResponse2(), EAthena::BeingRecv::processNameResponseTitle(), EAthena::BeingRecv::processPlayerGuilPartyInfo(), EAthena::BeingRecv::processPlayerGuilPartyInfo2(), EAthena::CharServerRecv::readPlayerData(), TmwAthena::CharServerRecv::readPlayerData(), PlayerInfo::setHomunculusBeing(), PlayerInfo::setMercenaryBeing(), CharSelectDialog::setName(), PlayerInfo::setPetBeing(), updateFromCache(), and SocialNavigationTab::updateList().

◆ setOtherTime()

void Being::setOtherTime ( )
inline

◆ setOwner()

void Being::setOwner ( Being *const  owner)
inline

Definition at line 911 of file being.h.

912  { mOwner = owner; }

References mOwner.

Referenced by PlayerInfo::setHomunculusBeing(), PlayerInfo::setMercenaryBeing(), and PlayerInfo::setPetBeing().

◆ setParty()

void Being::setParty ( Party *const  party)

Definition at line 1307 of file being.cpp.

1308 {
1309  if (party == mParty)
1310  return;
1311 
1312  Party *const old = mParty;
1313  mParty = party;
1314 
1315  if (old != nullptr)
1316  old->removeMember(mId);
1317 
1318  if (party != nullptr)
1319  party->addMember(mId, mName);
1320 
1321  updateColors();
1322 
1323  if (this == localPlayer && (socialWindow != nullptr))
1324  {
1325  if (old != nullptr)
1326  socialWindow->removeTab(old);
1327 
1328  if (party != nullptr)
1330  }
1331 }
Definition: party.h:63
void removeMember(const PartyMember *const member)
Definition: party.cpp:128
uint32_t party

References SocialWindow::addTab(), localPlayer, party, Party::removeMember(), SocialWindow::removeTab(), and socialWindow.

Referenced by EAthena::PartyRecv::processPartyInfo(), TmwAthena::PartyRecv::processPartyInfo(), Ea::PartyRecv::processPartyLeave(), TmwAthena::BeingRecv::processPlayerMove(), TmwAthena::BeingRecv::processPlayerUpdate1(), TmwAthena::BeingRecv::processPlayerUpdate2(), and Party::removeFromMembers().

◆ setPartyName()

void Being::setPartyName ( const std::string &  name)

Sets the name of the party the being is in. Shown in BeingPopup.

Definition at line 5246 of file being.cpp.

5247 {
5248  if (mPartyName != name)
5249  {
5250  mPartyName = name;
5251  showPartyBadge(!mPartyName.empty());
5252  }
5253 }
void showPartyBadge(const bool show)
Definition: being.cpp:5226

Referenced by EAthena::PartyRecv::processPartyInfo(), TmwAthena::PartyRecv::processPartyInfo(), Ea::PartyRecv::processPartyLeave(), EAthena::BeingRecv::processPlayerGuilPartyInfo(), TmwAthena::BeingRecv::processPlayerGuilPartyInfo(), EAthena::BeingRecv::processPlayerGuilPartyInfo2(), and updateFromCache().

◆ setPath()

void Being::setPath ( const Path path)

Sets the new path for this being.

Definition at line 559 of file being.cpp.

560 {
561  mPath = path;
562  if (mPath.empty())
563  return;
564 
566  {
567  nextTile();
569  }
570 }

References BeingAction::DEAD, BeingAction::MOVE, and tick_time.

Referenced by Ea::BeingRecv::processBeingMove3().

◆ setPixelPositionF() [1/2]

void Being::setPixelPositionF ( const float  x,
const float  y,
const float  z 
)
inline

Overloaded method provided for convenience.

See also
setPosition(const Vector &pos)

Definition at line 522 of file being.h.

525  { setPixelPositionF(Vector(x, y, z)); }

References setPixelPositionF(), NextSoundInfo::x, and NextSoundInfo::y.

◆ setPixelPositionF() [2/2]

void Being::setPixelPositionF ( const Vector pos)
virtual

Sets the pixel position of this actor.

Reimplemented from Actor.

Definition at line 526 of file being.cpp.

527 {
529 
530  updateCoords();
531 
532  if (mText != nullptr)
533  {
534  mText->adviseXY(CAST_S32(pos.x),
535  CAST_S32(pos.y) - getHeight() - mText->getHeight() - 9,
536  mMoveNames);
537  }
538 }
virtual void setPixelPositionF(const Vector &pos)
Definition: actor.cpp:83
virtual void updateCoords()
Definition: being.cpp:2501

References CAST_S32, and Actor::setPixelPositionF().

Referenced by logic(), and setPixelPositionF().

◆ setPvpRank()

void Being::setPvpRank ( const unsigned int  rank)
inline

Definition at line 752 of file being.h.

753  { mPvpRank = rank; }

References mPvpRank.

Referenced by EAthena::BeingRecv::processPvpSet(), TmwAthena::BeingRecv::processPvpSet(), and updateFromCache().

◆ setRaceName()

void Being::setRaceName ( const std::string &  name)
inline

Definition at line 858 of file being.h.

859  { mRaceName = name; }

References mRaceName.

◆ setReachable()

void Being::setReachable ( const ReachableT  n)
inline

Definition at line 607 of file being.h.

608  { mReachable = n; }

References mReachable.

Referenced by LocalPlayer::isReachable().

◆ setRiding()

void Being::setRiding ( const bool  b)
virtual

Reimplemented from ActorSprite.

Definition at line 5412 of file being.cpp.

5413 {
5415  return;
5416 
5417  if (b == (mHorseId != 0))
5418  return;
5419  if (b)
5420  setHorse(1);
5421  else
5422  setHorse(0);
5423 }
void setHorse(const int horseId)
Definition: being.cpp:5425
virtual bool haveExtendedRiding() const =0

References Net::ServerFeatures::haveExtendedRiding(), and serverFeatures.

◆ setSellBoard()

void Being::setSellBoard ( const std::string &  text)

Definition at line 5328 of file being.cpp.

5329 {
5330  mShop = !text.empty() || !mBuyBoard.empty();
5331  mSellBoard = text;
5332  updateName();
5334 }

Referenced by EAthena::VendingRecv::processHideBoard(), and EAthena::VendingRecv::processShowBoard().

◆ setShowName()

void Being::setShowName ( const bool  doShowName)

Definition at line 1166 of file being.cpp.

1167 {
1168  if (mShowName == doShowName)
1169  return;
1170 
1171  mShowName = doShowName;
1172 
1173  if (doShowName)
1174  showName();
1175  else
1177 }

References delete2.

Referenced by LocalPlayer::LocalPlayer(), LocalPlayer::optionChanged(), postInit(), EAthena::BeingRecv::processGraffiti(), and LocalPlayer::setTarget().

◆ setSpeech()

void Being::setSpeech ( const std::string &  text)

Puts a "speech balloon" above this being for the specified amount of time.

Parameters
textThe text that should appear.
timeThe amount of time the text should stay in milliseconds.

Definition at line 572 of file being.cpp.

573 {
574  if (userPalette == nullptr)
575  return;
576 
577  // Remove colors
578  mSpeech = removeColors(text);
579 
580  // Trim whitespace
581  trim(mSpeech);
582 
583  const unsigned int lineLim = mConfLineLim;
584  if (lineLim > 0 && mSpeech.length() > lineLim)
585  mSpeech = mSpeech.substr(0, lineLim);
586 
587  trim(mSpeech);
588  if (mSpeech.empty())
589  return;
590 
591  const size_t sz = mSpeech.size();
592  int time = 0;
593  if (sz < 200)
594  time = CAST_S32(SPEECH_TIME - 300 + (3 * sz));
595 
596  if (time < CAST_S32(SPEECH_MIN_TIME))
597  time = CAST_S32(SPEECH_MIN_TIME);
598 
599  // Check for links
600  size_t start = mSpeech.find('[');
601  size_t e = mSpeech.find(']', start);
602 
603  while (start != std::string::npos && e != std::string::npos)
604  {
605  // Catch multiple embeds and ignore them so it doesn't crash the client.
606  while ((mSpeech.find('[', start + 1) != std::string::npos) &&
607  (mSpeech.find('[', start + 1) < e))
608  {
609  start = mSpeech.find('[', start + 1);
610  }
611 
612  size_t position = mSpeech.find('|');
613  if (mSpeech[start + 1] == '@' && mSpeech[start + 2] == '@')
614  {
615  mSpeech.erase(e, 1);
616  mSpeech.erase(start, (position - start) + 1);
617  }
618  position = mSpeech.find("@@");
619 
620  while (position != std::string::npos)
621  {
622  mSpeech.erase(position, 2);
623  position = mSpeech.find('@');
624  }
625 
626  start = mSpeech.find('[', start + 1);
627  e = mSpeech.find(']', start);
628  }
629 
630  if (!mSpeech.empty())
631  {
633  ? time : CAST_S32(SPEECH_MAX_TIME);
634  }
635 
636  const int speech = mSpeechType;
637  if (speech == BeingSpeech::TEXT_OVERHEAD)
638  {
639  delete mText;
640  mText = nullptr;
641  mText = new Text(mSpeech,
642  mPixelX,
643  mPixelY - getHeight(),
646  Speech_true,
647  nullptr);
649  (mY + 1) * mapTileSize - getHeight() - mText->getHeight() - 9,
650  mMoveNames);
651  }
652  else
653  {
654  if (mSpeechBubble == nullptr)
656  if (mSpeechBubble != nullptr)
657  {
658  const bool isShowName = (speech == BeingSpeech::NAME_IN_BUBBLE);
659  mSpeechBubble->setCaption(isShowName ? mName : "",
660  &theme->getColor(ThemeColorId::BUBBLE_NAME, 255),
661  &theme->getColor(ThemeColorId::BUBBLE_NAME_OUTLINE, 255));
662  mSpeechBubble->setText(mSpeech, isShowName);
663  }
664  }
665 }
static const unsigned int SPEECH_TIME
Definition: being.cpp:152
static const unsigned int SPEECH_MAX_TIME
Definition: being.cpp:154
static const unsigned int SPEECH_MIN_TIME
Definition: being.cpp:153
void createSpeechBubble()
Definition: being.cpp:366
void setCaption(const std::string &name, const Color *const color1, const Color *const color2)
void setText(const std::string &text, const bool showName)
std::string trim(std::string const &str)
std::string removeColors(std::string msg)

References CAST_S32, Graphics::CENTER, Theme::getColor(), UserPalette::getColor(), mapTileSize, BeingSpeech::NAME_IN_BUBBLE, UserColorId::PARTICLE, removeColors(), SPEECH_MAX_TIME, SPEECH_MIN_TIME, SPEECH_TIME, Speech_true, anonymous_namespace{stringutils.cpp}::start, MailMessageType::Text, BeingSpeech::TEXT_OVERHEAD, theme, Catch::trim(), and userPalette.

Referenced by NotifyManager::notify(), EAthena::ChatRecv::processBeingChat(), TmwAthena::ChatRecv::processBeingChat(), TmwAthena::ChatRecv::processChatContinue(), and EAthena::ChatRecv::processChatContinue().

◆ setSpiritBalls()

void Being::setSpiritBalls ( const unsigned int  balls)

Definition at line 5474 of file being.cpp.

5475 {
5477  {
5478  mSpiritBalls = balls;
5479  return;
5480  }
5481 
5482  if (balls > mSpiritBalls)
5483  {
5484  const int effectId = paths.getIntValue("spiritEffectId");
5485  if (effectId != -1)
5486  addSpiritBalls(balls - mSpiritBalls, effectId);
5487  }
5488  else if (balls < mSpiritBalls)
5489  {
5491  }
5492  mSpiritBalls = balls;
5493 }
void addSpiritBalls(const unsigned int balls, const int effectId)
Definition: being.cpp:5495
void removeSpiritBalls(const unsigned int balls)
Definition: being.cpp:5510

References ParticleEngine::enabled, Configuration::getIntValue(), and paths.

Referenced by EAthena::BeingRecv::processSpiritBalls().

◆ setSprite()

void Being::setSprite ( const unsigned int  slot,
const int  id,
std::string  color,
ItemColor  colorId 
)

◆ setSpriteCards()

void Being::setSpriteCards ( const unsigned int  slot,
const int  id,
const CardsList cards 
)

Definition at line 3048 of file being.cpp.

3051 {
3052  if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
3053  return;
3054 
3055  if (slot >= CAST_U32(mSprites.size()))
3056  ensureSize(slot + 1);
3057 
3058  if (slot >= CAST_U32(mSlots.size()))
3059  mSlots.resize(slot + 1, BeingSlot());
3060 
3061  // disabled for now, because it may broke replace/reorder sprites logic
3062 // if (slot && mSlots[slot].spriteId == id)
3063 // return;
3064 
3065  ItemColor colorId = ItemColor_one;
3066  std::string color;
3067 
3068  // id = 0 means unequip
3069  if (id == 0)
3070  {
3071  removeSprite(slot);
3072  mSpriteDraw[slot] = 0;
3073 
3074  const int id1 = mSlots[slot].spriteId;
3075  if (id1 != 0)
3076  removeItemParticles(id1);
3077  }
3078  else
3079  {
3080  const ItemInfo &info = ItemDB::get(id);
3081  const std::string &restrict filename = info.getSprite(
3082  mGender, mSubType);
3083  int lastTime = 0;
3084  int startTime = 0;
3085  AnimatedSprite *restrict equipmentSprite = nullptr;
3086 
3087  if (!cards.isEmpty())
3088  colorId = ItemColorManager::getColorFromCards(cards);
3089 
3090  if (!filename.empty())
3091  {
3092  color = info.getDyeColorsString(colorId);
3093 
3094  equipmentSprite = AnimatedSprite::delayedLoad(
3095  pathJoin(paths.getStringValue("sprites"),
3096  combineDye(filename, color)),
3097  0);
3098  }
3099 
3100  if (equipmentSprite != nullptr)
3101  {
3102  equipmentSprite->setSpriteDirection(getSpriteDirection());
3103  startTime = getStartTime();
3104  lastTime = getLastTime();
3105  }
3106 
3107  CompoundSprite::setSprite(slot, equipmentSprite);
3108  mSpriteDraw[slot] = id;
3109 
3111  info.getDisplay(),
3112  cards);
3113 
3114  setAction(mAction, 0);
3115  if (equipmentSprite != nullptr)
3116  {
3117  if (lastTime > 0)
3118  {
3119  equipmentSprite->setLastTime(startTime);
3120  equipmentSprite->update(lastTime);
3121  }
3122  }
3123  }
3124 
3125  BeingSlot &beingSlot = mSlots[slot];
3126  beingSlot.spriteId = id;
3127  beingSlot.color = STD_MOVE(color);
3128  beingSlot.colorId = colorId;
3129  beingSlot.cardsId = CardsList(cards);
3131  if (beingEquipmentWindow != nullptr)
3133 }
void addItemParticlesCards(const int id, const SpriteDisplay &display, const CardsList &cards)
Definition: being.cpp:5081
#define STD_MOVE(var)
Definition: stdmove.h:28
ItemColor colorId
Definition: beingslot.h:47
CardsList cardsId
Definition: beingslot.h:46

References beingEquipmentWindow, BeingSlot::cardsId, CAST_U32, charServerHandler, BeingSlot::color, BeingSlot::colorId, combineDye(), AnimatedSprite::delayedLoad(), ItemDB::get(), ItemColorManager::getColorFromCards(), Configuration::getStringValue(), Actions::info(), ItemColor_one, Net::CharServerHandler::maxSprite(), pathJoin(), paths, restrict, CompoundSprite::setSprite(), BeingSlot::spriteId, STD_MOVE, and EquipmentWindow::updateBeing().

Referenced by CharCreateDialog::CharCreateDialog(), and EAthena::BeingRecv::processBeingChangeLookContinue().

◆ setSpriteColor() [1/2]

void Being::setSpriteColor ( const unsigned int  slot,
const int  id,
const std::string &  color 
)

Definition at line 2890 of file being.cpp.

2893 {
2894  if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
2895  return;
2896 
2897  if (slot >= CAST_U32(mSprites.size()))
2898  ensureSize(slot + 1);
2899 
2900  if (slot >= CAST_U32(mSlots.size()))
2901  mSlots.resize(slot + 1, BeingSlot());
2902 
2903  // disabled for now, because it may broke replace/reorder sprites logic
2904 // if (slot && mSlots[slot].spriteId == id)
2905 // return;
2906 
2907  // id = 0 means unequip
2908  if (id == 0)
2909  {
2910  removeSprite(slot);
2911  mSpriteDraw[slot] = 0;
2912 
2913  const int id1 = mSlots[slot].spriteId;
2914  if (id1 != 0)
2915  removeItemParticles(id1);
2916  }
2917  else
2918  {
2919  const ItemInfo &info = ItemDB::get(id);
2920  const std::string &restrict filename = info.getSprite(
2921  mGender, mSubType);
2922  int lastTime = 0;
2923  int startTime = 0;
2924  AnimatedSprite *restrict equipmentSprite = nullptr;
2925 
2926  if (!filename.empty())
2927  {
2928  equipmentSprite = AnimatedSprite::delayedLoad(
2929  pathJoin(paths.getStringValue("sprites"),
2930  combineDye(filename, color)),
2931  0);
2932  }
2933 
2934  if (equipmentSprite != nullptr)
2935  {
2936  equipmentSprite->setSpriteDirection(getSpriteDirection());
2937  startTime = getStartTime();
2938  lastTime = getLastTime();
2939  }
2940 
2941  CompoundSprite::setSprite(slot, equipmentSprite);
2942  mSpriteDraw[slot] = id;
2943  addItemParticles(id, info.getDisplay());
2944 
2945  setAction(mAction, 0);
2946  if (equipmentSprite != nullptr)
2947  {
2948  if (lastTime > 0)
2949  {
2950  equipmentSprite->setLastTime(startTime);
2951  equipmentSprite->update(lastTime);
2952  }
2953  }
2954  }
2955 
2956  BeingSlot &beingSlot = mSlots[slot];
2957  beingSlot.spriteId = id;
2958  beingSlot.color = color;
2959  beingSlot.colorId = ItemColor_one;
2960  beingSlot.cardsId = CardsList(nullptr);
2962  if (beingEquipmentWindow != nullptr)
2964 }

References beingEquipmentWindow, BeingSlot::cardsId, CAST_U32, charServerHandler, BeingSlot::color, BeingSlot::colorId, combineDye(), AnimatedSprite::delayedLoad(), ItemDB::get(), Configuration::getStringValue(), Actions::info(), ItemColor_one, Net::CharServerHandler::maxSprite(), pathJoin(), paths, restrict, CompoundSprite::setSprite(), BeingSlot::spriteId, and EquipmentWindow::updateBeing().

Referenced by ActorManager::cloneBeing(), EAthena::BeingRecv::processBeingChangeLookContinue(), EAthena::CharServerRecv::readPlayerData(), TmwAthena::CharServerRecv::readPlayerData(), and CharCreateDialog::updateHair().

◆ setSpriteColor() [2/2]

void Being::setSpriteColor ( const unsigned int  slot,
const std::string &  color 
)

Definition at line 3309 of file being.cpp.

3311 {
3312  if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
3313  return;
3314 
3315  if (slot >= CAST_U32(mSprites.size()))
3316  ensureSize(slot + 1);
3317 
3318  if (slot >= CAST_U32(mSlots.size()))
3319  mSlots.resize(slot + 1, BeingSlot());
3320 
3321  // disabled for now, because it may broke replace/reorder sprites logic
3322 // if (slot && mSlots[slot].spriteId == id)
3323 // return;
3324 
3325  BeingSlot &beingSlot = mSlots[slot];
3326  const int id = beingSlot.spriteId;
3327 
3328  // id = 0 means unequip
3329  if (id != 0)
3330  {
3331  const ItemInfo &info = ItemDB::get(id);
3332  const std::string &restrict filename = info.getSprite(
3333  mGender, mSubType);
3334  int lastTime = 0;
3335  int startTime = 0;
3336  AnimatedSprite *restrict equipmentSprite = nullptr;
3337 
3338  if (!filename.empty())
3339  {
3340  equipmentSprite = AnimatedSprite::delayedLoad(
3341  pathJoin(paths.getStringValue("sprites"),
3342  combineDye(filename, color)),
3343  0);
3344  }
3345 
3346  if (equipmentSprite != nullptr)
3347  {
3348  equipmentSprite->setSpriteDirection(getSpriteDirection());
3349  startTime = getStartTime();
3350  lastTime = getLastTime();
3351  }
3352 
3353  CompoundSprite::setSprite(slot, equipmentSprite);
3354 
3355  setAction(mAction, 0);
3356  if (equipmentSprite != nullptr)
3357  {
3358  if (lastTime > 0)
3359  {
3360  equipmentSprite->setLastTime(startTime);
3361  equipmentSprite->update(lastTime);
3362  }
3363  }
3364  }
3365 
3366  beingSlot.color = color;
3367  beingSlot.colorId = ItemColor_one;
3368  if (beingEquipmentWindow != nullptr)
3370 }

References beingEquipmentWindow, CAST_U32, charServerHandler, BeingSlot::color, BeingSlot::colorId, combineDye(), AnimatedSprite::delayedLoad(), ItemDB::get(), Configuration::getStringValue(), Actions::info(), ItemColor_one, Net::CharServerHandler::maxSprite(), pathJoin(), paths, restrict, CompoundSprite::setSprite(), BeingSlot::spriteId, and EquipmentWindow::updateBeing().

◆ setSpriteColorId()

void Being::setSpriteColorId ( const unsigned int  slot,
const int  id,
ItemColor  colorId 
)

Definition at line 2967 of file being.cpp.

2970 {
2971  if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
2972  return;
2973 
2974  if (slot >= CAST_U32(mSprites.size()))
2975  ensureSize(slot + 1);
2976 
2977  if (slot >= CAST_U32(mSlots.size()))
2978  mSlots.resize(slot + 1, BeingSlot());
2979 
2980  // disabled for now, because it may broke replace/reorder sprites logic
2981 // if (slot && mSlots[slot].spriteId == id)
2982 // return;
2983 
2984  std::string color;
2985 
2986  // id = 0 means unequip
2987  if (id == 0)
2988  {
2989  removeSprite(slot);
2990  mSpriteDraw[slot] = 0;
2991 
2992  const int id1 = mSlots[slot].spriteId;
2993  if (id1 != 0)
2994  removeItemParticles(id1);
2995  }
2996  else
2997  {
2998  const ItemInfo &info = ItemDB::get(id);
2999  const std::string &restrict filename = info.getSprite(
3000  mGender, mSubType);
3001  int lastTime = 0;
3002  int startTime = 0;
3003  AnimatedSprite *restrict equipmentSprite = nullptr;
3004 
3005  if (!filename.empty())
3006  {
3007  color = info.getDyeColorsString(colorId);
3008  equipmentSprite = AnimatedSprite::delayedLoad(
3009  pathJoin(paths.getStringValue("sprites"),
3010  combineDye(filename, color)),
3011  0);
3012  }
3013 
3014  if (equipmentSprite != nullptr)
3015  {
3016  equipmentSprite->setSpriteDirection(getSpriteDirection());
3017  startTime = getStartTime();
3018  lastTime = getLastTime();
3019  }
3020 
3021  CompoundSprite::setSprite(slot, equipmentSprite);
3022  mSpriteDraw[slot] = id;
3023 
3024  addItemParticles(id, info.getDisplay());
3025 
3026  setAction(mAction, 0);
3027  if (equipmentSprite != nullptr)
3028  {
3029  if (lastTime > 0)
3030  {
3031  equipmentSprite->setLastTime(startTime);
3032  equipmentSprite->update(lastTime);
3033  }
3034  }
3035  }
3036 
3037  BeingSlot &beingSlot = mSlots[slot];
3038  beingSlot.spriteId = id;
3039  beingSlot.color = STD_MOVE(color);
3040  beingSlot.colorId = colorId;
3041  beingSlot.cardsId = CardsList(nullptr);
3043  if (beingEquipmentWindow != nullptr)
3045 }

References beingEquipmentWindow, BeingSlot::cardsId, CAST_U32, charServerHandler, BeingSlot::color, BeingSlot::colorId, combineDye(), AnimatedSprite::delayedLoad(), ItemDB::get(), Configuration::getStringValue(), Actions::info(), Net::CharServerHandler::maxSprite(), pathJoin(), paths, restrict, CompoundSprite::setSprite(), BeingSlot::spriteId, STD_MOVE, and EquipmentWindow::updateBeing().

Referenced by ActorManager::cloneBeing().

◆ setSpriteId()

void Being::setSpriteId ( const unsigned int  slot,
const int  id 
)

Definition at line 2789 of file being.cpp.

2791 {
2792  if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
2793  return;
2794 
2795  if (slot >= CAST_U32(mSprites.size()))
2796  ensureSize(slot + 1);
2797 
2798  if (slot >= CAST_U32(mSlots.size()))
2799  mSlots.resize(slot + 1, BeingSlot());
2800 
2801  // id = 0 means unequip
2802  if (id == 0)
2803  {
2804  removeSprite(slot);
2805  mSpriteDraw[slot] = 0;
2806 
2807  const int id1 = mSlots[slot].spriteId;
2808  if (id1 != 0)
2809  removeItemParticles(id1);
2810  }
2811  else
2812  {
2813  const ItemInfo &info = ItemDB::get(id);
2814  const std::string &restrict filename = info.getSprite(
2815  mGender, mSubType);
2816  int lastTime = 0;
2817  int startTime = 0;
2818  AnimatedSprite *restrict equipmentSprite = nullptr;
2819 
2820  if (!filename.empty())
2821  {
2822  equipmentSprite = AnimatedSprite::delayedLoad(
2823  pathJoin(paths.getStringValue("sprites"), filename),
2824  0);
2825  }
2826 
2827  if (equipmentSprite != nullptr)
2828  {
2829  equipmentSprite->setSpriteDirection(getSpriteDirection());
2830  startTime = getStartTime();
2831  lastTime = getLastTime();
2832  }
2833 
2834  CompoundSprite::setSprite(slot, equipmentSprite);
2835  mSpriteDraw[slot] = id;
2836 
2837  addItemParticles(id, info.getDisplay());
2838 
2839  setAction(mAction, 0);
2840  if (equipmentSprite != nullptr)
2841  {
2842  if (lastTime > 0)
2843  {
2844  equipmentSprite->setLastTime(startTime);
2845  equipmentSprite->update(lastTime);
2846  }
2847  }
2848  }
2849 
2850  BeingSlot &beingSlot = mSlots[slot];
2851  beingSlot.spriteId = id;
2852  beingSlot.color.clear();
2853  beingSlot.colorId = ItemColor_one;
2854  beingSlot.cardsId = CardsList(nullptr);
2856  if (beingEquipmentWindow != nullptr)
2858 }

References beingEquipmentWindow, BeingSlot::cardsId, CAST_U32, charServerHandler, BeingSlot::color, BeingSlot::colorId, AnimatedSprite::delayedLoad(), ItemDB::get(), Configuration::getStringValue(), Actions::info(), ItemColor_one, Net::CharServerHandler::maxSprite(), pathJoin(), paths, restrict, CompoundSprite::setSprite(), BeingSlot::spriteId, and EquipmentWindow::updateBeing().

Referenced by TmwAthena::BeingRecv::processBeingChangeLookContinue(), EAthena::BeingRecv::processBeingChangeLookContinue(), EAthena::CharServerRecv::readPlayerData(), and TmwAthena::CharServerRecv::readPlayerData().

◆ setSpriteSlot()

void Being::setSpriteSlot ( const unsigned int  slot,
const BeingSlot beingSlot 
)

Definition at line 3403 of file being.cpp.

3405 {
3406  mSlots[slot] = beingSlot;
3407 }

References mSlots.

◆ setState()

void Being::setState ( const uint8_t  state)

Definition at line 4803 of file being.cpp.

4804 {
4805  const bool shop = ((state & BeingFlag::SHOP) != 0);
4806  const bool away = ((state & BeingFlag::AWAY) != 0);
4807  const bool inactive = ((state & BeingFlag::INACTIVE) != 0);
4808  const bool needUpdate = (shop != mShop || away != mAway
4809  || inactive != mInactive);
4810 
4812  mShop = shop;
4813  mAway = away;
4814  mInactive = inactive;
4815  updateAwayEffect();
4819 
4820  if (needUpdate)
4821  {
4822  if (shop || away || inactive)
4823  mAdvanced = true;
4824  updateName();
4825  addToCache();
4826  }
4827 }
void showAwayBadge(const bool show)
Definition: being.cpp:5293
void updateAwayEffect()
Definition: being.cpp:4951
void showInactiveBadge(const bool show)
Definition: being.cpp:5274
bool away(InputEvent &event)
Definition: statusbar.cpp:45

References BeingFlag::AWAY, Actions::away(), Net::getNetworkType(), BeingFlag::INACTIVE, BeingFlag::SHOP, and ServerType::TMWATHENA.

Referenced by OnlinePlayer::setText().

◆ setSubtype()

void Being::setSubtype ( const BeingTypeId  subtype,
const uint16_t  look 
)

Set Being's subtype (mostly for view for monsters and NPCs)

Definition at line 371 of file being.cpp.

373 {
374  if (mInfo == nullptr)
375  return;
376 
377  if (subtype == mSubType && mLook == look)
378  return;
379 
380  mSubType = subtype;
381  mLook = look;
382 
383  switch (mType)
384  {
385  case ActorType::Monster:
387  if (mInfo != nullptr)
388  {
389  setName(mInfo->getName());
395  }
396  break;
397  case ActorType::Pet:
399  if (mInfo != nullptr)
400  {
401  setName(mInfo->getName());
407  }
408  break;
411  if (mInfo != nullptr)
412  {
413  setName(mInfo->getName());
419  }
420  break;
423  if (mInfo != nullptr)
424  {
425  setName(mInfo->getName());
431  }
432  break;
435  if (mInfo != nullptr)
436  {
437  setName(mInfo->getName());
443  }
444  break;
447  if (mInfo != nullptr)
448  {
449  setName(mInfo->getName());
455  }
456  break;
457  case ActorType::Npc:
459  if (mInfo != nullptr)
460  {
464  std::string());
467  }
468  break;
469  case ActorType::Avatar:
471  if (mInfo != nullptr)
472  {
476  std::string());
477  }
478  break;
479  case ActorType::Player:
480  {
481  int id = -100 - toInt(subtype, int);
482  // Prevent showing errors when sprite doesn't exist
483  if (!ItemDB::exists(id))
484  {
485  id = -100;
486  // TRANSLATORS: default race name
487  setRaceName(_("Human"));
488  if (charServerHandler != nullptr)
489  {
491  id);
492  }
493  }
494  else
495  {
496  const ItemInfo &restrict info = ItemDB::get(id);
497  setRaceName(info.getName());
498  if (charServerHandler != nullptr)
499  {
501  id,
502  info.getColor(fromInt(mLook, ItemColor)));
503  }
504  }
505  break;
506  }
507  case ActorType::Portal:
508  break;
509  case ActorType::Unknown:
511  default:
512  reportAlways("Wrong being type %d in setSubType",
513  CAST_S32(mType))
514  break;
515  }
516 }
void setupSpriteDisplay(const SpriteDisplay &display, const ForceDisplay forceDisplay, const DisplayTypeT displayType, const std::string &color)
int getSortOffsetY() const
Definition: beinginfo.h:186
const std::string & getName() const
Definition: beinginfo.h:68
const SpriteDisplay & getDisplay() const
Definition: beinginfo.h:73
bool getAllowEquipment() const
Definition: beinginfo.h:327
std::string getColor(const ItemColor idx) const
Definition: beinginfo.cpp:242
void setRaceName(const std::string &name)
Definition: being.h:858
void setName(const std::string &name)
Definition: being.cpp:1136
void setSpriteId(const unsigned int slot, const int id)
Definition: being.cpp:2789
virtual unsigned int baseSprite() const =0
const bool ForceDisplay_true
Definition: forcedisplay.h:30
const bool ForceDisplay_false
Definition: forcedisplay.h:30
BeingInfo * get(const BeingTypeId id)
Definition: avatardb.cpp:141
BeingInfo * get(const BeingTypeId id)
BeingInfo * get(const BeingTypeId id)
bool exists(const int id)
Definition: itemdb.cpp:773
BeingInfo * get(const BeingTypeId id)
BeingInfo * get(const BeingTypeId id)
Definition: monsterdb.cpp:145
BeingInfo * get(const BeingTypeId id)
Definition: npcdb.cpp:188
BeingInfo * get(const BeingTypeId id)
Definition: petdb.cpp:157
BeingInfo * get(const BeingTypeId id)

References _, ActorType::Avatar, Net::CharServerHandler::baseSprite(), CAST_S32, charServerHandler, ActorType::Elemental, ItemDB::exists(), ActorType::FloorItem, ForceDisplay_false, ForceDisplay_true, fromInt, AvatarDB::get(), ElementalDb::get(), HomunculusDB::get(), MercenaryDB::get(), MonsterDB::get(), NPCDB::get(), PETDB::get(), SkillUnitDb::get(), ItemDB::get(), ActorType::Homunculus, Actions::info(), DisplayType::Item, ActorType::Mercenary, ActorType::Monster, ActorType::Npc, ActorType::Pet, ActorType::Player, ActorType::Portal, reportAlways, restrict, ActorType::SkillUnit, toInt, and ActorType::Unknown.

Referenced by postInit(), TmwAthena::BeingRecv::processBeingChangeLookContinue(), EAthena::BeingRecv::processBeingChangeLookContinue(), EAthena::BeingRecv::processBeingFakeName(), EAthena::BeingRecv::processBeingMove(), TmwAthena::BeingRecv::processBeingMove(), EAthena::BeingRecv::processBeingSpawn(), EAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processPlayerMove(), TmwAthena::BeingRecv::processPlayerUpdate1(), TmwAthena::BeingRecv::processPlayerUpdate2(), EAthena::CharServerRecv::readPlayerData(), TmwAthena::CharServerRecv::readPlayerData(), and CharCreateDialog::updateLook().

◆ setTalkTime()

void Being::setTalkTime ( )
inline

Definition at line 712 of file being.h.

713  { mTalkTime = cur_time; }

References cur_time, and mTalkTime.

Referenced by EAthena::ChatRecv::processBeingChat(), and TmwAthena::ChatRecv::processBeingChat().

◆ setTeamId()

void Being::setTeamId ( const uint16_t  teamId)

Definition at line 5187 of file being.cpp.

5188 {
5189  if (mTeamId != teamId)
5190  {
5191  mTeamId = teamId;
5192  showTeamBadge(mTeamId != 0);
5193  updateColors();
5194  }
5195 }
void showTeamBadge(const bool show)
Definition: being.cpp:5197

Referenced by EAthena::BattleGroundRecv::processBattleEmblem2(), TmwAthena::BeingRecv::processPvpSet(), and updateFromCache().

◆ setTempSprite()

void Being::setTempSprite ( const unsigned int  slot,
const int  id 
)

Definition at line 3143 of file being.cpp.

3145 {
3146  if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
3147  return;
3148 
3149  if (slot >= CAST_U32(mSprites.size()))
3150  ensureSize(slot + 1);
3151 
3152  if (slot >= CAST_U32(mSlots.size()))
3153  mSlots.resize(slot + 1, BeingSlot());
3154 
3155  BeingSlot &beingSlot = mSlots[slot];
3156 
3157  // id = 0 means unequip
3158  if (id == 0)
3159  {
3160  removeSprite(slot);
3161  mSpriteDraw[slot] = 0;
3162 
3163  const int id1 = beingSlot.spriteId;
3164  if (id1 != 0)
3165  removeItemParticles(id1);
3166  }
3167  else
3168  {
3169  const ItemInfo &info = ItemDB::get(id);
3170  const std::string &restrict filename = info.getSprite(
3171  mGender, mSubType);
3172  int lastTime = 0;
3173  int startTime = 0;
3174 
3175  AnimatedSprite *restrict equipmentSprite = nullptr;
3176 
3177  if (!filename.empty())
3178  {
3179  ItemColor colorId = ItemColor_one;
3180  const CardsList &cards = beingSlot.cardsId;
3181  if (!cards.isEmpty())
3182  colorId = ItemColorManager::getColorFromCards(cards);
3183  std::string color = beingSlot.color;
3184  if (color.empty())
3185  color = info.getDyeColorsString(colorId);
3186 
3187  equipmentSprite = AnimatedSprite::delayedLoad(
3188  pathJoin(paths.getStringValue("sprites"),
3189  combineDye(filename, color)),
3190  0);
3191  }
3192 
3193  if (equipmentSprite != nullptr)
3194  {
3195  equipmentSprite->setSpriteDirection(getSpriteDirection());
3196  startTime = getStartTime();
3197  lastTime = getLastTime();
3198  }
3199 
3200  CompoundSprite::setSprite(slot, equipmentSprite);
3201  mSpriteDraw[slot] = id;
3202 
3203  // +++ here probably need use existing cards
3204  addItemParticles(id, info.getDisplay());
3205 
3206  setAction(mAction, 0);
3207  if (equipmentSprite != nullptr)
3208  {
3209  if (lastTime > 0)
3210  {
3211  equipmentSprite->setLastTime(startTime);
3212  equipmentSprite->update(lastTime);
3213  }
3214  }
3215  }
3216 }

References BeingSlot::cardsId, CAST_U32, charServerHandler, BeingSlot::color, combineDye(), AnimatedSprite::delayedLoad(), ItemDB::get(), ItemColorManager::getColorFromCards(), Configuration::getStringValue(), Actions::info(), CardsList::isEmpty(), ItemColor_one, Net::CharServerHandler::maxSprite(), pathJoin(), paths, restrict, CompoundSprite::setSprite(), and BeingSlot::spriteId.

Referenced by recalcSpritesOrder().

◆ setTestTime()

void Being::setTestTime ( )
inline

Definition at line 715 of file being.h.

716  { mTestTime = cur_time; }

References cur_time, and mTestTime.

◆ setTileCoords()

void Being::setTileCoords ( const int  x,
const int  y 
)
virtual

◆ setTrickDead()

void Being::setTrickDead ( const bool  b)
virtual

Reimplemented from ActorSprite.

Definition at line 5465 of file being.cpp.

5466 {
5467  if (b != mTrickDead)
5468  {
5469  mTrickDead = b;
5470  setAction(mAction, 0);
5471  }
5472 }

◆ setWalkSpeed()

void Being::setWalkSpeed ( const int  speed)
inline

◆ setWeaponId()

void Being::setWeaponId ( const int  id)

◆ showAwayBadge()

void Being::showAwayBadge ( const bool  show)

Definition at line 5293 of file being.cpp.

5294 {
5296  if (show &&
5297  mAway &&
5299  {
5300  const std::string badge = paths.getStringValue("awaybadge");
5301  if (!badge.empty())
5302  {
5304  paths.getStringValue("badges") + badge,
5305  0);
5306  }
5307  }
5310 }

References BadgeIndex::Away, delete2, Configuration::getStringValue(), BadgeDrawType::Hide, AnimatedSprite::load(), and paths.

Referenced by updateFromCache().

◆ showBadges()

void Being::showBadges ( const bool  show)

Definition at line 5214 of file being.cpp.

5215 {
5216  showTeamBadge(show);
5217  showGuildBadge(show);
5218  showGmBadge(show);
5219  showPartyBadge(show);
5220  showNameBadge(show);
5221  showShopBadge(show);
5222  showInactiveBadge(show);
5223  showAwayBadge(show);
5224 }

Referenced by ActorManager::updateBadges().

◆ showClanBadge()

void Being::showClanBadge ( const bool  show)

Definition at line 1206 of file being.cpp.

1207 {
1209  if (show &&
1210  !mClanName.empty() &&
1212  {
1213  const std::string badge = BadgesDB::getClanBadge(mClanName);
1214  if (!badge.empty())
1215  {
1217  paths.getStringValue("badges") + badge,
1218  0);
1219  }
1220  }
1221 }
const std::string getClanBadge(const std::string &name)
Definition: badgesdb.cpp:120

References BadgeIndex::Clan, delete2, BadgesDB::getClanBadge(), Configuration::getStringValue(), BadgeDrawType::Hide, AnimatedSprite::load(), and paths.

◆ showGmBadge()

void Being::showGmBadge ( const bool  show)

Definition at line 3646 of file being.cpp.

3647 {
3649  if (show &&
3650  mIsGM &&
3653  {
3654  const std::string &gmBadge = GroupDb::getBadge(mGroupId);
3655  if (!gmBadge.empty())
3656  {
3658  paths.getStringValue("badges") + gmBadge,
3659  0);
3660  }
3661  }
3664 }
const std::string & getBadge(const int id)
Definition: groupdb.cpp:388
bool getShowBadge(const int id)
Definition: groupdb.cpp:366

References delete2, GroupDb::getBadge(), GroupDb::getShowBadge(), Configuration::getStringValue(), BadgeIndex::Gm, BadgeDrawType::Hide, AnimatedSprite::load(), and paths.

Referenced by setGroupId().

◆ showGuildBadge()

void Being::showGuildBadge ( const bool  show)

Definition at line 1179 of file being.cpp.

1180 {
1182  if (show &&
1183  !mGuildName.empty() &&
1185  {
1186  const std::string badge = BadgesDB::getGuildBadge(mGuildName);
1187  if (!badge.empty())
1188  {
1190  paths.getStringValue("badges") + badge,
1191  0);
1192  }
1193  }
1194 }
const std::string getGuildBadge(const std::string &name)
Definition: badgesdb.cpp:112

References delete2, BadgesDB::getGuildBadge(), Configuration::getStringValue(), BadgeIndex::Guild, BadgeDrawType::Hide, AnimatedSprite::load(), and paths.

◆ showInactiveBadge()

void Being::showInactiveBadge ( const bool  show)

Definition at line 5274 of file being.cpp.

5275 {
5277  if (show &&
5278  mInactive &&
5280  {
5281  const std::string badge = paths.getStringValue("inactivebadge");
5282  if (!badge.empty())
5283  {
5285  paths.getStringValue("badges") + badge,
5286  0);
5287  }
5288  }
5291 }

References delete2, Configuration::getStringValue(), BadgeDrawType::Hide, BadgeIndex::Inactive, AnimatedSprite::load(), and paths.

Referenced by updateFromCache().

◆ showName()

void Being::showName ( )
protected

Definition at line 2578 of file being.cpp.

2579 {
2580  if (mName.empty())
2581  return;
2582 
2584 
2586  return;
2587 
2588  std::string displayName(mName);
2589 
2591  {
2592  displayName.append(" ");
2593  if (mShowLevel && getLevel() != 0)
2594  displayName.append(toString(getLevel()));
2595 
2596  displayName.append(getGenderSign());
2597  }
2598 
2599  if (mType == ActorType::Monster)
2600  {
2601  if (config.getBoolValue("showMonstersTakedDamage"))
2602  displayName.append(", ").append(toString(getDamageTaken()));
2603  }
2604 
2605  Font *font = nullptr;
2606  if ((localPlayer != nullptr) && localPlayer->getTarget() == this
2607  && mType != ActorType::Monster)
2608  {
2609  font = boldFont;
2610  }
2611  else if (mType == ActorType::Player
2612  && !playerRelations.isGoodName(this) && (gui != nullptr))
2613  {
2614  font = gui->getSecureFont();
2615  }
2616 
2617  if (mInfo != nullptr)
2618  {
2619  mDispName = new FlashText(displayName,
2623  mNameColor,
2624  font);
2625  }
2626  else
2627  {
2628  mDispName = new FlashText(displayName,
2629  mPixelX,
2630  mPixelY,
2632  mNameColor,
2633  font);
2634  }
2635 
2636  updateCoords();
2637 }
int getNameOffsetY() const
Definition: beinginfo.h:153
int getNameOffsetX() const
Definition: beinginfo.h:147
int getDamageTaken() const
Definition: being.h:593
Definition: font.h:90
Font * getSecureFont() const
Definition: gui.h:172
bool isGoodName(Being *const being) const
RelationT getRelation(const std::string &name) const
Font * boldFont
Definition: gui.cpp:112
@ ERASED
Definition: relation.h:35
PlayerRelationsManager playerRelations

References boldFont, Graphics::CENTER, config, delete2, Relation::ERASED, Configuration::getBoolValue(), getDamageTaken(), getGenderSign(), getLevel(), BeingInfo::getNameOffsetX(), BeingInfo::getNameOffsetY(), PlayerRelationsManager::getRelation(), Gui::getSecureFont(), LocalPlayer::getTarget(), gui, PlayerRelationsManager::isGoodName(), localPlayer, mDispName, mHideErased, mInfo, mName, mNameColor, ActorType::Monster, Actor::mPixelX, Actor::mPixelY, mShowGender, mShowLevel, mType, ActorType::Player, playerRelations, Catch::toString(), and updateCoords().

Referenced by updateName().

◆ showNameBadge()

void Being::showNameBadge ( const bool  show)

Definition at line 1119 of file being.cpp.

1120 {
1122  if (show &&
1123  !mName.empty() &&
1125  {
1126  const std::string badge = BadgesDB::getNameBadge(mName);
1127  if (!badge.empty())
1128  {
1130  paths.getStringValue("badges") + badge,
1131  0);
1132  }
1133  }
1134 }
const std::string getNameBadge(const std::string &name)
Definition: badgesdb.cpp:104

References delete2, BadgesDB::getNameBadge(), Configuration::getStringValue(), BadgeDrawType::Hide, AnimatedSprite::load(), BadgeIndex::Name, and paths.

◆ showPartyBadge()

void Being::showPartyBadge ( const bool  show)

Definition at line 5226 of file being.cpp.

5227 {
5229  if (show &&
5230  !mPartyName.empty() &&
5232  {
5233  const std::string badge = BadgesDB::getPartyBadge(mPartyName);
5234  if (!badge.empty())
5235  {
5237  paths.getStringValue("badges") + badge,
5238  0);
5239  }
5240  }
5243 }
const std::string getPartyBadge(const std::string &name)
Definition: badgesdb.cpp:96

References delete2, BadgesDB::getPartyBadge(), Configuration::getStringValue(), BadgeDrawType::Hide, AnimatedSprite::load(), BadgeIndex::Party, and paths.

◆ showShopBadge()

void Being::showShopBadge ( const bool  show)

Definition at line 5255 of file being.cpp.

5256 {
5258  if (show &&
5259  mShop &&
5261  {
5262  const std::string badge = paths.getStringValue("shopbadge");
5263  if (!badge.empty())
5264  {
5266  paths.getStringValue("badges") + badge,
5267  0);
5268  }
5269  }
5272 }

References delete2, Configuration::getStringValue(), BadgeDrawType::Hide, AnimatedSprite::load(), paths, and BadgeIndex::Shop.

Referenced by updateFromCache().

◆ showTeamBadge()

void Being::showTeamBadge ( const bool  show)

Definition at line 5197 of file being.cpp.

5198 {
5200  if (show &&
5201  mTeamId != 0U &&
5203  {
5204  const std::string name = paths.getStringValue("badges") +
5205  paths.getStringValue(strprintf("team%dbadge",
5206  mTeamId));
5207  if (!name.empty())
5209  }
5212 }
std::string strprintf(const char *const format,...)

References delete2, Configuration::getStringValue(), BadgeDrawType::Hide, AnimatedSprite::load(), paths, strprintf(), and BadgeIndex::Team.

◆ stopCast()

void Being::stopCast ( const bool  b)
virtual

Reimplemented from ActorSprite.

Definition at line 5522 of file being.cpp.

5523 {
5524  if (b && mAction == BeingAction::CAST)
5526 }

References BeingAction::CAST, mAction, setAction(), and BeingAction::STAND.

Referenced by EAthena::SkillRecv::processSkillFailed().

◆ takeDamage()

void Being::takeDamage ( Being *const  attacker,
const int  amount,
const AttackTypeT  type,
const int  attackId,
const int  level 
)

Puts a damage bubble above this being.

Parameters
attackerthe attacking being
amountthe amount of damage recieved (0 means miss)
typethe attack type
attackIdthe attack id
levelthe skill level

Definition at line 667 of file being.cpp.

672 {
673  if (userPalette == nullptr || attacker == nullptr)
674  return;
675 
676  BLOCK_START("Being::takeDamage1")
677 
678  Font *font = nullptr;
679  const Color *color;
680 
681  if (gui != nullptr)
682  font = gui->getInfoParticleFont();
683 
684  // Selecting the right color
685  if (type == AttackType::CRITICAL || type == AttackType::FLEE)
686  {
687  if (type == AttackType::CRITICAL)
688  attacker->setCriticalHit(amount);
689 
690  if (attacker == localPlayer)
691  {
692  color = &userPalette->getColor(
694  255U);
695  }
696  else
697  {
699  255U);
700  }
701  }
702  else if (amount == 0)
703  {
704  if (attacker == localPlayer)
705  {
706  // This is intended to be the wrong direction to visually
707  // differentiate between hits and misses
709  255U);
710  }
711  else
712  {
714  255U);
715  }
716  }
717  else if (mType == ActorType::Monster ||
719  mType == ActorType::Pet ||
722  {
723  if (attacker == localPlayer)
724  {
725  color = &userPalette->getColor(
727  255U);
728  }
729  else
730  {
731  color = &userPalette->getColor(
733  255U);
734  }
735  }
736  else if (mType == ActorType::Player &&
737  attacker != localPlayer &&
738  this == localPlayer)
739  {
740  // here player was attacked by other player. mark him as enemy.
742  255U);
743  attacker->setEnemy(true);
744  attacker->updateColors();
745  }
746  else
747  {
749  255U);
750  }
751 
752  if (chatWindow != nullptr && mShowBattleEvents)
753  {
754  if (this == localPlayer)
755  {
756  if (attacker->mType == ActorType::Player || (amount != 0))
757  {
758  ChatWindow::battleChatLog(strprintf("%s : Hit you -%d",
759  attacker->getName().c_str(), amount),
763  }
764  }
765  else if (attacker == localPlayer && (amount != 0))
766  {
767  ChatWindow::battleChatLog(strprintf("%s : You hit %s -%d",
768  attacker->mName.c_str(),
769  mName.c_str(),
770  amount),
774  }
775  }
776  if (font != nullptr && particleEngine != nullptr)
777  {
778  const std::string damage = amount != 0 ? toString(amount) :
779  // TRANSLATORS: dodge or miss message in attacks
780  type == AttackType::FLEE ? _("dodge") : _("miss");
781  // Show damage number
783  mPixelX,
784  mPixelY - 16,
785  color,
786  font,
787  true);
788  }
789  BLOCK_END("Being::takeDamage1")
790  BLOCK_START("Being::takeDamage2")
791 
792  if (type != AttackType::SKILL)
793  attacker->updateHit(amount);
794 
795  if (amount > 0)
796  {
797  if ((localPlayer != nullptr) && localPlayer == this)
798  localPlayer->setLastHitFrom(attacker->mName);
799 
800  mDamageTaken += amount;
801  if (mInfo != nullptr)
802  {
804  this,
805  false,
806  mX,
807  mY);
808 
809  if (!mInfo->isStaticMaxHP())
810  {
811  if ((mHP == 0) && mInfo->getMaxHP() < mDamageTaken)
813  }
814  }
815  if ((mHP != 0) && isAlive())
816  {
817  mHP -= amount;
818  if (mHP < 0)
819  mHP = 0;
820  }
821 
822  if (mType == ActorType::Monster)
823  {
824  updatePercentHP();
825  updateName();
826  }
827  else if (mType == ActorType::Player &&
828  (socialWindow != nullptr) &&
829  !mName.empty())
830  {
832  }
833 
834  if (effectManager != nullptr)
835  {
836  const int hitEffectId = getHitEffect(attacker,
837  type,
838  attackId,
839  level);
840  if (hitEffectId >= 0)
841  effectManager->trigger(hitEffectId, this, 0);
842  }
843  }
844  else
845  {
846  if (effectManager != nullptr)
847  {
848  int hitEffectId = -1;
849  if (type == AttackType::SKILL)
850  {
851  hitEffectId = getHitEffect(attacker,
853  attackId,
854  level);
855  }
856  else
857  {
858  hitEffectId = getHitEffect(attacker,
860  attackId,
861  level);
862  }
863  if (hitEffectId >= 0)
864  effectManager->trigger(hitEffectId, this, 0);
865  }
866  }
867  BLOCK_END("Being::takeDamage2")
868 }
ChatWindow * chatWindow
Definition: chatwindow.cpp:94
bool isStaticMaxHP() const
Definition: beinginfo.h:174
void setMaxHP(const int n)
Definition: beinginfo.h:168
void updateHit(const int amount)
Definition: being.cpp:4686
void setCriticalHit(const int n)
Definition: being.h:791
const std::string & getName() const
Definition: being.h:232
static int getHitEffect(const Being *const attacker, const AttackTypeT type, const int attackId, const int level)
Definition: being.cpp:870
void setEnemy(const bool n)
Definition: being.h:740
static void battleChatLog(const std::string &line, ChatMsgTypeT own, const IgnoreRecord ignoreRecord, const TryRemoveColors tryRemoveColors)
void setLastHitFrom(const std::string &n)
Definition: localplayer.h:367
Particle * addTextSplashEffect(const std::string &text, const int x, const int y, const Color *const color, Font *const font, const bool outline)
void updateAvatar(const std::string &name)
const bool IgnoreRecord_false
Definition: ignorerecord.h:30
@ HIT_PLAYER_PLAYER
Definition: usercolorid.h:72
@ HIT_PLAYER_MONSTER
Definition: usercolorid.h:70
@ HIT_LOCAL_PLAYER_MONSTER
Definition: usercolorid.h:74
@ HIT_LOCAL_PLAYER_MISS
Definition: usercolorid.h:76
@ HIT_MONSTER_PLAYER
Definition: usercolorid.h:71
@ HIT_LOCAL_PLAYER_CRITICAL
Definition: usercolorid.h:75
const bool TryRemoveColors_true

References _, ParticleEngine::addTextSplashEffect(), ChatWindow::battleChatLog(), BLOCK_END, BLOCK_START, ChatMsgType::BY_OTHER, ChatMsgType::BY_PLAYER, chatWindow, AttackType::CRITICAL, effectManager, AttackType::FLEE, UserPalette::getColor(), Gui::getInfoParticleFont(), gui, UserColorId::HIT_CRITICAL, UserColorId::HIT_LOCAL_PLAYER_CRITICAL, UserColorId::HIT_LOCAL_PLAYER_MISS, UserColorId::HIT_LOCAL_PLAYER_MONSTER, UserColorId::HIT_MONSTER_PLAYER, UserColorId::HIT_PLAYER_MONSTER, UserColorId::HIT_PLAYER_PLAYER, ActorType::Homunculus, ItemSoundEvent::HURT, IgnoreRecord_false, localPlayer, ActorType::Mercenary, AttackType::MISS, UserColorId::MISS, ActorType::Monster, particleEngine, ActorType::Pet, ActorType::Player, LocalPlayer::setLastHitFrom(), AttackType::SKILL, AttackType::SKILLMISS, ActorType::SkillUnit, socialWindow, strprintf(), Catch::toString(), EffectManager::trigger(), TryRemoveColors_true, SocialWindow::updateAvatar(), and userPalette.

Referenced by Ea::BeingRecv::processBeingAction(), EAthena::BeingRecv::processBeingAction2(), EAthena::BeingRecv::processSkillAutoCast(), EAthena::BeingRecv::processSkillDamage(), and TmwAthena::BeingRecv::processSkillDamage().

◆ talkTo()

void Being::talkTo ( ) const

Definition at line 3675 of file being.cpp.

3676 {
3677  if (npcHandler == nullptr)
3678  return;
3679 
3681  {
3682  // using workaround...
3683  if ((playerHandler != nullptr) &&
3685  {
3687  }
3688  return;
3689  }
3690 
3691  npcHandler->talk(this);
3692 }
virtual void talk(const Being *const being) const =0
virtual void attack(const BeingId id, const Keep keep) const =0
const bool Keep_false
Definition: keep.h:30
bool limitPackets(const PacketTypeT type)
@ PACKET_ATTACK
Definition: packettype.h:38
@ PACKET_NPC_TALK
Definition: packettype.h:33
Net::NpcHandler * npcHandler
Definition: net.cpp:93

References Net::PlayerHandler::attack(), Keep_false, PacketLimiter::limitPackets(), ActorSprite::mId, npcHandler, PacketType::PACKET_ATTACK, PacketType::PACKET_NPC_TALK, playerHandler, and Net::NpcHandler::talk().

◆ undressItemById()

void Being::undressItemById ( const int  id)

Definition at line 4705 of file being.cpp.

4706 {
4707  const size_t sz = mSlots.size();
4708 
4709  for (size_t f = 0; f < sz; f ++)
4710  {
4711  if (id == mSlots[f].spriteId)
4712  {
4713  unSetSprite(CAST_U32(f));
4714  break;
4715  }
4716  }
4717 }
void unSetSprite(const unsigned int slot)
Definition: being.cpp:2861

References CAST_U32.

◆ unSetSprite()

void Being::unSetSprite ( const unsigned int  slot)

Definition at line 2861 of file being.cpp.

2862 {
2863  if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
2864  return;
2865 
2866  if (slot >= CAST_U32(mSprites.size()))
2867  ensureSize(slot + 1);
2868 
2869  if (slot >= CAST_U32(mSlots.size()))
2870  mSlots.resize(slot + 1, BeingSlot());
2871 
2872  removeSprite(slot);
2873  mSpriteDraw[slot] = 0;
2874 
2875  BeingSlot &beingSlot = mSlots[slot];
2876  const int id1 = beingSlot.spriteId;
2877  if (id1 != 0)
2878  removeItemParticles(id1);
2879 
2880  beingSlot.spriteId = 0;
2881  beingSlot.color.clear();
2882  beingSlot.colorId = ItemColor_one;
2883  beingSlot.cardsId = CardsList(nullptr);
2885  if (beingEquipmentWindow != nullptr)
2887 }

References beingEquipmentWindow, BeingSlot::cardsId, CAST_U32, charServerHandler, BeingSlot::color, BeingSlot::colorId, ItemColor_one, Net::CharServerHandler::maxSprite(), BeingSlot::spriteId, and EquipmentWindow::updateBeing().

Referenced by ActorManager::cloneBeing(), EAthena::CharServerRecv::readPlayerData(), TmwAthena::CharServerRecv::readPlayerData(), EAthena::BeingHandler::undress(), and TmwAthena::BeingHandler::undress().

◆ updateAwayEffect()

void Being::updateAwayEffect ( )

Definition at line 4951 of file being.cpp.

4952 {
4953  if (mAway)
4954  addAfkEffect();
4955  else
4956  removeAfkEffect();
4957 }
void addAfkEffect()
Definition: being.cpp:4918
void removeAfkEffect()
Definition: being.cpp:4923

References addAfkEffect(), mAway, and removeAfkEffect().

Referenced by updateFromCache().

◆ updateBadgesCount()

void Being::updateBadgesCount ( )
protected

Definition at line 5312 of file being.cpp.

5313 {
5314  mBadgesCount = 0;
5315  for_each_badges()
5316  {
5317  if (mBadges[f] != nullptr)
5318  mBadgesCount ++;
5319  }
5320 }

References for_each_badges, mBadges, and mBadgesCount.

◆ updateBadgesPosition()

void Being::updateBadgesPosition ( )
protected

Definition at line 2313 of file being.cpp.

2314 {
2315  const int px = mPixelX - mapTileSize / 2;
2316  const int py = mPixelY - mapTileSize * 2 - mapTileSize;
2318  mBadgesCount != 0U)
2319  {
2320  if (mDispName != nullptr &&
2321  gui != nullptr)
2322  {
2324  {
2325  const Font *restrict const font = gui->getFont();
2327  mBadgesY = mDispName->getY() - font->getHeight();
2328  }
2329  else if (mShowBadges == BadgeDrawType::Bottom)
2330  {
2331  mBadgesX = px + 8 - mBadgesCount * 8;
2333  {
2334  mBadgesY = mDispName->getY();
2335  }
2336  else
2337  {
2338  mBadgesY = py + settings.playerNameOffset + 16;
2339  }
2340  }
2341  else
2342  {
2343  mBadgesX = px + 8 - mBadgesCount * 8;
2345  mBadgesY = py - mDispName->getHeight();
2346  else
2347  mBadgesY = py;
2348  }
2349  }
2350  else
2351  {
2353  {
2355  mBadgesY = py;
2356  }
2357  else if (mShowBadges == BadgeDrawType::Bottom)
2358  {
2359  mBadgesX = px + 8 - mBadgesCount * 8;
2360  const int height = settings.playerNameOffset;
2362  mBadgesY = py + height;
2363  else
2364  mBadgesY = py + height + 16;
2365  }
2366  else
2367  {
2368  mBadgesX = px + 8 - mBadgesCount * 8;
2369  mBadgesY = py;
2370  }
2371  }
2372  }
2373 }
int playerNameOffset
Definition: settings.h:149
int playerBadgeAtRightOffset
Definition: settings.h:150
int getX() const
Definition: text.h:82
int getWidth() const
Definition: text.h:63
int getY() const
Definition: text.h:85

References BadgeDrawType::Bottom, VisibleNamePos::Bottom, Gui::getFont(), Text::getHeight(), Text::getWidth(), Text::getX(), Text::getY(), gui, BadgeDrawType::Hide, mapTileSize, mBadgesCount, mBadgesX, mBadgesY, mDispName, Actor::mPixelX, Actor::mPixelY, mShowBadges, mVisibleNamePos, Settings::playerBadgeAtRightOffset, Settings::playerNameOffset, restrict, BadgeDrawType::Right, settings, and VisibleNamePos::Top.

Referenced by updateCoords().

◆ updateBotDirection()

void Being::updateBotDirection ( const int  dstX,
const int  dstY 
)
protected

Definition at line 2224 of file being.cpp.

2226 {
2227  int directionType = 0;
2228  switch (mOwner->getCurrentAction())
2229  {
2230  case BeingAction::STAND:
2231  case BeingAction::MOVE:
2232  case BeingAction::HURT:
2233  case BeingAction::SPAWN:
2234  case BeingAction::CAST:
2235  case BeingAction::PRESTAND:
2236  default:
2237  directionType = mInfo->getDirectionType();
2238  break;
2239  case BeingAction::SIT:
2240  directionType = mInfo->getSitDirectionType();
2241  break;
2242  case BeingAction::DEAD:
2243  directionType = mInfo->getDeadDirectionType();
2244  break;
2245  case BeingAction::ATTACK:
2246  directionType = mInfo->getAttackDirectionType();
2247  break;
2248  }
2249 
2250  uint8_t newDir = 0;
2251  switch (directionType)
2252  {
2253  case 0:
2254  default:
2255  return;
2256 
2257  case 1:
2258  newDir = mOwner->mDirection;
2259  break;
2260 
2261  case 2:
2262  {
2263  const int dstX0 = mOwner->mX;
2264  const int dstY0 = mOwner->mY;
2265  if (dstX > dstX0)
2266  newDir |= BeingDirection::LEFT;
2267  else if (dstX < dstX0)
2268  newDir |= BeingDirection::RIGHT;
2269  if (dstY > dstY0)
2270  newDir |= BeingDirection::UP;
2271  else if (dstY < dstY0)
2272  newDir |= BeingDirection::DOWN;
2273  break;
2274  }
2275  case 3:
2276  {
2277  const int dstX0 = mOwner->mX;
2278  const int dstY0 = mOwner->mY;
2279  if (dstX > dstX0)
2280  newDir |= BeingDirection::RIGHT;
2281  else if (dstX < dstX0)
2282  newDir |= BeingDirection::LEFT;
2283  if (dstY > dstY0)
2284  newDir |= BeingDirection::DOWN;
2285  else if (dstY < dstY0)
2286  newDir |= BeingDirection::UP;
2287  break;
2288  }
2289  case 4:
2290  {
2291  const int dstX2 = mOwner->getLastAttackX();
2292  const int dstY2 = mOwner->getLastAttackY();
2293  if (dstX > dstX2)
2294  newDir |= BeingDirection::LEFT;
2295  else if (dstX < dstX2)
2296  newDir |= BeingDirection::RIGHT;
2297  if (dstY > dstY2)
2298  newDir |= BeingDirection::UP;
2299  else if (dstY < dstY2)
2300  newDir |= BeingDirection::DOWN;
2301  break;
2302  }
2303  }
2304  if ((newDir != 0U) && newDir != mDirection)
2305  {
2308  else
2309  mercenaryHandler->setDirection(newDir);
2310  }
2311 }
int getSitDirectionType() const
Definition: beinginfo.h:303
int getAttackDirectionType() const
Definition: beinginfo.h:315
int getDirectionType() const
Definition: beinginfo.h:297
int getDeadDirectionType() const
Definition: beinginfo.h:309
virtual int getLastAttackX() const
Definition: being.h:974
virtual int getLastAttackY() const
Definition: being.h:977
virtual void setDirection(const unsigned char type) const =0
virtual void setDirection(const unsigned char type) const =0

References BeingAction::ATTACK, BeingAction::CAST, BeingAction::DEAD, BeingDirection::DOWN, BeingInfo::getAttackDirectionType(), getCurrentAction(), BeingInfo::getDeadDirectionType(), BeingInfo::getDirectionType(), getLastAttackX(), getLastAttackY(), BeingInfo::getSitDirectionType(), ActorType::Homunculus, homunculusHandler, BeingAction::HURT, BeingDirection::LEFT, mDirection, mercenaryHandler, mInfo, BeingAction::MOVE, mOwner, mType, mX, mY, BeingAction::PRESTAND, BeingDirection::RIGHT, Net::HomunculusHandler::setDirection(), Net::MercenaryHandler::setDirection(), BeingAction::SIT, BeingAction::SPAWN, BeingAction::STAND, and BeingDirection::UP.

Referenced by moveBotTo().

◆ updateBotFollow()

void Being::updateBotFollow ( int  dstX,
int  dstY,
const int  divX,
const int  divY 
)
protected

Definition at line 2153 of file being.cpp.

2157 {
2158  const int followDist = mInfo->getStartFollowDist();
2159  const int dist = mInfo->getFollowDist();
2160  if (divX > followDist || divY > followDist)
2161  {
2162  if (dist > 0)
2163  {
2164  if (divX > followDist)
2165  {
2166  if (dstX > mX + dist)
2167  dstX -= dist;
2168  else if (dstX + dist <= mX)
2169  dstX += dist;
2170  }
2171  else
2172  {
2173  dstX = mX;
2174  }
2175  if (divY > followDist)
2176  {
2177  if (dstY > mY + dist)
2178  dstY -= dist;
2179  else if (dstX + dist <= mX)
2180  dstY += dist;
2181  }
2182  else
2183  {
2184  dstY = mY;
2185  }
2186  }
2187  botFixOffset(dstX, dstY);
2188  moveBotTo(dstX, dstY);
2189  }
2190 }
int getFollowDist() const
Definition: beinginfo.h:225
int getStartFollowDist() const
Definition: beinginfo.h:219

References botFixOffset(), BeingInfo::getFollowDist(), BeingInfo::getStartFollowDist(), mInfo, moveBotTo(), mX, and mY.

Referenced by botLogic().

◆ updateColors()

void Being::updateColors ( )

Definition at line 2663 of file being.cpp.

2664 {
2665  if (userPalette != nullptr)
2666  {
2667  if (mType == ActorType::Monster)
2668  {
2671  255U);
2672  }
2673  else if (mType == ActorType::Npc)
2674  {
2677  255U);
2678  }
2679  else if (mType == ActorType::Pet)
2680  {
2683  255U);
2684  }
2685  else if (mType == ActorType::Homunculus)
2686  {
2689  255U);
2690  }
2691  else if (mType == ActorType::SkillUnit)
2692  {
2695  255U);
2696  }
2697  else if (this == localPlayer)
2698  {
2700  mTextColor = &theme->getColor(ThemeColorId::PLAYER, 255);
2701  }
2702  else
2703  {
2704  mTextColor = &theme->getColor(ThemeColorId::PLAYER, 255);
2705 
2707  mErased = false;
2708  else
2709  mErased = true;
2710 
2711  if (mIsGM)
2712  {
2714  255U);
2716  255U);
2717  }
2718  else if (mEnemy)
2719  {
2721  255U);
2722  }
2723  else if ((mParty != nullptr) && (localPlayer != nullptr)
2724  && mParty == localPlayer->getParty())
2725  {
2727  255U);
2728  }
2729  else if ((localPlayer != nullptr) && (getGuild() != nullptr)
2730  && getGuild() == localPlayer->getGuild())
2731  {
2733  255U);
2734  }
2736  {
2738  255U);
2739  }
2740  else if (playerRelations.getRelation(mName) ==
2744  {
2746  255U);
2747  }
2749  == Relation::IGNORED ||
2751  {
2753  255U);
2754  }
2756  {
2758  255U);
2759  }
2760  else
2761  {
2763  }
2764  }
2765 
2766  if (mDispName != nullptr)
2768  }
2769 }
Party * getParty() const
Definition: being.h:330
const Guild * getGuild(const std::string &guildName) const
Definition: being.cpp:1258
void setDefaultNameColor(const UserColorIdT defaultColor)
Definition: being.cpp:2639
void setColor(const Color *const color)
Definition: text.cpp:130
@ DISREGARDED
Definition: relation.h:33
@ ENEMY2
Definition: relation.h:37
@ IGNORED
Definition: relation.h:34
@ FRIEND
Definition: relation.h:32
@ BLACKLISTED
Definition: relation.h:36

References Relation::BLACKLISTED, Relation::DISREGARDED, UserColorId::DISREGARDED, UserColorId::ENEMY, Relation::ENEMY2, Relation::ERASED, UserColorId::ERASED, Relation::FRIEND, UserColorId::FRIEND, Theme::getColor(), UserPalette::getColor(), getGuild(), getParty(), PlayerRelationsManager::getRelation(), UserColorId::GM, UserColorId::GUILD, ActorType::Homunculus, UserColorId::HOMUNCULUS, Relation::IGNORED, UserColorId::IGNORED, localPlayer, mDispName, mEnemy, mErased, mIsGM, mName, mNameColor, ActorType::Monster, UserColorId::MONSTER, mParty, mTextColor, mType, ActorType::Npc, UserColorId::NPC, UserColorId::PARTY, UserColorId::PC, ActorType::Pet, UserColorId::PET, playerRelations, UserColorId::SELF, Text::setColor(), setDefaultNameColor(), ActorType::SkillUnit, UserColorId::SKILLUNIT, theme, and userPalette.

Referenced by postInit(), GuildManager::process(), Ea::BeingRecv::processNameResponse(), EAthena::BeingRecv::processNameResponse2(), EAthena::BeingRecv::processNameResponseTitle(), setGroupId(), PlayerRelationsManager::signalUpdate(), updateFromCache(), updateGuild(), and ActorManager::updatePlayerColors().

◆ updateComment()

void Being::updateComment ( )

Definition at line 4725 of file being.cpp.

4726 {
4727  if (mGotComment || mName.empty())
4728  return;
4729 
4730  mGotComment = true;
4732 }
static std::string loadComment(const std::string &name, const ActorTypeT &type)
Definition: being.cpp:4734

References loadComment(), mComment, mGotComment, mName, and mType.

Referenced by PopupMenu::handleLink(), and BeingPopup::show().

◆ updateCoords()

void Being::updateCoords ( )
protectedvirtual

Updates name's location.

Reimplemented in LocalPlayer.

Definition at line 2501 of file being.cpp.

2502 {
2503  if (mDispName != nullptr)
2504  {
2505  int offsetX = mPixelX;
2506  int offsetY = mPixelY;
2507  if (mInfo != nullptr)
2508  {
2509  offsetX += mInfo->getNameOffsetX();
2510  offsetY += mInfo->getNameOffsetY();
2511  }
2512  // Monster names show above the sprite instead of below it
2513  if (mType == ActorType::Monster ||
2515  {
2516  offsetY += - settings.playerNameOffset - mDispName->getHeight();
2517  }
2518  mDispName->adviseXY(offsetX, offsetY, mMoveNames);
2519  }
2521 }

References Text::adviseXY(), Text::getHeight(), BeingInfo::getNameOffsetX(), BeingInfo::getNameOffsetY(), mDispName, mInfo, mMoveNames, ActorType::Monster, Actor::mPixelX, Actor::mPixelY, mType, mVisibleNamePos, Settings::playerNameOffset, settings, VisibleNamePos::Top, and updateBadgesPosition().

Referenced by showName(), and LocalPlayer::updateCoords().

◆ updateFromCache()

bool Being::updateFromCache ( )

Definition at line 3464 of file being.cpp.

3465 {
3466  const BeingCacheEntry *restrict const entry =
3468 
3469  if ((entry != nullptr) && entry->getTime() + 120 >= cur_time)
3470  {
3471  if (!entry->getName().empty())
3472  setName(entry->getName());
3473  setPartyName(entry->getPartyName());
3474  setGuildName(entry->getGuildName());
3475  setLevel(entry->getLevel());
3476  setPvpRank(entry->getPvpRank());
3477  setIp(entry->getIp());
3478  setTeamId(entry->getTeamId());
3479 
3480  mAdvanced = entry->isAdvanced();
3481  if (mAdvanced)
3482  {
3483  const int flags = entry->getFlags();
3484  if ((serverFeatures != nullptr) &&
3486  {
3487  mShop = ((flags & BeingFlag::SHOP) != 0);
3488  }
3489  mAway = ((flags & BeingFlag::AWAY) != 0);
3490  mInactive = ((flags & BeingFlag::INACTIVE) != 0);
3491  if (mShop || mAway || mInactive)
3492  updateName();
3493  }
3494  else
3495  {
3497  mShop = false;
3498  mAway = false;
3499  mInactive = false;
3500  }
3501 
3505  updateAwayEffect();
3506  if (mType == ActorType::Player || (mTeamId != 0U))
3507  updateColors();
3508  return true;
3509  }
3510  return false;
3511 }
void setGuildName(const std::string &name)
Definition: being.cpp:1196
void setLevel(const int n)
Definition: being.h:601
void setPvpRank(const unsigned int rank)
Definition: being.h:752
void setTeamId(const uint16_t teamId)
Definition: being.cpp:5187
void setPartyName(const std::string &name)
Definition: being.cpp:5246
void setIp(const std::string &ip)
Definition: being.h:746

References BeingFlag::AWAY, cur_time, getCacheEntry(), ActorSprite::getId(), Net::getNetworkType(), BeingFlag::INACTIVE, mAdvanced, mAway, mInactive, mShop, mTeamId, mType, ActorType::Player, restrict, serverFeatures, setGuildName(), setIp(), setLevel(), setName(), setPartyName(), setPvpRank(), setTeamId(), BeingFlag::SHOP, showAwayBadge(), showInactiveBadge(), showShopBadge(), ServerType::TMWATHENA, updateAwayEffect(), updateColors(), and updateName().

Referenced by ActorManager::createBeing().

◆ updateGuild()

void Being::updateGuild ( )

Definition at line 1333 of file being.cpp.

1334 {
1335  if (localPlayer == nullptr)
1336  return;
1337 
1338  Guild *restrict const guild = localPlayer->getGuild();
1339  if (guild == nullptr)
1340  {
1341  clearGuilds();
1342  updateColors();
1343  return;
1344  }
1345  if (guild->getMember(mName) != nullptr)
1346  {
1347  setGuild(guild);
1348  if (!guild->getName().empty())
1349  setGuildName(guild->getName());
1350  }
1351  updateColors();
1352 }
void setGuild(Guild *const guild)
Definition: being.cpp:1354

References clearGuilds(), getGuild(), guild, localPlayer, mName, restrict, setGuild(), setGuildName(), and updateColors().

Referenced by Ea::BeingRecv::processNameResponse(), EAthena::BeingRecv::processNameResponse2(), EAthena::BeingRecv::processNameResponseTitle(), and ActorManager::updatePlayerGuild().

◆ updateHit()

void Being::updateHit ( const int  amount)

Definition at line 4686 of file being.cpp.

4687 {
4688  if (amount > 0)
4689  {
4690  if ((mMinHit == 0) || amount < mMinHit)
4691  mMinHit = amount;
4692  if (amount != mCriticalHit && ((mMaxHit == 0) || amount > mMaxHit))
4693  mMaxHit = amount;
4694  }
4695 }

◆ updateName()

void Being::updateName ( )

◆ updatePercentHP()

void Being::updatePercentHP ( )

Definition at line 4876 of file being.cpp.

4877 {
4878  if (mMaxHP == 0)
4879  return;
4880  BLOCK_START("Being::updatePercentHP")
4881  if (mHP != 0)
4882  {
4883  const unsigned num = mHP * 100 / mMaxHP;
4884  if (num != mNumber)
4885  {
4886  mNumber = num;
4887  if (updateNumber(mNumber))
4888  setAction(mAction, 0);
4889  }
4890  }
4891  BLOCK_END("Being::updatePercentHP")
4892 }
bool updateNumber(const unsigned num)

References BLOCK_END, BLOCK_START, mAction, mHP, mMaxHP, mNumber, setAction(), and CompoundSprite::updateNumber().

Referenced by postInit().

◆ updateSprite()

void Being::updateSprite ( const unsigned int  slot,
const int  id,
const std::string &  color 
)

Definition at line 2771 of file being.cpp.

2774 {
2775  if (charServerHandler == nullptr || slot >= charServerHandler->maxSprite())
2776  return;
2777 
2778  if (slot >= CAST_U32(mSlots.size()))
2779  mSlots.resize(slot + 1, BeingSlot());
2780 
2781  if ((slot != 0U) && mSlots[slot].spriteId == id)
2782  return;
2783  setSpriteColor(slot,
2784  id,
2785  color);
2786 }

References CAST_U32, charServerHandler, and Net::CharServerHandler::maxSprite().

Referenced by TmwAthena::BeingRecv::processBeingMove(), TmwAthena::BeingRecv::processBeingVisible(), TmwAthena::BeingRecv::processPlayerMove(), TmwAthena::BeingRecv::processPlayerUpdate1(), and TmwAthena::BeingRecv::processPlayerUpdate2().

Friends And Related Function Documentation

◆ ActorManager

friend class ActorManager
friend

Definition at line 98 of file being.h.

◆ BeingEquipBackend

friend class BeingEquipBackend
friend

Definition at line 99 of file being.h.

Referenced by getEquipment().

◆ LocalPlayer

friend class LocalPlayer
friend

Definition at line 100 of file being.h.

Field Documentation

◆ mAction

BeingActionT Being::mAction
protected

◆ mActionTime

int Being::mActionTime
protected

Time spent in current action

Definition at line 1213 of file being.h.

Referenced by LocalPlayer::attack(), getActionTime(), getOffset(), logic(), nextTile(), and setActionTime().

◆ mAdvanced

bool Being::mAdvanced
protected

Definition at line 1380 of file being.h.

Referenced by isAdvanced(), LocalPlayer::LocalPlayer(), setAdvanced(), and updateFromCache().

◆ mAllowNpcEquipment

bool Being::mAllowNpcEquipment
protected

Definition at line 1386 of file being.h.

Referenced by getAllowNpcEquipment().

◆ mAnimationEffect

AnimatedSprite* Being::mAnimationEffect
protected

Definition at line 1175 of file being.h.

Referenced by logic(), removeSpecialEffect(), and ~Being().

◆ mAreaSize

int Being::mAreaSize
protected

Definition at line 1367 of file being.h.

Referenced by getAreaSize(), and setAreaSize().

◆ mAttackDelay

int Being::mAttackDelay
protected

Definition at line 1357 of file being.h.

Referenced by getAttackDelay(), and setAttackDelay().

◆ mAttackRange

int Being::mAttackRange
protected

◆ mAttackSpeed

int Being::mAttackSpeed
protected

Attack speed

Definition at line 1218 of file being.h.

Referenced by getAttackSpeed(), logic(), and setAttackSpeed().

◆ mAttackTime

time_t Being::mAttackTime
protected

Definition at line 1353 of file being.h.

Referenced by getAttackTime(), resetCounters(), and setAttackTime().

◆ mAway

bool Being::mAway
protected

Definition at line 1382 of file being.h.

Referenced by addToCache(), getGenderSign(), updateAwayEffect(), and updateFromCache().

◆ mAwayEffect

int Being::mAwayEffect = -1
staticprotected

Definition at line 1349 of file being.h.

Referenced by addAfkEffect(), and reReadConfig().

◆ mBadges

AnimatedSprite* Being::mBadges[BadgeIndex::BadgeIndexSize]
protected

Definition at line 1177 of file being.h.

Referenced by Being(), logic(), updateBadgesCount(), and ~Being().

◆ mBadgesCount

uint16_t Being::mBadgesCount
protected

Definition at line 1375 of file being.h.

Referenced by updateBadgesCount(), updateBadgesPosition(), and ~Being().

◆ mBadgesX

int Being::mBadgesX
protected

Definition at line 1370 of file being.h.

Referenced by updateBadgesPosition().

◆ mBadgesY

int Being::mBadgesY
protected

Definition at line 1371 of file being.h.

Referenced by updateBadgesPosition().

◆ mBotAi

bool Being::mBotAi
protected

Definition at line 1385 of file being.h.

Referenced by botLogic(), disableBotAi(), and enableBotAi().

◆ mBuyBoard

std::string Being::mBuyBoard
protected

Definition at line 1304 of file being.h.

Referenced by getBuyBoard(), and isBuyShopEnabled().

◆ mCachedX

int Being::mCachedX
protected

Definition at line 1316 of file being.h.

Referenced by getCachedX(), and setCachedDestination().

◆ mCachedY

int Being::mCachedY
protected

Definition at line 1317 of file being.h.

Referenced by getCachedY(), and setCachedDestination().

◆ mCastEndTime

int Being::mCastEndTime
protected

Definition at line 1368 of file being.h.

Referenced by addCast(), and logic().

◆ mCastingEffect

CastingEffect* Being::mCastingEffect
protected

Definition at line 1176 of file being.h.

Referenced by addCast(), logic(), and ~Being().

◆ mChat

ChatObject* Being::mChat
protected

Definition at line 1308 of file being.h.

Referenced by getChat(), and ~Being().

◆ mClanName

std::string Being::mClanName
protected

Definition at line 1185 of file being.h.

Referenced by getClanName().

◆ mComment

std::string Being::mComment
protected

Definition at line 1303 of file being.h.

Referenced by getComment(), setComment(), and updateComment().

◆ mConfLineLim

unsigned int Being::mConfLineLim = 0
staticprotected

Definition at line 1332 of file being.h.

Referenced by reReadConfig().

◆ mCreatorId

BeingId Being::mCreatorId
protected

Definition at line 1372 of file being.h.

Referenced by getCreatorId(), and setCreatorId().

◆ mCriticalHit

int Being::mCriticalHit
protected

Definition at line 1360 of file being.h.

Referenced by getCriticalHit(), and setCriticalHit().

◆ mDamageTaken

int Being::mDamageTaken
protected

Definition at line 1324 of file being.h.

Referenced by getDamageTaken(), and setDamageTaken().

◆ mDest

Vector Being::mDest
protected

destination coordinates.

Definition at line 1201 of file being.h.

Referenced by calcDirection(), getDestination(), and LocalPlayer::setDestination().

◆ mDirection

uint8_t Being::mDirection
protected

◆ mDirectionDelayed

uint8_t Being::mDirectionDelayed
protected

Facing direction

Definition at line 1232 of file being.h.

Referenced by getDirectionDelayed(), and setDirectionDelayed().

◆ mDispName

FlashText* Being::mDispName
protected

Holds a text object when the being displays it's name, 0 otherwise

Definition at line 1191 of file being.h.

Referenced by showName(), updateBadgesPosition(), updateColors(), updateCoords(), and ~Being().

◆ mDistance

int Being::mDistance
protected

Definition at line 1327 of file being.h.

Referenced by getDistance(), and setDistance().

◆ mDownHorseSprites

std::vector<AnimatedSprite*> Being::mDownHorseSprites
protected

Definition at line 1310 of file being.h.

Referenced by logic(), and removeHorse().

◆ mDrawHotKeys

bool Being::mDrawHotKeys = true
staticprotected

Definition at line 1337 of file being.h.

Referenced by reReadConfig().

◆ mEmotionSprite

AnimatedSprite* Being::mEmotionSprite
protected

Definition at line 1174 of file being.h.

Referenced by logic(), and ~Being().

◆ mEmotionTime

int Being::mEmotionTime
protected

Time until emotion disappears

Definition at line 1214 of file being.h.

Referenced by logic().

◆ mEnableReorderSprites

bool Being::mEnableReorderSprites = true
staticprotected

Definition at line 1344 of file being.h.

Referenced by recalcSpritesOrder(), and reReadConfig().

◆ mEnemy

bool Being::mEnemy
protected

Definition at line 1378 of file being.h.

Referenced by setEnemy(), and updateColors().

◆ mEquippedWeapon

const ItemInfo* Being::mEquippedWeapon
protected

Engine-related infos about weapon.

Definition at line 1195 of file being.h.

Referenced by getEquippedWeapon().

◆ mErased

bool Being::mErased
protected

Definition at line 1377 of file being.h.

Referenced by updateColors().

◆ mExtName

std::string Being::mExtName
protected

Full name of being

Definition at line 1181 of file being.h.

Referenced by getExtName().

◆ mFixedOffsetY

int Being::mFixedOffsetY
protected

Definition at line 1321 of file being.h.

Referenced by nextTile().

◆ mGender

GenderT Being::mGender
protected

Definition at line 1228 of file being.h.

Referenced by getGender().

◆ mGoodStatus

int Being::mGoodStatus
protected

Definition at line 1329 of file being.h.

Referenced by getGoodStatus(), and setGoodStatus().

◆ mGotComment

bool Being::mGotComment
protected

Definition at line 1379 of file being.h.

Referenced by postInit(), and updateComment().

◆ mGroupId

int Being::mGroupId
protected

Definition at line 1221 of file being.h.

Referenced by getGroupId(), and setGroupId().

◆ mGuildName

std::string Being::mGuildName
protected

Definition at line 1184 of file being.h.

Referenced by getGuildName().

◆ mGuilds

std::map<int, Guild*> Being::mGuilds
protected

Definition at line 1210 of file being.h.

Referenced by clearGuilds(), and getGuild().

◆ mHairColor

ItemColor Being::mHairColor
protected

Definition at line 1376 of file being.h.

Referenced by getHairColor(), and setHairColor().

◆ mHideErased

bool Being::mHideErased = false
staticprotected

Definition at line 1345 of file being.h.

Referenced by reReadConfig(), and showName().

◆ mHighlightMapPortals

bool Being::mHighlightMapPortals = false
staticprotected

Definition at line 1334 of file being.h.

Referenced by reReadConfig().

◆ mHighlightMonsterAttackRange

bool Being::mHighlightMonsterAttackRange = false
staticprotected

Definition at line 1335 of file being.h.

Referenced by reReadConfig().

◆ mHorseInfo

HorseInfo* Being::mHorseInfo
protected

Definition at line 1309 of file being.h.

◆ mHP

int Being::mHP
protected

Definition at line 1325 of file being.h.

Referenced by getHP(), and updatePercentHP().

◆ mInactive

bool Being::mInactive
protected

◆ mInfo

BeingInfo* Being::mInfo
protected

◆ mIp

std::string Being::mIp
protected

Definition at line 1299 of file being.h.

Referenced by getIp(), and setIp().

◆ mIsGM

bool Being::mIsGM
protected

Definition at line 1235 of file being.h.

Referenced by isGM(), setGroupId(), LocalPlayer::setGroupId(), and updateColors().

◆ mKarma

int Being::mKarma
protected

Definition at line 1365 of file being.h.

Referenced by getKarma(), and setKarma().

◆ mLanguageId

int Being::mLanguageId
protected

Definition at line 1369 of file being.h.

Referenced by getLanguageId().

◆ mLastAttackX

int Being::mLastAttackX
protected

Definition at line 1223 of file being.h.

Referenced by getLastAttackX(), and LocalPlayer::getLastAttackX().

◆ mLastAttackY

int Being::mLastAttackY
protected

Definition at line 1224 of file being.h.

Referenced by getLastAttackY(), and LocalPlayer::getLastAttackY().

◆ mLevel

int Being::mLevel
protected

◆ mLook

uint16_t Being::mLook
protected

Definition at line 1374 of file being.h.

Referenced by getLook().

◆ mLowTraffic

bool Being::mLowTraffic = true
staticprotected

Definition at line 1336 of file being.h.

Referenced by addToCache(), and reReadConfig().

◆ mManner

int Being::mManner
protected

Definition at line 1366 of file being.h.

Referenced by getManner(), and setManner().

◆ mMaxHit

int Being::mMaxHit
protected

Definition at line 1359 of file being.h.

Referenced by getMaxHit(), and setMaxHit().

◆ mMaxHP

int Being::mMaxHP
protected

Definition at line 1326 of file being.h.

Referenced by getMaxHP(), and updatePercentHP().

◆ mMinHit

int Being::mMinHit
protected

Definition at line 1358 of file being.h.

Referenced by getMinHit(), and setMinHit().

◆ mMoveNames

Move Being::mMoveNames = Move_false
staticprotected

Definition at line 1346 of file being.h.

Referenced by reReadConfig(), and updateCoords().

◆ mMoveTime

time_t Being::mMoveTime
protected

Definition at line 1352 of file being.h.

Referenced by botLogic(), getMoveTime(), resetCounters(), and setMoveTime().

◆ mName

std::string Being::mName
protected

◆ mNameColor

const Color* Being::mNameColor
protected

Definition at line 1192 of file being.h.

Referenced by LocalPlayer::LocalPlayer(), showName(), and updateColors().

◆ mNeedPosUpdate

bool Being::mNeedPosUpdate
protected

Definition at line 1384 of file being.h.

Referenced by logic(), and nextTile().

◆ mNextSound

NextSoundInfo Being::mNextSound

Definition at line 954 of file being.h.

Referenced by logic().

◆ mNumber

unsigned int Being::mNumber
protected

Definition at line 1362 of file being.h.

Referenced by updatePercentHP().

◆ mOldHeight

uint8_t Being::mOldHeight
protected

Definition at line 1322 of file being.h.

Referenced by logic(), and nextTile().

◆ mOtherTime

time_t Being::mOtherTime
protected

Definition at line 1355 of file being.h.

Referenced by getOtherTime(), resetCounters(), and setOtherTime().

◆ mOwner

Being* Being::mOwner
protected

Definition at line 1306 of file being.h.

Referenced by botFixOffset(), botLogic(), getOwner(), logic(), moveBotTo(), setOwner(), and updateBotDirection().

◆ mParty

Party* Being::mParty
protected

Definition at line 1211 of file being.h.

Referenced by getParty(), isInParty(), and updateColors().

◆ mPartyName

std::string Being::mPartyName
protected

Definition at line 1183 of file being.h.

Referenced by getPartyName().

◆ mPath

Path Being::mPath
protected

◆ mPixelOffsetY

int Being::mPixelOffsetY
protected

Definition at line 1319 of file being.h.

Referenced by logic(), and nextTile().

◆ mPreStandTime

int Being::mPreStandTime
protected

Definition at line 1226 of file being.h.

Referenced by logic(), and nextTile().

◆ mPvpRank

unsigned int Being::mPvpRank
protected

Definition at line 1361 of file being.h.

Referenced by getPvpRank(), and setPvpRank().

◆ mRaceName

std::string Being::mRaceName
protected

Definition at line 1182 of file being.h.

Referenced by getRaceName(), and setRaceName().

◆ mReachable

ReachableT Being::mReachable
protected

Definition at line 1328 of file being.h.

Referenced by getReachable(), nextTile(), and setReachable().

◆ mSellBoard

std::string Being::mSellBoard
protected

Definition at line 1305 of file being.h.

Referenced by getSellBoard(), and isSellShopEnabled().

◆ mShop

bool Being::mShop
protected

◆ mShowBadges

BadgeDrawType::Type Being::mShowBadges = BadgeDrawType::Top
staticprotected

◆ mShowBattleEvents

bool Being::mShowBattleEvents = false
staticprotected

Definition at line 1338 of file being.h.

Referenced by reReadConfig().

◆ mShowGender

bool Being::mShowGender = false
staticprotected

Definition at line 1341 of file being.h.

Referenced by getGenderSign(), reReadConfig(), and showName().

◆ mShowLevel

bool Being::mShowLevel = false
staticprotected

Definition at line 1342 of file being.h.

Referenced by reReadConfig(), and showName().

◆ mShowMobHP

bool Being::mShowMobHP = false
staticprotected

Definition at line 1339 of file being.h.

Referenced by reReadConfig().

◆ mShowName

bool Being::mShowName
protected

Definition at line 1234 of file being.h.

Referenced by getShowName(), and updateName().

◆ mShowOwnHP

bool Being::mShowOwnHP = false
staticprotected

Definition at line 1340 of file being.h.

Referenced by reReadConfig().

◆ mShowPlayersStatus

bool Being::mShowPlayersStatus = false
staticprotected

Definition at line 1343 of file being.h.

Referenced by getGenderSign(), and reReadConfig().

◆ mSlots

std::vector<BeingSlot> Being::mSlots
protected

◆ mSortOffsetY

int Being::mSortOffsetY
protected

Definition at line 1318 of file being.h.

Referenced by getSortPixelY(), and logic().

◆ mSpecialParticle

Particle* Being::mSpecialParticle
protected

Definition at line 1307 of file being.h.

Referenced by removeSpecialEffect().

◆ mSpeech

std::string Being::mSpeech
protected

Definition at line 1186 of file being.h.

◆ mSpeechBubble

SpeechBubble* Being::mSpeechBubble
protected

Speech Bubble components

Definition at line 1290 of file being.h.

Referenced by createSpeechBubble(), and ~Being().

◆ mSpeechTime

int Being::mSpeechTime
protected

Time until the last speech sentence disappears

Definition at line 1217 of file being.h.

Referenced by logic().

◆ mSpeechType

int Being::mSpeechType = 0
staticprotected

Definition at line 1333 of file being.h.

Referenced by reReadConfig().

◆ mSpeed

int Being::mSpeed
protected

Definition at line 1298 of file being.h.

Referenced by getOffset(), logic(), nextTile(), and setWalkSpeed().

◆ mSpiritBalls

unsigned int Being::mSpiritBalls
protected

Definition at line 1363 of file being.h.

Referenced by getSpiritBalls().

◆ mSpiritParticles

std::vector<Particle*> Being::mSpiritParticles
protected

Definition at line 1312 of file being.h.

Referenced by ~Being().

◆ mSpriteAction

std::string Being::mSpriteAction
protected

Definition at line 1179 of file being.h.

◆ mSpriteDirection

SpriteDirection::Type Being::mSpriteDirection
protected

Facing direction

Definition at line 1233 of file being.h.

Referenced by getSpriteDirection(), and recalcSpritesOrder().

◆ mSpriteDraw

int* Being::mSpriteDraw
protected

Definition at line 1302 of file being.h.

Referenced by Being(), recalcSpritesOrder(), and ~Being().

◆ mSpriteHide

int* Being::mSpriteHide
protected

Definition at line 1301 of file being.h.

Referenced by Being(), recalcSpritesOrder(), and ~Being().

◆ mSpriteParticles

SpriteParticleInfo Being::mSpriteParticles
protected

Definition at line 1207 of file being.h.

Referenced by recreateItemParticles(), and removeAllItemsParticles().

◆ mSpriteRemap

int* Being::mSpriteRemap
protected

Definition at line 1300 of file being.h.

Referenced by Being(), recalcSpritesOrder(), and ~Being().

◆ mSubType

BeingTypeId Being::mSubType
protected

Subtype (graphical view, basically)

Definition at line 1230 of file being.h.

Referenced by getSubType().

◆ mTalkTime

time_t Being::mTalkTime
protected

Definition at line 1354 of file being.h.

Referenced by getTalkTime(), resetCounters(), and setTalkTime().

◆ mTeamId

uint16_t Being::mTeamId
protected

Definition at line 1373 of file being.h.

Referenced by getTeamId(), and updateFromCache().

◆ mTestTime

time_t Being::mTestTime
protected

Definition at line 1356 of file being.h.

Referenced by getTestTime(), resetCounters(), and setTestTime().

◆ mText

Text* Being::mText
protected

Definition at line 1198 of file being.h.

Referenced by logic(), and ~Being().

◆ mTextColor

const Color* Being::mTextColor
protected

Definition at line 1199 of file being.h.

Referenced by LocalPlayer::LocalPlayer(), and updateColors().

◆ mType

const ActorTypeT Being::mType
protected

◆ mUpdateConfigTime

time_t Being::mUpdateConfigTime = 0
staticprotected

Definition at line 1331 of file being.h.

Referenced by reReadConfig().

◆ mUpHorseSprites

std::vector<AnimatedSprite*> Being::mUpHorseSprites
protected

Definition at line 1311 of file being.h.

Referenced by logic(), and removeHorse().

◆ mUsageCounter

int Being::mUsageCounter
protected

Definition at line 1364 of file being.h.

Referenced by decUsage(), and incUsage().

◆ mUseDiagonal

bool Being::mUseDiagonal = true
staticprotected

Definition at line 1347 of file being.h.

Referenced by nextTile(), and reReadConfig().

◆ mVisibleNamePos

VisibleNamePos::Type Being::mVisibleNamePos = VisibleNamePos::Bottom
staticprotected

◆ mWalkSpeed

int Being::mWalkSpeed
protected

Walk speed for x and y movement values. In pixels per second.

See also
MILLISECONDS_IN_A_TICK

Definition at line 1297 of file being.h.

Referenced by getWalkSpeed(), nextTile(), and setWalkSpeed().

◆ mX

int Being::mX
protected

◆ mY

int Being::mY
protected

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