mirror of
https://github.com/evennia/evennia.git
synced 2026-03-31 04:57:16 +02:00
Added sessids to command objects and changed how the "login"-hooks are called. Those will probably have to be changed to better names, at least for characters.
This commit is contained in:
parent
231af4a351
commit
00584365ae
5 changed files with 113 additions and 96 deletions
|
|
@ -223,8 +223,8 @@ class ServerSessionHandler(SessionHandler):
|
|||
|
||||
def player_count(self):
|
||||
"""
|
||||
Get the number of connected players (not sessions since a player
|
||||
may have more than one session connected if ALLOW_MULTISESSION is True)
|
||||
Get the number of connected players (not sessions since a
|
||||
player may have more than one session depending on settings).
|
||||
Only logged-in players are counted here.
|
||||
"""
|
||||
return len(set(session.uid for session in self.sessions.values() if session.logged_in))
|
||||
|
|
@ -235,7 +235,8 @@ class ServerSessionHandler(SessionHandler):
|
|||
"""
|
||||
uid = player.uid
|
||||
if sessid:
|
||||
return [session for session in self.sessions.values() if session.logged_in and session.sessid == sessid and session.uid == uid]
|
||||
session = self.sessions.get(sessid)
|
||||
return session and session.logged_in and session.uid == uid and session or None
|
||||
else:
|
||||
return [session for session in self.sessions.values() if session.logged_in and session.uid == uid]
|
||||
|
||||
|
|
@ -243,9 +244,9 @@ class ServerSessionHandler(SessionHandler):
|
|||
"""
|
||||
Given a game character, return any matching sessions.
|
||||
"""
|
||||
player = character.player
|
||||
if player:
|
||||
return self.sessions_from_player(player)
|
||||
sessid = character.sessid
|
||||
if sessid:
|
||||
return self.sessions.get(sessid)
|
||||
return None
|
||||
|
||||
def announce_all(self, message):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue