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 93 of file being.h.

Member Typedef Documentation

◆ SpriteParticleInfo

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

Definition at line 1206 of file being.h.

◆ SpriteParticleInfoIter

typedef SpriteParticleInfo::iterator Being::SpriteParticleInfoIter
protected

Definition at line 1207 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 161 of file being.cpp.

162  :
163  ActorSprite(id),
164  mNextSound(),
166  mEmotionSprite(nullptr),
167  mAnimationEffect(nullptr),
168  mCastingEffect(nullptr),
169  mBadges(),
171  mName(),
172  mExtName(),
173  mRaceName(),
174  mPartyName(),
175  mGuildName(),
176  mClanName(),
177  mSpeech(),
178  mDispName(nullptr),
179  mNameColor(nullptr),
180  mEquippedWeapon(nullptr),
181  mPath(),
182  mText(nullptr),
183  mTextColor(nullptr),
184  mDest(),
185  mSlots(),
187  mGuilds(),
188  mParty(nullptr),
189  mActionTime(0),
190  mEmotionTime(0),
191  mSpeechTime(0),
192  mAttackSpeed(350),
193  mLevel(0),
194  mGroupId(0),
195  mAttackRange(1),
196  mLastAttackX(0),
197  mLastAttackY(0),
198  mPreStandTime(0),
201  mSubType(fromInt(0xFFFF, BeingTypeId)),
205  mShowName(false),
206  mIsGM(false),
207  mType(type),
208  mSpeechBubble(nullptr),
209  mWalkSpeed(playerHandler != nullptr ?
211  mSpeed(playerHandler != nullptr ?
213  mIp(),
214  mSpriteRemap(new int[20]),
215  mSpriteHide(new int[20]),
216  mSpriteDraw(new int[20]),
217  mComment(),
218  mBuyBoard(),
219  mSellBoard(),
220  mOwner(nullptr),
221  mSpecialParticle(nullptr),
222  mChat(nullptr),
223  mHorseInfo(nullptr),
225  mUpHorseSprites(),
227  mX(0),
228  mY(0),
229  mCachedX(0),
230  mCachedY(0),
231  mSortOffsetY(0),
232  mPixelOffsetY(0),
233  mFixedOffsetY(0),
234  mOldHeight(0),
235  mDamageTaken(0),
236  mHP(0),
237  mMaxHP(0),
238  mDistance(0),
240  mGoodStatus(-1),
241  mMoveTime(0),
242  mAttackTime(0),
243  mTalkTime(0),
244  mOtherTime(0),
246  mAttackDelay(0),
247  mMinHit(0),
248  mMaxHit(0),
249  mCriticalHit(0),
250  mPvpRank(0),
251  mNumber(100),
252  mSpiritBalls(0U),
253  mUsageCounter(1),
254  mKarma(0),
255  mManner(0),
256  mAreaSize(11),
257  mCastEndTime(0),
258  mLanguageId(-1),
259  mBadgesX(0),
260  mBadgesY(0),
262  mTeamId(0U),
263  mLook(0U),
264  mBadgesCount(0U),
266  mErased(false),
267  mEnemy(false),
268  mGotComment(false),
269  mAdvanced(false),
270  mShop(false),
271  mAway(false),
272  mInactive(false),
273  mNeedPosUpdate(true),
274  mBotAi(true),
275  mAllowNpcEquipment(false)
276 {
277  for (int f = 0; f < 20; f ++)
278  {
279  mSpriteRemap[f] = f;
280  mSpriteHide[f] = 0;
281  mSpriteDraw[f] = 0;
282  }
283 
285  mBadges[f] = nullptr;
286 }

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

Referenced by createBeing().

◆ ~Being()

Being::~Being ( )

Definition at line 336 of file being.cpp.

337 {
338  config.removeListener("visiblenames", this);
340 
341  delete [] mSpriteRemap;
342  mSpriteRemap = nullptr;
343  delete [] mSpriteHide;
344  mSpriteHide = nullptr;
345  delete [] mSpriteDraw;
346  mSpriteDraw = nullptr;
347 
349  delete2(mBadges[f])
350 
353  delete2(mText)
357  mBadgesCount = 0;
358  delete2(mChat)
359  removeHorse();
360 
363 }

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 4915 of file being.cpp.

4916 {
4918 }

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 5366 of file being.cpp.

5372 {
5373  if (waitTimeTicks <= 0)
5374  {
5375  mCastEndTime = 0;
5376  return;
5377  }
5378  mCastEndTime = tick_time + waitTimeTicks;
5380  skillId,
5381  skillLevel);
5383  if (data != nullptr)
5384  {
5385  const std::string castingAnimation = data->castingAnimation;
5386  mCastingEffect = new CastingEffect(skillId,
5387  skillLevel,
5388  castingAnimation,
5389  dstX,
5390  dstY,
5391  range);
5393  }
5394  else
5395  {
5396  reportAlways("Want to draw casting for unknown skill %d",
5397  skillId)
5398  }
5399 }

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 4956 of file being.cpp.

4957 {
4958  delete mAnimationEffect;
4960  paths.getStringValue("sprites") + name,
4961  0);
4962 }

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 1236 of file being.cpp.

1237 {
1238  if (guild == nullptr)
1239  return;
1240 
1241  mGuilds[guild->getId()] = guild;
1242 
1243  if (this == localPlayer && (socialWindow != nullptr))
1245 }

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 5041 of file being.cpp.

5043 {
5044  const SpriteParticleInfoIter it = mSpriteParticles.find(id);
5045  ParticleInfo *restrict pi = nullptr;
5046  if (it == mSpriteParticles.end())
5047  {
5048  pi = new ParticleInfo;
5049  mSpriteParticles[id] = pi;
5050  }
5051  else
5052  {
5053  pi = (*it).second;
5054  }
5055 
5056  if ((pi == nullptr) || !pi->particles.empty())
5057  return;
5058 
5059  // setup particle effects
5061  (particleEngine != nullptr))
5062  {
5063  FOR_EACH (StringVectCIter, itr, display.particles)
5064  {
5065  Particle *const p = particleEngine->addEffect(*itr, 0, 0, 0);
5067  pi->files.push_back(*itr);
5068  pi->particles.push_back(p);
5069  }
5070  }
5071  else
5072  {
5073  FOR_EACH (StringVectCIter, itr, display.particles)
5074  pi->files.push_back(*itr);
5075  }
5076 }

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 5078 of file being.cpp.

5081 {
5082  const SpriteParticleInfoIter it = mSpriteParticles.find(id);
5083  ParticleInfo *restrict pi = nullptr;
5084  if (it == mSpriteParticles.end())
5085  {
5086  pi = new ParticleInfo;
5087  mSpriteParticles[id] = pi;
5088  }
5089  else
5090  {
5091  pi = (*it).second;
5092  }
5093 
5094  if ((pi == nullptr) || !pi->particles.empty())
5095  return;
5096 
5097  // setup particle effects
5099  (particleEngine != nullptr))
5100  {
5101  FOR_EACH (StringVectCIter, itr, display.particles)
5102  {
5103  Particle *const p = particleEngine->addEffect(*itr, 0, 0, 0);
5105  pi->files.push_back(*itr);
5106  pi->particles.push_back(p);
5107  }
5108  for (int f = 0; f < maxCards; f ++)
5109  {
5110  const int cardId = cards.cards[f];
5111  if (!Item::isItem(cardId))
5112  continue;
5113  const ItemInfo &info = ItemDB::get(cardId);
5114  const SpriteDisplay &restrict display2 = info.getDisplay();
5115  FOR_EACH (StringVectCIter, itr, display2.particles)
5116  {
5117  Particle *const p = particleEngine->addEffect(*itr, 0, 0, 0);
5119  pi->files.push_back(*itr);
5120  pi->particles.push_back(p);
5121  }
5122  }
5123  }
5124  else
5125  {
5126  FOR_EACH (StringVectCIter, itr, display.particles)
5127  {
5128  pi->files.push_back(*itr);
5129  }
5130  for (int f = 0; f < maxCards; f ++)
5131  {
5132  const int cardId = cards.cards[f];
5133  if (!Item::isItem(cardId))
5134  continue;
5135  const ItemInfo &info = ItemDB::get(cardId);
5136  const SpriteDisplay &restrict display2 = info.getDisplay();
5137  FOR_EACH (StringVectCIter, itr, display2.particles)
5138  {
5139  pi->files.push_back(*itr);
5140  }
5141  }
5142  }
5143 }

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 4925 of file being.cpp.

4926 {
4927  if ((effectManager != nullptr) &&
4929  (mSpecialParticle == nullptr) &&
4930  effect != -1)
4931  {
4933  this,
4934  0);
4935  }
4936 }

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 5492 of file being.cpp.

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

References effectManager, and EffectManager::triggerReturn().

◆ addToCache()

void Being::addToCache ( ) const

Definition at line 3510 of file being.cpp.

3511 {
3512  if (localPlayer == this)
3513  return;
3514 
3516  if (entry == nullptr)
3517  {
3518  entry = new BeingCacheEntry(getId());
3519  beingInfoCache.push_front(entry);
3520 
3521  if (beingInfoCache.size() >= CACHE_SIZE)
3522  {
3523  delete beingInfoCache.back();
3524  beingInfoCache.pop_back();
3525  }
3526  }
3527  if (!mLowTraffic)
3528  return;
3529 
3530  entry->setName(mName);
3531  entry->setLevel(getLevel());
3532  entry->setPartyName(getPartyName());
3533  entry->setGuildName(getGuildName());
3534  entry->setTime(cur_time);
3535  entry->setPvpRank(getPvpRank());
3536  entry->setIp(getIp());
3537  entry->setAdvanced(isAdvanced());
3538  entry->setTeamId(getTeamId());
3539  if (isAdvanced())
3540  {
3541  int flags = 0;
3543  flags += BeingFlag::SHOP;
3544  if (mAway)
3545  flags += BeingFlag::AWAY;
3546  if (mInactive)
3547  flags += BeingFlag::INACTIVE;
3548  entry->setFlags(flags);
3549  }
3550  else
3551  {
3552  entry->setFlags(0);
3553  }
3554 }

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(), TmwAthena::BeingRecv::processPlayerGuilPartyInfo(), EAthena::BeingRecv::processPlayerGuilPartyInfo(), EAthena::BeingRecv::processPlayerGuilPartyInfo2(), TmwAthena::BeingRecv::processPvpSet(), and setAdvanced().

◆ botFixOffset()

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

Definition at line 2079 of file being.cpp.

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

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 1998 of file being.cpp.

1999 {
2000  if ((mOwner == nullptr) || (mMap == nullptr) || (mInfo == nullptr))
2001  return;
2002 
2003  const int time = tick_time;
2004  const int thinkTime = mInfo->getThinkTime();
2005  if (abs(CAST_S32(mMoveTime) - time) < thinkTime)
2006  return;
2007 
2008  mMoveTime = time;
2009 
2010  int dstX = mOwner->mX;
2011  int dstY = mOwner->mY;
2012  const int warpDist = mInfo->getWarpDist();
2013  const int divX = abs(dstX - mX);
2014  const int divY = abs(dstY - mY);
2015 
2016  if (divX >= warpDist || divY >= warpDist)
2017  {
2020  else
2022  mBotAi = true;
2023  return;
2024  }
2025  if (!mBotAi)
2026  return;
2027  if (mAction == BeingAction::MOVE)
2028  {
2030  {
2031  updateBotFollow(dstX, dstY,
2032  divX, divY);
2033  }
2034  return;
2035  }
2036 
2037  switch (mOwner->mAction)
2038  {
2039  case BeingAction::MOVE:
2040  case BeingAction::PRESTAND:
2041  updateBotFollow(dstX, dstY,
2042  divX, divY);
2043  break;
2044  case BeingAction::STAND:
2045  case BeingAction::SPAWN:
2046  botFixOffset(dstX, dstY);
2047  moveBotTo(dstX, dstY);
2048  break;
2049  case BeingAction::ATTACK:
2050  {
2051  const Being *const target = localPlayer->getTarget();
2052  if (target == nullptr)
2053  return;
2054  const BeingId targetId = target->getId();
2056  {
2057  homunculusHandler->attack(targetId,
2058  Keep_true);
2059  }
2060  else
2061  {
2062  mercenaryHandler->attack(targetId,
2063  Keep_true);
2064  }
2065  break;
2066  }
2067  case BeingAction::SIT:
2068  case BeingAction::DEAD:
2069  botFixOffset(dstX, dstY);
2070  moveBotTo(dstX, dstY);
2071  break;
2072  case BeingAction::CAST:
2073  case BeingAction::HURT:
2074  default:
2075  break;
2076  }
2077 }

References BeingAction::ATTACK, Net::MercenaryHandler::attack(), Net::HomunculusHandler::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 1752 of file being.cpp.

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

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 1766 of file being.cpp.

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

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 666 of file being.h.

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

References mType, and ActorType::Npc.

◆ clearCache()

void Being::clearCache ( )
static

Definition at line 4716 of file being.cpp.

4717 {
4719  beingInfoCache.clear();
4720 }

References beingInfoCache, and delete_all().

Referenced by Game::~Game().

◆ clearGuilds()

void Being::clearGuilds ( )

Removes all guilds the being is in.

Definition at line 1288 of file being.cpp.

1289 {
1291  {
1292  Guild *const guild = itr->second;
1293 
1294  if (guild != nullptr)
1295  {
1296  if (this == localPlayer && (socialWindow != nullptr))
1298 
1299  guild->removeMember(mId);
1300  }
1301  }
1302 
1303  mGuilds.clear();
1304 }

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 553 of file being.cpp.

554 {
555  mPath.clear();
556 }

References mPath.

Referenced by TmwAthena::BeingRecv::processBeingVisible(), EAthena::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 5572 of file being.cpp.

5576 {
5577  Being *const being = new Being(id,
5578  type);
5579  being->postInit(subType,
5580  map);
5581  return being;
5582 }

References Being(), and postInit().

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

◆ createSpeechBubble()

void Being::createSpeechBubble ( )
protected

Definition at line 365 of file being.cpp.

366 {
368 }

References CREATEWIDGETV0, and mSpeechBubble.

◆ decUsage()

int Being::decUsage ( )
inline

Definition at line 974 of file being.h.

975  { return --mUsageCounter; }

References mUsageCounter.

◆ disableBotAi()

void Being::disableBotAi ( )
inline

Definition at line 1046 of file being.h.

1047  { 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 3836 of file being.cpp.

3839 {
3840  switch (mType)
3841  {
3842  case ActorType::Player:
3843  drawPlayer(graphics,
3844  offsetX,
3845  offsetY);
3846  break;
3847  case ActorType::Portal:
3848  drawPortal(graphics,
3849  offsetX,
3850  offsetY);
3851  break;
3852  case ActorType::Homunculus:
3853  drawHomunculus(graphics,
3854  offsetX,
3855  offsetY);
3856  break;
3857  case ActorType::Mercenary:
3858  drawMercenary(graphics,
3859  offsetX,
3860  offsetY);
3861  break;
3862  case ActorType::Elemental:
3863  drawElemental(graphics,
3864  offsetX,
3865  offsetY);
3866  break;
3867  case ActorType::Monster:
3868  drawMonster(graphics,
3869  offsetX,
3870  offsetY);
3871  break;
3872  case ActorType::Npc:
3873  drawNpc(graphics,
3874  offsetX,
3875  offsetY);
3876  break;
3877  case ActorType::Pet:
3878  case ActorType::SkillUnit:
3879  case ActorType::Unknown:
3880  case ActorType::FloorItem:
3881  case ActorType::Avatar:
3882  default:
3883  drawOther(graphics,
3884  offsetX,
3885  offsetY);
3886  break;
3887  }
3888 }

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 3927 of file being.cpp.

3930 {
3931  drawCompound(graphics, x, y);
3932 }

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 3731 of file being.cpp.

3734 {
3735  if (mUsedTargetCursor != nullptr)
3736  {
3738  if (mInfo == nullptr)
3739  {
3740  mUsedTargetCursor->draw(graphics,
3741  offsetX - mCursorPaddingX,
3742  offsetY - mCursorPaddingY);
3743  }
3744  else
3745  {
3746  mUsedTargetCursor->draw(graphics,
3747  offsetX + mInfo->getTargetOffsetX() - mCursorPaddingX,
3748  offsetY + mInfo->getTargetOffsetY() - mCursorPaddingY);
3749  }
3750  }
3751 }

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 3934 of file being.cpp.

3937 {
3938  FUNC_BLOCK("CompoundSprite::draw", 1)
3939  if (mNeedsRedraw)
3940  updateImages();
3941 
3942  if (mSprites.empty()) // Nothing to draw
3943  return;
3944 
3945  if (mAlpha == 1.0F && (mImage != nullptr))
3946  {
3947  graphics->drawImage(mImage,
3948  posX + mOffsetX,
3949  posY + mOffsetY);
3950  }
3951  else if ((mAlpha != 0.0F) && (mAlphaImage != nullptr))
3952  {
3954  graphics->drawImage(mAlphaImage,
3955  posX + mOffsetX,
3956  posY + mOffsetY);
3957  }
3958  else
3959  {
3960  Being::drawPlayerSprites(graphics, posX, posY);
3961  }
3962 }

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

◆ drawElemental()

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

Definition at line 3813 of file being.cpp.

3816 {
3817  // getActorX() + offsetX;
3818  const int px = mPixelX - mapTileSize / 2 + offsetX;
3819  // getActorY() + offsetY;
3820  const int py = mPixelY - mapTileSize + offsetY;
3821  drawBeingCursor(graphics, px, py);
3822  drawElementalSpriteAt(graphics, px, py);
3823 }

References mapTileSize.

◆ drawElementalSpriteAt()

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

Definition at line 4166 of file being.cpp.

4169 {
4172  {
4173  if (userPalette == nullptr)
4174  {
4175  CompoundSprite::drawSimple(graphics, x, y);
4176  return;
4177  }
4178 
4179  int attackRange;
4180  if (mAttackRange != 0)
4181  attackRange = mapTileSize * mAttackRange;
4182  else
4183  attackRange = mapTileSize;
4184 
4187 
4188  graphics->fillRectangle(Rect(
4189  x - attackRange, y - attackRange,
4190  2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
4191  }
4192 
4193  CompoundSprite::drawSimple(graphics, x, y);
4194 
4195  if (mShowMobHP &&
4196  (mInfo != nullptr))
4197  {
4199  {
4200  // show hp bar here
4202  if (maxHP == 0)
4203  maxHP = mInfo->getMaxHP();
4204 
4205  drawHpBar(graphics,
4206  maxHP,
4208  mDamageTaken,
4211  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
4212  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
4213  2 * 50,
4214  4);
4215  }
4216  }
4217 }

References BeingAction::DEAD, CompoundSprite::drawSimple(), UserColorId::ELEMENTAL_HP, Attributes::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 2374 of file being.cpp.

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

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 3789 of file being.cpp.

3792 {
3793  // getActorX() + offsetX;
3794  const int px = mPixelX - mapTileSize / 2 + offsetX;
3795  // getActorY() + offsetY;
3796  const int py = mPixelY - mapTileSize + offsetY;
3797  drawBeingCursor(graphics, px, py);
3798  drawHomunculusSpriteAt(graphics, px, py);
3799 }

References mapTileSize.

◆ drawHomunculusSpriteAt()

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

Definition at line 4056 of file being.cpp.

4059 {
4062  {
4063  if (userPalette == nullptr)
4064  {
4065  CompoundSprite::drawSimple(graphics, x, y);
4066  return;
4067  }
4068 
4069  int attackRange;
4070  if (mAttackRange != 0)
4071  attackRange = mapTileSize * mAttackRange;
4072  else
4073  attackRange = mapTileSize;
4074 
4077 
4078  graphics->fillRectangle(Rect(
4079  x - attackRange, y - attackRange,
4080  2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
4081  }
4082 
4083  CompoundSprite::drawSimple(graphics, x, y);
4084 
4085  if (mShowMobHP &&
4086  (mInfo != nullptr))
4087  {
4089  if ((info != nullptr) &&
4090  mId == info->id)
4091  {
4092  // show hp bar here
4094  if (maxHP == 0)
4095  maxHP = mInfo->getMaxHP();
4096 
4097  drawHpBar(graphics,
4098  maxHP,
4100  mDamageTaken,
4103  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
4104  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
4105  2 * 50,
4106  4);
4107  }
4108  }
4109 }

References BeingAction::DEAD, CompoundSprite::drawSimple(), UserPalette::getColorWithAlpha(), PlayerInfo::getHomunculus(), PlayerInfo::getStatBase(), UserColorId::HOMUN_HP, Attributes::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 4250 of file being.cpp.

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

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 3801 of file being.cpp.

3804 {
3805  // getActorX() + offsetX;
3806  const int px = mPixelX - mapTileSize / 2 + offsetX;
3807  // getActorY() + offsetY;
3808  const int py = mPixelY - mapTileSize + offsetY;
3809  drawBeingCursor(graphics, px, py);
3810  drawMercenarySpriteAt(graphics, px, py);
3811 }

References mapTileSize.

◆ drawMercenarySpriteAt()

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

Definition at line 4111 of file being.cpp.

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

References BeingAction::DEAD, CompoundSprite::drawSimple(), UserPalette::getColorWithAlpha(), PlayerInfo::getMercenary(), PlayerInfo::getStatBase(), Actions::info(), mapTileSize, UserColorId::MERC_HP, Attributes::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 3777 of file being.cpp.

3780 {
3781  // getActorX() + offsetX;
3782  const int px = mPixelX - mapTileSize / 2 + offsetX;
3783  // getActorY() + offsetY;
3784  const int py = mPixelY - mapTileSize + offsetY;
3785  drawBeingCursor(graphics, px, py);
3786  drawMonsterSpriteAt(graphics, px, py);
3787 }

References mapTileSize.

◆ drawMonsterSpriteAt()

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

Definition at line 4002 of file being.cpp.

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

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 3765 of file being.cpp.

3768 {
3769  // getActorX() + offsetX;
3770  const int px = mPixelX - mapTileSize / 2 + offsetX;
3771  // getActorY() + offsetY;
3772  const int py = mPixelY - mapTileSize + offsetY;
3773  drawBeingCursor(graphics, px, py);
3774  drawNpcSpriteAt(graphics, px, py);
3775 }

References mapTileSize.

◆ drawNpcSpriteAt()

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

Definition at line 3995 of file being.cpp.

3998 {
3999  drawCompound(graphics, x, y);
4000 }

References x, and y.

◆ drawOther()

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

Definition at line 3753 of file being.cpp.

3756 {
3757  // getActorX() + offsetX;
3758  const int px = mPixelX - mapTileSize / 2 + offsetX;
3759  // getActorY() + offsetY;
3760  const int py = mPixelY - mapTileSize + offsetY;
3761  drawBeingCursor(graphics, px, py);
3762  drawOtherSpriteAt(graphics, px, py);
3763 }

References mapTileSize.

◆ drawOtherSpriteAt()

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

Definition at line 3988 of file being.cpp.

3991 {
3992  CompoundSprite::drawSimple(graphics, x, y);
3993 }

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

◆ drawPlayer()

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

Definition at line 3691 of file being.cpp.

3694 {
3695  if (!mErased)
3696  {
3697  // getActorX() + offsetX;
3698  const int px = mPixelX - mapTileSize / 2 + offsetX;
3699  // getActorY() + offsetY;
3700  const int py = mPixelY - mapTileSize + offsetY;
3701  if (mHorseInfo != nullptr)
3702  {
3705  {
3706  (*it)->draw(graphics,
3707  px + offset.downOffsetX,
3708  py + offset.downOffsetY);
3709  }
3710 
3711  drawBeingCursor(graphics, px, py);
3712  drawPlayerSpriteAt(graphics,
3713  px + offset.riderOffsetX,
3714  py + offset.riderOffsetY);
3715 
3717  {
3718  (*it)->draw(graphics,
3719  px + offset.upOffsetX,
3720  py + offset.upOffsetY);
3721  }
3722  }
3723  else
3724  {
3725  drawBeingCursor(graphics, px, py);
3726  drawPlayerSpriteAt(graphics, px, py);
3727  }
3728  }
3729 }

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 3964 of file being.cpp.

3967 {
3968  drawCompound(graphics, x, y);
3969 
3970  if (mShowOwnHP &&
3971  (mInfo != nullptr) &&
3972  localPlayer == this &&
3974  {
3975  drawHpBar(graphics,
3978  0,
3981  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
3982  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
3983  2 * 50,
3984  4);
3985  }
3986 }

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 3890 of file being.cpp.

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

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 3825 of file being.cpp.

3828 {
3829  // getActorX() + offsetX;
3830  const int px = mPixelX - mapTileSize / 2 + offsetX;
3831  // getActorY() + offsetY;
3832  const int py = mPixelY - mapTileSize + offsetY;
3833  drawPortalSpriteAt(graphics, px, py);
3834 }

References mapTileSize.

◆ drawPortalSpriteAt()

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

Definition at line 4219 of file being.cpp.

4222 {
4223  if (mHighlightMapPortals &&
4224  (mMap != nullptr) &&
4225  !mMap->getHasWarps())
4226  {
4227  if (userPalette == nullptr)
4228  {
4229  CompoundSprite::drawSimple(graphics, x, y);
4230  return;
4231  }
4232 
4233  graphics->setColor(userPalette->
4234  getColorWithAlpha(UserColorId::PORTAL_HIGHLIGHT));
4235 
4236  graphics->fillRectangle(Rect(x, y,
4238 
4239  if (mDrawHotKeys && !mName.empty())
4240  {
4241  const Color &color = userPalette->getColor(UserColorId::BEING,
4242  255U);
4243  gui->getFont()->drawString(graphics, color, color, mName, x, y);
4244  }
4245  }
4246 
4247  CompoundSprite::drawSimple(graphics, x, y);
4248 }

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 2404 of file being.cpp.

2406 {
2407  if (mErased)
2408  return;
2409  if (mSpeech.empty())
2410  return;
2411 
2412  const int px = mPixelX - offsetX;
2413  const int py = mPixelY - offsetY;
2414  const int speech = mSpeechType;
2415 
2416  // Draw speech above this being
2417  if (mSpeechTime == 0)
2418  {
2419  if (mSpeechBubble != nullptr &&
2421  {
2423  }
2424  mSpeech.clear();
2425  }
2426  else if (mSpeechTime > 0 && (speech == BeingSpeech::NAME_IN_BUBBLE ||
2427  speech == BeingSpeech::NO_NAME_IN_BUBBLE))
2428  {
2429  delete2(mText)
2430 
2431  if (mSpeechBubble != nullptr)
2432  {
2434  py - getHeight() - (mSpeechBubble->getHeight()));
2436  }
2437  }
2438  else if (mSpeechTime > 0 && speech == BeingSpeech::TEXT_OVERHEAD)
2439  {
2440  if (mSpeechBubble != nullptr)
2442 
2443  if ((mText == nullptr) && (userPalette != nullptr))
2444  {
2445  mText = new Text(mSpeech,
2446  mPixelX,
2447  mPixelY - getHeight(),
2449  &theme->getColor(ThemeColorId::BUBBLE_TEXT, 255),
2450  Speech_true,
2451  nullptr);
2453  (mY + 1) * mapTileSize - getHeight() - mText->getHeight() - 9,
2454  mMoveNames);
2455  }
2456  }
2457  else if (speech == BeingSpeech::NO_SPEECH)
2458  {
2459  if (mSpeechBubble != nullptr)
2461  delete2(mText)
2462  }
2463 }

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 3910 of file being.cpp.

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

References restrict.

◆ dumpSprites()

void Being::dumpSprites ( ) const
protected

Definition at line 3406 of file being.cpp.

3407 {
3408  STD_VECTOR<BeingSlot>::const_iterator it1 = mSlots.begin();
3409  const STD_VECTOR<BeingSlot>::const_iterator it1_end = mSlots.end();
3410 
3411  logger->log("sprites");
3412  for (; it1 != it1_end;
3413  ++ it1)
3414  {
3415  logger->log("%d,%s,%d",
3416  (*it1).spriteId,
3417  (*it1).color.c_str(),
3418  toInt((*it1).colorId, int));
3419  }
3420 }

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

◆ enableBotAi()

void Being::enableBotAi ( )
inline

Definition at line 1049 of file being.h.

1050  { mBotAi = true; }

References mBotAi.

◆ enableShop()

void Being::enableShop ( const bool  b)

Definition at line 5341 of file being.cpp.

5342 {
5343  mShop = b;
5344  updateName();
5346 }

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 1377 of file being.cpp.

1379 {
1380  BLOCK_START("Being::fireMissile")
1381 
1382  if (victim == nullptr ||
1383  missile.particle.empty() ||
1384  particleEngine == nullptr)
1385  {
1386  BLOCK_END("Being::fireMissile")
1387  return;
1388  }
1389 
1390  Particle *restrict const target = particleEngine->createChild();
1391 
1392  if (target == nullptr)
1393  {
1394  BLOCK_END("Being::fireMissile")
1395  return;
1396  }
1397 
1398  // +++ add z particle position?
1399  Particle *restrict const missileParticle = target->addEffect(
1400  missile.particle,
1401  mPixelX,
1402  mPixelY,
1403  0);
1404 
1405  target->moveBy(Vector(0.0F, 0.0F, missile.z));
1406  target->setLifetime(missile.lifeTime);
1407  victim->controlAutoParticle(target);
1408 
1409  if (missileParticle != nullptr)
1410  {
1411  missileParticle->setDestination(target, missile.speed, 0.0F);
1412  missileParticle->setDieDistance(missile.dieDistance);
1413  missileParticle->setLifetime(missile.lifeTime);
1414  }
1415  BLOCK_END("Being::fireMissile")
1416 }

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

◆ fixDirectionOffsets()

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

Definition at line 5525 of file being.cpp.

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

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 2531 of file being.cpp.

2532 {
2533  if (mDispName != nullptr)
2534  mDispName->flash(time);
2535 }

◆ genderToInt()

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

Definition at line 926 of file being.h.

928  {
929  switch (sex)
930  {
931  case Gender::FEMALE:
932  case Gender::UNSPECIFIED:
933  default:
934  return 0;
935  case Gender::MALE:
936  return 1;
937  case Gender::HIDDEN:
938  return 3;
939  }
940  }

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

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

◆ getActionTime()

int Being::getActionTime ( ) const
inline

Returns the time spent in the current action.

Definition at line 127 of file being.h.

128  { return mActionTime; }

References mActionTime.

◆ getAllowNpcEquipment()

bool Being::getAllowNpcEquipment ( ) const
inline

Definition at line 1105 of file being.h.

1106  { return mAllowNpcEquipment; }

References mAllowNpcEquipment.

◆ getAreaSize()

int Being::getAreaSize ( ) const
inline

Definition at line 1052 of file being.h.

1053  { return mAreaSize; }

References mAreaSize.

◆ getAttackAction() [1/2]

std::string Being::getAttackAction ( ) const

Definition at line 1524 of file being.cpp.

◆ getAttackAction() [2/2]

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

Definition at line 1470 of file being.cpp.

1472 {
1473  if (attack1 == nullptr)
1474  return getAttackAction();
1475 
1476  if (mHorseId != 0)
1477  return attack1->mRideAction;
1478  if (mMap != nullptr)
1479  {
1480  const unsigned char mask = mMap->getBlockMask(mX, mY);
1481  if ((mask & BlockMask::AIR) != 0)
1482  return attack1->mSkyAction;
1483  else if ((mask & BlockMask::WATER) != 0)
1484  return attack1->mWaterAction;
1485  }
1486  return attack1->mAction;
1487 }

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

◆ getAttackDelay()

int Being::getAttackDelay ( ) const
inline

Definition at line 772 of file being.h.

773  { return mAttackDelay; }

References mAttackDelay.

Referenced by TargetDebugTab::logic().

◆ getAttackSpeed()

int Being::getAttackSpeed ( ) const
inline

Gets the attack speed.

Definition at line 469 of file being.h.

470  { return mAttackSpeed; }

References mAttackSpeed.

◆ getAttackTime()

time_t Being::getAttackTime ( ) const
inline

Definition at line 723 of file being.h.

724  { 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 441 of file being.h.

442  {
443  if (mInfo == nullptr)
444  return BlockType::NONE;
445  return mInfo->getBlockType();
446  }

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 431 of file being.h.

432  {
433  if (mInfo == nullptr)
434  return 0;
435  return mInfo->getBlockWalkMask();
436  }

References BeingInfo::getBlockWalkMask(), and mInfo.

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

◆ getBuyBoard()

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

Definition at line 1018 of file being.h.

1019  { return mBuyBoard; }

References mBuyBoard.

Referenced by BeingPopup::show().

◆ getCachedX()

int Being::getCachedX ( ) const
inline

Definition at line 152 of file being.h.

153  { return mCachedX; }

References mCachedX.

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

◆ getCachedY()

int Being::getCachedY ( ) const
inline

Definition at line 155 of file being.h.

156  { return mCachedY; }

References mCachedY.

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

◆ getCacheEntry()

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

Definition at line 3556 of file being.cpp.

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

References beingInfoCache, cur_time, and FOR_EACH.

Referenced by addToCache(), and updateFromCache().

◆ getCastAction() [1/2]

std::string Being::getCastAction ( ) const

Definition at line 1525 of file being.cpp.

◆ getCastAction() [2/2]

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

Definition at line 1489 of file being.cpp.

1491 {
1492  if (skill == nullptr)
1493  return getCastAction();
1494 
1495  if (mHorseId != 0)
1496  return skill->castingRideAction;
1497  if (mMap != nullptr)
1498  {
1499  const unsigned char mask = mMap->getBlockMask(mX, mY);
1500  if ((mask & BlockMask::AIR) != 0)
1501  return skill->castingSkyAction;
1502  else if ((mask & BlockMask::WATER) != 0)
1503  return skill->castingWaterAction;
1504  }
1505  return skill->castingAction;
1506 }

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 262 of file being.h.

264  { return mClanName; }

References mClanName.

Referenced by BeingPopup::show().

◆ getComment()

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

Definition at line 811 of file being.h.

812  { return mComment; }

References mComment.

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

◆ getCreatorId()

BeingId Being::getCreatorId ( ) const
inline

Definition at line 1031 of file being.h.

1032  { return mCreatorId; }

References mCreatorId.

Referenced by PopupMenu::showPopup().

◆ getCriticalHit()

int Being::getCriticalHit ( ) const
inline

Definition at line 787 of file being.h.

788  { return mCriticalHit; }

References mCriticalHit.

Referenced by TargetDebugTab::logic().

◆ getCurrentAction()

BeingActionT Being::getCurrentAction ( ) const
inline

◆ getDamageTaken()

int Being::getDamageTaken ( ) const
inline

Definition at line 592 of file being.h.

593  { return mDamageTaken; }

References mDamageTaken.

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

◆ getDeadAction()

std::string Being::getDeadAction ( ) const

Definition at line 1526 of file being.cpp.

◆ getDefaultEffectId()

int Being::getDefaultEffectId ( const AttackTypeT type)
staticprotected

Definition at line 952 of file being.cpp.

953 {
954  if (type == AttackType::MISS)
955  return paths.getIntValue("missEffectId");
956  else if (type != AttackType::CRITICAL)
957  return paths.getIntValue("hitEffectId");
958  else
959  return paths.getIntValue("criticalHitEffectId");
960 }

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 161 of file being.h.

162  { 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 551 of file being.h.

552  { return mDistance; }

References mDistance.

Referenced by ActorManager::findNearestLivingBeing().

◆ getEquipment()

Equipment * Being::getEquipment ( )

Definition at line 4694 of file being.cpp.

4695 {
4696  Equipment *restrict const eq = new Equipment;
4697  Equipment::Backend *restrict const bk = new BeingEquipBackend(this);
4698  eq->setBackend(bk);
4699  return eq;
4700 }

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

Referenced by EquipmentWindow::setBeing().

◆ getEquippedWeapon()

const ItemInfo* Being::getEquippedWeapon ( ) const
inline

Definition at line 225 of file being.h.

226  { return mEquippedWeapon; }

References mEquippedWeapon.

◆ getExtName()

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

Definition at line 234 of file being.h.

235  { return mExtName; }

References mExtName.

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

◆ getGender()

GenderT Being::getGender ( ) const
inline

Definition at line 625 of file being.h.

626  { return mGender; }

References mGender.

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

◆ getGenderSign()

std::string Being::getGenderSign ( ) const

Definition at line 2546 of file being.cpp.

2547 {
2548  std::string str;
2549  if (mShowGender)
2550  {
2551  if (getGender() == Gender::FEMALE)
2552  str = "\u2640";
2553  else if (getGender() == Gender::MALE)
2554  str = "\u2642";
2555  }
2556  if (mShowPlayersStatus &&
2558  {
2559  if (mShop)
2560  str.append("$");
2561  if (mAway)
2562  {
2563  // TRANSLATORS: this away status writed in player nick
2564  str.append(_("A"));
2565  }
2566  else if (mInactive)
2567  {
2568  // TRANSLATORS: this inactive status writed in player nick
2569  str.append(_("I"));
2570  }
2571  }
2572  return str;
2573 }

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

Referenced by getGenderSignWithSpace(), and showName().

◆ getGenderSignWithSpace()

std::string Being::getGenderSignWithSpace ( ) const

Definition at line 2537 of file being.cpp.

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

References getGenderSign(), and restrict.

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

◆ getGoodStatus()

int Being::getGoodStatus ( ) const
inline

Definition at line 799 of file being.h.

800  { 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 1279 of file being.cpp.

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

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 1270 of file being.cpp.

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

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 258 of file being.h.

260  { 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 305 of file being.h.

307  { return mGuilds; }

References anonymous_namespace{badgesdb.cpp}::mGuilds.

◆ getHairColor()

ItemColor Being::getHairColor ( ) const
inline

Definition at line 882 of file being.h.

883  { 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 535 of file being.h.

536  { return std::max(CompoundSprite::getHeight(), DEFAULT_BEING_HEIGHT); }

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 869 of file being.cpp.

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

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 892 of file being.h.

893  {
894  return mInfo != nullptr ?
896  }

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

◆ getHP()

int Being::getHP ( ) const
inline

Definition at line 758 of file being.h.

759  { 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 742 of file being.h.

743  { return mIp; }

References mIp.

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

◆ getKarma()

int Being::getKarma ( ) const
inline

Definition at line 1037 of file being.h.

1038  { return mKarma; }

References mKarma.

Referenced by TargetDebugTab::logic().

◆ getLanguageId()

int Being::getLanguageId ( )
inline

Definition at line 1082 of file being.h.

1083  { return mLanguageId; }

References mLanguageId.

◆ getLastAttackX()

virtual int Being::getLastAttackX ( ) const
inlinevirtual

Reimplemented in LocalPlayer.

Definition at line 977 of file being.h.

978  { return mLastAttackX; }

References mLastAttackX.

Referenced by updateBotDirection().

◆ getLastAttackY()

virtual int Being::getLastAttackY ( ) const
inlinevirtual

Reimplemented in LocalPlayer.

Definition at line 980 of file being.h.

981  { return mLastAttackY; }

References mLastAttackY.

Referenced by updateBotDirection().

◆ getLevel()

virtual int Being::getLevel ( ) const
inlinevirtual

◆ getLook()

uint16_t Being::getLook ( ) const
inline

Definition at line 921 of file being.h.

922  { return mLook; }

References mLook.

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

◆ getManner()

int Being::getManner ( ) const
inline

Definition at line 1043 of file being.h.

1044  { return mManner; }

References mManner.

Referenced by TargetDebugTab::logic().

◆ getMaxHit()

int Being::getMaxHit ( ) const
inline

Definition at line 781 of file being.h.

782  { return mMaxHit; }

References mMaxHit.

Referenced by TargetDebugTab::logic().

◆ getMaxHP()

int Being::getMaxHP ( ) const
inline

Definition at line 761 of file being.h.

762  { return mMaxHP; }

References mMaxHP.

Referenced by BeingPopup::show().

◆ getMinHit()

int Being::getMinHit ( ) const
inline

Definition at line 775 of file being.h.

776  { return mMinHit; }

References mMinHit.

Referenced by TargetDebugTab::logic().

◆ getMoveAction()

std::string Being::getMoveAction ( ) const

Definition at line 1436 of file being.cpp.

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

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 720 of file being.h.

721  { return mMoveTime; }

References mMoveTime.

◆ getName()

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

Returns the name of the being.

Definition at line 231 of file being.h.

232  { return mName; }

References mName.

Referenced by PlayerPostDeathListener::action(), CharSelectDialog::action(), ChatWindow::addWhisper(), ChatWindow::addWhisperTab(), EAthena::ChatHandler::battleTalk(), EAthena::ClanHandler::chat(), GuildManager::chat(), EAthena::PartyHandler::chat(), EAthena::GuildHandler::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(), WhoIsOnline::handleLink(), PopupMenu::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(), TmwAthena::ChatRecv::processBeingChat(), EAthena::ChatRecv::processBeingChat(), Ea::BeingRecv::processBeingRemove(), TmwAthena::BeingRecv::processBeingSelfEffect(), EAthena::BeingRecv::processBeingSpecialEffect(), EAthena::FamilyRecv::processCallPartner(), EAthena::CharServerRecv::processCharCharacters(), TmwAthena::CharServerRecv::processCharLogin(), EAthena::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(), TmwAthena::PartyRecv::processPartyInfo(), EAthena::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(), TmwAthena::ChatHandler::talk(), EAthena::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 317 of file being.h.

318  { return CAST_S16(mGuilds.size()); }

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 376 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 2466 of file being.cpp.

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

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 732 of file being.h.

733  { return mOtherTime; }

References mOtherTime.

◆ getOwner()

Being* Being::getOwner ( ) const
inline

Definition at line 913 of file being.h.

914  { 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 548 of file being.h.

549  { return mPath; }

References mPath.

◆ getPvpRank()

unsigned int Being::getPvpRank ( ) const
inline

Definition at line 748 of file being.h.

749  { return mPvpRank; }

References mPvpRank.

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

◆ getRaceName()

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

Definition at line 860 of file being.h.

861  { return mRaceName; }

References mRaceName.

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

◆ getReachable()

ReachableT Being::getReachable ( ) const
inline

Definition at line 609 of file being.h.

610  { return mReachable; }

References mReachable.

Referenced by LocalPlayer::isReachable().

◆ getSellBoard()

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

Definition at line 1013 of file being.h.

1014  { return mSellBoard; }

References mSellBoard.

Referenced by BeingPopup::show().

◆ getShowName()

bool Being::getShowName ( ) const
inline

Definition at line 244 of file being.h.

245  { return mShowName; }

References mShowName.

◆ getSitAction()

std::string Being::getSitAction ( ) const

Return sprite sit action for current environment.

Definition at line 1418 of file being.cpp.

1419 {
1420  if (mHorseId != 0)
1421  return SpriteAction::SITRIDE;
1422  if (mMap != nullptr)
1423  {
1424  const unsigned char mask = mMap->getBlockMask(mX, mY);
1425  if ((mask & BlockMask::GROUNDTOP) != 0)
1426  return SpriteAction::SITTOP;
1427  else if ((mask & BlockMask::AIR) != 0)
1428  return SpriteAction::SITSKY;
1429  else if ((mask & BlockMask::WATER) != 0)
1430  return SpriteAction::SITWATER;
1431  }
1432  return SpriteAction::SIT;
1433 }

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 964 of file being.h.

965  { return CAST_S32(mPos.y) - mYDiff - mSortOffsetY; }

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

◆ getSpawnAction()

std::string Being::getSpawnAction ( ) const

Definition at line 1527 of file being.cpp.

◆ getSpiritBalls()

unsigned int Being::getSpiritBalls ( ) const
inline

Definition at line 1023 of file being.h.

1024  { return mSpiritBalls; }

References mSpiritBalls.

◆ getSpriteColor()

ItemColor Being::getSpriteColor ( const int  slot) const

Definition at line 4907 of file being.cpp.

4908 {
4909  if (slot < 0 || CAST_SIZE(slot) >= mSlots.size())
4910  return ItemColor_one;
4911 
4912  return mSlots[slot].colorId;
4913 }

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 510 of file being.h.

512  { return mSpriteDirection; }

References mSpriteDirection.

◆ getSpriteID()

int Being::getSpriteID ( const int  slot) const

Definition at line 4891 of file being.cpp.

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

References CAST_SIZE.

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

◆ getSpriteSlot()

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

Definition at line 4899 of file being.cpp.

4900 {
4901  if (slot < 0 || CAST_SIZE(slot) >= mSlots.size())
4902  return *emptyBeingSlot;
4903 
4904  return mSlots[slot];
4905 }

References CAST_SIZE, and emptyBeingSlot.

◆ getStandAction()

std::string Being::getStandAction ( ) const

Definition at line 1529 of file being.cpp.

1530 {
1531  if (mHorseId != 0)
1532  return SpriteAction::STANDRIDE;
1533  if (mMap != nullptr)
1534  {
1535  const unsigned char mask = mMap->getBlockMask(mX, mY);
1536  if (mTrickDead)
1537  {
1538  if ((mask & BlockMask::AIR) != 0)
1539  return SpriteAction::DEADSKY;
1540  else if ((mask & BlockMask::WATER) != 0)
1541  return SpriteAction::DEADWATER;
1542  else
1543  return SpriteAction::DEAD;
1544  }
1545  if ((mask & BlockMask::AIR) != 0)
1546  return SpriteAction::STANDSKY;
1547  else if ((mask & BlockMask::WATER) != 0)
1548  return SpriteAction::STANDWATER;
1549  }
1550  return SpriteAction::STAND;
1551 }

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 726 of file being.h.

727  { 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 517 of file being.cpp.

518 {
519  if (mInfo == nullptr)
521 
522  return mInfo->getTargetCursorSize();
523 }

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

◆ getTargetOffsetX()

int Being::getTargetOffsetX ( ) const
inlinevirtual

Reimplemented from ActorSprite.

Definition at line 414 of file being.h.

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

References BeingInfo::getTargetOffsetX(), and mInfo.

◆ getTargetOffsetY()

int Being::getTargetOffsetY ( ) const
inlinevirtual

Reimplemented from ActorSprite.

Definition at line 421 of file being.h.

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

References BeingInfo::getTargetOffsetY(), and mInfo.

◆ getTeamId()

uint16_t Being::getTeamId ( ) const
inline

Definition at line 1085 of file being.h.

1086  { return mTeamId; }

References mTeamId.

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

◆ getTestTime()

time_t Being::getTestTime ( ) const
inline

Definition at line 729 of file being.h.

730  { 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 115 of file being.h.

117  { 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(), TmwAthena::ChatRecv::processBeingChat(), EAthena::ChatRecv::processBeingChat(), Ea::BeingRecv::processBeingEmotion(), TmwAthena::BeingRecv::processBeingMove(), EAthena::BeingRecv::processBeingMove(), TmwAthena::BeingRecv::processBeingMove2(), EAthena::BeingRecv::processBeingMove2(), Ea::BeingRecv::processBeingRemove(), TmwAthena::BeingRecv::processBeingSelfEffect(), EAthena::BeingRecv::processBeingSpawn(), EAthena::BeingRecv::processBeingSpecialEffect(), TmwAthena::BeingRecv::processBeingVisible(), EAthena::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 457 of file being.h.

458  { return mWalkSpeed; }

References mWalkSpeed.

Referenced by LocalPlayer::LocalPlayer().

◆ getWeaponAttackAction()

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

Definition at line 1451 of file being.cpp.

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

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 529 of file being.h.

530  { return std::max(CompoundSprite::getWidth(), DEFAULT_BEING_WIDTH); }

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 962 of file being.cpp.

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

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 1049 of file being.cpp.

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

References SkillType::Attack, BeingAction::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(), TmwAthena::BeingRecv::processSkillDamage(), EAthena::BeingRecv::processSkillDamage(), and Ea::BeingRecv::processSkillNoDamage().

◆ handleSkillCasting()

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

Definition at line 1024 of file being.cpp.

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

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 971 of file being.h.

972  { mUsageCounter ++; }

References mUsageCounter.

◆ intToGender()

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

◆ isAdvanced()

bool Being::isAdvanced ( ) const
inline

Definition at line 827 of file being.h.

828  { return mAdvanced; }

References mAdvanced.

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

◆ isAlive()

bool Being::isAlive ( ) const
inline

◆ isBuyShopEnabled()

bool Being::isBuyShopEnabled ( ) const

Definition at line 5348 of file being.cpp.

5349 {
5351  !mBuyBoard.empty());
5352 }

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 5354 of file being.cpp.

5355 {
5357  !mSellBoard.empty());
5358 }

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 4731 of file being.cpp.

4733 {
4734  std::string str;
4735  switch (type)
4736  {
4737  case ActorType::Player:
4738  str = settings.usersDir;
4739  break;
4740  case ActorType::Npc:
4741  str = settings.npcsDir;
4742  break;
4743  case ActorType::Unknown:
4744  case ActorType::Monster:
4745  case ActorType::FloorItem:
4746  case ActorType::Portal:
4747  case ActorType::Avatar:
4748  case ActorType::Mercenary:
4749  case ActorType::Homunculus:
4750  case ActorType::Pet:
4751  case ActorType::SkillUnit:
4752  case ActorType::Elemental:
4753  default:
4754  return "";
4755  }
4756 
4757  str = pathJoin(str, stringToHexPath(name), "comment.txt");
4758  if (Files::existsLocal(str))
4759  {
4760  StringVect lines;
4761  Files::loadTextFileLocal(str, lines);
4762  if (lines.size() >= 2)
4763  return lines[1];
4764  }
4765  return std::string();
4766 }

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 1833 of file being.cpp.

1834 {
1835  BLOCK_START("Being::logic")
1836  if (A_UNLIKELY(mSpeechTime != 0))
1837  {
1838  mSpeechTime--;
1839  if (mSpeechTime == 0 && mText != nullptr)
1840  delete2(mText)
1841  }
1842 
1843  if (A_UNLIKELY(mOwner != nullptr))
1844  {
1845  if (mType == ActorType::Homunculus ||
1847  {
1848  botLogic();
1849  }
1850  }
1851 
1852  const int time = tick_time * MILLISECONDS_IN_A_TICK;
1853  if (mEmotionSprite != nullptr)
1854  mEmotionSprite->update(time);
1856  (*it)->update(time);
1858  (*it)->update(time);
1859 
1861  {
1862  mCastEndTime = 0;
1864  }
1865 
1867  {
1868  mAnimationEffect->update(time);
1871  }
1873  {
1874  mCastingEffect->update(time);
1877  }
1878  for_each_badges()
1879  {
1880  AnimatedSprite *restrict const sprite = mBadges[f];
1881  if (sprite != nullptr)
1882  sprite->update(time);
1883  }
1884 
1885  int frameCount = CAST_S32(getFrameCount());
1886 
1887  switch (mAction)
1888  {
1889  case BeingAction::STAND:
1890  case BeingAction::SIT:
1891  case BeingAction::DEAD:
1892  case BeingAction::HURT:
1893  case BeingAction::SPAWN:
1894  case BeingAction::CAST:
1895  default:
1896  break;
1897 
1898  case BeingAction::MOVE:
1899  {
1901  nextTile();
1902  break;
1903  }
1904 
1905  case BeingAction::ATTACK:
1906  {
1907  if (mActionTime == 0)
1908  break;
1909 
1910  int curFrame = 0;
1911  if (mAttackSpeed != 0)
1912  {
1913  curFrame = (get_elapsed_time(mActionTime) * frameCount)
1914  / mAttackSpeed;
1915  }
1916 
1917  if (this == localPlayer && curFrame >= frameCount)
1918  nextTile();
1919 
1920  break;
1921  }
1922 
1923  case BeingAction::PRESTAND:
1924  {
1925  if (get_elapsed_time1(mPreStandTime) > 10)
1927  break;
1928  }
1929  }
1930 
1932  {
1933  const int xOffset = getOffset<BeingDirection::LEFT,
1935  const int yOffset = getOffset<BeingDirection::UP,
1937  int offset = xOffset;
1938  if (offset == 0)
1939  offset = yOffset;
1940 
1941  if ((xOffset == 0) && (yOffset == 0))
1942  mNeedPosUpdate = false;
1943 
1944  const int halfTile = mapTileSize / 2;
1945  const float offset2 = static_cast<float>(
1946  mPixelOffsetY * abs(offset)) / 2;
1947 // mSortOffsetY = (mOldHeight - mFixedOffsetY + mPixelOffsetY)
1948 // * halfTile - offset2;
1949  mSortOffsetY = 0;
1950  const float yOffset3 = (mY + 1) * mapTileSize + yOffset
1951  - (mOldHeight + mPixelOffsetY) * halfTile + offset2;
1952 
1953  // Update pixel coordinates
1954  setPixelPositionF(static_cast<float>(mX * mapTileSize
1955  + mapTileSize / 2 + xOffset),
1956  yOffset3,
1957  0.0F);
1958  }
1959 
1961  {
1962  mEmotionTime--;
1963  if (mEmotionTime == 0)
1965  }
1966 
1968 
1969  if (frameCount < 10)
1970  frameCount = 10;
1971 
1972  if (A_UNLIKELY(!isAlive() &&
1973  mSpeed != 0 &&
1975  get_elapsed_time(mActionTime) / mSpeed >= frameCount))
1976  {
1977  if (mType != ActorType::Player && (actorManager != nullptr))
1978  actorManager->destroy(this);
1979  }
1980 
1981  const SoundInfo *restrict const sound = mNextSound.sound;
1982  if (A_UNLIKELY(sound))
1983  {
1984  const int time2 = tick_time;
1985  if (time2 > mNextSound.time)
1986  {
1987  soundManager.playSfx(sound->sound,
1988  mNextSound.x,
1989  mNextSound.y);
1990  mNextSound.sound = nullptr;
1991  mNextSound.time = time2 + sound->delay;
1992  }
1993  }
1994 
1995  BLOCK_END("Being::logic")
1996 }

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 2191 of file being.cpp.

2193 {
2194  const int dstX0 = mOwner->mX;
2195  const int dstY0 = mOwner->mY;
2196  const unsigned char blockWalkMask = getBlockWalkMask();
2197  if (!mMap->getWalk(dstX, dstY, blockWalkMask))
2198  {
2199  if (dstX != dstX0)
2200  {
2201  dstX = dstX0;
2202  if (!mMap->getWalk(dstX, dstY, blockWalkMask))
2203  dstY = dstY0;
2204  }
2205  else if (dstY != dstY0)
2206  {
2207  dstY = dstY0;
2208  if (!mMap->getWalk(dstX, dstY, blockWalkMask))
2209  dstX = dstX0;
2210  }
2211  }
2212  if (mX != dstX || mY != dstY)
2213  {
2215  homunculusHandler->move(dstX, dstY);
2216  else
2217  mercenaryHandler->move(dstX, dstY);
2218  return;
2219  }
2220  updateBotDirection(dstX, dstY);
2221 }

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 1781 of file being.cpp.

1782 {
1783  if (mPath.empty())
1784  {
1787  return;
1788  }
1789 
1790  const Position pos = mPath.front();
1791  mPath.pop_front();
1792 
1793  const uint8_t dir = calcDirection(pos.x, pos.y);
1794  if (dir != 0U)
1795  setDirection(dir);
1796 
1797  if (mMap == nullptr ||
1798  !mMap->getWalk(pos.x, pos.y, getBlockWalkMask()))
1799  {
1801  return;
1802  }
1803 
1804  mActionTime += mSpeed / 10;
1806  && mX != pos.x && mY != pos.y)
1807  {
1808  mSpeed = mWalkSpeed * 14 / 10;
1809  }
1810  else
1811  {
1812  mSpeed = mWalkSpeed;
1813  }
1814 
1815  if (mX != pos.x || mY != pos.y)
1816  {
1819  mMap->getBlockMask(mX, mY) != mMap->getBlockMask(pos.x, pos.y))
1820  {
1822  }
1823  }
1824  mX = pos.x;
1825  mY = pos.y;
1826  const uint8_t height = mMap->getHeightOffset(mX, mY);
1827  mPixelOffsetY = height - mOldHeight;
1828  mFixedOffsetY = height;
1829  mNeedPosUpdate = true;
1831 }

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 2522 of file being.cpp.

2523 {
2524  if (mType == ActorType::Player && value == "visiblenames")
2525  {
2526  setShowName(config.getIntValue("visiblenames") == VisibleName::Show);
2528  }
2529 }

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 4964 of file being.cpp.

4968 {
4969  BLOCK_START("Being::playSfx")
4970 
4971  if (being != nullptr)
4972  {
4973  // here need add timer and delay sound
4974  const int time = tick_time;
4975  if (main)
4976  {
4977  being->mNextSound.sound = nullptr;
4978  being->mNextSound.time = time + sound.delay;
4979  soundManager.playSfx(sound.sound, x, y);
4980  }
4981  else if (mNextSound.time <= time)
4982  { // old event sound time is gone. we can play new sound
4983  being->mNextSound.sound = nullptr;
4984  being->mNextSound.time = time + sound.delay;
4985  soundManager.playSfx(sound.sound, x, y);
4986  }
4987  else
4988  { // old event sound in progress. need save sound and wait
4989  being->mNextSound.sound = &sound;
4990  being->mNextSound.x = x;
4991  being->mNextSound.y = y;
4992  }
4993  }
4994  else
4995  {
4996  soundManager.playSfx(sound.sound, x, y);
4997  }
4998  BLOCK_END("Being::playSfx")
4999 }

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 288 of file being.cpp.

290 {
291  setMap(map);
292  setSubtype(subtype, 0);
293 
295 
296  switch (mType)
297  {
298  case ActorType::Player:
300  case ActorType::Pet:
303  showName1 = static_cast<VisibleName::Type>(
304  config.getIntValue("visiblenames"));
305  break;
306  case ActorType::Portal:
308  showName1 = VisibleName::Hide;
309  break;
310  default:
311  case ActorType::Unknown:
312  case ActorType::Npc:
313  case ActorType::Monster:
315  case ActorType::Avatar:
316  break;
317  }
318 
319  if (mType != ActorType::Npc)
320  mGotComment = true;
321 
322  config.addListener("visiblenames", this);
323 
324  reReadConfig();
325 
326  if (mType == ActorType::Npc ||
327  showName1 == VisibleName::Show)
328  {
329  setShowName(true);
330  }
331 
332  updateColors();
333  updatePercentHP();
334 }

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 4356 of file being.cpp.

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

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 TmwAthena::BeingRecv::applyPlayerAction(), EAthena::BeingRecv::applyPlayerAction(), LocalPlayer::playerDeath(), and Ea::BeingRecv::processBeingRemove().

◆ recreateItemParticles()

void Being::recreateItemParticles ( )

Definition at line 5160 of file being.cpp.

5161 {
5163  {
5164  ParticleInfo *restrict const pi = (*it).second;
5165  if ((pi != nullptr) && !pi->files.empty())
5166  {
5167  FOR_EACH (STD_VECTOR<Particle*>::const_iterator,
5168  itp, pi->particles)
5169  {
5171  }
5172 
5173  FOR_EACH (STD_VECTOR<std::string>::const_iterator, str, pi->files)
5174  {
5175  Particle *const p = particleEngine->addEffect(
5176  *str, 0, 0, 0);
5178  pi->particles.push_back(p);
5179  }
5180  }
5181  }
5182 }

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 4920 of file being.cpp.

4921 {
4923 }

References removeSpecialEffect().

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

◆ removeAllItemsParticles()

void Being::removeAllItemsParticles ( )
protected

Definition at line 5034 of file being.cpp.

5035 {
5037  delete (*it).second;
5038  mSpriteParticles.clear();
5039 }

References FOR_EACH, and mSpriteParticles.

Referenced by ~Being().

◆ removeGuild()

void Being::removeGuild ( const int  id)

Removers a guild from the being.

Definition at line 1247 of file being.cpp.

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

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 5401 of file being.cpp.

5402 {
5404  mUpHorseSprites.clear();
5406  mDownHorseSprites.clear();
5407 }

References delete_all(), mDownHorseSprites, and mUpHorseSprites.

Referenced by ~Being().

◆ removeItemParticles()

void Being::removeItemParticles ( const int  id)
protected

Definition at line 5145 of file being.cpp.

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

References FOR_EACH, and restrict.

◆ removeSpecialEffect()

void Being::removeSpecialEffect ( )

Definition at line 4938 of file being.cpp.

4939 {
4940  if ((effectManager != nullptr) && (mSpecialParticle != nullptr))
4941  {
4943  mSpecialParticle = nullptr;
4944  }
4946 }

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 5507 of file being.cpp.

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

References particleEngine, and restrict.

◆ reReadConfig()

void Being::reReadConfig ( )
static

Definition at line 3428 of file being.cpp.

3429 {
3430  BLOCK_START("Being::reReadConfig")
3431  if (mUpdateConfigTime + 1 < cur_time)
3432  {
3433  mAwayEffect = paths.getIntValue("afkEffectId");
3434  mHighlightMapPortals = config.getBoolValue("highlightMapPortals");
3435  mConfLineLim = config.getIntValue("chatMaxCharLimit");
3436  mSpeechType = config.getIntValue("speech");
3438  config.getBoolValue("highlightMonsterAttackRange");
3439  mLowTraffic = config.getBoolValue("lowTraffic");
3440  mDrawHotKeys = config.getBoolValue("drawHotKeys");
3441  mShowBattleEvents = config.getBoolValue("showBattleEvents");
3442  mShowMobHP = config.getBoolValue("showMobHP");
3443  mShowOwnHP = config.getBoolValue("showOwnHP");
3444  mShowGender = config.getBoolValue("showgender");
3445  mShowLevel = config.getBoolValue("showlevel");
3446  mShowPlayersStatus = config.getBoolValue("showPlayersStatus");
3447  mEnableReorderSprites = config.getBoolValue("enableReorderSprites");
3448  mHideErased = config.getBoolValue("hideErased");
3449  mMoveNames = fromBool(config.getBoolValue("moveNames"), Move);
3450  mUseDiagonal = config.getBoolValue("useDiagonalSpeed");
3451  mShowBadges = static_cast<BadgeDrawType::Type>(
3452  config.getIntValue("showBadges"));
3453  mVisibleNamePos = static_cast<VisibleNamePos::Type>(
3454  config.getIntValue("visiblenamespos"));
3455 
3457  }
3458  BLOCK_END("Being::reReadConfig")
3459 }

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 4347 of file being.cpp.

4348 {
4349  mMoveTime = 0;
4350  mAttackTime = 0;
4351  mTalkTime = 0;
4352  mOtherTime = 0;
4353  mTestTime = cur_time;
4354 }

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 4768 of file being.cpp.

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

References ActorType::Avatar, ActorType::Elemental, ActorType::FloorItem, ActorType::Homunculus, ActorType::Mercenary</