--- deliantra/server/ext/schmorp-neko.ext 2007/09/30 16:24:30 1.7 +++ deliantra/server/ext/schmorp-neko.ext 2010/04/22 12:50:24 1.9 @@ -2,24 +2,10 @@ # archetype nekosan -sub teleport { - my ($pl, $map, $x, $y) = @_; - - my $portal = cf::object::new "exit"; - - $portal->slaying ($map); - $portal->stats->hp ($x); - $portal->stats->sp ($y); - - $portal->apply ($pl); - - $portal->destroy; -} - sub find_target_player { my ($obj) = @_; - my ($time, $pl) = (time + 120, undef); + my ($time, $pl) = (AE::now + 120, undef); for (map $_->ob, cf::player::list) { next unless $obj->on_same_map_as ($_); @@ -42,13 +28,13 @@ if ($d < 1.5) { if (grep $_->type == cf::FORCE && $_->slaying eq "schmorp-neko-gave-fish", $pl->inv) { # she likes us! - if ($pl->{neko_next_pester} < time) { - $pl->{neko_next_pester} = time + 120 + rand 300; + if ($pl->{neko_next_pester} < AE::now) { + $pl->{neko_next_pester} = AE::now + 120 + cf::rndm 300; $pl->message ("Purr. (Purr)"); } - if ($pl->{neko_next_cast} < time) { - $pl->{neko_next_cast} = time + 40 + rand 60; + if ($pl->{neko_next_cast} < AE::now) { + $pl->{neko_next_cast} = AE::now + 40 + cf::rndm 60; # so heal her my $spell = cf::object::new "spell_heal"; @@ -86,8 +72,8 @@ } else { # pester user - if ($pl->{neko_next_pester} < time) { - $pl->{neko_next_pester} = time + 60 + rand 300; + if ($pl->{neko_next_pester} < AE::now) { + $pl->{neko_next_pester} = AE::now + 60 + cf::rndm 300; $pl->message ("Meow. (Please bring me fish)"); } } @@ -107,11 +93,11 @@ my ($self, $hitter) = @_; if ($hitter->type == cf::PLAYER) { - if ($hitter->{neko_last_attack} < time - 300) { + if ($hitter->{neko_last_attack} < AE::now - 300) { $hitter->{neko_attack} = 0; } - $hitter->{neko_last_attack} = time; + $hitter->{neko_last_attack} = AE::now; $hitter->{neko_attack}++ or ext::irc::do_notice "Neko-san was attacked by ". $hitter->name . "!\n"; @@ -121,7 +107,7 @@ if ($hitter->{neko_attack} > 512) { $hitter->{neko_attack} -= 128; $hitter->message ("Neko-san is suddenly gone!"); - teleport $hitter, "/scorn/misc/scorn_illusions", 15, 7; + $hitter->goto ("/scorn/misc/scorn_illusions", 15, 7); $hitter->message ("You hear strange noises all around you..."); $hitter->message ("You feel dumb."); }