World Class
This contains “global” functions that is to
be called by the various mods of the MUCK to perform actions such as creating
Players.
-
class world.World(engine)[source]
The “singleton” class that represents the ScalyMUCK world in memory and is to
be passed to every mod that actually manages to initialize when loaded.
-
__init__(engine)[source]
Initializes an instance of the World with an SQLAlchemy engine.
-
create_bot(name=None, location=None)[source]
Creates a new instance of a Bot.
- Keyword arguments:
- name – The name of the new Player instance to be used.
location – The ID or instance of Room that the new Player is to be created at.
-
create_item(name=None, description='<Unset>', owner=0, location=None)[source]
Creates a new item in the ScalyMUCK world.
- Keyword arguments:
- name – The name of the Item that is to be used.
description – The description of the Item that is to be used. Default: <Unset>
owner – The ID or instance of Player that is to become the owner of this Item.
location – The ID or instance of Room that is to become the location of this Item.
-
create_player(name=None, password=None, workfactor=None, location=None, admin=False, sadmin=False, owner=False)[source]
Creates a new instance of a Player.
- Keyword arguments:
- name – The name of the new Player instance to be used.
password – The password that is to be used for the Player.
workfactor – The work factor # to be used when hasing the Player’s password.
location – The ID or instance of Room that the new Player is to be created at.
admin – A boolean representing whether or not this new Player is an administrator.
sadmin – A boolean representing whether or not this new Player is a super administrator.
owner – A boolean representing whether or not this new Player is an owner.
-
create_room(name, description='<Unset>', owner=0)[source]
Creates a new Room if the World.
- Keyword arguments:
- description – The description that is to be used with the new Room instance.
owner – The ID or instance of Player that is to become the owner of this Room.
-
find_bot(**kwargs)[source]
Locates a Bot inside of the ScalyMUCK world.
This searches the entire WORLD for the specified Bot so if you happen to be running a very, very
large world this search will end up getting slow and it is recommended in that case that you try and
use the Room level find_player function whenever possible.
- Keyword arguments (one or the other):
- id – The ID of the Bot to locate. This overrides the name if both are specified.
-
find_item(**kwargs)[source]
Locates an item by any specifications.
If the ID number does not exist then None is returned.
-
find_player(**kwargs)[source]
Locates a Player inside of the ScalyMUCK world.
This searches the entire WORLD for the specified Player so if you happen to be running a very, very
large world this search will end up getting slow and it is recommended in that case that you try and
use the Room level find_player function whenever possible.
- Keyword arguments (one or the other):
- id – The ID of the Player to locate. This overrides the name if both are specified.
name – The name of the Player to locate.
-
find_room(**kwargs)[source]
Locates the specified Room in the ScalyMUCK world.
This can be a bit computionally intense if you are running a very large world.
- Keyword arguments (one or the other):
- id – The id of the requested room to return an instance of. This overrides the name if both are specified.
name – The name of the requested room to return an instance of.
-
get_players()[source]
Returns a list of all Players in the ScalyMUCK world.
-
get_rooms(**kwargs)[source]
Returns all rooms in the database that meet the specified criterion.
- Keyword arguments:
- owner – The owner we are to filter by. If not specified, this filter is not used.