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

Comparing deliantra/server/ext/dmcommands.ext (file contents):
Revision 1.6 by root, Tue Jan 2 11:08:35 2007 UTC vs.
Revision 1.17 by pippijn, Fri Mar 2 13:32:50 2007 UTC

1#! perl 1#! perl
2 2
3# wizard commands 3# wizard commands
4
5cf::register_command kick => sub {
6 my ($ob, $arg) = @_;
7 return unless $ob->flag (cf::FLAG_WIZ);
8
9 my $other = cf::player::find_active $arg
10 or return 0;
11 $other->kick ($ob);
12 $ob->reply (undef, "$arg is kicked out of the game.", cf::NDI_UNIQUE | cf::NDI_ALL | cf::NDI_RED);
13
14 1
15};
4 16
5cf::register_command goto => sub { 17cf::register_command goto => sub {
6 my ($ob, $arg) = @_; 18 my ($ob, $arg) = @_;
7 19
8 return unless $ob->may ("command_goto"); 20 return unless $ob->may ("command_goto");
9 21
10 my $portal = cf::object::new "exit"; 22 my ($path, $x, $y) = split /\s+/, $arg, 3;
11 23
12 $portal->slaying ($arg); 24 $ob->goto ($path, $x, $y);
13 $portal->stats->hp (0);
14 $portal->stats->sp (0);
15 25
16 $portal->apply ($ob); 26 1
27};
17 28
18 $portal->destroy; 29cf::register_command teleport => sub {
30 my ($ob, $arg) = @_;
31
32 return unless $ob->may ("command_teleport");
33
34 cf::async {
35 my $other = cf::player::find $arg
36 or return $ob->reply (undef, "$arg: no such player.");
37
38 $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y);
39 };
19 40
20 1 41 1
21}; 42};
22 43
23cf::register_command wizpass => sub { 44cf::register_command wizpass => sub {
75 96
76 my $map = $ob->map; 97 my $map = $ob->map;
77 98
78 my @pl = $map->players; 99 my @pl = $map->players;
79 $_->enter_link for @pl; 100 $_->enter_link for @pl;
80 Coro::async { 101 cf::async {
81 Coro::Timer::sleep 10; 102 my $name = $map->visible_name;
103
82 $map->reset; 104 $map->reset;
83 $_->leave_link for @pl; 105 $_->leave_link for @pl;
84 106
85 $ob->reply (undef, $map->{path}->as_string . " was reset."); 107 $ob->reply (undef, "$name was reset.");
86 }; 108 };
87 109
88 1 110 1
89}; 111};
90 112
91for my $command (qw(teleport summon arrest kick banish)) { 113for my $command (qw(summon arrest banish)) {
92 my $method = "command_$command"; 114 my $method = "command_$command";
93 115
94 cf::register_command $command => sub { 116 cf::register_command $command => sub {
95 my ($ob, $arg) = @_; 117 my ($ob, $arg) = @_;
96 118

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines