Character Class Reference

The representation of a player's character in the game world. More...

#include <character.hpp>

Inheritance diagram for Character:

Being Actor Thing

List of all members.

Public Member Functions

 Character (const std::string &name, int id=-1)
int getDatabaseID () const
 Gets the database id of the character.
void setDatabaseID (int id)
AccountgetAccount () const
 Gets the account the character belongs to.
void setAccount (Account *ptr)
 Sets the account the character belongs to, and related fields.
int getAccountID () const
 Gets the ID of the account the character belongs to.
void setAccountID (int id)
const std::string & getName () const
 Gets the name of the character.
void setName (const std::string &name)
 Sets the name of the being.
int getGender () const
 Gets the gender of the character (male / female).
void setGender (int gender)
int getHairStyle () const
 Gets the hairstyle of the character.
void setHairStyle (int style)
int getHairColor () const
 Gets the haircolor of the character.
void setHairColor (int color)
int getAccountLevel () const
 Gets the account level of the user.
void setAccountLevel (int l, bool force=false)
 Sets the account level of the user.
int getLevel () const
 Gets the level of the character.
void setLevel (int level)
int getAttribute (int n) const
 Gets the value of a base attribute of the character.
void setAttribute (int n, int value)
 Sets the value of a base attribute of the character.
int getExperience (int skill) const
void setExperience (int skill, int value)
void receiveExperience (int skill, int value)
int getMapId () const
 Gets the Id of the map that the character is on.
void setMapId (int mapId)
const PointgetPosition () const
 Gets the position of the character on the map.
void setPosition (const Point &p)
 Sets the coordinates.
void addGuild (const std::string &name)
 Add a guild to the character.
std::vector< std::string > getGuilds () const
 Returns a list of guilds the player belongs to.
const PossessionsgetPossessions () const
 Gets a reference on the possessions.
PossessionsgetPossessions ()
 Gets a reference on the possessions.
void setCharacterPoints (int points)
int getCharacterPoints () const
void setCorrectionPoints (int points)
int getCorrectionPoints () const
 Character (MessageIn &msg)
 Utility constructor for creating a Character from a received characterdata message.
void update ()
 recalculates the level when necessary and calls Being::update
void perform ()
 Perform actions.
void respawn ()
 makes the character respawn
void useSpecial (int id)
 makes the character perform a special action when it is allowed to do so
void giveSpecial (int id)
 Allows a character to perform a special action.
GameClient * getClient () const
 Gets client computer.
void setClient (GameClient *c)
 Sets client computer.
const PossessionsgetPossessions () const
 Gets a reference on the possessions.
PossessionsgetPossessions ()
 Gets a reference on the possessions.
Trade * getTrading () const
 Gets the Trade object the character is involved in.
void setTrading (Trade *t)
 Sets the Trade object the character is involved in.
BuySell * getBuySell () const
 Gets the BuySell object the character is involved in.
void setBuySell (BuySell *t)
 Sets the trade object the character is involved in.
void cancelTransaction ()
 Cancels current transaction.
bool isBusy () const
 Gets transaction status of the character.
int getDatabaseID () const
 Gets the database id of the character.
void setDatabaseID (int id)
 Sets the database id of the character.
int getGender () const
 Gets the gender of the character (male or female).
void setGender (int gender)
 Sets the gender of the character (male or female).
int getHairStyle () const
 Gets the hairstyle of the character.
void setHairStyle (int style)
 Sets the hairstyle of the character.
int getHairColor () const
 Gets the haircolor of the character.
void setHairColor (int color)
 Sets the haircolor of the character.
int getLevel () const
 Gets the level of the character.
void setLevel (int level)
 Sets the level of the character.
int getAccountLevel () const
 Gets the account level of the user.
void setAccountLevel (int l)
 Sets the account level of the user.
int getParty () const
 Gets the party id of the character.
void setParty (int party)
 Sets the party id of the character.
void sendStatus ()
 Sends a message that informs the client about attribute modified since last call.
int getMapId () const
 Gets the ID of the map that the character is on.
void setMapId (int)
 Sets the ID of the map that the character is on.
void modifiedAttribute (int)
 Updates base Being attributes.
void disconnected ()
 Calls all the "disconnected" listener.
void receiveExperience (size_t skill, int experience)
 Gives a skill a specific amount of exp and checks if a levelup occured.
int getExperience (int skill) const
 Gets total accumulated exp for skill.
void setExperience (int skill, int value)
 Sets total accumulated exp for skill.
int getHealth () const
 Shortcut to get being's health.
AttribmodResponseCode useCharacterPoint (size_t attribute)
 Tries to use a character point to increase a basic attribute.
AttribmodResponseCode useCorrectionPoint (size_t attribute)
 Tries to use a correction point to reduce a basic attribute and regain a character point.
void setCharacterPoints (int points)
int getCharacterPoints () const
void setCorrectionPoints (int points)
int getCorrectionPoints () const
virtual unsigned char getWalkMask () const
 Gets the way the actor is blocked by other things on the map.

Static Public Member Functions

static int expForLevel (int level)
 Returns the exp needed to reach a specific skill level.

Public Attributes

std::map< std::string,
std::string > 
questCache
 Associative array containing all the quest variables known by the server.

Protected Member Functions

virtual Map::BlockType getBlockType () const
 Gets the way the actor blocks pathfinding for other objects.


Detailed Description

The representation of a player's character in the game world.

Definition at line 34 of file character.hpp.


Member Function Documentation

Account* Character::getAccount (  )  const [inline]

Gets the account the character belongs to.

Definition at line 47 of file character.hpp.

void Character::setAccount ( Account ptr  ) 

Sets the account the character belongs to, and related fields.

Definition at line 49 of file character.cpp.

References Account::getID(), and Account::getLevel().

void Character::setName ( const std::string &  name  )  [inline]

Sets the name of the being.

Reimplemented from Being.

Definition at line 63 of file character.hpp.

Referenced by Character().

int Character::getAccountLevel (  )  const [inline]

Gets the account level of the user.

Definition at line 84 of file character.hpp.

void Character::setAccountLevel ( int  l,
bool  force = false 
) [inline]

Sets the account level of the user.

Parameters:
force ensure the level is not modified by a game server.

Definition at line 91 of file character.hpp.

int Character::getAttribute ( int  n  )  const [inline]

Gets the value of a base attribute of the character.

Reimplemented from Being.

Definition at line 101 of file character.hpp.

Referenced by modifiedAttribute(), receiveExperience(), sendStatus(), DALStorage::updateCharacter(), useCharacterPoint(), and useCorrectionPoint().

void Character::setAttribute ( int  n,
int  value 
) [inline]

Sets the value of a base attribute of the character.

Reimplemented from Being.

Definition at line 105 of file character.hpp.

Referenced by modifiedAttribute(), receiveExperience(), useCharacterPoint(), and useCorrectionPoint().

void Character::setPosition ( const Point p  )  [inline]

Sets the coordinates.

Also updates the walkmap of the map the actor is on.

Parameters:
p the coordinates.

Reimplemented from Actor.

Definition at line 127 of file character.hpp.

void Character::setTrading ( Trade *  t  ) 

Sets the Trade object the character is involved in.

Cancels other transactions.

Definition at line 246 of file character.cpp.

References cancelTransaction().

void Character::setBuySell ( BuySell *  t  ) 

Sets the trade object the character is involved in.

Cancels other transactions.

Definition at line 261 of file character.cpp.

References cancelTransaction().

int Character::getDatabaseID (  )  const [inline]

Gets the database id of the character.

Definition at line 154 of file character.hpp.

void Character::setDatabaseID ( int  id  )  [inline]

Sets the database id of the character.

Definition at line 159 of file character.hpp.

int Character::getGender (  )  const [inline]

Gets the gender of the character (male or female).

Definition at line 164 of file character.hpp.

void Character::setGender ( int  gender  )  [inline]

Sets the gender of the character (male or female).

Definition at line 169 of file character.hpp.

int Character::getHairStyle (  )  const [inline]

Gets the hairstyle of the character.

Definition at line 174 of file character.hpp.

void Character::setHairStyle ( int  style  )  [inline]

Sets the hairstyle of the character.

Definition at line 179 of file character.hpp.

int Character::getHairColor (  )  const [inline]

Gets the haircolor of the character.

Definition at line 184 of file character.hpp.

void Character::setHairColor ( int  color  )  [inline]

Sets the haircolor of the character.

Definition at line 189 of file character.hpp.

int Character::getLevel (  )  const [inline]

Gets the level of the character.

Definition at line 194 of file character.hpp.

void Character::setLevel ( int  level  )  [inline]

Sets the level of the character.

Definition at line 199 of file character.hpp.

int Character::getAccountLevel (  )  const [inline]

Gets the account level of the user.

Definition at line 203 of file character.hpp.

void Character::setAccountLevel ( int  l  )  [inline]

Sets the account level of the user.

Definition at line 207 of file character.hpp.

int Character::getMapId (  )  const

Gets the ID of the map that the character is on.

For serialization purpose only.

void Character::setMapId ( int   ) 

Sets the ID of the map that the character is on.

For serialization purpose only.


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

Generated on Sun Apr 26 17:30:46 2009 for TMW Server Collection by  doxygen 1.5.5