00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _TMWSERV_CHARACTERDATA
00022 #define _TMWSERV_CHARACTERDATA
00023
00024 #include <string>
00025 #include <vector>
00026
00027 #include "defines.h"
00028 #include "point.h"
00029 #include "common/inventorydata.hpp"
00030
00031 class Account;
00032 class MessageIn;
00033
00034 class Character
00035 {
00036 public:
00037
00038 Character(const std::string &name, int id = -1);
00039
00043 int getDatabaseID() const { return mDatabaseID; }
00044 void setDatabaseID(int id) { mDatabaseID = id; }
00045
00047 Account *getAccount() const
00048 { return mAccount; }
00049
00051 void setAccount(Account *ptr);
00052
00056 int getAccountID() const { return mAccountID; }
00057 void setAccountID(int id) { mAccountID = id; }
00058
00062 const std::string &getName() const { return mName; }
00063 void setName(const std::string &name) { mName = name; }
00064
00068 int getGender() const { return mGender; }
00069 void setGender(int gender) { mGender = gender; }
00070
00074 int getHairStyle() const { return mHairStyle; }
00075 void setHairStyle(int style) { mHairStyle = style; }
00076
00080 int getHairColor() const { return mHairColor; }
00081 void setHairColor(int color) { mHairColor = color; }
00082
00084 int getAccountLevel() const
00085 { return mAccountLevel; }
00086
00091 void setAccountLevel(int l, bool force = false)
00092 { if (force) mAccountLevel = l; }
00093
00097 int getLevel() const { return mLevel; }
00098 void setLevel(int level) { mLevel = level; }
00099
00101 int getAttribute(int n) const
00102 { return mAttributes[n - CHAR_ATTR_BEGIN]; }
00103
00105 void setAttribute(int n, int value)
00106 { mAttributes[n - CHAR_ATTR_BEGIN] = value; }
00107
00108 int getExperience(int skill) const
00109 { return mExperience[skill]; }
00110
00111 void setExperience(int skill, int value)
00112 { mExperience[skill] = value; }
00113
00114 void receiveExperience(int skill, int value)
00115 { mExperience[skill] += value; }
00116
00120 int getMapId() const { return mMapId; }
00121 void setMapId(int mapId) { mMapId = mapId; }
00122
00126 const Point &getPosition() const { return mPos; }
00127 void setPosition(const Point &p) { mPos = p; }
00128
00130 void addGuild(const std::string &name) { mGuilds.push_back(name); }
00131
00133 std::vector<std::string>
00134 getGuilds() const { return mGuilds; }
00135
00139 const Possessions &getPossessions() const
00140 { return mPossessions; }
00141
00145 Possessions &getPossessions()
00146 { return mPossessions; }
00147
00148 void setCharacterPoints(int points)
00149 { mCharacterPoints = points; }
00150
00151 int getCharacterPoints() const
00152 { return mCharacterPoints; }
00153
00154 void setCorrectionPoints(int points)
00155 { mCorrectionPoints = points; }
00156
00157 int getCorrectionPoints() const
00158 { return mCorrectionPoints; }
00159
00160
00161 private:
00162 Character(const Character &);
00163 Character &operator=(const Character &);
00164
00165 Possessions mPossessions;
00166 std::string mName;
00167 int mDatabaseID;
00168 int mAccountID;
00169 Account *mAccount;
00170 Point mPos;
00171 unsigned short mAttributes[CHAR_ATTR_NB];
00172 int mExperience[CHAR_SKILL_NB];
00173 unsigned short mMapId;
00174 unsigned char mGender;
00175 unsigned char mHairStyle;
00176 unsigned char mHairColor;
00177 short mLevel;
00178 short mCharacterPoints;
00179 short mCorrectionPoints;
00180 unsigned char mAccountLevel;
00181
00182 std::vector<std::string> mGuilds;
00183
00184 };
00185
00189 typedef std::vector< Character * > Characters;
00190
00191 #endif