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.16 by pippijn, Thu Mar 1 20:20:05 2007 UTC vs.
Revision 1.23 by root, Wed Sep 19 21:56:30 2007 UTC

1#! perl 1#! perl # mandatory
2 2
3# wizard commands 3# wizard commands
4
5cf::register_command shutdown => sub {
6 my ($ob, $arg) = @_;
7 return $ob->reply (undef, "Sorry, you can't shutdown the server.")
8 unless $ob->flag (cf::FLAG_WIZ);
9
10 my $name = $ob->name;
11 cf::cleanup ("dm '$name' initiated shutdown" . ($arg ? " with reason: $arg" : "."), 0);
12
13 1
14};
15
16cf::register_command kick => sub {
17 my ($ob, $arg) = @_;
18 return unless $ob->flag (cf::FLAG_WIZ);
19
20 my $other = cf::player::find_active $arg
21 or return 0;
22 $other->kick ($ob);
23 $ob->reply (undef, "$arg is kicked out of the game.", cf::NDI_UNIQUE | cf::NDI_ALL | cf::NDI_RED);
24
25 1
26};
4 27
5cf::register_command goto => sub { 28cf::register_command goto => sub {
6 my ($ob, $arg) = @_; 29 my ($ob, $arg) = @_;
7 30
8 return unless $ob->may ("command_goto"); 31 return unless $ob->may ("command_goto");
18 my ($ob, $arg) = @_; 41 my ($ob, $arg) = @_;
19 42
20 return unless $ob->may ("command_teleport"); 43 return unless $ob->may ("command_teleport");
21 44
22 cf::async { 45 cf::async {
46 $Coro::current->{desc} = "teleport $arg";
47
23 my $other = cf::player::find $arg 48 my $other = cf::player::find $arg
24 or return $ob->reply (undef, "$arg: no such player."); 49 or return $ob->reply (undef, "$arg: no such player.");
25 50
26 $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y); 51 $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y);
27 }; 52 };
68cf::register_command wizlook => sub { 93cf::register_command wizlook => sub {
69 my ($ob, $arg) = @_; 94 my ($ob, $arg) = @_;
70 95
71 return unless $ob->may ("command_wizlook"); 96 return unless $ob->may ("command_wizlook");
72 97
73 $ob->clear_los; 98 $ob->contr->clear_los;
74 99
75 $ob->reply (undef, "You can temporarily see through walls."); 100 $ob->reply (undef, "You can temporarily see through walls.");
76 101
77 1 102 1
78}; 103};
86 111
87 my @pl = $map->players; 112 my @pl = $map->players;
88 $_->enter_link for @pl; 113 $_->enter_link for @pl;
89 cf::async { 114 cf::async {
90 my $name = $map->visible_name; 115 my $name = $map->visible_name;
116 $Coro::current->{desc} = "reset $name";
91 117
92 $map->reset; 118 $map->reset;
93 $_->leave_link for @pl; 119 $_->leave_link for @pl;
94 120
95 $ob->reply (undef, "$name was reset."); 121 $ob->reply (undef, "$name was reset.");
96 }; 122 };
97 123
98 1 124 1
99}; 125};
100 126
127cf::register_command observe => sub {
128 my ($ob, $arg) = @_;
129
130 return unless $ob->may ("command_observe");
131
132 my $other = cf::player::find_active $arg;
133 $ob->contr->set_observe ($other ? $other->ob : undef);
134
135 1
136};
137
101for my $command (qw(summon arrest kick banish)) { 138for my $command (qw(summon arrest banish)) {
102 my $method = "command_$command"; 139 my $method = "command_$command";
103 140
104 cf::register_command $command => sub { 141 cf::register_command $command => sub {
105 my ($ob, $arg) = @_; 142 my ($ob, $arg) = @_;
106 143

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines