--- deliantra/server/ext/dmcommands.ext 2007/01/13 23:06:13 1.12 +++ deliantra/server/ext/dmcommands.ext 2007/06/11 21:38:13 1.22 @@ -1,21 +1,53 @@ -#! perl +#! perl # mandatory # wizard commands +cf::register_command shutdown => sub { + my ($ob, $arg) = @_; + return $ob->reply (undef, "Sorry, you can't shutdown the server.") + unless $ob->flag (cf::FLAG_WIZ); + + my $name = $ob->name; + cf::cleanup ("dm '$name' initiated shutdown" . ($arg ? " with reason: $arg" : "."), 0); + + 1 +}; + +cf::register_command kick => sub { + my ($ob, $arg) = @_; + return unless $ob->flag (cf::FLAG_WIZ); + + my $other = cf::player::find_active $arg + or return 0; + $other->kick ($ob); + $ob->reply (undef, "$arg is kicked out of the game.", cf::NDI_UNIQUE | cf::NDI_ALL | cf::NDI_RED); + + 1 +}; + cf::register_command goto => sub { my ($ob, $arg) = @_; return unless $ob->may ("command_goto"); - my $portal = cf::object::new "exit"; + my ($path, $x, $y) = split /\s+/, $arg, 3; - $portal->slaying ($arg); - $portal->stats->hp (0); - $portal->stats->sp (0); + $ob->goto ($path, $x, $y); - $portal->apply ($ob); + 1 +}; - $portal->destroy; +cf::register_command teleport => sub { + my ($ob, $arg) = @_; + + return unless $ob->may ("command_teleport"); + + cf::async { + my $other = cf::player::find $arg + or return $ob->reply (undef, "$arg: no such player."); + + $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y); + }; 1 }; @@ -61,7 +93,7 @@ return unless $ob->may ("command_wizlook"); - $ob->clear_los; + $ob->contr->clear_los; $ob->reply (undef, "You can temporarily see through walls."); @@ -89,7 +121,18 @@ 1 }; -for my $command (qw(teleport summon arrest kick banish)) { +cf::register_command observe => sub { + my ($ob, $arg) = @_; + + return unless $ob->may ("command_observe"); + + my $other = cf::player::find_active $arg; + $ob->contr->set_observe ($other ? $other->ob : undef); + + 1 +}; + +for my $command (qw(summon arrest banish)) { my $method = "command_$command"; cf::register_command $command => sub {