Mana
|
The local player character. More...
#include <localplayer.h>
Public Member Functions | |
LocalPlayer (int id=65535, int subtype=0) | |
~LocalPlayer () override | |
void | logic () override |
Performs being logic. | |
void | setAction (Action action, int attackId=1) override |
Sets the current action. | |
bool | checkInviteRights (const std::string &guildName) |
Check the player has permission to invite users to specific guild. | |
void | inviteToGuild (Being *being) |
Invite a player to join guild. | |
void | pickUp (FloorItem *item) |
void | setAttackRange (int range) |
Sets the attack range. | |
int | getAttackRange () const |
Gets the attack range. | |
void | attack (Being *target=nullptr, bool keep=false) |
void | setGMLevel (int level) |
void | stopAttack () |
Being * | getTarget () const |
Returns the current target of the player. | |
void | setTarget (Being *target) |
Sets the target being of the player. | |
virtual void | setDestination (int x, int y) |
Sets a new destination for this being to walk to. | |
virtual void | setDestination (const Vector &dest) |
virtual void | setDestination (const Position &dest) |
void | setWalkingDir (int dir) |
Sets a new direction to keep walking in, when using the keyboard or the joystick. | |
int | getWalkingDir () const |
Gets the walking direction. | |
void | setGotoTarget (Being *target) |
Sets going to being to attack. | |
void | cancelGoToTarget () |
Cancel a possible target destination in progress, but not the targeting. | |
bool | withinRange (Actor *target, int range) const |
Returns whether the target is in range (in pixels). | |
void | toggleSit () |
void | emote (int emoteId) |
void | pickedUp (const ItemInfo &itemInfo, int amount, unsigned char fail) |
Shows item pickup notifications. | |
void | setShowIp (bool show) |
bool | getShowIp () const |
void | pathSetByMouse () |
Tells that the path has been set by mouse. | |
bool | isPathSetByMouse () const |
Tells if the path has been set by mouse. | |
void | setAwayMode (bool away) |
bool | getAwayMode () const |
void | afkRespond (ChatTab *tab, const std::string &nick) |
void | addMessageToQueue (const std::string &message, int color=UserPalette::EXP_INFO) |
void | event (Event::Channel channel, const Event &event) override |
![]() | |
Being (int id, Type type, int subtype, Map *map) | |
Constructor. | |
~Being () override | |
Type | getType () const final |
Returns the type of the ActorSprite. | |
void | setType (Type type, int subtype) |
Can be used to change the type of the being. | |
void | clearPath () |
Removes all path nodes from this being. | |
void | setDestination (int ex, int ey) |
Creates a path for the being from current position to ex and ey. | |
const Vector & | getDestination () const |
Returns the destination for this being. | |
int | getTileX () const override |
Returns the tile x coord. | |
int | getTileY () const override |
Returns the tile y coord. | |
void | setSpeech (const std::string &text, int time=5000) |
Puts a "speech balloon" above this being for the specified amount of time. | |
void | takeDamage (Being *attacker, int damage, AttackType type, int attackId=1) |
Puts a damage bubble above this being. | |
void | handleAttack (Being *victim, int damage, int attackId=1) |
Handles an attack of another being by this being. | |
const ItemInfo * | getEquippedWeapon () const |
const std::string & | getName () const |
Returns the name of the being. | |
void | setName (const std::string &name) |
Sets the name for the being. | |
bool | getShowName () const |
void | setShowName (bool doShowName) |
void | setPartyName (const std::string &name) |
Sets the name of the party the being is in. | |
const std::string & | getPartyName () const |
void | setGuildName (const std::string &name) |
Sets the name of the primary guild the being is in. | |
void | setGuildPos (const std::string &pos) |
void | addGuild (Guild *guild) |
Adds a guild to the being. | |
void | removeGuild (int id) |
Removers a guild from the being. | |
Guild * | getGuild (const std::string &guildName) const |
Returns a pointer to the specified guild that the being is in. | |
Guild * | getGuild (int id) const |
Returns a pointer to the specified guild that the being is in. | |
const std::map< int, Guild * > & | getGuilds () const |
Returns all guilds the being is in. | |
void | clearGuilds () |
Removes all guilds the being is in. | |
short | getNumberOfGuilds () const |
Get number of guilds the being belongs to. | |
bool | isInParty () const |
void | setParty (Party *party) |
Party * | getParty () const |
void | setSprite (unsigned slot, int id, const std::string &color=std::string(), bool isWeapon=false) |
Sets visible equipments for this being. | |
void | setSpriteID (unsigned slot, int id) |
void | setSpriteColor (unsigned slot, const std::string &color=std::string()) |
unsigned | getSpriteCount () const |
bool | drawnWhenBehind () const override |
Determines wether the actor should be drawn translucent when behind another object. | |
void | drawSpeech (int offsetX, int offsetY) |
Draws the speech text above the being. | |
uint16_t | getSubType () const |
const BeingInfo & | getInfo () const |
bool | isTargetSelection () const |
TargetCursorSize | getTargetCursorSize () const override |
Returns the required size of a target cursor for this being. | |
Cursor | getHoverCursor () const |
unsigned char | getWalkMask () const |
Gets the way the object is blocked by other objects. | |
Map::BlockType | getBlockType () const override |
Gets the way the monster blocks pathfinding for other objects. | |
void | setMoveSpeed (const Vector &speed) |
Sets the move speed. | |
void | setAttackSpeed (int speed) |
Sets the attack speed. | |
int | getAttackSpeed () const |
Gets the attack speed. | |
void | setAction (const std::string &action) |
Sets the current action by name. | |
Action | getCurrentAction () const |
Get the being's action currently performed. | |
bool | isAlive () const |
Returns whether this being is still alive. | |
uint8_t | getDirection () const |
Returns the current direction. | |
void | setDirection (uint8_t direction) |
Sets the current direction. | |
SpriteDirection | getSpriteDirection () const |
Returns the direction the being is facing. | |
void | setPosition (const Vector &pos) final |
Sets the pixel position of this actor. | |
void | setPosition (float x, float y, float z=0.0f) |
Overloaded method provided for convenience. | |
int | getCollisionRadius () const |
Returns the being's pixel radius used to detect collisions. | |
void | fireMissile (Being *target, const std::string &particle) |
Shoots a missile particle from this being, to target being. | |
void | setStatusEffect (int id, bool active) |
const Path & | getPath () const |
Returns the path this being is following. | |
void | flashName (int time) |
int | getDamageTaken () const |
void | updateName () |
void | setGender (Gender gender) |
Sets the gender of this being. | |
Gender | getGender () const |
bool | isGM () const |
Whether or not this player is a GM. | |
void | setGM (bool gm) |
Triggers whether or not to show the name as a GM name. | |
void | setIp (int ip) |
Sets the IP or an IP hash. | |
int | getIp () const |
Returns the player's IP or an IP hash. | |
bool | canTalk () |
void | talkTo () |
void | death (const gcn::Event &event) override |
void | setMap (Map *map) final |
void | lookAt (const Vector &destVec) |
Make the being look at a given pixel position. | |
void | lookAt (const Position &destPos) |
![]() | |
ActorSprite (int id) | |
~ActorSprite () override | |
int | getId () const |
void | setId (int id) |
int | getDrawOrder () const override |
Returns the pixel Y coordinate that the actor should be drawn at. | |
bool | draw (Graphics *graphics, int offsetX, int offsetY) const override |
Draws the Actor to the given graphics context. | |
bool | drawSpriteAt (Graphics *graphics, int x, int y) const |
void | controlParticle (Particle *particle) |
Take control of a particle. | |
void | setTargetType (TargetCursorType type) |
Sets the target animation for this actor. | |
void | untarget () |
Untargets the actor. | |
void | setAlpha (float alpha) override |
Sets the alpha value used to draw the actor. | |
float | getAlpha () const override |
Returns the current alpha value used to draw the actor. | |
int | getWidth () const |
int | getHeight () const |
![]() | |
Actor () | |
virtual | ~Actor () |
const Vector & | getPosition () const |
Returns the pixel position of this actor. | |
int | getPixelX () const |
Returns the pixels X coordinate of the actor. | |
int | getPixelY () const |
Returns the pixel Y coordinate of the actor. | |
Map * | getMap () const |
![]() | |
virtual | ~EventListener () |
void | listen (Event::Channel channel) |
void | ignore (Event::Channel channel) |
Protected Member Functions | |
void | updateStatusEffect (int id, bool newStatus) override |
Notify self that a status effect has flipped. | |
void | startWalking (unsigned char dir) |
Make the character starts to walk. | |
void | stopWalking (bool sendToServer=true) |
Stops the player dead in his tracks. | |
void | nextTile (unsigned char dir) |
set the next path tile when walking and using the keyboard. | |
Position | getNextWalkPosition (unsigned char dir) const |
Compute the next pathnode location when walking using keyboard. | |
void | pathFinished () override |
Called when the being has reached the end of its path. | |
![]() | |
void | setPath (const Path &path) |
Sets the new path for this being. | |
void | updateNamePosition () |
Updates name's location. | |
void | addSpriteParticles (SpriteState &spriteState, const SpriteDisplay &display) |
void | restoreAllSpriteParticles () |
void | updateColors () |
void | updatePlayerSprites () |
Updates the visible sprite IDs of the player, taking into account the item replacements. | |
int | getSpeechTextYPosition () const |
Gets the advised Y chat text position. | |
![]() | |
void | setupSpriteDisplay (const SpriteDisplay &display, bool forceDisplay=true) |
Protected Attributes | |
int | mAttackRange = -1 |
Timer | mLastTargetTimer |
Timer for last targeting action. | |
int | mGMLevel = 0 |
Being * | mTarget = nullptr |
FloorItem * | mPickUpTarget = nullptr |
bool | mGoingToTarget = false |
bool | mKeepAttacking = false |
Whether or not to continue to attack. | |
Timer | mLastActionTimer |
Timeout for the last action. | |
int | mWalkingDir = 0 |
The direction the player is walking in. | |
bool | mPathSetByMouse = false |
Tells if the path was set using mouse. | |
std::list< std::pair< std::string, int > > | mMessages |
Queued messages. | |
Timer | mMessageTimer |
bool | mShowIp = false |
std::unique_ptr< AwayListener > | mAwayListener |
Timer | mAfkTimer |
bool | mAwayMode = false |
![]() | |
const BeingInfo * | mInfo |
Timer | mActionTimer |
Time spent in current action. | |
Timer | mSpeechTimer |
Time until the last speech sentence disappears. | |
int | mAttackSpeed = 350 |
Attack speed. | |
Action | mAction = STAND |
Action the being is performing. | |
int | mSubType = 0xFFFF |
Subtype (graphical view, basically) | |
uint8_t | mDirection = DOWN |
Facing direction. | |
uint8_t | mSpriteDirection = DIRECTION_DOWN |
Facing direction. | |
std::string | mName |
Name of character. | |
std::string | mPartyName |
FlashText * | mDispName = nullptr |
Holds a text object when the being displays its name, 0 otherwise. | |
const gcn::Color * | mNameColor |
bool | mShowName = false |
const ItemInfo * | mEquippedWeapon = nullptr |
Engine-related infos about weapon. | |
Path | mPath |
std::string | mSpeech |
Text * | mText = nullptr |
Vector | mDest |
destination coordinates. | |
std::vector< SpriteState > | mSpriteStates |
bool | mRestoreParticlesOnLogic = false |
Gender | mGender = Gender::Neutral |
std::map< int, Guild * > | mGuilds |
Party * | mParty = nullptr |
bool | mIsGM = false |
![]() | |
int | mId |
std::vector< ParticleHandle > | mChildParticleEffects |
CompoundSprite | mSprites |
![]() | |
Map * | mMap = nullptr |
Vector | mPos |
Position in pixels relative to map. | |
Additional Inherited Members | |
![]() | |
enum | Action { STAND , MOVE , ATTACK , SIT , DEAD , HURT } |
Action the being is currently performing WARNING: Has to be in sync with the same enum in the Being class of the server! More... | |
enum | Speech { NO_SPEECH = 0 , TEXT_OVERHEAD , NO_NAME_IN_BUBBLE , NAME_IN_BUBBLE } |
enum | AttackType { HIT = 0x00 , CRITICAL = 0x0a , MULTI = 0x08 , REFLECT = 0x04 , FLEE = 0x0b } |
enum | BeingDirection { DOWN = 1 , LEFT = 2 , UP = 4 , RIGHT = 8 } |
Directions, to be used as bitmask values. More... | |
![]() | |
enum | Type { UNKNOWN , PLAYER , NPC , MONSTER , FLOOR_ITEM , PORTAL } |
enum | TargetCursorSize { TC_SMALL = 0 , TC_MEDIUM , TC_LARGE , NUM_TC } |
enum | TargetCursorType { TCT_NONE = -1 , TCT_NORMAL = 0 , TCT_IN_RANGE , NUM_TCT } |
![]() | |
static void | load () |
static void | unload () |
The local player character.
Definition at line 74 of file localplayer.h.
LocalPlayer::LocalPlayer | ( | int | id = 65535 , |
int | subtype = 0 |
||
) |
Definition at line 58 of file localplayer.cpp.
|
overridedefault |
void LocalPlayer::addMessageToQueue | ( | const std::string & | message, |
int | color = UserPalette::EXP_INFO |
||
) |
Definition at line 948 of file localplayer.cpp.
void LocalPlayer::afkRespond | ( | ChatTab * | tab, |
const std::string & | nick | ||
) |
Definition at line 1050 of file localplayer.cpp.
void LocalPlayer::attack | ( | Being * | target = nullptr , |
bool | keep = false |
||
) |
Definition at line 801 of file localplayer.cpp.
|
inline |
Cancel a possible target destination in progress, but not the targeting.
Definition at line 154 of file localplayer.h.
bool LocalPlayer::checkInviteRights | ( | const std::string & | guildName | ) |
Check the player has permission to invite users to specific guild.
Definition at line 559 of file localplayer.cpp.
void LocalPlayer::emote | ( | int | emoteId | ) |
Definition at line 792 of file localplayer.cpp.
|
overridevirtual |
Reimplemented from Being.
Definition at line 953 of file localplayer.cpp.
|
inline |
Gets the attack range.
Definition at line 104 of file localplayer.h.
|
inline |
Definition at line 186 of file localplayer.h.
|
protected |
Compute the next pathnode location when walking using keyboard.
used by nextTile().
Definition at line 178 of file localplayer.cpp.
|
inline |
Definition at line 174 of file localplayer.h.
Being * LocalPlayer::getTarget | ( | ) | const |
Returns the current target of the player.
Returns 0 if no being is currently targeted.
Definition at line 608 of file localplayer.cpp.
|
inline |
Gets the walking direction.
Definition at line 142 of file localplayer.h.
void LocalPlayer::inviteToGuild | ( | Being * | being | ) |
Invite a player to join guild.
Definition at line 567 of file localplayer.cpp.
|
inline |
Tells if the path has been set by mouse.
Definition at line 182 of file localplayer.h.
|
overridevirtual |
|
protected |
set the next path tile when walking and using the keyboard.
Definition at line 537 of file localplayer.cpp.
|
inlineoverrideprotectedvirtual |
Called when the being has reached the end of its path.
Reimplemented from Being.
Definition at line 218 of file localplayer.h.
|
inline |
Tells that the path has been set by mouse.
Definition at line 178 of file localplayer.h.
void LocalPlayer::pickedUp | ( | const ItemInfo & | itemInfo, |
int | amount, | ||
unsigned char | fail | ||
) |
Shows item pickup notifications.
Definition at line 849 of file localplayer.cpp.
void LocalPlayer::pickUp | ( | FloorItem * | item | ) |
Definition at line 584 of file localplayer.cpp.
|
overridevirtual |
void LocalPlayer::setAttackRange | ( | int | range | ) |
Sets the attack range.
Definition at line 901 of file localplayer.cpp.
void LocalPlayer::setAwayMode | ( | bool | away | ) |
Definition at line 1032 of file localplayer.cpp.
|
inlinevirtual |
Definition at line 130 of file localplayer.h.
|
inlinevirtual |
Definition at line 128 of file localplayer.h.
|
virtual |
Sets a new destination for this being to walk to.
Definition at line 649 of file localplayer.cpp.
void LocalPlayer::setGMLevel | ( | int | level | ) |
Definition at line 169 of file localplayer.cpp.
void LocalPlayer::setGotoTarget | ( | Being * | target | ) |
Sets going to being to attack.
Definition at line 933 of file localplayer.cpp.
|
inline |
Definition at line 171 of file localplayer.h.
void LocalPlayer::setTarget | ( | Being * | target | ) |
Sets the target being of the player.
Definition at line 613 of file localplayer.cpp.
void LocalPlayer::setWalkingDir | ( | int | dir | ) |
Sets a new direction to keep walking in, when using the keyboard or the joystick.
Definition at line 691 of file localplayer.cpp.
|
protected |
Make the character starts to walk.
Definition at line 740 of file localplayer.cpp.
void LocalPlayer::stopAttack | ( | ) |
Definition at line 837 of file localplayer.cpp.
|
protected |
Stops the player dead in his tracks.
Definition at line 756 of file localplayer.cpp.
void LocalPlayer::toggleSit | ( | ) |
Definition at line 775 of file localplayer.cpp.
|
overrideprotectedvirtual |
Notify self that a status effect has flipped.
The new flag is passed.
Reimplemented from Being.
Definition at line 1016 of file localplayer.cpp.
bool LocalPlayer::withinRange | ( | Actor * | target, |
int | range | ||
) | const |
Returns whether the target is in range (in pixels).
Definition at line 921 of file localplayer.cpp.
|
protected |
Definition at line 243 of file localplayer.h.
|
protected |
Definition at line 220 of file localplayer.h.
|
protected |
Definition at line 242 of file localplayer.h.
|
protected |
Definition at line 244 of file localplayer.h.
|
protected |
Definition at line 224 of file localplayer.h.
|
protected |
Definition at line 230 of file localplayer.h.
|
protected |
Whether or not to continue to attack.
Definition at line 231 of file localplayer.h.
|
protected |
Timeout for the last action.
Definition at line 232 of file localplayer.h.
|
protected |
Timer for last targeting action.
Definition at line 222 of file localplayer.h.
|
protected |
Queued messages.
Definition at line 237 of file localplayer.h.
|
protected |
Definition at line 238 of file localplayer.h.
|
protected |
Tells if the path was set using mouse.
Definition at line 234 of file localplayer.h.
|
protected |
Definition at line 228 of file localplayer.h.
|
protected |
Definition at line 240 of file localplayer.h.
|
protected |
Definition at line 226 of file localplayer.h.
|
protected |
The direction the player is walking in.
Definition at line 233 of file localplayer.h.