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.3 by root, Thu Sep 14 19:39:09 2006 UTC vs.
Revision 1.11 by root, Wed Nov 8 00:54:11 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 who_listing(;$) {
40 my ($privileged) = @_;
41
42 my ($numwiz, $numafk) = (0, 0);
43 my @pl;
44
45 foreach my $pl (cf::player::list) {
46 my $ob = $pl->ob;
47
48 next unless $ob->map
49 && ($privileged || !$pl->hidden);
50
51 $numwiz++ if $ob->flag (cf::FLAG_WIZ);
52 $numafk++ if $ob->flag (cf::FLAG_AFK);
53
54 push @pl, $pl;
55 }
56
57 (
58 "Total Players in The World. (" . (scalar @pl) . ") -- WIZ($numwiz) AFK($numafk) BOT(0)",
59 map {
60 my ($pl, $ob) = ($_, $_->ob);
61
62 "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title)
63 . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]")
64 . ($ob->flag (cf::FLAG_AFK) ? " [AFK]" : "")
65 . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "")
66 . " [" . $pl->client . "]"
67 . " [" . ($pl->peaceful || $privileged ? $ob->map->path : $ob->map->region ? $ob->map->region->name : "the unknown") . "]"
68 . ($privileged ? " " . $pl->host : "")
69 } sort { (lc $a->ob->name) cmp (lc $b->ob->name) } @pl
70 )
71}
72
39cf::register_command rename => 0, sub { 73cf::register_command who => $cf::TICK, sub {
40 my ($ob, $arg) = @_; 74 my ($ob, $arg) = @_;
41 75
76 $ob->reply (undef, (join "\n", who_listing $ob->flag (cf::FLAG_WIZ)), cf::NDI_UNIQUE | cf::NDI_DK_ORANGE);
77
78 1
79};
80
81cf::register_command rename => $cf::TICK, sub {
82 my ($ob, $arg) = @_;
83
42 if ($arg =~ /^\s* (?: <([^>]+)> \s+)? to \s+ <([^>]+)> \s*$/x) { 84 if ($arg =~ /^\s* (?: <([^>]+)> \s+)? to \s+ <([^>]*)> \s*$/x) {
43 # compatibility syntax 85 # compatibility syntax
44 rename_to $ob, $1, $2; 86 rename_to $ob, $1, $2;
45 } elsif ($arg =~ / 87 } elsif ($arg =~ /
46 ^\s* 88 ^\s*
47 (?: 89 (?:
52 \s*$ 94 \s*$
53 /x) { 95 /x) {
54 # does not unquote $1 or $3 96 # does not unquote $1 or $3
55 rename_to $ob, $2||$1, $4||$3; 97 rename_to $ob, $2||$1, $4||$3;
56 } else { 98 } else {
57 $ob->message ('Syntax error. Rename usage: rename ["oldname"] to "newname"'); 99 $ob->reply (undef, 'Syntax error. Rename usage: rename ["oldname"] to "newname"');
58 } 100 }
101
102 1
59}; 103};
104

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines