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.')
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()
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()
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.') )
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.')
def handle_spawn(client, amount): client.s.map.spawn_cheat_mobs(int(amount)) mutil.notify(client, 'Ok, have fun.')