ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/dmcommands.ext
Revision: 1.15
Committed: Thu Mar 1 20:17:01 2007 UTC (17 years, 2 months ago) by pippijn
Branch: MAIN
Changes since 1.14: +1 -1 lines
Log Message:
fixed teleporting to broken players

File Contents

# User Rev Content
1 root 1.1 #! perl
2    
3     # wizard commands
4    
5     cf::register_command goto => sub {
6     my ($ob, $arg) = @_;
7    
8     return unless $ob->may ("command_goto");
9    
10 root 1.13 my ($path, $x, $y) = split /\s+/, $arg, 3;
11 root 1.1
12 root 1.13 $ob->goto ($path, $x, $y);
13 root 1.1
14 root 1.13 1
15     };
16    
17     cf::register_command teleport => sub {
18     my ($ob, $arg) = @_;
19 root 1.1
20 root 1.13 return unless $ob->may ("command_teleport");
21    
22     cf::async {
23 pippijn 1.15 my $other = cf::player::find_active $arg
24 pippijn 1.14 or return $ob->reply (undef, "$arg: no such player.");
25 root 1.13
26     $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y);
27     };
28 root 1.1
29     1
30     };
31    
32     cf::register_command wizpass => sub {
33     my ($ob, $arg) = @_;
34    
35     return unless $ob->may ("command_wizpass");
36    
37     my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZPASS);
38    
39     $ob->flag (cf::FLAG_WIZPASS, $new_val);
40    
41     $ob->reply (undef,
42     $new_val
43     ? "You will now walk through walls.\n"
44     : "You will now be stopped by walls.\n",
45     );
46    
47     1
48     };
49    
50     cf::register_command wizcast => sub {
51     my ($ob, $arg) = @_;
52    
53     return unless $ob->may ("command_wizcast");
54    
55     my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZCAST);
56    
57     $ob->flag (cf::FLAG_WIZCAST, $new_val);
58    
59     $ob->reply (undef,
60     $new_val
61     ? "You can now cast spells anywhere."
62     : "You now cannot cast spells in no-magic areas.",
63     );
64    
65     1
66     };
67    
68     cf::register_command wizlook => sub {
69     my ($ob, $arg) = @_;
70    
71     return unless $ob->may ("command_wizlook");
72    
73     $ob->clear_los;
74    
75     $ob->reply (undef, "You can temporarily see through walls.");
76    
77     1
78     };
79    
80 root 1.2 cf::register_command reset => sub {
81     my ($ob, $arg) = @_;
82    
83     return unless $ob->may ("command_reset");
84    
85 root 1.4 my $map = $ob->map;
86    
87 root 1.6 my @pl = $map->players;
88     $_->enter_link for @pl;
89 root 1.11 cf::async {
90 root 1.12 my $name = $map->visible_name;
91 root 1.9
92 root 1.4 $map->reset;
93     $_->leave_link for @pl;
94 root 1.5
95 root 1.9 $ob->reply (undef, "$name was reset.");
96 root 1.4 };
97    
98 root 1.2 1
99     };
100    
101 root 1.13 for my $command (qw(summon arrest kick banish)) {
102 root 1.1 my $method = "command_$command";
103    
104     cf::register_command $command => sub {
105     my ($ob, $arg) = @_;
106    
107     return unless $ob->may ($method);
108    
109     $ob->$method ($arg)
110     };
111     }
112