4 #include <Eris/Types.h>
5 #include <Eris/EntityRef.h>
7 #include <Atlas/Objects/ObjectsFwd.h>
9 #include <wfmath/point.h>
10 #include <wfmath/vector.h>
11 #include <wfmath/quaternion.h>
12 #include <wfmath/timestamp.h>
14 #include <sigc++/trackable.h>
15 #include <sigc++/signal.h>
16 #include <sigc++/connection.h>
31 class Avatar :
virtual public sigc::trackable
37 const std::string &
getId()
const;
42 View* getView()
const;
58 void drop(
Entity* entity,
const WFMath::Point<3>& pos,
59 const WFMath::Quaternion& orientation,
const std::string& loc);
67 void drop(
Entity* entity,
const WFMath::Vector<3>& offset = WFMath::Vector<3>(0, 0, 0),
68 const WFMath::Quaternion& orientation = WFMath::Quaternion());
77 void say(
const std::string&);
82 void sayTo(
const std::string& message,
const std::vector<const Entity*>& entities);
85 void emote(
const std::string&);
94 void moveInDirection(
const WFMath::Vector<3>&,
const WFMath::Quaternion&);
109 const WFMath::Quaternion& orientation = WFMath::Quaternion());
124 void useOn(
Entity * entity,
const WFMath::Point< 3 > & position,
const std::string& op);
185 sigc::signal<void, Entity*, const Atlas::Objects::Operation::RootOperation&>
Hear;
210 void onEntityAppear(
Entity* ent);
211 void onCharacterChildAdded(
Entity* child);
212 void onCharacterChildRemoved(
Entity* child);
219 void onCharacterWield(
const Atlas::Message::Element&);
220 void onWieldedChanged();
222 virtual void onTransferRequested(
const TransferInfo &transfer);
224 void logoutResponse(
const Atlas::Objects::Operation::RootOperation&);
242 std::string m_entityId;
245 WFMath::TimeStamp m_stampAtLastOp;
253 sigc::connection m_entityAppearanceCon;
268 inline View* Avatar::getView()
const
273 inline const EntityRef& Avatar::getWielded()
const
void moveToPoint(const WFMath::Point< 3 > &)
Have the character move towards a position.
Definition: Avatar.cpp:182
void moveInDirection(const WFMath::Vector< 3 > &)
Set the character's velocity.
Definition: Avatar.cpp:196
void place(Entity *entity, Entity *container, const WFMath::Point< 3 > &pos, const WFMath::Quaternion &orientation=WFMath::Quaternion())
Place an entity inside another one.
Definition: Avatar.cpp:246
sigc::connection observe(const std::string &attr, const AttrChangedSlot &aslot)
Setup an observer so that the specified slot is fired when the named attribue's value changes.
Definition: Entity.cpp:163
Entity * getLocation() const
The containing entity, or null if this is a top-level visible entity.
Definition: Entity.h:625
Entity is a concrete (instantiable) class representing one game entity.
Definition: Entity.h:58
WFMath::Point< 3 > getPosition() const
Returns the Entity's position inside it's parent in the parent's local system coordinates.
Definition: Entity.h:631
void wield(Entity *entity)
Wield an entity which is inside the Avatar's inventory.
Definition: Avatar.cpp:277
A TransferInfo object represents the encapsulation of various data required to successfully transfer ...
Definition: TransferInfo.h:17
Connection * getConnection() const
Access the underlying Connection for this account.
Definition: Account.h:334
sigc::signal< void, Entity * > InvRemoved
An object was removed from the inventory.
Definition: Avatar.h:181
void drop(Entity *entity, const WFMath::Point< 3 > &pos, const WFMath::Quaternion &orientation, const std::string &loc)
Drop an entity in the Avatar's inventory at the given location.
Definition: Avatar.cpp:78
void emote(const std::string &)
Emote something (in-game)
Definition: Avatar.cpp:167
Definition: IGRouter.h:14
double getWorldTime()
get the current local approximation of world time.
Definition: Avatar.cpp:400
void avatarLogoutRequested(Avatar *avatar)
Called when a logout of the avatar has been requested by the server.
Definition: Account.cpp:452
Definition: Operations.h:17
void updateWorldTime(double t)
called by the IG router for each op it sees with a valid 'seconds' attribute set.
Definition: Avatar.cpp:406
void say(const std::string &)
Say something (in-game)
Definition: Avatar.cpp:137
sigc::signal< void, const TransferInfo & > TransferRequested
Emitted when a character transfer authentication is requested.
Definition: Avatar.h:192
void useStop()
Stop the current task, if one is in progress.
Definition: Avatar.cpp:338
void useOn(Entity *entity, const WFMath::Point< 3 > &position, const std::string &op)
Use the currently wielded entity (tool) on another entity.
Definition: Avatar.cpp:296
Result deactivateCharacter(Avatar *av)
Request de-activation of a character.
Definition: Account.cpp:345
Encapsulates all the state of an Atlas Account, and methods that operation on that state.
Definition: Account.h:45
The player's avatar representation.
Definition: Avatar.h:32
sigc::signal< void > AvatarEntityDeleted
emitted AFTER the avatar entity was deleted due to a SIGHT(DELETE) op is received
Definition: View.h:88
Definition: LogStream.h:56
void attack(Entity *entity)
Attach the specified entity.
Definition: Avatar.cpp:325
static bool extractEntityId(const Atlas::Message::Element &element, std::string &id)
Extracts an entity id from the supplied element.
Definition: Entity.cpp:832
const std::string & getId() const
Retrieve the unique entity ID.
Definition: Entity.h:604
Avatar(Account &pl, const std::string &entId)
Create a new Avatar object.
Definition: Avatar.cpp:38
Definition: Account.cpp:36
sigc::signal< void, Entity *, const Atlas::Objects::Operation::RootOperation & > Hear
emitted when this Avatar hears something.
Definition: Avatar.h:185
void take(Entity *)
Move an entity into the Avatar's inventory.
Definition: Avatar.cpp:108
sigc::signal< void, Avatar * > AvatarDeactivated
Emitted when an active avatar is deactivated.
Definition: Account.h:239
bool getIsAdmin()
Gets whether the current avatar is an admin character.
Definition: Avatar.cpp:461
void sayTo(const std::string &message, const std::vector< const Entity * > &entities)
Say something (in-game), addressing one or many entities.
Definition: Avatar.cpp:149
const std::string & getId() const
Get the Entity id of this Avatar.
Definition: Avatar.h:258
void setIsAdmin(bool isAdmin)
Sets whether the current avatar is an admin character.
Definition: Avatar.cpp:456
void onAvatarEntityDeleted()
Called when the avatar entity is deleted.
Definition: Avatar.cpp:363
void touch(Entity *)
Touch an entity.
Definition: Avatar.cpp:125
void logoutRequested()
Called when a logout of the avatar has been requested by the server.
Definition: Avatar.cpp:445
virtual void send(const Atlas::Objects::Root &obj)
Transmit an Atlas::Objects instance to the server.
Definition: Connection.cpp:147
Definition: EntityRef.h:15
Entity * getEntity(const std::string &eid) const
Retrieve an entity in the view by id.
Definition: View.cpp:53
sigc::signal< void, Entity * > GotCharacterEntity
Emitted when the character entity of this Avatar is valid (and presumably, visible).
Definition: Avatar.h:170
Definition: LogStream.h:46
EntityPtr getEntity() const
Get the Entity this Avatar refers to.
Definition: Avatar.h:263
Underlying Atlas connection, providing a send interface, and receive (dispatch) system.
Definition: Connection.h:40
View encapsulates the set of entities currently visible to an Avatar, as well as those that have rece...
Definition: View.h:34
sigc::signal< void, Entity * > InvAdded
An object was added to the inventory.
Definition: Avatar.h:179