ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/commands.ext
(Generate patch)

Comparing deliantra/server/ext/commands.ext (file contents):
Revision 1.14 by root, Fri Jan 5 22:47:18 2007 UTC vs.
Revision 1.20 by pippijn, Fri Mar 2 10:15:38 2007 UTC

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
92cf::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
99cf::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.
109cf::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
122cf::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
92cf::register_command rename => sub { 135cf::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);
136 179
137 no re 'eval'; $arg = qr<$arg>; 180 no re 'eval'; $arg = qr<$arg>;
138 181
139 my $format = "%2s %1s %3s %5s %.60s\n"; 182 my $format = "%2s %1s %3s %5s %.60s\n";
140 183
141 $ob->reply (undef, sprintf $format, "Pl", "I", "Svd", "Reset", "Name", cf::NDI_BLACK | cf::NDI_UNIQUE); 184 $ob->reply (undef, (sprintf $format, "Pl", "I", "Svd", "Reset", "Name"), cf::NDI_BLACK | cf::NDI_UNIQUE);
142 185
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};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines