X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/move_up?a=blobdiff_plain;f=plomrogue%2Fcommands.py;h=8ec6f524d22e8283ba13fc47424dc4e18352de2d;hb=e67306357a830cabdd5ce86b2b333499d99da325;hp=6c356658e20ae48c858652f353f96353d879f6b0;hpb=3ab9a2ef6f42f109e9b8460be2ea3ebfcc0af19b;p=plomrogue2 diff --git a/plomrogue/commands.py b/plomrogue/commands.py index 6c35665..8ec6f52 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -18,7 +18,7 @@ def cmd_ALL(game, msg, connection_id): while random.random() > volume * 8: if c.isupper(): c = c.lower() - elif c != '.': + elif c != '.' and c != ' ': c = '.' else: c = ' ' @@ -99,20 +99,20 @@ def cmd_GET_GAMESTATE(game, connection_id): game.send_gamestate(connection_id) cmd_GET_GAMESTATE.argtypes = '' -def cmd_QUERY(game, target_nick, msg, connection_id): - if not connection_id in game.sessions: - raise GameError('can only query when logged in') - t = game.get_thing(game.sessions[connection_id], False) - source_nick = t.nickname - for t in [t for t in game.things if t.type_ == 'player' and t.nickname == target_nick]: - for c_id in game.sessions: - if game.sessions[c_id] == t.id_: - game.io.send('CHAT ' + quote(source_nick+ '->' + target_nick + ': ' + msg), c_id) - game.io.send('CHAT ' + quote(source_nick+ '->' + target_nick + ': ' + msg), connection_id) - return - raise GameError('target user offline') - raise GameError('can only query with registered nicknames') -cmd_QUERY.argtypes = 'string string' +#def cmd_QUERY(game, target_nick, msg, connection_id): +# if not connection_id in game.sessions: +# raise GameError('can only query when logged in') +# t = game.get_thing(game.sessions[connection_id], False) +# source_nick = t.nickname +# for t in [t for t in game.things if t.type_ == 'player' and t.nickname == target_nick]: +# for c_id in game.sessions: +# if game.sessions[c_id] == t.id_: +# game.io.send('CHAT ' + quote(source_nick+ '->' + target_nick + ': ' + msg), c_id) +# game.io.send('CHAT ' + quote(source_nick+ '->' + target_nick + ': ' + msg), connection_id) +# return +# raise GameError('target user offline') +# raise GameError('can only query with registered nicknames') +#cmd_QUERY.argtypes = 'string string' def cmd_PING(game, connection_id): game.io.send('PONG', connection_id)