From c2be01dc9463526abfeec429aea4e580f124ecf4 Mon Sep 17 00:00:00 2001 From: jcao219 Date: Fri, 29 Jun 2012 01:21:42 -0500 Subject: [PATCH] prevent certain debug mode crashes --- modules/common.py | 2 +- modules/wolfgame.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/common.py b/modules/common.py index 3b545e9..5feb359 100644 --- a/modules/common.py +++ b/modules/common.py @@ -111,7 +111,7 @@ def connect_callback(cli): if botconfig.JOIN_AFTER_CLOAKED: prepare_stuff = hook("event_hosthidden", hookid=294)(prepare_stuff) else: - prepare_stuff = hook("event_hosthidden", hookid=294)(prepare_stuff) + prepare_stuff = hook("endofmotd", hookid=294)(prepare_stuff) @hook("mode") def check_if_identified(cli, spam, egg, m, *etc): diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 4e42af5..4c9f1df 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -59,6 +59,7 @@ var.ORIGINAL_SETTINGS = {} var.LAST_SAID_TIME = {} var.GAME_START_TIME = datetime.now() # for idle checker only +var.CAN_START_TIME = 0 var.GRAVEYARD_LOCK = threading.RLock() var.GAME_ID = 0 @@ -280,7 +281,7 @@ def pinger(cli, nick, chan, rest): var.PINGING = False minimum = datetime.now() + timedelta(seconds=var.PING_MIN_WAIT) - if var.CAN_START_TIME < minimum: + if not var.CAN_START_TIME or var.CAN_START_TIME < minimum: var.CAN_START_TIME = minimum decorators.unhook(HOOKS, 800) @@ -1543,7 +1544,7 @@ def shoot(cli, nick, chann_, rest): wolfshooter = nick in var.ROLES["wolf"]+var.ROLES["werecrow"]+var.ROLES["traitor"] - if wolfshooter: + if wolfshooter and nick in var.WOLF_GUNNERS: var.WOLF_GUNNERS[nick] -= 1 else: var.GUNNERS[nick] -= 1