Merge pull request #95 from kernelpanic3/dyn-quit

Dynamic quit messages, take 2
This commit is contained in:
Ryan Schmidt 2014-12-17 20:27:38 -06:00
commit a960696e6e
2 changed files with 28 additions and 3 deletions

View File

@ -2630,10 +2630,25 @@ def leave_game(cli, nick, chan, rest):
cli.notice(nick, "You're not currently playing.")
return
if var.get_role(nick) != "person" and var.ROLE_REVEAL:
cli.msg(botconfig.CHANNEL, ("\02{0}\02, a \02{1}\02, has died of an unknown disease.{2}").format(nick, var.get_reveal_role(nick), population))
var.LOGGER.logMessage(("{0}, a {1}, has died of an unknown disease.").format(nick, var.get_reveal_role(nick)))
role = var.get_reveal_role(nick)
an = "n" if role[0] in ("a", "e", "i", "o", "u") else ""
if var.DYNQUIT_DURING_GAME:
lmsg = random.choice(var.QUIT_MESSAGES).format(nick, an, role, population)
cli.msg(botconfig.CHANNEL, lmsg)
else:
cli.msg(botconfig.CHANNEL, ("\02{0}\02, a \02{1}\02, has died of an unknown disease.{2}").format(nick, role, population))
var.LOGGER.logMessage(("{0}, a {1}, has died of an unknown disease.").format(nick, role))
else:
# DYNQUIT_DURING_GAME should not have any effect during the join phase, so only check if we aren't in that
if var.PHASE != "join":
if var.DYNQUIT_DURING_GAME:
lmsg = random.choice(var.QUIT_MESSAGES_NO_REVEAL).format(nick, population)
cli.msg(botconfig.CHANNEL, lmsg)
else:
cli.msg(botconfig.CHANNEL, ("\02{0}\02 has died of an unknown disease.{1}").format(nick, population))
else:
lmsg = random.choice(var.QUIT_MESSAGES_NO_REVEAL).format(nick, population)
cli.msg(botconfig.CHANNEL, lmsg)
var.LOGGER.logMessage(("{0} has died of an unknown disease.").format(nick))
if var.PHASE != "join":
for r, rlist in var.ORIGINAL_ROLES.items():

View File

@ -49,6 +49,8 @@ QUIET_DEAD_PLAYERS = False
# The bot will automatically toggle those modes of people joining
AUTO_TOGGLE_MODES = ""
DYNQUIT_DURING_GAME = False # are dynamic quit messages used while a game is in progress? Note that true will break certain stats scrapers
GOAT_HERDER = True
ABSTAIN_ENABLED = True # whether village can !abstain in order to not vote anyone during day
@ -205,6 +207,14 @@ LYNCH_MESSAGES_NO_REVEAL = ("The villagers, after much debate, finally decide on
"Despite protests, the mob drags their victim to the hanging tree. \u0002{0}\u0002 succumbs to the will of the horde, and is hanged.",
"Resigned to the inevitable, \u0002{0}\u0002 is led to the gallows.",
"Before the rope is pulled, \u0002{0}\u0002 throws a grenade at the mob. The grenade explodes early.")
QUIT_MESSAGES= ("\u0002{0}\u0002, a{1} \u0002{2}\u0002, suddenly falls over dead before the astonished villagers.",
"A pack of wild animals sets upon \u0002{0}\u0002. Soon the \u0002{2}\u0002 is only a pile of bones and a lump in the beasts' stomaches.",
"\u0002{0}\u0002, a{1} \u0002{2}\u0002, fell off the roof of their house and is now dead.",
"\u0002{0}\u0002 is crushed to death by a falling tree. The villagers desperately try to save the \u0002{2}\u0002, but it is too late.")
QUIT_MESSAGES_NO_REVEAL = ("\u0002{0}\u0002 suddenly falls over dead before the astonished villagers.",
"A pack of wild animals sets upon \u0002{0}\u0002. Soon they are only a pile of bones and a lump in the beasts' stomaches.",
"\u0002{0}\u0002 fell off the roof of their house and is now dead.",
"\u0002{0}\u0002 is crushed to death by a falling tree. The villagers desperately try to save them, but it is too late.")
import botconfig, fnmatch