Storycraft: notify (via privmsg) a player who has had a game newly assigned to them, and show the line.

This commit is contained in:
Brian S. Stephan 2011-01-09 13:50:16 -06:00
parent 487ca2e862
commit 2f001e274b
1 changed files with 11 additions and 1 deletions

View File

@ -434,8 +434,18 @@ class Storycraft(Module):
# indicate the status
game = self._get_game_details(game_id)
line = self._get_lines_for_game(game_id)[0]
last_line = self._get_lines_for_game(game_id)[1]
player = self._get_player_by_id(line.player_id)
return_msg = 'Line logged.'
# message the new owner
if player.nick == nick:
# simpily notify them they're up again
return_msg = 'Line logged. Please add another.'
else:
# notify the new owner, too
self.irc.reply(connection, player.nick, 'You have a new line in storycraft #{0:d}: \'{1:s}\''.format(game_id, last_line.line))
# get the default settings
settings = self._get_storycraft_settings()
master_channel = settings.master_channel
@ -443,7 +453,7 @@ class Storycraft(Module):
# log output
if game.status == 'IN PROGRESS':
self.irc.reply(connection, master_channel, '{0:s} added a line to storycraft #{1:d}! - next player is {2:s}'.format(nick, game_id, player.nick))
return 'Line logged.'
return return_msg
else:
self.irc.reply(connection, master_channel, '{0:s} finished storycraft #{1:d}!'.format(nick, game_id))
return 'Line logged (and game completed).'