characterdata.hpp

Go to the documentation of this file.
00001 /*
00002  *  The Mana World Server
00003  *  Copyright 2004 The Mana World Development Team
00004  *
00005  *  This file is part of The Mana World.
00006  *
00007  *  The Mana World  is free software; you can redistribute  it and/or modify it
00008  *  under the terms of the GNU General  Public License as published by the Free
00009  *  Software Foundation; either version 2 of the License, or any later version.
00010  *
00011  *  The Mana  World is  distributed in  the hope  that it  will be  useful, but
00012  *  WITHOUT ANY WARRANTY; without even  the implied warranty of MERCHANTABILITY
00013  *  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00014  *  more details.
00015  *
00016  *  You should  have received a  copy of the  GNU General Public  License along
00017  *  with The Mana  World; if not, write to the  Free Software Foundation, Inc.,
00018  *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00019  *
00020  *  $Id$
00021  */
00022 
00023 #ifndef _TMWSERV_CHARACTERDATA
00024 #define _TMWSERV_CHARACTERDATA
00025 
00026 #include "abstractcharacterdata.hpp"
00027 #include "defines.h"
00028 #include <string>
00029 #include <vector>
00030 
00031 #include "utils/countedptr.h"
00032 
00033 #include "point.h"
00034 
00035 class MessageIn;
00036 
00037 class CharacterData: public AbstractCharacterData
00038 {
00039     public:
00040 
00041         CharacterData(std::string const &name, int id = -1);
00042 
00046         CharacterData(MessageIn & msg);
00047 
00053         int
00054         getDatabaseID() const { return mDatabaseID; }
00055 
00057         void
00058         setDatabaseID(int id) { mDatabaseID = id; }
00059 
00061         int
00062         getAccountID() const { return mAccountID; }
00063 
00065         void
00066         setAccountID(int id) { mAccountID = id; }
00067 
00069         std::string const &
00070         getName() const { return mName; }
00071 
00073         void
00074         setName(const std::string& name) { mName = name; }
00075 
00077         int
00078         getGender() const { return mGender; }
00079 
00081         void
00082         setGender(int gender) { mGender = gender; }
00083 
00085         int
00086         getHairStyle() const { return mHairStyle; }
00087 
00089         void
00090         setHairStyle(int style) { mHairStyle = style; }
00091 
00093         int
00094         getHairColor() const { return mHairColor; }
00095 
00097         void
00098         setHairColor(int color) { mHairColor = color; }
00099 
00101         int
00102         getLevel() const { return mLevel; }
00103 
00105         void
00106         setLevel(int level) { mLevel = level; }
00107 
00109         int
00110         getMoney() const { return mMoney; }
00111 
00113         void
00114         setMoney(int amount) { mMoney = amount; }
00115 
00117         unsigned short
00118         getBaseAttribute(int attributeNumber) const
00119         { return mBaseAttributes[attributeNumber]; }
00120 
00122         void
00123         setBaseAttribute(int attributeNumber, int value)
00124         { mBaseAttributes[attributeNumber] = value; }
00125 
00127         int
00128         getMapId() const { return mMapId; }
00129 
00131         void
00132         setMapId(int mapId) { mMapId = mapId; }
00133 
00135         Point const &
00136         getPosition() const { return mPos; }
00137 
00139         void
00140         setPosition(const Point &p) { mPos = p; }
00141 
00143         int
00144         getNumberOfInventoryItems() const { return mInventory.size(); }
00145 
00147         InventoryItem const &
00148         getInventoryItem(unsigned short slot) const;
00149 
00151         void
00152         clearInventory() { mInventory.clear(); }
00153 
00155         void
00156         addItemToInventory(const InventoryItem& item);
00157 
00158     private:
00159         CharacterData(CharacterData const &);
00160         CharacterData &operator=(CharacterData const &);
00161 
00162         int mDatabaseID;          
00163 
00164         int mAccountID;           
00165 
00166         std::string mName;        
00167         unsigned char mGender;    
00168         unsigned char mHairStyle; 
00169         unsigned char mHairColor; 
00170         unsigned char mLevel;     
00171         unsigned int mMoney;      
00172         unsigned short mBaseAttributes[NB_BASE_ATTRIBUTES]; 
00173 
00174         unsigned short mMapId;    
00175         Point mPos;               
00176         std::vector< InventoryItem > mInventory; 
00177 
00178 };
00179 
00180 // Utility typedefs
00184 typedef utils::CountedPtr< CharacterData > CharacterPtr;
00185 
00189 typedef std::vector< CharacterPtr > Characters;
00190 
00191 #endif

Generated on Fri Mar 30 15:39:16 2007 for TMW Server by  doxygen 1.3.9.1