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.30 by elmex, Mon Apr 26 12:09:03 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"],
14 "/mlab/mountpermapartment" => [ 400, "st. bartholomew", "barth"],
13 "/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"],
14 "/pup_land/nurnberg/apartment/main" => [ 300, "nürnberg", "sauerkraut"], 17 "/pup_land/nurnberg/apartment/main" => [ 300, "nürnberg", "sauerkraut"],
15 "/lostwages/petapartment" => [ 5000, "lostwages", "losvegas"], 18 "/lostwages/petapartment" => [ 5000, "lostwages", "losvegas"],
19 "/gotischerbereich/towerapartment/tower1" => [10000, "gotisch", "retreat"],
20 "/lake_country/Butakis/apartment" => [25000, "castle butakis", "expandor"],
21 "/brest/apartments/brest_town_house" => [30000, "brest", "brecht"],
16 "/pup_land/lone_town/apartment/groundfloor" => [50000, "lone town", "looney"], 22 "/pup_land/lone_town/apartment/groundfloor" => [50000, "lone town", "looney"],
17 "/brest/apartments/brest_town_house" => [30000, "brest", "brecht"],
18); 23);
19 24
20# we have to special case some special cases :) 25# we have to special case some special cases :)
21sub reject_entry { 26sub reject_entry {
22 my ($pl) = @_; 27 my ($pl) = @_;
94 my ($pl, $types) = @_; 99 my ($pl, $types) = @_;
95 100
96 while (my ($k, $v) = each %apartment) { 101 while (my ($k, $v) = each %apartment) {
97 my $type = exists $pl->{rent}{apartment}{$k} ? 1 : 2; 102 my $type = exists $pl->{rent}{apartment}{$k} ? 1 : 2;
98 103
99 $pl->ob->reply (undef, "model \"$v->[2]\", situated in $v->[1] (" 104 $pl->ob->reply (undef, "model \"$v->[2]\", located in $v->[1] ("
100 . (cf::cost_string_from_value $v->[0]) . "/hr)\n") 105 . (cf::cost_string_from_value $v->[0]) . "/hr)\n")
101 if $type & $types; 106 if $type & $types;
102 } 107 }
103}; 108};
104 109
161 166
162cf::map::attachment rent => 167cf::map::attachment rent =>
163 on_enter => sub { 168 on_enter => sub {
164 my ($map, $pl, $x, $y) = @_; 169 my ($map, $pl, $x, $y) = @_;
165 170
171 return if $pl->ob->flag (cf::FLAG_WIZ);
172
166 my $pfx = sprintf "~%s/", $pl->ob->name; 173 my $pfx = sprintf "~%s/", $pl->ob->name;
167 174
168 # only do something if entering ones own apartment 175 # only do something if entering ones own apartment
169 if ($pfx eq substr $map->path, 0, length $pfx) { 176 if ($pfx eq substr $map->path, 0, length $pfx) {
170 for my $path (keys %{ $pl->{rent}{apartment} }) { 177 for my $path (keys %{ $pl->{rent}{apartment} }) {
172 179
173 if ($map->path eq $path) { 180 if ($map->path eq $path) {
174 if (check_balance $pl) { 181 if (check_balance $pl) {
175 $pl->ob->reply (undef, "Welcome to your apartment, your highness!"); 182 $pl->ob->reply (undef, "Welcome to your apartment, your highness!");
176 } else { 183 } else {
177 $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.");
178 reject_entry $pl; 185 reject_entry $pl;
179 } 186 }
180 187
181 return; 188 return;
182 } 189 }
183 } 190 }
184 191
185 $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!");
186 reject_entry $pl; 193 reject_entry $pl;
187 } 194 }
188 }, 195 },
189; 196;
190 197

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines