summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-03-05 01:19:53 -0300
committerJesusaves <cpntb1@ymail.com>2019-03-05 01:19:53 -0300
commitb2c76ecee4b7e25235787f7936317d80a0420d65 (patch)
tree91675618235c4610cdfb4f4c5540203fd72697fa
parent96a4c962d34cbd759746cf932247c7911047ae34 (diff)
downloadserverdata-b2c76ecee4b7e25235787f7936317d80a0420d65.tar.gz
serverdata-b2c76ecee4b7e25235787f7936317d80a0420d65.tar.bz2
serverdata-b2c76ecee4b7e25235787f7936317d80a0420d65.tar.xz
serverdata-b2c76ecee4b7e25235787f7936317d80a0420d65.zip
Preload. More Helpers.
-rw-r--r--npc/012-1/estate.txt6
-rw-r--r--npc/012-8/doorbell.txt126
-rw-r--r--npc/functions/estate.txt31
3 files changed, 111 insertions, 52 deletions
diff --git a/npc/012-1/estate.txt b/npc/012-1/estate.txt
index a457744ec..57f578f1d 100644
--- a/npc/012-1/estate.txt
+++ b/npc/012-1/estate.txt
@@ -8,9 +8,10 @@
// $ESTATE_OWNER[.id] → Account ID owner of the Real Estate
// $ESTATE_OWNERNAME$[.id] → Human readable name of Real Estate owner
// $ESTATE_RENTTIME[.id] → When the rent will expire
-// $ESTATE_MOBILIA_2[.id] → Bitmask of mobilia currently purchased on Yellow Collision (4)
+// $ESTATE_MOBILIA_2[.id] → Bitmask of mobilia currently purchased on Monster Collision (6) (Use on walls only)
// $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)
+// $ESTATE_MOBILIA_32[.id] → Bitmask of mobilia currently purchased on Yellow Collision (4)
// $ESTATE_MOBILIA_64[.id] → Bitmask of mobilia currently purchased on Player Collision (5)
// $ESTATE_MOBILIA_128[.id] → Bitmask of mobilia currently purchased on Normal Collision (1)
// $ESTATE_PASSWORD$[.id] → Password to enter the estate. If it is "", then no password required
@@ -66,6 +67,7 @@ L_RentAvailable:
$ESTATE_MOBILIA_2[.id]=0;
$ESTATE_MOBILIA_4[.id]=0;
$ESTATE_MOBILIA_8[.id]=0;
+ $ESTATE_MOBILIA_32[.id]=0;
$ESTATE_MOBILIA_64[.id]=0;
$ESTATE_MOBILIA_128[.id]=0;
$ESTATE_PASSWORD$[.id]="";
@@ -153,7 +155,7 @@ OnInit:
// Estate Settings
.id=1; // Estate ID
- .price=50000; // Monthly rent price
+ .price=120000; // Monthly rent price
.time=60*60*24*30; // How long last default rent time. In future could consider month.
end;
diff --git a/npc/012-8/doorbell.txt b/npc/012-8/doorbell.txt
index ad3a9d4d9..45722fb3f 100644
--- a/npc/012-8/doorbell.txt
+++ b/npc/012-8/doorbell.txt
@@ -11,9 +11,10 @@
// $ESTATE_OWNER[.id] → Account ID owner of the Real Estate
// $ESTATE_OWNERNAME$[.id] → Human readable name of Real Estate owner
// $ESTATE_RENTTIME[.id] → When the rent will expire
-// $ESTATE_MOBILIA_2[.id] → Bitmask of mobilia currently purchased on Yellow Collision (4)
+// $ESTATE_MOBILIA_2[.id] → Bitmask of mobilia currently purchased on Monster Collision (6) (Use on walls only)
// $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)
+// $ESTATE_MOBILIA_32[.id] → Bitmask of mobilia currently purchased on Yellow Collision (4)
// $ESTATE_MOBILIA_64[.id] → Bitmask of mobilia currently purchased on Player Collision (5)
// $ESTATE_MOBILIA_128[.id] → Bitmask of mobilia currently purchased on Normal Collision (1)
// $ESTATE_PASSWORD$[.id] → Password to enter the estate. If it is "", then no password required
@@ -114,7 +115,7 @@ L_Furniture:
l("Manage beds"),
l("Manage shelves"),
l("Manage luxury furniture"),
- l("Manage Desks and Chairs"),
+ l("Manage Desks and Chairs"), // Note: Put chairs in mobilia32
l("Manage Paintings");
mes "";
@@ -125,7 +126,6 @@ L_Furniture:
case 2:
mesc l("Beds"), 3;
@re_col=1; // Collision layer to look up
- @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;
@@ -162,7 +162,7 @@ L_Furniture:
if ($ESTATE_MOBILIA_2[.id] & .objid[.@id]) {
// If you have the mobilia, you're selling it for Mobiliary Credits
.@price=realestate_sellprice(.id,.price[.@i]);
- $ESTATE_MOBILIA_2[.id]=$ESTATE_MOBILIA_2[.id] ^ .objid[.@id];
+ realestate_togglemobilia(.id, .layer[.@id], .objid[.@id]);
REAL_ESTATE_CREDITS+=.@price;
delcells realestate_cellname(.id, .@id);
mesc l("Sale successful!");
@@ -172,7 +172,7 @@ L_Furniture:
.@price=.price[.@id];
if (.@gp > .@price) {
realestate_payment(.@price);
- $ESTATE_MOBILIA_2[.id]=$ESTATE_MOBILIA_2[.id] | .objid[.@id];
+ realestate_togglemobilia(.id, .layer[.@id], .objid[.@id]);
setcells .mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], .layer[.@id], realestate_cellname(.id, .@id);
mesc l("Purchase successful!");
next;
@@ -231,51 +231,79 @@ OnInit:
create_object("Wardrobe" , 5, 7000, 1, 21, 23, 22, 23);
create_object("Cauldron" , 5, 5000, 2, 28, 24, 29, 24);
+ create_object("Shelf 01" , 5, 2000, 4, 25, 23, 25, 23);
+ create_object("Shelf 02" , 5, 2000, 8, 26, 23, 26, 23);
+ create_object("Shelf 03" , 5, 2000, 16, 27, 23, 27, 23);
+ create_object("Shelf 04" , 5, 2000, 32, 30, 23, 30, 23);
+ create_object("Shelf 05" , 5, 2000, 64, 31, 23, 31, 23);
+ create_object("Shelf 06" , 5, 2000, 128, 32, 23, 32, 23);
+ create_object("Shelf 07" , 5, 2000, 256, 33, 23, 33, 23);
+ create_object("Shelf 08" , 5, 2000, 512, 34, 23, 34, 23);
+ create_object("Shelf 09" , 5, 2000, 1024, 35, 23, 35, 23);
+ create_object("Shelf 10" , 5, 2000, 2048, 36, 23, 36, 23);
+ create_object("Shelf 11" , 5, 2000, 4096, 37, 23, 37, 23);
+ create_object("Shelf 12" , 5, 2000, 8192, 38, 23, 38, 23);
+
+ create_object("Piano" , 3, 10000, 1, 33, 25, 35, 25);
+
+ create_object("Left Desk" , 2, 5000, 1, 20, 25, 22, 27);
+ create_object("Right Desk" , 2, 5000, 2, 36, 30, 38, 32);
+
+ create_object("Left Chair" , 4, 2000, 1, 21, 28, 21, 28);
+ create_object("Right Chair" , 4, 2000, 2, 37, 29, 37, 29);
+
+ create_object("Painting 01" , 6, 3000, 1, 21, 20, 21, 20);
+ create_object("Painting 02" , 6, 3000, 2, 23, 21, 23, 21);
+ create_object("Painting 03" , 6, 3000, 4, 25, 20, 25, 20);
+ create_object("Painting 04" , 6, 3000, 8, 28, 21, 28, 21);
+ create_object("Painting 05" , 6, 3000, 16, 31, 20, 31, 20);
+ create_object("Painting 06" , 6, 3000, 32, 36, 20, 36, 20);
+ initnpctimer;
+ end;
- // Price Settings
- // Sell price is a proportion from buy price here stated
- // And rent time still available
- // Sell price = Buy Price / max(1, 60-Days Remaining)
- .pshelf= 2000;
- .ppiano= 10000;
- .pdesk= 5000;
- .pchair= 2000;
- .ppaint= 3000;
-
- // Name, Layer, Price, ID, x1, y1, x2, y2,
-
- // Storage Layer
- .shelf01=4;
- .shelf02=8;
- .shelf03=16;
- .shelf04=32;
- .shelf05=64;
- .shelf06=128;
- .shelf07=256;
- .shelf08=512;
- .shelf09=1024;
- .shelf10=2048;
- .shelf11=4096;
- .shelf12=8192;
-
- // Luxury Layer
- .piano=1;
-
- // Chair & Desk Layer
- .desk1=1;
- .desk2=2;
- .chair1=4;
- .chair2=8;
-
- // Painting Layer
- .paint1=1;
- .paint2=2;
- .paint3=4;
- .paint4=8;
- .paint5=16;
- .paint6=32;
-
- // Load Mobilia
+// Load Mobilia already existing after 5 seconds
+OnTimer5000:
+ debugmes "[REAL ESTATE] Now loading mobilia";
+ for (.@i=0; .@i < getarraysize(.layer); .@i++) {
+ switch (.layer[.@i]) {
+ case 1:
+ if ($ESTATE_MOBILIA_128[.id] & .objid[.@i])
+ array_push(.valid_ids, .@i);
+ break;
+ case 2:
+ if ($ESTATE_MOBILIA_4[.id] & .objid[.@i])
+ array_push(.valid_ids, .@i);
+ break;
+ case 3:
+ if ($ESTATE_MOBILIA_8[.id] & .objid[.@i])
+ array_push(.valid_ids, .@i);
+ break;
+ case 4:
+ if ($ESTATE_MOBILIA_32[.id] & .objid[.@i])
+ array_push(.valid_ids, .@i);
+ break;
+ case 5:
+ if ($ESTATE_MOBILIA_64[.id] & .objid[.@i])
+ array_push(.valid_ids, .@i);
+ break;
+ case 6:
+ if ($ESTATE_MOBILIA_2[.id] & .objid[.@i])
+ array_push(.valid_ids, .@i);
+ break;
+ default:
+ // We do nothing by default
+ //debugmes("[ERROR] [CRITICAL] [REAL ESTATE]: Object %d have Invalid Collision Type: %d (must range 1~6)", .@i, .layer[.@i]);
+ break;
+ }
+ }
+ debugmes "Found %d valid objects", getarraysize(.valid_ids);
+ for (.@j=0; .@j < getarraysize(.valid_ids); .@j++) {
+ .@id=.valid_ids[.@j];
+ setcells .mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], .layer[.@id], realestate_cellname(.id, .@id);
+ debugmes "Creating %s in %s", realestate_cellname(.id, .@id), .mapa$;
+ }
+ deletearray .valid_ids;
+ stopnpctimer;
end;
}
diff --git a/npc/functions/estate.txt b/npc/functions/estate.txt
index b9dae84b6..6e040d376 100644
--- a/npc/functions/estate.txt
+++ b/npc/functions/estate.txt
@@ -4,7 +4,7 @@
// Description:
// Real Estate System
// Script Helpers
-// For all your real estate purposes
+// WARNING: They affect directly the real estate global variables!
// This function reduces payment accordingly
// realestate_payment ( amount )
@@ -36,3 +36,32 @@ function script realestate_sellprice {
return (getarg(1)/max(1, 8-.@weeksleft)) - max(0, 60-.@daysleft);
}
+// This will toggle if mobilia was purchased or not, in the right group
+// realestate_togglemobilia ( estate_id, layer_id, object_id )
+function script realestate_togglemobilia {
+ switch (getarg(1)) {
+ case 1:
+ $ESTATE_MOBILIA_128[getarg(0)] = $ESTATE_MOBILIA_128[getarg(0)] ^ getarg(2);
+ break;
+ case 2:
+ $ESTATE_MOBILIA_4[getarg(0)] = $ESTATE_MOBILIA_4[getarg(0)] ^ getarg(2);
+ break;
+ case 3:
+ $ESTATE_MOBILIA_8[getarg(0)] = $ESTATE_MOBILIA_8[getarg(0)] ^ getarg(2);
+ break;
+ case 4:
+ $ESTATE_MOBILIA_32[getarg(0)] = $ESTATE_MOBILIA_32[getarg(0)] ^ getarg(2);
+ break;
+ case 5:
+ $ESTATE_MOBILIA_64[getarg(0)] = $ESTATE_MOBILIA_64[getarg(0)] ^ getarg(2);
+ break;
+ case 6:
+ $ESTATE_MOBILIA_2[getarg(0)] = $ESTATE_MOBILIA_2[getarg(0)] ^ getarg(2);
+ break;
+ default:
+ debugmes("[ERROR] [CRITICAL] [REAL ESTATE]: Object %d have Invalid Collision Type: %d (must range 1~6)", getarg(2), getarg(1));
+ break;
+ }
+ return;
+}
+