00001 #ifndef ERIS_AVATAR_H
00002 #define ERIS_AVATAR_H
00003
00004 #include <Eris/Types.h>
00005 #include <Atlas/Objects/ObjectsFwd.h>
00006 #include <Eris/EntityRef.h>
00007
00008 #include <wfmath/point.h>
00009 #include <wfmath/vector.h>
00010 #include <wfmath/quaternion.h>
00011 #include <wfmath/timestamp.h>
00012
00013 #include <sigc++/trackable.h>
00014 #include <sigc++/signal.h>
00015 #include <sigc++/connection.h>
00016
00017 #include <string>
00018 #include <map>
00019 #include <vector>
00020
00021 namespace Eris
00022 {
00023
00024
00025 class Account;
00026 class IGRouter;
00027 class View;
00028 class Connection;
00029
00031 class Avatar : virtual public sigc::trackable
00032 {
00033 public:
00034 virtual ~Avatar();
00035
00037 std::string getId() const
00038 { return m_entityId; }
00039
00041 EntityPtr getEntity() const
00042 {
00043 return m_entity;
00044 }
00045
00046 View* getView() const
00047 {
00048 return m_view;
00049 }
00050
00051 Connection* getConnection() const;
00052
00054 double getWorldTime();
00055
00056 const EntityRef& getWielded() const
00057 {
00058 return m_wielded;
00059 }
00060
00062 void drop(Entity*, const WFMath::Point<3>& pos, const std::string& loc);
00064 void drop(Entity*, const WFMath::Vector<3>& offset = WFMath::Vector<3>(0, 0, 0));
00065
00067 void take(Entity*);
00068
00070 void touch(Entity*);
00071
00073 void say(const std::string&);
00074
00076 void emote(const std::string&);
00077
00079 void moveToPoint(const WFMath::Point<3>&);
00080
00082 void moveInDirection(const WFMath::Vector<3>&);
00083
00085 void moveInDirection(const WFMath::Vector<3>&, const WFMath::Quaternion&);
00086
00088 void place(Entity*, Entity* container, const WFMath::Point<3>& pos
00089 = WFMath::Point<3>(0, 0, 0));
00090
00092 void wield(Entity * entity);
00093
00104 void useOn(Entity * entity, const WFMath::Point< 3 > & position, const std::string& op);
00105
00110 void attack(Entity* entity);
00111
00117 const TypeInfoArray& getUseOperationsForWielded() const
00118 {
00119 return m_useOps;
00120 }
00121
00128 sigc::signal<void, Entity*> GotCharacterEntity;
00129
00130
00131
00132
00133
00134
00135
00137 sigc::signal<void,Entity*> InvAdded;
00139 sigc::signal<void,Entity*> InvRemoved;
00140
00143 sigc::signal<void, Entity*, const Atlas::Objects::Operation::RootOperation&> Hear;
00144 protected:
00145 friend class Account;
00146
00150 Avatar(Account* pl, const std::string& entId);
00151
00152 friend class AccountRouter;
00153 friend class IGRouter;
00154
00157 void updateWorldTime(double t);
00158
00159
00160 private:
00161 void onEntityAppear(Entity* ent);
00162 void onCharacterChildAdded(Entity* child);
00163 void onCharacterChildRemoved(Entity* child);
00164
00165 void onCharacterWield(const std::string&, const Atlas::Message::Element&);
00166 void onWieldedChanged();
00167
00168 Account* m_account;
00169
00170 std::string m_entityId;
00171 EntityPtr m_entity;
00172
00173 WFMath::TimeStamp m_stampAtLastOp;
00174 double m_lastOpTime;
00175
00176 IGRouter* m_router;
00177 View* m_view;
00178 TypeInfoArray m_useOps;
00179
00180 EntityRef m_wielded;
00181
00182 sigc::connection m_entityAppearanceCon;
00183 };
00184
00185 }
00186
00187 #endif