Character Class Reference

#include <character.hpp>

Inheritance diagram for Character:

Being AbstractCharacterData MovingObject Object Thing List of all members.

Detailed Description

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

Definition at line 46 of file character.hpp.

Public Member Functions

 Character (MessageIn &msg)
 Utility constructor for creating a Character from a received characterdata message.
void update ()
 Updates the internal status.
GameClientgetClient () const
 Gets client computer.
void setClient (GameClient *c)
 Sets client computer.
PossessionsgetPossessions ()
 Gets a reference on the possession.
int getDatabaseID () const
 Gets the database id of the character.
void setDatabaseID (int id)
 Sets the database id of the character.
std::string const & getName () const
 Gets the name of the character.
void setName (const std::string &name)
 Sets the name 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 getMoney () const
 Gets the amount of money the character has.
void setMoney (int amount)
 Sets the amount of money the character has.
unsigned short getBaseAttribute (int attributeNumber) const
 Gets the value of an attribute of the character.
void setBaseAttribute (int attributeNumber, int value)
 Sets the value of an attribute of the character.
void writeAttributeUpdateMessage (MessageOut &msg)
 Creates a message that informs the client about the attribute changes since last call.
int getMapId () const
 Gets the Id of the map that the character is on.
void setMapId (int mapId)
 Sets the Id of the map that the character is on.
Point const & getPosition () const
 Gets the position of the character on the map.
void setPosition (const Point &p)
 Sets the position of the character on the map.
int getNumberOfInventoryItems () const
 Returns the number of inventory items.
InventoryItem const & getInventoryItem (unsigned short slot) const
 Returns a reference to the item in inventory at slot.
void clearInventory ()
 Clears the inventory, in preperation for an update.
void addItemToInventory (const InventoryItem &item)
 Adds an inventory item to the inventory.

Protected Member Functions

void calculateDerivedAttributes ()
 Calculates all derived attributes.
virtual WeaponStats getWeaponStats ()
 Gets the stats of the currently equipped weapon that are relevant for damage calculation.

Private Member Functions

 Character (Character const &)
Characteroperator= (Character const &)

Private Attributes

GameClientmClient
 Client computer.
std::vector< unsigned short > mOldAttributes
 Atributes as the client should currently know them.
bool mAttributesChanged
 true when one or more attributes might have changed since the client has been updated about them.
int mDatabaseID
 Character's database ID.
std::string mName
 Name of the character.
unsigned char mGender
 Gender of the character.
unsigned char mHairStyle
 Hair Style of the character.
unsigned char mHairColor
 Hair Color of the character.
unsigned char mLevel
 Level of the character.
unsigned int mMoney
 Wealth of the being.
Possessions mPossessions
 Possesssions of the character.


Constructor & Destructor Documentation

Character::Character MessageIn msg  ) 
 

Utility constructor for creating a Character from a received characterdata message.

Definition at line 33 of file character.cpp.

Character::Character Character const &   )  [private]
 


Member Function Documentation

void Character::addItemToInventory const InventoryItem item  )  [virtual]
 

Adds an inventory item to the inventory.

Implements AbstractCharacterData.

Definition at line 99 of file character.cpp.

void Character::calculateDerivedAttributes  )  [protected]
 

Calculates all derived attributes.

Reimplemented from Being.

Definition at line 104 of file character.cpp.

void Character::clearInventory  )  [virtual]
 

Clears the inventory, in preperation for an update.

Implements AbstractCharacterData.

Definition at line 93 of file character.cpp.

unsigned short Character::getBaseAttribute int  attributeNumber  )  const [inline, virtual]
 

Gets the value of an attribute of the character.

Inherited from Being, explicitly defined because of double inheritance.

Implements AbstractCharacterData.

Definition at line 162 of file character.hpp.

GameClient* Character::getClient  )  const [inline]
 

Gets client computer.

Definition at line 64 of file character.hpp.

int Character::getDatabaseID  )  const [inline, virtual]
 

Gets the database id of the character.

Implements AbstractCharacterData.

Definition at line 88 of file character.hpp.

int Character::getGender  )  const [inline, virtual]
 

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

Implements AbstractCharacterData.

Definition at line 108 of file character.hpp.

int Character::getHairColor  )  const [inline, virtual]
 

Gets the haircolor of the character.

Implements AbstractCharacterData.

Definition at line 128 of file character.hpp.

int Character::getHairStyle  )  const [inline, virtual]
 

Gets the hairstyle of the character.

Implements AbstractCharacterData.

Definition at line 118 of file character.hpp.

InventoryItem const & Character::getInventoryItem unsigned short  slot  )  const [virtual]
 

Returns a reference to the item in inventory at slot.

TODO: Keep this consistent with whatever is chosen for getNumberOfInventoryItems.

Implements AbstractCharacterData.

Definition at line 80 of file character.cpp.

int Character::getLevel void   )  const [inline, virtual]
 

Gets the level of the character.

Implements AbstractCharacterData.

Definition at line 138 of file character.hpp.

int Character::getMapId  )  const [inline, virtual]
 

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

Inherited from Thing through Being, explicitly defined because of double inheritance.

Implements AbstractCharacterData.

Definition at line 187 of file character.hpp.

int Character::getMoney  )  const [inline, virtual]
 

Gets the amount of money the character has.

Implements AbstractCharacterData.

Definition at line 148 of file character.hpp.

std::string const& Character::getName void   )  const [inline, virtual]
 

Gets the name of the character.

Implements AbstractCharacterData.

Definition at line 98 of file character.hpp.

int Character::getNumberOfInventoryItems  )  const [virtual]
 

Returns the number of inventory items.

(items don't have to be unique) TODO: maybe renaming to NumberOfFilledSlots would be better.

Implements AbstractCharacterData.

Definition at line 73 of file character.cpp.

Point const& Character::getPosition  )  const [inline, virtual]
 

Gets the position of the character on the map.

Inherited from Object through Being, explicitly defined because of double inheritance.

Implements AbstractCharacterData.

Definition at line 205 of file character.hpp.

Possessions& Character::getPossessions  )  [inline]
 

Gets a reference on the possession.

Used in the current Inventory class

Definition at line 77 of file character.hpp.

WeaponStats Character::getWeaponStats  )  [protected, virtual]
 

Gets the stats of the currently equipped weapon that are relevant for damage calculation.

Reimplemented from Being.

Definition at line 115 of file character.cpp.

Character& Character::operator= Character const &   )  [private]
 

void Character::setBaseAttribute int  attributeNumber,
int  value
[inline, virtual]
 

Sets the value of an attribute of the character.

Inherited from Being, explicitly defined because of double inheritance.

Implements AbstractCharacterData.

Definition at line 171 of file character.hpp.

void Character::setClient GameClient c  )  [inline]
 

Sets client computer.

Definition at line 70 of file character.hpp.

void Character::setDatabaseID int  id  )  [inline, virtual]
 

Sets the database id of the character.

Implements AbstractCharacterData.

Definition at line 93 of file character.hpp.

void Character::setGender int  gender  )  [inline, virtual]
 

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

Implements AbstractCharacterData.

Definition at line 113 of file character.hpp.

void Character::setHairColor int  color  )  [inline, virtual]
 

Sets the haircolor of the character.

Implements AbstractCharacterData.

Definition at line 133 of file character.hpp.

void Character::setHairStyle int  style  )  [inline, virtual]
 

Sets the hairstyle of the character.

Implements AbstractCharacterData.

Definition at line 123 of file character.hpp.

void Character::setLevel int  level  )  [inline, virtual]
 

Sets the level of the character.

Implements AbstractCharacterData.

Definition at line 143 of file character.hpp.

void Character::setMapId int  mapId  )  [inline, virtual]
 

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

Inherited from Thing through Being, explicitly defined because of double inheritance.

Implements AbstractCharacterData.

Definition at line 196 of file character.hpp.

void Character::setMoney int  amount  )  [inline, virtual]
 

Sets the amount of money the character has.

Implements AbstractCharacterData.

Definition at line 153 of file character.hpp.

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

Sets the name of the character.

Implements AbstractCharacterData.

Definition at line 103 of file character.hpp.

void Character::setPosition const Point p  )  [inline, virtual]
 

Sets the position of the character on the map.

Inherited from Object through Being, explicitly defined because of double inheritance.

Implements AbstractCharacterData.

Definition at line 214 of file character.hpp.

void Character::update  )  [virtual]
 

Updates the internal status.

Implements Thing.

Definition at line 56 of file character.cpp.

void Character::writeAttributeUpdateMessage MessageOut msg  ) 
 

Creates a message that informs the client about the attribute changes since last call.

Definition at line 130 of file character.cpp.


Member Data Documentation

bool Character::mAttributesChanged [private]
 

true when one or more attributes might have changed since the client has been updated about them.

Definition at line 272 of file character.hpp.

GameClient* Character::mClient [private]
 

Client computer.

Definition at line 263 of file character.hpp.

int Character::mDatabaseID [private]
 

Character's database ID.

Definition at line 274 of file character.hpp.

unsigned char Character::mGender [private]
 

Gender of the character.

Definition at line 276 of file character.hpp.

unsigned char Character::mHairColor [private]
 

Hair Color of the character.

Definition at line 278 of file character.hpp.

unsigned char Character::mHairStyle [private]
 

Hair Style of the character.

Definition at line 277 of file character.hpp.

unsigned char Character::mLevel [private]
 

Level of the character.

Definition at line 279 of file character.hpp.

unsigned int Character::mMoney [private]
 

Wealth of the being.

Definition at line 280 of file character.hpp.

std::string Character::mName [private]
 

Name of the character.

Definition at line 275 of file character.hpp.

std::vector<unsigned short> Character::mOldAttributes [private]
 

Atributes as the client should currently know them.

Definition at line 266 of file character.hpp.

Possessions Character::mPossessions [private]
 

Possesssions of the character.

Definition at line 282 of file character.hpp.


The documentation for this class was generated from the following files:
Generated on Fri Mar 30 15:39:18 2007 for TMW Server by  doxygen 1.3.9.1