From 05e49c0ba19da7963c66efa3c5ffcce6be4407f4 Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Sun, 20 Mar 2011 17:07:52 -0600 Subject: [PATCH] Added optional uno:english option. See documentation for UNO. --- NEWS | 1 + doc/CHANGELOG | 1 + modules/UNO.pm | 24 ++++++++++++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 10ae04c..2e44ccf 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ In this alpha8 release, we have added: * EightBall rewritten to be much nicer. * A module to translate English into LOLCAT (LOLCAT). * Command aliasing via aliases blocks in the config. +* Added optional uno:english and required uno:msg options. See documentation for UNO. Bug fixes: diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 20b7b9f..ef9c452 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -3,6 +3,7 @@ Auto IRC Bot 3.0: Change Log 3.0 Indev =============================================================================== + * Added optional uno:english option. See documentation for UNO. * UNO has a new config option, uno:msg, for setting what method the bot uses for private messages. * Added command aliasing. diff --git a/modules/UNO.pm b/modules/UNO.pm index 74d44bb..7badde3 100644 --- a/modules/UNO.pm +++ b/modules/UNO.pm @@ -769,12 +769,16 @@ sub _fmtcard { my $fmt; my ($color, $val) = split m/[:]/, $card; if ($color eq 'W' or $color eq 'WD4' or $color eq 'WAH' or $color eq 'WHF') { $val = $color } + + # Determine if we should state the color in the output. + my $code = '['; + if (conf_get('uno:english')) { if ((conf_get('uno:english'))[0][0] == 1) { $code = '[%s ' } } given ($color) { - when ('R') { $fmt = "\00301,04[$val]\003" } - when ('B') { $fmt = "\00300,12[$val]\003" } - when ('G') { $fmt = "\00300,03[$val]\003" } - when ('Y') { $fmt = "\00301,08[$val]\003" } + when ('R') { $fmt = sprintf "\00301,04$code$val]\003", $_ } + when ('B') { $fmt = sprintf "\00300,12$code$val]\003", $_ } + when ('G') { $fmt = sprintf "\00300,03$code$val]\003", $_ } + when ('Y') { $fmt = sprintf "\00301,08$code$val]\003", $_ } default { $fmt = "\002\00300,01[$val]\003\002" } } @@ -1346,7 +1350,7 @@ sub sendmsg { } # Start initialization. -API::Std::mod_init('UNO', 'Xelhua', '1.06', '3.0.0a8', __PACKAGE__); +API::Std::mod_init('UNO', 'Xelhua', '1.07', '3.0.0a8', __PACKAGE__); # build: perl=5.010000 __END__ @@ -1357,7 +1361,7 @@ UNO - Three editions of the UNO card game =head1 VERSION - 1.06 + 1.07 =head1 SYNOPSIS @@ -1431,6 +1435,14 @@ You may also add the reschan option to the block, like so: This will restrict use of UNO to the specified channel. Often useful since only one channel at a time may use UNO. +You may also add the english option to the block, like so: + + english 1; + +This will make cards display as [ ], rather than [] with +IRC color. Useful if players are color blind or their clients do not support +colors. + =head1 DIFFERENCES BETWEEN EDITIONS This is a list of differences between the three editions.