accounts.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. """
  2. Account
  3. The Account represents the game "account" and each login has only one
  4. Account object. An Account is what chats on default channels but has no
  5. other in-game-world existence. Rather the Account puppets Objects (such
  6. as Characters) in order to actually participate in the game world.
  7. Guest
  8. Guest accounts are simple low-level accounts that are created/deleted
  9. on the fly and allows users to test the game without the commitment
  10. of a full registration. Guest accounts are deactivated by default; to
  11. activate them, add the following line to your settings file:
  12. GUEST_ENABLED = True
  13. You will also need to modify the connection screen to reflect the
  14. possibility to connect with a guest account. The setting file accepts
  15. several more options for customizing the Guest account system.
  16. """
  17. from evennia import DefaultAccount, DefaultGuest
  18. class Account(DefaultAccount):
  19. """
  20. This class describes the actual OOC account (i.e. the user connecting
  21. to the MUD). It does NOT have visual appearance in the game world (that
  22. is handled by the character which is connected to this). Comm channels
  23. are attended/joined using this object.
  24. It can be useful e.g. for storing configuration options for your game, but
  25. should generally not hold any character-related info (that's best handled
  26. on the character level).
  27. Can be set using BASE_ACCOUNT_TYPECLASS.
  28. * available properties
  29. key (string) - name of account
  30. name (string)- wrapper for user.username
  31. aliases (list of strings) - aliases to the object. Will be saved to database as AliasDB entries but returned as strings.
  32. dbref (int, read-only) - unique #id-number. Also "id" can be used.
  33. date_created (string) - time stamp of object creation
  34. permissions (list of strings) - list of permission strings
  35. user (User, read-only) - django User authorization object
  36. obj (Object) - game object controlled by account. 'character' can also be used.
  37. sessions (list of Sessions) - sessions connected to this account
  38. is_superuser (bool, read-only) - if the connected user is a superuser
  39. * Handlers
  40. locks - lock-handler: use locks.add() to add new lock strings
  41. db - attribute-handler: store/retrieve database attributes on this self.db.myattr=val, val=self.db.myattr
  42. ndb - non-persistent attribute handler: same as db but does not create a database entry when storing data
  43. scripts - script-handler. Add new scripts to object with scripts.add()
  44. cmdset - cmdset-handler. Use cmdset.add() to add new cmdsets to object
  45. nicks - nick-handler. New nicks with nicks.add().
  46. * Helper methods
  47. msg(text=None, **kwargs)
  48. execute_cmd(raw_string, session=None)
  49. search(ostring, global_search=False, attribute_name=None, use_nicks=False, location=None, ignore_errors=False, account=False)
  50. is_typeclass(typeclass, exact=False)
  51. swap_typeclass(new_typeclass, clean_attributes=False, no_default=True)
  52. access(accessing_obj, access_type='read', default=False)
  53. check_permstring(permstring)
  54. * Hook methods (when re-implementation, remember methods need to have self as first arg)
  55. basetype_setup()
  56. at_account_creation()
  57. - note that the following hooks are also found on Objects and are
  58. usually handled on the character level:
  59. at_init()
  60. at_cmdset_get(**kwargs)
  61. at_first_login()
  62. at_post_login(session=None)
  63. at_disconnect()
  64. at_message_receive()
  65. at_message_send()
  66. at_server_reload()
  67. at_server_shutdown()
  68. """
  69. pass
  70. class Guest(DefaultGuest):
  71. """
  72. This class is used for guest logins. Unlike Accounts, Guests and their
  73. characters are deleted after disconnection.
  74. """
  75. pass