Advertisement
Guest User

Untitled

a guest
May 26th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1.     def at_account_creation(self):
  2.         """
  3.        This is called once, the very first time
  4.        the player is created (i.e. first time they
  5.        register with the game). It's a good place
  6.        to store attributes all players should have,
  7.        like configuration values etc.
  8.        """
  9.         # set an (empty) attribute holding the characters this player has
  10.         lockstring = "attrread:perm(Wizards);attredit:perm(Wizards);attrcreate:perm(Wizards)"
  11.         self.attributes.add("_playable_characters", [], lockstring=lockstring)
  12.         self.addributes.add("_jnotes", [], lockstring=lockstring)
  13.         self.attributes.add("_last_site", ['' for x in range(10)])
  14.         self.attributes.add("_site_index", 0)
  15.  
  16.  
  17.     def at_post_login(self, session=None):
  18.  
  19.         super().at_post_login(session=session)
  20.  
  21.         address = self.sessions.all()[-1].address
  22.         if isinstance(address, tuple):
  23.             address = address[0]
  24.  
  25.         try:
  26.             index = self.db._site_index or 0
  27.             sites = self.db._last_site or ['' for x in range(10)]
  28.             sites[index] = (address, time.time(), self.db._last_puppet.id)
  29.             index = (index + 1) % 10
  30.             self.db._site_index = index
  31.             self.db._last_site = sites
  32.         except:
  33.             pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement