--- deliantra/server/ext/rent.ext 2006/12/15 19:29:18 1.1 +++ deliantra/server/ext/rent.ext 2007/01/04 18:39:14 1.4 @@ -14,29 +14,16 @@ "/brest/apartments/brest_town_house" => [30000, "brest", "brecht"], ); -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->ob); - $portal->destroy; -} - # we have to special case some special cases :) sub reject_entry { my ($pl) = @_; cf::override; - teleport $pl, "/world/world_105_115", 2, 34 + $pl->goto_map ("/world/world_105_115", 2, 34) unless $pl->ob->map - && $pl->ob->map->path !~ /nimbus/ - && $pl->ob->map->path !~ m%/var/crossfire/players/%; + && !$pl->ob->map->{path}{user_rel}; } sub update_balance { @@ -150,7 +137,8 @@ $pl->ob->reply (undef, "I am sorry to hear that, we will immediately stop charging you for your apartment, of course."); }; -cf::attach_to_players prio => 100, +cf::player->attach ( + prio => 100, on_login => sub { my ($pl) = @_; @@ -165,9 +153,10 @@ } update_balance $pl; - }; + }, +); -cf::register_map_attachment rent => +cf::map::attachment rent => on_enter => sub { my ($map, $pl, $x, $y) = @_; @@ -201,7 +190,7 @@ }, ; -Event->timer (after => 60, interval => 3600, data => cf::WF_AUTOCANCEL, cb => sub { +our $RENT_TIMER = Event->timer (after => 60, interval => 3600, data => cf::WF_AUTOCANCEL, cb => sub { pay_balance $_ for cf::player::list; });