1 | #! perl # mandatory |
1 | #! perl # mandatory depends=irc |
2 | |
2 | |
3 | use POSIX (); |
3 | use POSIX (); |
4 | |
4 | |
5 | # miscellaneous commands |
5 | # miscellaneous commands |
6 | |
6 | |
… | |
… | |
36 | $ob->esrv_update_item (cf::UPD_NAME, $item); |
36 | $ob->esrv_update_item (cf::UPD_NAME, $item); |
37 | |
37 | |
38 | 1 |
38 | 1 |
39 | } |
39 | } |
40 | |
40 | |
41 | sub ext::irc::users; # HACK: TODO: replace by signal |
|
|
42 | |
|
|
43 | sub who_listing(;$$) { |
41 | sub who_listing(;$$) { |
44 | my ($privileged, $select) = @_; |
42 | my ($privileged, $select) = @_; |
45 | |
43 | |
46 | my ($numwiz, $numafk) = (0, 0); |
44 | my ($numwiz, $numafk) = (0, 0); |
47 | my @pl; |
45 | my @pl; |
… | |
… | |
64 | (grep /$select/, |
62 | (grep /$select/, |
65 | map { |
63 | map { |
66 | my ($pl, $ob, $ns) = ($_, $_->ob, $_->ns); |
64 | my ($pl, $ob, $ns) = ($_, $_->ob, $_->ns); |
67 | |
65 | |
68 | "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title) |
66 | "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title) |
|
|
67 | . ($pl->gender ? " [f]" : " [m]") |
69 | . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]") |
68 | . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]") |
70 | . ($ns->afk ? " [AFK]" : "") |
69 | . ($ns->afk ? " [AFK]" : "") |
71 | . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "") |
70 | . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "") |
72 | . " [" . $pl->ns->version . "]" |
71 | . " [" . $pl->ns->version . "]" |
73 | . " [" . ($pl->peaceful || $privileged ? $ob->map->visible_name : $ob->region->name) . "]" |
72 | . " [" . ($pl->peaceful || $privileged ? $ob->map->visible_name : $ob->region->name) . "]" |
… | |
… | |
186 | } |
185 | } |
187 | |
186 | |
188 | cf::register_command mapinfo => sub { |
187 | cf::register_command mapinfo => sub { |
189 | my ($ob) = @_; |
188 | my ($ob) = @_; |
190 | |
189 | |
191 | my $map = $ob->map |
190 | my $map = $ob->contr->observe->map |
192 | or return; |
191 | or return; |
193 | $ob->reply (undef, (sprintf "%s (%s) %s", $map->name, $map->path, $ob->region->longname)); |
192 | $ob->reply (undef, (sprintf "%s (%s) %s", $map->name, $map->path, $ob->region->longname)); |
194 | $ob->reply (undef, (sprintf "players: %d difficulty: %d size: %d start: %dx%d timeout: %d", |
193 | $ob->reply (undef, (sprintf "players: %d difficulty: %d size: %d start: %dx%d timeout: %d", |
195 | $map->players, $map->difficulty, $map->width, $map->height, $map->enter_x, $map->enter_y, $map->timeout)) |
194 | $map->players, $map->difficulty, $map->width, $map->height, $map->enter_x, $map->enter_y, $map->timeout)) |
196 | if $ob->flag (cf::FLAG_WIZ); |
195 | if $ob->flag (cf::FLAG_WIZ); |
… | |
… | |
200 | }; |
199 | }; |
201 | |
200 | |
202 | cf::register_command whereami => sub { |
201 | cf::register_command whereami => sub { |
203 | my ($ob) = @_; |
202 | my ($ob) = @_; |
204 | |
203 | |
205 | my $reg = $ob->region; |
204 | my $reg = $ob->contr->observe->region; |
206 | $ob->reply (undef, (sprintf "You are %s.\n%s", $reg->longname, $reg->msg)); |
205 | $ob->reply (undef, (sprintf "You are %s.\n%s", $reg->longname, $reg->msg)); |
207 | |
206 | |
208 | 1 |
207 | 1 |
209 | }; |
208 | }; |
210 | |
209 | |