--- deliantra/server/ext/invite.ext 2007/01/07 02:39:14 1.2 +++ deliantra/server/ext/invite.ext 2008/05/03 09:30:38 1.4 @@ -1,13 +1,13 @@ #! perl +# implement the invite command + # level 1: invite to private rooms only ~lvl 10 # level 2: private rooms and saving maps (guilds, some other public saving maps) # level 3: invite everywhere where no monsters are on the map # level 4: invite everywhere -# implement a 'follow' command - -my $TIMEOUT = 60; +my $TIMEOUT = $cf::CFG{invite_timeout} || 60; # determine whether map cell is damned sub is_damned { @@ -39,10 +39,7 @@ } } - my $path = $map->path; - my $player = sprintf "%s/%s/", cf::localdir, cf::playerdir; - - if ($player eq substr $path, 0, length $player) { + if ($map->path =~ /^~/) { 1 } elsif (grep $_->flag (cf::FLAG_UNIQUE) && $_->flag (cf::FLAG_IS_FLOOR), $map->at ($x, $y)) { 2 @@ -75,19 +72,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, type: 'invite or wait $TIMEOUT seconds"); + $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]; } 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"); @@ -118,17 +118,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->message ("... and sets you down where $args invited you to."); - } };