… | |
… | |
32 | my ($map, $x, $y) = @_; |
32 | my ($map, $x, $y) = @_; |
33 | |
33 | |
34 | for my $x (0 .. $map->width - 1) { |
34 | for my $x (0 .. $map->width - 1) { |
35 | for my $y (0 .. $map->height - 1) { |
35 | for my $y (0 .. $map->height - 1) { |
36 | return 4 |
36 | return 4 |
37 | if grep $_->flag (cf::FLAG_MONSTER), |
37 | if grep $_->flag (cf::FLAG_MONSTER) |
|
|
38 | && !$_->flag (cf::FLAG_FRIENDLY) |
|
|
39 | && !$_->flag (cf::FLAG_UNAGGRESSIVE), |
38 | $map->at ($x, $y); |
40 | $map->at ($x, $y); |
39 | } |
41 | } |
40 | } |
42 | } |
41 | |
43 | |
42 | if ($map->path =~ /^~/) { |
44 | if ($map->path =~ /^~/) { |
… | |
… | |
48 | } |
50 | } |
49 | } |
51 | } |
50 | |
52 | |
51 | my @maplevel = ( |
53 | my @maplevel = ( |
52 | "some mysterious hideout", |
54 | "some mysterious hideout", |
53 | "his home", |
55 | "a private apartment", |
54 | "his guild", # wrong, this is any unique place !player-specific |
56 | "a guild", # wrong, this is any unique place !player-specific |
55 | "a nice place", |
57 | "some nice and safe place", |
56 | "a place with monsters", |
58 | "a place with monsters", |
57 | ); |
59 | ); |
58 | |
60 | |
59 | my %invite; |
61 | my %invite; |
60 | |
62 | |
… | |
… | |
75 | $who->message ("Your god isn't present here, you can't invite someone to unholy ground. " |
77 | $who->message ("Your god isn't present here, you can't invite someone to unholy ground. " |
76 | . "H<You can only use invite at places where you can use prayers.>"); |
78 | . "H<You can only use invite at places where you can use prayers.>"); |
77 | } elsif ($plevel >= $mlevel) { |
79 | } elsif ($plevel >= $mlevel) { |
78 | if (my $other = cf::player::find_active $args) { |
80 | if (my $other = cf::player::find_active $args) { |
79 | $who->message ("inviting player '$args', to cancel, use invite with no arguments or wait $TIMEOUT seconds"); |
81 | $who->message ("inviting player '$args', to cancel, use invite with no arguments or wait $TIMEOUT seconds"); |
80 | $other->ob->message ("$name invites you to $maplevel[$mlevel], to accept, use 'accept-invitation $name"); |
82 | $other->ob->message ("$name invites you to $maplevel[$mlevel], to accept, use C<accept-invitation $name> (or C<a-i $name>)"); |
81 | $invite{$name}{$args} = [time + $TIMEOUT, $map, $x, $y]; |
83 | $invite{$name}{$args} = [time + $TIMEOUT, $map, $x, $y]; |
82 | } else { |
84 | } else { |
83 | $who->message ("cannot invite '$args': no such player"); |
85 | $who->message ("cannot invite '$args': no such player"); |
84 | } |
86 | } |
85 | } elsif ($plevel) { |
87 | } elsif ($plevel) { |
… | |
… | |
112 | $who->message ("Sorry, $args\'s invitation has expired. " |
114 | $who->message ("Sorry, $args\'s invitation has expired. " |
113 | . "H<Invites are only valid for $TIMEOUT seconds, ask $args to invite you again.>"); |
115 | . "H<Invites are only valid for $TIMEOUT seconds, ask $args to invite you again.>"); |
114 | } else { |
116 | } else { |
115 | my $inv = delete $invite{$args}{$name}; |
117 | my $inv = delete $invite{$args}{$name}; |
116 | $who->message ("A godly force starts to pull you up..."); |
118 | $who->message ("A godly force starts to pull you up..."); |
117 | $who->goto ($inv->[1,2,3]); |
119 | $who->goto (@$inv[1,2,3]); |
118 | $who->message ("... and sets you down where $args invited you to."); |
120 | $who->message ("... and sets you down where $args invited you to."); |
119 | } |
121 | } |
120 | }; |
122 | }; |
121 | |
123 | |