Exemplo n.º 1
0
def do_zinstance(zone):
    '''create a new instance of the specified zone.'''
    # sanitize the zone key
    if sum([(not v in string.ascii_letters + string.digits + "_")
            for v in zone]):
        return None
    elif len(zone) == 0:
        return None

    # find all of our room keys
    rnames = mudsys.list_zone_contents(zone, "rproto")
    if len(rnames) == 0:
        return None

    to_instance = []
    for name in rnames:
        key = name + "@" + zone
        if not mudroom.is_abstract(key):
            to_instance.append(name)

    # instantiate and reset all of the relevant rooms
    uid = mudsys.next_uid()
    inszone = zone + str(uid)
    for name in to_instance:
        key = name + "@" + zone
        ins = name + "@" + inszone
        rm = mudroom.instance(key, ins)
        rm.reset()

    # append this to the list of instanced zones
    curr_instances.append((inszone, zone))

    # success
    return inszone
Exemplo n.º 2
0
def do_zinstance(zone):
    '''create a new instance of the specified zone.'''
    # sanitize the zone key
    if sum([(not v in string.ascii_letters+string.digits+"_") for v in zone]):
        return None
    elif len(zone) == 0:
        return None

    # find all of our room keys
    rnames = mudsys.list_zone_contents(zone, "rproto")
    if len(rnames) == 0:
        return None
            
    to_instance = [ ]
    for name in rnames:
        key = name + "@" + zone
        if not mudroom.is_abstract(key):
            to_instance.append(name)

    # instantiate and reset all of the relevant rooms
    uid     = mudsys.next_uid()
    inszone = zone + str(uid)
    for name in to_instance:
        key = name + "@" + zone
        ins = name + "@" + inszone
        rm  = mudroom.instance(key, ins)
        rm.reset()

    # append this to the list of instanced zones
    curr_instances.append((inszone, zone))

    # success
    return inszone
Exemplo n.º 3
0
def cmd_instance(ch, cmd, arg):
    '''Create an instanced version of the specified room'''
    try:
        source, dest = mud.parse_args(ch, True, cmd, arg, "word(source) [as] word(dest)")
    except: return

    room = mudroom.instance(source, dest)
    ch.send("You instance " + source + " as " + room.proto + ".")
Exemplo n.º 4
0
def cmd_instance(ch, cmd, arg):
    '''Create an instanced version of the specified room'''
    try:
        source, dest = mud.parse_args(ch, True, cmd, arg,
                                      "word(source) [as] word(dest)")
    except:
        return

    room = mudroom.instance(source, dest)
    ch.send("You instance " + source + " as " + room.proto + ".")