def mm_attach(a): try: clear(a) a.hs_picker_cmd1 = asss.add_command("capt", c_capt, a) a.hs_picker_cmd2 = asss.add_command("pick", c_pick, a) a.hs_picker_cmd3 = asss.add_command("resetpick", c_resetpick, a) except: mm_detach(a)
def mm_attach(a): # set up interface a.fpwd_oldfm = asss.get_interface(asss.I_FREQMAN, a) a.fpwd_myint = asss.reg_interface(asss.I_FREQMAN, (initial, shipch, freqch), a) # set up command a.fpwd_joinpwd_cmd = asss.add_command("joinpwd", c_joinpwd, a) a.fpwd_freqpwd_cmd = asss.add_command("freqpwd", c_freqpwd, a) # data a.fpwd_fpwds = {}
def mm_attach(a): try: a.hs_duel = HS_Duel(a) a.hs_duel.cmds.append(asss.add_command('challenge', c_challenge, a)) a.hs_duel.cmds.append(asss.add_command('accept', c_accept, a)) a.hs_duel.cmds.append(asss.add_command('ready', c_ready, a)) a.hs_duel.cmds.append(asss.add_command('rating', c_rating, a)) a.hs_duel.cbs.append(asss.reg_callback(asss.CB_KILL, player_kill, a)) a.hs_duel.cbs.append(asss.reg_callback(asss.CB_SHIPFREQCHANGE, shipfreq_change, a)) a.hs_duel.cbs.append(asss.reg_callback(asss.CB_PLAYERACTION, player_action, a)) except: lm.LogA(asss.L_ERROR, 'hs_duel', a, 'Error during attach') mm_detach(a)
def mm_attach(a): try: a.hs_duel = HS_Duel(a) a.hs_duel.cmds.append(asss.add_command('challenge', c_challenge, a)) a.hs_duel.cmds.append(asss.add_command('accept', c_accept, a)) a.hs_duel.cmds.append(asss.add_command('ready', c_ready, a)) a.hs_duel.cmds.append(asss.add_command('rating', c_rating, a)) a.hs_duel.cbs.append(asss.reg_callback(asss.CB_KILL, player_kill, a)) a.hs_duel.cbs.append( asss.reg_callback(asss.CB_SHIPFREQCHANGE, shipfreq_change, a)) a.hs_duel.cbs.append( asss.reg_callback(asss.CB_PLAYERACTION, player_action, a)) except: lm.LogA(asss.L_ERROR, 'hs_duel', a, 'Error during attach') mm_detach(a)
def mm_attach(a): try: a.hs_lanc_cmd1 = asss.add_command('lancs', c_lancs, a) a.hs_lanc_item_summoner = items.getItemByName('Summoner', a) a.hs_lanc_item_evoker = items.getItemByName('Evoker', a) except: mm_detach(a)
def mm_attach(a): #commands a.tw_Cstart = asss.add_command("start", c_start, a) a.tw_Csetcap = asss.add_command("addcap", c_addcap, a) a.tw_Cscore = asss.add_command("score", c_score, a) a.tw_Cend = asss.add_command("end", c_end, a) #callbacks cb1 = reg_callback(CB_KILL, kill) cb2 = reg_callback(CB_SHIPCHANGE, shipchange) #data a.tw_caps = [] a.tw_freq0 = [] a.tw_freq1 = [] a.tw_scores = {'key': 'value'}
def mm_attach(arena): arena.lib_devmode = asss.add_command("devmode", devmode, arena)
arena. You can write multi-line statements by separating lines with semicolons (be sure to get the indentation correct). Output written to stdout (e.g., with print) is captured and displayed to you, as are any exceptions raised in your code. """ params = params.replace(';', '\n') output = sys.stdout = cStringIO.StringIO() env['me'] = player env['t'] = targ env['a'] = player.arena try: exec params in env except: info = sys.exc_info() output.write('%s: %s\n' % \ (getattr(info[0], '__name__', info[0]), info[1])) del info if hasattr(sys, 'exc_clear'): sys.exc_clear() sys.stdout = orig_sys_stdout del env['me'] del env['t'] del env['a'] for l in output.getvalue().splitlines(): chat.SendMessage(player, l) ref = asss.add_command('py', c_py)
Module: <py> watchgreen Targets: player or arena Args: none If send to a player, turns on green watching for that player. If sent as a public message, turns off all your green watching.""" if type(targ) == asss.ArenaType: clear_watches(p) elif type(targ) == asss.PlayerType and \ asss.is_standard(targ): watchers = watchmap.setdefault(targ, []) if p not in watchers: watchers.append(p) else: chat.SendMessage(p, "Bad target") cmd1 = asss.add_command('watchgreen', c_watchgreen) def my_green(p, x, y, type): watchers = watchmap.get(p) if watchers: msg = '%s picked up %s' % (p.name, greenmap.get(type, 'Unknown')) for watcher in watchers: chat.SendMessage(watcher, msg) cb1 = asss.reg_callback(asss.CB_GREEN, my_green) def my_paction(p, action, arena): if action == asss.PA_LEAVEARENA: try: del watchmap[p]
yourself, {t} is the target of the command, and {a} is the current arena. You can write multi-line statements by separating lines with semicolons (be sure to get the indentation correct). Output written to stdout (e.g., with print) is captured and displayed to you, as are any exceptions raised in your code. """ params = params.replace(';', '\n') output = sys.stdout = cStringIO.StringIO() env['me'] = player env['t'] = targ env['a'] = player.arena try: exec params in env except: info = sys.exc_info() output.write('%s: %s\n' % \ (getattr(info[0], '__name__', info[0]), info[1])) del info if hasattr(sys, 'exc_clear'): sys.exc_clear() sys.stdout = orig_sys_stdout del env['me'] del env['t'] del env['a'] for l in output.getvalue().splitlines(): chat.SendMessage(player, l) ref = asss.add_command('py', c_py)
Targets: player or arena Args: none If send to a player, turns on green watching for that player. If sent as a public message, turns off all your green watching.""" if type(targ) == asss.ArenaType: clear_watches(p) elif type(targ) == asss.PlayerType and \ asss.is_standard(targ): watchers = watchmap.setdefault(targ, []) if p not in watchers: watchers.append(p) else: chat.SendMessage(p, "Bad target") cmd1 = asss.add_command('watchgreen', c_watchgreen) def my_green(p, x, y, type): watchers = watchmap.get(p) if watchers: msg = '%s picked up %s' % (p.name, greenmap.get(type, 'Unknown')) for watcher in watchers: chat.SendMessage(watcher, msg) cb1 = asss.reg_callback(asss.CB_GREEN, my_green) def my_paction(p, action, arena): if action == asss.PA_LEAVEARENA: