|
|
@ -2,7 +2,8 @@ from oyoyo.parse import parse_nick |
|
|
|
import vars |
|
|
|
import vars |
|
|
|
import botconfig |
|
|
|
import botconfig |
|
|
|
import decorators |
|
|
|
import decorators |
|
|
|
import time |
|
|
|
from datetime import datetime, timedelta |
|
|
|
|
|
|
|
import threading |
|
|
|
import random |
|
|
|
import random |
|
|
|
|
|
|
|
|
|
|
|
COMMANDS = {} |
|
|
|
COMMANDS = {} |
|
|
@ -33,28 +34,29 @@ def say(cli, nick, rest): # To be removed later |
|
|
|
@pmcmd("!bye", admin_only=True) |
|
|
|
@pmcmd("!bye", admin_only=True) |
|
|
|
@cmd("!bye", admin_only=True) |
|
|
|
@cmd("!bye", admin_only=True) |
|
|
|
def forced_exit(cli, nick, *rest): # Admin Only |
|
|
|
def forced_exit(cli, nick, *rest): # Admin Only |
|
|
|
reset_game(cli, nick, rest[0], None) |
|
|
|
reset_game(cli, nick, botconfig.CHANNEL, None) |
|
|
|
cli.quit("Forced quit from admin") |
|
|
|
cli.quit("Forced quit from admin") |
|
|
|
raise SystemExit |
|
|
|
raise SystemExit |
|
|
|
|
|
|
|
|
|
|
|
@cmd("!exec") |
|
|
|
@cmd("!exec", admin_only=True) |
|
|
|
def py(cli, nick, chan, rest): |
|
|
|
def py(cli, nick, chan, rest): |
|
|
|
if nick in botconfig.ADMINS: |
|
|
|
exec(rest) |
|
|
|
exec(rest) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cmd("!ping") |
|
|
|
@cmd("!ping") |
|
|
|
def pinger(cli, nick, chan, rest): |
|
|
|
def pinger(cli, nick, chan, rest): |
|
|
|
if vars.LAST_PING + 300 > time.time(): |
|
|
|
if (vars.LAST_PING and |
|
|
|
cli.notice(nick, "This command is ratelimited. \ |
|
|
|
vars.LAST_PING + timedelta(seconds=300) > datetime.now()): |
|
|
|
Please wait a while before using it again.") |
|
|
|
cli.notice(nick, ("This command is ratelimited. " + |
|
|
|
|
|
|
|
"Please wait a while before using it again.")) |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
vars.LAST_PING = time.time() |
|
|
|
vars.LAST_PING = datetime.now() |
|
|
|
vars.PINGING = True |
|
|
|
vars.PINGING = True |
|
|
|
TO_PING = [] |
|
|
|
TO_PING = [] |
|
|
|
|
|
|
|
|
|
|
|
@hook("whoreply") |
|
|
|
@hook("whoreply") |
|
|
|
def on_whoreply(server, dunno, chan, dunno1, dunno2, dunno3, user, status, dunno4): |
|
|
|
def on_whoreply(server, dunno, chan, dunno1, |
|
|
|
|
|
|
|
dunno2, dunno3, user, status, dunno4): |
|
|
|
if not vars.PINGING: return |
|
|
|
if not vars.PINGING: return |
|
|
|
if user in (botconfig.NICK, nick): return # Don't ping self. |
|
|
|
if user in (botconfig.NICK, nick): return # Don't ping self. |
|
|
|
|
|
|
|
|
|
|
@ -81,7 +83,7 @@ def join(cli, nick, chan, rest): |
|
|
|
cli.mode(chan, "+v", nick, nick+"!*@*") |
|
|
|
cli.mode(chan, "+v", nick, nick+"!*@*") |
|
|
|
vars.ROLES["person"].append(nick) |
|
|
|
vars.ROLES["person"].append(nick) |
|
|
|
vars.PHASE = "join" |
|
|
|
vars.PHASE = "join" |
|
|
|
vars.CAN_START_TIME = time.time() + vars.MINIMUM_WAIT |
|
|
|
vars.CAN_START_TIME = datetime.now() + timedelta(seconds=vars.MINIMUM_WAIT) |
|
|
|
cli.msg(chan, '\u0002{0}\u0002 has started a game of Werewolf. \ |
|
|
|
cli.msg(chan, '\u0002{0}\u0002 has started a game of Werewolf. \ |
|
|
|
Type "!join" to join. Type "!start" to start the game. \ |
|
|
|
Type "!join" to join. Type "!start" to start the game. \ |
|
|
|
Type "!wait" to increase join wait time.'.format(nick)) |
|
|
|
Type "!wait" to increase join wait time.'.format(nick)) |
|
|
@ -117,14 +119,206 @@ def stats(cli, nick, chan, rest): |
|
|
|
message.append("\u0002(0}\u0002 {1}".format(count, vars.plural(role))) |
|
|
|
message.append("\u0002(0}\u0002 {1}".format(count, vars.plural(role))) |
|
|
|
else: |
|
|
|
else: |
|
|
|
message.append("\u0002{0}\u0002 {1}".format(count, role)) |
|
|
|
message.append("\u0002{0}\u0002 {1}".format(count, role)) |
|
|
|
|
|
|
|
if len(vars.ROLES["wolf"]) > 1: |
|
|
|
|
|
|
|
vb = "are" |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
vb = "is" |
|
|
|
cli.msg(chan, |
|
|
|
cli.msg(chan, |
|
|
|
"{0}: There are {1}, and {2}.".format(nick, |
|
|
|
"{0}: There {verb} {1}, and {2}.".format(nick, |
|
|
|
", ".join(message[0:-1]), |
|
|
|
", ".join(message[0:-1]), |
|
|
|
message[-1])) |
|
|
|
message[-1]), verb=vb) |
|
|
|
|
|
|
|
|
|
|
|
def transition_night(cli, chan): |
|
|
|
def del_player(cli, nick, died_in_game = True): |
|
|
|
vars.PHASE = "night" |
|
|
|
cli.mode(botconfig.CHANNEL, "-v", "{0} {0}!*@*".format(nick)) |
|
|
|
|
|
|
|
if vars.PHASE != "join" and died_in_game: |
|
|
|
|
|
|
|
cli.mode(botconfig.CHANNEL, "+q", "{0} {0}!*@*".format(nick)) |
|
|
|
|
|
|
|
vars.DEAD.append(nick) |
|
|
|
|
|
|
|
vars.del_player(nick) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def leave(cli, what, nick): |
|
|
|
|
|
|
|
if nick not in vars.list_players(): # not playing |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
msg = "" |
|
|
|
|
|
|
|
if what in ("!quit", "!leave"): |
|
|
|
|
|
|
|
msg = ("\u0002{0}\u0002 died of an unknown disease. "+ |
|
|
|
|
|
|
|
"S/He was a \u0002{1}\u0002.") |
|
|
|
|
|
|
|
died_in_game = True |
|
|
|
|
|
|
|
elif what == "part": |
|
|
|
|
|
|
|
msg = ("\u0002{0}\u0002 died due to eating poisonous berries. "+ |
|
|
|
|
|
|
|
"Appears (s)he was a \u0002{1}\u0002.") |
|
|
|
|
|
|
|
elif what == "quit": |
|
|
|
|
|
|
|
msg = ("\u0002{0}\u0002 died due to a fatal attack by wild animals. "+ |
|
|
|
|
|
|
|
"Appears (s)he was a \u0002{1}\u0002.") |
|
|
|
|
|
|
|
elif what == "kick": |
|
|
|
|
|
|
|
msg = ("\u0002{0}\u0002 died due to falling off a cliff. "+ |
|
|
|
|
|
|
|
"Appears (s)he was a \u0002{1}\u0002.") |
|
|
|
|
|
|
|
msg = msg.format(nick, vars.get_role(nick)) |
|
|
|
|
|
|
|
cli.msg(botconfig.CHANNEL, msg) |
|
|
|
|
|
|
|
del_player(cli, nick, died_in_game) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd("!leave")(lambda cli, nick, chan, *rest: leave(cli, "!leave", nick)) |
|
|
|
|
|
|
|
cmd("!quit")(lambda cli, nick, chan, *rest: leave(cli, "!quit", nick)) |
|
|
|
|
|
|
|
hook("part")(lambda cli, nick, chan, *rest: leave(cli, "part", nick)) |
|
|
|
|
|
|
|
hook("quit")(lambda cli, nick, chan, *rest: leave(cli, "quit", nick)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def transition_day(cli): |
|
|
|
|
|
|
|
chan = botconfig.CHANNEL |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vars.PHASE = "day" |
|
|
|
|
|
|
|
vars.DAY_START_TIME = datetime.now() |
|
|
|
|
|
|
|
td = vars.DAY_START_TIME - vars.NIGHT_START_TIME |
|
|
|
|
|
|
|
vars.NIGHT_TIMEDELTA += td |
|
|
|
|
|
|
|
min, sec = td.seconds // 60, td.seconds % 60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message = "Night lasted \u0002{0:0>2}:{1:0>2}\u0002. It is now daytime. \ |
|
|
|
|
|
|
|
The villagers awake, thankful for surviving the night, \ |
|
|
|
|
|
|
|
and search the village... ".format(min, sec) |
|
|
|
|
|
|
|
if not vars.VICTIM: |
|
|
|
|
|
|
|
message += random.choice(vars.NO_VICTIMS_MESSAGES) |
|
|
|
|
|
|
|
cli.msg(chan, message); |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
# TODO: check if visited is harlot |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dead = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message += "The dead body of \u0002{0}\u0002, a \ |
|
|
|
|
|
|
|
\u0002{1}\u0002, is found. Those remaining mourn his/her \ |
|
|
|
|
|
|
|
death.".format(vars.VICTIM, vars.get_role(vars.VICTIM)) |
|
|
|
|
|
|
|
dead.append(vars.VICTIM) |
|
|
|
|
|
|
|
# TODO: check if harlot also died |
|
|
|
|
|
|
|
cli.msg(chan, message) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for deadperson in dead: |
|
|
|
|
|
|
|
del_player(cli, deadperson, True) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def chk_nightdone(cli): |
|
|
|
|
|
|
|
if (len(vars.SEEN) == len(vars.ROLES["seer"]) and |
|
|
|
|
|
|
|
vars.VICTIM and vars.PHASE == "night"): |
|
|
|
|
|
|
|
if vars.TIMERS[0]: |
|
|
|
|
|
|
|
vars.TIMERS[0].cancel() # cancel timer |
|
|
|
|
|
|
|
vars.TIMERS[0] = None |
|
|
|
|
|
|
|
transition_day(cli) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pmcmd("!kill") |
|
|
|
|
|
|
|
@pmcmd("kill") |
|
|
|
|
|
|
|
def kill(cli, nick, rest): |
|
|
|
|
|
|
|
if vars.PHASE == "none": |
|
|
|
|
|
|
|
cli.msg(nick, "No game is currently running.") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if not nick in vars.list_players(): |
|
|
|
|
|
|
|
cli.msg(nick, "You're currently playing") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if not (vars.is_role(nick, "wolf") or vars.is_role(nick, "traitor")): |
|
|
|
|
|
|
|
cli.msg(nick, "Only a wolf may use this command") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if vars.PHASE != "night": |
|
|
|
|
|
|
|
cli.msg(nick, "You may only kill people at night.") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
victim = rest.split(" ")[0].strip() |
|
|
|
|
|
|
|
if not victim: |
|
|
|
|
|
|
|
cli.msg(nick, "Not enough parameters") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if victim not in vars.list_players(): |
|
|
|
|
|
|
|
cli.msg(nick,"\u0002{0}\u0002 is currently not playing.".format(victim)) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if victim == nick: |
|
|
|
|
|
|
|
cli.msg(nick, "Suicide is bad. Don't do it.") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if victim in vars.ROLES["wolf"]: |
|
|
|
|
|
|
|
cli.msg(nick, "You may only kill villagers, not other wolves") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
vars.VICTIM = victim |
|
|
|
|
|
|
|
cli.msg(nick, "You have selected \u0002{0}\u0002 to be killed".format(victim)) |
|
|
|
|
|
|
|
chk_nightdone(cli) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pmcmd("see") |
|
|
|
|
|
|
|
@pmcmd("!see") |
|
|
|
|
|
|
|
def see(cli, nick, rest): |
|
|
|
|
|
|
|
if vars.PHASE == "none": |
|
|
|
|
|
|
|
cli.msg(nick, "No game is currently running.") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if not nick in vars.list_players(): |
|
|
|
|
|
|
|
cli.msg(nick, "You're currently playing") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if not vars.is_role(nick, "seer"): |
|
|
|
|
|
|
|
cli.msg(nick, "Only a seer may use this command") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if vars.PHASE != "night": |
|
|
|
|
|
|
|
cli.msg(nick, "You may have visions at night.") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if nick in vars.SEEN: |
|
|
|
|
|
|
|
cli.msg(nick, "You may only have one vision per round.") |
|
|
|
|
|
|
|
victim = rest.split(" ")[0].strip() |
|
|
|
|
|
|
|
if not victim: |
|
|
|
|
|
|
|
cli.msg(nick, "Not enough parameters") |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if victim not in vars.list_players(): |
|
|
|
|
|
|
|
cli.msg(nick,"\u0002{0}\u0002 is \ |
|
|
|
|
|
|
|
currently not playing.".format(victim)) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
if vars.CURSED == nick: |
|
|
|
|
|
|
|
role = "wolf" |
|
|
|
|
|
|
|
elif vars.TRAITOR == nick: |
|
|
|
|
|
|
|
role = "villager" |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
role = vars.get_role(victim) |
|
|
|
|
|
|
|
cli.msg(nick, "You have a vision; in this vision, \ |
|
|
|
|
|
|
|
you see that \u0002{0}\u0002 is a \u0002{1}\u0002!".format(victim, |
|
|
|
|
|
|
|
role)) |
|
|
|
|
|
|
|
vars.SEEN.append(nick) |
|
|
|
|
|
|
|
chk_nightdone(cli) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pmcmd("") |
|
|
|
|
|
|
|
def relay(cli, nick, rest): |
|
|
|
|
|
|
|
badguys = vars.ROLES.get("wolf", []) + vars.ROLES.get("traitor", []) |
|
|
|
|
|
|
|
if len(badguys) > 1: |
|
|
|
|
|
|
|
if vars.is_role(nick, "wolf") or vars.is_role(nick, "traitor"): |
|
|
|
|
|
|
|
badguys.remove(nick) # remove self from list |
|
|
|
|
|
|
|
for badguy in badguys: |
|
|
|
|
|
|
|
cli.msg(badguy, "{0} says: {1}".format(nick, rest)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def transition_night(cli): |
|
|
|
|
|
|
|
vars.PHASE = "night" |
|
|
|
|
|
|
|
vars.VICTIM = "" # nickname of cursed villager |
|
|
|
|
|
|
|
vars.SEEN = [] # list of seers that have had visions |
|
|
|
|
|
|
|
vars.NIGHT_START_TIME = datetime.now() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chan = botconfig.CHANNEL |
|
|
|
|
|
|
|
cli.msg(chan, "It is now nighttime. All players \ |
|
|
|
|
|
|
|
check for PMs from me for instructions. If you did not receive \ |
|
|
|
|
|
|
|
one, simply sit back, relax, and wait patiently for morning.") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t = threading.Timer(vars.NIGHT_TIME_LIMIT, transition_day, [cli]) |
|
|
|
|
|
|
|
vars.TIMERS[0] = t |
|
|
|
|
|
|
|
t.start() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# send PMs |
|
|
|
|
|
|
|
pl = vars.list_players() |
|
|
|
|
|
|
|
for wolf in vars.ROLES["wolf"]: |
|
|
|
|
|
|
|
cli.msg(wolf, 'You are a \u0002wolf\u0002. It is your job to kill all the \ |
|
|
|
|
|
|
|
villagers. Use "kill <nick>" to kill a villager. Also, if \ |
|
|
|
|
|
|
|
you send a PM to me, it will be relayed to all other wolves.') |
|
|
|
|
|
|
|
_pl = pl[:] |
|
|
|
|
|
|
|
_pl.remove(wolf) # remove self from list |
|
|
|
|
|
|
|
for i, player in enumerate(_pl): |
|
|
|
|
|
|
|
if vars.is_role(player, "wolf"): |
|
|
|
|
|
|
|
_pl[i] = player + " (wolf)" |
|
|
|
|
|
|
|
elif vars.is_role(player, "traitor"): |
|
|
|
|
|
|
|
_pl[i] = player + " (traitor)" |
|
|
|
|
|
|
|
cli.msg(wolf, "Players: "+", ".join(_pl)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for seer in vars.ROLES["seer"]: |
|
|
|
|
|
|
|
_pl = pl[:] |
|
|
|
|
|
|
|
_pl.remove(seer) # remove self from list |
|
|
|
|
|
|
|
cli.msg(seer, 'You are a \u0002seer\u0002. \ |
|
|
|
|
|
|
|
It is your job to detect the wolves, you may have a vision once per night. \ |
|
|
|
|
|
|
|
Use "see <nick>" to see the role of a player.') |
|
|
|
|
|
|
|
cli.msg(seer, "Players: "+", ".join(_pl)) |
|
|
|
|
|
|
|
|
|
|
|
@cmd("!start") |
|
|
|
@cmd("!start") |
|
|
|
def start(cli, nick, chan, rest): |
|
|
|
def start(cli, nick, chan, rest): |
|
|
|
pl = vars.list_players() |
|
|
|
pl = vars.list_players() |
|
|
@ -137,10 +331,10 @@ def start(cli, nick, chan, rest): |
|
|
|
if nick not in pl: |
|
|
|
if nick not in pl: |
|
|
|
cli.notice(nick, "You're currently not playing.") |
|
|
|
cli.notice(nick, "You're currently not playing.") |
|
|
|
return |
|
|
|
return |
|
|
|
now = time.time() |
|
|
|
now = datetime.now() |
|
|
|
if vars.CAN_START_TIME > now: |
|
|
|
dur = int((vars.CAN_START_TIME - now).total_seconds()) |
|
|
|
cli.msg(chan, "Please wait at least {0} more seconds.".format( |
|
|
|
if dur > 0: |
|
|
|
int(vars.CAN_START_TIME - now))) |
|
|
|
cli.msg(chan, "Please wait at least {0} more seconds.".format(dur)) |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
if len(pl) < 4: |
|
|
|
if len(pl) < 4: |
|
|
@ -153,6 +347,7 @@ def start(cli, nick, chan, rest): |
|
|
|
nwolves = 0 |
|
|
|
nwolves = 0 |
|
|
|
ndrunk = 0 |
|
|
|
ndrunk = 0 |
|
|
|
ncursed = 0 |
|
|
|
ncursed = 0 |
|
|
|
|
|
|
|
ntraitor = 0 |
|
|
|
|
|
|
|
|
|
|
|
if len(pl) >= 8: |
|
|
|
if len(pl) >= 8: |
|
|
|
nharlots = 1 |
|
|
|
nharlots = 1 |
|
|
@ -189,17 +384,24 @@ def start(cli, nick, chan, rest): |
|
|
|
vars.ROLES["villager"] = pl |
|
|
|
vars.ROLES["villager"] = pl |
|
|
|
|
|
|
|
|
|
|
|
if ncursed: |
|
|
|
if ncursed: |
|
|
|
CURSED = random.choice(var.ROLES["villager"] + \ |
|
|
|
vars.CURSED = random.choice(vars.ROLES["villager"] + \ |
|
|
|
var.ROLES.get("harlot", []) +\ |
|
|
|
vars.ROLES.get("harlot", []) +\ |
|
|
|
var.ROLES.get("village drunk", [])) |
|
|
|
vars.ROLES.get("village drunk", [])) |
|
|
|
|
|
|
|
if ntraitor: |
|
|
|
|
|
|
|
possible = vars.ROLES["villager"] |
|
|
|
|
|
|
|
if ncursed: |
|
|
|
|
|
|
|
possible.remove(vars.CURSED) # Cursed traitors are not allowed |
|
|
|
|
|
|
|
vars.TRAITOR = random.choice(possible) |
|
|
|
|
|
|
|
|
|
|
|
cli.msg(chan, "{0}: Welcome to Werewolf, the popular detective/social \ |
|
|
|
cli.msg(chan, "{0}: Welcome to Werewolf, the popular detective/social \ |
|
|
|
party game (a theme of Mafia).".format(", ".join(vars.list_players()))) |
|
|
|
party game (a theme of Mafia).".format(", ".join(vars.list_players()))) |
|
|
|
cli.mode(chan, "+m") |
|
|
|
cli.mode(chan, "+m") |
|
|
|
|
|
|
|
|
|
|
|
vars.GAME_START_TIME = time.time() |
|
|
|
|
|
|
|
vars.ORIGINAL_ROLES = dict(vars.ROLES) # Make a copy |
|
|
|
vars.ORIGINAL_ROLES = dict(vars.ROLES) # Make a copy |
|
|
|
transition_night(cli, chan) |
|
|
|
vars.DAY_TIMEDELTA = timedelta(0) |
|
|
|
|
|
|
|
vars.NIGHT_TIMEDELTA = timedelta(0) |
|
|
|
|
|
|
|
vars.DEAD = [] |
|
|
|
|
|
|
|
transition_night(cli) |
|
|
|
|
|
|
|
|
|
|
|
@cmd("!wait") |
|
|
|
@cmd("!wait") |
|
|
|
def wait(cli, nick, chan, rest): |
|
|
|
def wait(cli, nick, chan, rest): |
|
|
@ -217,11 +419,11 @@ def wait(cli, nick, chan, rest): |
|
|
|
cli.msg(chan, "Limit has already been reached for extending the wait time.") |
|
|
|
cli.msg(chan, "Limit has already been reached for extending the wait time.") |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
now = time.time() |
|
|
|
now = datetime.now() |
|
|
|
if now > vars.CAN_START_TIME: |
|
|
|
if now > vars.CAN_START_TIME: |
|
|
|
vars.CAN_START_TIME = now + vars.EXTRA_WAIT |
|
|
|
vars.CAN_START_TIME = now + timedelta(seconds=vars.EXTRA_WAIT) |
|
|
|
else: |
|
|
|
else: |
|
|
|
vars.CAN_START_TIME += vars.EXTRA_WAIT |
|
|
|
vars.CAN_START_TIME += timedelta(seconds=vars.EXTRA_WAIT) |
|
|
|
vars.WAITED += 1 |
|
|
|
vars.WAITED += 1 |
|
|
|
cli.msg(chan, "{0} increased the wait \ |
|
|
|
cli.msg(chan, "{0} increased the wait \ |
|
|
|
time by {1} seconds.".format(nick, vars.EXTRA_WAIT)) |
|
|
|
time by {1} seconds.".format(nick, vars.EXTRA_WAIT)) |
|
|
@ -229,15 +431,21 @@ time by {1} seconds.".format(nick, vars.EXTRA_WAIT)) |
|
|
|
@cmd("!reset", admin_only = True) |
|
|
|
@cmd("!reset", admin_only = True) |
|
|
|
def reset_game(cli, nick, chan, rest): |
|
|
|
def reset_game(cli, nick, chan, rest): |
|
|
|
vars.PHASE = "none" |
|
|
|
vars.PHASE = "none" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if vars.TIMERS[0]: |
|
|
|
|
|
|
|
vars.TIMERS[0].cancel() |
|
|
|
|
|
|
|
vars.TIMERS[0] = None |
|
|
|
cli.mode(chan, "-m") |
|
|
|
cli.mode(chan, "-m") |
|
|
|
for pl in vars.list_players(): |
|
|
|
for plr in vars.list_players(): |
|
|
|
cli.mode(chan, "-v", pl) |
|
|
|
cli.mode(chan, "-v", "{0} {0}!*@*".format(plr)) |
|
|
|
|
|
|
|
for deadguy in vars.DEAD: |
|
|
|
|
|
|
|
cli.mode(chan, "-q", "{0} {0}!*@*".format(deadguy)) |
|
|
|
|
|
|
|
|
|
|
|
vars.ROLES = {"person" : []} |
|
|
|
vars.ROLES = {"person" : []} |
|
|
|
vars.ORIGINAL_ROLES = None |
|
|
|
vars.ORIGINAL_ROLES = None |
|
|
|
vars.CURSED = "" |
|
|
|
vars.CURSED = "" |
|
|
|
vars.GAME_START_TIME = 0 |
|
|
|
vars.CAN_START_TIME = timedelta(0) |
|
|
|
vars.CAN_START_TIME = 0 |
|
|
|
|
|
|
|
vars.GUNNERS = {} |
|
|
|
vars.GUNNERS = {} |
|
|
|
vars.WAITED = 0 |
|
|
|
vars.WAITED = 0 |
|
|
|
|
|
|
|
vars.VICTIM = "" |
|
|
|
|
|
|
|
|