… | |
… | |
2 | |
2 | |
3 | use List::Util; |
3 | use List::Util; |
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 | "/navar_city/apartments/apartment" => [ 250, "navar", "navar"], |
9 | "/navar_city/apartments/apartment" => [ 250, "navar", "navar"], |
10 | "/azumauindo/ranbounagisatoshi/apartments/sapartment" => [ 100, "乱暴渚都市", "benjo"], |
10 | "/azumauindo/ranbounagisatoshi/apartments/sapartment" => [ 100, "乱暴渚都市", "benjo"], |
11 | "/azumauindo/suno-yamatoshi/apartments/lapartment1" => [ 1000, "スノー大和島根", "sama"], |
11 | "/azumauindo/suno-yamatoshi/apartments/lapartment1" => [ 1000, "スノー大和島根", "sama"], |
12 | "/pup_land/nurnberg/apartment/main" => [ 300, "nürnberg", "sauerkraut"], |
12 | "/pup_land/nurnberg/apartment/main" => [ 300, "nürnberg", "sauerkraut"], |
13 | "/pup_land/lone_town/apartment/groundfloor" => [50000, "lone town", "looney"], |
13 | "/pup_land/lone_town/apartment/groundfloor" => [50000, "lone town", "looney"], |
14 | "/brest/apartments/brest/town/house" => [30000, "brest", "brecht"], |
14 | "/brest/apartments/brest_town_house" => [30000, "brest", "brecht"], |
15 | ); |
15 | ); |
16 | |
16 | |
17 | sub teleport { |
17 | sub teleport { |
18 | my ($pl, $map, $x, $y) = @_; |
18 | my ($pl, $map, $x, $y) = @_; |
19 | |
19 | |
… | |
… | |
31 | my ($pl) = @_; |
31 | my ($pl) = @_; |
32 | |
32 | |
33 | cf::override; |
33 | cf::override; |
34 | |
34 | |
35 | teleport $pl, "/world/world_105_115", 2, 34 |
35 | teleport $pl, "/world/world_105_115", 2, 34 |
|
|
36 | unless |
|
|
37 | $pl->ob->map |
36 | unless $pl->ob->map && $pl->ob->map->path !~ /nimbus/; |
38 | && $pl->ob->map->path !~ /nimbus/ |
|
|
39 | && $pl->ob->map->path !~ m%/var/crossfire/players/%; |
37 | } |
40 | } |
38 | |
41 | |
39 | sub update_balance { |
42 | sub update_balance { |
40 | my ($pl) = @_; |
43 | my ($pl) = @_; |
41 | |
44 | |
… | |
… | |
146 | $pl->ob->reply (undef, "I am sorry to hear that, we will immediately stop charging you for your apartment, of course."); |
149 | $pl->ob->reply (undef, "I am sorry to hear that, we will immediately stop charging you for your apartment, of course."); |
147 | }; |
150 | }; |
148 | |
151 | |
149 | cf::attach_to_players prio => 100, |
152 | cf::attach_to_players prio => 100, |
150 | on_login => sub { |
153 | on_login => sub { |
151 | return; |
|
|
152 | my ($pl) = @_; |
154 | my ($pl) = @_; |
153 | |
|
|
154 | use Data::Dumper; |
|
|
155 | warn Dumper $pl; |
|
|
156 | |
155 | |
157 | $pl->{rent}{last_offline_check} ||= time; |
156 | $pl->{rent}{last_offline_check} ||= time; |
158 | |
157 | |
159 | if ($pl->{rent}{last_online_check}) { |
158 | if ($pl->{rent}{last_online_check}) { |
160 | $pl->{rent}{last_online_check} = time |
159 | $pl->{rent}{last_online_check} = time |
… | |
… | |
169 | |
168 | |
170 | cf::register_map_attachment rent => |
169 | cf::register_map_attachment rent => |
171 | on_enter => sub { |
170 | on_enter => sub { |
172 | my ($map, $pl, $x, $y) = @_; |
171 | my ($map, $pl, $x, $y) = @_; |
173 | |
172 | |
|
|
173 | # can freely enter homes of other people |
|
|
174 | { |
|
|
175 | my $path = sprintf "%s/%s/%s/", |
|
|
176 | cf::localdir, cf::playerdir, $pl->ob->name; |
|
|
177 | |
|
|
178 | return if $path ne substr $map->path, 0, length $path; |
|
|
179 | } |
|
|
180 | |
174 | for my $path (keys %{ $pl->{rent}{apartment} }) { |
181 | for my $path (keys %{ $pl->{rent}{apartment} }) { |
175 | $path =~ y/\//_/; |
182 | $path =~ y/\//_/; |
176 | $path = sprintf "%s/%s/%s/%s", |
183 | $path = sprintf "%s/%s/%s/%s", |
177 | cf::localdir, cf::playerdir, $pl->ob->name, $path; |
184 | cf::localdir, cf::playerdir, $pl->ob->name, $path; |
178 | |
185 | |