ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/dmcommands.ext
Revision: 1.7
Committed: Tue Jan 2 14:10:23 2007 UTC (17 years, 4 months ago) by root
Branch: MAIN
Changes since 1.6: +0 -1 lines
Log Message:
remove debugging code

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     my $portal = cf::object::new "exit";
11    
12     $portal->slaying ($arg);
13     $portal->stats->hp (0);
14     $portal->stats->sp (0);
15    
16     $portal->apply ($ob);
17    
18     $portal->destroy;
19    
20     1
21     };
22    
23     cf::register_command wizpass => sub {
24     my ($ob, $arg) = @_;
25    
26     return unless $ob->may ("command_wizpass");
27    
28     my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZPASS);
29    
30     $ob->flag (cf::FLAG_WIZPASS, $new_val);
31    
32     $ob->reply (undef,
33     $new_val
34     ? "You will now walk through walls.\n"
35     : "You will now be stopped by walls.\n",
36     );
37    
38     1
39     };
40    
41     cf::register_command wizcast => sub {
42     my ($ob, $arg) = @_;
43    
44     return unless $ob->may ("command_wizcast");
45    
46     my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZCAST);
47    
48     $ob->flag (cf::FLAG_WIZCAST, $new_val);
49    
50     $ob->reply (undef,
51     $new_val
52     ? "You can now cast spells anywhere."
53     : "You now cannot cast spells in no-magic areas.",
54     );
55    
56     1
57     };
58    
59     cf::register_command wizlook => sub {
60     my ($ob, $arg) = @_;
61    
62     return unless $ob->may ("command_wizlook");
63    
64     $ob->clear_los;
65    
66     $ob->reply (undef, "You can temporarily see through walls.");
67    
68     1
69     };
70    
71 root 1.2 cf::register_command reset => sub {
72     my ($ob, $arg) = @_;
73    
74     return unless $ob->may ("command_reset");
75    
76 root 1.4 my $map = $ob->map;
77    
78 root 1.6 my @pl = $map->players;
79     $_->enter_link for @pl;
80 root 1.5 Coro::async {
81 root 1.4 $map->reset;
82     $_->leave_link for @pl;
83 root 1.5
84     $ob->reply (undef, $map->{path}->as_string . " was reset.");
85 root 1.4 };
86    
87 root 1.2 1
88     };
89    
90     for my $command (qw(teleport summon arrest kick banish)) {
91 root 1.1 my $method = "command_$command";
92    
93     cf::register_command $command => sub {
94     my ($ob, $arg) = @_;
95    
96     return unless $ob->may ($method);
97    
98     $ob->$method ($arg)
99     };
100     }
101