--- deliantra/server/ext/rent.ext 2007/06/17 13:56:09 1.9 +++ deliantra/server/ext/rent.ext 2007/11/14 08:09:46 1.12 @@ -47,6 +47,8 @@ sub pay_balance { my ($pl) = @_; + cf::cede_to_tick; + update_balance $pl; return unless $pl->{rent}{balance} > 0; @@ -59,10 +61,10 @@ cf::db_put rent => balance => $deduct + cf::db_get rent => "balance"; $pl->ob->{bank_balance} -= $deduct; $pl->{rent}{balance} -= $deduct; - $pl->ob->reply (undef, "Something whispers into your ear:\n" + $pl->ob->reply (undef, "Something whispers into your ear: " . "Your highness, we deducted your apartment rent ($deduct_string) from your bank account."); } else { - $pl->ob->reply (undef, "Something whispers into your ear:\n" + $pl->ob->reply (undef, "Something whispers into your ear: " . "Your highness, we want to deduct the apartment rent ($deduct_string), but the bank informed us that they cannot perform the transaction. " . "Please even out your balance so we can deduct the fees, otherwise we will be forced to shut down your access to the apartment."); } @@ -92,7 +94,7 @@ my $type = exists $pl->{rent}{apartment}{$k} ? 1 : 2; $pl->ob->reply (undef, "model \"$v->[2]\", situated in $v->[1] (" - . (cf::cost_string_from_value $v->[0]) . "/hr)") + . (cf::cost_string_from_value $v->[0]) . "/hr)\n") if $type & $types; } }; @@ -183,13 +185,7 @@ }, ; -our $RENT_TIMER = Event->timer ( - reentrant => 0, - after => 60, - interval => 3600, - data => cf::WF_AUTOCANCEL, - cb => sub { - pay_balance $_ for cf::player::list; - }, -); +our $RENT_TIMER = cf::periodic 3600, Coro::unblock_sub { + pay_balance $_ for cf::player::list; +};