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.20 by pippijn, Fri Mar 2 10:15:38 2007 UTC vs.
Revision 1.22 by pippijn, Fri Mar 2 10:44:56 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 usekeys => sub {
93 my ($ob, $arg) = @_;
94 my @types = ("inventory", "keyrings", "containers");
95 my $mapping = {
96 inventory => 1,
97 keyrings => 2,
98 containers => 3,
99 };
100
101 my $oldtype = $ob->contr->usekeys;
102 my $oldtype_name = $types[$oldtype];
103
104 return $ob->reply (undef, "usekeys is set to $oldtype_name")
105 unless $arg;
106
107 return $ob->reply (undef, "usekeys: Unknown options '$arg', valid options are inventory, keyrings, containers")
108 unless $mapping->{$arg};
109
110 $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
112 $ob->reply (undef, "usekeys" . ($oldtype == $ob->contr->usekeys ? "" : " now") . " set to " . $types[$ob->contr->usekeys]);
113
114 1
115};
116
92cf::register_command afk => sub { 117cf::register_command afk => sub {
93 my ($ob, $arg) = @_; 118 my ($ob, $arg) = @_;
94 119
95 $ob->contr->ns->afk ($ob->contr->ns->afk ? 0 : 1); 120 $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"); 121 $ob->reply (undef, $ob->contr->ns->afk ? "You are now AFK" : "You are no longer AFK");
122
123 1
124};
125
126cf::register_command sound => sub {
127 my ($ob, $arg) = @_;
128
129 $ob->contr->ns->sound ($ob->contr->ns->sound ? 0 : 1);
130 $ob->reply (undef, $ob->contr->ns->sound ? "The sounds are enabled." : "Silence is golden...");
131
132 1
97}; 133};
98 134
99cf::register_command brace => sub { 135cf::register_command brace => sub {
100 my ($ob, $arg) = @_; 136 my ($ob, $arg) = @_;
101 137
102 $ob->contr->braced ($ob->contr->braced ? 0 : 1); 138 $ob->contr->braced ($ob->contr->braced ? 0 : 1);
103 $ob->reply (undef, $ob->contr->braced ? "You are braced." : "Not braced."); 139 $ob->reply (undef, $ob->contr->braced ? "You are braced." : "Not braced.");
140
141 1
104}; 142};
105 143
106# XXX: This has a bug. After one sets his wimpy level to 0 and resets it to 144# 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, 145# some other level (which may also be 0), this does not get echoed,
108# but it does get set. 146# but it does get set.
115 153
116 return $ob->run_away ($arg) && $ob->reply (undef, "Your new wimpy level is $arg.") 154 return $ob->run_away ($arg) && $ob->reply (undef, "Your new wimpy level is $arg.")
117 if $arg =~ /^\d+$/ and $arg <= 100; 155 if $arg =~ /^\d+$/ and $arg <= 100;
118 156
119 $ob->reply (undef, "Incorrect parameters for wimpy: $arg"); 157 $ob->reply (undef, "Incorrect parameters for wimpy: $arg");
158
159 1
120}; 160};
121 161
122cf::register_command peaceful => sub { 162cf::register_command peaceful => sub {
123 my ($ob, $arg) = @_; 163 my ($ob, $arg) = @_;
124 164
127 ." if you want to become hostile or in temple of Valriel" 167 ." if you want to become hostile or in temple of Valriel"
128 ." if you want to become peaceful again."); 168 ." if you want to become peaceful again.");
129 169
130 #$ob->contr->peaceful ($ob->contr->peaceful ? 0 : 1); 170 #$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."); 171 #$ob->reply (undef, $ob->contr->peaceful ? "You will attack other players." : "You will not attack other players.");
172
173 1
132}; 174};
133 175
134 176
135cf::register_command rename => sub { 177cf::register_command rename => sub {
136 my ($ob, $arg) = @_; 178 my ($ob, $arg) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines