… | |
… | |
68 | "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title) |
68 | "* " . $ob->name . "/" . $ob->level . " " . (length $pl->own_title ? $pl->own_title : "the " . $pl->title) |
69 | . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]") |
69 | . ($pl->peaceful ? " [peaceful]" : " [HOSTILE]") |
70 | . ($ns->afk ? " [AFK]" : "") |
70 | . ($ns->afk ? " [AFK]" : "") |
71 | . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "") |
71 | . ($ob->flag (cf::FLAG_WIZ) ? " [WIZ]" : "") |
72 | . " [" . $pl->ns->version . "]" |
72 | . " [" . $pl->ns->version . "]" |
73 | . " [" . ($pl->peaceful || $privileged ? $ob->map->{path}->visible_name : $ob->map->region ? $ob->map->region->name : "the unknown") . "]" |
73 | . " [" . ($pl->peaceful || $privileged ? $ob->map->visible_name : $ob->region->name) . "]" |
74 | . (sprintf " [rtt %.3fs]", $pl->ns->rtt * 1e-6) |
74 | . (sprintf " [rtt %.3fs]", $pl->ns->rtt * 1e-6) |
75 | . ($privileged ? " " . $pl->ns->host : "") |
75 | . ($privileged ? " " . $pl->ns->host : "") |
76 | } sort { (lc $a->ob->name) cmp (lc $b->ob->name) } @pl |
76 | } sort { (lc $a->ob->name) cmp (lc $b->ob->name) } @pl |
77 | ), |
77 | ), |
78 | eval { "* IRC: " . join ", ", ext::schmorp_irc::users }, |
78 | eval { "* IRC: " . join ", ", ext::schmorp_irc::users }, |
… | |
… | |
86 | |
86 | |
87 | $ob->reply (undef, (join "\n", who_listing $ob->may ("extended_who")), cf::NDI_UNIQUE | cf::NDI_DK_ORANGE); |
87 | $ob->reply (undef, (join "\n", who_listing $ob->may ("extended_who")), cf::NDI_UNIQUE | cf::NDI_DK_ORANGE); |
88 | |
88 | |
89 | 1 |
89 | 1 |
90 | }; |
90 | }; |
|
|
91 | |
|
|
92 | cf::register_command afk => sub { |
|
|
93 | my ($ob, $arg) = @_; |
|
|
94 | |
|
|
95 | $ob->contr->ns->afk ($ob->contr->ns->afk ? 0 : 1); |
|
|
96 | $ob->reply (undef, $ob->contr->ns->afk ? "You are now AFK" : "You are no longer AFK"); |
|
|
97 | }; |
|
|
98 | |
|
|
99 | cf::register_command brace => sub { |
|
|
100 | my ($ob, $arg) = @_; |
|
|
101 | |
|
|
102 | $ob->contr->braced ($ob->contr->braced ? 0 : 1); |
|
|
103 | $ob->reply (undef, $ob->contr->braced ? "You are braced." : "Not braced."); |
|
|
104 | }; |
|
|
105 | |
|
|
106 | # XXX: This has a bug. After one sets his wimpy level to 0 and resets it to |
|
|
107 | # some other level (which may also be 0), this does not get echoed, |
|
|
108 | # but it does get set. |
|
|
109 | cf::register_command wimpy => sub { |
|
|
110 | my ($ob, $arg) = @_; |
|
|
111 | |
|
|
112 | my $wimpy = $ob->run_away; |
|
|
113 | return $ob->reply (undef, "Your current wimpy level is $wimpy.") |
|
|
114 | if $arg eq ""; |
|
|
115 | |
|
|
116 | return $ob->run_away ($arg) && $ob->reply (undef, "Your new wimpy level is $arg.") |
|
|
117 | if $arg =~ /^\d+$/ and $arg <= 100; |
|
|
118 | |
|
|
119 | $ob->reply (undef, "Incorrect parameters for wimpy: $arg"); |
|
|
120 | }; |
|
|
121 | |
|
|
122 | cf::register_command peaceful => sub { |
|
|
123 | my ($ob, $arg) = @_; |
|
|
124 | |
|
|
125 | $ob->reply (undef, "You cannot change your peaceful setting with this command." |
|
|
126 | ." Please speak to the priest in the temple of Gorokh" |
|
|
127 | ." if you want to become hostile or in temple of Valriel" |
|
|
128 | ." if you want to become peaceful again."); |
|
|
129 | |
|
|
130 | #$ob->contr->peaceful ($ob->contr->peaceful ? 0 : 1); |
|
|
131 | #$ob->reply (undef, $ob->contr->peaceful ? "You will attack other players." : "You will not attack other players."); |
|
|
132 | }; |
|
|
133 | |
91 | |
134 | |
92 | cf::register_command rename => sub { |
135 | cf::register_command rename => sub { |
93 | my ($ob, $arg) = @_; |
136 | my ($ob, $arg) = @_; |
94 | |
137 | |
95 | $ob->speed_left ($ob->speed_left - 0.25); |
138 | $ob->speed_left ($ob->speed_left - 0.25); |
… | |
… | |
143 | for (sort keys %cf::MAP) { |
186 | for (sort keys %cf::MAP) { |
144 | my $map = $cf::MAP{$_} |
187 | my $map = $cf::MAP{$_} |
145 | or next; |
188 | or next; |
146 | |
189 | |
147 | next unless $map->path =~ $arg; |
190 | next unless $map->path =~ $arg; |
|
|
191 | next if $map->{deny_list}; |
148 | |
192 | |
149 | my $svd = int $cf::RUNTIME - $map->{last_save}; |
193 | my $svd = int $cf::RUNTIME - $map->{last_save}; |
150 | $svd = "++" if $svd > 99; |
194 | $svd = "++" if $svd > 99; |
151 | |
195 | |
152 | $ob->reply (undef, |
196 | $ob->reply (undef, |
153 | (sprintf $format, |
197 | (sprintf $format, |
154 | (scalar $map->players), |
198 | (scalar $map->players), |
155 | $IN_MEMORY{$map->in_memory} || "?", |
199 | $IN_MEMORY{$map->in_memory} || "?", |
156 | $svd, |
200 | $svd, |
157 | (int $map->reset_at - $cf::RUNTIME), |
201 | (int $map->reset_at - $cf::RUNTIME), |
158 | $map->{path}->visible_name), |
202 | $map->visible_name), |
159 | cf::NDI_BLACK | cf::NDI_UNIQUE); |
203 | cf::NDI_BLACK | cf::NDI_UNIQUE); |
160 | } |
204 | } |
161 | |
205 | |
162 | 1 |
206 | 1 |
163 | }; |
207 | }; |