def cmd_chat(ch, cmd, arg): '''Usage: chat <message> This command will send a message to all players currently logged on. ''' if arg == '': ch.send("Chat what?") else: arg = arg.replace("$", "$$") mssg = "{y$n chats, '" + arg + "'{n" mud.message(ch, None, None, None, False, "to_world", mssg) mud.message(ch, None, None, None,False,"to_char", "{yyou chat, '"+arg+"'{n") history.add_history(ch, "chat", "{y%-10s: %s{n" % (ch.name, arg))
def cmd_tell(ch, cmd, arg): '''Usage: tell <person> <message> This command sends a message to another character. Primarily intended for player-to-player communication. Players can tell other players things even if they are not in the same room. see also: reply''' try: tgt, mssg = mud.parse_args(ch, True, cmd, arg, "ch.world.noself string(message)") except: return mssg = mssg.replace("$", "$$") tovict = "{r$n tells you, '" + mssg + "'{n" toch = "{rYou tell $N, '" + mssg + "'{n" mud.message(ch, tgt, None, None, False, "to_vict", tovict) mud.message(ch, tgt, None, None, False, "to_char", toch) history.add_history(ch, "tell", "{r%-10s: %s{n" % (ch.name, mssg)) history.add_history(tgt, "tell", "{r%-10s: %s{n" % (ch.name, mssg)) hooks.run("tell", hooks.build_info("ch ch str", (ch, tgt, mssg)))
def index(): values = request.args agent = str(request.user_agent) if 'group' not in values or 'step' not in values: #add_history(u'Start Page// ' + agent) return render_template('index.html') if (not 'key' in values) or (values['key'] == ''): if 'lone' in str(values['group']) or 'givenchystyle' in str( values['group']): key = '1985' else: return jsonify({'error': 'The personal key isn\'t given'}) else: key = str(values['key']) if not key in get_keys(): return jsonify({'error': 'The key doesn\'t exist'}) step = int(values['step']) screen_name = str(values['group']) if 'full' in values and int(values['full']) == 1: full = True else: full = False if 'extra' in values and int(values['extra']) == 1: extra = True else: extra = False add_history( u'Request. step:{}, screen_name:{}, full:{}, key:{}, extra:{} // '. format(*[str(n) for n in [step, screen_name, full, key, extra]])) #try: instas = run(step, screen_name, full=full, extra_data=extra) #except KeyError: # return jsonify({'error': 'Invalid datas'}) if instas == 'Out of range': return jsonify({'error': 'Out of range'}) dic = {'count': len(instas), 'items': instas} return jsonify(dic)