leave & fleave: Don't say role if it's "person"
And other minor improvements.
This commit is contained in:
parent
11b508d40b
commit
ffa7f7c58c
@ -565,36 +565,42 @@ def fjoin(cli, nick, chann_, rest):
|
|||||||
if fake:
|
if fake:
|
||||||
cli.msg(chan, "\u0002{0}\u0002 used fjoin and raised the number of players to \u0002{1}\u0002.".format(nick, len(var.list_players())))
|
cli.msg(chan, "\u0002{0}\u0002 used fjoin and raised the number of players to \u0002{1}\u0002.".format(nick, len(var.list_players())))
|
||||||
|
|
||||||
|
|
||||||
@cmd("fleave", "fquit", admin_only=True)
|
@cmd("fleave", "fquit", admin_only=True)
|
||||||
def fleave(cli, nick, chann_, rest):
|
def fleave(cli, nick, chan, rest):
|
||||||
"""Forces someone to leave the game."""
|
"""Forces someone to leave the game."""
|
||||||
chan = botconfig.CHANNEL
|
|
||||||
|
|
||||||
if var.PHASE == "none":
|
if var.PHASE == "none":
|
||||||
cli.notice(nick, "No game is running.")
|
cli.notice(nick, "No game is currently running.")
|
||||||
for a in re.split(" +",rest):
|
|
||||||
a = a.strip()
|
for a in rest.split():
|
||||||
if not a:
|
if not a:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
pl = var.list_players()
|
pl = var.list_players()
|
||||||
pll = [x.lower() for x in pl]
|
pll = [x.lower() for x in pl]
|
||||||
|
|
||||||
if a.lower() in pll:
|
if a.lower() in pll:
|
||||||
a = pl[pll.index(a.lower())]
|
a = pl[pll.index(a.lower())]
|
||||||
else:
|
else:
|
||||||
cli.msg(chan, nick+": That person is not playing.")
|
cli.notice(nick, "\u0002{0}\u0002 is not currently playing.")
|
||||||
return
|
return
|
||||||
|
|
||||||
message = "\u0002{0}\u0002 is forcing \u0002{1}\u0002 to leave.".format(nick, a)
|
message = "\u0002{0}\u0002 is forcing \u0002{1}\u0002 to leave.".format(nick, a)
|
||||||
if var.ROLE_REVEAL:
|
role = var.get_reveal_role(a)
|
||||||
message += " Say goodbye to the \02{0}\02.".format(var.get_reveal_role(a))
|
|
||||||
|
if var.ROLE_REVEAL and role != "person":
|
||||||
|
message += " Say goodbye to the \u0002{0}\u0002.".format(role)
|
||||||
|
|
||||||
if var.PHASE == "join":
|
if var.PHASE == "join":
|
||||||
message += " New player count: \u0002{0}\u0002".format(len(var.list_players()) - 1)
|
message += " New player count: \u0002{0}\u0002".format(len(var.list_players()) - 1)
|
||||||
|
|
||||||
if var.PHASE in ("day", "night"):
|
if var.PHASE in ("day", "night"):
|
||||||
var.LOGGER.logMessage("{0} is forcing {1} to leave.".format(nick, a))
|
var.LOGGER.logMessage("{0} is forcing {1} to leave.".format(nick, a))
|
||||||
var.LOGGER.logMessage("Say goodbye to the {0}".format(var.get_reveal_role(a)))
|
var.LOGGER.logMessage("Say goodbye to the {0}".format(role)
|
||||||
cli.msg(chan, message)
|
|
||||||
|
|
||||||
del_player(cli, a, death_triggers = False)
|
cli.msg(chan, message)
|
||||||
|
del_player(cli, a, death_triggers=False)
|
||||||
|
|
||||||
|
|
||||||
@cmd("fstart", admin_only=True)
|
@cmd("fstart", admin_only=True)
|
||||||
@ -2166,9 +2172,11 @@ hook("kick")(lambda cli, nick, *rest: leave(cli, "kick", rest[1]))
|
|||||||
@cmd("quit", "leave")
|
@cmd("quit", "leave")
|
||||||
def leave_game(cli, nick, chan, rest):
|
def leave_game(cli, nick, chan, rest):
|
||||||
"""Quits the game."""
|
"""Quits the game."""
|
||||||
|
|
||||||
if var.PHASE == "none":
|
if var.PHASE == "none":
|
||||||
cli.notice(nick, "No game is currently running.")
|
cli.notice(nick, "No game is currently running.")
|
||||||
return
|
return
|
||||||
|
|
||||||
elif var.PHASE == "join":
|
elif var.PHASE == "join":
|
||||||
lpl = len(var.list_players()) - 1
|
lpl = len(var.list_players()) - 1
|
||||||
|
|
||||||
@ -2178,23 +2186,30 @@ def leave_game(cli, nick, chan, rest):
|
|||||||
population = (" New player count: \u0002{0}\u0002").format(lpl)
|
population = (" New player count: \u0002{0}\u0002").format(lpl)
|
||||||
else:
|
else:
|
||||||
population = ""
|
population = ""
|
||||||
|
|
||||||
if nick not in var.list_players() or nick in var.DISCONNECTED.keys(): # not playing
|
if nick not in var.list_players() or nick in var.DISCONNECTED.keys(): # not playing
|
||||||
cli.notice(nick, "You're not currently playing.")
|
cli.notice(nick, "You're not currently playing.")
|
||||||
return
|
return
|
||||||
if 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))
|
role = var.get_reveal_role(nick)
|
||||||
|
|
||||||
|
if var.ROLE_REVEAL and role != "person":
|
||||||
|
cli.msg(botconfig.CHANNEL, ("\u0002{0}\u0002{1} has died of an unknown disease.{2}").format(nick, roletxt, population))
|
||||||
var.LOGGER.logMessage(("{0}, a {1}, has died of an unknown disease.").format(nick, var.get_reveal_role(nick)))
|
var.LOGGER.logMessage(("{0}, a {1}, has died of an unknown disease.").format(nick, var.get_reveal_role(nick)))
|
||||||
else:
|
else:
|
||||||
cli.msg(botconfig.CHANNEL, ("\02{0}\02 has died of an unknown disease.{1}").format(nick, population))
|
cli.msg(botconfig.CHANNEL, ("\u0002{0}\u0002 has died of an unknown disease.{1}").format(nick, population))
|
||||||
var.LOGGER.logMessage(("{0} has died of an unknown disease.").format(nick))
|
var.LOGGER.logMessage(("{0} has died of an unknown disease.").format(nick))
|
||||||
|
|
||||||
if var.PHASE != "join":
|
if var.PHASE != "join":
|
||||||
for r, rlist in var.ORIGINAL_ROLES.items():
|
for r, rlist in var.ORIGINAL_ROLES.items():
|
||||||
if nick in rlist:
|
if nick in rlist:
|
||||||
var.ORIGINAL_ROLES[r].remove(nick)
|
var.ORIGINAL_ROLES[r].remove(nick)
|
||||||
var.ORIGINAL_ROLES[r].append("(dced)"+nick)
|
var.ORIGINAL_ROLES[r].append("(dced)" + nick)
|
||||||
|
|
||||||
make_stasis(nick, var.LEAVE_STASIS_PENALTY)
|
make_stasis(nick, var.LEAVE_STASIS_PENALTY)
|
||||||
|
|
||||||
del_player(cli, nick, death_triggers = False)
|
del_player(cli, nick, death_triggers=False)
|
||||||
|
|
||||||
|
|
||||||
def begin_day(cli):
|
def begin_day(cli):
|
||||||
chan = botconfig.CHANNEL
|
chan = botconfig.CHANNEL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user