ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/maps/perl/schmorp-irc.ext
(Generate patch)

Comparing deliantra/maps/perl/schmorp-irc.ext (file contents):
Revision 1.15 by elmex, Tue Sep 26 22:19:48 2006 UTC vs.
Revision 1.16 by root, Fri Sep 29 19:21:25 2006 UTC

1#! perl 1#! perl
2 2
3use Time::HiRes; 3use Time::HiRes;
4use Net::IRC3::Client::Connection; 4use Net::IRC3::Client::Connection;
5
6# requires: commands.ext
5 7
6my $BOTSERVER = 'localhost'; 8my $BOTSERVER = 'localhost';
7my $BOTPORT = '6667'; 9my $BOTPORT = '6667';
8my $BOTNAME = 'cfbot'; 10my $BOTNAME = 'cfbot';
9my $BOTCHAN = '#cf'; 11my $BOTCHAN = '#cf';
23 25
24sub handle_fcmd { 26sub handle_fcmd {
25 my ($name, $me, $msg) = @_; 27 my ($name, $me, $msg) = @_;
26 28
27 if ($msg eq "!who") { 29 if ($msg eq "!who") {
28 my ($numplayers, $numwiz, @plist) = (0, 0); 30 $CON->send_chan ($BOTCHAN, NOTICE => $_, $BOTCHAN)
31 for ext::commands::who_listing ();
29 32
30 foreach my $pl (cf::player::list) {
31 $numplayers++;
32 $numwiz++
33 if ($pl->ob->flag (cf::FLAG_WIZ));
34 push (@plist, $pl);
35 }
36
37 $CON->send_chan ($BOTCHAN, NOTICE => "Total Players in The World. ($numplayers) -- WIZ($numwiz)", $BOTCHAN);
38
39 if ($numplayers > 0) {
40 foreach my $pl (@plist) {
41 $CON->send_chan ($BOTCHAN, NOTICE =>
42 "* " . $pl->ob->name . "/" . $pl->ob->level . " " . ( length $pl->own_title ? $pl->own_title : "the " . $pl->title ) . " "
43 .($pl->ob->flag (cf::FLAG_WIZ) ? " [WIZ] " : "")
44 ." [" . ($pl->ob->map ? $pl->ob->map->path : "NULL") . "]", $BOTCHAN);
45 }
46 }
47 } elsif ($msg =~ /^\!tell/) { 33 } elsif ($msg =~ /^\!tell/) {
48 my (undef, $target, $tmsg) = split / /, $msg, 3; 34 my (undef, $target, $tmsg) = split / /, $msg, 3;
49 35
50 if (my $other = cf::player::find $target) { 36 if (my $other = cf::player::find $target) {
51 37

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines