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.2 by root, Mon Jan 1 13:31:47 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 {
66 $ob->reply (undef, "You can temporarily see through walls."); 87 $ob->reply (undef, "You can temporarily see through walls.");
67 88
68 1 89 1
69}; 90};
70 91
71cf::register_command maps => sub {
72 my ($ob, $arg) = @_;
73
74 no re 'eval'; $arg = qr<$arg>;
75
76 my $format = "%2s %2s %-30.30s\n";
77
78 my $msg = sprintf $format, "Pl", "Fl", "Reset", "Name";
79
80 for (sort keys %cf::MAP) {
81 my $map = $cf::MAP{$_}
82 or next;
83
84 $msg
85 }
86
87 1
88};
89
90cf::register_command reset => sub { 92cf::register_command reset => sub {
91 my ($ob, $arg) = @_; 93 my ($ob, $arg) = @_;
92 94
93 return unless $ob->may ("command_reset"); 95 return unless $ob->may ("command_reset");
94 96
95 $ob->reply (undef, "You can temporarily see through walls."); 97 my $map = $ob->map;
98
99 my @pl = $map->players;
100 $_->enter_link for @pl;
101 cf::async {
102 my $name = $map->visible_name;
103
104 $map->reset;
105 $_->leave_link for @pl;
106
107 $ob->reply (undef, "$name was reset.");
108 };
96 109
97 1 110 1
98}; 111};
99 112
100for my $command (qw(teleport summon arrest kick banish)) { 113for my $command (qw(summon arrest banish)) {
101 my $method = "command_$command"; 114 my $method = "command_$command";
102 115
103 cf::register_command $command => sub { 116 cf::register_command $command => sub {
104 my ($ob, $arg) = @_; 117 my ($ob, $arg) = @_;
105 118

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines