1 | #! perl |
1 | #! perl # mandatory |
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 | }; |
4 | |
15 | |
5 | cf::register_command kick => sub { |
16 | cf::register_command kick => sub { |
6 | my ($ob, $arg) = @_; |
17 | my ($ob, $arg) = @_; |
7 | return unless $ob->flag (cf::FLAG_WIZ); |
18 | return unless $ob->flag (cf::FLAG_WIZ); |
8 | |
19 | |
… | |
… | |
30 | my ($ob, $arg) = @_; |
41 | my ($ob, $arg) = @_; |
31 | |
42 | |
32 | return unless $ob->may ("command_teleport"); |
43 | return unless $ob->may ("command_teleport"); |
33 | |
44 | |
34 | cf::async { |
45 | cf::async { |
|
|
46 | $Coro::current->{desc} = "teleport $arg"; |
|
|
47 | |
35 | my $other = cf::player::find $arg |
48 | my $other = cf::player::find $arg |
36 | or return $ob->reply (undef, "$arg: no such player."); |
49 | or return $ob->reply (undef, "$arg: no such player."); |
37 | |
50 | |
38 | $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y); |
51 | $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y); |
39 | }; |
52 | }; |
… | |
… | |
80 | cf::register_command wizlook => sub { |
93 | cf::register_command wizlook => sub { |
81 | my ($ob, $arg) = @_; |
94 | my ($ob, $arg) = @_; |
82 | |
95 | |
83 | return unless $ob->may ("command_wizlook"); |
96 | return unless $ob->may ("command_wizlook"); |
84 | |
97 | |
85 | $ob->clear_los; |
98 | $ob->contr->clear_los; |
86 | |
99 | |
87 | $ob->reply (undef, "You can temporarily see through walls."); |
100 | $ob->reply (undef, "You can temporarily see through walls."); |
88 | |
101 | |
89 | 1 |
102 | 1 |
90 | }; |
103 | }; |
… | |
… | |
98 | |
111 | |
99 | my @pl = $map->players; |
112 | my @pl = $map->players; |
100 | $_->enter_link for @pl; |
113 | $_->enter_link for @pl; |
101 | cf::async { |
114 | cf::async { |
102 | my $name = $map->visible_name; |
115 | my $name = $map->visible_name; |
|
|
116 | $Coro::current->{desc} = "reset $name"; |
103 | |
117 | |
104 | $map->reset; |
118 | $map->reset; |
105 | $_->leave_link for @pl; |
119 | $_->leave_link for @pl; |
106 | |
120 | |
107 | $ob->reply (undef, "$name was reset."); |
121 | $ob->reply (undef, "$name was reset."); |
108 | }; |
122 | }; |
|
|
123 | |
|
|
124 | 1 |
|
|
125 | }; |
|
|
126 | |
|
|
127 | cf::register_command observe => sub { |
|
|
128 | my ($ob, $arg) = @_; |
|
|
129 | |
|
|
130 | return unless $ob->may ("command_observe"); |
|
|
131 | |
|
|
132 | my $other = cf::player::find_active $arg; |
|
|
133 | $ob->contr->set_observe ($other ? $other->ob : undef); |
109 | |
134 | |
110 | 1 |
135 | 1 |
111 | }; |
136 | }; |
112 | |
137 | |
113 | for my $command (qw(summon arrest banish)) { |
138 | for my $command (qw(summon arrest banish)) { |