--- deliantra/server/ext/invite.ext 2007/02/11 02:25:25 1.3 +++ deliantra/server/ext/invite.ext 2012/02/03 03:01:44 1.10 @@ -7,7 +7,7 @@ # level 3: invite everywhere where no monsters are on the map # level 4: invite everywhere -my $TIMEOUT = $cf::CFG{invite_timeout} || 60; +CONF INVITE_TIMEOUT = 60 # determine whether map cell is damned sub is_damned { @@ -34,7 +34,9 @@ for my $x (0 .. $map->width - 1) { for my $y (0 .. $map->height - 1) { return 4 - if grep $_->flag (cf::FLAG_MONSTER), + if grep $_->flag (cf::FLAG_MONSTER) + && !$_->flag (cf::FLAG_FRIENDLY) + && !$_->flag (cf::FLAG_UNAGGRESSIVE), $map->at ($x, $y); } } @@ -50,9 +52,9 @@ my @maplevel = ( "some mysterious hideout", - "his home", - "his guild", # wrong, this is any unique place !player-specific - "a nice place", + "a private apartment", + "a guild", # wrong, this is any unique place !player-specific + "some nice and safe place", "a place with monsters", ); @@ -72,19 +74,22 @@ my $mlevel = map_level $map, $x, $y; if (is_damned ($map, $x, $y)) { - $who->message ("Your god isn't present here, you can't invite someone to unholy ground."); + $who->message ("Your god isn't present here, you can't invite someone to unholy ground. " + . "H"); } elsif ($plevel >= $mlevel) { if (my $other = cf::player::find_active $args) { - $who->message ("inviting player '$args', to cancel, use invite with no arguments or wait $TIMEOUT seconds"); - $other->ob->message ("$name invites you to $maplevel[$mlevel], to accept, use 'accept-invitation $name"); - $invite{$name}{$args} = [time + $TIMEOUT, $map, $x, $y]; + $who->message ("inviting player '$args', to cancel, use invite with no arguments or wait $INVITE_TIMEOUT seconds"); + $other->ob->message ("$name invites you to $maplevel[$mlevel], to accept, use C (or C)"); + $invite{$name}{$args} = [time + $INVITE_TIMEOUT, $map, $x, $y]; } else { $who->message ("cannot invite '$args': no such player"); } } elsif ($plevel) { - $who->message ("Valriel deems you not worthy yet. Gorokh is annoyed by your sacrilege."); + $who->message ("Valriel deems you not worthy yet. Gorokh is annoyed by your sacrilege. " + . "H"); } else { - $who->message ("You haven't proven your worthyness in the mountain maze."); + $who->message ("You haven't proven your worthyness in the mountain maze. " + . "H"); } } else { $who->message ("canceling all invites"); @@ -92,20 +97,6 @@ } }; -sub teleport { - my ($pl, $map, $x, $y) = @_; - - my $portal = cf::object::new "exit"; - - $portal->slaying ($map->path); - $portal->stats->hp ($x); - $portal->stats->sp ($y); - - $portal->apply ($pl); - - $portal->destroy; -} - cf::register_command "accept-invitation" => sub { my ($who, $args) = @_; @@ -115,17 +106,18 @@ my ($map, $x, $y) = ($who->map, $who->x, $who->y); if (is_damned ($map, $x, $y)) { - $who->message ("You can't be invited from a place where your god isn't present."); + $who->message ("You can't be invited from a place where your god isn't present. " + . "H"); } elsif (!exists $invite{$args} || !exists $invite{$args}{$name}) { $who->message ("Sorry, $args hasn't invited you."); } elsif ($invite{$args}{$name}[0] < time) { - $who->message ("Sorry, $args\'s invitation has expired."); + $who->message ("Sorry, $args\'s invitation has expired. " + . "H"); } else { my $inv = delete $invite{$args}{$name}; $who->message ("A godly force starts to pull you up..."); - teleport $who, @{$inv}[1,2,3]; + $who->goto (@$inv[1,2,3]); $who->message ("... and sets you down where $args invited you to."); - } };