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.11 by root, Fri Jan 5 20:04:02 2007 UTC vs.
Revision 1.20 by root, Sun Jun 3 17:05:35 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");
9 32
10 my $portal = cf::object::new "exit"; 33 my ($path, $x, $y) = split /\s+/, $arg, 3;
11 34
12 $portal->slaying ($arg); 35 $ob->goto ($path, $x, $y);
13 $portal->stats->hp (0);
14 $portal->stats->sp (0);
15 36
16 $portal->apply ($ob); 37 1
38};
17 39
18 $portal->destroy; 40cf::register_command teleport => sub {
41 my ($ob, $arg) = @_;
42
43 return unless $ob->may ("command_teleport");
44
45 cf::async {
46 my $other = cf::player::find $arg
47 or return $ob->reply (undef, "$arg: no such player.");
48
49 $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y);
50 };
19 51
20 1 52 1
21}; 53};
22 54
23cf::register_command wizpass => sub { 55cf::register_command wizpass => sub {
76 my $map = $ob->map; 108 my $map = $ob->map;
77 109
78 my @pl = $map->players; 110 my @pl = $map->players;
79 $_->enter_link for @pl; 111 $_->enter_link for @pl;
80 cf::async { 112 cf::async {
81 my $name = $map->{path}->as_string; 113 my $name = $map->visible_name;
82 114
83 $map->reset; 115 $map->reset;
84 $_->leave_link for @pl; 116 $_->leave_link for @pl;
85 117
86 $ob->reply (undef, "$name was reset."); 118 $ob->reply (undef, "$name was reset.");
87 }; 119 };
88 120
89 1 121 1
90}; 122};
91 123
124cf::register_command observe => sub {
125 my ($ob, $arg) = @_;
126
127 return unless $ob->may ("command_observe");
128
129 my $other = cf::player::find_active $arg;
130 $ob->contr->set_observe ($other ? $other->ob : undef);
131
132 1
133};
134
92for my $command (qw(teleport summon arrest kick banish)) { 135for my $command (qw(summon arrest banish)) {
93 my $method = "command_$command"; 136 my $method = "command_$command";
94 137
95 cf::register_command $command => sub { 138 cf::register_command $command => sub {
96 my ($ob, $arg) = @_; 139 my ($ob, $arg) = @_;
97 140

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines