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

Comparing deliantra/maps/perl/commands.ext (file contents):
Revision 1.1 by root, Thu Sep 14 19:06:49 2006 UTC vs.
Revision 1.13 by root, Sun Nov 26 02:37:53 2006 UTC

31 $ob->message ("You stop calling your " . $item->base_name . " with weird names."); 31 $ob->message ("You stop calling your " . $item->base_name . " with weird names.");
32 } 32 }
33 33
34 $ob->esrv_update_item (cf::UPD_NAME, $item); 34 $ob->esrv_update_item (cf::UPD_NAME, $item);
35 35
36 return 1; 36 1
37} 37}
38 38
39sub ext::schmorp_irc::users; # HACK: TODO: replace by signal
40
41sub who_listing(;$) {
42 my ($privileged) = @_;
43
44 my ($numwiz, $numafk) = (0, 0);
45 my @pl;
46
47 foreach my $pl (cf::player::list) {
48 my $ob = $pl->ob;
49
50 next unless $ob->map
51 && ($privileged || !$pl->hidden);
52
53 $numwiz++ if $ob->flag (cf::FLAG_WIZ);
54 $numafk++ if $ob->flag (cf::FLAG_AFK);
55
56 push @pl, $pl;
57 }
58
59 (
60 "Total Players in The World. (" . (scalar @pl) . ") -- WIZ($numwiz) AFK($numafk) BOT(0)",
61 (
62 map {
63 my ($pl, $ob) = ($_, $_->ob);
64
65 "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title)
66 . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]")
67 . ($ob->flag (cf::FLAG_AFK) ? " [AFK]" : "")
68 . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "")
69 . " [" . $pl->client . "]"
70 . " [" . ($pl->peaceful || $privileged ? $ob->map->path : $ob->map->region ? $ob->map->region->name : "the unknown") . "]"
71 . ($privileged ? " " . $pl->host : "")
72 } sort { (lc $a->ob->name) cmp (lc $b->ob->name) } @pl
73 ),
74 eval { "* IRC: " . join ", ", ext::schmorp_irc::users },
75 )
76}
77
39cf::register_command rename => 0, sub { 78cf::register_command who => $cf::TICK, sub {
40 my ($ob, $arg) = @_; 79 my ($ob, $arg) = @_;
41 80
42 # support compatibility syntax as well as new syntax 81 $ob->reply (undef, (join "\n", who_listing $ob->may ("extended_who")), cf::NDI_UNIQUE | cf::NDI_DK_ORANGE);
82
83 1
84};
85
86cf::register_command rename => $cf::TICK, sub {
87 my ($ob, $arg) = @_;
88
43 if ($arg =~ /^\s* (?: <([^>]+)> \s+) to \s+ <([^>]+)> \s*$/x) { 89 if ($arg =~ /^\s* (?: <([^>]+)> \s+)? to \s+ <([^>]*)> \s*$/x) {
90 # compatibility syntax
44 rename_to $ob, $1, $2; 91 rename_to $ob, $1, $2;
45 } elsif ($arg =~ / 92 } elsif ($arg =~ /
46 ^\s* 93 ^\s*
47 (?: 94 (?:
48 (?: "((?:[^"]+|\\.)*)" | (\S+) ) 95 (?: "((?:[^"]+|\\.)*)" | (\S+) )
52 \s*$ 99 \s*$
53 /x) { 100 /x) {
54 # does not unquote $1 or $3 101 # does not unquote $1 or $3
55 rename_to $ob, $2||$1, $4||$3; 102 rename_to $ob, $2||$1, $4||$3;
56 } else { 103 } else {
57 $ob->message ('Syntax error. Rename usage: rename ["oldname"] to "newname"'); 104 $ob->reply (undef, 'Syntax error. Rename usage: rename ["oldname"] to "newname"');
58 } 105 }
106
107 1
59}; 108};
109

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines