ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/invite.ext
(Generate patch)

Comparing deliantra/server/ext/invite.ext (file contents):
Revision 1.2 by root, Sun Jan 7 02:39:14 2007 UTC vs.
Revision 1.3 by root, Sun Feb 11 02:25:25 2007 UTC

1#! perl 1#! perl
2
3# implement the invite command
2 4
3# level 1: invite to private rooms only ~lvl 10 5# level 1: invite to private rooms only ~lvl 10
4# level 2: private rooms and saving maps (guilds, some other public saving maps) 6# level 2: private rooms and saving maps (guilds, some other public saving maps)
5# level 3: invite everywhere where no monsters are on the map 7# level 3: invite everywhere where no monsters are on the map
6# level 4: invite everywhere 8# level 4: invite everywhere
7 9
8# implement a 'follow' command 10my $TIMEOUT = $cf::CFG{invite_timeout} || 60;
9
10my $TIMEOUT = 60;
11 11
12# determine whether map cell is damned 12# determine whether map cell is damned
13sub is_damned { 13sub is_damned {
14 my ($map, $x, $y) = @_; 14 my ($map, $x, $y) = @_;
15 return grep $_->flag (cf::FLAG_DAMNED), $map->at ($x, $y); 15 return grep $_->flag (cf::FLAG_DAMNED), $map->at ($x, $y);
37 if grep $_->flag (cf::FLAG_MONSTER), 37 if grep $_->flag (cf::FLAG_MONSTER),
38 $map->at ($x, $y); 38 $map->at ($x, $y);
39 } 39 }
40 } 40 }
41 41
42 my $path = $map->path; 42 if ($map->path =~ /^~/) {
43 my $player = sprintf "%s/%s/", cf::localdir, cf::playerdir;
44
45 if ($player eq substr $path, 0, length $player) {
46 1 43 1
47 } elsif (grep $_->flag (cf::FLAG_UNIQUE) && $_->flag (cf::FLAG_IS_FLOOR), $map->at ($x, $y)) { 44 } elsif (grep $_->flag (cf::FLAG_UNIQUE) && $_->flag (cf::FLAG_IS_FLOOR), $map->at ($x, $y)) {
48 2 45 2
49 } else { 46 } else {
50 3 47 3
76 73
77 if (is_damned ($map, $x, $y)) { 74 if (is_damned ($map, $x, $y)) {
78 $who->message ("Your god isn't present here, you can't invite someone to unholy ground."); 75 $who->message ("Your god isn't present here, you can't invite someone to unholy ground.");
79 } elsif ($plevel >= $mlevel) { 76 } elsif ($plevel >= $mlevel) {
80 if (my $other = cf::player::find_active $args) { 77 if (my $other = cf::player::find_active $args) {
81 $who->message ("inviting player '$args', to cancel, type: 'invite or wait $TIMEOUT seconds"); 78 $who->message ("inviting player '$args', to cancel, use invite with no arguments or wait $TIMEOUT seconds");
82 $other->ob->message ("$name invites you to $maplevel[$mlevel], to accept, use 'accept-invitation $name"); 79 $other->ob->message ("$name invites you to $maplevel[$mlevel], to accept, use 'accept-invitation $name");
83 $invite{$name}{$args} = [time + $TIMEOUT, $map, $x, $y]; 80 $invite{$name}{$args} = [time + $TIMEOUT, $map, $x, $y];
84 } else { 81 } else {
85 $who->message ("cannot invite '$args': no such player"); 82 $who->message ("cannot invite '$args': no such player");
86 } 83 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines