… | |
… | |
3 | # wizard commands |
3 | # wizard commands |
4 | |
4 | |
5 | cf::register_command goto => 0, sub { |
5 | cf::register_command goto => 0, sub { |
6 | my ($ob, $arg) = @_; |
6 | my ($ob, $arg) = @_; |
7 | |
7 | |
8 | return unless $ob->flag (cf::FLAG_WIZ) || $cf::CFG{nopriv_goto}; |
8 | return unless $ob->may ("command_goto"); |
9 | |
9 | |
10 | my $portal = cf::object::new "exit"; |
10 | my $portal = cf::object::new "exit"; |
11 | |
11 | |
12 | $portal->slaying ($arg); |
12 | $portal->slaying ($arg); |
13 | $portal->stats->hp (0); #todo#improve |
13 | $portal->stats->hp (0); |
14 | $portal->stats->sp (0); |
14 | $portal->stats->sp (0); |
15 | |
15 | |
16 | $portal->apply ($ob); |
16 | $portal->apply ($ob); |
17 | |
17 | |
18 | $portal->free; |
18 | $portal->free; |
19 | }; |
19 | }; |
20 | |
20 | |
|
|
21 | cf::register_command wizpass => 0, sub { |
|
|
22 | my ($ob, $arg) = @_; |
|
|
23 | |
|
|
24 | return unless $ob->may ("command_wizpass"); |
|
|
25 | |
|
|
26 | my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZPASS); |
|
|
27 | |
|
|
28 | $ob->flag (cf::FLAG_WIZPASS, $new_val); |
|
|
29 | |
|
|
30 | $ob->reply (undef, |
|
|
31 | $new_val |
|
|
32 | ? "You will now walk through walls.\n" |
|
|
33 | : "You will now be stopped by walls.\n", |
|
|
34 | ); |
|
|
35 | }; |
|
|
36 | |
|
|
37 | cf::register_command wizcast => 0, sub { |
|
|
38 | my ($ob, $arg) = @_; |
|
|
39 | |
|
|
40 | return unless $ob->may ("command_wizcast"); |
|
|
41 | |
|
|
42 | my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZCAST); |
|
|
43 | |
|
|
44 | $ob->flag (cf::FLAG_WIZCAST, $new_val); |
|
|
45 | |
|
|
46 | $ob->reply (undef, |
|
|
47 | $new_val |
|
|
48 | ? "You can now cast spells anywhere." |
|
|
49 | : "You now cannot cast spells in no-magic areas.", |
|
|
50 | ); |
|
|
51 | }; |
|
|
52 | |
|
|
53 | cf::register_command wizlook => 0, sub { |
|
|
54 | my ($ob, $arg) = @_; |
|
|
55 | |
|
|
56 | return unless $ob->may ("command_wizlook"); |
|
|
57 | |
|
|
58 | $ob->clear_los; |
|
|
59 | |
|
|
60 | $ob->reply (undef, "You can temporarily see through walls."); |
|
|
61 | }; |
|
|
62 | |