Rename all instances of Player->Account.
This commit is contained in:
parent
a14e11640b
commit
5590ee2258
94 changed files with 1316 additions and 2327 deletions
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Commands
|
||||
|
||||
Commands describe the input the player can do to the game.
|
||||
Commands describe the input the account can do to the game.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -169,17 +169,17 @@ class Command(BaseCommand):
|
|||
# self.rhs = rhs
|
||||
# self.rhslist = rhslist
|
||||
#
|
||||
# # if the class has the player_caller property set on itself, we make
|
||||
# # sure that self.caller is always the player if possible. We also create
|
||||
# # if the class has the account_caller property set on itself, we make
|
||||
# # sure that self.caller is always the account if possible. We also create
|
||||
# # a special property "character" for the puppeted object, if any. This
|
||||
# # is convenient for commands defined on the Player only.
|
||||
# if hasattr(self, "player_caller") and self.player_caller:
|
||||
# # is convenient for commands defined on the Account only.
|
||||
# if hasattr(self, "account_caller") and self.account_caller:
|
||||
# if utils.inherits_from(self.caller, "evennia.objects.objects.DefaultObject"):
|
||||
# # caller is an Object/Character
|
||||
# self.character = self.caller
|
||||
# self.caller = self.caller.player
|
||||
# elif utils.inherits_from(self.caller, "evennia.players.players.DefaultPlayer"):
|
||||
# # caller was already a Player
|
||||
# self.caller = self.caller.account
|
||||
# elif utils.inherits_from(self.caller, "evennia.accounts.accounts.DefaultAccount"):
|
||||
# # caller was already an Account
|
||||
# self.character = self.caller.get_puppet(self.session)
|
||||
# else:
|
||||
# self.character = None
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
|||
"""
|
||||
The `CharacterCmdSet` contains general in-game commands like `look`,
|
||||
`get`, etc available on in-game Character objects. It is merged with
|
||||
the `PlayerCmdSet` when a Player puppets a Character.
|
||||
the `AccountCmdSet` when an Account puppets a Character.
|
||||
"""
|
||||
key = "DefaultCharacter"
|
||||
|
||||
|
|
@ -34,20 +34,20 @@ class CharacterCmdSet(default_cmds.CharacterCmdSet):
|
|||
#
|
||||
|
||||
|
||||
class PlayerCmdSet(default_cmds.PlayerCmdSet):
|
||||
class AccountCmdSet(default_cmds.AccountCmdSet):
|
||||
"""
|
||||
This is the cmdset available to the Player at all times. It is
|
||||
combined with the `CharacterCmdSet` when the Player puppets a
|
||||
This is the cmdset available to the Account at all times. It is
|
||||
combined with the `CharacterCmdSet` when the Account puppets a
|
||||
Character. It holds game-account-specific commands, channel
|
||||
commands, etc.
|
||||
"""
|
||||
key = "DefaultPlayer"
|
||||
key = "DefaultAccount"
|
||||
|
||||
def at_cmdset_creation(self):
|
||||
"""
|
||||
Populates the cmdset
|
||||
"""
|
||||
super(PlayerCmdSet, self).at_cmdset_creation()
|
||||
super(AccountCmdSet, self).at_cmdset_creation()
|
||||
#
|
||||
# any commands you add below will overload the default ones.
|
||||
#
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ The serversession is the Server-side in-memory representation of a
|
|||
user connecting to the game. Evennia manages one Session per
|
||||
connection to the game. So a user logged into the game with multiple
|
||||
clients (if Evennia is configured to allow that) will have multiple
|
||||
sessions tied to one Player object. All communication between Evennia
|
||||
sessions tied to one Account object. All communication between Evennia
|
||||
and the real-world user goes through the Session(s) associated with that user.
|
||||
|
||||
It should be noted that modifying the Session object is not usually
|
||||
|
|
@ -28,8 +28,8 @@ class ServerSession(BaseServerSession):
|
|||
This class represents a player's session and is a template for
|
||||
individual protocols to communicate with Evennia.
|
||||
|
||||
Each player gets one or more sessions assigned to them whenever they connect
|
||||
to the game server. All communication between game and player goes
|
||||
Each account gets one or more sessions assigned to them whenever they connect
|
||||
to the game server. All communication between game and account goes
|
||||
through their session(s).
|
||||
"""
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
Channel
|
||||
|
||||
The channel class represents the out-of-character chat-room usable by
|
||||
Players in-game. It is mostly overloaded to change its appearance, but
|
||||
Accounts in-game. It is mostly overloaded to change its appearance, but
|
||||
channels can be used to implement many different forms of message
|
||||
distribution systems.
|
||||
|
||||
|
|
@ -18,9 +18,9 @@ class Channel(DefaultChannel):
|
|||
"""
|
||||
Working methods:
|
||||
at_channel_creation() - called once, when the channel is created
|
||||
has_connection(player) - check if the given player listens to this channel
|
||||
connect(player) - connect player to this channel
|
||||
disconnect(player) - disconnect player from channel
|
||||
has_connection(account) - check if the given account listens to this channel
|
||||
connect(account) - connect account to this channel
|
||||
disconnect(account) - disconnect account from channel
|
||||
access(access_obj, access_type='listen', default=False) - check the
|
||||
access on this channel (default access_type is listen)
|
||||
delete() - delete this channel
|
||||
|
|
@ -33,8 +33,8 @@ class Channel(DefaultChannel):
|
|||
tempmsg(msg, header=None, senders=None) - wrapper for sending non-persistent
|
||||
messages.
|
||||
distribute_message(msg, online=False) - send a message to all
|
||||
connected players on channel, optionally sending only
|
||||
to players that are currently online (optimized for very large sends)
|
||||
connected accounts on channel, optionally sending only
|
||||
to accounts that are currently online (optimized for very large sends)
|
||||
|
||||
Useful hooks:
|
||||
channel_prefix(msg, emit=False) - how the channel should be
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"""
|
||||
Characters
|
||||
|
||||
Characters are (by default) Objects setup to be puppeted by Players.
|
||||
Characters are (by default) Objects setup to be puppeted by Accounts.
|
||||
They are what you "see" in game. The Character class in this module
|
||||
is setup to be the "default" character type created by the default
|
||||
creation commands.
|
||||
|
|
@ -19,14 +19,14 @@ class Character(DefaultCharacter):
|
|||
and its commands only be called by itself, not anyone else.
|
||||
(to change things, use at_object_creation() instead).
|
||||
at_after_move(source_location) - Launches the "look" command after every move.
|
||||
at_post_unpuppet(player) - when Player disconnects from the Character, we
|
||||
at_post_unpuppet(account) - when Account disconnects from the Character, we
|
||||
store the current location in the pre_logout_location Attribute and
|
||||
move it to a None-location so the "unpuppeted" character
|
||||
object does not need to stay on grid. Echoes "Player has disconnected"
|
||||
object does not need to stay on grid. Echoes "Account has disconnected"
|
||||
to the room.
|
||||
at_pre_puppet - Just before Player re-connects, retrieves the character's
|
||||
at_pre_puppet - Just before Account re-connects, retrieves the character's
|
||||
pre_logout_location Attribute and move it back on the grid.
|
||||
at_post_puppet - Echoes "PlayerName has entered the game" to the room.
|
||||
at_post_puppet - Echoes "AccountName has entered the game" to the room.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -40,16 +40,16 @@ class Object(DefaultObject):
|
|||
date_created (string) - time stamp of object creation
|
||||
permissions (list of strings) - list of permission strings
|
||||
|
||||
player (Player) - controlling player (if any, only set together with
|
||||
account (Account) - controlling account (if any, only set together with
|
||||
sessid below)
|
||||
sessid (int, read-only) - session id (if any, only set together with
|
||||
player above). Use `sessions` handler to get the
|
||||
account above). Use `sessions` handler to get the
|
||||
Sessions directly.
|
||||
location (Object) - current location. Is None if this is a room
|
||||
home (Object) - safety start-location
|
||||
sessions (list of Sessions, read-only) - returns all sessions connected
|
||||
to this object
|
||||
has_player (bool, read-only)- will only return *connected* players
|
||||
has_account (bool, read-only)- will only return *connected* accounts
|
||||
contents (list of Objects, read-only) - returns all objects inside this
|
||||
object (including exits)
|
||||
exits (list of Objects, read-only) - returns all exits from this
|
||||
|
|
@ -73,7 +73,7 @@ class Object(DefaultObject):
|
|||
* Helper methods (see src.objects.objects.py for full headers)
|
||||
|
||||
search(ostring, global_search=False, attribute_name=None,
|
||||
use_nicks=False, location=None, ignore_errors=False, player=False)
|
||||
use_nicks=False, location=None, ignore_errors=False, account=False)
|
||||
execute_cmd(raw_string)
|
||||
msg(text=None, **kwargs)
|
||||
msg_contents(message, exclude=None, from_obj=None, **kwargs)
|
||||
|
|
@ -105,14 +105,14 @@ class Object(DefaultObject):
|
|||
requests a cmdset from this object. The kwargs are
|
||||
not normally used unless the cmdset is created
|
||||
dynamically (see e.g. Exits).
|
||||
at_pre_puppet(player)- (player-controlled objects only) called just
|
||||
at_pre_puppet(account)- (account-controlled objects only) called just
|
||||
before puppeting
|
||||
at_post_puppet() - (player-controlled objects only) called just
|
||||
after completing connection player<->object
|
||||
at_pre_unpuppet() - (player-controlled objects only) called just
|
||||
at_post_puppet() - (account-controlled objects only) called just
|
||||
after completing connection account<->object
|
||||
at_pre_unpuppet() - (account-controlled objects only) called just
|
||||
before un-puppeting
|
||||
at_post_unpuppet(player) - (player-controlled objects only) called just
|
||||
after disconnecting player<->object link
|
||||
at_post_unpuppet(account) - (account-controlled objects only) called just
|
||||
after disconnecting account<->object link
|
||||
at_server_reload() - called before server is reloaded
|
||||
at_server_shutdown() - called just before server is fully shut down
|
||||
|
||||
|
|
|
|||
|
|
@ -1,102 +0,0 @@
|
|||
"""
|
||||
Player
|
||||
|
||||
The Player represents the game "account" and each login has only one
|
||||
Player object. A Player is what chats on default channels but has no
|
||||
other in-game-world existence. Rather the Player puppets Objects (such
|
||||
as Characters) in order to actually participate in the game world.
|
||||
|
||||
|
||||
Guest
|
||||
|
||||
Guest players are simple low-level accounts that are created/deleted
|
||||
on the fly and allows users to test the game without the commitment
|
||||
of a full registration. Guest accounts are deactivated by default; to
|
||||
activate them, add the following line to your settings file:
|
||||
|
||||
GUEST_ENABLED = True
|
||||
|
||||
You will also need to modify the connection screen to reflect the
|
||||
possibility to connect with a guest account. The setting file accepts
|
||||
several more options for customizing the Guest account system.
|
||||
|
||||
"""
|
||||
|
||||
from evennia import DefaultPlayer, DefaultGuest
|
||||
|
||||
class Player(DefaultPlayer):
|
||||
"""
|
||||
This class describes the actual OOC player (i.e. the user connecting
|
||||
to the MUD). It does NOT have visual appearance in the game world (that
|
||||
is handled by the character which is connected to this). Comm channels
|
||||
are attended/joined using this object.
|
||||
|
||||
It can be useful e.g. for storing configuration options for your game, but
|
||||
should generally not hold any character-related info (that's best handled
|
||||
on the character level).
|
||||
|
||||
Can be set using BASE_PLAYER_TYPECLASS.
|
||||
|
||||
|
||||
* available properties
|
||||
|
||||
key (string) - name of player
|
||||
name (string)- wrapper for user.username
|
||||
aliases (list of strings) - aliases to the object. Will be saved to database as AliasDB entries but returned as strings.
|
||||
dbref (int, read-only) - unique #id-number. Also "id" can be used.
|
||||
date_created (string) - time stamp of object creation
|
||||
permissions (list of strings) - list of permission strings
|
||||
|
||||
user (User, read-only) - django User authorization object
|
||||
obj (Object) - game object controlled by player. 'character' can also be used.
|
||||
sessions (list of Sessions) - sessions connected to this player
|
||||
is_superuser (bool, read-only) - if the connected user is a superuser
|
||||
|
||||
* Handlers
|
||||
|
||||
locks - lock-handler: use locks.add() to add new lock strings
|
||||
db - attribute-handler: store/retrieve database attributes on this self.db.myattr=val, val=self.db.myattr
|
||||
ndb - non-persistent attribute handler: same as db but does not create a database entry when storing data
|
||||
scripts - script-handler. Add new scripts to object with scripts.add()
|
||||
cmdset - cmdset-handler. Use cmdset.add() to add new cmdsets to object
|
||||
nicks - nick-handler. New nicks with nicks.add().
|
||||
|
||||
* Helper methods
|
||||
|
||||
msg(text=None, **kwargs)
|
||||
swap_character(new_character, delete_old_character=False)
|
||||
execute_cmd(raw_string, session=None)
|
||||
search(ostring, global_search=False, attribute_name=None, use_nicks=False, location=None, ignore_errors=False, player=False)
|
||||
is_typeclass(typeclass, exact=False)
|
||||
swap_typeclass(new_typeclass, clean_attributes=False, no_default=True)
|
||||
access(accessing_obj, access_type='read', default=False)
|
||||
check_permstring(permstring)
|
||||
|
||||
* Hook methods (when re-implementation, remember methods need to have self as first arg)
|
||||
|
||||
basetype_setup()
|
||||
at_player_creation()
|
||||
|
||||
- note that the following hooks are also found on Objects and are
|
||||
usually handled on the character level:
|
||||
|
||||
at_init()
|
||||
at_cmdset_get(**kwargs)
|
||||
at_first_login()
|
||||
at_post_login(session=None)
|
||||
at_disconnect()
|
||||
at_message_receive()
|
||||
at_message_send()
|
||||
at_server_reload()
|
||||
at_server_shutdown()
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Guest(DefaultGuest):
|
||||
"""
|
||||
This class is used for guest logins. Unlike Players, Guests and their
|
||||
characters are deleted after disconnection.
|
||||
"""
|
||||
pass
|
||||
Loading…
Add table
Add a link
Reference in a new issue