Module bzServer :: Class bzUser
[frames] | no frames]

Class bzUser

source code

This object deals with socket connection and low level data exchanges

Instance Methods
bzUser
__init__(self, pseudo, password)
Returns: N/A
source code
 
__str__(self) source code
 
__repr__(self) source code
string.
getPseudo(self)
returns the pseudo of the player
source code
bzInventory.bzInventory.
getInventory(self)
returns the inventory of the user
source code
boolean.
hasAvatar(self)
indicates if the user has already choosen an avatar
source code
integer.
getAvatar(self)
returns the identifier of the avatar choosen by user.
source code
string.
getPassword(self)
returns the password of user.
source code
 
setConnected(self, current_id)
Changes the connection status of user to 'Connected'.
source code
 
setDisconnected(self)
Changes the connection status of user to 'Disconnected'.
source code
integer.
getCurrentId(self)
returns the user current id (-1 if user is not connected).
source code
boolean.
isConnected(self)
Indicates whether the player is connected or not.
source code
 
setAvatar(self, avatar)
Set the avatar id choosen by the user.
source code
 
save(self, position=[0.0, 0.0, 0.0], orientation=[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], heading=[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], scene=0, inventory=None)
Save information of user (position, orientation, scene number, inventory content).
source code
 
saveInventory(self)
Save player inventory with current known content.
source code
integer.
getSavedPosition(self)
Returns the last known position of user.
source code
bzInventory.bzInventory.
getSavedInventory(self)
Returns the inventory the user had the last time he saved game.
source code
3*3 matrix.
getSavedOrientation(self)
Returns the last known orientation of user.
source code
3*3 matrix.
getSavedHeading(self)
Returns the last known heading of user.
source code
integer.
getSavedScene(self)
Returns the id of the last scene the user saved in.
source code
Instance Variables
integer. avatar
the avatar id choosen by the player.
boolean connected
indicates if the player is currently connected.
integer current_id
the current identifier of the player
bzInventory.bzInventory current_inventory
  last_connection_date
  last_disconnection_date
integer. last_saved_action
3*3 matrix last_saved_heading
bzInventory.bzInventory last_saved_inventory
3*3 matrix. last_saved_orientation
1*3 vector. last_saved_position
the position of the player when saved for the last time.
integer. last_saved_scene
integer. last_saved_state
string. password
the password of the player
string. pseudo
the pseudo of the player.
Method Details

__init__(self, pseudo, password)
(Constructor)

source code 
Parameters:
  • pseudo (string.) - the pseudo of the user
  • password (string.) - password of the user
Returns: bzUser
N/A

getPseudo(self)

source code 
returns the pseudo of the player
Returns: string.
the pseudo of the player.

getInventory(self)

source code 
returns the inventory of the user
Returns: bzInventory.bzInventory.
the inventory of the user.

hasAvatar(self)

source code 
indicates if the user has already choosen an avatar
Returns: boolean.
True if user has selected an avatar, False otherwise

getAvatar(self)

source code 
returns the identifier of the avatar choosen by user.
Returns: integer.
the identifier of the avatar choosen by user.

getPassword(self)

source code 
returns the password of user.
Returns: string.
the password used to authenticate the user.

setConnected(self, current_id)

source code 
Changes the connection status of user to 'Connected'. This function is called when user log in.
Parameters:
  • current_id (string.) - the id the player was given at connection.

setDisconnected(self)

source code 
Changes the connection status of user to 'Disconnected'. This function is called when user log off.

getCurrentId(self)

source code 
returns the user current id (-1 if user is not connected).
Returns: integer.
the user current id.

isConnected(self)

source code 
Indicates whether the player is connected or not.
Returns: boolean.
True if the user is connected, False otherwise.

setAvatar(self, avatar)

source code 
Set the avatar id choosen by the user. This function is typically called when user choose his avatar.

save(self, position=[0.0, 0.0, 0.0], orientation=[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], heading=[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]], scene=0, inventory=None)

source code 
Save information of user (position, orientation, scene number, inventory content). User information that was saved can than be retrieved next time user connects.
Parameters:
  • position - the current position of the user.
  • position - 1*3 vector.
  • orientation - the current orientation of the user.
  • orientation - 3*3 matrix.
  • heading - the current heading of the user.
  • heading - 3*3 matrix.
  • scene - the scene id the user is currently in.
  • scene - integer.
  • inventory - the inventory of the user.
  • inventory - bzInventory.bzInventory

getSavedPosition(self)

source code 
Returns the last known position of user.
Returns: integer.
the saved user position.

getSavedInventory(self)

source code 
Returns the inventory the user had the last time he saved game.
Returns: bzInventory.bzInventory.
the last saved inventory.

getSavedOrientation(self)

source code 
Returns the last known orientation of user.
Returns: 3*3 matrix.
the user orientation.

getSavedHeading(self)

source code 
Returns the last known heading of user.
Returns: 3*3 matrix.
the user heading.

getSavedScene(self)

source code 
Returns the id of the last scene the user saved in.
Returns: integer.
the user scene id.