summaryrefslogtreecommitdiff
path: root/npc/012-8/doorbell.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/012-8/doorbell.txt')
-rw-r--r--npc/012-8/doorbell.txt19
1 files changed, 10 insertions, 9 deletions
diff --git a/npc/012-8/doorbell.txt b/npc/012-8/doorbell.txt
index 51218685e..ad3a9d4d9 100644
--- a/npc/012-8/doorbell.txt
+++ b/npc/012-8/doorbell.txt
@@ -10,7 +10,7 @@
// ID: 1
// $ESTATE_OWNER[.id] → Account ID owner of the Real Estate
// $ESTATE_OWNERNAME$[.id] → Human readable name of Real Estate owner
-// $ESTATE_RENTTIME → When the rent will expire
+// $ESTATE_RENTTIME[.id] → When the rent will expire
// $ESTATE_MOBILIA_2[.id] → Bitmask of mobilia currently purchased on Yellow Collision (4)
// $ESTATE_MOBILIA_4[.id] → Bitmask of mobilia currently purchased on Air Collision (2)
// $ESTATE_MOBILIA_8[.id] → Bitmask of mobilia currently purchased on Water Collision (3)
@@ -106,7 +106,6 @@ L_Furniture:
mesc ".:: "+ l("Furniture Menu") + " ::.";
.@gp=REAL_ESTATE_CREDITS+Zeny;
- .@dl=$ESTATE_RENTTIME[.id]/(60*60*24);
mesc l("Total Credits and GP: @@", format_number(.@gp));
next;
@@ -126,20 +125,20 @@ L_Furniture:
case 2:
mesc l("Beds"), 3;
@re_col=1; // Collision layer to look up
- @daysleft=$ESTATE_RENTTIME/86400; // Number of days left of rent
+ @daysleft=$ESTATE_RENTTIME[.id]/86400; // Number of days left of rent
.@gp=REAL_ESTATE_CREDITS+Zeny; // How much you have
//@valid_ids=0; // Array of valid entries
deletearray @valid_ids;
for (.@i=0; .@i < getarraysize(.layer); .@i++) {
- debugmes "Found object ID %d named %s on layer %s coords (%d,%d) - Looking for layer %d", .@i, .name$[.@i], .layer[.@i], .x1[.@i], .y1[.@i], @re_col;
+ //debugmes "Found object ID %d named %s on layer %s coords (%d,%d) - Looking for layer %d", .@i, .name$[.@i], .layer[.@i], .x1[.@i], .y1[.@i], @re_col;
if (.layer[.@i] == @re_col) {
// We have a valid object
// So we can populate a second array?
// Allow to buy/sell and also setcells with params
// Maybe an htable would work better (name$, .@id)
array_push(@valid_ids, .@i);
- debugmes "Pushing";
+ //debugmes "Pushing";
}
}
debugmes "Found %d valid objects", getarraysize(@valid_ids);
@@ -149,9 +148,9 @@ L_Furniture:
for (.@j=0; .@j < getarraysize(@valid_ids); .@j++) {
.@i=@valid_ids[.@j];
if ($ESTATE_MOBILIA_2[.id] & .objid[.@i])
- @menuentries$+=("Sell ")+.name$[.@i]+l(" for ") + format_number(.price[.@i]/max(1,60-@daysleft)) +":";
+ @menuentries$+=("Sell ")+.name$[.@i]+l(" for ") + format_number( realestate_sellprice(.id,.price[.@i]) ) +":";
else
- @menuentries$+=("Purchase ")+.name$[.@i]+(" for ") + format_number(.price[.@i])+":";
+ @menuentries$+=("Purchase ")+.name$[.@i]+(" for ") + format_number( .price[.@i] )+":";
}
select (@menuentries$);
mes "";
@@ -162,9 +161,10 @@ L_Furniture:
if ($ESTATE_MOBILIA_2[.id] & .objid[.@id]) {
// If you have the mobilia, you're selling it for Mobiliary Credits
- .@price=.price[.@i]/max(1,60-@daysleft);
+ .@price=realestate_sellprice(.id,.price[.@i]);
$ESTATE_MOBILIA_2[.id]=$ESTATE_MOBILIA_2[.id] ^ .objid[.@id];
REAL_ESTATE_CREDITS+=.@price;
+ delcells realestate_cellname(.id, .@id);
mesc l("Sale successful!");
next;
} else {
@@ -173,7 +173,7 @@ L_Furniture:
if (.@gp > .@price) {
realestate_payment(.@price);
$ESTATE_MOBILIA_2[.id]=$ESTATE_MOBILIA_2[.id] | .objid[.@id];
-
+ setcells .mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], .layer[.@id], realestate_cellname(.id, .@id);
mesc l("Purchase successful!");
next;
} else {
@@ -203,6 +203,7 @@ OnInit:
.id=1; // Estate ID
.delay=15; // Forced wait between rings
.dpost=0; // Last doorbell ring
+ .mapa$="012-8";
// Arrays
// We go element by element on the array building the menu