summaryrefslogtreecommitdiffstats
path: root/lib/Bot/Games.pm
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-01-14 05:09:16 -0500
committerdoy <doy@tozt.net>2009-01-14 05:09:16 -0500
commit94a9a6a179e48f2d98ecc2954cd33ec6e7f5c10a (patch)
treee0bc716ac2b2749fa7a95d83def69c98fdb8fc22 /lib/Bot/Games.pm
parent76ded94cf254c45f8516f298be5ee534cc453e5b (diff)
downloadbot-games-94a9a6a179e48f2d98ecc2954cd33ec6e7f5c10a.tar.gz
bot-games-94a9a6a179e48f2d98ecc2954cd33ec6e7f5c10a.zip
update Bot::Games to use the new meta-stuff... completely untested, and probably broken!
Diffstat (limited to 'lib/Bot/Games.pm')
-rw-r--r--lib/Bot/Games.pm20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Bot/Games.pm b/lib/Bot/Games.pm
index 92b22ae..ff2f76f 100644
--- a/lib/Bot/Games.pm
+++ b/lib/Bot/Games.pm
@@ -1,6 +1,6 @@
#!/usr/bin/perl
package Bot::Games;
-use Moose;
+use Bot::Games::OO;
use Module::Pluggable
search_path => 'Bot::Games::Game',
except => ['Bot::Games::Game::Ghostlike'],
@@ -45,14 +45,14 @@ sub said {
if ($action =~ /^-(\w+)\s*(.*)/) {
my ($action, $arg) = ($1, $2);
- if ($action =~ s/^_//) {
- $output = "$action is private in $game_name";
- }
- elsif ($game->meta->find_attribute_by_name($action)) {
- $output = $game->$action();
- }
- elsif ($game->can($action)) {
- $output = $game->$action($arg, {player => $args->{who}});
+ my $method_meta = $game->meta->find_method_by_name($action);
+ # bleh. isa isn't what i want either, but it's getting closer.
+ if ($method_meta->isa('Bot::Games::Meta::Method::Command')) {
+ my @command_args;
+ if (!$game->meta->has_attribute($action)) {
+ push @command_args, ($arg, {player => $args->{who}});
+ }
+ $output = $game->$action(@command_args);
}
else {
$output = "Unknown command $action for game $game_name";
@@ -105,6 +105,6 @@ sub _format {
}
__PACKAGE__->meta->make_immutable;
-no Moose;
+no Bot::Games::OO;
1;