Add infos into target window
[ryzomcore.git] / ryzom / server / src / entities_game_service / guild_pd.h
blob56e918162c26f02785f51be962eeacf1dfd6fcef
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef GUILD_PD_H
19 #define GUILD_PD_H
21 #include <nel/misc/types_nl.h>
22 #include <nel/misc/debug.h>
23 #include <nel/misc/common.h>
24 #include <nel/misc/entity_id.h>
25 #include <nel/misc/sheet_id.h>
26 #include <vector>
27 #include <map>
28 #include <pd_lib/pd_lib.h>
29 #include <game_share/persistent_data.h>
31 // User #includes
32 #include "mission_manager/ai_alias_translator.h"
34 namespace EGSPD
38 // Forward declarations
44 // Typedefs & Enums
47 /** CGuildPD
48 * defined at entities_game_service/pd_scripts/guild.pds:58
50 class CGuildPD : public RY_PDS::IPDBaseData
53 public:
55 /// \name Accessors and Mutators methods
56 // @{
58 /**
59 * Use these methods to change a value, add or delete elements.
62 TGuildId getId() const;
64 uint64 getMoney() const;
65 void setMoney(uint64 __v, bool forceWrite=false);
67 uint32 getCreationDate() const;
68 void setCreationDate(uint32 __v, bool forceWrite=false);
70 uint32 getXP() const;
71 void setXP(uint32 __v, bool forceWrite=false);
73 uint32 getChargesPoints() const;
74 void setChargesPoints(uint32 __v, bool forceWrite=false);
76 CPeople::TPeople getRace() const;
77 void setRace(CPeople::TPeople __v, bool forceWrite=false);
79 uint64 getIcon() const;
80 void setIcon(uint64 __v, bool forceWrite=false);
82 uint32 getBuilding() const;
83 void setBuilding(uint32 __v, bool forceWrite=false);
85 uint32 getVersion() const;
86 void setVersion(uint32 __v, bool forceWrite=false);
88 CGuildMemberPD* getMembers(const TCharacterId& __k);
89 const CGuildMemberPD* getMembers(const TCharacterId& __k) const;
90 std::map<TCharacterId, CGuildMemberPD*>::iterator getMembersBegin();
91 std::map<TCharacterId, CGuildMemberPD*>::iterator getMembersEnd();
92 std::map<TCharacterId, CGuildMemberPD*>::const_iterator getMembersBegin() const;
93 std::map<TCharacterId, CGuildMemberPD*>::const_iterator getMembersEnd() const;
94 const std::map<TCharacterId, CGuildMemberPD*> & getMembers() const;
95 void setMembers(CGuildMemberPD* __v);
96 void deleteFromMembers(const TCharacterId &__k);
98 CGuildFameContainerPD* getFameContainer();
99 const CGuildFameContainerPD* getFameContainer() const;
100 void setFameContainer(CGuildFameContainerPD* __v);
102 CGuildContainerPD* getParent();
103 const CGuildContainerPD* getParent() const;
105 // @}
108 public:
110 /// \name Public Management methods
111 // @{
114 * Use these methods to create, load, unload and get
115 * an object from database.
120 * Clear whole object content but key (delete subobjects if there are, key is left unmodified), default clear value is 0.
122 void clear();
125 * Cast base object to CGuildPD
127 static CGuildPD* cast(RY_PDS::IPDBaseData* obj);
130 * Cast base object to const CGuildPD
132 static const CGuildPD* cast(const RY_PDS::IPDBaseData* obj);
135 * Set user factory for this class (as class is indicated as derived, a home made constructor must be provided)
137 static void setFactory(RY_PDS::TPDFactory userFactory);
140 * Create an object of the CGuildPD class, and declare it to the PDS.
142 static CGuildPD* create(const TGuildId &Id);
144 // @}
147 public:
149 /// \name Public constructor
150 // @{
153 * This constructor is public to allow direct instanciation of the class
156 CGuildPD();
157 virtual ~CGuildPD();
159 // @}
162 public:
164 /// \name Persistent methods declaration
165 // @{
167 void apply(CPersistentDataRecord &__pdr);
168 void store(CPersistentDataRecord &__pdr) const;
170 // @}
173 protected:
175 /// \name User defined init and release methods
176 // @{
179 * Overload those methods to implement init and release behaviours
182 virtual void init();
183 virtual void release();
185 // @}
188 protected:
190 /// \name Attributes
191 // @{
194 * Don't modify those value manually, use accessors and mutators above
197 TGuildId _Id;
198 uint64 _Money;
199 uint32 _CreationDate;
200 uint32 _XP;
201 uint32 _ChargesPoints;
202 CPeople::TPeople _Race;
203 uint64 _Icon;
204 uint32 _Building;
205 uint32 _Version;
206 std::map<TCharacterId, CGuildMemberPD*> _Members;
207 CGuildFameContainerPD* _FameContainer;
208 CGuildContainerPD* _Parent;
210 // @}
213 protected:
215 /// \name Internal Management methods
216 // @{
218 void pds__init(const TGuildId &Id);
219 void pds__destroy();
220 void pds__fetch(RY_PDS::CPData &data);
221 void pds__register();
222 void pds__registerAttributes();
223 void pds__unregister();
224 void pds__unregisterAttributes();
225 void pds__setParent(CGuildContainerPD* __parent);
226 void pds__setParentUnnotified(CGuildContainerPD* __parent);
227 void pds__notifyInit();
228 void pds__notifyRelease();
229 void pds__unlinkMembers(TCharacterId __k);
230 void pds__unlinkFameContainer(NLMISC::CEntityId dummy);
231 static void pds_static__init();
233 // @}
236 protected:
238 /// \name Default Factory and Fetch methods
239 // @{
241 static void pds_static__setFactory(RY_PDS::TPDFactory userFactory);
242 static bool _FactoryInitialised;
243 static RY_PDS::CIndexAllocator _IndexAllocator;
244 static void pds_static__fetch(RY_PDS::IPDBaseData *object, RY_PDS::CPData &data);
246 // @}
249 protected:
251 friend class CGuildContainerPD;
252 friend class CGuildFameContainerPD;
253 friend class CGuildMemberPD;
254 friend class RY_PDS::CPDSLib;
255 friend void EGSPD::init(uint32);
259 } // End of EGSPD
261 #endif