… | |
… | |
32 | "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title) |
32 | "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title) |
33 | . ($pl->gender ? " [f]" : " [m]") |
33 | . ($pl->gender ? " [f]" : " [m]") |
34 | . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]") |
34 | . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]") |
35 | . ($ns->afk ? " [AFK]" : "") |
35 | . ($ns->afk ? " [AFK]" : "") |
36 | . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "") |
36 | . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "") |
37 | . " [" . $pl->ns->version . "]" |
37 | . " [" . $pl->ns->{who_version} . "]" |
38 | . " [" . ($pl->peaceful || $privileged ? $ob->map->visible_name : $ob->region->name) . "]" |
38 | . " [" . ($pl->peaceful || $privileged ? $ob->map->visible_name : $ob->region->name) . "]" |
39 | . (sprintf " [rtt %.3fs]", $pl->ns->tcpi_rtt * 1e-6) |
39 | . (sprintf " [rtt %.3fs]", $pl->ns->tcpi_rtt * 1e-6) |
40 | . ($privileged ? " " . $pl->ns->host : "") |
40 | . ($privileged ? " " . $pl->ns->host : "") |
41 | } sort { (lc $a->ob->name) cmp (lc $b->ob->name) } @pl |
41 | } sort { (lc $a->ob->name) cmp (lc $b->ob->name) } @pl |
42 | ), |
42 | ), |
… | |
… | |
117 | unless $observe->flag (cf::FLAG_USE_WEAPON); |
117 | unless $observe->flag (cf::FLAG_USE_WEAPON); |
118 | |
118 | |
119 | $ob->send_msg ("c/body" => $reply, cf::NDI_REPLY | cf::NDI_CLEAR); |
119 | $ob->send_msg ("c/body" => $reply, cf::NDI_REPLY | cf::NDI_CLEAR); |
120 | }; |
120 | }; |
121 | |
121 | |
122 | cf::register_command mark => sub { |
122 | #cf::register_command mark => sub { |
123 | my ($pl, $arg) = @_; |
123 | # my ($pl, $arg) = @_; |
124 | |
124 | # |
125 | if (length $arg) { |
125 | # if (length $arg) { |
126 | my $ob = $pl->find_best_object_match ($arg); |
126 | # my $ob = $pl->find_best_object_match ($arg); |
127 | |
127 | # |
128 | return $pl->reply (undef, "Could not find an object that matches $arg") |
128 | # return $pl->reply (undef, "Could not find an object that matches $arg") |
129 | unless $ob; |
129 | # unless $ob; |
130 | |
130 | # |
131 | $pl->contr->mark ($ob); |
131 | # $pl->contr->mark ($ob); |
132 | $pl->reply (undef, (sprintf "Marked item %s", $ob->name, $ob->title)); |
132 | # $pl->reply (undef, (sprintf "Marked item %s", $ob->name, $ob->title)); |
133 | } else { |
133 | # } else { |
134 | my $ob = $pl->find_marked_object; |
134 | # my $ob = $pl->find_marked_object; |
135 | |
135 | # |
136 | $pl->reply (undef, $ob |
136 | # $pl->reply (undef, $ob |
137 | ? (sprintf "%s %s * is marked.", $ob->name, $ob->title) |
137 | # ? (sprintf "%s %s * is marked.", $ob->name, $ob->title) |
138 | : "You have no marked object."); |
138 | # : "You have no marked object."); |
139 | } |
139 | # } |
140 | }; |
140 | #}; |
141 | |
|
|
142 | for my $cmd ("run", "fire") { |
|
|
143 | my $oncmd = "${cmd}_on"; |
|
|
144 | cf::register_command $cmd => sub { |
|
|
145 | my ($ob, $arg) = @_; |
|
|
146 | |
|
|
147 | $ob->reply (undef, "Can't $cmd into a non adjacent square.") |
|
|
148 | if $arg < 0 or $arg >= 9; |
|
|
149 | |
|
|
150 | $ob->contr->$oncmd (1); |
|
|
151 | $ob->move_player ($arg); |
|
|
152 | }; |
|
|
153 | |
|
|
154 | cf::register_command "${cmd}_stop" => sub { |
|
|
155 | my ($ob) = @_; |
|
|
156 | |
|
|
157 | $ob->contr->$oncmd (0); |
|
|
158 | }; |
|
|
159 | } |
|
|
160 | |
141 | |
161 | cf::register_command mapinfo => sub { |
142 | cf::register_command mapinfo => sub { |
162 | my ($ob) = @_; |
143 | my ($ob) = @_; |
163 | |
144 | |
164 | my $observe = $ob->contr->observe; |
145 | my $observe = $ob->contr->observe; |
… | |
… | |
267 | my ($ob, $arg) = @_; |
248 | my ($ob, $arg) = @_; |
268 | |
249 | |
269 | return $ob->reply (undef, sprintf "Output rate is presently %dbps.", $ob->contr->ns->max_rate / $cf::TICK) |
250 | return $ob->reply (undef, sprintf "Output rate is presently %dbps.", $ob->contr->ns->max_rate / $cf::TICK) |
270 | unless $arg > 0; |
251 | unless $arg > 0; |
271 | |
252 | |
272 | # minimum is 5k/s |
253 | $ob->contr->ns->max_rate ((cf::clamp $arg, $OUTPUT_RATE_MIN, $OUTPUT_RATE_MAX) * $TICK); |
273 | # maximum is 100k/s, this should be configurable |
|
|
274 | $ob->contr->ns->max_rate ((List::Util::max 5000, List::Util::min 100000, $arg) * $cf::TICK); |
|
|
275 | $ob->reply (undef, sprintf "Output rate now set to %dbps.", $ob->contr->ns->max_rate / $cf::TICK); |
254 | $ob->reply (undef, sprintf "Output rate now set to %dbps.", $ob->contr->ns->max_rate / $TICK); |
276 | }; |
255 | }; |
277 | |
256 | |
278 | cf::register_command 'output-count' => sub { |
257 | cf::register_command 'output-count' => sub { |
279 | my ($ob, $arg) = @_; |
258 | my ($ob, $arg) = @_; |
280 | |
259 | |