SmartFoxServer 2X C++ API
Sfs2X::Entities::User Class Referenceabstract

The User interface defines all the methods and properties that an object representing a SmartFoxServer User entity exposes. More...

#include <User.h>

Inheritance diagram for Sfs2X::Entities::User:
Sfs2X::Entities::SFSUser

Public Member Functions

virtual long int Id ()=0
 Get the unique User Id More...
 
virtual boost::shared_ptr< string > Name ()=0
 The user name More...
 
virtual long int PlayerId ()=0
 Get the playerId of the User. More...
 
virtual bool IsPlayer ()=0
 Return true if the User is a Player (playerId > 0) in the last joined Room More...
 
virtual bool IsSpectator ()=0
 Return true if the User is a Spectator (playerId < 0) in the last joined Room More...
 
virtual long int GetPlayerId (boost::shared_ptr< Room > room)=0
 Return the playerId for the specific Room. More...
 
virtual long int PrivilegeId ()=0
 Get the privilegeId of the User More...
 
virtual void PrivilegeId (long int value)=0
 Get the privilegeId of the User More...
 
virtual boost::shared_ptr< IUserManagerUserManager ()=0
 Get the UserManager of this User More...
 
virtual void UserManager (boost::shared_ptr< IUserManager > value)=0
 Get the UserManager of this User More...
 
virtual bool IsGuest ()=0
 Return true if the User is logged in as guest user More...
 
virtual bool IsStandardUser ()=0
 Return true if the User is logged in as standard user More...
 
virtual bool IsModerator ()=0
 Return true if the User is logged in as moderator user More...
 
virtual bool IsAdmin ()=0
 Return true if the User is logged in as administrator user More...
 
virtual bool IsPlayerInRoom (boost::shared_ptr< Room > room)=0
 Return true if the User is a Player in the specified Room More...
 
virtual bool IsSpectatorInRoom (boost::shared_ptr< Room > room)=0
 Return true if the User is a Spectator in the specified Room More...
 
virtual bool IsJoinedInRoom (boost::shared_ptr< Room > room)=0
 Return true if the User is joined in the specified Room More...
 
virtual bool IsItMe ()=0
 Return true if the User object is the client's User object, also known as SmartFox.MySelf More...
 
virtual boost::shared_ptr< vector< boost::shared_ptr< UserVariable > > > GetVariables ()=0
 Get all the User Variables More...
 
virtual boost::shared_ptr< UserVariableGetVariable (string varName)=0
 Get a UserVariable More...
 
virtual bool ContainsVariable (string name)=0
 Check if a UserVariable exists More...
 
virtual boost::shared_ptr< map< string, boost::shared_ptr< void > > > Properties ()=0
 A generic object that can be used to store any User custom data needed at runtime. More...
 
virtual void Properties (boost::shared_ptr< map< string, boost::shared_ptr< void > > > value)=0
 A generic object that can be used to store any User custom data needed at runtime. More...
 
virtual boost::shared_ptr< Vec3DAOIEntryPoint ()=0
 Returns the entry point of this user in the current user's AoI. More...
 
virtual void AOIEntryPoint (boost::shared_ptr< Vec3D >value)=0
 Returns the entry point of this user in the current user's AoI. More...
 

Detailed Description

The User interface defines all the methods and properties that an object representing a SmartFoxServer User entity exposes.

In the SmartFoxServer 2X client API this interface is implemented by the SFSUser class. Read the class description for additional informations.

See also
SFSUser

Member Function Documentation

◆ AOIEntryPoint() [1/2]

virtual boost::shared_ptr<Vec3D> Sfs2X::Entities::User::AOIEntryPoint ( )
pure virtual

Returns the entry point of this user in the current user's AoI.

The returned coordinates are those that the user had when his presence in the current user's Area of Interest was last notified by a PROXIMITY_LIST_UPDATE event. This field is populated only if the user joined a Room of type MMORoom and this is configured to receive such data from the server.

See also
Sfs2X.Requests.MMO.MMORoomSettings.SendAOIEntryPoint, Sfs2X.Core.SFSEvent.PROXIMITY_LIST_UPDATE

Implemented in Sfs2X::Entities::SFSUser.

◆ AOIEntryPoint() [2/2]

virtual void Sfs2X::Entities::User::AOIEntryPoint ( boost::shared_ptr< Vec3D value)
pure virtual

Returns the entry point of this user in the current user's AoI.

The returned coordinates are those that the user had when his presence in the current user's Area of Interest was last notified by a PROXIMITY_LIST_UPDATE event. This field is populated only if the user joined a Room of type MMORoom and this is configured to receive such data from the server.

See also
Sfs2X.Requests.MMO.MMORoomSettings.SendAOIEntryPoint, Sfs2X.Core.SFSEvent.PROXIMITY_LIST_UPDATE

Implemented in Sfs2X::Entities::SFSUser.

◆ ContainsVariable()

virtual bool Sfs2X::Entities::User::ContainsVariable ( string  name)
pure virtual

Check if a UserVariable exists

Parameters
namethe name of the variable
Returns
true if the UserVariable exists
See also
UserVariable

Implemented in Sfs2X::Entities::SFSUser.

◆ GetPlayerId()

virtual long int Sfs2X::Entities::User::GetPlayerId ( boost::shared_ptr< Room >  room)
pure virtual

Return the playerId for the specific Room.

If you don't use multi-room you can use User.PlayerId

Parameters
roomPointer to a Room instance
Returns
A long integer
See also
PlayerId

Implemented in Sfs2X::Entities::SFSUser.

◆ GetVariable()

virtual boost::shared_ptr<UserVariable> Sfs2X::Entities::User::GetVariable ( string  varName)
pure virtual

Get a UserVariable

Parameters
varNamethe name of the variable
Returns
the UserVariable or null if the variable doesn't exist
See also
UserVariable

Implemented in Sfs2X::Entities::SFSUser.

◆ GetVariables()

virtual boost::shared_ptr<vector<boost::shared_ptr<UserVariable> > > Sfs2X::Entities::User::GetVariables ( )
pure virtual

Get all the User Variables

Returns
A vector of UserVariable pointers
See also
UserVariable

Implemented in Sfs2X::Entities::SFSUser.

◆ Id()

virtual long int Sfs2X::Entities::User::Id ( )
pure virtual

Get the unique User Id

Implemented in Sfs2X::Entities::SFSUser.

◆ IsAdmin()

virtual bool Sfs2X::Entities::User::IsAdmin ( )
pure virtual

Return true if the User is logged in as administrator user

Returns
A boolean

Implemented in Sfs2X::Entities::SFSUser.

◆ IsGuest()

virtual bool Sfs2X::Entities::User::IsGuest ( )
pure virtual

Return true if the User is logged in as guest user

Returns
A boolean

Implemented in Sfs2X::Entities::SFSUser.

◆ IsItMe()

virtual bool Sfs2X::Entities::User::IsItMe ( )
pure virtual

Return true if the User object is the client's User object, also known as SmartFox.MySelf

Implemented in Sfs2X::Entities::SFSUser.

◆ IsJoinedInRoom()

virtual bool Sfs2X::Entities::User::IsJoinedInRoom ( boost::shared_ptr< Room >  room)
pure virtual

Return true if the User is joined in the specified Room

Parameters
roomPointer to a Room instance
Returns
A boolean

Implemented in Sfs2X::Entities::SFSUser.

◆ IsModerator()

virtual bool Sfs2X::Entities::User::IsModerator ( )
pure virtual

Return true if the User is logged in as moderator user

Returns
A boolean

Implemented in Sfs2X::Entities::SFSUser.

◆ IsPlayer()

virtual bool Sfs2X::Entities::User::IsPlayer ( )
pure virtual

Return true if the User is a Player (playerId > 0) in the last joined Room

Non game Rooms will always return false

See also
SmartFox.LastJoinedRoom

Implemented in Sfs2X::Entities::SFSUser.

◆ IsPlayerInRoom()

virtual bool Sfs2X::Entities::User::IsPlayerInRoom ( boost::shared_ptr< Room >  room)
pure virtual

Return true if the User is a Player in the specified Room

Parameters
roomPointer to a Room instance
Returns
A boolean

Implemented in Sfs2X::Entities::SFSUser.

◆ IsSpectator()

virtual bool Sfs2X::Entities::User::IsSpectator ( )
pure virtual

Return true if the User is a Spectator (playerId < 0) in the last joined Room

Non game Rooms will always return false

See also
SmartFox.LastJoinedRoom

Implemented in Sfs2X::Entities::SFSUser.

◆ IsSpectatorInRoom()

virtual bool Sfs2X::Entities::User::IsSpectatorInRoom ( boost::shared_ptr< Room >  room)
pure virtual

Return true if the User is a Spectator in the specified Room

Parameters
roomPointer to a Room instance
Returns
A boolean

Implemented in Sfs2X::Entities::SFSUser.

◆ IsStandardUser()

virtual bool Sfs2X::Entities::User::IsStandardUser ( )
pure virtual

Return true if the User is logged in as standard user

Returns
A boolean

Implemented in Sfs2X::Entities::SFSUser.

◆ Name()

virtual boost::shared_ptr<string> Sfs2X::Entities::User::Name ( )
pure virtual

The user name

Implemented in Sfs2X::Entities::SFSUser.

◆ PlayerId()

virtual long int Sfs2X::Entities::User::PlayerId ( )
pure virtual

Get the playerId of the User.

The playerId is different from the User ID and it used to indicate which player number is the user inside a Game Room. Example: in a Game Room for 5 players the first client joining will have playerId = 1, the 2nd will have playerId = 2 and so forth. When a User leaves the Room its player slot is freed up and the next User joining the Room will take it.

The playerId is only applicable for Game Rooms, in the other Rooms it is always == 0 A playerId < 0 indicates that the User is a spectator.

If the User is joined in multiple game Rooms at the same time he will be assigned one playerId per Room. In order to obtain a specific playerId you can use the User.GetPlayerId(Room room) method.

Implemented in Sfs2X::Entities::SFSUser.

◆ PrivilegeId() [1/2]

virtual long int Sfs2X::Entities::User::PrivilegeId ( )
pure virtual

Get the privilegeId of the User

See also
UserPrivileges

Implemented in Sfs2X::Entities::SFSUser.

◆ PrivilegeId() [2/2]

virtual void Sfs2X::Entities::User::PrivilegeId ( long int  value)
pure virtual

Get the privilegeId of the User

See also
UserPrivileges

Implemented in Sfs2X::Entities::SFSUser.

◆ Properties() [1/2]

virtual boost::shared_ptr<map<string, boost::shared_ptr<void> > > Sfs2X::Entities::User::Properties ( )
pure virtual

A generic object that can be used to store any User custom data needed at runtime.

The values added/removed in this object are for client side use only an are never transmitted to the Server.

Implemented in Sfs2X::Entities::SFSUser.

◆ Properties() [2/2]

virtual void Sfs2X::Entities::User::Properties ( boost::shared_ptr< map< string, boost::shared_ptr< void > > >  value)
pure virtual

A generic object that can be used to store any User custom data needed at runtime.

The values added/removed in this object are for client side use only an are never transmitted to the Server.

Implemented in Sfs2X::Entities::SFSUser.

◆ UserManager() [1/2]

virtual boost::shared_ptr<IUserManager> Sfs2X::Entities::User::UserManager ( )
pure virtual

Get the UserManager of this User

See also
SFSUserManager

Implemented in Sfs2X::Entities::SFSUser.

◆ UserManager() [2/2]

virtual void Sfs2X::Entities::User::UserManager ( boost::shared_ptr< IUserManager value)
pure virtual

Get the UserManager of this User

See also
SFSUserManager

Implemented in Sfs2X::Entities::SFSUser.