ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/dmcommands.ext
Revision: 1.13
Committed: Sun Jan 14 02:10:41 2007 UTC (17 years, 4 months ago) by root
Branch: MAIN
Changes since 1.12: +16 -7 lines
Log Message:
- re-do stupid teleport command. can now teleport to the player even
  if no space is available. can even teleport to logged-out players,
  whatever useful that might be.
- goto now supports x and y destination coordinates as additional arguments.

File Contents

# Content
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 ($path, $x, $y) = split /\s+/, $arg, 3;
11
12 $ob->goto ($path, $x, $y);
13
14 1
15 };
16
17 cf::register_command teleport => sub {
18 my ($ob, $arg) = @_;
19
20 return unless $ob->may ("command_teleport");
21
22 cf::async {
23 my $other = cf::player::find $arg
24 or return $ob->reply ("$arg: no such player.");
25
26 $ob->goto ($other->maplevel, $other->ob->x, $other->ob->y);
27 };
28
29 1
30 };
31
32 cf::register_command wizpass => sub {
33 my ($ob, $arg) = @_;
34
35 return unless $ob->may ("command_wizpass");
36
37 my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZPASS);
38
39 $ob->flag (cf::FLAG_WIZPASS, $new_val);
40
41 $ob->reply (undef,
42 $new_val
43 ? "You will now walk through walls.\n"
44 : "You will now be stopped by walls.\n",
45 );
46
47 1
48 };
49
50 cf::register_command wizcast => sub {
51 my ($ob, $arg) = @_;
52
53 return unless $ob->may ("command_wizcast");
54
55 my $new_val = length $arg ? $arg * 1 : !$ob->flag (cf::FLAG_WIZCAST);
56
57 $ob->flag (cf::FLAG_WIZCAST, $new_val);
58
59 $ob->reply (undef,
60 $new_val
61 ? "You can now cast spells anywhere."
62 : "You now cannot cast spells in no-magic areas.",
63 );
64
65 1
66 };
67
68 cf::register_command wizlook => sub {
69 my ($ob, $arg) = @_;
70
71 return unless $ob->may ("command_wizlook");
72
73 $ob->clear_los;
74
75 $ob->reply (undef, "You can temporarily see through walls.");
76
77 1
78 };
79
80 cf::register_command reset => sub {
81 my ($ob, $arg) = @_;
82
83 return unless $ob->may ("command_reset");
84
85 my $map = $ob->map;
86
87 my @pl = $map->players;
88 $_->enter_link for @pl;
89 cf::async {
90 my $name = $map->visible_name;
91
92 $map->reset;
93 $_->leave_link for @pl;
94
95 $ob->reply (undef, "$name was reset.");
96 };
97
98 1
99 };
100
101 for my $command (qw(summon arrest kick banish)) {
102 my $method = "command_$command";
103
104 cf::register_command $command => sub {
105 my ($ob, $arg) = @_;
106
107 return unless $ob->may ($method);
108
109 $ob->$method ($arg)
110 };
111 }
112