mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 23:47:16 +02:00
* After review of the codebase some more, discovered better methods for most of what I was trying to do.
* Before this change, it was no longer dumping the connection, but was always claiming that the target player was not online, when they were. * Back to the drawing board on cmd_page for now.
This commit is contained in:
parent
3054d1233f
commit
21a03fc07c
1 changed files with 18 additions and 10 deletions
|
|
@ -241,18 +241,26 @@ def cmd_page(cdat):
|
|||
"""
|
||||
Send a message to target user (if online).
|
||||
"""
|
||||
from apps.objects.models import Object
|
||||
session = cdat['session']
|
||||
target_name = cdat['uinput']['splitted'][1:][0]
|
||||
message = cdat['uinput']['splitted'][1:][1:]
|
||||
# discard command name
|
||||
cdat['uinput']['splitted'].pop(0)
|
||||
target_name = cdat['uinput']['splitted'].pop(0)
|
||||
message = ' '.join(cdat['uinput']['splitted'])
|
||||
target = Object.objects.get(name__iexact=target_name)
|
||||
try:
|
||||
if target.is_connected_plr():
|
||||
target.emit_to("% pages you with: %s" % (session.something, message))
|
||||
session.get_pobject().emit_to("Page sent.")
|
||||
else:
|
||||
session.get_pobject().emit_to("User %s is not logged on." % (target_name.capitalize(),))
|
||||
except:
|
||||
session.get_pobject().emit_to("User %s not found." % (target_name,))
|
||||
if target:
|
||||
session.msg("Found user %s.", (target.get_name(),))
|
||||
try:
|
||||
if target.is_connected_plr():
|
||||
target.emit_to("% pages you with: %s" %
|
||||
(session.get_pobject().name.capitalize(), message))
|
||||
session.msg("Page sent.")
|
||||
else:
|
||||
session.msg("User %s is not logged on." % (target_name.capitalize(),))
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
session.msg("User %s not found." % (target_name,))
|
||||
|
||||
def cmd_quit(cdat):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue