… | |
… | |
75 | $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. " |
76 | . "H<You can only use invite at places where you can use prayers.>"); |
76 | . "H<You can only use invite at places where you can use prayers.>"); |
77 | } elsif ($plevel >= $mlevel) { |
77 | } elsif ($plevel >= $mlevel) { |
78 | if (my $other = cf::player::find_active $args) { |
78 | 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"); |
79 | $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"); |
80 | $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]; |
81 | $invite{$name}{$args} = [time + $TIMEOUT, $map, $x, $y]; |
82 | } else { |
82 | } else { |
83 | $who->message ("cannot invite '$args': no such player"); |
83 | $who->message ("cannot invite '$args': no such player"); |
84 | } |
84 | } |
85 | } elsif ($plevel) { |
85 | } elsif ($plevel) { |
… | |
… | |
92 | } else { |
92 | } else { |
93 | $who->message ("canceling all invites"); |
93 | $who->message ("canceling all invites"); |
94 | delete $invite{$name}; |
94 | delete $invite{$name}; |
95 | } |
95 | } |
96 | }; |
96 | }; |
97 | |
|
|
98 | sub teleport { |
|
|
99 | my ($pl, $map, $x, $y) = @_; |
|
|
100 | |
|
|
101 | my $portal = cf::object::new "exit"; |
|
|
102 | |
|
|
103 | $portal->slaying ($map->path); |
|
|
104 | $portal->stats->hp ($x); |
|
|
105 | $portal->stats->sp ($y); |
|
|
106 | |
|
|
107 | $portal->apply ($pl); |
|
|
108 | |
|
|
109 | $portal->destroy; |
|
|
110 | } |
|
|
111 | |
97 | |
112 | cf::register_command "accept-invitation" => sub { |
98 | cf::register_command "accept-invitation" => sub { |
113 | my ($who, $args) = @_; |
99 | my ($who, $args) = @_; |
114 | |
100 | |
115 | $who->speed_left ($who->speed_left - 0.2); |
101 | $who->speed_left ($who->speed_left - 0.2); |
… | |
… | |
126 | $who->message ("Sorry, $args\'s invitation has expired. " |
112 | $who->message ("Sorry, $args\'s invitation has expired. " |
127 | . "H<Invites are only valid for $TIMEOUT seconds, ask $args to invite you again.>"); |
113 | . "H<Invites are only valid for $TIMEOUT seconds, ask $args to invite you again.>"); |
128 | } else { |
114 | } else { |
129 | my $inv = delete $invite{$args}{$name}; |
115 | my $inv = delete $invite{$args}{$name}; |
130 | $who->message ("A godly force starts to pull you up..."); |
116 | $who->message ("A godly force starts to pull you up..."); |
131 | teleport $who, @{$inv}[1,2,3]; |
117 | $who->goto (@$inv[1,2,3]); |
132 | $who->message ("... and sets you down where $args invited you to."); |
118 | $who->message ("... and sets you down where $args invited you to."); |
133 | } |
119 | } |
134 | }; |
120 | }; |
135 | |
121 | |