Browse Source

all bugfixes

master
jcao219 14 years ago
parent
commit
716059f5a2
  1. 5
      var.py
  2. 15
      wolfgame.py

5
var.py

@ -6,7 +6,7 @@ MAX_SHOTS = 2
DRUNK_SHOTS_MULTIPLIER = 3 DRUNK_SHOTS_MULTIPLIER = 3
NIGHT_TIME_LIMIT = 0 NIGHT_TIME_LIMIT = 0
DAY_TIME_LIMIT = 0 DAY_TIME_LIMIT = 0
START_WITH_DAY = True START_WITH_DAY = False
# HIT MISS SUICIDE # HIT MISS SUICIDE
GUN_CHANCES = ( 5/7 , 1/7 , 1/7 ) GUN_CHANCES = ( 5/7 , 1/7 , 1/7 )
@ -112,7 +112,8 @@ class ChangedRolesMode(object):
try: try:
lx[CHANGEABLE_ROLES[role.lower()]] = num lx[CHANGEABLE_ROLES[role.lower()]] = num
except KeyError: except KeyError:
raise InvalidModeException("The role \u0002{0}\u0002 is not valid.") raise InvalidModeException(("The role \u0002{0}\u0002 "+
"is not valid.").format(role))
except ValueError: except ValueError:
raise InvalidModeException("A bad value was used in mode roles.") raise InvalidModeException("A bad value was used in mode roles.")
for k in ROLES_GUIDE.keys(): for k in ROLES_GUIDE.keys():

15
wolfgame.py

@ -116,7 +116,10 @@ def forced_exit(cli, nick, *rest): # Admin Only
@cmd("!exec", admin_only=True) @cmd("!exec", admin_only=True)
def py(cli, nick, chan, rest): def py(cli, nick, chan, rest):
exec(rest) try:
exec(rest)
except Exception as e:
cli.msg(chan, str(type(e))+":"+str(e))
@ -261,7 +264,7 @@ def hurry_up(cli):
found_dup = False found_dup = False
elif len(voters) == maxfound[0]: elif len(voters) == maxfound[0]:
found_dup = True found_dup = True
if max[0] > 0 and not found_dup: if maxfound[0] > 0 and not found_dup:
cli.msg(chan, "The sun sets.") cli.msg(chan, "The sun sets.")
var.VOTES[maxfound[1]] = [None] * votesneeded var.VOTES[maxfound[1]] = [None] * votesneeded
chk_decision(cli) # Induce a lynch chk_decision(cli) # Induce a lynch
@ -966,6 +969,7 @@ def transition_night(cli):
def cgamemode(cli, *args): def cgamemode(cli, *args):
chan = botconfig.CHANNEL
for arg in args: for arg in args:
modeargs = arg.split("=", 1) modeargs = arg.split("=", 1)
modeargs[0] = modeargs[0].strip() modeargs[0] = modeargs[0].strip()
@ -985,7 +989,7 @@ def cgamemode(cli, *args):
cli.msg(botconfig.CHANNEL, "Invalid mode: "+str(e)) cli.msg(botconfig.CHANNEL, "Invalid mode: "+str(e))
return False return False
else: else:
cli.msg(chan, "Mode \u0002{0}\u0002not found.".format(mode)) cli.msg(chan, "Mode \u0002{0}\u0002not found.".format(modeargs[0]))
@cmd("!start") @cmd("!start")
@ -1132,7 +1136,7 @@ def game(cli, nick, chan, rest):
def nay(cli, nick, chan, rest): def nay(cli, nick, chan, rest):
pl = var.list_players() pl = var.list_players()
if var.PHASE != "join" or not var.SETTINGS_CHANGE_REQUESTER: if var.PHASE != "join" or not var.SETTINGS_CHANGE_REQUESTER:
cli.notice("This command is only allowed if there is "+ cli.notice(nick, "This command is only allowed if there is "+
"a game settings change request in effect.") "a game settings change request in effect.")
return return
if nick not in pl: if nick not in pl:
@ -1140,6 +1144,9 @@ def nay(cli, nick, chan, rest):
return return
if var.SETTINGS_CHANGE_REQUESTER in pl: if var.SETTINGS_CHANGE_REQUESTER in pl:
pl.remove(var.SETTINGS_CHANGE_REQUESTER) pl.remove(var.SETTINGS_CHANGE_REQUESTER)
if nick in var.SETTINGS_CHANGE_OPPOSITION:
cli.notice(nick, "You are already in the opposition.")
return
var.SETTINGS_CHANGE_OPPOSITION.append(nick) var.SETTINGS_CHANGE_OPPOSITION.append(nick)
needed = len(pl)//2 + 1 needed = len(pl)//2 + 1
if len(var.SETTINGS_CHANGE_OPPOSITION) >= needed: if len(var.SETTINGS_CHANGE_OPPOSITION) >= needed:

Loading…
Cancel
Save