Cleanups and bug fixes. Fixed the @unlink command and also made it overally more stable. Resolves issue 161. Added more string conversion routines to handle non-ascii variables being stored in an Attribute. Resolves issue 160.
This commit is contained in:
parent
14db4bea4d
commit
7d30b337d9
27 changed files with 873 additions and 1048 deletions
|
|
@ -109,103 +109,103 @@ def cmd_imclist(command):
|
|||
source_object.emit_to(retval)
|
||||
GLOBAL_CMD_TABLE.add_command("imclist", cmd_imclist, help_category="Comms")
|
||||
|
||||
def cmd_imcstatus(command):
|
||||
"""
|
||||
imcstatus
|
||||
# def cmd_imcstatus(command):
|
||||
# """
|
||||
# imcstatus
|
||||
|
||||
Usage:
|
||||
imcstatus
|
||||
# Usage:
|
||||
# imcstatus
|
||||
|
||||
Shows some status information for your IMC2 connection.
|
||||
"""
|
||||
source_object = command.source_object
|
||||
# This manages our game's plugged in services.
|
||||
collection = command.session.server.service_collection
|
||||
# Retrieve the IMC2 service.
|
||||
service = collection.getServiceNamed('IMC2')
|
||||
# Shows some status information for your IMC2 connection.
|
||||
# """
|
||||
# source_object = command.source_object
|
||||
# # This manages our game's plugged in services.
|
||||
# collection = command.session.server.service_collection
|
||||
# # Retrieve the IMC2 service.
|
||||
# service = collection.getServiceNamed('IMC2')
|
||||
|
||||
if service.running == 1:
|
||||
status_string = 'Running'
|
||||
else:
|
||||
status_string = 'Inactive'
|
||||
# if service.running == 1:
|
||||
# status_string = 'Running'
|
||||
# else:
|
||||
# status_string = 'Inactive'
|
||||
|
||||
# Build the output to emit to the player.
|
||||
retval = '-' * 50
|
||||
retval += '\n\r'
|
||||
retval += 'IMC Status\n\r'
|
||||
retval += ' * MUD Name: %s\n\r' % (settings.IMC2_MUDNAME)
|
||||
retval += ' * Status: %s\n\r' % (status_string)
|
||||
retval += ' * Debugging Mode: %s\n\r' % (settings.IMC2_DEBUG)
|
||||
retval += ' * IMC Network Address: %s\n\r' % (settings.IMC2_SERVER_ADDRESS)
|
||||
retval += ' * IMC Network Port: %s\n\r' % (settings.IMC2_SERVER_PORT)
|
||||
retval += '-' * 50
|
||||
# # Build the output to emit to the player.
|
||||
# retval = '-' * 50
|
||||
# retval += '\n\r'
|
||||
# retval += 'IMC Status\n\r'
|
||||
# retval += ' * MUD Name: %s\n\r' % (settings.IMC2_MUDNAME)
|
||||
# retval += ' * Status: %s\n\r' % (status_string)
|
||||
# retval += ' * Debugging Mode: %s\n\r' % (settings.IMC2_DEBUG)
|
||||
# retval += ' * IMC Network Address: %s\n\r' % (settings.IMC2_SERVER_ADDRESS)
|
||||
# retval += ' * IMC Network Port: %s\n\r' % (settings.IMC2_SERVER_PORT)
|
||||
# retval += '-' * 50
|
||||
|
||||
source_object.emit_to(retval)
|
||||
GLOBAL_CMD_TABLE.add_command("imcstatus", cmd_imcstatus,
|
||||
priv_tuple=('imc2.admin_imc_channels',), help_category="Comms")
|
||||
# source_object.emit_to(retval)
|
||||
# GLOBAL_CMD_TABLE.add_command("imcstatus", cmd_imcstatus,
|
||||
# priv_tuple=('imc2.admin_imc_channels',), help_category="Comms")
|
||||
|
||||
|
||||
def cmd_IMC2chan(command):
|
||||
"""
|
||||
@imc2chan
|
||||
# def cmd_IMC2chan(command):
|
||||
# """
|
||||
# @imc2chan
|
||||
|
||||
Usage:
|
||||
@imc2chan <IMCServer> : <IMCchannel> <channel>
|
||||
# Usage:
|
||||
# @imc2chan <IMCServer> : <IMCchannel> <channel>
|
||||
|
||||
Links an IMC channel to an existing evennia
|
||||
channel. You can link as many existing
|
||||
evennia channels as you like to the
|
||||
IMC channel this way. Running the command with an
|
||||
existing mapping will re-map the channels.
|
||||
# Links an IMC channel to an existing evennia
|
||||
# channel. You can link as many existing
|
||||
# evennia channels as you like to the
|
||||
# IMC channel this way. Running the command with an
|
||||
# existing mapping will re-map the channels.
|
||||
|
||||
Use 'imcchanlist' to get a list of IMC channels and
|
||||
servers. Note that both are case sensitive.
|
||||
"""
|
||||
source_object = command.source_object
|
||||
if not settings.IMC2_ENABLED:
|
||||
s = """IMC is not enabled. You need to activate it in game/settings.py."""
|
||||
source_object.emit_to(s)
|
||||
return
|
||||
args = command.command_argument
|
||||
if not args or len(args.split()) != 2 :
|
||||
source_object.emit_to("Usage: @imc2chan IMCServer:IMCchannel channel")
|
||||
return
|
||||
#identify the server-channel pair
|
||||
imcdata, channel = args.split()
|
||||
if not ":" in imcdata:
|
||||
source_object.emit_to("You need to supply an IMC Server:Channel pair.")
|
||||
return
|
||||
imclist = IMC2_CHANLIST.get_channel_list()
|
||||
imc_channels = filter(lambda c: c.name == imcdata, imclist)
|
||||
if not imc_channels:
|
||||
source_object.emit_to("IMC server and channel '%s' not found." % imcdata)
|
||||
return
|
||||
else:
|
||||
imc_server_name, imc_channel_name = imcdata.split(":")
|
||||
# Use 'imcchanlist' to get a list of IMC channels and
|
||||
# servers. Note that both are case sensitive.
|
||||
# """
|
||||
# source_object = command.source_object
|
||||
# if not settings.IMC2_ENABLED:
|
||||
# s = """IMC is not enabled. You need to activate it in game/settings.py."""
|
||||
# source_object.emit_to(s)
|
||||
# return
|
||||
# args = command.command_argument
|
||||
# if not args or len(args.split()) != 2 :
|
||||
# source_object.emit_to("Usage: @imc2chan IMCServer:IMCchannel channel")
|
||||
# return
|
||||
# #identify the server-channel pair
|
||||
# imcdata, channel = args.split()
|
||||
# if not ":" in imcdata:
|
||||
# source_object.emit_to("You need to supply an IMC Server:Channel pair.")
|
||||
# return
|
||||
# imclist = IMC2_CHANLIST.get_channel_list()
|
||||
# imc_channels = filter(lambda c: c.name == imcdata, imclist)
|
||||
# if not imc_channels:
|
||||
# source_object.emit_to("IMC server and channel '%s' not found." % imcdata)
|
||||
# return
|
||||
# else:
|
||||
# imc_server_name, imc_channel_name = imcdata.split(":")
|
||||
|
||||
#find evennia channel
|
||||
try:
|
||||
chanobj = comsys.get_cobj_from_name(channel)
|
||||
except CommChannel.DoesNotExist:
|
||||
source_object.emit_to("Local channel '%s' not found (use real name, not alias)." % channel)
|
||||
return
|
||||
# #find evennia channel
|
||||
# try:
|
||||
# chanobj = comsys.get_cobj_from_name(channel)
|
||||
# except CommChannel.DoesNotExist:
|
||||
# source_object.emit_to("Local channel '%s' not found (use real name, not alias)." % channel)
|
||||
# return
|
||||
|
||||
#create the mapping.
|
||||
outstring = ""
|
||||
mapping = IMC2ChannelMapping.objects.filter(channel__name=channel)
|
||||
if mapping:
|
||||
mapping = mapping[0]
|
||||
outstring = "Replacing %s. New " % mapping
|
||||
else:
|
||||
mapping = IMC2ChannelMapping()
|
||||
# #create the mapping.
|
||||
# outstring = ""
|
||||
# mapping = IMC2ChannelMapping.objects.filter(channel__name=channel)
|
||||
# if mapping:
|
||||
# mapping = mapping[0]
|
||||
# outstring = "Replacing %s. New " % mapping
|
||||
# else:
|
||||
# mapping = IMC2ChannelMapping()
|
||||
|
||||
mapping.imc2_server_name = imc_server_name
|
||||
mapping.imc2_channel_name = imc_channel_name
|
||||
mapping.channel = chanobj
|
||||
mapping.save()
|
||||
outstring += "Mapping set: %s." % mapping
|
||||
source_object.emit_to(outstring)
|
||||
# mapping.imc2_server_name = imc_server_name
|
||||
# mapping.imc2_channel_name = imc_channel_name
|
||||
# mapping.channel = chanobj
|
||||
# mapping.save()
|
||||
# outstring += "Mapping set: %s." % mapping
|
||||
# source_object.emit_to(outstring)
|
||||
|
||||
GLOBAL_CMD_TABLE.add_command("@imc2chan",cmd_IMC2chan,
|
||||
priv_tuple=("imc2.admin_imc_channels",), help_category="Comms")
|
||||
# GLOBAL_CMD_TABLE.add_command("@imc2chan",cmd_IMC2chan,
|
||||
# priv_tuple=("imc2.admin_imc_channels",), help_category="Comms")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue