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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines