From cdf96cfc2b31be1a34f5b66a68b00e1c0d011666 Mon Sep 17 00:00:00 2001 From: "Vgr E.Barry" Date: Wed, 6 Aug 2014 13:42:33 -0400 Subject: [PATCH 1/5] Added !fgoat command for admins. Allows unlimited amount of goats. --- modules/wolfgame.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 03efe19..d3537e5 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -1235,7 +1235,10 @@ def goat(cli, nick, chan, rest): victim)) var.GOATED = True - +@cmd("fgoat", admin_only=True) +def fgoat(cli, nick, chan, rest): + var.GOATED = False + goat(cli, nick, chan, rest) @hook("nick") def on_nick(cli, prefix, nick): From 5700ec7d01eb648fd2b0090a217b2db44d56eab7 Mon Sep 17 00:00:00 2001 From: Yizhe Shen Date: Fri, 8 Aug 2014 00:25:58 -0400 Subject: [PATCH 2/5] Updated output behaviour for in-game commands available in PM. - Updated behaviour for listroles(), show_votes(), timeleft() - Uses !simple settings when those commands are given in PM - Uses notice if channel is +z and a game is in progress --- modules/wolfgame.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 03efe19..5bffca2 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -796,10 +796,12 @@ def show_votes(cli, nick, chan, rest): for votee in var.VOTES.keys()] msg = '{}: {}'.format(nick, ', '.join(votelist)) - if chan == nick or nick in pl: - cli.msg(chan, msg) - else: + if chan == nick: + pm(cli, nick, msg) + elif nick not in pl and var.PHASE not in ("none", "join"): cli.notice(nick, msg) + else: + cli.msg(chan, msg) pl = var.list_players() avail = len(pl) - len(var.WOUNDED) @@ -808,10 +810,12 @@ def show_votes(cli, nick, chan, rest): 'required to lynch, \u0002{}\u0002 players available to ' 'vote.').format(nick, len(pl), votesneeded, avail) - if chan == nick or nick in pl: - cli.msg(chan, the_message) - else: + if chan == nick: + pm(cli, nick, the_message) + elif nick not in pl and var.PHASE not in ("none", "join"): cli.notice(nick, the_message) + else: + cli.msg(chan, the_message) @pmcmd('votes') @@ -3020,6 +3024,8 @@ def timeleft(cli, nick, chan, rest): if nick == chan: pm(cli, nick, msg) + elif nick not in var.list_players() and var.PHASE not in ("none", "join"): + cli.notice(nick, msg) else: cli.msg(chan, msg) @@ -3055,6 +3061,8 @@ def listroles(cli, nick, chan, rest): old = v if chan == nick: pm(cli, nick, txt) + elif nick not in var.list_players() and var.PHASE not in ("none", "join"): + cli.notice(nick, txt) else: cli.msg(chan, txt) From df48af8a9d7b880a5a76525863d30e830e8a5534 Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Mon, 11 Aug 2014 00:06:39 +0200 Subject: [PATCH 3/5] Improve !fgoat --- modules/wolfgame.py | 61 +++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index ad3df76..30c52bc 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -1197,52 +1197,71 @@ def on_join(cli, raw_nick, chan, acc="*", rname=""): if nick == "ChanServ" and not var.OPPED: cli.msg("ChanServ", "op " + chan) -@cmd("goat") + +@cmd('goat') def goat(cli, nick, chan, rest): - """Use a goat to interact with anyone in the channel during the day""" - if var.PHASE in ("none", "join"): - cli.notice(nick, "No game is currently running.") + """Use a goat to interact with anyone in the channel during the day.""" + + if var.PHASE in ('none', 'join'): + cli.notice(nick, 'No game is currently running.') return elif nick not in var.list_players() or nick in var.DISCONNECTED.keys(): - cli.notice(nick, "You're not currently playing.") + cli.notice(nick, 'You\'re not currently playing.') return - if var.PHASE != "day": - cli.notice(nick, "You can only do that in the day.") + + if var.PHASE != 'day': + cli.notice(nick, 'You can only do that in the day.') return - if var.GOATED and nick not in var.SPECIAL_ROLES["goat herder"]: - cli.notice(nick, "This can only be done once per day.") + + if var.GOATED and nick not in var.SPECIAL_ROLES['goat herder']: + cli.notice(nick, 'This can only be done once per day.') return + ul = list(var.USERS.keys()) ull = [x.lower() for x in ul] - rest = re.split(" +",rest)[0].strip().lower() + rest = re.split(' +', rest)[0].strip().lower() + if not rest: - cli.notice(nick, "Not enough parameters.") + cli.notice(nick, 'Not enough parameters.') return + matches = 0 + for player in ull: if rest == player: victim = player break + if player.startswith(rest): victim = player matches += 1 else: if matches != 1: - pm(cli, nick,"\u0002{0}\u0002 is not in this channel.".format(rest)) + pm(cli, nick, '\x02{}\x02 is not in this channel.'.format(rest)) return + victim = ul[ull.index(victim)] - goatact = random.choice(["kicks", "headbutts"]) - cli.msg(botconfig.CHANNEL, ("\u0002{0}\u0002's goat walks by "+ - "and {1} \u0002{2}\u0002.").format(nick, - goatact, victim)) - var.LOGGER.logMessage("{0}'s goat walks by and {1} {2}.".format(nick, goatact, - victim)) + goatact = random.choice(('kicks', 'headbutts')) + + cli.msg(chan, '\x02{}\x02\'s goat walks by and {} \x02{}\x02.'.format( + nick, goatact, victim)) + + var.LOGGER.logMessage('{}\'s goat walks by and {} {}.'.format( + nick, goatact, victim)) + var.GOATED = True + -@cmd("fgoat", admin_only=True) +@cmd('fgoat', admin_only=True) def fgoat(cli, nick, chan, rest): - var.GOATED = False - goat(cli, nick, chan, rest) + goatact = random.choice(['kicks', 'headbutts']) + + cli.msg(chan, '\x02{}\x02\'s goat walks by and {} \x02{}\x02.'format( + nick, goatact, rest)) + + var.LOGGER.logMessage('{}\'s goat walks by and {} {}.'.format( + nick, goatact, rest)) + @hook("nick") def on_nick(cli, prefix, nick): From 11e411a052455db567f79efe6afe1a9878852e35 Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Mon, 11 Aug 2014 00:07:33 +0200 Subject: [PATCH 4/5] Fix previous commit --- modules/wolfgame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 30c52bc..5c26c14 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -1256,7 +1256,7 @@ def goat(cli, nick, chan, rest): def fgoat(cli, nick, chan, rest): goatact = random.choice(['kicks', 'headbutts']) - cli.msg(chan, '\x02{}\x02\'s goat walks by and {} \x02{}\x02.'format( + cli.msg(chan, '\x02{}\x02\'s goat walks by and {} \x02{}\x02'.format( nick, goatact, rest)) var.LOGGER.logMessage('{}\'s goat walks by and {} {}.'.format( From 9216ef0c45ca665505ad5c94a28fdbfe1e3aa83b Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Mon, 11 Aug 2014 00:08:08 +0200 Subject: [PATCH 5/5] Add missing dot --- modules/wolfgame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 5c26c14..2a6f654 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -1256,7 +1256,7 @@ def goat(cli, nick, chan, rest): def fgoat(cli, nick, chan, rest): goatact = random.choice(['kicks', 'headbutts']) - cli.msg(chan, '\x02{}\x02\'s goat walks by and {} \x02{}\x02'.format( + cli.msg(chan, '\x02{}\x02\'s goat walks by and {} \x02{}\x02.'.format( nick, goatact, rest)) var.LOGGER.logMessage('{}\'s goat walks by and {} {}.'.format(