1 | #! perl |
1 | #! perl |
2 | |
2 | |
3 | use List::Util; |
3 | use List::Util; |
4 | |
4 | |
5 | my %apartment = ( |
5 | our %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 | "/gotischerbereich/steinwandstadt/sapartment1" => [ 100, "steinwandstadt", "konkret"], |
9 | "/gotischerbereich/steinwandstadt/sapartment1" => [ 100, "steinwandstadt", "konkret"], |
10 | "/celvear_port/tower2/tower2" => [ 150, "celvear port", "kevlar"], |
|
|
11 | "/navar_city/apartments/apartment" => [ 250, "navar", "navar"], |
10 | "/navar_city/apartments/apartment" => [ 250, "navar", "navar"], |
|
|
11 | "/celvear_port/tower2/tower2" => [ 300, "celvear port", "kevlar"], |
12 | "/azumauindo/ranbounagisatoshi/apartments/sapartment" => [ 100, "乱暴渚都市", "benjo"], |
12 | "/azumauindo/ranbounagisatoshi/apartments/sapartment" => [ 100, "乱暴渚都市", "benjo"], |
13 | "/azumauindo/suno-yamatoshi/apartments/lapartment1" => [ 1000, "スノー大和島根", "sama"], |
13 | "/azumauindo/suno-yamatoshi/apartments/lapartment1" => [ 1000, "スノー大和島根", "sama"], |
|
|
14 | "/mlab/mountpermapartment" => [ 400, "st. bartholomew", "barth"], |
14 | "/elmex/jeweler/jeweler_inn_upper" => [ 500, "jeweler town", "jewelor"], |
15 | "/valleynoy/jewelertown/jeweler_inn_upper" => [ 500, "jeweler town", "jewelor"], |
|
|
16 | "/heaven/apartment" => [ 1500, "heaven town", "heaven"], |
15 | "/pup_land/nurnberg/apartment/main" => [ 300, "nürnberg", "sauerkraut"], |
17 | "/pup_land/nurnberg/apartment/main" => [ 300, "nürnberg", "sauerkraut"], |
16 | "/lostwages/petapartment" => [ 5000, "lostwages", "losvegas"], |
18 | "/lostwages/petapartment" => [ 5000, "lostwages", "losvegas"], |
17 | "/towerapartment/tower1" => [10000, "gotisch", "risen"], |
19 | "/gotischerbereich/towerapartment/tower1" => [10000, "gotisch", "retreat"], |
|
|
20 | "/lake_country/Butakis/apartment" => [25000, "castle butakis", "expandor"], |
18 | "/brest/apartments/brest_town_house" => [30000, "brest", "brecht"], |
21 | "/brest/apartments/brest_town_house" => [30000, "brest", "brecht"], |
19 | "/pup_land/lone_town/apartment/groundfloor" => [50000, "lone town", "looney"], |
22 | "/pup_land/lone_town/apartment/groundfloor" => [50000, "lone town", "looney"], |
20 | ); |
23 | ); |
21 | |
24 | |
22 | # we have to special case some special cases :) |
25 | # we have to special case some special cases :) |
… | |
… | |
163 | |
166 | |
164 | cf::map::attachment rent => |
167 | cf::map::attachment rent => |
165 | on_enter => sub { |
168 | on_enter => sub { |
166 | my ($map, $pl, $x, $y) = @_; |
169 | my ($map, $pl, $x, $y) = @_; |
167 | |
170 | |
|
|
171 | return if $pl->ob->flag (cf::FLAG_WIZ); |
|
|
172 | |
168 | my $pfx = sprintf "~%s/", $pl->ob->name; |
173 | my $pfx = sprintf "~%s/", $pl->ob->name; |
169 | |
174 | |
170 | # only do something if entering ones own apartment |
175 | # only do something if entering ones own apartment |
171 | if ($pfx eq substr $map->path, 0, length $pfx) { |
176 | if ($pfx eq substr $map->path, 0, length $pfx) { |
172 | for my $path (keys %{ $pl->{rent}{apartment} }) { |
177 | for my $path (keys %{ $pl->{rent}{apartment} }) { |
… | |
… | |
174 | |
179 | |
175 | if ($map->path eq $path) { |
180 | if ($map->path eq $path) { |
176 | if (check_balance $pl) { |
181 | if (check_balance $pl) { |
177 | $pl->ob->reply (undef, "Welcome to your apartment, your highness!"); |
182 | $pl->ob->reply (undef, "Welcome to your apartment, your highness!"); |
178 | } else { |
183 | } else { |
179 | $pl->ob->reply (undef, "We are sorry, your highness, you have to pay your rent first."); |
184 | $pl->failmsg ("We are sorry, your highness, you have to pay your rent first."); |
180 | reject_entry $pl; |
185 | reject_entry $pl; |
181 | } |
186 | } |
182 | |
187 | |
183 | return; |
188 | return; |
184 | } |
189 | } |
185 | } |
190 | } |
186 | |
191 | |
187 | $pl->ob->reply (undef, "Your highness, you have to rent this apartment in The Apartment Shop in Scorn or other apartment shops first!"); |
192 | $pl->failmsg ("Your highness, you have to rent this apartment in The Apartment Shop in Scorn or other apartment shops first!"); |
188 | reject_entry $pl; |
193 | reject_entry $pl; |
189 | } |
194 | } |
190 | }, |
195 | }, |
191 | ; |
196 | ; |
192 | |
197 | |