00001 #ifndef ERIS_AVATAR_H
00002 #define ERIS_AVATAR_H
00003
00004 #include <Eris/Types.h>
00005 #include <Eris/EntityRef.h>
00006
00007 #include <Atlas/Objects/ObjectsFwd.h>
00008
00009 #include <wfmath/point.h>
00010 #include <wfmath/vector.h>
00011 #include <wfmath/quaternion.h>
00012 #include <wfmath/timestamp.h>
00013
00014 #include <sigc++/trackable.h>
00015 #include <sigc++/signal.h>
00016 #include <sigc++/connection.h>
00017
00018 namespace Eris
00019 {
00020
00021
00022 class Account;
00023 class IGRouter;
00024 class View;
00025 class Connection;
00026
00028 class Avatar : virtual public sigc::trackable
00029 {
00030 public:
00031 virtual ~Avatar();
00032
00034 const std::string & getId() const
00035 { return m_entityId; }
00036
00038 EntityPtr getEntity() const
00039 {
00040 return m_entity;
00041 }
00042
00043 View* getView() const
00044 {
00045 return m_view;
00046 }
00047
00048 Connection* getConnection() const;
00049
00051 double getWorldTime();
00052
00053 const EntityRef& getWielded() const
00054 {
00055 return m_wielded;
00056 }
00057
00059 void drop(Entity*, const WFMath::Point<3>& pos, const std::string& loc);
00061 void drop(Entity*, const WFMath::Vector<3>& offset = WFMath::Vector<3>(0, 0, 0));
00062
00064 void take(Entity*);
00065
00067 void touch(Entity*);
00068
00070 void say(const std::string&);
00071
00073 void emote(const std::string&);
00074
00076 void moveToPoint(const WFMath::Point<3>&);
00077
00079 void moveInDirection(const WFMath::Vector<3>&);
00080
00082 void moveInDirection(const WFMath::Vector<3>&, const WFMath::Quaternion&);
00083
00085 void place(Entity*, Entity* container, const WFMath::Point<3>& pos
00086 = WFMath::Point<3>(0, 0, 0));
00087
00089 void wield(Entity * entity);
00090
00101 void useOn(Entity * entity, const WFMath::Point< 3 > & position, const std::string& op);
00102
00107 void attack(Entity* entity);
00108
00113 void useStop();
00114
00115 void deactivate();
00116
00123 sigc::signal<void, Entity*> GotCharacterEntity;
00124
00125
00126
00127
00128
00129
00130
00132 sigc::signal<void,Entity*> InvAdded;
00134 sigc::signal<void,Entity*> InvRemoved;
00135
00138 sigc::signal<void, Entity*, const Atlas::Objects::Operation::RootOperation&> Hear;
00139 protected:
00140 friend class Account;
00141
00145 Avatar(Account* pl, const std::string& entId);
00146
00147 friend class AccountRouter;
00148 friend class IGRouter;
00149
00152 void updateWorldTime(double t);
00153
00154
00155 protected:
00156 void onEntityAppear(Entity* ent);
00157 void onCharacterChildAdded(Entity* child);
00158 void onCharacterChildRemoved(Entity* child);
00159
00160 void onCharacterWield(const Atlas::Message::Element&);
00161 void onWieldedChanged();
00162
00163 void logoutResponse(const Atlas::Objects::Operation::RootOperation&);
00164
00165 Account* m_account;
00166
00167 std::string m_entityId;
00168 EntityPtr m_entity;
00169
00170 WFMath::TimeStamp m_stampAtLastOp;
00171 double m_lastOpTime;
00172
00173 IGRouter* m_router;
00174 View* m_view;
00175
00176 EntityRef m_wielded;
00177
00178 sigc::connection m_entityAppearanceCon;
00179 };
00180
00181 }
00182
00183 #endif