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.21 by pippijn, Fri Mar 2 10:43:01 2007 UTC vs.
Revision 1.24 by pippijn, Fri Mar 2 11:07:59 2007 UTC

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 91
92cf::register_command applymode => sub {
93 my ($ob, $arg) = @_;
94 my @types = ("nochoice", "never", "always");
95 my $mapping = {
96 nochoice => 1,
97 never => 2,
98 always => 3,
99 };
100
101 my $oldmode = $ob->contr->unapply;
102 my $oldmode_name = $types[$oldmode];
103
104 return $ob->reply (undef, "applymode is set to $oldmode_name")
105 unless $arg;
106
107 return $ob->reply (undef, "applymode: Unknown options '$arg', valid options are @types")
108 unless $mapping->{$arg};
109
110 $ob->contr->unapply ($mapping->{$arg} - 1); # HACK: because of the $mapping->{$arg} check before, where $arg should not be 0
111 # but $arg would be 0 if a user enters an incorrect value
112 $ob->reply (undef, "applymode" . ($oldmode == $ob->contr->unapply ? "" : " now") . " set to " . $types[$ob->contr->unapply]);
113
114 1
115};
116
117cf::register_command petmode => sub {
118 my ($ob, $arg) = @_;
119 my @types = ("normal", "sad", "defend", "arena");
120 my $mapping = {
121 normal => 1,
122 sad => 2,
123 defend => 3,
124 arena => 4,
125 };
126
127 my $oldtype = $ob->contr->petmode;
128 my $oldtype_name = $types[$oldtype];
129
130 return $ob->reply (undef, "petmode is set to $oldtype_name")
131 unless $arg;
132
133 return $ob->reply (undef, "petmode: Unknown options '$arg', valid options are @types")
134 unless $mapping->{$arg};
135
136 $ob->contr->petmode ($mapping->{$arg} - 1); # HACK: because of the $mapping->{$arg} check before, where $arg should not be 0
137 # but $arg would be 0 if a user enters an incorrect value
138 $ob->reply (undef, "petmode" . ($oldtype == $ob->contr->petmode ? "" : " now") . " set to " . $types[$ob->contr->petmode]);
139
140 1
141};
142
92cf::register_command usekeys => sub { 143cf::register_command usekeys => sub {
93 my ($ob, $arg) = @_; 144 my ($ob, $arg) = @_;
94 my @types = ("inventory", "keyrings", "containers"); 145 my @types = ("inventory", "keyrings", "containers");
95 my $mapping = { 146 my $mapping = {
96 inventory => 1, 147 inventory => 1,
102 my $oldtype_name = $types[$oldtype]; 153 my $oldtype_name = $types[$oldtype];
103 154
104 return $ob->reply (undef, "usekeys is set to $oldtype_name") 155 return $ob->reply (undef, "usekeys is set to $oldtype_name")
105 unless $arg; 156 unless $arg;
106 157
107 return $ob->reply (undef, "usekeys: Unknown options '$arg', valid options are inventory, keyrings, containers") 158 return $ob->reply (undef, "usekeys: Unknown options '$arg', valid options are @types")
108 unless $mapping->{$arg}; 159 unless $mapping->{$arg};
109 160
110 $ob->contr->usekeys ($mapping->{$arg} - 1); # HACK: because of the $mapping->{$arg} check before, where $arg should not be 0 161 $ob->contr->usekeys ($mapping->{$arg} - 1); # HACK: because of the $mapping->{$arg} check before, where $arg should not be 0
111 # but $arg would be 0 if a user enters an incorrect value 162 # but $arg would be 0 if a user enters an incorrect value
112 $ob->reply (undef, "usekeys" . ($oldtype == $ob->contr->usekeys ? "" : " now") . " set to " . $types[$ob->contr->usekeys]); 163 $ob->reply (undef, "usekeys" . ($oldtype == $ob->contr->usekeys ? "" : " now") . " set to " . $types[$ob->contr->usekeys]);
164
165 1
113}; 166};
114 167
115cf::register_command afk => sub { 168cf::register_command afk => sub {
116 my ($ob, $arg) = @_; 169 my ($ob, $arg) = @_;
117 170
118 $ob->contr->ns->afk ($ob->contr->ns->afk ? 0 : 1); 171 $ob->contr->ns->afk ($ob->contr->ns->afk ? 0 : 1);
119 $ob->reply (undef, $ob->contr->ns->afk ? "You are now AFK" : "You are no longer AFK"); 172 $ob->reply (undef, $ob->contr->ns->afk ? "You are now AFK" : "You are no longer AFK");
173
174 1
120}; 175};
121 176
122cf::register_command sound => sub { 177cf::register_command sound => sub {
123 my ($ob, $arg) = @_; 178 my ($ob, $arg) = @_;
124 179
125 $ob->contr->ns->sound ($ob->contr->ns->sound ? 0 : 1); 180 $ob->contr->ns->sound ($ob->contr->ns->sound ? 0 : 1);
126 $ob->reply (undef, $ob->contr->ns->sound ? "The sounds are enabled." : "Silence is golden..."); 181 $ob->reply (undef, $ob->contr->ns->sound ? "The sounds are enabled." : "Silence is golden...");
182
183 1
127}; 184};
128 185
129cf::register_command brace => sub { 186cf::register_command brace => sub {
130 my ($ob, $arg) = @_; 187 my ($ob, $arg) = @_;
131 188
132 $ob->contr->braced ($ob->contr->braced ? 0 : 1); 189 $ob->contr->braced ($ob->contr->braced ? 0 : 1);
133 $ob->reply (undef, $ob->contr->braced ? "You are braced." : "Not braced."); 190 $ob->reply (undef, $ob->contr->braced ? "You are braced." : "Not braced.");
191
192 1
193};
194
195cf::register_command 'output-count' => sub {
196 my ($ob, $arg) = @_;
197
198 return $ob->reply (undef, "Output count is presently " . $ob->contr->outputs_count)
199 unless $arg > 0;
200
201 $ob->contr->outputs_count ($arg);
202 $ob->reply (undef, "Output count now set to " . $ob->contr->outputs_count);
203
204 1
205};
206
207cf::register_command 'output-sync' => sub {
208 my ($ob, $arg) = @_;
209
210 return $ob->reply (undef, "Output sync time is presently " . $ob->contr->outputs_sync)
211 unless $arg > 0;
212
213 $ob->contr->outputs_sync ($arg);
214 $ob->reply (undef, "Output sync time now set to " . $ob->contr->outputs_sync);
215
216 1
134}; 217};
135 218
136# XXX: This has a bug. After one sets his wimpy level to 0 and resets it to 219# XXX: This has a bug. After one sets his wimpy level to 0 and resets it to
137# some other level (which may also be 0), this does not get echoed, 220# some other level (which may also be 0), this does not get echoed,
138# but it does get set. 221# but it does get set.
145 228
146 return $ob->run_away ($arg) && $ob->reply (undef, "Your new wimpy level is $arg.") 229 return $ob->run_away ($arg) && $ob->reply (undef, "Your new wimpy level is $arg.")
147 if $arg =~ /^\d+$/ and $arg <= 100; 230 if $arg =~ /^\d+$/ and $arg <= 100;
148 231
149 $ob->reply (undef, "Incorrect parameters for wimpy: $arg"); 232 $ob->reply (undef, "Incorrect parameters for wimpy: $arg");
233
234 1
150}; 235};
151 236
152cf::register_command peaceful => sub { 237cf::register_command peaceful => sub {
153 my ($ob, $arg) = @_; 238 my ($ob, $arg) = @_;
154 239
157 ." if you want to become hostile or in temple of Valriel" 242 ." if you want to become hostile or in temple of Valriel"
158 ." if you want to become peaceful again."); 243 ." if you want to become peaceful again.");
159 244
160 #$ob->contr->peaceful ($ob->contr->peaceful ? 0 : 1); 245 #$ob->contr->peaceful ($ob->contr->peaceful ? 0 : 1);
161 #$ob->reply (undef, $ob->contr->peaceful ? "You will attack other players." : "You will not attack other players."); 246 #$ob->reply (undef, $ob->contr->peaceful ? "You will attack other players." : "You will not attack other players.");
162};
163 247
248 1
249};
164 250
165cf::register_command rename => sub { 251cf::register_command rename => sub {
166 my ($ob, $arg) = @_; 252 my ($ob, $arg) = @_;
167 253
168 $ob->speed_left ($ob->speed_left - 0.25); 254 $ob->speed_left ($ob->speed_left - 0.25);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines