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/>.
18 #pragma warning (disable : 4355) // warning C4355: 'this' : used in base member initializer list
19 #endif // NL_OS_WINDOWS
21 #ifndef RYAI_BOT_PET_H
22 #define RYAI_BOT_PET_H
25 #include "path_behaviors.h"
31 class IAIBotCAIProfile
;
34 //////////////////////////////////////////////////////////////////////////////
36 //////////////////////////////////////////////////////////////////////////////
39 : public NLMISC::CDbgRefCount
<CSpawnBotPet
>
43 CSpawnBotPet(TDataSetRow
const& row
, CBot
& owner
, NLMISC::CEntityId
const& id
, float radius
, uint32 level
, RYAI_MAP_CRUNCH::TAStarFlag denyFlags
);
45 void processEvent(CCombatInterface::CEvent
const& event
) { }
47 RYZOMID::TTypeId
getRyzomType() const { return RYZOMID::pack_animal
; }
49 CBotPet
& getPersistent ();
50 CBotPet
const& getPersistent() const;
52 CSpawnGroupPet
& spawnGrp();
54 void sendInfoToEGS() const { }
56 // pets are always attackable by bots
57 virtual bool isBotAttackable() const { return true; }
59 // Take position from mirror
62 // Return true if the animal is mounted (thus controlled by the GPMS)
63 bool isMounted() const;
65 CPathPosition
& pathPos() { return _PathPos
; }
69 void setVisualPropertiesName();
73 CPathPosition _PathPos
;
76 //////////////////////////////////////////////////////////////////////////////
78 //////////////////////////////////////////////////////////////////////////////
84 CBotPet(CGroup
* owner
, CAIAliasDescriptionNode
* alias
= NULL
);
87 void getSpawnPos(CAIVector
& triedPos
, RYAI_MAP_CRUNCH::CWorldPosition
& spawnPos
, RYAI_MAP_CRUNCH::CWorldMap
const& worldMap
, CAngle
& spawnTheta
);
88 void setSpawnPos(CAIPos
const& spawnPos
) { _SpawnPos
= spawnPos
; }
89 CGrpPet
& getPetGroup();
91 void update(uint32 ticks
, CAIEntityPhysical
const* petOwner
);
93 CSpawnBotPet
* getSpawn() { return static_cast<CSpawnBotPet
*>(getSpawnObj()); }
95 CAIS::CCounter
& getSpawnCounter();
97 void setDespawn() { _MustDespawn
= true; }
98 bool haveToDespawn() const { return _MustDespawn
; }
100 void changeOwner(NLMISC::CEntityId
const& newOwner
);
102 virtual std::string
getOneLineInfoString() const { return std::string("Pet bot '") + getName() + "'"; }
104 virtual void triggerSetSheet(AISHEETS::ICreatureCPtr
const& sheet
);
107 RYZOMID::TTypeId
getRyzomType() const { return RYZOMID::pack_animal
; }
109 CSpawnBot
* getSpawnBot(TDataSetRow
const& row
, NLMISC::CEntityId
const& id
, float radius
)
111 return new CSpawnBotPet(row
, *this, id
, radius
, getSheet()->Level(), getGroup().getAStarFlag());
119 /****************************************************************************/
120 /* Inlined methods */
121 /****************************************************************************/
123 //////////////////////////////////////////////////////////////////////////////
125 //////////////////////////////////////////////////////////////////////////////
128 CSpawnBotPet::CSpawnBotPet(TDataSetRow
const& row
, CBot
& owner
, NLMISC::CEntityId
const& id
, float radius
, uint32 level
, RYAI_MAP_CRUNCH::TAStarFlag denyFlags
)
129 : CSpawnBot(row
, owner
, id
, radius
, level
, denyFlags
)
136 CBotPet
& CSpawnBotPet::getPersistent()
138 return static_cast<CBotPet
&>(CSpawnBot::getPersistent());
142 CBotPet
const& CSpawnBotPet::getPersistent() const
144 return static_cast<const CBotPet
&>(CSpawnBot::getPersistent());
147 //////////////////////////////////////////////////////////////////////////////
149 //////////////////////////////////////////////////////////////////////////////
152 CBotPet::CBotPet(CGroup
* owner
, CAIAliasDescriptionNode
* alias
)
154 , _MustDespawn(false)
167 CAIS::CCounter
& CBotPet::getSpawnCounter()
169 return CAIS::instance()._PetBotCounter
;