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)
 
virtual ~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
 
void setTileCoords (const int x, const int y)
 
void setSpeech (const std::string &text, const std::string &channel="", int time=0)
 
void takeDamage (Being *const attacker, const int amount, const AttackTypeT type, const int attackId=1, const int level=1)
 
void handleAttack (Being *const victim, const int damage, const int attackId=1)
 
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
 
void setGuildName (const std::string &name)
 
void setGuildPos (const std::string &pos) A_CONST
 
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=0.0F) 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 ()
 
int getHitEffect (const Being *const attacker, const AttackTypeT type, const int attackId, const int level) const
 
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 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)
 
virtual ~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 ()
 
virtual ~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 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
void setStatusEffectBlock (const int offset, const uint16_t newEffects)
 
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 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 1200 of file being.h.

◆ SpriteParticleInfoIter

typedef SpriteParticleInfo::iterator Being::SpriteParticleInfoIter
protected

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

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

Referenced by createBeing().

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

◆ ~Being()

Being::~Being ( )
virtual

Definition at line 337 of file being.cpp.

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().

338 {
339  config.removeListener("visiblenames", this);
341 
342  delete [] mSpriteRemap;
343  mSpriteRemap = nullptr;
344  delete [] mSpriteHide;
345  mSpriteHide = nullptr;
346  delete [] mSpriteDraw;
347  mSpriteDraw = nullptr;
348 
350  delete2(mBadges[f]);
351 
354  delete2(mText);
358  mBadgesCount = 0;
359  delete2(mChat);
360  removeHorse();
361 
364 }
void removeAllItemsParticles()
Definition: being.cpp:4961
Configuration config
CastingEffect * mCastingEffect
Definition: being.h:1174
AnimatedSprite * mAnimationEffect
Definition: being.h:1173
#define delete2(var)
Definition: delete2.h:24
Text * mText
Definition: being.h:1195
std::vector< Particle * > mSpiritParticles
Definition: being.h:1309
void removeHorse()
Definition: being.cpp:5324
SpeechBubble * mSpeechBubble
Definition: being.h:1287
AnimatedSprite * mBadges[BadgeIndex::BadgeIndexSize]
Definition: being.h:1175
#define for_each_badges()
Definition: being.cpp:157
int * mSpriteHide
Definition: being.h:1298
int * mSpriteRemap
Definition: being.h:1297
AnimatedSprite * mEmotionSprite
Definition: being.h:1172
int * mSpriteDraw
Definition: being.h:1299
FlashText * mDispName
Definition: being.h:1188
#define CHECKLISTENERS
Definition: localconsts.h:305
uint16_t mBadgesCount
Definition: being.h:1372
ChatObject * mChat
Definition: being.h:1305
void removeListener(const std::string &key, ConfigListener *const listener)

Member Function Documentation

◆ addAfkEffect()

void Being::addAfkEffect ( )

Definition at line 4845 of file being.cpp.

References addSpecialEffect(), and mAwayEffect.

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

4846 {
4848 }
static int mAwayEffect
Definition: being.h:1346
void addSpecialEffect(const int effect)
Definition: being.cpp:4855

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

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

Referenced by getGroupId(), and EAthena::BeingRecv::processSkillCastingContinue().

5295 {
5296  if (waitTimeTicks <= 0)
5297  {
5298  mCastEndTime = 0;
5299  return;
5300  }
5301  mCastEndTime = tick_time + waitTimeTicks;
5303  skillId,
5304  skillLevel);
5306  if (data != nullptr)
5307  {
5308  const std::string castingAnimation = data->castingAnimation;
5309  mCastingEffect = new CastingEffect(skillId,
5310  skillLevel,
5311  castingAnimation,
5312  dstX,
5313  dstY,
5314  range);
5316  }
5317  else
5318  {
5319  reportAlways("Want to draw casting for unknown skill %d",
5320  skillId);
5321  }
5322 }
volatile int tick_time
Definition: timer.cpp:52
CastingEffect * mCastingEffect
Definition: being.h:1174
#define delete2(var)
Definition: delete2.h:24
std::string castingAnimation
Definition: skilldata.h:41
SkillData * getSkillDataByLevel(const int id, const int level) const
uint32_t data
int mCastEndTime
Definition: being.h:1365
virtual void setMap(Map *const map)
Definition: actor.cpp:47
SkillDialog * skillDialog
Definition: skilldialog.cpp:65
#define reportAlways(...)
Definition: checkutils.h:252
Map * mMap
Definition: actor.h:138

◆ addEffect()

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

Definition at line 4884 of file being.cpp.

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

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

4885 {
4886  delete mAnimationEffect;
4888  paths.getStringValue("sprites") + name);
4889 }
std::string getStringValue(const std::string &key) const
AnimatedSprite * mAnimationEffect
Definition: being.h:1173
static AnimatedSprite * load(const std::string &filename, const int variant=0)
Configuration paths

◆ addGuild()

void Being::addGuild ( Guild *const  guild)

Adds a guild to the being.

Definition at line 1198 of file being.cpp.

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

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

1199 {
1200  if (guild == nullptr)
1201  return;
1202 
1203  mGuilds[guild->getId()] = guild;
1204 
1205  if (this == localPlayer && (socialWindow != nullptr))
1206  socialWindow->addTab(guild);
1207 }
int16_t getId() const
Definition: guild.h:127
bool addTab(Guild *const guild)
LocalPlayer * localPlayer
SocialWindow * socialWindow
std::map< int, Guild * > mGuilds
Definition: being.h:1207
uint32_t guild

◆ addItemParticles()

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

Definition at line 4968 of file being.cpp.

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

Referenced by getAllowNpcEquipment(), setHairTempSprite(), setSpriteColor(), setSpriteColorId(), setSpriteId(), and setTempSprite().

4970 {
4971  const SpriteParticleInfoIter it = mSpriteParticles.find(id);
4972  ParticleInfo *restrict pi = nullptr;
4973  if (it == mSpriteParticles.end())
4974  {
4975  pi = new ParticleInfo;
4976  mSpriteParticles[id] = pi;
4977  }
4978  else
4979  {
4980  pi = (*it).second;
4981  }
4982 
4983  if ((pi == nullptr) || !pi->particles.empty())
4984  return;
4985 
4986  // setup particle effects
4988  (particleEngine != nullptr))
4989  {
4990  FOR_EACH (StringVectCIter, itr, display.particles)
4991  {
4992  Particle *const p = particleEngine->addEffect(*itr, 0, 0);
4994  pi->files.push_back(*itr);
4995  pi->particles.push_back(p);
4996  }
4997  }
4998  else
4999  {
5000  FOR_EACH (StringVectCIter, itr, display.particles)
5001  pi->files.push_back(*itr);
5002  }
5003 }
SpriteParticleInfo mSpriteParticles
Definition: being.h:1204
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
static bool enabled
StringVect::const_iterator StringVectCIter
Definition: stringvector.h:30
ParticleEngine * particleEngine
SpriteParticleInfo::iterator SpriteParticleInfoIter
Definition: being.h:1201
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation=0)
void controlCustomParticle(Particle *const particle)
StringVect particles
Definition: spritedisplay.h:47
#define restrict
Definition: localconsts.h:176

◆ addItemParticlesCards()

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

Definition at line 5005 of file being.cpp.

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

Referenced by getAllowNpcEquipment(), and setSpriteCards().

5008 {
5009  const SpriteParticleInfoIter it = mSpriteParticles.find(id);
5010  ParticleInfo *restrict pi = nullptr;
5011  if (it == mSpriteParticles.end())
5012  {
5013  pi = new ParticleInfo;
5014  mSpriteParticles[id] = pi;
5015  }
5016  else
5017  {
5018  pi = (*it).second;
5019  }
5020 
5021  if ((pi == nullptr) || !pi->particles.empty())
5022  return;
5023 
5024  // setup particle effects
5026  (particleEngine != nullptr))
5027  {
5028  FOR_EACH (StringVectCIter, itr, display.particles)
5029  {
5030  Particle *const p = particleEngine->addEffect(*itr, 0, 0);
5032  pi->files.push_back(*itr);
5033  pi->particles.push_back(p);
5034  }
5035  for (int f = 0; f < maxCards; f ++)
5036  {
5037  const int cardId = cards.cards[f];
5038  if (!Item::isItem(cardId))
5039  continue;
5040  const ItemInfo &info = ItemDB::get(cardId);
5041  const SpriteDisplay &restrict display2 = info.getDisplay();
5042  FOR_EACH (StringVectCIter, itr, display2.particles)
5043  {
5044  Particle *const p = particleEngine->addEffect(*itr, 0, 0);
5046  pi->files.push_back(*itr);
5047  pi->particles.push_back(p);
5048  }
5049  }
5050  }
5051  else
5052  {
5053  FOR_EACH (StringVectCIter, itr, display.particles)
5054  {
5055  pi->files.push_back(*itr);
5056  }
5057  for (int f = 0; f < maxCards; f ++)
5058  {
5059  const int cardId = cards.cards[f];
5060  if (!Item::isItem(cardId))
5061  continue;
5062  const ItemInfo &info = ItemDB::get(cardId);
5063  const SpriteDisplay &restrict display2 = info.getDisplay();
5064  FOR_EACH (StringVectCIter, itr, display2.particles)
5065  {
5066  pi->files.push_back(*itr);
5067  }
5068  }
5069  }
5070 }
int cards[4]
Definition: cardslist.h:67
SpriteParticleInfo mSpriteParticles
Definition: being.h:1204
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
static bool enabled
const ItemInfo & get(const int id)
Definition: itemdb.cpp:814
StringVect::const_iterator StringVectCIter
Definition: stringvector.h:30
ParticleEngine * particleEngine
SpriteParticleInfo::iterator SpriteParticleInfoIter
Definition: being.h:1201
Particle * addEffect(const std::string &particleEffectFile, const int pixelX, const int pixelY, const int rotation=0)
void controlCustomParticle(Particle *const particle)
bool info(InputEvent &event)
Definition: commands.cpp:56
StringVect particles
Definition: spritedisplay.h:47
const SpriteDisplay & getDisplay() const
Definition: iteminfo.h:93
static bool isItem(const int id)
Definition: item.h:237
#define restrict
Definition: localconsts.h:176
#define maxCards
Definition: cards.h:24

◆ addSpecialEffect()

void Being::addSpecialEffect ( const int  effect)

Definition at line 4855 of file being.cpp.

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

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

4856 {
4857  if ((effectManager != nullptr) &&
4859  (mSpecialParticle == nullptr) &&
4860  effect != -1)
4861  {
4863  }
4864 }
static bool enabled
Particle * triggerReturn(const int id, Being *const being, const int rotation=0)
Particle * mSpecialParticle
Definition: being.h:1304
EffectManager * effectManager

◆ addSpiritBalls()

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

Definition at line 5415 of file being.cpp.

References effectManager, mSpiritParticles, and EffectManager::triggerReturn().

Referenced by setSpiritBalls().

5417 {
5418  if (effectManager == nullptr)
5419  return;
5420  for (unsigned int f = 0; f < balls; f ++)
5421  {
5422  Particle *const particle = effectManager->triggerReturn(
5423  effectId,
5424  this);
5425  mSpiritParticles.push_back(particle);
5426  }
5427 }
Particle * triggerReturn(const int id, Being *const being, const int rotation=0)
std::vector< Particle * > mSpiritParticles
Definition: being.h:1309
EffectManager * effectManager

◆ addToCache()

void Being::addToCache ( ) const

Definition at line 3446 of file being.cpp.

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 getReachable(), ActorManager::logic(), ActorManager::parseLevels(), Ea::BeingRecv::processNameResponse(), EAthena::BeingRecv::processNameResponse2(), TmwAthena::BeingRecv::processPlayerGuilPartyInfo(), EAthena::BeingRecv::processPlayerGuilPartyInfo(), TmwAthena::BeingRecv::processPvpSet(), setAdvanced(), and setState().

3447 {
3448  if (localPlayer == this)
3449  return;
3450 
3452  if (entry == nullptr)
3453  {
3454  entry = new BeingCacheEntry(getId());
3455  beingInfoCache.push_front(entry);
3456 
3457  if (beingInfoCache.size() >= CACHE_SIZE)
3458  {
3459  delete beingInfoCache.back();
3460  beingInfoCache.pop_back();
3461  }
3462  }
3463  if (!mLowTraffic)
3464  return;
3465 
3466  entry->setName(mName);
3467  entry->setLevel(getLevel());
3468  entry->setPartyName(getPartyName());
3469  entry->setGuildName(getGuildName());
3470  entry->setTime(cur_time);
3471  entry->setPvpRank(getPvpRank());
3472  entry->setIp(getIp());
3473  entry->setAdvanced(isAdvanced());
3474  entry->setTeamId(getTeamId());
3475  if (isAdvanced())
3476  {
3477  int flags = 0;
3479  flags += BeingFlag::SHOP;
3480  if (mAway)
3481  flags += BeingFlag::AWAY;
3482  if (mInactive)
3483  flags += BeingFlag::INACTIVE;
3484  entry->setFlags(flags);
3485  }
3486  else
3487  {
3488  entry->setFlags(0);
3489  }
3490 }
void setTime(const time_t n)
void setLevel(const int n)
const unsigned int CACHE_SIZE
Definition: being.cpp:126
const std::string & getPartyName() const
Definition: being.h:256
void setAdvanced(const bool a)
BeingId getId() const
Definition: actorsprite.h:63
void setPvpRank(const int r)
void setFlags(const int flags)
static bool mLowTraffic
Definition: being.h:1333
void setGuildName(const std::string &name)
std::string mName
Definition: being.h:1178
bool mInactive
Definition: being.h:1380
void setPartyName(const std::string &name)
LocalPlayer * localPlayer
bool mShop
Definition: being.h:1378
std::list< BeingCacheEntry * > beingInfoCache
Definition: being.cpp:149
volatile time_t cur_time
Definition: timer.cpp:57
void setIp(const std::string &ip)
ServerTypeT getNetworkType()
Definition: net.cpp:178
bool isAdvanced() const
Definition: being.h:823
unsigned int getPvpRank() const
Definition: being.h:744
bool mAway
Definition: being.h:1379
static BeingCacheEntry * getCacheEntry(const BeingId id)
Definition: being.cpp:3492
uint16_t getTeamId() const
Definition: being.h:1079
virtual int getLevel() const
Definition: being.h:599
void setTeamId(const uint16_t teamId)
const std::string & getIp() const
Definition: being.h:738
void setName(const std::string &name)
const std::string & getGuildName() const
Definition: being.h:260

◆ botFixOffset()

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

Definition at line 2039 of file being.cpp.

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().

2041 {
2042  if ((mInfo == nullptr) || (mOwner == nullptr))
2043  return;
2044 
2045  int offsetX1;
2046  int offsetY1;
2047  switch (mOwner->getCurrentAction())
2048  {
2049  case BeingAction::SIT:
2050  offsetX1 = mInfo->getSitOffsetX();
2051  offsetY1 = mInfo->getSitOffsetY();
2052  break;
2053 
2054  case BeingAction::MOVE:
2055  offsetX1 = mInfo->getMoveOffsetX();
2056  offsetY1 = mInfo->getMoveOffsetY();
2057  break;
2058 
2059  case BeingAction::DEAD:
2060  offsetX1 = mInfo->getDeadOffsetX();
2061  offsetY1 = mInfo->getDeadOffsetY();
2062  break;
2063 
2064  case BeingAction::ATTACK:
2065  offsetX1 = mInfo->getAttackOffsetX();
2066  offsetY1 = mInfo->getAttackOffsetY();
2067  break;
2068 
2069  case BeingAction::SPAWN:
2070  case BeingAction::HURT:
2071  case BeingAction::STAND:
2072  case BeingAction::PRESTAND:
2073  case BeingAction::CAST:
2074  default:
2075  offsetX1 = mInfo->getTargetOffsetX();
2076  offsetY1 = mInfo->getTargetOffsetY();
2077  break;
2078  }
2079 
2080  int offsetX = offsetX1;
2081  int offsetY = offsetY1;
2082  switch (mOwner->mDirection)
2083  {
2084  case BeingDirection::LEFT:
2085  offsetX = -offsetY1;
2086  offsetY = offsetX1;
2087  break;
2088  case BeingDirection::RIGHT:
2089  offsetX = offsetY1;
2090  offsetY = -offsetX1;
2091  break;
2092  case BeingDirection::UP:
2093  offsetY = -offsetY;
2094  offsetX = -offsetX;
2095  break;
2096  default:
2097  case BeingDirection::DOWN:
2098  break;
2099  }
2100  dstX += offsetX;
2101  dstY += offsetY;
2102  if (mMap != nullptr)
2103  {
2104  if (!mMap->getWalk(dstX, dstY, getBlockWalkMask()))
2105  {
2106  dstX = mOwner->mX;
2107  dstY = mOwner->mY;
2108  }
2109  }
2110 }
uint8_t mDirection
Definition: being.h:1228
int getDeadOffsetX() const
Definition: beinginfo.h:266
virtual unsigned char getBlockWalkMask() const
Definition: being.h:427
int getDeadOffsetY() const
Definition: beinginfo.h:272
int getTargetOffsetX() const
Definition: beinginfo.h:134
int getSitOffsetY() const
Definition: beinginfo.h:248
int mX
Definition: being.h:1311
int getSitOffsetX() const
Definition: beinginfo.h:242
BeingActionT getCurrentAction() const
Definition: being.h:477
bool getWalk(const int x, const int y, const unsigned char blockWalkMask) const
Definition: map.cpp:773
int getMoveOffsetY() const
Definition: beinginfo.h:260
int getMoveOffsetX() const
Definition: beinginfo.h:254
int getAttackOffsetY() const
Definition: beinginfo.h:284
int mY
Definition: being.h:1312
int getAttackOffsetX() const
Definition: beinginfo.h:278
Being * mOwner
Definition: being.h:1303
int getTargetOffsetY() const
Definition: beinginfo.h:140
BeingInfo * mInfo
Definition: being.h:1171
Map * mMap
Definition: actor.h:138

◆ botLogic()

void Being::botLogic ( )

Definition at line 1955 of file being.cpp.

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, ServerCommandType::time, and updateBotFollow().

Referenced by getNumberOfLayers(), and logic().

1956 {
1957  if ((mOwner == nullptr) || (mMap == nullptr) || (mInfo == nullptr))
1958  return;
1959 
1960  const int time = tick_time;
1961  const int thinkTime = mInfo->getThinkTime();
1962  if (abs(CAST_S32(mMoveTime) - time) < thinkTime)
1963  return;
1964 
1965  mMoveTime = time;
1966 
1967  int dstX = mOwner->mX;
1968  int dstY = mOwner->mY;
1969  const int warpDist = mInfo->getWarpDist();
1970  const int divX = abs(dstX - mX);
1971  const int divY = abs(dstY - mY);
1972 
1973  if (divX >= warpDist || divY >= warpDist)
1974  {
1977  else
1979  mBotAi = true;
1980  return;
1981  }
1982  if (!mBotAi)
1983  return;
1984  if (mAction == BeingAction::MOVE)
1985  {
1987  {
1988  updateBotFollow(dstX, dstY,
1989  divX, divY);
1990  }
1991  return;
1992  }
1993 
1994  switch (mOwner->mAction)
1995  {
1996  case BeingAction::MOVE:
1997  case BeingAction::PRESTAND:
1998  updateBotFollow(dstX, dstY,
1999  divX, divY);
2000  break;
2001  case BeingAction::STAND:
2002  case BeingAction::SPAWN:
2003  botFixOffset(dstX, dstY);
2004  moveBotTo(dstX, dstY);
2005  break;
2006  case BeingAction::ATTACK:
2007  {
2008  const Being *const target = localPlayer->getTarget();
2009  if (target == nullptr)
2010  return;
2011  const BeingId targetId = target->getId();
2013  {
2014  homunculusHandler->attack(targetId,
2015  Keep_true);
2016  }
2017  else
2018  {
2019  mercenaryHandler->attack(targetId,
2020  Keep_true);
2021  }
2022  break;
2023  }
2024  case BeingAction::SIT:
2025  botFixOffset(dstX, dstY);
2026  moveBotTo(dstX, dstY);
2027  break;
2028  case BeingAction::DEAD:
2029  botFixOffset(dstX, dstY);
2030  moveBotTo(dstX, dstY);
2031  break;
2032  case BeingAction::CAST:
2033  case BeingAction::HURT:
2034  default:
2035  break;
2036  }
2037 }
virtual void attack(const BeingId targetId, const Keep keep) const =0
bool mBotAi
Definition: being.h:1382
volatile int tick_time
Definition: timer.cpp:52
const bool Keep_true
Definition: keep.h:29
BeingId getId() const
Definition: actorsprite.h:63
int BeingId
Definition: beingid.h:29
virtual void moveToMaster() const =0
virtual void moveToMaster() const =0
#define CAST_S32
Definition: cast.h:29
int mX
Definition: being.h:1311
time_t mMoveTime
Definition: being.h:1349
LocalPlayer * localPlayer
Net::MercenaryHandler * mercenaryHandler
Definition: net.cpp:108
int getThinkTime() const
Definition: beinginfo.h:290
virtual void attack(const BeingId targetId, const Keep keep) const =0
Net::HomunculusHandler * homunculusHandler
Definition: net.cpp:103
int mY
Definition: being.h:1312
void moveBotTo(int dstX, int dstY)
Definition: being.cpp:2151
Being * mOwner
Definition: being.h:1303
int getWarpDist() const
Definition: beinginfo.h:236
Definition: being.h:93
void botFixOffset(int &dstX, int &dstY) const
Definition: being.cpp:2039
BeingInfo * mInfo
Definition: being.h:1171
BeingActionT mAction
Definition: being.h:1226
void updateBotFollow(int dstX, int dstY, const int divX, const int divY)
Definition: being.cpp:2112
Being * getTarget() const
const ActorTypeT mType
Definition: being.h:1284
Map * mMap
Definition: actor.h:138

◆ calcDirection() [1/2]

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

Definition at line 1726 of file being.cpp.

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

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

1728 {
1729  uint8_t dir = 0;
1730  if (dstX > mX)
1731  dir |= BeingDirection::RIGHT;
1732  else if (dstX < mX)
1733  dir |= BeingDirection::LEFT;
1734  if (dstY > mY)
1735  dir |= BeingDirection::DOWN;
1736  else if (dstY < mY)
1737  dir |= BeingDirection::UP;
1738  return dir;
1739 }
int mX
Definition: being.h:1311
int mY
Definition: being.h:1312

◆ calcDirection() [2/2]

uint8_t Being::calcDirection ( ) const

Definition at line 1712 of file being.cpp.

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

Referenced by getMaxHP(), handleAttack(), handleSkill(), and nextTile().

1713 {
1714  uint8_t dir = 0;
1715  if (mDest.x > mX)
1716  dir |= BeingDirection::RIGHT;
1717  else if (mDest.x < mX)
1718  dir |= BeingDirection::LEFT;
1719  if (mDest.y > mY)
1720  dir |= BeingDirection::DOWN;
1721  else if (mDest.y < mY)
1722  dir |= BeingDirection::UP;
1723  return dir;
1724 }
Vector mDest
Definition: being.h:1198
int mX
Definition: being.h:1311
float x
Definition: vector.h:208
int mY
Definition: being.h:1312
float y
Definition: vector.h:208

◆ canTalk()

bool Being::canTalk ( ) const
inline

Definition at line 662 of file being.h.

References A_NONNULL, draw(), drawBasic(), drawMonster(), drawNpc(), drawOther(), drawPlayer(), drawPortal(), mType, ActorType::Npc, restrict, restrict2, and talkTo().

Referenced by Actions::doSit(), and Viewport::drawPath().

663  { return mType == ActorType::Npc; }
const ActorTypeT mType
Definition: being.h:1284

◆ clearCache()

void Being::clearCache ( )
static

Definition at line 4646 of file being.cpp.

References beingInfoCache, and delete_all().

Referenced by Game::~Game().

4647 {
4649  beingInfoCache.clear();
4650 }
void delete_all(Container &c)
Definition: dtor.h:55
std::list< BeingCacheEntry * > beingInfoCache
Definition: being.cpp:149

◆ clearGuilds()

void Being::clearGuilds ( )

Removes all guilds the being is in.

Definition at line 1250 of file being.cpp.

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

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

1251 {
1253  {
1254  Guild *const guild = itr->second;
1255 
1256  if (guild != nullptr)
1257  {
1258  if (this == localPlayer && (socialWindow != nullptr))
1259  socialWindow->removeTab(guild);
1260 
1261  guild->removeMember(mId);
1262  }
1263  }
1264 
1265  mGuilds.clear();
1266 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
bool removeTab(Guild *const guild)
void removeMember(const GuildMember *const member)
Definition: guild.cpp:186
LocalPlayer * localPlayer
SocialWindow * socialWindow
std::map< int, Guild * >::const_iterator GuildsMapCIter
Definition: being.cpp:150
std::map< int, Guild * > mGuilds
Definition: being.h:1207
uint32_t guild
Definition: guild.h:68
BeingId mId
Definition: actorsprite.h:255

◆ clearPath()

void Being::clearPath ( )

Removes all path nodes from this being.

Definition at line 549 of file being.cpp.

References mPath.

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

550 {
551  mPath.clear();
552 }
Path mPath
Definition: being.h:1194

◆ createBeing()

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

Definition at line 5493 of file being.cpp.

References Being(), and postInit().

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

5497 {
5498  Being *const being = new Being(id,
5499  type);
5500  being->postInit(subType,
5501  map);
5502  return being;
5503 }
Being(const BeingId id, const ActorTypeT type)
Definition: being.cpp:163
void postInit(const BeingTypeId subType, Map *const map)
Definition: being.cpp:289
Definition: being.h:93

◆ createSpeechBubble()

void Being::createSpeechBubble ( )
protected

Definition at line 366 of file being.cpp.

References CREATEWIDGETV0, and mSpeechBubble.

Referenced by getAllowNpcEquipment(), and setSpeech().

367 {
369 }
#define CREATEWIDGETV0(var, type)
Definition: createwidget.h:31
SpeechBubble * mSpeechBubble
Definition: being.h:1287

◆ decUsage()

int Being::decUsage ( )
inline

Definition at line 970 of file being.h.

References mUsageCounter.

971  { return --mUsageCounter; }
int mUsageCounter
Definition: being.h:1361

◆ disableBotAi()

void Being::disableBotAi ( )
inline

Definition at line 1042 of file being.h.

References mBotAi.

1043  { mBotAi = false; }
bool mBotAi
Definition: being.h:1382

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

References ActorType::Avatar, drawElemental(), drawHomunculus(), drawMercenary(), drawMonster(), drawNpc(), drawOther(), drawPlayer(), drawPortal(), ActorType::Elemental, ActorType::FloorItem, ActorType::Homunculus, ActorType::Mercenary, ActorType::Monster, mType, ActorType::Npc, ActorType::Pet, ActorType::Player, ActorType::Portal, ActorType::SkillUnit, and ActorType::Unknown.

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

3775 {
3776  switch (mType)
3777  {
3778  case ActorType::Player:
3779  drawPlayer(graphics,
3780  offsetX,
3781  offsetY);
3782  break;
3783  case ActorType::Portal:
3784  drawPortal(graphics,
3785  offsetX,
3786  offsetY);
3787  break;
3788  case ActorType::Homunculus:
3789  drawHomunculus(graphics,
3790  offsetX,
3791  offsetY);
3792  break;
3793  case ActorType::Mercenary:
3794  drawMercenary(graphics,
3795  offsetX,
3796  offsetY);
3797  break;
3798  case ActorType::Elemental:
3799  drawElemental(graphics,
3800  offsetX,
3801  offsetY);
3802  break;
3803  case ActorType::Monster:
3804  drawMonster(graphics,
3805  offsetX,
3806  offsetY);
3807  break;
3808  case ActorType::Npc:
3809  drawNpc(graphics,
3810  offsetX,
3811  offsetY);
3812  break;
3813  case ActorType::Pet:
3814  case ActorType::SkillUnit:
3815  case ActorType::Unknown:
3816  case ActorType::FloorItem:
3817  case ActorType::Avatar:
3818  default:
3819  drawOther(graphics,
3820  offsetX,
3821  offsetY);
3822  break;
3823  }
3824 }
void drawMonster(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3713
void drawNpc(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3701
void drawPlayer(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3627
void drawMercenary(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3737
void drawPortal(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3761
void drawElemental(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3749
void drawHomunculus(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3725
void drawOther(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3689
const ActorTypeT mType
Definition: being.h:1284

◆ drawBasic()

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

Definition at line 3863 of file being.cpp.

References drawCompound(), x, and y.

Referenced by canTalk(), and PlayerBox::draw().

3866 {
3867  drawCompound(graphics, x, y);
3868 }
void drawCompound(Graphics *const graphics, const int posX, const int posY) const
Definition: being.cpp:3870

◆ drawBeingCursor()

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

Definition at line 3667 of file being.cpp.

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

Referenced by drawElemental(), drawHomunculus(), drawMercenary(), drawMonster(), drawNpc(), drawOther(), and drawPlayer().

3670 {
3671  if (mUsedTargetCursor != nullptr)
3672  {
3674  if (mInfo == nullptr)
3675  {
3676  mUsedTargetCursor->draw(graphics,
3677  offsetX - mCursorPaddingX,
3678  offsetY - mCursorPaddingY);
3679  }
3680  else
3681  {
3682  mUsedTargetCursor->draw(graphics,
3683  offsetX + mInfo->getTargetOffsetX() - mCursorPaddingX,
3684  offsetY + mInfo->getTargetOffsetY() - mCursorPaddingY);
3685  }
3686  }
3687 }
volatile int tick_time
Definition: timer.cpp:52
int mCursorPaddingX
Definition: actorsprite.h:264
void draw(Graphics *const graphics, const int posX, const int posY) const
int getTargetOffsetX() const
Definition: beinginfo.h:134
AnimatedSprite * mUsedTargetCursor
Definition: actorsprite.h:258
static const int MILLISECONDS_IN_A_TICK
Definition: timer.h:29
int mCursorPaddingY
Definition: actorsprite.h:265
int getTargetOffsetY() const
Definition: beinginfo.h:140
bool update(const int time)
BeingInfo * mInfo
Definition: being.h:1171

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

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().

Referenced by drawBasic(), drawNpcSpriteAt(), drawPlayerSpriteAt(), and getAllowNpcEquipment().

3873 {
3874  FUNC_BLOCK("CompoundSprite::draw", 1)
3875  if (mNeedsRedraw)
3876  updateImages();
3877 
3878  if (mSprites.empty()) // Nothing to draw
3879  return;
3880 
3881  if (mAlpha == 1.0F && (mImage != nullptr))
3882  {
3883  graphics->drawImage(mImage,
3884  posX + mOffsetX,
3885  posY + mOffsetY);
3886  }
3887  else if ((mAlpha != 0.0f) && (mAlphaImage != nullptr))
3888  {
3890  graphics->drawImage(mAlphaImage,
3891  posX + mOffsetX,
3892  posY + mOffsetY);
3893  }
3894  else
3895  {
3896  Being::drawPlayerSprites(graphics, posX, posY);
3897  }
3898 }
if(!vert) return
virtual void setAlpha(const float alpha)
Definition: image.cpp:285
std::vector< Sprite * > mSprites
void drawPlayerSprites(Graphics *const graphics, const int posX, const int posY) const
Definition: being.cpp:3826
#define FUNC_BLOCK(name, id)
Definition: perfomance.h:80
std::string empty
Definition: podict.cpp:25
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
void updateImages() const
float mAlpha
Definition: sprite.h:129

◆ drawElemental()

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

Definition at line 3749 of file being.cpp.

References drawBeingCursor(), drawElementalSpriteAt(), mapTileSize, Actor::mPixelX, and Actor::mPixelY.

Referenced by draw(), and getLastAttackY().

3752 {
3753  // getActorX() + offsetX;
3754  const int px = mPixelX - mapTileSize / 2 + offsetX;
3755  // getActorY() + offsetY;
3756  const int py = mPixelY - mapTileSize + offsetY;
3757  drawBeingCursor(graphics, px, py);
3758  drawElementalSpriteAt(graphics, px, py);
3759 }
void drawBeingCursor(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3667
void drawElementalSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:4102
int mPixelX
Definition: actor.h:132
int mPixelY
Definition: actor.h:133
static const int mapTileSize
Definition: map.h:26

◆ drawElementalSpriteAt()

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

Definition at line 4102 of file being.cpp.

References BeingAction::DEAD, drawHpBar(), CompoundSprite::drawSimple(), UserColorId::ELEMENTAL_HP, Attributes::ELEMENTAL_HP, UserColorId::ELEMENTAL_HP2, Attributes::ELEMENTAL_MAX_HP, UserPalette::getColorWithAlpha(), PlayerInfo::getElementalId(), BeingInfo::getHpBarOffsetX(), BeingInfo::getHpBarOffsetY(), BeingInfo::getMaxHP(), PlayerInfo::getStatBase(), mAction, mapTileSize, mAttackRange, mDamageTaken, mHighlightMonsterAttackRange, ActorSprite::mId, mInfo, UserColorId::MONSTER_ATTACK_RANGE, mShowMobHP, userPalette, x, and y.

Referenced by drawElemental(), and getAllowNpcEquipment().

4105 {
4108  {
4109  if (userPalette == nullptr)
4110  {
4111  CompoundSprite::drawSimple(graphics, x, y);
4112  return;
4113  }
4114 
4115  int attackRange;
4116  if (mAttackRange != 0)
4117  attackRange = mapTileSize * mAttackRange;
4118  else
4119  attackRange = mapTileSize;
4120 
4123 
4124  graphics->fillRectangle(Rect(
4125  x - attackRange, y - attackRange,
4126  2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
4127  }
4128 
4129  CompoundSprite::drawSimple(graphics, x, y);
4130 
4131  if (mShowMobHP &&
4132  (mInfo != nullptr))
4133  {
4135  {
4136  // show hp bar here
4138  if (maxHP == 0)
4139  maxHP = mInfo->getMaxHP();
4140 
4141  drawHpBar(graphics,
4142  maxHP,
4144  mDamageTaken,
4147  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
4148  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
4149  2 * 50,
4150  4);
4151  }
4152  }
4153 }
const Color & getColorWithAlpha(const UserColorIdT type)
Definition: userpalette.h:199
int getHpBarOffsetY() const
Definition: beinginfo.h:164
Definition: rect.h:72
void drawSimple(Graphics *const graphics, const int posX, const int posY) const
UserPalette * userPalette
Definition: userpalette.cpp:33
static bool mHighlightMonsterAttackRange
Definition: being.h:1332
virtual void setColor(const Color &color)
Definition: graphics.h:319
static bool mShowMobHP
Definition: being.h:1336
int mDamageTaken
Definition: being.h:1321
int getStatBase(const AttributesT id)
Definition: playerinfo.cpp:133
BeingId getElementalId()
Definition: playerinfo.cpp:555
virtual void fillRectangle(const Rect &rectangle)=0
int getHpBarOffsetX() const
Definition: beinginfo.h:158
void drawHpBar(Graphics *const graphics, const int maxHP, const int hp, const int damage, const UserColorIdT color1, const UserColorIdT color2, const int x, const int y, const int width, const int height) const
Definition: being.cpp:4185
static const int mapTileSize
Definition: map.h:26
int mAttackRange
Definition: being.h:1219
int getMaxHP() const
Definition: beinginfo.h:170
BeingId mId
Definition: actorsprite.h:255
BeingInfo * mInfo
Definition: being.h:1171
BeingActionT mAction
Definition: being.h:1226

◆ drawEmotion()

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

Draws the emotion picture above the being.

Definition at line 2334 of file being.cpp.

References AnimatedSprite::draw(), for_each_badges, BadgeDrawType::Hide, mAnimationEffect, mapTileSize, mBadges, mBadgesCount, mBadgesX, mBadgesY, mEmotionSprite, mErased, Actor::mPixelX, Actor::mPixelY, mShowBadges, restrict, x, and y.

Referenced by getNumberOfLayers().

2337 {
2338  if (mErased)
2339  return;
2340 
2341  const int px = mPixelX - offsetX - mapTileSize / 2;
2342  const int py = mPixelY - offsetY - mapTileSize * 2 - mapTileSize;
2343  if (mAnimationEffect != nullptr)
2344  mAnimationEffect->draw(graphics, px, py);
2346  mBadgesCount != 0u)
2347  {
2348  int x = mBadgesX - offsetX;
2349  const int y = mBadgesY - offsetY;
2350  for_each_badges()
2351  {
2352  const AnimatedSprite *restrict const sprite = mBadges[f];
2353  if (sprite != nullptr)
2354  {
2355  sprite->draw(graphics, x, y);
2356  x += 16;
2357  }
2358  }
2359  }
2360  if (mEmotionSprite != nullptr)
2361  mEmotionSprite->draw(graphics, px, py);
2362 }
void draw(Graphics *const graphics, const int posX, const int posY) const
AnimatedSprite * mAnimationEffect
Definition: being.h:1173
bool mErased
Definition: being.h:1374
int mPixelX
Definition: actor.h:132
AnimatedSprite * mBadges[BadgeIndex::BadgeIndexSize]
Definition: being.h:1175
#define for_each_badges()
Definition: being.cpp:157
int mPixelY
Definition: actor.h:133
AnimatedSprite * mEmotionSprite
Definition: being.h:1172
int mBadgesX
Definition: being.h:1367
int mBadgesY
Definition: being.h:1368
static BadgeDrawType::Type mShowBadges
Definition: being.h:1345
static const int mapTileSize
Definition: map.h:26
#define restrict
Definition: localconsts.h:176
uint16_t mBadgesCount
Definition: being.h:1372

◆ drawHomunculus()

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

Definition at line 3725 of file being.cpp.

References drawBeingCursor(), drawHomunculusSpriteAt(), mapTileSize, Actor::mPixelX, and Actor::mPixelY.

Referenced by draw(), and getLastAttackY().

3728 {
3729  // getActorX() + offsetX;
3730  const int px = mPixelX - mapTileSize / 2 + offsetX;
3731  // getActorY() + offsetY;
3732  const int py = mPixelY - mapTileSize + offsetY;
3733  drawBeingCursor(graphics, px, py);
3734  drawHomunculusSpriteAt(graphics, px, py);
3735 }
void drawHomunculusSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:3992
void drawBeingCursor(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3667
int mPixelX
Definition: actor.h:132
int mPixelY
Definition: actor.h:133
static const int mapTileSize
Definition: map.h:26

◆ drawHomunculusSpriteAt()

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

Definition at line 3992 of file being.cpp.

References BeingAction::DEAD, drawHpBar(), CompoundSprite::drawSimple(), UserPalette::getColorWithAlpha(), PlayerInfo::getHomunculus(), BeingInfo::getHpBarOffsetX(), BeingInfo::getHpBarOffsetY(), BeingInfo::getMaxHP(), PlayerInfo::getStatBase(), UserColorId::HOMUN_HP, Attributes::HOMUN_HP, UserColorId::HOMUN_HP2, Attributes::HOMUN_MAX_HP, HomunculusInfo::id, Actions::info(), mAction, mapTileSize, mAttackRange, mDamageTaken, mHighlightMonsterAttackRange, ActorSprite::mId, mInfo, UserColorId::MONSTER_ATTACK_RANGE, mShowMobHP, userPalette, x, and y.

Referenced by drawHomunculus(), and getAllowNpcEquipment().

3995 {
3998  {
3999  if (userPalette == nullptr)
4000  {
4001  CompoundSprite::drawSimple(graphics, x, y);
4002  return;
4003  }
4004 
4005  int attackRange;
4006  if (mAttackRange != 0)
4007  attackRange = mapTileSize * mAttackRange;
4008  else
4009  attackRange = mapTileSize;
4010 
4013 
4014  graphics->fillRectangle(Rect(
4015  x - attackRange, y - attackRange,
4016  2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
4017  }
4018 
4019  CompoundSprite::drawSimple(graphics, x, y);
4020 
4021  if (mShowMobHP &&
4022  (mInfo != nullptr))
4023  {
4025  if ((info != nullptr) &&
4026  mId == info->id)
4027  {
4028  // show hp bar here
4030  if (maxHP == 0)
4031  maxHP = mInfo->getMaxHP();
4032 
4033  drawHpBar(graphics,
4034  maxHP,
4036  mDamageTaken,
4039  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
4040  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
4041  2 * 50,
4042  4);
4043  }
4044  }
4045 }
const Color & getColorWithAlpha(const UserColorIdT type)
Definition: userpalette.h:199
int getHpBarOffsetY() const
Definition: beinginfo.h:164
Definition: rect.h:72
void drawSimple(Graphics *const graphics, const int posX, const int posY) const
UserPalette * userPalette
Definition: userpalette.cpp:33
static bool mHighlightMonsterAttackRange
Definition: being.h:1332
virtual void setColor(const Color &color)
Definition: graphics.h:319
static bool mShowMobHP
Definition: being.h:1336
bool info(InputEvent &event)
Definition: commands.cpp:56
int mDamageTaken
Definition: being.h:1321
int getStatBase(const AttributesT id)
Definition: playerinfo.cpp:133
virtual void fillRectangle(const Rect &rectangle)=0
int getHpBarOffsetX() const
Definition: beinginfo.h:158
HomunculusInfo * getHomunculus()
Definition: playerinfo.cpp:614
void drawHpBar(Graphics *const graphics, const int maxHP, const int hp, const int damage, const UserColorIdT color1, const UserColorIdT color2, const int x, const int y, const int width, const int height) const
Definition: being.cpp:4185
static const int mapTileSize
Definition: map.h:26
int mAttackRange
Definition: being.h:1219
int getMaxHP() const
Definition: beinginfo.h:170
BeingId mId
Definition: actorsprite.h:255
BeingInfo * mInfo
Definition: being.h:1171
BeingActionT mAction
Definition: being.h:1226

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

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

Referenced by drawElementalSpriteAt(), drawHomunculusSpriteAt(), drawMercenarySpriteAt(), drawMonsterSpriteAt(), drawPlayerSpriteAt(), and setDistance().

4195 {
4196  if (maxHP <= 0 || (userPalette == nullptr))
4197  return;
4198 
4199  float p;
4200 
4201  if (hp != 0)
4202  {
4203  p = static_cast<float>(maxHP) / static_cast<float>(hp);
4204  }
4205  else if (maxHP != damage)
4206  {
4207  p = static_cast<float>(maxHP)
4208  / static_cast<float>(maxHP - damage);
4209  }
4210  else
4211  {
4212  p = 1;
4213  }
4214 
4215  if (p <= 0 || p > width)
4216  return;
4217 
4218  const int dx = static_cast<int>(static_cast<float>(width) / p);
4219 
4220 #ifdef TMWA_SUPPORT
4221  if (!serverFeatures->haveServerHp())
4222  { // old servers
4223  if ((damage == 0 && (this != localPlayer || hp == maxHP))
4224  || (hp == 0 && maxHP == damage))
4225  {
4226  graphics->setColor(userPalette->getColorWithAlpha(color1));
4227  graphics->fillRectangle(Rect(
4228  x, y, dx, height));
4229  return;
4230  }
4231  else if (width - dx <= 0)
4232  {
4233  graphics->setColor(userPalette->getColorWithAlpha(color2));
4234  graphics->fillRectangle(Rect(
4235  x, y, width, height));
4236  return;
4237  }
4238  }
4239  else
4240 #endif // TMWA_SUPPORT
4241  {
4242  if (hp == maxHP)
4243  {
4244  graphics->setColor(userPalette->getColorWithAlpha(color1));
4245  graphics->fillRectangle(Rect(
4246  x, y, dx, height));
4247  return;
4248  }
4249  else if (width - dx <= 0)
4250  {
4251  graphics->setColor(userPalette->getColorWithAlpha(color2));
4252  graphics->fillRectangle(Rect(
4253  x, y, width, height));
4254  return;
4255  }
4256  }
4257 
4258  graphics->setColor(userPalette->getColorWithAlpha(color1));
4259  graphics->fillRectangle(Rect(
4260  x, y, dx, height));
4261 
4262  graphics->setColor(userPalette->getColorWithAlpha(color2));
4263  graphics->fillRectangle(Rect(x + dx, y, width - dx, height));
4264 }
const Color & getColorWithAlpha(const UserColorIdT type)
Definition: userpalette.h:199
Definition: rect.h:72
UserPalette * userPalette
Definition: userpalette.cpp:33
Net::ServerFeatures * serverFeatures
Definition: net.cpp:94
virtual void setColor(const Color &color)
Definition: graphics.h:319
virtual bool haveServerHp() const =0
LocalPlayer * localPlayer
virtual void fillRectangle(const Rect &rectangle)=0

◆ drawMercenary()

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

Definition at line 3737 of file being.cpp.

References drawBeingCursor(), drawMercenarySpriteAt(), mapTileSize, Actor::mPixelX, and Actor::mPixelY.

Referenced by draw(), and getLastAttackY().

3740 {
3741  // getActorX() + offsetX;
3742  const int px = mPixelX - mapTileSize / 2 + offsetX;
3743  // getActorY() + offsetY;
3744  const int py = mPixelY - mapTileSize + offsetY;
3745  drawBeingCursor(graphics, px, py);
3746  drawMercenarySpriteAt(graphics, px, py);
3747 }
void drawBeingCursor(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3667
void drawMercenarySpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:4047
int mPixelX
Definition: actor.h:132
int mPixelY
Definition: actor.h:133
static const int mapTileSize
Definition: map.h:26

◆ drawMercenarySpriteAt()

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

Definition at line 4047 of file being.cpp.

References BeingAction::DEAD, drawHpBar(), CompoundSprite::drawSimple(), UserPalette::getColorWithAlpha(), BeingInfo::getHpBarOffsetX(), BeingInfo::getHpBarOffsetY(), BeingInfo::getMaxHP(), PlayerInfo::getMercenary(), PlayerInfo::getStatBase(), MercenaryInfo::id, Actions::info(), mAction, mapTileSize, mAttackRange, mDamageTaken, UserColorId::MERC_HP, Attributes::MERC_HP, UserColorId::MERC_HP2, Attributes::MERC_MAX_HP, mHighlightMonsterAttackRange, ActorSprite::mId, mInfo, UserColorId::MONSTER_ATTACK_RANGE, mShowMobHP, userPalette, x, and y.

Referenced by drawMercenary(), and getAllowNpcEquipment().

4050 {
4053  {
4054  if (userPalette == nullptr)
4055  {
4056  CompoundSprite::drawSimple(graphics, x, y);
4057  return;
4058  }
4059 
4060  int attackRange;
4061  if (mAttackRange != 0)
4062  attackRange = mapTileSize * mAttackRange;
4063  else
4064  attackRange = mapTileSize;
4065 
4068 
4069  graphics->fillRectangle(Rect(
4070  x - attackRange, y - attackRange,
4071  2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
4072  }
4073 
4074  CompoundSprite::drawSimple(graphics, x, y);
4075 
4076  if (mShowMobHP &&
4077  (mInfo != nullptr))
4078  {
4079  const MercenaryInfo *const info = PlayerInfo::getMercenary();
4080  if ((info != nullptr) &&
4081  mId == info->id)
4082  {
4083  // show hp bar here
4085  if (maxHP == 0)
4086  maxHP = mInfo->getMaxHP();
4087 
4088  drawHpBar(graphics,
4089  maxHP,
4091  mDamageTaken,
4094  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
4095  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
4096  2 * 50,
4097  4);
4098  }
4099  }
4100 }
const Color & getColorWithAlpha(const UserColorIdT type)
Definition: userpalette.h:199
int getHpBarOffsetY() const
Definition: beinginfo.h:164
Definition: rect.h:72
void drawSimple(Graphics *const graphics, const int posX, const int posY) const
UserPalette * userPalette
Definition: userpalette.cpp:33
MercenaryInfo * getMercenary()
Definition: playerinfo.cpp:560
static bool mHighlightMonsterAttackRange
Definition: being.h:1332
virtual void setColor(const Color &color)
Definition: graphics.h:319
static bool mShowMobHP
Definition: being.h:1336
bool info(InputEvent &event)
Definition: commands.cpp:56
int mDamageTaken
Definition: being.h:1321
int getStatBase(const AttributesT id)
Definition: playerinfo.cpp:133
virtual void fillRectangle(const Rect &rectangle)=0
int getHpBarOffsetX() const
Definition: beinginfo.h:158
void drawHpBar(Graphics *const graphics, const int maxHP, const int hp, const int damage, const UserColorIdT color1, const UserColorIdT color2, const int x, const int y, const int width, const int height) const
Definition: being.cpp:4185
static const int mapTileSize
Definition: map.h:26
int mAttackRange
Definition: being.h:1219
int getMaxHP() const
Definition: beinginfo.h:170
BeingId mId
Definition: actorsprite.h:255
BeingInfo * mInfo
Definition: being.h:1171
BeingActionT mAction
Definition: being.h:1226

◆ drawMonster()

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

Definition at line 3713 of file being.cpp.

References drawBeingCursor(), drawMonsterSpriteAt(), mapTileSize, Actor::mPixelX, and Actor::mPixelY.

Referenced by canTalk(), and draw().

3716 {
3717  // getActorX() + offsetX;
3718  const int px = mPixelX - mapTileSize / 2 + offsetX;
3719  // getActorY() + offsetY;
3720  const int py = mPixelY - mapTileSize + offsetY;
3721  drawBeingCursor(graphics, px, py);
3722  drawMonsterSpriteAt(graphics, px, py);
3723 }
void drawMonsterSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:3938
void drawBeingCursor(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3667
int mPixelX
Definition: actor.h:132
int mPixelY
Definition: actor.h:133
static const int mapTileSize
Definition: map.h:26

◆ drawMonsterSpriteAt()

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

Definition at line 3938 of file being.cpp.

References BeingAction::DEAD, drawHpBar(), CompoundSprite::drawSimple(), UserPalette::getColorWithAlpha(), BeingInfo::getHpBarOffsetX(), BeingInfo::getHpBarOffsetY(), BeingInfo::getMaxHP(), LocalPlayer::getTarget(), localPlayer, mAction, mapTileSize, mAttackRange, mDamageTaken, mHighlightMonsterAttackRange, mHP, mInfo, mMaxHP, ActorType::Monster, UserColorId::MONSTER_ATTACK_RANGE, UserColorId::MONSTER_HP, UserColorId::MONSTER_HP2, mShowMobHP, mType, userPalette, x, and y.

Referenced by drawMonster(), and getAllowNpcEquipment().

3941 {
3945  {
3946  if (userPalette == nullptr)
3947  {
3948  CompoundSprite::drawSimple(graphics, x, y);
3949  return;
3950  }
3951 
3952  int attackRange;
3953  if (mAttackRange != 0)
3954  attackRange = mapTileSize * mAttackRange;
3955  else
3956  attackRange = mapTileSize;
3957 
3960 
3961  graphics->fillRectangle(Rect(
3962  x - attackRange, y - attackRange,
3963  2 * attackRange + mapTileSize, 2 * attackRange + mapTileSize));
3964  }
3965 
3966  CompoundSprite::drawSimple(graphics, x, y);
3967 
3968  if (mShowMobHP &&
3969  (mInfo != nullptr) &&
3970  (localPlayer != nullptr) &&
3971  localPlayer->getTarget() == this &&
3973  {
3974  // show hp bar here
3975  int maxHP = mMaxHP;
3976  if (maxHP == 0)
3977  maxHP = mInfo->getMaxHP();
3978 
3979  drawHpBar(graphics,
3980  maxHP,
3981  mHP,
3982  mDamageTaken,
3985  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
3986  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
3987  2 * 50,
3988  4);
3989  }
3990 }
const Color & getColorWithAlpha(const UserColorIdT type)
Definition: userpalette.h:199
int getHpBarOffsetY() const
Definition: beinginfo.h:164
Definition: rect.h:72
void drawSimple(Graphics *const graphics, const int posX, const int posY) const
UserPalette * userPalette
Definition: userpalette.cpp:33
static bool mHighlightMonsterAttackRange
Definition: being.h:1332
virtual void setColor(const Color &color)
Definition: graphics.h:319
static bool mShowMobHP
Definition: being.h:1336
int mMaxHP
Definition: being.h:1323
LocalPlayer * localPlayer
int mDamageTaken
Definition: being.h:1321
virtual void fillRectangle(const Rect &rectangle)=0
int getHpBarOffsetX() const
Definition: beinginfo.h:158
void drawHpBar(Graphics *const graphics, const int maxHP, const int hp, const int damage, const UserColorIdT color1, const UserColorIdT color2, const int x, const int y, const int width, const int height) const
Definition: being.cpp:4185
static const int mapTileSize
Definition: map.h:26
int mAttackRange
Definition: being.h:1219
int getMaxHP() const
Definition: beinginfo.h:170
BeingInfo * mInfo
Definition: being.h:1171
BeingActionT mAction
Definition: being.h:1226
int mHP
Definition: being.h:1322
Being * getTarget() const
const ActorTypeT mType
Definition: being.h:1284

◆ drawNpc()

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

Definition at line 3701 of file being.cpp.

References drawBeingCursor(), drawNpcSpriteAt(), mapTileSize, Actor::mPixelX, and Actor::mPixelY.

Referenced by canTalk(), and draw().

3704 {
3705  // getActorX() + offsetX;
3706  const int px = mPixelX - mapTileSize / 2 + offsetX;
3707  // getActorY() + offsetY;
3708  const int py = mPixelY - mapTileSize + offsetY;
3709  drawBeingCursor(graphics, px, py);
3710  drawNpcSpriteAt(graphics, px, py);
3711 }
void drawBeingCursor(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3667
void drawNpcSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:3931
int mPixelX
Definition: actor.h:132
int mPixelY
Definition: actor.h:133
static const int mapTileSize
Definition: map.h:26

◆ drawNpcSpriteAt()

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

Definition at line 3931 of file being.cpp.

References drawCompound(), x, and y.

Referenced by drawNpc(), and getAllowNpcEquipment().

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

◆ drawOther()

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

Definition at line 3689 of file being.cpp.

References drawBeingCursor(), drawOtherSpriteAt(), mapTileSize, Actor::mPixelX, and Actor::mPixelY.

Referenced by canTalk(), and draw().

3692 {
3693  // getActorX() + offsetX;
3694  const int px = mPixelX - mapTileSize / 2 + offsetX;
3695  // getActorY() + offsetY;
3696  const int py = mPixelY - mapTileSize + offsetY;
3697  drawBeingCursor(graphics, px, py);
3698  drawOtherSpriteAt(graphics, px, py);
3699 }
void drawBeingCursor(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3667
int mPixelX
Definition: actor.h:132
void drawOtherSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:3924
int mPixelY
Definition: actor.h:133
static const int mapTileSize
Definition: map.h:26

◆ drawOtherSpriteAt()

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

Definition at line 3924 of file being.cpp.

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

Referenced by drawOther(), and getAllowNpcEquipment().

3927 {
3928  CompoundSprite::drawSimple(graphics, x, y);
3929 }
void drawSimple(Graphics *const graphics, const int posX, const int posY) const

◆ drawPlayer()

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

Definition at line 3627 of file being.cpp.

References HorseOffset::downOffsetX, HorseOffset::downOffsetY, drawBeingCursor(), drawPlayerSpriteAt(), for_each_horses, mapTileSize, mDownHorseSprites, mErased, mHorseInfo, Actor::mPixelX, Actor::mPixelY, mSpriteDirection, mUpHorseSprites, HorseInfo::offsets, HorseOffset::riderOffsetX, HorseOffset::riderOffsetY, HorseOffset::upOffsetX, and HorseOffset::upOffsetY.

Referenced by canTalk(), and draw().

3630 {
3631  if (!mErased)
3632  {
3633  // getActorX() + offsetX;
3634  const int px = mPixelX - mapTileSize / 2 + offsetX;
3635  // getActorY() + offsetY;
3636  const int py = mPixelY - mapTileSize + offsetY;
3637  if (mHorseInfo != nullptr)
3638  {
3641  {
3642  (*it)->draw(graphics,
3643  px + offset.downOffsetX,
3644  py + offset.downOffsetY);
3645  }
3646 
3647  drawBeingCursor(graphics, px, py);
3648  drawPlayerSpriteAt(graphics,
3649  px + offset.riderOffsetX,
3650  py + offset.riderOffsetY);
3651 
3653  {
3654  (*it)->draw(graphics,
3655  px + offset.upOffsetX,
3656  py + offset.upOffsetY);
3657  }
3658  }
3659  else
3660  {
3661  drawBeingCursor(graphics, px, py);
3662  drawPlayerSpriteAt(graphics, px, py);
3663  }
3664  }
3665 }
#define for_each_horses(name)
Definition: being.cpp:160
SpriteDirection::Type mSpriteDirection
Definition: being.h:1230
std::vector< AnimatedSprite * > mDownHorseSprites
Definition: being.h:1307
int downOffsetX
Definition: horseoffset.h:41
void drawBeingCursor(Graphics *const graphics, const int offsetX, const int offsetY) const
Definition: being.cpp:3667
std::vector< AnimatedSprite * > mUpHorseSprites
Definition: being.h:1308
bool mErased
Definition: being.h:1374
int mPixelX
Definition: actor.h:132
int downOffsetY
Definition: horseoffset.h:42
int mPixelY
Definition: actor.h:133
int riderOffsetX
Definition: horseoffset.h:43
void drawPlayerSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:3900
HorseInfo * mHorseInfo
Definition: being.h:1306
int riderOffsetY
Definition: horseoffset.h:44
static const int mapTileSize
Definition: map.h:26
HorseOffset offsets[10]
Definition: horseinfo.h:53

◆ drawPlayerSpriteAt()

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

Definition at line 3900 of file being.cpp.

References BeingAction::DEAD, drawCompound(), drawHpBar(), PlayerInfo::getAttribute(), BeingInfo::getHpBarOffsetX(), BeingInfo::getHpBarOffsetY(), localPlayer, mAction, mapTileSize, mInfo, mShowOwnHP, Attributes::PLAYER_HP, UserColorId::PLAYER_HP, UserColorId::PLAYER_HP2, Attributes::PLAYER_MAX_HP, x, and y.

Referenced by drawPlayer(), and getAllowNpcEquipment().

3903 {
3904  drawCompound(graphics, x, y);
3905 
3906  if (mShowOwnHP &&
3907  (mInfo != nullptr) &&
3908  localPlayer == this &&
3910  {
3911  drawHpBar(graphics,
3914  0,
3917  x - 50 + mapTileSize / 2 + mInfo->getHpBarOffsetX(),
3918  y + mapTileSize - 6 + mInfo->getHpBarOffsetY(),
3919  2 * 50,
3920  4);
3921  }
3922 }
void drawCompound(Graphics *const graphics, const int posX, const int posY) const
Definition: being.cpp:3870
int getHpBarOffsetY() const
Definition: beinginfo.h:164
LocalPlayer * localPlayer
int getHpBarOffsetX() const
Definition: beinginfo.h:158
void drawHpBar(Graphics *const graphics, const int maxHP, const int hp, const int damage, const UserColorIdT color1, const UserColorIdT color2, const int x, const int y, const int width, const int height) const
Definition: being.cpp:4185
static const int mapTileSize
Definition: map.h:26
static bool mShowOwnHP
Definition: being.h:1337
int32_t getAttribute(const AttributesT id)
Definition: playerinfo.cpp:100
BeingInfo * mInfo
Definition: being.h:1171
BeingActionT mAction
Definition: being.h:1226

◆ drawPlayerSprites()

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

Definition at line 3826 of file being.cpp.

References CompoundSprite::getNumberOfLayers(), Sprite::mAlpha, mSpriteHide, mSpriteRemap, CompoundSprite::mSprites, and restrict.

Referenced by drawCompound(), and setDistance().

3829 {
3830  const int sz = CompoundSprite::getNumberOfLayers();
3831  for (int f = 0; f < sz; f ++)
3832  {
3833  const int rSprite = mSpriteHide[mSpriteRemap[f]];
3834  if (rSprite == 1)
3835  continue;
3836 
3837  Sprite *restrict const sprite = mSprites[mSpriteRemap[f]];
3838  if (sprite != nullptr)
3839  {
3840  sprite->setAlpha(mAlpha);
3841  sprite->draw(graphics, posX, posY);
3842  }
3843  }
3844 }
Definition: sprite.h:32
int getNumberOfLayers() const
int * mSpriteHide
Definition: being.h:1298
std::vector< Sprite * > mSprites
int * mSpriteRemap
Definition: being.h:1297
#define restrict
Definition: localconsts.h:176
float mAlpha
Definition: sprite.h:129

◆ drawPortal()

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

Definition at line 3761 of file being.cpp.

References drawPortalSpriteAt(), mapTileSize, Actor::mPixelX, and Actor::mPixelY.

Referenced by canTalk(), and draw().

3764 {
3765  // getActorX() + offsetX;
3766  const int px = mPixelX - mapTileSize / 2 + offsetX;
3767  // getActorY() + offsetY;
3768  const int py = mPixelY - mapTileSize + offsetY;
3769  drawPortalSpriteAt(graphics, px, py);
3770 }
int mPixelX
Definition: actor.h:132
int mPixelY
Definition: actor.h:133
void drawPortalSpriteAt(Graphics *const graphics, const int x, const int y) const
Definition: being.cpp:4155
static const int mapTileSize
Definition: map.h:26

◆ drawPortalSpriteAt()

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

Definition at line 4155 of file being.cpp.

References UserColorId::BEING, CompoundSprite::drawSimple(), Font::drawString(), UserPalette::getColor(), Gui::getFont(), Map::getHasWarps(), gui, mapTileSize, mDrawHotKeys, mHighlightMapPortals, Actor::mMap, mName, UserColorId::PORTAL_HIGHLIGHT, userPalette, x, and y.

Referenced by drawPortal(), and getAllowNpcEquipment().

4158 {
4159  if (mHighlightMapPortals &&
4160  (mMap != nullptr) &&
4161  !mMap->getHasWarps())
4162  {
4163  if (userPalette == nullptr)
4164  {
4165  CompoundSprite::drawSimple(graphics, x, y);
4166  return;
4167  }
4168 
4169  graphics->setColor(userPalette->
4170  getColorWithAlpha(UserColorId::PORTAL_HIGHLIGHT));
4171 
4172  graphics->fillRectangle(Rect(x, y,
4174 
4175  if (mDrawHotKeys && !mName.empty())
4176  {
4177  const Color &color = userPalette->getColor(UserColorId::BEING);
4178  gui->getFont()->drawString(graphics, color, color, mName, x, y);
4179  }
4180  }
4181 
4182  CompoundSprite::drawSimple(graphics, x, y);
4183 }
static bool mDrawHotKeys
Definition: being.h:1334
const Color & getColor(UserColorIdT type, const unsigned int alpha=255U)
Definition: userpalette.h:159
Gui * gui
Definition: gui.cpp:110
Definition: rect.h:72
void drawSimple(Graphics *const graphics, const int posX, const int posY) const
static bool mHighlightMapPortals
Definition: being.h:1331
Font * getFont() const
Definition: gui.h:159
UserPalette * userPalette
Definition: userpalette.cpp:33
std::string mName
Definition: being.h:1178
virtual void setColor(const Color &color)
Definition: graphics.h:319
bool getHasWarps() const
Definition: map.h:243
void drawString(Graphics *const graphics, Color col, const Color &col2, const std::string &text, const int x, const int y)
Definition: font.cpp:253
virtual void fillRectangle(const Rect &rectangle)=0
static const int mapTileSize
Definition: map.h:26
Definition: color.h:74
Map * mMap
Definition: actor.h:138

◆ drawSpeech()

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

Draws the speech text above the being.

Definition at line 2364 of file being.cpp.

References Text::adviseXY(), ThemeColorId::BUBBLE_TEXT, Graphics::CENTER, delete2, Theme::getColor(), Text::getHeight(), Widget::getHeight(), getHeight(), Widget::getWidth(), mapTileSize, mErased, mMoveNames, Actor::mPixelX, Actor::mPixelY, mSpeech, mSpeechBubble, mSpeechTime, mSpeechType, mText, Widget::mVisible, mY, BeingSpeech::NAME_IN_BUBBLE, BeingSpeech::NO_NAME_IN_BUBBLE, BeingSpeech::NO_SPEECH, SpeechBubble::requestMoveToBackground(), Widget::setPosition(), Widget::setVisible(), Speech_true, MailMessageType::Text, BeingSpeech::TEXT_OVERHEAD, theme, userPalette, Visible_false, and Visible_true.

Referenced by getNumberOfLayers().

2366 {
2367  if (mErased)
2368  return;
2369  if (mSpeech.empty())
2370  return;
2371 
2372  const int px = mPixelX - offsetX;
2373  const int py = mPixelY - offsetY;
2374  const int speech = mSpeechType;
2375 
2376  // Draw speech above this being
2377  if (mSpeechTime == 0)
2378  {
2379  if (mSpeechBubble != nullptr &&
2381  {
2383  }
2384  mSpeech.clear();
2385  }
2386  else if (mSpeechTime > 0 && (speech == BeingSpeech::NAME_IN_BUBBLE ||
2387  speech == BeingSpeech::NO_NAME_IN_BUBBLE))
2388  {
2389  delete2(mText)
2390 
2391  if (mSpeechBubble != nullptr)
2392  {
2394  py - getHeight() - (mSpeechBubble->getHeight()));
2397  }
2398  }
2399  else if (mSpeechTime > 0 && speech == BeingSpeech::TEXT_OVERHEAD)
2400  {
2401  if (mSpeechBubble != nullptr)
2403 
2404  if ((mText == nullptr) && (userPalette != nullptr))
2405  {
2406  mText = new Text(mSpeech,
2407  mPixelX,
2408  mPixelY - getHeight(),
2411  Speech_true);
2413  (mY + 1) * mapTileSize - getHeight() - mText->getHeight() - 9,
2414  mMoveNames);
2415  }
2416  }
2417  else if (speech == BeingSpeech::NO_SPEECH)
2418  {
2419  if (mSpeechBubble != nullptr)
2421  delete2(mText)
2422  }
2423 }
int mSpeechTime
Definition: being.h:1214
int getWidth() const
Definition: widget.h:220
const bool Visible_true
Definition: visible.h:29
void setVisible(Visible visible)
Definition: widget.cpp:224
#define delete2(var)
Definition: delete2.h:24
Text * mText
Definition: being.h:1195
UserPalette * userPalette
Definition: userpalette.cpp:33
void requestMoveToBackground()
bool mErased
Definition: being.h:1374
Visible mVisible
Definition: widget.h:962
std::string mSpeech
Definition: being.h:1183
int mPixelX
Definition: actor.h:132
SpeechBubble * mSpeechBubble
Definition: being.h:1287
const bool Visible_false
Definition: visible.h:29
const Color & getColor(ThemeColorIdT type, const unsigned int alpha=255U)
Definition: theme.h:136
void setPosition(const int x, const int y)
Definition: widget.cpp:160
int mPixelY
Definition: actor.h:133
int getHeight() const
Definition: text.h:65
static int mSpeechType
Definition: being.h:1330
const bool Speech_true
Definition: speech.h:29
Theme * theme
Definition: theme.cpp:61
int mY
Definition: being.h:1312
int getHeight() const
Definition: being.h:531
static Move mMoveNames
Definition: being.h:1343
int getHeight() const
Definition: widget.h:239
static const int mapTileSize
Definition: map.h:26
void adviseXY(const int x, const int y, const Move move)
Definition: text.cpp:139

◆ drawSpritesSDL()

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

Reimplemented from CompoundSprite.

Definition at line 3846 of file being.cpp.

References mSpriteHide, mSpriteRemap, CompoundSprite::mSprites, and restrict.

Referenced by setDistance().

3849 {
3850  const size_t sz = mSprites.size();
3851  for (size_t f = 0; f < sz; f ++)
3852  {
3853  const int rSprite = mSpriteHide[mSpriteRemap[f]];
3854  if (rSprite == 1)
3855  continue;
3856 
3857  const Sprite *restrict const sprite = mSprites[mSpriteRemap[f]];
3858  if (sprite != nullptr)
3859  sprite->draw(graphics, posX, posY);
3860  }
3861 }
Definition: sprite.h:32
int * mSpriteHide
Definition: being.h:1298
std::vector< Sprite * > mSprites
int * mSpriteRemap
Definition: being.h:1297
#define restrict
Definition: localconsts.h:176

◆ dumpSprites()

void Being::dumpSprites ( ) const
protected

Definition at line 3342 of file being.cpp.

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

3343 {
3344  STD_VECTOR<BeingSlot>::const_iterator it1 = mSlots.begin();
3345  const STD_VECTOR<BeingSlot>::const_iterator it1_end = mSlots.end();
3346 
3347  logger->log("sprites");
3348  for (; it1 != it1_end;
3349  ++ it1)
3350  {
3351  logger->log("%d,%s,%d",
3352  (*it1).spriteId,
3353  (*it1).color.c_str(),
3354  toInt((*it1).colorId, int));
3355  }
3356 }
Logger * logger
Definition: logger.cpp:95
std::vector< BeingSlot > mSlots
Definition: being.h:1203
#define toInt(val, name)
Definition: intdefines.h:46
void log(const char *const log_text,...)
Definition: logger.cpp:243

◆ enableBotAi()

void Being::enableBotAi ( )
inline

Definition at line 1045 of file being.h.

References mBotAi.

1046  { mBotAi = true; }
bool mBotAi
Definition: being.h:1382

◆ enableShop()

void Being::enableShop ( const bool  b)

Definition at line 5264 of file being.cpp.

References mShop, showShopBadge(), and updateName().

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

5265 {
5266  mShop = b;
5267  updateName();
5269 }
void showShopBadge(const bool show)
Definition: being.cpp:5178
bool mShop
Definition: being.h:1378
void updateName()
Definition: being.cpp:3358

◆ fireMissile()

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

Shoots a missile particle from this being, to target being

Definition at line 1339 of file being.cpp.

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

Referenced by getHeight(), handleAttack(), handleSkill(), and handleSkillCasting().

1341 {
1342  BLOCK_START("Being::fireMissile")
1343 
1344  if (victim == nullptr ||
1345  missile.particle.empty() ||
1346  particleEngine == nullptr)
1347  {
1348  BLOCK_END("Being::fireMissile")
1349  return;
1350  }
1351 
1352  Particle *restrict const target = particleEngine->createChild();
1353 
1354  if (target == nullptr)
1355  {
1356  BLOCK_END("Being::fireMissile")
1357  return;
1358  }
1359 
1360  Particle *restrict const missileParticle = target->addEffect(
1361  missile.particle,
1362  mPixelX,
1363  mPixelY);
1364 
1365  target->moveBy(Vector(0.0F, 0.0F, missile.z));
1366  target->setLifetime(missile.lifeTime);
1367  victim->controlAutoParticle(target);
1368 
1369  if (missileParticle != nullptr)
1370  {
1371  missileParticle->setDestination(target, missile.speed, 0.0F);
1372  missileParticle->setDieDistance(missile.dieDistance);
1373  missileParticle->setLifetime(missile.lifeTime);
1374  }
1375  BLOCK_END("Being::fireMissile")
1376 }
Definition: vector.h:38
#define BLOCK_START(name)
Definition: perfomance.h:78
ParticleEngine * particleEngine
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:79
void controlAutoParticle(Particle *const particle)
int mPixelX
Definition: actor.h:132
int mPixelY
Definition: actor.h:133
std::string empty
Definition: podict.cpp:25
float dieDistance
Definition: missileinfo.h:43
#define restrict
Definition: localconsts.h:176
void addEffect(const std::string &name)
Definition: being.cpp:4884
float speed
Definition: missileinfo.h:42

◆ fixDirectionOffsets()

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

Definition at line 5447 of file being.cpp.

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

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

5449 {
5450  const uint8_t dir = mDirection;
5451  if ((dir & BeingDirection::DOWN) != 0)
5452  {
5453  // do nothing
5454  }
5455  else if ((dir & BeingDirection::UP) != 0)
5456  {
5457  offsetX = -offsetX;
5458  offsetY = -offsetY;
5459  }
5460  else if ((dir & BeingDirection::LEFT) != 0)
5461  {
5462  const int tmp = offsetY;
5463  offsetY = offsetX;
5464  offsetX = -tmp;
5465  }
5466  else if ((dir & BeingDirection::RIGHT) != 0)
5467  {
5468  const int tmp = offsetY;
5469  offsetY = -offsetX;
5470  offsetX = tmp;
5471  }
5472 }
uint8_t mDirection
Definition: being.h:1228

◆ flashName()

void Being::flashName ( const int  time)

Definition at line 2491 of file being.cpp.

References FlashText::flash(), mDispName, and ServerCommandType::time.

Referenced by setDistance().

2492 {
2493  if (mDispName != nullptr)
2494  mDispName->flash(time);
2495 }
FlashText * mDispName
Definition: being.h:1188
void flash(const int time)
Definition: text.h:125

◆ genderToInt()

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

Definition at line 922 of file being.h.

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

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

924  {
925  switch (sex)
926  {
927  case Gender::FEMALE:
928  case Gender::UNSPECIFIED:
929  default:
930  return 0;
931  case Gender::MALE:
932  return 1;
933  case Gender::OTHER:
934  return 3;
935  }
936  }

◆ getActionTime()

int Being::getActionTime ( ) const
inline

Returns the time spent in the current action.

Definition at line 127 of file being.h.

References mActionTime.

Referenced by Viewport::getMouseTile().

128  { return mActionTime; }
int mActionTime
Definition: being.h:1210

◆ getAllowNpcEquipment()

bool Being::getAllowNpcEquipment ( ) const
inline

◆ getAreaSize()

int Being::getAreaSize ( ) const
inline

Definition at line 1048 of file being.h.

References mAreaSize.

1049  { return mAreaSize; }
int mAreaSize
Definition: being.h:1364

◆ getAttackAction() [1/2]

std::string Being::getAttackAction ( ) const

Definition at line 1484 of file being.cpp.

Referenced by getAttackAction(), getGender(), getWeaponAttackAction(), and setAction().

◆ getAttackAction() [2/2]

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

Definition at line 1430 of file being.cpp.

References BlockMask::AIR, getAttackAction(), Map::getBlockMask(), ActorSprite::mHorseId, Actor::mMap, mX, mY, and BlockMask::WATER.

1432 {
1433  if (attack1 == nullptr)
1434  return getAttackAction();
1435 
1436  if (mHorseId != 0)
1437  return attack1->mRideAction;
1438  if (mMap != nullptr)
1439  {
1440  const unsigned char mask = mMap->getBlockMask(mX, mY);
1441  if ((mask & BlockMask::AIR) != 0)
1442  return attack1->mSkyAction;
1443  else if ((mask & BlockMask::WATER) != 0)
1444  return attack1->mWaterAction;
1445  }
1446  return attack1->mAction;
1447 }
std::string mAction
Definition: attack.h:30
unsigned char getBlockMask(const int x, const int y) const
Definition: map.cpp:784
std::string mSkyAction
Definition: attack.h:31
int mX
Definition: being.h:1311
std::string mRideAction
Definition: attack.h:33
int mY
Definition: being.h:1312
std::string mWaterAction
Definition: attack.h:32
std::string getAttackAction() const
Definition: being.cpp:1484
Map * mMap
Definition: actor.h:138

◆ getAttackDelay()

int Being::getAttackDelay ( ) const
inline

Definition at line 768 of file being.h.

References mAttackDelay.

Referenced by TargetDebugTab::logic().

769  { return mAttackDelay; }
int mAttackDelay
Definition: being.h:1354

◆ getAttackSpeed()

int Being::getAttackSpeed ( ) const
inline

Gets the attack speed.

Definition at line 465 of file being.h.

References mAttackSpeed, restrict, restrict2, and LocalPlayer::setAction().

466  { return mAttackSpeed; }
int mAttackSpeed
Definition: being.h:1215

◆ getAttackTime()

time_t Being::getAttackTime ( ) const
inline

Definition at line 719 of file being.h.

References mAttackTime.

720  { return mAttackTime; }
time_t mAttackTime
Definition: being.h:1350

◆ getBlockType()

BlockTypeT Being::getBlockType ( ) const
inlinevirtual

Gets the way the monster blocks pathfinding for other objects

Reimplemented from ActorSprite.

Definition at line 437 of file being.h.

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

438  {
439  if (mInfo == nullptr)
440  return BlockType::NONE;
441  return mInfo->getBlockType();
442  }
BlockTypeT getBlockType() const
Definition: beinginfo.h:128
BeingInfo * mInfo
Definition: being.h:1171

◆ getBlockWalkMask()

virtual unsigned char Being::getBlockWalkMask ( ) const
inlinevirtual

Gets the way the object is blocked by other objects.

Reimplemented in LocalPlayer.

Definition at line 427 of file being.h.

References BeingInfo::getBlockWalkMask(), and mInfo.

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

428  {
429  if (mInfo == nullptr)
430  return 0;
431  return mInfo->getBlockWalkMask();
432  }
unsigned char getBlockWalkMask() const
Definition: beinginfo.h:122
BeingInfo * mInfo
Definition: being.h:1171

◆ getBuyBoard()

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

Definition at line 1014 of file being.h.

References mBuyBoard, restrict2, and setSpiritBalls().

Referenced by BeingPopup::show().

1015  { return mBuyBoard; }
std::string mBuyBoard
Definition: being.h:1301

◆ getCachedX()

int Being::getCachedX ( ) const
inline

Definition at line 152 of file being.h.

References mCachedX.

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

153  { return mCachedX; }
int mCachedX
Definition: being.h:1313

◆ getCachedY()

int Being::getCachedY ( ) const
inline

Definition at line 155 of file being.h.

References mCachedY.

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

156  { return mCachedY; }
int mCachedY
Definition: being.h:1314

◆ getCacheEntry()

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

Definition at line 3492 of file being.cpp.

References beingInfoCache, cur_time, and FOR_EACH.

Referenced by addToCache(), getReachable(), and updateFromCache().

3493 {
3494  FOR_EACH (std::list<BeingCacheEntry*>::iterator, i, beingInfoCache)
3495  {
3496  if (*i == nullptr)
3497  continue;
3498 
3499  if (id == (*i)->getId())
3500  {
3501  // Raise priority: move it to front
3502  if ((*i)->getTime() + 120 < cur_time)
3503  {
3504  beingInfoCache.splice(beingInfoCache.begin(),
3505  beingInfoCache, i);
3506  }
3507  return *i;
3508  }
3509  }
3510  return nullptr;
3511 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
std::list< BeingCacheEntry * > beingInfoCache
Definition: being.cpp:149
volatile time_t cur_time
Definition: timer.cpp:57

◆ getCastAction() [1/2]

std::string Being::getCastAction ( ) const

Definition at line 1485 of file being.cpp.

Referenced by getCastAction(), getGender(), and setAction().

◆ getCastAction() [2/2]

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

Definition at line 1449 of file being.cpp.

References BlockMask::AIR, Map::getBlockMask(), getCastAction(), ActorSprite::mHorseId, Actor::mMap, mX, mY, Actions::skill(), and BlockMask::WATER.

1451 {
1452  if (skill == nullptr)
1453  return getCastAction();
1454 
1455  if (mHorseId != 0)
1456  return skill->castingRideAction;
1457  if (mMap != nullptr)
1458  {
1459  const unsigned char mask = mMap->getBlockMask(mX, mY);
1460  if ((mask & BlockMask::AIR) != 0)
1461  return skill->castingSkyAction;
1462  else if ((mask & BlockMask::WATER) != 0)
1463  return skill->castingWaterAction;
1464  }
1465  return skill->castingAction;
1466 }
std::string castingWaterAction
Definition: skillinfo.h:58
std::string castingRideAction
Definition: skillinfo.h:56
unsigned char getBlockMask(const int x, const int y) const
Definition: map.cpp:784
std::string getCastAction() const
Definition: being.cpp:1485
std::string castingAction
Definition: skillinfo.h:55
int mX
Definition: being.h:1311
std::string castingSkyAction
Definition: skillinfo.h:57
int mY
Definition: being.h:1312
Map * mMap
Definition: actor.h:138

◆ getChat()

ChatObject* Being::getChat ( ) const
inline

◆ getComment()

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

Definition at line 807 of file being.h.

References mComment.

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

808  { return mComment; }
std::string mComment
Definition: being.h:1300

◆ getCreatorId()

BeingId Being::getCreatorId ( ) const
inline

Definition at line 1027 of file being.h.

References mCreatorId.

Referenced by PopupMenu::showPopup().

1028  { return mCreatorId; }
BeingId mCreatorId
Definition: being.h:1369

◆ getCriticalHit()

int Being::getCriticalHit ( ) const
inline

Definition at line 783 of file being.h.

References mCriticalHit.

Referenced by TargetDebugTab::logic().

784  { return mCriticalHit; }
int mCriticalHit
Definition: being.h:1357

◆ getCurrentAction()

BeingActionT Being::getCurrentAction ( ) const
inline

◆ getDamageTaken()

int Being::getDamageTaken ( ) const
inline

Definition at line 588 of file being.h.

References mDamageTaken.

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

589  { return mDamageTaken; }
int mDamageTaken
Definition: being.h:1321

◆ getDeadAction()

std::string Being::getDeadAction ( ) const

Definition at line 1486 of file being.cpp.

Referenced by getGender(), and setAction().

◆ getDefaultEffectId()

int Being::getDefaultEffectId ( const AttackTypeT type)
staticprotected

Definition at line 943 of file being.cpp.

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

Referenced by getAllowNpcEquipment(), and getHitEffect().

944 {
945  if (type == AttackType::MISS)
946  return paths.getIntValue("missEffectId");
947  else if (type != AttackType::CRITICAL)
948  return paths.getIntValue("hitEffectId");
949  else
950  return paths.getIntValue("criticalHitEffectId");
951 }
int getIntValue(const std::string &key) const
Configuration paths

◆ getDestination()

const Vector& Being::getDestination ( ) const
inline

Returns the destination for this being.

Definition at line 161 of file being.h.

References mDest.

162  { return mDest; }
Vector mDest
Definition: being.h:1198

◆ getDirection()

uint8_t Being::getDirection ( ) const
inline

◆ getDirectionDelayed()

uint8_t Being::getDirectionDelayed ( ) const
inline

◆ getDistance()

int Being::getDistance ( ) const
inline

Definition at line 547 of file being.h.

References mDistance.

Referenced by ActorManager::findNearestLivingBeing().

548  { return mDistance; }
int mDistance
Definition: being.h:1324

◆ getEquipment()

Equipment * Being::getEquipment ( )

Definition at line 4624 of file being.cpp.

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

Referenced by EquipmentWindow::setBeing().

4625 {
4626  Equipment *restrict const eq = new Equipment;
4627  Equipment::Backend *restrict const bk = new BeingEquipBackend(this);
4628  eq->setBackend(bk);
4629  return eq;
4630 }
friend class BeingEquipBackend
Definition: being.h:98
#define restrict
Definition: localconsts.h:176

◆ getEquippedWeapon()

const ItemInfo* Being::getEquippedWeapon ( ) const
inline

Definition at line 227 of file being.h.

References mEquippedWeapon.

228  { return mEquippedWeapon; }
const ItemInfo * mEquippedWeapon
Definition: being.h:1192

◆ getExtName()

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

Definition at line 236 of file being.h.

References mExtName, restrict, restrict2, and setName().

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

237  { return mExtName; }
std::string mExtName
Definition: being.h:1179

◆ getGender()

GenderT Being::getGender ( ) const
inline

◆ getGenderSign()

std::string Being::getGenderSign ( ) const

Definition at line 2506 of file being.cpp.

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

Referenced by getGenderSignWithSpace(), setGoodStatus(), and showName().

2507 {
2508  std::string str;
2509  if (mShowGender)
2510  {
2511  if (getGender() == Gender::FEMALE)
2512  str = "\u2640";
2513  else if (getGender() == Gender::MALE)
2514  str = "\u2642";
2515  }
2516  if (mShowPlayersStatus &&
2518  {
2519  if (mShop)
2520  str.append("$");
2521  if (mAway)
2522  {
2523  // TRANSLATORS: this away status writed in player nick
2524  str.append(_("A"));
2525  }
2526  else if (mInactive)
2527  {
2528  // TRANSLATORS: this inactive status writed in player nick
2529  str.append(_("I"));
2530  }
2531  }
2532  return str;
2533 }
#define _(s)
Definition: gettext.h:34
GenderT getGender() const
Definition: being.h:621
bool mInactive
Definition: being.h:1380
static bool mShowGender
Definition: being.h:1338
bool mShop
Definition: being.h:1378
static bool mShowPlayersStatus
Definition: being.h:1340
static BadgeDrawType::Type mShowBadges
Definition: being.h:1345
bool mAway
Definition: being.h:1379

◆ getGenderSignWithSpace()

std::string Being::getGenderSignWithSpace ( ) const

Definition at line 2497 of file being.cpp.

References getGenderSign(), restrict, and ServerCommandType::str.

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

2498 {
2499  const std::string &restrict str = getGenderSign();
2500  if (str.empty())
2501  return str;
2502  else
2503  return std::string(" ").append(str);
2504 }
#define restrict
Definition: localconsts.h:176
std::string getGenderSign() const
Definition: being.cpp:2506

◆ getGoodStatus()

int Being::getGoodStatus ( ) const
inline

Definition at line 795 of file being.h.

References mGoodStatus.

Referenced by PlayerRelationsManager::isGoodName().

796  { return mGoodStatus; }
int mGoodStatus
Definition: being.h:1326

◆ getGroupId()

int Being::getGroupId ( ) const
inline

◆ getGuild() [1/3]

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

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

Definition at line 1219 of file being.cpp.

References FOR_EACH, guild, mGuilds, and restrict.

Referenced by PopupMenu::addSocialMenu(), SocialGuildTab2::buildCounter(), SocialGuildTab::buildCounter(), Actions::changeRelation(), Minimap::draw2(), NotifyManager::getGuildTab(), PopupMenu::handleLink(), Actions::outString(), outStringNormal(), SocialWindow::postInit(), WhoIsOnline::setNeutralColor(), PopupMenu::showChangePos(), PopupMenu::showChatPopup(), PopupMenu::showPlayerPopup(), PopupMenu::showPopup(), Actions::splitWhisper(), updateColors(), updateGuild(), SocialWindow::updateGuildCounter(), and ChatWindow::updateOnline().

1221 {
1223  {
1224  const Guild *restrict const guild = itr->second;
1225  if ((guild != nullptr) && guild->getName() == guildName)
1226  return guild;
1227  }
1228 
1229  return nullptr;
1230 }
#define FOR_EACH(type, iter, array)
Definition: foreach.h:24
std::map< int, Guild * >::const_iterator GuildsMapCIter
Definition: being.cpp:150
#define restrict
Definition: localconsts.h:176
std::map< int, Guild * > mGuilds
Definition: being.h:1207
uint32_t guild
Definition: guild.h:68

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

References mGuilds.

1233 {
1234  const std::map<int, Guild*>::const_iterator itr = mGuilds.find(id);
1235  if (itr != mGuilds.end())
1236  return itr->second;
1237 
1238  return nullptr;
1239 }
std::map< int, Guild * > mGuilds
Definition: being.h:1207

◆ getGuild() [3/3]

Guild * Being::getGuild ( ) const

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

Definition at line 1241 of file being.cpp.

References mGuilds.

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

1242 {
1243  const std::map<int, Guild*>::const_iterator itr = mGuilds.begin();
1244  if (itr != mGuilds.end())
1245  return itr->second;
1246 
1247  return nullptr;
1248 }
std::map< int, Guild * > mGuilds
Definition: being.h:1207

◆ getGuildName()

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

◆ getGuilds()

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

Returns all guilds the being is in.

Definition at line 301 of file being.h.

References clearGuilds(), anonymous_namespace{badgesdb.cpp}::mGuilds, and restrict2.

303  { return mGuilds; }
std::map< int, Guild * > mGuilds
Definition: being.h:1207

◆ getHairColor()

ItemColor Being::getHairColor ( ) const
inline

Definition at line 878 of file being.h.

References A_WARN_UNUSED, getHitEffect(), mHairColor, recalcSpritesOrder(), restrict, and restrict2.

Referenced by ActorManager::cloneBeing().

879  { return mHairColor; }
ItemColor mHairColor
Definition: being.h:1373

◆ getHeight()

int Being::getHeight ( ) const
inlinevirtual

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

Reimplemented from ActorSprite.

Definition at line 531 of file being.h.

References DEFAULT_BEING_HEIGHT, fireMissile(), CompoundSprite::getHeight(), restrict, and restrict2.

Referenced by drawSpeech(), setPixelPositionF(), and setSpeech().

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

◆ getHitEffect()

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

Definition at line 860 of file being.cpp.

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

Referenced by getHairColor(), and takeDamage().

864 {
865  if (effectManager == nullptr)
866  return 0;
867 
868  BLOCK_START("Being::getHitEffect")
869  // Init the particle effect path based on current
870  // weapon or default.
871  int hitEffectId = 0;
872  if (type == AttackType::SKILL || type == AttackType::SKILLMISS)
873  {
874  const SkillData *restrict const data =
875  skillDialog->getSkillDataByLevel(attackId, level);
876  if (data == nullptr)
877  return -1;
878  if (type == AttackType::SKILL)
879  {
880  hitEffectId = data->hitEffectId;
881  if (hitEffectId == -1)
882  hitEffectId = paths.getIntValue("skillHitEffectId");
883  }
884  else
885  {
886  hitEffectId = data->missEffectId;
887  if (hitEffectId == -1)
888  hitEffectId = paths.getIntValue("skillMissEffectId");
889  }
890  }
891  else
892  {
893  if (attacker != nullptr)
894  {
895  const ItemInfo *restrict const attackerWeapon
896  = attacker->getEquippedWeapon();
897  if (attackerWeapon != nullptr &&
898  attacker->getType() == ActorType::Player)
899  {
900  if (type == AttackType::MISS)
901  hitEffectId = attackerWeapon->getMissEffectId();
902  else if (type != AttackType::CRITICAL)
903  hitEffectId = attackerWeapon->getHitEffectId();
904  else
905  hitEffectId = attackerWeapon->getCriticalHitEffectId();
906  }
907  else if (attacker->getType() == ActorType::Monster)
908  {
909  const BeingInfo *restrict const info = attacker->getInfo();
910  if (info != nullptr)
911  {
912  const Attack *restrict const atk =
913  info->getAttack(attackId);
914  if (atk != nullptr)
915  {
916  if (type == AttackType::MISS)
917  hitEffectId = atk->mMissEffectId;
918  else if (type != AttackType::CRITICAL)
919  hitEffectId = atk->mHitEffectId;
920  else
921  hitEffectId = atk->mCriticalHitEffectId;
922  }
923  else
924  {
925  hitEffectId = getDefaultEffectId(type);
926  }
927  }
928  }
929  else
930  {
931  hitEffectId = getDefaultEffectId(type);
932  }
933  }
934  else
935  {
936  hitEffectId = getDefaultEffectId(type);
937  }
938  }
939  BLOCK_END("Being::getHitEffect")
940  return hitEffectId;
941 }
Definition: attack.h:28
int hitEffectId
Definition: skilldata.h:50
#define BLOCK_START(name)
Definition: perfomance.h:78
if(!vert) return
#define BLOCK_END(name)
Definition: perfomance.h:79
int getIntValue(const std::string &key) const
SkillData * getSkillDataByLevel(const int id, const int level) const
bool info(InputEvent &event)
Definition: commands.cpp:56
uint32_t data
ActorTypeT getType() const
Definition: being.h:115
const ItemInfo * getEquippedWeapon() const
Definition: being.h:227
int getMissEffectId() const
Definition: iteminfo.h:182
static int getDefaultEffectId(const AttackTypeT &type)
Definition: being.cpp:943
Configuration paths
SkillDialog * skillDialog
Definition: skilldialog.cpp:65
const BeingInfo * getInfo() const
Definition: being.h:404
#define restrict
Definition: localconsts.h:176
EffectManager * effectManager

◆ getHoverCursor()

CursorT Being::getHoverCursor ( ) const
inline

◆ getHP()

int Being::getHP ( ) const
inline

Definition at line 754 of file being.h.

References mHP.

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

755  { return mHP; }
int mHP
Definition: being.h:1322

◆ getInfo()

const BeingInfo* Being::getInfo ( ) const
inline

◆ getIp()

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

Definition at line 738 of file being.h.

References mIp.

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

739  { return mIp; }
std::string mIp
Definition: being.h:1296

◆ getKarma()

int Being::getKarma ( ) const
inline

Definition at line 1033 of file being.h.

References mKarma.

Referenced by TargetDebugTab::logic().

1034  { return mKarma; }
int mKarma
Definition: being.h:1362

◆ getLanguageId()

int Being::getLanguageId ( )
inline

Definition at line 1076 of file being.h.

References mLanguageId.

Referenced by Actions::splitWhisper().

1077  { return mLanguageId; }
int mLanguageId
Definition: being.h:1366

◆ getLastAttackX()

virtual int Being::getLastAttackX ( ) const
inlinevirtual

Reimplemented in LocalPlayer.

Definition at line 973 of file being.h.

References mLastAttackX.

Referenced by updateBotDirection().

974  { return mLastAttackX; }
int mLastAttackX
Definition: being.h:1220

◆ getLastAttackY()

virtual int Being::getLastAttackY ( ) const
inlinevirtual

Reimplemented in LocalPlayer.

Definition at line 976 of file being.h.

References A_NONNULL, drawElemental(), drawHomunculus(), drawMercenary(), mLastAttackY, restrict, restrict2, setChat(), and setTrickDead().

Referenced by updateBotDirection().

977  { return mLastAttackY; }
int mLastAttackY
Definition: being.h:1221

◆ getLevel()

virtual int Being::getLevel ( ) const
inlinevirtual

◆ getLook()

uint16_t Being::getLook ( ) const
inline

Definition at line 917 of file being.h.

References mLook, restrict2, and setLook().

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

918  { return mLook; }
uint16_t mLook
Definition: being.h:1371

◆ getManner()

int Being::getManner ( ) const
inline

Definition at line 1039 of file being.h.

References mManner.

Referenced by TargetDebugTab::logic().

1040  { return mManner; }
int mManner
Definition: being.h:1363

◆ getMaxHit()

int Being::getMaxHit ( ) const
inline

Definition at line 777 of file being.h.

References mMaxHit.

Referenced by TargetDebugTab::logic().

778  { return mMaxHit; }
int mMaxHit
Definition: being.h:1356

◆ getMaxHP()

int Being::getMaxHP ( ) const
inline

Definition at line 757 of file being.h.

References A_WARN_UNUSED, calcDirection(), and mMaxHP.

Referenced by BeingPopup::show().

758  { return mMaxHP; }
int mMaxHP
Definition: being.h:1323

◆ getMinHit()

int Being::getMinHit ( ) const
inline

Definition at line 771 of file being.h.

References mMinHit.

Referenced by TargetDebugTab::logic().

772  { return mMinHit; }
int mMinHit
Definition: being.h:1355

◆ getMoveAction()

std::string Being::getMoveAction ( ) const

Definition at line 1396 of file being.cpp.

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

Referenced by getGender(), and setAction().

1397 {
1398  if (mHorseId != 0)
1399  return SpriteAction::RIDE;
1400  if (mMap != nullptr)
1401  {
1402  const unsigned char mask = mMap->getBlockMask(mX, mY);
1403  if ((mask & BlockMask::AIR) != 0)
1404  return SpriteAction::FLY;
1405  else if ((mask & BlockMask::WATER) != 0)
1406  return SpriteAction::SWIM;
1407  }
1408  return SpriteAction::MOVE;
1409 }
static const std::string RIDE("ride")
unsigned char getBlockMask(const int x, const int y) const
Definition: map.cpp:784
int mX
Definition: being.h:1311
static const std::string FLY("fly")
int mY
Definition: being.h:1312
static const std::string SWIM("swim")
static const std::string MOVE("walk")
Map * mMap
Definition: actor.h:138

◆ getMoveTime()

time_t Being::getMoveTime ( ) const
inline

Definition at line 716 of file being.h.

References mMoveTime.

717  { return mMoveTime; }
time_t mMoveTime
Definition: being.h:1349

◆ getName()

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