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/>.
19 #ifndef FAMILY_PROFILE_H
20 #define FAMILY_PROFILE_H
22 #include "nel/misc/smart_ptr.h"
24 #include "ai_share/ai_types.h"
25 #include "server_share/mission_messages.h"
26 #include "game_share/zc_shard_common.h"
27 #include "ai_factory.h"
29 class CFamilyBehavior
;
36 template <class FamilyT
>
39 /** Interface class for family profile
41 class IFamilyProfile
:
42 public NLMISC::CDbgRefCount
<IFamilyProfile
>,
43 public NLMISC::CRefCount
46 NLMISC::CDbgPtr
<CFamilyBehavior
> _FamilyBehavior
;
52 CtorParam(CFamilyBehavior
*familyBehavior
)
53 :_familyBehavior(familyBehavior
)
56 nlassert(familyBehavior
);
61 const CFamilyBehavior
*familyBehavior () const
63 return _familyBehavior
;
66 friend class IFamilyProfile
;
68 CFamilyBehavior
*_familyBehavior
;
72 IFamilyProfile (const CtorParam
&ctorParam
)
73 :_FamilyBehavior(ctorParam
._familyBehavior
)
77 virtual ~IFamilyProfile ()
81 virtual void setDefaultProfile(const CNpcZone
*const zone
, CGroupNpc
*grp
) {}
84 virtual void spawnGroup() =0;
86 /// The main update for the profile. Called aprox every 10 s (100 ticks)
87 virtual void update() =0;
89 /// Fill a vector of outpost id name assigned to tribe
90 virtual void fillOutpostNames(std::vector
<NLMISC::TStringId
> outpostNames
) {}
91 /// Add an outpost for the tribe (nb : the family must be a tribe)
92 virtual void outpostAdd(NLMISC::TStringId outpostName
) {}
93 /// Remove an from the tribe
94 virtual void outpostRemove(NLMISC::TStringId outpostName
) {}
96 virtual void outpostEvent(NLMISC::TStringId outpostName
, ZCSTATE::TZcState state
) {}
98 virtual void spawnBoss(NLMISC::TStringId outpostName
) {}
100 CGroupNpc
*createNpcGroup(const CNpcZone
*const zone
, const CGroupDesc
<CGroupFamily
> *const groupDesc
);
102 /** Factory method to create profile instance.
103 * NB : you are responsible to delete the profile.
105 static IFamilyProfile
* createFamilyProfile(const NLMISC::TStringId
&profileNamer
, const IFamilyProfile::CtorParam
& ctorParam
);
109 class CFamilyProfileFactory
110 : public CAiFactoryContainer
<IFamilyProfile
, NLMISC::TStringId
> // TFamilyTag>
113 CFamilyProfileFactory();
115 static CAiFactoryContainer
<IFamilyProfile
, NLMISC::TStringId
> &instance();
117 virtual ~CFamilyProfileFactory();
119 static IFamilyProfile
* createFamilyProfile(const NLMISC::TStringId
&keyWord
, const IFamilyProfile::CtorParam
& ctorParam
);
124 #endif // FAMILY_PROFILE_H