20 #ifndef __PERCEPTIONS_H__ 21 #define __PERCEPTIONS_H__ 26 #include <csutil/weakref.h> 27 #include <csutil/array.h> 76 Perception(
const char* name,
const char* type):name(name),type(type) {}
128 virtual const csString &
GetName()
const;
135 const csString &
GetType()
const;
142 void SetType(
const char* type);
155 virtual bool GetLocation(csVector3 &pos, iSector* §or);
183 int gameHour,gameMinute,
gameYear,gameMonth,gameDay;
187 :
Perception(
"time"), gameHour(hour),gameMinute(minute),gameYear(year),gameMonth(month),gameDay(day) { }
198 static void NormalizeReaction(
Reaction* reaction);
264 :
Perception(n,type), location(location), engine(engine) {}
268 virtual bool GetLocation(csVector3 &pos, iSector* §or);
290 :
Perception(n,type), instance(instance), sector(sector), pos(pos), yrot(yrot), radius(radius) {}
294 virtual bool GetLocation(csVector3 &pos, iSector* §or);
344 :
Perception(n), attacker_ents(ents), bestSkillSlots(slots) { }
455 sector = this->sector;
489 csWeakRef<gemNPCObject>
pet;
518 csWeakRef<gemNPCObject>
pet;
csString type
Type used by perceptions. Usally they correspond to the same value in a reaction. ...
Whenever an NPC is close to an item, this perception is passed to the npc.
This embodies any perception an NPC might have, or any game event of interest.
csWeakRef< gemNPCObject > pet
InventoryPerception(const char *n, const char *t, const int c, const csVector3 &p, iSector *s, float r)
virtual ~ItemPerception()
csString name
The name of this perception.
virtual float GetRadius() const
Get the radius of the perception.
virtual gemNPCObject * GetTarget()
Some perception has a target/source.
csWeakRef< gemNPCActor > player
csArray< gemNPCObject * > attacker_ents
csWeakRef< gemNPCActor > caster
Given to the NPC upon ever tick of game minute.
Whenever an NPC is attacked by a grouop, this perception is passed to the attacked npc...
PositionPerception(const char *n, const char *type, InstanceID &instance, iSector *sector, csVector3 &pos, float yrot, float radius)
csWeakRef< gemNPCActor > target
The network layer is notified of any deaths from players or NPCs on the server.
DamagePerception(const char *n, gemNPCObject *attack, float dmg)
This perception is used when a item is added or removed from inventory.
virtual gemNPCObject * GetTarget()
Some perception has a target/source.
AttackPerception(const char *n, gemNPCObject *attack)
GroupAttackPerception(const char *n, csArray< gemNPCObject * > &ents, csArray< int > &slots)
virtual gemNPCObject * GetTarget()
Some perception has a target/source.
virtual ~TimePerception()
Whenever an NPCPet is told by it's owner to stay, this perception is passed to the NPCPet...
FactionPerception(const char *n, int d, gemNPCObject *p)
virtual ~Perception()
Destructor.
virtual ~PositionPerception()
csWeakRef< gemNPCObject > item
Perception(const char *name)
Constructor.
Whenever an NPC is close to an location, this perception is passed to the npc.
Deliver a faction based perception.
csWeakRef< gemNPCObject > owner
csWeakRef< gemNPCObject > owner
virtual ~FactionPerception()
virtual int GetCount() const
Whenever an NPC is attacked by a player, this perception is passed to the attacked npc...
virtual csString ToString(NPC *npc)
Get a text description of the perception.
csWeakRef< gemNPCActor > attacker
const csString & GetType() const
Get the type of the perception.
virtual gemNPCObject * GetTarget()
Some perception has a target/source.
A reaction embodies the change in desire which occurs in an NPC when he perceives something...
virtual bool GetLocation(csVector3 &pos, iSector *§or)
Get a location assosiated with the perception.
This object represents each NPC managed by this superclient.
LocationPerception(const char *n, const char *type, Location *location, iEngine *engine)
Whenever a player casts a spell on himself, another player, or any npc, this perception is passed to ...
void SetType(const char *type)
Set the type of the perception.
virtual ~LocationPerception()
virtual gemNPCObject * GetTarget()
Some perception has a target/source.
virtual float GetRadius() const
Get the radius of the perception.
TimePerception(int hour, int minute, int year, int month, int day)
virtual void ExecutePerception(NPC *npc, float weight)
All preconditions has been checked, now excecute the perception.
csWeakRef< gemNPCObject > pet
virtual bool GetLocation(csVector3 &pos, iSector *§or)
Get a location assosiated with the perception.
ItemPerception(const char *n, gemNPCObject *i)
virtual gemNPCObject * GetTarget()
Some perception has a target/source.
csWeakRef< gemNPCObject > attacker
csWeakRef< gemNPCActor > attacker
Perception(const char *name, const char *type)
Constructor.
Whenever an NPC Cmd is received this perception is fired.
virtual Perception * MakeCopy()
Make a copy of this perception.
DeathPerception(EID ent_id)
Whenever an NPC is hit for damage by a melee hit or a spell, this perception is passed to the damaged...
A Location is a named place on the map, located dynamically by NPCs as scripted.
csArray< int > bestSkillSlots
psPETCommandMessage::PetCommand_t command
virtual const csString & GetName() const
Get the name of the perception.
csWeakRef< gemNPCActor > target
virtual gemNPCObject * GetTarget()
Some perception has a target/source.
Whenever an NPCPet is told by it's owner to stay, this perception is passed to the NPCPet...
virtual bool ShouldReact(Reaction *reaction, NPC *npc)
Check if this perception should react to a reaction.