… | |
… | |
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 | |