LocalPlayer Class Reference

#include <localplayer.h>

Inheritance diagram for LocalPlayer:

Player Being

List of all members.


Detailed Description

The local player character.

Definition at line 127 of file localplayer.h.


Public Types

enum  Attribute {
  STR = 0, AGI, VIT, INT,
  DEX, LUK
}

Public Member Functions

 LocalPlayer (int id, int job, Map *map)
 Constructor.
 ~LocalPlayer ()
 Destructor.
virtual void setName (const std::string &name)
 Set up mName to be the character's name.
virtual void logic ()
 Performs being logic.
virtual void setAction (Action action, int attackType=0)
 Sets the current action.
virtual void nextStep ()
 Adds a new step when walking before calling super.
InventorygetInventory () const
 Returns the player's inventory.
InventorygetStorage () const
 Returns the player's storage.
void inviteToParty (const std::string &name)
 Invite a player to join their party.
void inviteToParty (Player *player)
 Invite a player to join their party.
void moveInvItem (Item *item, int newIndex)
 Move the Inventory item from the old slot to the new slot.
void equipItem (Item *item)
 Equips an item.
void unequipItem (Item *item)
 Unequips an item.
void useItem (Item *item)
void dropItem (Item *item, int quantity)
void pickUp (FloorItem *item)
int getAttackRange ()
 Gets the attack range.
void trade (Being *being) const
 Sents a trade request to the given being.
void tradeReply (bool accept)
 Accept or decline a trade offer.
bool tradeRequestOk () const
 Returns true when the player is ready to accept a trade offer.
void setTrading (bool trading)
 Sets the trading state of the player, i.e.
void attack (Being *target=NULL, bool keep=false)
virtual void setGM ()
 Triggers whether or not to show the name as a GM name.
void stopAttack ()
virtual void handleAttack (Being *victim, int damage, AttackType type)
 Overridden to do nothing.
virtual void handleAttack ()
BeinggetTarget () const
 Returns the current target of the player.
void setTarget (Being *target)
 Sets the target being of the player.
virtual void setDestination (Uint16 x, Uint16 y)
 Sets a new destination for this being to walk to.
void setWalkingDir (int dir)
 Sets a new direction to keep walking in.
int getWalkingDir () const
 Gets the walking direction.
void setGotoTarget (Being *target)
 Sets going to being to attack.
bool withinAttackRange (Being *target)
 Returns whether the target is in range to attack.
void stopWalking (bool sendToServer=true)
 Stops the player dead in his tracks.
void raiseAttribute (size_t attr)
 Uses a character point to raise an attribute.
void lowerAttribute (size_t attr)
 Uses a correction point to lower an attribute.
void toggleSit ()
void emote (Uint8 emotion)
void revive ()
void pickedUp (const std::string &item)
 Shows item pickup effect if the player is on a map.
bool getInStorage ()
 Accessors for mInStorage.
void setInStorage (bool inStorage)
int getHp () const
int getMaxHp () const
void setHp (int value)
void setMaxHp (int value)
int getLevel () const
void setLevel (int value)
int getMoney () const
void setMoney (int value)
int getTotalWeight () const
void setTotalWeight (int value)
int getMaxWeight () const
void setMaxWeight (int value)

Public Attributes

bool mUpdateName
bool mMapInitialized
 Whether or not the name settings have changed.
float mLastAttackTime
 Whether or not the map is available yet.
const std::auto_ptr< EquipmentmEquipment

Protected Member Functions

virtual void handleStatusEffect (StatusEffect *effect, int effectId)
 Handle an update to a status or stun effect.
void walk (unsigned char dir)
void initTargetCursor ()
void loadTargetCursor (std::string filename, int width, int height, bool outRange, Being::TargetCursorSize size)
 Helper function for loading target cursors.

Protected Attributes

bool mInStorage
 Whether storage is currently accessible.
int mLastTarget
int mLevel
 Time stamp of last targeting action, -1 if none.
int mMoney
int mTotalWeight
int mMaxWeight
int mHp
int mMaxHp
BeingmTarget
FloorItemmPickUpTarget
bool mTrading
bool mGoingToTarget
bool mKeepAttacking
int mLastAction
 Whether or not to continue to attack.
int mWalkingDir
 The direction the player is walking in.
int mDestX
 X coordinate of destination.
int mDestY
 Y coordinate of destination.
std::vector< int > mStatusEffectIcons
InventorymInventory
InventorymStorage
ImageSetmTargetCursorImages [2][NUM_TC]
 Images of the target cursor.
SimpleAnimationmTargetCursor [2][NUM_TC]
 Animated target cursors.

Member Enumeration Documentation

Enumerator:
STR 
AGI 
VIT 
INT 
DEX 
LUK 

Definition at line 130 of file localplayer.h.


Constructor & Destructor Documentation

LocalPlayer::LocalPlayer ( int  id,
int  job,
Map map 
)

Constructor.

Definition at line 84 of file localplayer.cpp.

LocalPlayer::~LocalPlayer (  ) 

Destructor.

Definition at line 141 of file localplayer.cpp.


Member Function Documentation

void LocalPlayer::setName ( const std::string &  name  )  [virtual]

Set up mName to be the character's name.

Reimplemented from Player.

Definition at line 249 of file localplayer.cpp.

void LocalPlayer::logic (  )  [virtual]

Performs being logic.

Reimplemented from Being.

Definition at line 157 of file localplayer.cpp.

void LocalPlayer::setAction ( Action  action,
int  attackType = 0 
) [virtual]

Sets the current action.

Reimplemented from Being.

Definition at line 228 of file localplayer.cpp.

void LocalPlayer::nextStep (  )  [virtual]

Adds a new step when walking before calling super.

Also, when specified it picks up an item at the end of a path.

Definition at line 263 of file localplayer.cpp.

Inventory* LocalPlayer::getInventory (  )  const [inline]

Returns the player's inventory.

Definition at line 168 of file localplayer.h.

Inventory* LocalPlayer::getStorage (  )  const [inline]

Returns the player's storage.

Definition at line 173 of file localplayer.h.

void LocalPlayer::inviteToParty ( const std::string &  name  ) 

Invite a player to join their party.

Definition at line 339 of file localplayer.cpp.

void LocalPlayer::inviteToParty ( Player player  ) 

Invite a player to join their party.

Definition at line 344 of file localplayer.cpp.

void LocalPlayer::moveInvItem ( Item item,
int  newIndex 
)

Move the Inventory item from the old slot to the new slot.

Definition at line 349 of file localplayer.cpp.

void LocalPlayer::equipItem ( Item item  ) 

Equips an item.

Definition at line 362 of file localplayer.cpp.

void LocalPlayer::unequipItem ( Item item  ) 

Unequips an item.

Definition at line 367 of file localplayer.cpp.

void LocalPlayer::useItem ( Item item  ) 

Definition at line 379 of file localplayer.cpp.

void LocalPlayer::dropItem ( Item item,
int  quantity 
)

Definition at line 384 of file localplayer.cpp.

void LocalPlayer::pickUp ( FloorItem item  ) 

Definition at line 401 of file localplayer.cpp.

int LocalPlayer::getAttackRange (  ) 

Gets the attack range.

Definition at line 928 of file localplayer.cpp.

void LocalPlayer::trade ( Being being  )  const

Sents a trade request to the given being.

Definition at line 683 of file localplayer.cpp.

void LocalPlayer::tradeReply ( bool  accept  ) 

Accept or decline a trade offer.

Definition at line 675 of file localplayer.cpp.

bool LocalPlayer::tradeRequestOk (  )  const

Returns true when the player is ready to accept a trade offer.

Returns false otherwise.

Definition at line 688 of file localplayer.cpp.

void LocalPlayer::setTrading ( bool  trading  )  [inline]

Sets the trading state of the player, i.e.

whether or not he is currently involved into some trade.

Definition at line 257 of file localplayer.h.

void LocalPlayer::attack ( Being target = NULL,
bool  keep = false 
)

Definition at line 752 of file localplayer.cpp.

void LocalPlayer::setGM (  )  [virtual]

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

Reimplemented from Being.

Definition at line 239 of file localplayer.cpp.

void LocalPlayer::stopAttack (  ) 

Definition at line 810 of file localplayer.cpp.

virtual void LocalPlayer::handleAttack ( Being victim,
int  damage,
AttackType  type 
) [inline, virtual]

Overridden to do nothing.

The attacks of the local player are displayed as soon as the player attacks, not when the server says the player does.

Parameters:
victim the victim being
damage the amount of damage dealt (0 means miss)
type the attack type

Reimplemented from Being.

Definition at line 282 of file localplayer.h.

virtual void LocalPlayer::handleAttack (  )  [inline, virtual]

Definition at line 283 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 530 of file localplayer.cpp.

void LocalPlayer::setTarget ( Being target  ) 

Sets the target being of the player.

Definition at line 535 of file localplayer.cpp.

void LocalPlayer::setDestination ( Uint16  x,
Uint16  y 
) [virtual]

Sets a new destination for this being to walk to.

Definition at line 572 of file localplayer.cpp.

void LocalPlayer::setWalkingDir ( int  dir  ) 

Sets a new direction to keep walking in.

Definition at line 608 of file localplayer.cpp.

int LocalPlayer::getWalkingDir (  )  const [inline]

Gets the walking direction.

Definition at line 313 of file localplayer.h.

void LocalPlayer::setGotoTarget ( Being target  ) 

Sets going to being to attack.

Definition at line 966 of file localplayer.cpp.

bool LocalPlayer::withinAttackRange ( Being target  ) 

Returns whether the target is in range to attack.

Definition at line 943 of file localplayer.cpp.

void LocalPlayer::stopWalking ( bool  sendToServer = true  ) 

Stops the player dead in his tracks.

void LocalPlayer::raiseAttribute ( size_t  attr  ) 

Uses a character point to raise an attribute.

void LocalPlayer::lowerAttribute ( size_t  attr  ) 

Uses a correction point to lower an attribute.

void LocalPlayer::toggleSit (  ) 

Definition at line 649 of file localplayer.cpp.

void LocalPlayer::emote ( Uint8  emotion  ) 

Definition at line 666 of file localplayer.cpp.

void LocalPlayer::revive (  ) 

Definition at line 821 of file localplayer.cpp.

void LocalPlayer::pickedUp ( const std::string &  item  ) 

Shows item pickup effect if the player is on a map.

Definition at line 914 of file localplayer.cpp.

bool LocalPlayer::getInStorage (  )  [inline]

Accessors for mInStorage.

Definition at line 359 of file localplayer.h.

void LocalPlayer::setInStorage ( bool  inStorage  ) 

int LocalPlayer::getHp (  )  const [inline]

Definition at line 393 of file localplayer.h.

int LocalPlayer::getMaxHp (  )  const [inline]

Definition at line 396 of file localplayer.h.

void LocalPlayer::setHp ( int  value  )  [inline]

Definition at line 399 of file localplayer.h.

void LocalPlayer::setMaxHp ( int  value  )  [inline]

Definition at line 402 of file localplayer.h.

int LocalPlayer::getLevel (  )  const [inline]

Definition at line 405 of file localplayer.h.

void LocalPlayer::setLevel ( int  value  )  [inline]

Definition at line 408 of file localplayer.h.

int LocalPlayer::getMoney (  )  const [inline]

Definition at line 419 of file localplayer.h.

void LocalPlayer::setMoney ( int  value  )  [inline]

Definition at line 422 of file localplayer.h.

int LocalPlayer::getTotalWeight (  )  const [inline]

Definition at line 425 of file localplayer.h.

void LocalPlayer::setTotalWeight ( int  value  )  [inline]

Definition at line 428 of file localplayer.h.

int LocalPlayer::getMaxWeight (  )  const [inline]

Definition at line 431 of file localplayer.h.

void LocalPlayer::setMaxWeight ( int  value  )  [inline]

Definition at line 434 of file localplayer.h.

void LocalPlayer::handleStatusEffect ( StatusEffect effect,
int  effectId 
) [protected, virtual]

Handle an update to a status or stun effect.

Parameters:
The StatusEffect to effect
effectId -1 for stun, otherwise the effect index

Reimplemented from Being.

Definition at line 983 of file localplayer.cpp.

void LocalPlayer::walk ( unsigned char  dir  )  [protected]

Definition at line 430 of file localplayer.cpp.

void LocalPlayer::initTargetCursor (  )  [protected]

Definition at line 1021 of file localplayer.cpp.

void LocalPlayer::loadTargetCursor ( std::string  filename,
int  width,
int  height,
bool  outRange,
Being::TargetCursorSize  size 
) [protected]

Helper function for loading target cursors.

Definition at line 1038 of file localplayer.cpp.


Member Data Documentation

Definition at line 474 of file localplayer.h.

Whether or not the name settings have changed.

Definition at line 476 of file localplayer.h.

Whether or not the map is available yet.

Used to synchronize the charge dialog

Definition at line 478 of file localplayer.h.

const std::auto_ptr<Equipment> LocalPlayer::mEquipment

Definition at line 480 of file localplayer.h.

bool LocalPlayer::mInStorage [protected]

Whether storage is currently accessible.

Definition at line 487 of file localplayer.h.

int LocalPlayer::mLastTarget [protected]

Definition at line 492 of file localplayer.h.

int LocalPlayer::mLevel [protected]

Time stamp of last targeting action, -1 if none.

Definition at line 504 of file localplayer.h.

int LocalPlayer::mMoney [protected]

Definition at line 505 of file localplayer.h.

int LocalPlayer::mTotalWeight [protected]

Definition at line 506 of file localplayer.h.

int LocalPlayer::mMaxWeight [protected]

Definition at line 507 of file localplayer.h.

int LocalPlayer::mHp [protected]

Definition at line 508 of file localplayer.h.

int LocalPlayer::mMaxHp [protected]

Definition at line 509 of file localplayer.h.

Definition at line 511 of file localplayer.h.

Definition at line 512 of file localplayer.h.

bool LocalPlayer::mTrading [protected]

Definition at line 514 of file localplayer.h.

bool LocalPlayer::mGoingToTarget [protected]

Definition at line 515 of file localplayer.h.

bool LocalPlayer::mKeepAttacking [protected]

Definition at line 516 of file localplayer.h.

int LocalPlayer::mLastAction [protected]

Whether or not to continue to attack.

Time stamp of the last action, -1 if none.

Definition at line 517 of file localplayer.h.

int LocalPlayer::mWalkingDir [protected]

The direction the player is walking in.

Definition at line 518 of file localplayer.h.

int LocalPlayer::mDestX [protected]

X coordinate of destination.

Definition at line 519 of file localplayer.h.

int LocalPlayer::mDestY [protected]

Y coordinate of destination.

Definition at line 520 of file localplayer.h.

std::vector<int> LocalPlayer::mStatusEffectIcons [protected]

Definition at line 522 of file localplayer.h.

Definition at line 524 of file localplayer.h.

Definition at line 531 of file localplayer.h.

ImageSet* LocalPlayer::mTargetCursorImages[2][NUM_TC] [protected]

Images of the target cursor.

Definition at line 543 of file localplayer.h.

Animated target cursors.

Definition at line 546 of file localplayer.h.


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

Generated on Sun Apr 26 17:30:43 2009 for The Mana World by  doxygen 1.5.5