示例#1
0
def reset_character(client, warp=True):
    client.s.char.level = 1
    client.s.char.exp = 1

    levelup(client, (1, ), is_natural=False, warp=warp)
    send_levelup(client)

    mutil.notify(client, 'Your session has been reset.')
示例#2
0
def handle_command(client, message):
    parts = message.split()
    func = handlers.get(parts[0])
    if func:
        try:
            func(client, *parts[1:])
        except TypeError:
            mutil.notify(client, 'Bad command.')
            traceback.print_exc()
        except:
            traceback.print_exc()
示例#3
0
def handle_rebirth(client, is_natural):
    char = client.s.char

    char.inventory.mesos = 0
    client.send('set_mesos', char)

    active = list(char.skills.active)
    for skill_id in active:
        skills.end_skill(client, skill_id)

    if is_natural:
        seconds = time.time() - char.vars.starttime
        mutil.notify(client, 'You finished in %s.' % format_time(seconds))

        runs = list(char.runs)
        runs.append({'time': seconds, 'livemode': char.vars.livemode})
        char.runs = runs

        char.vars.starttime = time.time()
示例#4
0
def handle_start_livemode(client):
    char = client.s.char

    char.exp = 0
    char.level = 1
    char.vars.update({
        'livemode': True,
        'exprate': 1,
        'droprate': 1,
        'mesorate': 1,
    })

    levels.levelup(client, (1,), is_natural=False)
    mutil.notify(
        client,
        ('Ok, we\'ve reset your character and set all rates to 1. '
         'Go through the portal to start the timer.'),
        ('If you change any variables during the run, livemode will '
         'be turned off.')
    )
示例#5
0
def handle_set(client, var, value):
    typecast = vartypes.get(var)
    if not typecast:
        mutil.notify(client, '%s is not a valid variable.' % var)

    try:
        value = typecast(value)
    except:
        msg = 'Variable %s is not of type %s.' % (var, typecast.__name__)
        mutil.notify(client, msg)
        return

    cvars = client.s.char.vars
    cvars[var] = value
    mutil.notify(client, '`%s` was set to: %s' % (var, value))

    if cvars.livemode:
        cvars.livemode = False
        mutil.notify(client, 'Livemode has been cancelled.')
示例#6
0
def handle_spawn(client, amount):
    client.s.map.spawn_cheat_mobs(int(amount))
    mutil.notify(client, 'Ok, have fun.')