… | |
… | |
4 | |
4 | |
5 | my %apartment = ( |
5 | my %apartment = ( |
6 | "/scorn/apartment/apartments" => [ 1, "scorn", "skorn"], |
6 | "/scorn/apartment/apartments" => [ 1, "scorn", "skorn"], |
7 | "/santo_dominion/sdomino_appartment" => [ 10, "santo dominion", "domino"], |
7 | "/santo_dominion/sdomino_appartment" => [ 10, "santo dominion", "domino"], |
8 | "/darcap/darcap/apartment" => [ 30, "darcap", "thecap"], |
8 | "/darcap/darcap/apartment" => [ 30, "darcap", "thecap"], |
|
|
9 | "/celvear_port/tower2/tower2" => [ 100, "celvear port", "kevlar"], |
9 | "/navar_city/apartments/apartment" => [ 250, "navar", "navar"], |
10 | "/navar_city/apartments/apartment" => [ 250, "navar", "navar"], |
10 | "/azumauindo/ranbounagisatoshi/apartments/sapartment" => [ 100, "乱暴渚都市", "benjo"], |
11 | "/azumauindo/ranbounagisatoshi/apartments/sapartment" => [ 100, "乱暴渚都市", "benjo"], |
11 | "/azumauindo/suno-yamatoshi/apartments/lapartment1" => [ 1000, "スノー大和島根", "sama"], |
12 | "/azumauindo/suno-yamatoshi/apartments/lapartment1" => [ 1000, "スノー大和島根", "sama"], |
|
|
13 | "/elmex/jeweler/jeweler_inn_upper" => [ 500, "jeweler town", "jewelor"], |
12 | "/pup_land/nurnberg/apartment/main" => [ 300, "nürnberg", "sauerkraut"], |
14 | "/pup_land/nurnberg/apartment/main" => [ 300, "nürnberg", "sauerkraut"], |
|
|
15 | "/lostwages/petapartment" => [ 5000, "lostwages", "losvegas"], |
13 | "/pup_land/lone_town/apartment/groundfloor" => [50000, "lone town", "looney"], |
16 | "/pup_land/lone_town/apartment/groundfloor" => [50000, "lone town", "looney"], |
14 | "/brest/apartments/brest_town_house" => [30000, "brest", "brecht"], |
17 | "/brest/apartments/brest_town_house" => [30000, "brest", "brecht"], |
15 | ); |
18 | ); |
16 | |
19 | |
17 | # we have to special case some special cases :) |
20 | # we have to special case some special cases :) |
… | |
… | |
44 | $pl->{rent}{balance} += $offline + $online; |
47 | $pl->{rent}{balance} += $offline + $online; |
45 | } |
48 | } |
46 | |
49 | |
47 | sub pay_balance { |
50 | sub pay_balance { |
48 | my ($pl) = @_; |
51 | my ($pl) = @_; |
|
|
52 | |
|
|
53 | cf::cede_to_tick; |
49 | |
54 | |
50 | update_balance $pl; |
55 | update_balance $pl; |
51 | |
56 | |
52 | return unless $pl->{rent}{balance} > 0; |
57 | return unless $pl->{rent}{balance} > 0; |
53 | |
58 | |
… | |
… | |
89 | my ($pl, $types) = @_; |
94 | my ($pl, $types) = @_; |
90 | |
95 | |
91 | while (my ($k, $v) = each %apartment) { |
96 | while (my ($k, $v) = each %apartment) { |
92 | my $type = exists $pl->{rent}{apartment}{$k} ? 1 : 2; |
97 | my $type = exists $pl->{rent}{apartment}{$k} ? 1 : 2; |
93 | |
98 | |
94 | $pl->ob->reply (undef, "model \"$v->[2]\", situated in $v->[1] (" |
99 | $pl->ob->reply (undef, "model \"$v->[2]\", located in $v->[1] (" |
95 | . (cf::cost_string_from_value $v->[0]) . "/hr)\n") |
100 | . (cf::cost_string_from_value $v->[0]) . "/hr)\n") |
96 | if $type & $types; |
101 | if $type & $types; |
97 | } |
102 | } |
98 | }; |
103 | }; |
99 | |
104 | |
… | |
… | |
143 | $pl->{rent}{last_offline_check} ||= time; |
148 | $pl->{rent}{last_offline_check} ||= time; |
144 | |
149 | |
145 | if ($pl->{rent}{last_online_check}) { |
150 | if ($pl->{rent}{last_online_check}) { |
146 | $pl->{rent}{last_online_check} = time |
151 | $pl->{rent}{last_online_check} = time |
147 | - List::Util::min 3600, |
152 | - List::Util::min 3600, |
148 | $pl->ob->get_ob_key_value ("schmorplog_last_save") - $pl->{rent}{last_online_check}; |
153 | $pl->ob->kv_get ("schmorplog_last_save") - $pl->{rent}{last_online_check}; |
149 | } else { |
154 | } else { |
150 | $pl->{rent}{last_online_check} = time; |
155 | $pl->{rent}{last_online_check} = time; |
151 | } |
156 | } |
152 | |
157 | |
153 | update_balance $pl; |
158 | update_balance $pl; |
… | |
… | |
175 | |
180 | |
176 | return; |
181 | return; |
177 | } |
182 | } |
178 | } |
183 | } |
179 | |
184 | |
180 | $pl->ob->reply (undef, "Your highness, you have to rent this apartment in The Apartment Shop in Scorn first!"); |
185 | $pl->ob->reply (undef, "Your highness, you have to rent this apartment in The Apartment Shop in Scorn or other apartment shops first!"); |
181 | reject_entry $pl; |
186 | reject_entry $pl; |
182 | } |
187 | } |
183 | }, |
188 | }, |
184 | ; |
189 | ; |
185 | |
190 | |
186 | our $RENT_TIMER = Event->timer ( |
191 | our $RENT_TIMER = cf::periodic 3600, Coro::unblock_sub { |
187 | reentrant => 0, |
|
|
188 | after => 60, |
|
|
189 | interval => 3600, |
|
|
190 | data => cf::WF_AUTOCANCEL, |
|
|
191 | cb => sub { |
|
|
192 | pay_balance $_ for cf::player::list; |
192 | pay_balance $_ for cf::player::list; |
193 | }, |
193 | }; |
194 | ); |
|
|
195 | |
194 | |