Player Model

This is where all of ScalyMUCK’s model definitions are located, save for the modifications that may extend the software in such a way that it demands for extra models but that is beyond the point.

The “base” definitions located in models.py are:

All of the above classes inherit a few functions from ObjectBase as well.

class models.Player(name=None, password=None, workfactor=None, location=None, inventory=None, description='<Unset>', admin=False, sadmin=False, owner=False)[source]

Players are well, the players that actually move and interact in the world. They store their password hash and various other generic data that can be used across just about anything.

check_admin_trump(target)[source]

Checks whether or not this Player trumps the target Player administratively.

This returns True when the calling Player instance has greater privilege than that of the target they are being compared against. It returns false in the opposite situation.

description

A 2000 character string representing the description of the Player.

disconnect()[source]

Drops the Player’s connection from the server.

This drops the user’s connection from the game, flushing any messages that were destined for them before actually booting them out of the server. This triggers the default disconnect message to be displayed by the ScalyMUCK core to whomever else may be in the room with the user at the time of their disconnect.

display_name

A short 25 character string representing the name of the Player that is displayed to other users.

hash

A 128 character string representing the password hash of the Player.

id

This variable is the database number of the Player.

inventory_id

This variable is the database id of the Room that represents the Player’s inventory.

is_admin

A boolean representing whether or not this Player is a server administrator.

is_owner

A boolean representing whether or not this Player is a server owner.

is_sadmin

A boolean representing whether or not this Player is a server super administrator.

location_id

This variable is the database id of the Room this Player is located in.

name

A short 25 character string representing the name of the Player. It should be all lower case.

send(message)[source]

Sends a message to this Player if they are connected.

This sends a message to the relevant connection if there happens to be one established for this player object. If there is no active connection for this player, then the message is simply dropped.

set_is_admin(status, commit=True)[source]

Sets the administrator status of this Player.

This sets the state as to whether or not the calling player instance is an administrator of the server or not. This may mean different things to different mods but -generally- it should just provide basic administrator privileges. The commit parameter is used if you don’t want to dump changes to the database yet; if you’re changing multiple properties at once, it doesn’t hit the database as often then.

Keyword arguments:
  • commit – Determines whether or not this data should be commited immediately. It also includes other changes made

by any previous function calls thay may have set this to false. Default: True

set_is_super_admin(status, commit=True)[source]

Sets the super administrator status of this Player.

This sets the state as to whether or not the calling player instance is a super administrator of the server or not. This may mean different things to different mods but -generally- it should provide administrator functionalities more akin to what the owner may have, things that may break the server if used improperly. The commit parameter is used if you don’t want to dump changes to the database yet; if you’re changing multiple properties at once, it doesn’t hit the database as often then.

Keyword arguments:
  • commit – Determines whether or not this data should be commited immediately. It also includes other changes made

by any previous function calls thay may have set this to false. Default: True

set_password(password, commit=True)[source]

Sets the password of this Player.

This sets the password of the Player in the database without any notification to the Player. This also triggers the new password to be hashed with a randomly generated salt which means the current thread of execution will probably hang for a few seconds unless the work factor is set just right.

Keyword arguments:
commit – Determines whether or not this data should be commited immediately. It also includes other changes made by any previous function calls thay may have set this to false. Default: True

Previous topic

Database Models

Next topic

Room Model

This Page