fix gstats error when using 8p instead of just 8

This commit is contained in:
jacob1 2014-12-18 17:06:04 -05:00
parent 1a4ad90dd2
commit 61e41a5776

View File

@ -6348,6 +6348,7 @@ def game_stats(cli, nick, chan, rest):
return return
gamemode = var.CURRENT_GAMEMODE gamemode = var.CURRENT_GAMEMODE
gamesize = None
rest = rest.split() rest = rest.split()
# Check for gamemode # Check for gamemode
if len(rest) and not rest[0].isdigit(): if len(rest) and not rest[0].isdigit():
@ -6359,14 +6360,15 @@ def game_stats(cli, nick, chan, rest):
return return
rest.pop(0) rest.pop(0)
# Check for invalid input # Check for invalid input
if len(rest) and rest[0].isdigit() and ( if len(rest) and rest[0].isdigit():
int(rest[0]) > var.GAME_MODES[gamemode][2] or int(rest[0]) < var.GAME_MODES[gamemode][1]): gamesize = int(rest[0])
cli.notice(nick, "Please enter an integer between "+\ if gamesize > var.GAME_MODES[gamemode][2] or gamesize < var.GAME_MODES[gamemode][1]:
"{0} and {1}.".format(var.GAME_MODES[gamemode][1], var.GAME_MODES[gamemode][2])) cli.notice(nick, "Please enter an integer between {0} and "+\
return "{1}.".format(var.GAME_MODES[gamemode][1], var.GAME_MODES[gamemode][2]))
return
# List all games sizes and totals if no size is given # List all games sizes and totals if no size is given
if not len(rest): if not gamesize:
if chan == nick: if chan == nick:
pm(cli, nick, var.get_game_totals(gamemode)) pm(cli, nick, var.get_game_totals(gamemode))
else: else:
@ -6374,9 +6376,9 @@ def game_stats(cli, nick, chan, rest):
else: else:
# Attempt to find game stats for the given game size # Attempt to find game stats for the given game size
if chan == nick: if chan == nick:
pm(cli, nick, var.get_game_stats(gamemode, int(rest[0]))) pm(cli, nick, var.get_game_stats(gamemode, gamesize))
else: else:
cli.msg(chan, var.get_game_stats(gamemode, int(rest[0]))) cli.msg(chan, var.get_game_stats(gamemode, gamesize))
@pmcmd('gamestats', 'gstats') @pmcmd('gamestats', 'gstats')