From e7dad23525f4ae7ce468945321b3b40b8a41dea3 Mon Sep 17 00:00:00 2001 From: Yizhe Shen Date: Mon, 10 Feb 2014 22:48:01 -0500 Subject: [PATCH] Added check for gun/bullets for "myrole" command. Adds additional notification of gun/bullets if the player has them. Minor change in the way messages are sent out for "myrole" command. --- modules/wolfgame.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 1563524..c861bac 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -2804,16 +2804,26 @@ def myrole(cli, nick, chan, rest): if var.PHASE in ("none", "join"): cli.notice(nick, "No game is currently running.") return - - if nick not in var.list_players(): + + ps = var.list_players() + if nick not in ps: cli.notice(nick, "You're currently not playing.") return - - if var.PLAYERS[nick]["cloak"] in var.SIMPLE_NOTIFY: - cli.notice(nick, "You are a \02{0}\02.".format(var.get_role(nick))) - else: - cli.msg(nick, "You are a \02{0}\02.".format(var.get_role(nick))) + pm(cli, nick, "You are a \02{0}\02.".format(var.get_role(nick))) + + # Check for gun/bullets + if nick in ps and nick in var.GUNNERS and var.GUNNERS[nick]: + if var.GUNNERS[nick] == 1: + pm(cli, nick, "You have a \02gun\02 with {0} {1}.".format(var.GUNNERS[nick], "bullet")) + else: + pm(cli, nick, "You have a \02gun\02 with {0} {1}.".format(var.GUNNERS[nick], "bullets")) + elif nick in ps and nick in var.WOLF_GUNNERS and var.WOLF_GUNNERS[nick]: + if var.WOLF_GUNNERS[nick] == 1: + pm(cli, nick, "You have a \02gun\02 with {0} {1}.".format(var.WOLF_GUNNERS[nick], "bullet")) + else: + pm(cli, nick, "You have a \02gun\02 with {0} {1}.".format(var.WOLF_GUNNERS[nick], "bullets")) + @pmcmd("myrole") def myrole_pm(cli, nick, rest): myrole(cli, nick, "", rest)