… | |
… | |
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 | |
|
|
39 | sub ext::schmorp_irc::users; # HACK: TODO: replace by signal |
38 | |
40 | |
39 | sub who_listing(;$) { |
41 | sub who_listing(;$) { |
40 | my ($privileged) = @_; |
42 | my ($privileged) = @_; |
41 | |
43 | |
42 | my ($numwiz, $numafk) = (0, 0); |
44 | my ($numwiz, $numafk) = (0, 0); |
… | |
… | |
54 | push @pl, $pl; |
56 | push @pl, $pl; |
55 | } |
57 | } |
56 | |
58 | |
57 | ( |
59 | ( |
58 | "Total Players in The World. (" . (scalar @pl) . ") -- WIZ($numwiz) AFK($numafk) BOT(0)", |
60 | "Total Players in The World. (" . (scalar @pl) . ") -- WIZ($numwiz) AFK($numafk) BOT(0)", |
|
|
61 | ( |
59 | map { |
62 | map { |
60 | my ($pl, $ob) = ($_, $_->ob); |
63 | my ($pl, $ob) = ($_, $_->ob); |
61 | |
64 | |
62 | "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title) |
65 | "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title) |
63 | . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]") |
66 | . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]") |
64 | . ($ob->flag (cf::FLAG_AFK) ? " [AFK]" : "") |
67 | . ($ob->flag (cf::FLAG_AFK) ? " [AFK]" : "") |
65 | . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "") |
68 | . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "") |
66 | . " [" . $pl->client . "]" |
69 | . " [" . $pl->client . "]" |
67 | . " [" . ($pl->peaceful ? $ob->map->path : $ob->map->region ? $ob->map->region->name : "the unknown") . "]" |
70 | . " [" . ($pl->peaceful || $privileged ? $ob->map->path : $ob->map->region ? $ob->map->region->name : "the unknown") . "]" |
68 | . ($privileged ? " " . $pl->host : "") |
71 | . ($privileged ? " " . $pl->host : "") |
69 | } sort { $a->ob->name cmp $b->ob->name } @pl |
72 | } sort { (lc $a->ob->name) cmp (lc $b->ob->name) } @pl |
|
|
73 | ), |
|
|
74 | eval { "* IRC: " . join ", ", ext::schmorp_irc::users }, |
70 | ) |
75 | ) |
71 | } |
76 | } |
72 | |
77 | |
73 | cf::register_command who => $cf::TICK, sub { |
78 | cf::register_command who => $cf::TICK, sub { |
74 | my ($ob, $arg) = @_; |
79 | my ($ob, $arg) = @_; |
75 | |
80 | |
76 | $ob->reply (undef, (join "\n", who_listing $ob->flag (cf::FLAG_WIZ)), cf::NDI_UNIQUE | cf::NDI_GOLD); |
81 | $ob->reply (undef, (join "\n", who_listing $ob->may ("extended_who")), cf::NDI_UNIQUE | cf::NDI_DK_ORANGE); |
|
|
82 | |
|
|
83 | 1 |
77 | }; |
84 | }; |
78 | |
85 | |
79 | cf::register_command rename => $cf::TICK, sub { |
86 | cf::register_command rename => $cf::TICK, sub { |
80 | my ($ob, $arg) = @_; |
87 | my ($ob, $arg) = @_; |
81 | |
88 | |
82 | if ($arg =~ /^\s* (?: <([^>]+)> \s+)? to \s+ <([^>]+)> \s*$/x) { |
89 | if ($arg =~ /^\s* (?: <([^>]+)> \s+)? to \s+ <([^>]*)> \s*$/x) { |
83 | # compatibility syntax |
90 | # compatibility syntax |
84 | rename_to $ob, $1, $2; |
91 | rename_to $ob, $1, $2; |
85 | } elsif ($arg =~ / |
92 | } elsif ($arg =~ / |
86 | ^\s* |
93 | ^\s* |
87 | (?: |
94 | (?: |
… | |
… | |
94 | # does not unquote $1 or $3 |
101 | # does not unquote $1 or $3 |
95 | rename_to $ob, $2||$1, $4||$3; |
102 | rename_to $ob, $2||$1, $4||$3; |
96 | } else { |
103 | } else { |
97 | $ob->reply (undef, 'Syntax error. Rename usage: rename ["oldname"] to "newname"'); |
104 | $ob->reply (undef, 'Syntax error. Rename usage: rename ["oldname"] to "newname"'); |
98 | } |
105 | } |
|
|
106 | |
|
|
107 | 1 |
99 | }; |
108 | }; |
|
|
109 | |