1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | # wizard commands |
3 | # wizard commands |
4 | |
4 | |
5 | cf::register_command goto => 0, sub { |
5 | cf::register_command goto => sub { |
6 | my ($ob, $arg) = @_; |
6 | my ($ob, $arg) = @_; |
7 | |
7 | |
8 | return unless $ob->may ("command_goto"); |
8 | return unless $ob->may ("command_goto"); |
9 | |
9 | |
10 | my $portal = cf::object::new "exit"; |
10 | my $portal = cf::object::new "exit"; |
… | |
… | |
13 | $portal->stats->hp (0); |
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->destroy; |
19 | |
19 | |
20 | 1 |
20 | 1 |
21 | }; |
21 | }; |
22 | |
22 | |
23 | cf::register_command wizpass => 0, sub { |
23 | cf::register_command wizpass => sub { |
24 | my ($ob, $arg) = @_; |
24 | my ($ob, $arg) = @_; |
25 | |
25 | |
26 | return unless $ob->may ("command_wizpass"); |
26 | return unless $ob->may ("command_wizpass"); |
27 | |
27 | |
28 | my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZPASS); |
28 | my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZPASS); |
… | |
… | |
36 | ); |
36 | ); |
37 | |
37 | |
38 | 1 |
38 | 1 |
39 | }; |
39 | }; |
40 | |
40 | |
41 | cf::register_command wizcast => 0, sub { |
41 | cf::register_command wizcast => sub { |
42 | my ($ob, $arg) = @_; |
42 | my ($ob, $arg) = @_; |
43 | |
43 | |
44 | return unless $ob->may ("command_wizcast"); |
44 | return unless $ob->may ("command_wizcast"); |
45 | |
45 | |
46 | my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZCAST); |
46 | my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZCAST); |
… | |
… | |
54 | ); |
54 | ); |
55 | |
55 | |
56 | 1 |
56 | 1 |
57 | }; |
57 | }; |
58 | |
58 | |
59 | cf::register_command wizlook => 0, sub { |
59 | cf::register_command wizlook => sub { |
60 | my ($ob, $arg) = @_; |
60 | my ($ob, $arg) = @_; |
61 | |
61 | |
62 | return unless $ob->may ("command_wizlook"); |
62 | return unless $ob->may ("command_wizlook"); |
63 | |
63 | |
64 | $ob->clear_los; |
64 | $ob->clear_los; |
… | |
… | |
69 | }; |
69 | }; |
70 | |
70 | |
71 | for my $command (qw(reset teleport summon arrest kick banish)) { |
71 | for my $command (qw(reset teleport summon arrest kick banish)) { |
72 | my $method = "command_$command"; |
72 | my $method = "command_$command"; |
73 | |
73 | |
74 | cf::register_command $command => 0, sub { |
74 | cf::register_command $command => sub { |
75 | my ($ob, $arg) = @_; |
75 | my ($ob, $arg) = @_; |
76 | |
76 | |
77 | return unless $ob->may ($method); |
77 | return unless $ob->may ($method); |
78 | |
78 | |
79 | $ob->$method ($arg) |
79 | $ob->$method ($arg) |