--- deliantra/server/ext/commands.ext 2007/03/02 10:15:38 1.20 +++ deliantra/server/ext/commands.ext 2007/03/02 10:43:01 1.21 @@ -89,6 +89,29 @@ 1 }; +cf::register_command usekeys => sub { + my ($ob, $arg) = @_; + my @types = ("inventory", "keyrings", "containers"); + my $mapping = { + inventory => 1, + keyrings => 2, + containers => 3, + }; + + my $oldtype = $ob->contr->usekeys; + my $oldtype_name = $types[$oldtype]; + + return $ob->reply (undef, "usekeys is set to $oldtype_name") + unless $arg; + + return $ob->reply (undef, "usekeys: Unknown options '$arg', valid options are inventory, keyrings, containers") + unless $mapping->{$arg}; + + $ob->contr->usekeys ($mapping->{$arg} - 1); # HACK: because of the $mapping->{$arg} check before, where $arg should not be 0 + # but $arg would be 0 if a user enters an incorrect value + $ob->reply (undef, "usekeys" . ($oldtype == $ob->contr->usekeys ? "" : " now") . " set to " . $types[$ob->contr->usekeys]); +}; + cf::register_command afk => sub { my ($ob, $arg) = @_; @@ -96,6 +119,13 @@ $ob->reply (undef, $ob->contr->ns->afk ? "You are now AFK" : "You are no longer AFK"); }; +cf::register_command sound => sub { + my ($ob, $arg) = @_; + + $ob->contr->ns->sound ($ob->contr->ns->sound ? 0 : 1); + $ob->reply (undef, $ob->contr->ns->sound ? "The sounds are enabled." : "Silence is golden..."); +}; + cf::register_command brace => sub { my ($ob, $arg) = @_;