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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines