ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/rent.ext
(Generate patch)

Comparing deliantra/server/ext/rent.ext (file contents):
Revision 1.15 by root, Sat Oct 24 11:08:14 2009 UTC vs.
Revision 1.29 by root, Fri Apr 16 02:37:50 2010 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines