1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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/>.
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>
28 #include <pd_lib/pd_lib.h>
29 #include <game_share/persistent_data.h>
32 #include "mission_manager/ai_alias_translator.h"
38 // Forward declarations
48 * defined at entities_game_service/pd_scripts/guild.pds:58
50 class CGuildPD
: public RY_PDS::IPDBaseData
55 /// \name Accessors and Mutators methods
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);
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;
110 /// \name Public Management methods
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.
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
);
149 /// \name Public constructor
153 * This constructor is public to allow direct instanciation of the class
164 /// \name Persistent methods declaration
167 void apply(CPersistentDataRecord
&__pdr
);
168 void store(CPersistentDataRecord
&__pdr
) const;
175 /// \name User defined init and release methods
179 * Overload those methods to implement init and release behaviours
183 virtual void release();
194 * Don't modify those value manually, use accessors and mutators above
199 uint32 _CreationDate
;
201 uint32 _ChargesPoints
;
202 CPeople::TPeople _Race
;
206 std::map
<TCharacterId
, CGuildMemberPD
*> _Members
;
207 CGuildFameContainerPD
* _FameContainer
;
208 CGuildContainerPD
* _Parent
;
215 /// \name Internal Management methods
218 void pds__init(const TGuildId
&Id
);
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();
238 /// \name Default Factory and Fetch methods
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
);
251 friend class CGuildContainerPD
;
252 friend class CGuildFameContainerPD
;
253 friend class CGuildMemberPD
;
254 friend class RY_PDS::CPDSLib
;
255 friend void EGSPD::init(uint32
);