1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | # wizard commands |
3 | # wizard commands |
|
|
4 | |
|
|
5 | cf::register_command shutdown => sub { |
|
|
6 | my ($ob, $arg) = @_; |
|
|
7 | return $ob->reply (undef, "Sorry, you can't shutdown the server.") |
|
|
8 | unless $ob->flag (cf::FLAG_WIZ); |
|
|
9 | |
|
|
10 | my $name = $ob->name; |
|
|
11 | cf::cleanup ("dm '$name' initiated shutdown" . ($arg ? " with reason: $arg" : "."), 0); |
|
|
12 | |
|
|
13 | 1 |
|
|
14 | }; |
|
|
15 | |
|
|
16 | cf::register_command kick => sub { |
|
|
17 | my ($ob, $arg) = @_; |
|
|
18 | return unless $ob->flag (cf::FLAG_WIZ); |
|
|
19 | |
|
|
20 | my $other = cf::player::find_active $arg |
|
|
21 | or return 0; |
|
|
22 | $other->kick ($ob); |
|
|
23 | $ob->reply (undef, "$arg is kicked out of the game.", cf::NDI_UNIQUE | cf::NDI_ALL | cf::NDI_RED); |
|
|
24 | |
|
|
25 | 1 |
|
|
26 | }; |
4 | |
27 | |
5 | cf::register_command goto => sub { |
28 | cf::register_command goto => sub { |
6 | my ($ob, $arg) = @_; |
29 | my ($ob, $arg) = @_; |
7 | |
30 | |
8 | return unless $ob->may ("command_goto"); |
31 | return unless $ob->may ("command_goto"); |
… | |
… | |
96 | }; |
119 | }; |
97 | |
120 | |
98 | 1 |
121 | 1 |
99 | }; |
122 | }; |
100 | |
123 | |
101 | for my $command (qw(summon arrest kick banish)) { |
124 | for my $command (qw(summon arrest banish)) { |
102 | my $method = "command_$command"; |
125 | my $method = "command_$command"; |
103 | |
126 | |
104 | cf::register_command $command => sub { |
127 | cf::register_command $command => sub { |
105 | my ($ob, $arg) = @_; |
128 | my ($ob, $arg) = @_; |
106 | |
129 | |