<p>An <em>Account</em> represents a unique game account - one player playing the game. Whereas a player can potentially connect to the game from several Clients/Sessions, they will normally have only one Account.</p>
<p>The Account object has no in-game representation. In order to actually get on the game the Account must <em>puppet</em> an <aclass="reference internal"href="Objects.html"><spanclass="doc std std-doc">Object</span></a> (normally a <spanclass="xref myst">Character</span>).</p>
<p>Apart from storing login information and other account-specific data, the Account object is what is chatting on Evennia’s default <aclass="reference internal"href="Channels.html"><spanclass="doc std std-doc">Channels</span></a>. It is also a good place to store <aclass="reference internal"href="Locks.html"><spanclass="doc std std-doc">Permissions</span></a> to be consistent between different in-game characters. It can also hold player-level configuration options.</p>
<p>The Account object has its own default <aclass="reference internal"href="Command-Sets.html"><spanclass="doc std std-doc">CmdSet</span></a>, the <codeclass="docutils literal notranslate"><spanclass="pre">AccountCmdSet</span></code>. The commands in this set are available to the player no matter which character they are puppeting. Most notably the default game’s <codeclass="docutils literal notranslate"><spanclass="pre">exit</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">who</span></code> and chat-channel commands are in the Account cmdset.</p>
<p>The default <codeclass="docutils literal notranslate"><spanclass="pre">ooc</span></code> command causes you to leave your current puppet and go into OOC mode. In this mode you have no location and have only the Account-cmdset available. It acts a staging area for switching characters (if your game supports that) as well as a safety fallback if your character gets accidentally deleted.</p>
<divclass="highlight-none notranslate"><divclass="highlight"><pre><span></span>> ic
</pre></div>
</div>
<p>This re-puppets the latest character.</p>
<p>Note that the Account object can have, and often does have, a different set of <aclass="reference internal"href="Permissions.html"><spanclass="doc std std-doc">Permissions</span></a> from the Character they control. Normally you should put your permissions on the Account level - this will overrule permissions set on the Character level. For the permissions of the Character to come into play the default <codeclass="docutils literal notranslate"><spanclass="pre">quell</span></code> command can be used. This allows for exploring the game using a different permission set (but you can’t escalate your permissions this way - for hierarchical permissions like <codeclass="docutils literal notranslate"><spanclass="pre">Builder</span></code>, <codeclass="docutils literal notranslate"><spanclass="pre">Admin</span></code> etc, the <em>lower</em> of the permissions on the Character/Account will always be used).</p>
<p>You will usually not want more than one Account typeclass for all new accounts.</p>
<p>An Evennia Account is, per definition, a Python class that includes <codeclass="docutils literal notranslate"><spanclass="pre">evennia.DefaultAccount</span></code> among its parents. In <codeclass="docutils literal notranslate"><spanclass="pre">mygame/typeclasses/accounts.py</span></code> there is an empty class ready for you to modify. Evennia defaults to using this (it inherits directly from <codeclass="docutils literal notranslate"><spanclass="pre">DefaultAccount</span></code>).</p>
<spanclass="s2">"this is called only once, when account is first created"</span>
<spanclass="bp">self</span><spanclass="o">.</span><spanclass="n">db</span><spanclass="o">.</span><spanclass="n">real_name</span><spanclass="o">=</span><spanclass="kc">None</span><spanclass="c1"># this is set later </span>
<p>Reload the server with <codeclass="docutils literal notranslate"><spanclass="pre">reload</span></code>.</p>
<p>… However, if you use <codeclass="docutils literal notranslate"><spanclass="pre">examine</span><spanclass="pre">*self</span></code> (the asterisk makes you examine your Account object rather than your Character), you won’t see your new Attributes yet. This is because <codeclass="docutils literal notranslate"><spanclass="pre">at_account_creation</span></code> is only called the very <em>first</em> time the Account is called and your Account object already exists (any new Accounts that connect will see them though). To update yourself you need to make sure to re-fire the hook on all the Accounts you have already created. Here is an example of how to do this using <codeclass="docutils literal notranslate"><spanclass="pre">py</span></code>:</p>
<div><p>If you wanted Evennia to default to a completely <em>different</em> Account class located elsewhere, you > must point Evennia to it. Add <codeclass="docutils literal notranslate"><spanclass="pre">BASE_ACCOUNT_TYPECLASS</span></code> to your settings file, and give the python path to your custom class as its value. By default this points to <codeclass="docutils literal notranslate"><spanclass="pre">typeclasses.accounts.Account</span></code>, the empty template we used above.</p>
<p>Beyond those properties assigned to all typeclassed objects (see <aclass="reference internal"href="Typeclasses.html"><spanclass="doc std std-doc">Typeclasses</span></a>), the Account also has the following custom properties:</p>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">user</span></code> - a unique link to a <codeclass="docutils literal notranslate"><spanclass="pre">User</span></code> Django object, representing the logged-in user.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">obj</span></code> - an alias for <codeclass="docutils literal notranslate"><spanclass="pre">character</span></code>.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">name</span></code> - an alias for <codeclass="docutils literal notranslate"><spanclass="pre">user.username</span></code></p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">sessions</span></code> - an instance of <aclass="reference external"href="https://github.com/evennia/evennia/blob/main/evennia.objects.objects#objectsessionhandler">ObjectSessionHandler</a> managing all connected Sessions (physical connections) this object listens to (Note: In older versions of Evennia, this was a list). The so-called <codeclass="docutils literal notranslate"><spanclass="pre">session-id</span></code> (used in many places) is found as a property <codeclass="docutils literal notranslate"><spanclass="pre">sessid</span></code> on each Session instance.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">is_superuser</span></code> (bool: True/False) - if this account is a superuser.</p></li>
</ul>
<p>Special handlers:</p>
<ulclass="simple">
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">cmdset</span></code> - This holds all the current <aclass="reference internal"href="Commands.html"><spanclass="doc std std-doc">Commands</span></a> of this Account. By default these are
the commands found in the cmdset defined by <codeclass="docutils literal notranslate"><spanclass="pre">settings.CMDSET_ACCOUNT</span></code>.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">nicks</span></code> - This stores and handles <aclass="reference internal"href="Nicks.html"><spanclass="doc std std-doc">Nicks</span></a>, in the same way as nicks it works on Objects. For Accounts, nicks are primarily used to store custom aliases for <aclass="reference internal"href="Channels.html"><spanclass="doc std std-doc">Channels</span></a>.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">get_puppet</span></code> - get a currently puppeted object connected to the Account and a given session id, if any.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">puppet_object</span></code> - connect a session to a puppetable Object.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">unpuppet_object</span></code> - disconnect a session from a puppetable Object.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">msg</span></code> - send text to the Account</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">execute_cmd</span></code> - runs a command as if this Account did it.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">search</span></code> - search for Accounts.</p></li>