X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdeck_id%7D%7D/cards/%7B%7Bcard_id%7D%7D/form?a=blobdiff_plain;f=plomrogue%2Fcommands.py;h=3b2464b42baa6d7c429832ea34138c970d00570d;hb=2ce340a97606c970eb1d6dd8cccee7a2d12c6c05;hp=229285fb8c7f291ff02458367b11e40f89cdb6a9;hpb=884b4b8d9c18896569c5e741f90a6ee67f8db8b2;p=plomrogue2 diff --git a/plomrogue/commands.py b/plomrogue/commands.py index 229285f..3b2464b 100644 --- a/plomrogue/commands.py +++ b/plomrogue/commands.py @@ -67,7 +67,7 @@ def cmd_ALL(game, msg, connection_id): listener_vol = dijkstra_map[game.map.get_position_index(listener.position)] volume = 1 / max(1, listener_vol) lowered_msg = lower_msg_by_volume(msg, volume) - lowered_nick = lower_msg_by_volume(speaker.nickname, volume) + lowered_nick = lower_msg_by_volume(speaker.name, volume) game.io.send('CHAT ' + quote('(volume: %.2f) %s: %s' % (volume, lowered_nick, lowered_msg)), @@ -75,7 +75,7 @@ def cmd_ALL(game, msg, connection_id): cmd_ALL.argtypes = 'string' def cmd_LOGIN(game, nick, connection_id): - for t in [t for t in game.things if t.type_ == 'Player' and t.nickname == nick]: + for t in [t for t in game.things if t.type_ == 'Player' and t.name == nick]: raise GameError('name already in use') if connection_id in game.sessions: raise GameError('cannot log in twice') @@ -85,21 +85,21 @@ def cmd_LOGIN(game, nick, connection_id): t.player_char = game.get_next_player_char() game.sessions[connection_id] = t.id_ game.io.send('LOGIN_OK', connection_id) - t.nickname = nick - game.io.send('CHAT ' + quote(t.nickname + ' entered the map.')) + t.name = nick + game.io.send('CHAT ' + quote(t.name + ' entered the map.')) game.io.send('PLAYER_ID %s' % t.id_, connection_id) game.changed = True cmd_LOGIN.argtypes = 'string' def cmd_NICK(game, nick, connection_id): - for t in [t for t in game.things if t.type_ == 'Player' and t.nickname == nick]: + for t in [t for t in game.things if t.type_ == 'Player' and t.name == nick]: raise GameError('name already in use') if not connection_id in game.sessions: raise GameError('can only rename when already logged in') t_id = game.sessions[connection_id] t = game.get_thing(t_id) - old_nick = t.nickname - t.nickname = nick + old_nick = t.name + t.name = nick game.io.send('CHAT ' + quote(old_nick + ' renamed themselves to ' + nick)) game.changed = True cmd_NICK.argtypes = 'string' @@ -112,8 +112,8 @@ cmd_GET_GAMESTATE.argtypes = '' # 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]: +# source_nick = t.name +# for t in [t for t in game.things if t.type_ == 'Player' and t.name == 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)