Avatar.h

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 // Forward Declerations
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     
00116     void useStop();
00117     
00118     void deactivate();
00119     
00126     sigc::signal<void, Entity*> GotCharacterEntity;
00127 
00128 // These two signals just transmit the Entity's
00129     // AddedMember and RemovedMember signals, but
00130     // you're allowed to connect to them as soon as
00131     // the Avatar has been created, instead of having to wait
00132     // for the Entity to be created.
00133 
00135     sigc::signal<void,Entity*> InvAdded;
00137     sigc::signal<void,Entity*> InvRemoved;
00138         
00141     sigc::signal<void, Entity*, const Atlas::Objects::Operation::RootOperation&> Hear;
00142 protected:
00143     friend class Account;
00144     
00148     Avatar(Account* pl, const std::string& entId);
00149     
00150     friend class AccountRouter;
00151     friend class IGRouter;
00152         
00155     void updateWorldTime(double t);
00156     
00157     
00158 private:
00159     void onEntityAppear(Entity* ent);
00160     void onCharacterChildAdded(Entity* child);
00161     void onCharacterChildRemoved(Entity* child);
00162     
00163     void onCharacterWield(const std::string&, const Atlas::Message::Element&);
00164     void onWieldedChanged();
00165     
00166     void logoutResponse(const Atlas::Objects::Operation::RootOperation&);
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 } // of namespace Eris
00186 
00187 #endif

Generated on Mon Jan 29 21:35:50 2007 for Eris by  doxygen 1.5.1