From a2975d485998dd61f7749ef5285afd224729da73 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Sun, 10 Apr 2011 22:48:09 -0600 Subject: [PATCH] Werewolf: Fixed various warnings. --- doc/CHANGELOG | 1 + modules/Werewolf.pm | 34 ++++++++++++++++++---------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index f4e08e7..c5809f9 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Werewolf: Fixed various warnings. * Werewolf: Handful of bugs fixed, timeouts rewritten, wolf assignment rewritten. (see ROLES:Werewolf) * Werewolf: Fixed an annoyance in VOTES. diff --git a/modules/Werewolf.pm b/modules/Werewolf.pm index c3246f4..91fcbe2 100644 --- a/modules/Werewolf.pm +++ b/modules/Werewolf.pm @@ -1228,22 +1228,24 @@ sub _getrole { my ($plyr, $lev) = @_; my $role; - if ($lev == 1) { - if ($PLAYERS{$plyr} =~ m/w/xsm) { $role = 'wolf' } - elsif ($PLAYERS{$plyr} =~ m/s/xsm) { $role = 'seer' } - elsif ($PLAYERS{$plyr} =~ m/h/xsm) { $role = 'harlot' } - elsif ($PLAYERS{$plyr} =~ m/g/xsm) { $role = 'guardian angel' } - elsif ($PLAYERS{$plyr} =~ m/d/xsm) { $role = 'detective' } - elsif ($PLAYERS{$plyr} =~ m/(v|t)/xsm) { $role = 'villager' } - } - elsif ($lev == 2) { - if ($PLAYERS{$plyr} =~ m/w/xsm) { $role = 'wolf' } - elsif ($PLAYERS{$plyr} =~ m/s/xsm) { $role = 'seer' } - elsif ($PLAYERS{$plyr} =~ m/h/xsm) { $role = 'harlot' } - elsif ($PLAYERS{$plyr} =~ m/g/xsm) { $role = 'guardian angel' } - elsif ($PLAYERS{$plyr} =~ m/d/xsm) { $role = 'detective' } - elsif ($PLAYERS{$plyr} =~ m/t/xsm) { $role = 'traitor' } - elsif ($PLAYERS{$plyr} =~ m/v/xsm) { $role = 'villager' } + if (exists $PLAYERS{$plyr}) { + if ($lev == 1) { + if ($PLAYERS{$plyr} =~ m/w/xsm) { $role = 'wolf' } + elsif ($PLAYERS{$plyr} =~ m/s/xsm) { $role = 'seer' } + elsif ($PLAYERS{$plyr} =~ m/h/xsm) { $role = 'harlot' } + elsif ($PLAYERS{$plyr} =~ m/g/xsm) { $role = 'guardian angel' } + elsif ($PLAYERS{$plyr} =~ m/d/xsm) { $role = 'detective' } + elsif ($PLAYERS{$plyr} =~ m/(v|t)/xsm) { $role = 'villager' } + } + elsif ($lev == 2) { + if ($PLAYERS{$plyr} =~ m/w/xsm) { $role = 'wolf' } + elsif ($PLAYERS{$plyr} =~ m/s/xsm) { $role = 'seer' } + elsif ($PLAYERS{$plyr} =~ m/h/xsm) { $role = 'harlot' } + elsif ($PLAYERS{$plyr} =~ m/g/xsm) { $role = 'guardian angel' } + elsif ($PLAYERS{$plyr} =~ m/d/xsm) { $role = 'detective' } + elsif ($PLAYERS{$plyr} =~ m/t/xsm) { $role = 'traitor' } + elsif ($PLAYERS{$plyr} =~ m/v/xsm) { $role = 'villager' } + } } if (!$role) { $role = 'person' }