summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-03-07 17:29:11 -0300
committerJesusaves <cpntb1@ymail.com>2019-03-07 17:29:11 -0300
commit09ee49345bc354f2c10b95fe172574687c6e6a8f (patch)
treefbca03a68a9e6d9776909c2154740aa95f82b553 /npc
parent6f78c7f3fcc740cc0616233fd286973210a78964 (diff)
downloadserverdata-09ee49345bc354f2c10b95fe172574687c6e6a8f.tar.gz
serverdata-09ee49345bc354f2c10b95fe172574687c6e6a8f.tar.bz2
serverdata-09ee49345bc354f2c10b95fe172574687c6e6a8f.tar.xz
serverdata-09ee49345bc354f2c10b95fe172574687c6e6a8f.zip
Let's see if Real Estate System works out-of-the-box as planned...
Note: Rent System could be improved to use functions
Diffstat (limited to 'npc')
-rw-r--r--npc/012-1/estate.txt2
-rw-r--r--npc/017-1/_import.txt2
-rw-r--r--npc/017-1/estate.txt224
-rw-r--r--npc/017-1/estate2.txt224
-rw-r--r--npc/017-7/_import.txt3
-rw-r--r--npc/017-7/_warps.txt3
-rw-r--r--npc/017-7/doorbell.txt335
-rw-r--r--npc/017-7/utils.txt163
-rw-r--r--npc/017-8/_import.txt3
-rw-r--r--npc/017-8/_warps.txt3
-rw-r--r--npc/017-8/doorbell.txt335
-rw-r--r--npc/017-8/utils.txt163
-rw-r--r--npc/_import.txt2
13 files changed, 1462 insertions, 0 deletions
diff --git a/npc/012-1/estate.txt b/npc/012-1/estate.txt
index 4ee92d188..ac8dbae78 100644
--- a/npc/012-1/estate.txt
+++ b/npc/012-1/estate.txt
@@ -66,12 +66,14 @@ L_RentAvailable:
// If you're not the previous owner
// Remove previous owner furniture and reset room password
if ($ESTATE_OWNER[.id] != getcharid(3)) {
+ /*
$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]="";
$ESTATE_DOORBELL[.id]=false;
}
diff --git a/npc/017-1/_import.txt b/npc/017-1/_import.txt
index ea4bbb1a3..ebe8b188a 100644
--- a/npc/017-1/_import.txt
+++ b/npc/017-1/_import.txt
@@ -3,6 +3,8 @@
"npc/017-1/017-1_stranger_blackbox.txt",
"npc/017-1/_mobs.txt",
"npc/017-1/_warps.txt",
+"npc/017-1/estate.txt",
+"npc/017-1/estate2.txt",
"npc/017-1/fairy_collector.txt",
"npc/017-1/guards.txt",
"npc/017-1/mapflags.txt",
diff --git a/npc/017-1/estate.txt b/npc/017-1/estate.txt
new file mode 100644
index 000000000..b8e9118ab
--- /dev/null
+++ b/npc/017-1/estate.txt
@@ -0,0 +1,224 @@
+// TMW2: Moubootaur Legends scripts.
+// Author:
+// Jesusalva
+// Description:
+// Real Estate System
+
+// ID: 2
+// $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 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 Normal Collision (1)
+// $ESTATE_MOBILIA_128[.id] → Bitmask of mobilia currently purchased on Player Collision (5)
+// $ESTATE_PASSWORD$[.id] → Password to enter the estate. If it is "", then no password required
+// Note: GMs and Administrators can always use super password "mouboo" to enter a locked estate
+// $ESTATE_DOORBELL[.id] → If doorbell is disabled (enabled by default)
+
+// REAL_ESTATE_CREDITS → Credits equivalent to GP the player have. Will be used first.
+
+// The sign is the main controller
+017-1,86,177,0 script Sign#RES_0177 NPC_SWORDS_SIGN,{
+ if ($ESTATE_RENTTIME[.id] < gettimetick(2))
+ goto L_RentAvailable;
+
+ if ($ESTATE_OWNER[.id] == getcharid(3))
+ goto L_Manage;
+
+ if (is_admin() && $@GM_OVERRIDE)
+ goto L_Manage;
+
+ mesc l("This estate currently belongs to @@.", $ESTATE_OWNERNAME$[.id]);
+ mesc l("Press the doorbell?");
+ next;
+ if (askyesno() == ASK_YES)
+ doevent "Doorbell#RES_0177::OnDoorbell";
+ close;
+
+L_RentAvailable:
+ mesc l("This Real Estate is available for rent for only @@ GP!", format_number(.price));
+ .@gp=REAL_ESTATE_CREDITS+Zeny;
+ mesc l("You currently have: @@ GP and mobiliary credits", format_number(.@gp));
+ next;
+ select
+ rif(.@gp > .price, l("Rent it! Make it mine!")),
+ l("Information"),
+ l("Don't rent it");
+
+ // You want to rent
+ if (@menu == 1) {
+ if ($ESTATE_RENTTIME[.id] > gettimetick(2)) {
+ mesc l("Somebody already rented it before you!");
+ close;
+ }
+ REAL_ESTATE_CREDITS=REAL_ESTATE_CREDITS-.price;
+ if (REAL_ESTATE_CREDITS < 0) {
+ Zeny+=REAL_ESTATE_CREDITS;
+ REAL_ESTATE_CREDITS=0;
+ }
+
+ // Payment done, you can now acquire the house for a month
+ $ESTATE_RENTTIME[.id]=gettimetick(2)+.time;
+
+ // If you're not the previous owner
+ // Remove previous owner furniture and reset room password
+ if ($ESTATE_OWNER[.id] != getcharid(3)) {
+ /*
+ $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]="";
+ $ESTATE_DOORBELL[.id]=false;
+ }
+
+ // Register your info so you can manage it
+ $ESTATE_OWNER[.id]=getcharid(3);
+ $ESTATE_OWNERNAME$[.id]=strcharinfo(0);
+
+ mesc l("Rent successful for 30 days!");
+ } else if (@menu == 2) {
+ mesc l("You can rent this house to make it yours.");
+ mesc l("Then you'll be able to buy furniture and utility.");
+ mesc l("The door is password-protected, so your friends can enter but strangers stay outside.");
+ next;
+ mesc l("Both rent and furniture are bought using money, however, there are mobiliary credits.");
+ mesc l("Mobiliary Credits is a special currency which can only be used on real estate.");
+ mesc l("It's obtained with ADMINS or by selling furniture. It is sumed to money and used first.");
+ }
+ close;
+
+L_Manage:
+ mesc l("@@'s Estate", strcharinfo(0));
+ mesc ".:: "+ l("Managment Menu") + " ::.";
+
+ .@gp=REAL_ESTATE_CREDITS+Zeny;
+ mesc l("Rent time available: @@", FuzzyTime($ESTATE_RENTTIME[.id]));
+ mesc l("Total Credits and GP: @@", format_number(.@gp));
+ mes "";
+ mesc l("Rent Renew Price: @@ GP", format_number(.price));
+ mesc l("Room password: @@", $ESTATE_PASSWORD$[.id]);
+ if ($ESTATE_DOORBELL[.id])
+ mesc l("Doorbell is disabled"), 1;
+
+ next;
+ select
+ l("Leave"),
+ l("Enable/disable doorbell"),
+ l("Set room password"),
+ rif(.@gp >= .price && $ESTATE_RENTTIME[.id] < gettimetick(2)+.time, l("Renew Rent")),
+ rif($@GM_OVERRIDE, l("Destroy all mobilia")),
+ rif($@GM_OVERRIDE, l("Expire rent time"));
+
+ switch (@menu) {
+ case 1:
+ close;
+ break;
+ case 2:
+ $ESTATE_DOORBELL[.id]=!$ESTATE_DOORBELL[.id];
+ break;
+ case 3:
+ mesc l("(Leave the password blank to disable)");
+ mesc l("Current Room password: @@", $ESTATE_PASSWORD$[.id]);
+ mesc l("Input new password: ");
+ input .@password$;
+ mesc l("Repeat new password: ");
+ input .@passwordc$;
+ if (.@password$ == .@passwordc$) {
+ $ESTATE_PASSWORD$[.id]=.@password$;
+ mesc l("Password changed with success!"), 3;
+ } else {
+ mesc l("The passwords doesn't match."), 1;
+ }
+ break;
+ case 4:
+ // The check is performed before showing the menu option
+ // I guess it could be hacked, but I'll probably see negative GP...
+ REAL_ESTATE_CREDITS=REAL_ESTATE_CREDITS-.price;
+ if (REAL_ESTATE_CREDITS < 0) {
+ Zeny+=REAL_ESTATE_CREDITS;
+ REAL_ESTATE_CREDITS=0;
+ }
+
+ // Payment done, you can now acquire the house for a month
+ // If you lost the rent on the meanwhile, it'll renew
+ // If you lost the rent and somebody else rented it, you lose the GP
+ $ESTATE_RENTTIME[.id]+=.time;
+ break;
+ case 5:
+ mesc l("Are you sure? This cannot be undone!"), 1;
+ next;
+ if (validatepin()) {
+ $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]="";
+ $ESTATE_DOORBELL[.id]=false;
+ }
+ case 6:
+ mesc l("Are you sure? This cannot be undone!"), 1;
+ next;
+ if (validatepin()) {
+ $ESTATE_RENTTIME[.id]=gettimetick(2);
+ }
+ }
+ goto L_Manage;
+ close;
+
+OnInit:
+ .sex = G_OTHER;
+ .distance = 3;
+
+ // Estate Settings
+ .id=2; // Estate ID
+ .price=140000; // Monthly rent price
+ .time=60*60*24*30; // How long last default rent time. In future could consider month.
+ end;
+
+}
+
+// Door entrance
+017-1,85,175,0 script #RES_0177 NPC_HIDDEN,0,0,{
+ end;
+OnTouch:
+ if ($ESTATE_RENTTIME[.id] < gettimetick(2))
+ goto L_RentAvailable;
+
+ if ($ESTATE_OWNER[.id] == getcharid(3) || $ESTATE_PASSWORD$[.id] == "")
+ goto L_Warp;
+
+ mesc l("The door is locked");
+ next;
+ mesc l("However, it can be unlocked if you know the password:");
+ if (is_gm()) mesc l("You can use super password \"mouboo\" to unlock the door."), 1;
+ input .@password$;
+ // GMs can use super password "mouboo"
+ if (.@password$ == $ESTATE_PASSWORD$[.id] || (is_gm() && .@password$ == "mouboo"))
+ goto L_Warp;
+ close;
+
+L_Warp:
+ warp "017-7", 33, 33;
+ closeclientdialog;
+ close;
+
+L_RentAvailable:
+ dispbottom l("This estate is available for rent, talk to the sign to rent it.");
+ close;
+
+OnInit:
+ // Estate Settings
+ .id=2; // Estate ID
+ end;
+
+}
+
diff --git a/npc/017-1/estate2.txt b/npc/017-1/estate2.txt
new file mode 100644
index 000000000..bf5fc1856
--- /dev/null
+++ b/npc/017-1/estate2.txt
@@ -0,0 +1,224 @@
+// TMW2: Moubootaur Legends scripts.
+// Author:
+// Jesusalva
+// Description:
+// Real Estate System
+
+// ID: 3
+// $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 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 Normal Collision (1)
+// $ESTATE_MOBILIA_128[.id] → Bitmask of mobilia currently purchased on Player Collision (5)
+// $ESTATE_PASSWORD$[.id] → Password to enter the estate. If it is "", then no password required
+// Note: GMs and Administrators can always use super password "mouboo" to enter a locked estate
+// $ESTATE_DOORBELL[.id] → If doorbell is disabled (enabled by default)
+
+// REAL_ESTATE_CREDITS → Credits equivalent to GP the player have. Will be used first.
+
+// The sign is the main controller
+017-1,138,22,0 script Sign#RES_0178 NPC_SWORDS_SIGN,{
+ if ($ESTATE_RENTTIME[.id] < gettimetick(2))
+ goto L_RentAvailable;
+
+ if ($ESTATE_OWNER[.id] == getcharid(3))
+ goto L_Manage;
+
+ if (is_admin() && $@GM_OVERRIDE)
+ goto L_Manage;
+
+ mesc l("This estate currently belongs to @@.", $ESTATE_OWNERNAME$[.id]);
+ mesc l("Press the doorbell?");
+ next;
+ if (askyesno() == ASK_YES)
+ doevent "Doorbell#RES_0178::OnDoorbell";
+ close;
+
+L_RentAvailable:
+ mesc l("This Real Estate is available for rent for only @@ GP!", format_number(.price));
+ .@gp=REAL_ESTATE_CREDITS+Zeny;
+ mesc l("You currently have: @@ GP and mobiliary credits", format_number(.@gp));
+ next;
+ select
+ rif(.@gp > .price, l("Rent it! Make it mine!")),
+ l("Information"),
+ l("Don't rent it");
+
+ // You want to rent
+ if (@menu == 1) {
+ if ($ESTATE_RENTTIME[.id] > gettimetick(2)) {
+ mesc l("Somebody already rented it before you!");
+ close;
+ }
+ REAL_ESTATE_CREDITS=REAL_ESTATE_CREDITS-.price;
+ if (REAL_ESTATE_CREDITS < 0) {
+ Zeny+=REAL_ESTATE_CREDITS;
+ REAL_ESTATE_CREDITS=0;
+ }
+
+ // Payment done, you can now acquire the house for a month
+ $ESTATE_RENTTIME[.id]=gettimetick(2)+.time;
+
+ // If you're not the previous owner
+ // Remove previous owner furniture and reset room password
+ if ($ESTATE_OWNER[.id] != getcharid(3)) {
+ /*
+ $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]="";
+ $ESTATE_DOORBELL[.id]=false;
+ }
+
+ // Register your info so you can manage it
+ $ESTATE_OWNER[.id]=getcharid(3);
+ $ESTATE_OWNERNAME$[.id]=strcharinfo(0);
+
+ mesc l("Rent successful for 30 days!");
+ } else if (@menu == 2) {
+ mesc l("You can rent this house to make it yours.");
+ mesc l("Then you'll be able to buy furniture and utility.");
+ mesc l("The door is password-protected, so your friends can enter but strangers stay outside.");
+ next;
+ mesc l("Both rent and furniture are bought using money, however, there are mobiliary credits.");
+ mesc l("Mobiliary Credits is a special currency which can only be used on real estate.");
+ mesc l("It's obtained with ADMINS or by selling furniture. It is sumed to money and used first.");
+ }
+ close;
+
+L_Manage:
+ mesc l("@@'s Estate", strcharinfo(0));
+ mesc ".:: "+ l("Managment Menu") + " ::.";
+
+ .@gp=REAL_ESTATE_CREDITS+Zeny;
+ mesc l("Rent time available: @@", FuzzyTime($ESTATE_RENTTIME[.id]));
+ mesc l("Total Credits and GP: @@", format_number(.@gp));
+ mes "";
+ mesc l("Rent Renew Price: @@ GP", format_number(.price));
+ mesc l("Room password: @@", $ESTATE_PASSWORD$[.id]);
+ if ($ESTATE_DOORBELL[.id])
+ mesc l("Doorbell is disabled"), 1;
+
+ next;
+ select
+ l("Leave"),
+ l("Enable/disable doorbell"),
+ l("Set room password"),
+ rif(.@gp >= .price && $ESTATE_RENTTIME[.id] < gettimetick(2)+.time, l("Renew Rent")),
+ rif($@GM_OVERRIDE, l("Destroy all mobilia")),
+ rif($@GM_OVERRIDE, l("Expire rent time"));
+
+ switch (@menu) {
+ case 1:
+ close;
+ break;
+ case 2:
+ $ESTATE_DOORBELL[.id]=!$ESTATE_DOORBELL[.id];
+ break;
+ case 3:
+ mesc l("(Leave the password blank to disable)");
+ mesc l("Current Room password: @@", $ESTATE_PASSWORD$[.id]);
+ mesc l("Input new password: ");
+ input .@password$;
+ mesc l("Repeat new password: ");
+ input .@passwordc$;
+ if (.@password$ == .@passwordc$) {
+ $ESTATE_PASSWORD$[.id]=.@password$;
+ mesc l("Password changed with success!"), 3;
+ } else {
+ mesc l("The passwords doesn't match."), 1;
+ }
+ break;
+ case 4:
+ // The check is performed before showing the menu option
+ // I guess it could be hacked, but I'll probably see negative GP...
+ REAL_ESTATE_CREDITS=REAL_ESTATE_CREDITS-.price;
+ if (REAL_ESTATE_CREDITS < 0) {
+ Zeny+=REAL_ESTATE_CREDITS;
+ REAL_ESTATE_CREDITS=0;
+ }
+
+ // Payment done, you can now acquire the house for a month
+ // If you lost the rent on the meanwhile, it'll renew
+ // If you lost the rent and somebody else rented it, you lose the GP
+ $ESTATE_RENTTIME[.id]+=.time;
+ break;
+ case 5:
+ mesc l("Are you sure? This cannot be undone!"), 1;
+ next;
+ if (validatepin()) {
+ $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]="";
+ $ESTATE_DOORBELL[.id]=false;
+ }
+ case 6:
+ mesc l("Are you sure? This cannot be undone!"), 1;
+ next;
+ if (validatepin()) {
+ $ESTATE_RENTTIME[.id]=gettimetick(2);
+ }
+ }
+ goto L_Manage;
+ close;
+
+OnInit:
+ .sex = G_OTHER;
+ .distance = 3;
+
+ // Estate Settings
+ .id=3; // Estate ID
+ .price=180000; // Monthly rent price
+ .time=60*60*24*30; // How long last default rent time. In future could consider month.
+ end;
+
+}
+
+// Door entrance
+017-1,139,20,0 script #RES_0178 NPC_HIDDEN,0,0,{
+ end;
+OnTouch:
+ if ($ESTATE_RENTTIME[.id] < gettimetick(2))
+ goto L_RentAvailable;
+
+ if ($ESTATE_OWNER[.id] == getcharid(3) || $ESTATE_PASSWORD$[.id] == "")
+ goto L_Warp;
+
+ mesc l("The door is locked");
+ next;
+ mesc l("However, it can be unlocked if you know the password:");
+ if (is_gm()) mesc l("You can use super password \"mouboo\" to unlock the door."), 1;
+ input .@password$;
+ // GMs can use super password "mouboo"
+ if (.@password$ == $ESTATE_PASSWORD$[.id] || (is_gm() && .@password$ == "mouboo"))
+ goto L_Warp;
+ close;
+
+L_Warp:
+ warp "017-8", 33, 33;
+ closeclientdialog;
+ close;
+
+L_RentAvailable:
+ dispbottom l("This estate is available for rent, talk to the sign to rent it.");
+ close;
+
+OnInit:
+ // Estate Settings
+ .id=3; // Estate ID
+ end;
+
+}
+
diff --git a/npc/017-7/_import.txt b/npc/017-7/_import.txt
new file mode 100644
index 000000000..fde6dbffe
--- /dev/null
+++ b/npc/017-7/_import.txt
@@ -0,0 +1,3 @@
+// Map 017-7: Real Estate
+// This file is generated automatically. All manually added changes will be removed when running the Converter.
+"npc/017-7/_warps.txt",
diff --git a/npc/017-7/_warps.txt b/npc/017-7/_warps.txt
new file mode 100644
index 000000000..a47e31a76
--- /dev/null
+++ b/npc/017-7/_warps.txt
@@ -0,0 +1,3 @@
+// This file is generated automatically. All manually added changes will be removed when running the Converter.
+// Map 017-7: Real Estate warps
+017-7,34,34,0 warp #017-7_34_34 1,0,017-1,85,176
diff --git a/npc/017-7/doorbell.txt b/npc/017-7/doorbell.txt
new file mode 100644
index 000000000..b2009bd00
--- /dev/null
+++ b/npc/017-7/doorbell.txt
@@ -0,0 +1,335 @@
+// TMW2: Moubootaur Legends scripts.
+// Author:
+// Jesusalva
+// Description:
+// Real Estate System
+// Doorbell allows you to purchase mobilia, besides loading it when server starts
+// Each layer can have 32 different furniture pieces because bitmask limit.
+// This file is custom to every room
+
+// ID: 2
+// $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 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 Normal Collision (1)
+// $ESTATE_MOBILIA_128[.id] → Bitmask of mobilia currently purchased on Player Collision (5)
+// $ESTATE_PASSWORD$[.id] → Password to enter the estate. If it is "", then no password required
+// Note: GMs and Administrators can always use super password "mouboo" to enter a locked estate
+// $ESTATE_DOORBELL[.id] → If doorbell is disabled (enabled by default)
+
+// REAL_ESTATE_CREDITS → Credits equivalent to GP the player have. Will be used first.
+
+// The sign is the main controller
+017-7,32,34,0 script Doorbell#RES_0177 NPC_NO_SPRITE,{
+ // Name, Layer, Price, ID, x1, y1, x2, y2,
+ function create_object {
+ array_push(.name$, getarg(0));
+ array_push(.layer, getarg(1));
+ array_push(.price, getarg(2));
+ array_push(.objid, getarg(3));
+ array_push(.x1, getarg(4));
+ array_push(.y1, getarg(5));
+ array_push(.x2, getarg(6));
+ array_push(.y2, getarg(7));
+ return;
+ }
+
+ if ($ESTATE_OWNER[.id] == getcharid(3))
+ goto L_Manage;
+
+ mesc l("This estate currently belongs to @@.", $ESTATE_OWNERNAME$[.id]);
+ close;
+
+// When using setcells() a player could get trapped!
+// This label will slide the player back to entrance, which should be a safe spot
+OnSlide:
+ slide 33, 33;
+ end;
+
+// If someone press the doorbell from outside and doorbell is enabled
+OnDoorbell:
+ if (!$ESTATE_DOORBELL[.id])
+ end;
+
+ if (.dpost < gettimetick(2)) {
+ npctalk l("@@ is pressing the doorbell.", strcharinfo(0)); // We actually don't want l()
+ }
+ .dpost=gettimetick(2)+.delay;
+ end;
+
+// Managment Menu
+L_Manage:
+ mesc l("@@'s Estate", strcharinfo(0));
+ mesc ".:: "+ l("Managment Menu") + " ::.";
+
+ .@gp=REAL_ESTATE_CREDITS+Zeny;
+ mesc l("Rent time available: @@", FuzzyTime($ESTATE_RENTTIME[.id]));
+ mesc l("Total Credits and GP: @@", format_number(.@gp));
+ mes "";
+ mesc l("Room password: @@", $ESTATE_PASSWORD$[.id]);
+ if ($ESTATE_DOORBELL[.id])
+ mesc l("Doorbell is disabled"), 1;
+
+ next;
+ select
+ l("Leave"),
+ l("Enable/disable doorbell"),
+ l("Manage Furniture"),
+ l("Set room password");
+
+ switch (@menu) {
+ case 1:
+ close;
+ break;
+ case 2:
+ $ESTATE_DOORBELL[.id]=!$ESTATE_DOORBELL[.id];
+ break;
+ case 3:
+ goto L_Furniture;
+ break;
+ case 4:
+ mesc l("(Leave the password blank to disable)");
+ mesc l("Current Room password: @@", $ESTATE_PASSWORD$[.id]);
+ mesc l("Input new password: ");
+ input .@password$;
+ mesc l("Repeat new password: ");
+ input .@passwordc$;
+ if (.@password$ == .@passwordc$) {
+ $ESTATE_PASSWORD$[.id]=.@password$;
+ mesc l("Password changed with success!"), 3;
+ } else {
+ mesc l("The passwords doesn't match."), 1;
+ }
+ break;
+ }
+ goto L_Manage;
+
+L_Furniture:
+ mesc l("@@'s Estate", strcharinfo(0));
+ mesc ".:: "+ l("Furniture Menu") + " ::.";
+
+ .@gp=REAL_ESTATE_CREDITS+Zeny;
+ mesc l("Total Credits and GP: @@", format_number(.@gp));
+
+ next;
+ select
+ l("Finish"),
+ l("Manage Beds"),
+ l("Manage Utilities"),
+ l("Manage Luxury furniture"),
+ l("Manage Decoration"),
+ l("Manage Chairs"),
+ l("Manage Paintings");
+ mes "";
+
+ switch (@menu) {
+ case 1:
+ goto L_Manage;
+ break;
+ case 2:
+ mesc ".:: "+ l("Beds") + " ::.", 3;
+ @re_col=RES_OBJECTS;
+ break;
+ case 3:
+ mesc ".:: "+ l("Utilities") + " ::.", 3;
+ @re_col=RES_UTILITIES;
+ break;
+ case 4:
+ mesc ".:: "+ l("Luxury furniture") + " ::.", 3;
+ @re_col=RES_LUXURY;
+ break;
+ case 5:
+ mesc ".:: "+ l("Decoration") + " ::.", 3;
+ @re_col=RES_DECORATION;
+ break;
+ case 6:
+ mesc ".:: "+ l("Chairs") + " ::.", 3;
+ @re_col=RES_SITTABLE;
+ break;
+ case 7:
+ mesc ".:: "+ l("Paintings") + " ::.", 3;
+ @re_col=RES_WALLDECORATION;
+ break;
+ }
+
+// L_ContinuousLoop
+// Requires the following variables:
+// @re_col
+// Target Collision ID
+L_ContinuousLoop:
+ deletearray @valid_ids;
+
+ // Create a second array (@valid_ids) with the ID of objects within @re_col group
+ 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;
+ if (.layer[.@i] == @re_col)
+ array_push(@valid_ids, .@i);
+ }
+ //debugmes "Found %d valid objects", getarraysize(@valid_ids);
+
+ // Create the menu with @valid_ids - Check if you already have the item to decide if you're buying or selling
+ @menuentries$="Finish:";
+ for (.@j=0; .@j < getarraysize(@valid_ids); .@j++) {
+ .@i=@valid_ids[.@j];
+ if (realestate_hasmobilia(.id, .layer[.@i], .objid[.@i]))
+ @menuentries$+=l("Sell ")+.name$[.@i]+l(" for ") + format_number( realestate_sellprice(.id,.price[.@i]) ) +":";
+ else
+ @menuentries$+=l("Purchase ")+.name$[.@i]+(" for ") + format_number( .price[.@i] )+":";
+ }
+ select (@menuentries$);
+ mes "";
+
+ // First option to return to previous menu
+ if (@menu == 1)
+ goto L_Furniture;
+
+ // Otherwise, we know then that (@menu-2) is the ID in @valid_ids
+ // So we save .@id with the correct ID in object arrays.
+ // We also calculate how much aggregated money you have.
+ .@id=@valid_ids[@menu-2];
+ .@gp=REAL_ESTATE_CREDITS+Zeny;
+
+ if (realestate_hasmobilia(.id, .layer[.@id], .objid[.@id])) {
+ // If you have the mobilia, you're selling it for Mobiliary Credits
+ delcells realestate_cellname(.id, .@id);
+ realestate_togglemobilia(.id, .layer[.@id], .objid[.@id], "NPCs#RES_0177");
+ REAL_ESTATE_CREDITS+=realestate_sellprice(.id,.price[.@i]);
+ mesc l("Sale successful!");
+ next;
+ } else {
+ // Else, you're buying it, so we must check if you have the moolah first
+ .@price=.price[.@id];
+ if (.@gp > .@price) {
+ realestate_payment(.@price);
+ setcells .mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], .layer[.@id], realestate_cellname(.id, .@id);
+ areatimer(.mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], 10, "::OnSlide");
+ realestate_togglemobilia(.id, .layer[.@id], .objid[.@id], "NPCs#RES_0177");
+ mesc l("Purchase successful!");
+ next;
+ } else {
+ mesc l("Not enough funds!");
+ next;
+ }
+ }
+
+ // This loops forever
+ goto L_ContinuousLoop;
+
+
+OnInit:
+ .sex = G_OTHER;
+ .distance = 3;
+
+ // Estate Settings
+ .id=2; // Estate ID
+ .delay=15; // Forced wait between rings
+ .dpost=0; // Last doorbell ring
+ .mapa$="017-7";
+
+ // Arrays
+ // We go element by element on the array building the menu
+ .name$="";
+ .layer=0;
+ .price=0;
+ .objid=0;
+ .x1=0;
+ .y1=0;
+ .x2=0;
+ .y2=0;
+
+ // Furniture Settings
+ // Name, Collision Layer, Price, ID, x1, y1, x2, y2
+ // For Collision Layer, see constants.conf ("Real Estate Collisions")
+ create_object("Placeholder" ,99,999999,99999, 99, 99, 99, 99);
+
+ create_object("Bed 01" , 5, 5000, 1, 24, 24, 25, 27);
+ create_object("Bed 02" , 5, 5000, 2, 26, 24, 27, 27);
+ create_object("Bed 03" , 5, 5000, 4, 28, 24, 29, 27);
+ create_object("Bed 04" , 5, 5000, 8, 30, 24, 31, 27);
+ create_object("Bed 05" , 5, 5000, 16, 24, 29, 25, 32);
+ create_object("Bed 06" , 5, 5000, 32, 26, 29, 27, 32);
+ create_object("Bed 07" , 5, 5000, 64, 28, 29, 29, 32);
+ create_object("Bed 08" , 5, 5000, 128, 30, 29, 31, 32);
+
+ create_object("Wardrobe" , 1, 7000, 1, 21, 23, 22, 23);
+ create_object("Cauldron" , 1, 5000, 2, 28, 24, 29, 24);
+ create_object("Shelf 01" , 1, 2000, 4, 25, 23, 25, 23);
+ create_object("Shelf 02" , 1, 2000, 8, 26, 23, 26, 23);
+ create_object("Shelf 03" , 1, 2000, 16, 27, 23, 27, 23);
+ create_object("Shelf 04" , 1, 2000, 32, 30, 23, 30, 23);
+ create_object("Shelf 05" , 1, 2000, 64, 31, 23, 31, 23);
+ create_object("Shelf 06" , 1, 2000, 128, 32, 23, 32, 23);
+ create_object("Shelf 07" , 1, 2000, 256, 33, 23, 33, 23);
+ create_object("Shelf 08" , 1, 2000, 512, 34, 23, 34, 23);
+ create_object("Shelf 09" , 1, 2000, 1024, 35, 23, 35, 23);
+ create_object("Shelf 10" , 1, 2000, 2048, 36, 23, 36, 23);
+ create_object("Shelf 11" , 1, 2000, 4096, 37, 23, 37, 23);
+ create_object("Shelf 12" , 1, 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);
+
+ // Load Mobilia already existing
+ 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;
+ // Load NPCs
+ donpcevent "NPCs#RES_0177::OnReload";
+ end;
+
+}
+
+
diff --git a/npc/017-7/utils.txt b/npc/017-7/utils.txt
new file mode 100644
index 000000000..2266836f8
--- /dev/null
+++ b/npc/017-7/utils.txt
@@ -0,0 +1,163 @@
+// TMW2: Moubootaur Legends scripts.
+// Author:
+// Jesusalva
+// Description:
+// Real Estate System
+// Utils take care of NPCs - Their code, and enable/disable using check_cell
+// This file is custom to every room
+
+// ID: 2
+// $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 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
+// Note: GMs and Administrators can always use super password "mouboo" to enter a locked estate
+// $ESTATE_DOORBELL[.id] → If doorbell is disabled (enabled by default)
+
+// REAL_ESTATE_CREDITS → Credits equivalent to GP the player have. Will be used first.
+
+// The sign is the main controller for rent system
+// Doorbell is the main controller for indoor
+// This is the NPC script controller
+017-7,0,0,0 script NPCs#RES_0177 NPC_HIDDEN,{
+ // load_npc ( name , map, x , y{, cell} )
+ function load_npc {
+ if (checknpccell(getarg(1), getarg(2), getarg(3), getarg(4, cell_chknopass))) {
+ enablenpc getarg(0);
+ //debugmes "ENABLING NPC %s", getarg(0);
+ } else {
+ disablenpc getarg(0);
+ //debugmes "Disabling NPC %s", getarg(0);
+ }
+
+ /*
+ debugmes "----- %s (%d,%d) cell report", getarg(1), getarg(2), getarg(3);
+ debugmes "cell_chknopass: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chknopass);
+ debugmes "cell_chknoreach: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chknoreach);
+ debugmes "cell_chkbasilica: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkbasilica);
+ debugmes "";
+ debugmes "cell_chkwater: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkwater);
+ debugmes "cell_chkwall: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkwall);
+ debugmes "cell_chkcliff: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkcliff);
+ debugmes "----- Npc Id: %s", getarg(0);
+ */
+ return;
+ }
+ end;
+
+OnInit:
+ // Estate Settings
+ .id=2; // Estate ID
+ .mapa$="017-7"; // Map name
+
+ // NPC Settings
+ .sex = G_OTHER;
+ .distance = 3;
+ end;
+
+// Load or unload accordingly
+OnReload:
+ //debugmes "[REAL ESTATE] NPC ONRELOAD";
+ // load_npc ( name , map, x , y{, cell} )
+ load_npc("Wardrobe#RES_0177", .mapa$, 21, 23);
+ load_npc("Cauldron#RES_0177", .mapa$, 28, 24);
+ load_npc("Piano#RES_0177" , .mapa$, 34, 25);
+ end;
+
+}
+
+017-7,21,23,0 script Wardrobe#RES_0177 NPC_NO_SPRITE,{
+ openstorage;
+ end;
+
+OnInit:
+ .distance=3;
+ end;
+}
+
+
+017-7,29,24,0 script Cauldron#RES_0177 NPC_NO_SPRITE,{
+ npctalk l("Alchemy system Not Yet Implemented - Blame Jesusalva");
+ end;
+
+OnInit:
+ .distance=3;
+ end;
+}
+
+
+017-7,34,25,0 script Piano#RES_0177 NPC_NO_SPRITE,{
+ mesc l("Do you want to play a song?");
+ mesc l("This is not saved.");
+ select
+ l("Nothing"),
+ l("Default"),
+ l("Indoors 1 (Peace)"),
+ l("Indoors 2 (Dimonds)"),
+ l("TMW Adventure"),
+ l("Sailing Away!"),
+ l("Magick Real"),
+ l("The Forest"),
+ l("Dragons and Toast"),
+ l("Unforgiving Lands"),
+ l("Arabesque (Action)"),
+ l("No Chains (Tulimshar)"),
+ l("School of Quirks (Candor)"),
+ l("Cake Town (Hurnscald)"),
+ l("Steam (LoF Village)"),
+ l("Woodland Fantasy"),
+ l("Birds in the Sunrise");
+
+ mes "";
+ .@m$="";
+ switch (@menu) {
+ case 1:
+ close;
+ case 2:
+ .@m$="8bit_the_hero.ogg"; break;
+ case 3:
+ .@m$="peace.ogg"; break;
+ case 4:
+ .@m$="peace2.ogg"; break;
+ case 5:
+ .@m$="tmw_adventure.ogg"; break;
+ case 6:
+ .@m$="sail_away.ogg"; break;
+ case 7:
+ .@m$="magick_real.ogg"; break;
+ case 8:
+ .@m$="dariunas_forest.ogg"; break;
+ case 9:
+ .@m$="dragon_and_toast.ogg"; break;
+ case 10:
+ .@m$="Unforgiving_Lands.ogg"; break;
+ case 11:
+ .@m$="Arabesque.ogg"; break;
+ case 12:
+ .@m$="mvrasseli_nochains.ogg"; break;
+ case 13:
+ .@m$="school_of_quirks.ogg"; break;
+ case 14:
+ .@m$="caketown.ogg"; break;
+ case 15:
+ .@m$="steam.ogg"; break;
+ case 16:
+ .@m$="woodland_fantasy.ogg"; break;
+ case 17:
+ .@m$="tws_birds_in_the_sunrise.ogg"; break;
+
+ }
+ changemusic "017-7", .@m$;
+ close;
+
+OnInit:
+ .distance=3;
+ end;
+}
+
diff --git a/npc/017-8/_import.txt b/npc/017-8/_import.txt
new file mode 100644
index 000000000..c9c0d9582
--- /dev/null
+++ b/npc/017-8/_import.txt
@@ -0,0 +1,3 @@
+// Map 017-8: Real Estate
+// This file is generated automatically. All manually added changes will be removed when running the Converter.
+"npc/017-8/_warps.txt",
diff --git a/npc/017-8/_warps.txt b/npc/017-8/_warps.txt
new file mode 100644
index 000000000..50279ce79
--- /dev/null
+++ b/npc/017-8/_warps.txt
@@ -0,0 +1,3 @@
+// This file is generated automatically. All manually added changes will be removed when running the Converter.
+// Map 017-8: Real Estate warps
+017-8,34,34,0 warp #017-8_34_34 1,0,017-1,139,21
diff --git a/npc/017-8/doorbell.txt b/npc/017-8/doorbell.txt
new file mode 100644
index 000000000..901d8d2f6
--- /dev/null
+++ b/npc/017-8/doorbell.txt
@@ -0,0 +1,335 @@
+// TMW2: Moubootaur Legends scripts.
+// Author:
+// Jesusalva
+// Description:
+// Real Estate System
+// Doorbell allows you to purchase mobilia, besides loading it when server starts
+// Each layer can have 32 different furniture pieces because bitmask limit.
+// This file is custom to every room
+
+// ID: 3
+// $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 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 Normal Collision (1)
+// $ESTATE_MOBILIA_128[.id] → Bitmask of mobilia currently purchased on Player Collision (5)
+// $ESTATE_PASSWORD$[.id] → Password to enter the estate. If it is "", then no password required
+// Note: GMs and Administrators can always use super password "mouboo" to enter a locked estate
+// $ESTATE_DOORBELL[.id] → If doorbell is disabled (enabled by default)
+
+// REAL_ESTATE_CREDITS → Credits equivalent to GP the player have. Will be used first.
+
+// The sign is the main controller
+017-8,32,34,0 script Doorbell#RES_0178 NPC_NO_SPRITE,{
+ // Name, Layer, Price, ID, x1, y1, x2, y2,
+ function create_object {
+ array_push(.name$, getarg(0));
+ array_push(.layer, getarg(1));
+ array_push(.price, getarg(2));
+ array_push(.objid, getarg(3));
+ array_push(.x1, getarg(4));
+ array_push(.y1, getarg(5));
+ array_push(.x2, getarg(6));
+ array_push(.y2, getarg(7));
+ return;
+ }
+
+ if ($ESTATE_OWNER[.id] == getcharid(3))
+ goto L_Manage;
+
+ mesc l("This estate currently belongs to @@.", $ESTATE_OWNERNAME$[.id]);
+ close;
+
+// When using setcells() a player could get trapped!
+// This label will slide the player back to entrance, which should be a safe spot
+OnSlide:
+ slide 33, 33;
+ end;
+
+// If someone press the doorbell from outside and doorbell is enabled
+OnDoorbell:
+ if (!$ESTATE_DOORBELL[.id])
+ end;
+
+ if (.dpost < gettimetick(2)) {
+ npctalk l("@@ is pressing the doorbell.", strcharinfo(0)); // We actually don't want l()
+ }
+ .dpost=gettimetick(2)+.delay;
+ end;
+
+// Managment Menu
+L_Manage:
+ mesc l("@@'s Estate", strcharinfo(0));
+ mesc ".:: "+ l("Managment Menu") + " ::.";
+
+ .@gp=REAL_ESTATE_CREDITS+Zeny;
+ mesc l("Rent time available: @@", FuzzyTime($ESTATE_RENTTIME[.id]));
+ mesc l("Total Credits and GP: @@", format_number(.@gp));
+ mes "";
+ mesc l("Room password: @@", $ESTATE_PASSWORD$[.id]);
+ if ($ESTATE_DOORBELL[.id])
+ mesc l("Doorbell is disabled"), 1;
+
+ next;
+ select
+ l("Leave"),
+ l("Enable/disable doorbell"),
+ l("Manage Furniture"),
+ l("Set room password");
+
+ switch (@menu) {
+ case 1:
+ close;
+ break;
+ case 2:
+ $ESTATE_DOORBELL[.id]=!$ESTATE_DOORBELL[.id];
+ break;
+ case 3:
+ goto L_Furniture;
+ break;
+ case 4:
+ mesc l("(Leave the password blank to disable)");
+ mesc l("Current Room password: @@", $ESTATE_PASSWORD$[.id]);
+ mesc l("Input new password: ");
+ input .@password$;
+ mesc l("Repeat new password: ");
+ input .@passwordc$;
+ if (.@password$ == .@passwordc$) {
+ $ESTATE_PASSWORD$[.id]=.@password$;
+ mesc l("Password changed with success!"), 3;
+ } else {
+ mesc l("The passwords doesn't match."), 1;
+ }
+ break;
+ }
+ goto L_Manage;
+
+L_Furniture:
+ mesc l("@@'s Estate", strcharinfo(0));
+ mesc ".:: "+ l("Furniture Menu") + " ::.";
+
+ .@gp=REAL_ESTATE_CREDITS+Zeny;
+ mesc l("Total Credits and GP: @@", format_number(.@gp));
+
+ next;
+ select
+ l("Finish"),
+ l("Manage Beds"),
+ l("Manage Utilities"),
+ l("Manage Luxury furniture"),
+ l("Manage Decoration"),
+ l("Manage Chairs"),
+ l("Manage Paintings");
+ mes "";
+
+ switch (@menu) {
+ case 1:
+ goto L_Manage;
+ break;
+ case 2:
+ mesc ".:: "+ l("Beds") + " ::.", 3;
+ @re_col=RES_OBJECTS;
+ break;
+ case 3:
+ mesc ".:: "+ l("Utilities") + " ::.", 3;
+ @re_col=RES_UTILITIES;
+ break;
+ case 4:
+ mesc ".:: "+ l("Luxury furniture") + " ::.", 3;
+ @re_col=RES_LUXURY;
+ break;
+ case 5:
+ mesc ".:: "+ l("Decoration") + " ::.", 3;
+ @re_col=RES_DECORATION;
+ break;
+ case 6:
+ mesc ".:: "+ l("Chairs") + " ::.", 3;
+ @re_col=RES_SITTABLE;
+ break;
+ case 7:
+ mesc ".:: "+ l("Paintings") + " ::.", 3;
+ @re_col=RES_WALLDECORATION;
+ break;
+ }
+
+// L_ContinuousLoop
+// Requires the following variables:
+// @re_col
+// Target Collision ID
+L_ContinuousLoop:
+ deletearray @valid_ids;
+
+ // Create a second array (@valid_ids) with the ID of objects within @re_col group
+ 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;
+ if (.layer[.@i] == @re_col)
+ array_push(@valid_ids, .@i);
+ }
+ //debugmes "Found %d valid objects", getarraysize(@valid_ids);
+
+ // Create the menu with @valid_ids - Check if you already have the item to decide if you're buying or selling
+ @menuentries$="Finish:";
+ for (.@j=0; .@j < getarraysize(@valid_ids); .@j++) {
+ .@i=@valid_ids[.@j];
+ if (realestate_hasmobilia(.id, .layer[.@i], .objid[.@i]))
+ @menuentries$+=l("Sell ")+.name$[.@i]+l(" for ") + format_number( realestate_sellprice(.id,.price[.@i]) ) +":";
+ else
+ @menuentries$+=l("Purchase ")+.name$[.@i]+(" for ") + format_number( .price[.@i] )+":";
+ }
+ select (@menuentries$);
+ mes "";
+
+ // First option to return to previous menu
+ if (@menu == 1)
+ goto L_Furniture;
+
+ // Otherwise, we know then that (@menu-2) is the ID in @valid_ids
+ // So we save .@id with the correct ID in object arrays.
+ // We also calculate how much aggregated money you have.
+ .@id=@valid_ids[@menu-2];
+ .@gp=REAL_ESTATE_CREDITS+Zeny;
+
+ if (realestate_hasmobilia(.id, .layer[.@id], .objid[.@id])) {
+ // If you have the mobilia, you're selling it for Mobiliary Credits
+ delcells realestate_cellname(.id, .@id);
+ realestate_togglemobilia(.id, .layer[.@id], .objid[.@id], "NPCs#RES_0178");
+ REAL_ESTATE_CREDITS+=realestate_sellprice(.id,.price[.@i]);
+ mesc l("Sale successful!");
+ next;
+ } else {
+ // Else, you're buying it, so we must check if you have the moolah first
+ .@price=.price[.@id];
+ if (.@gp > .@price) {
+ realestate_payment(.@price);
+ setcells .mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], .layer[.@id], realestate_cellname(.id, .@id);
+ areatimer(.mapa$, .x1[.@id], .y1[.@id], .x2[.@id], .y2[.@id], 10, "::OnSlide");
+ realestate_togglemobilia(.id, .layer[.@id], .objid[.@id], "NPCs#RES_0178");
+ mesc l("Purchase successful!");
+ next;
+ } else {
+ mesc l("Not enough funds!");
+ next;
+ }
+ }
+
+ // This loops forever
+ goto L_ContinuousLoop;
+
+
+OnInit:
+ .sex = G_OTHER;
+ .distance = 3;
+
+ // Estate Settings
+ .id=3; // Estate ID
+ .delay=15; // Forced wait between rings
+ .dpost=0; // Last doorbell ring
+ .mapa$="017-8";
+
+ // Arrays
+ // We go element by element on the array building the menu
+ .name$="";
+ .layer=0;
+ .price=0;
+ .objid=0;
+ .x1=0;
+ .y1=0;
+ .x2=0;
+ .y2=0;
+
+ // Furniture Settings
+ // Name, Collision Layer, Price, ID, x1, y1, x2, y2
+ // For Collision Layer, see constants.conf ("Real Estate Collisions")
+ create_object("Placeholder" ,99,999999,99999, 99, 99, 99, 99);
+
+ create_object("Bed 01" , 5, 5000, 1, 24, 24, 25, 27);
+ create_object("Bed 02" , 5, 5000, 2, 26, 24, 27, 27);
+ create_object("Bed 03" , 5, 5000, 4, 28, 24, 29, 27);
+ create_object("Bed 04" , 5, 5000, 8, 30, 24, 31, 27);
+ create_object("Bed 05" , 5, 5000, 16, 24, 29, 25, 32);
+ create_object("Bed 06" , 5, 5000, 32, 26, 29, 27, 32);
+ create_object("Bed 07" , 5, 5000, 64, 28, 29, 29, 32);
+ create_object("Bed 08" , 5, 5000, 128, 30, 29, 31, 32);
+
+ create_object("Wardrobe" , 1, 7000, 1, 21, 23, 22, 23);
+ create_object("Cauldron" , 1, 5000, 2, 28, 24, 29, 24);
+ create_object("Shelf 01" , 1, 2000, 4, 25, 23, 25, 23);
+ create_object("Shelf 02" , 1, 2000, 8, 26, 23, 26, 23);
+ create_object("Shelf 03" , 1, 2000, 16, 27, 23, 27, 23);
+ create_object("Shelf 04" , 1, 2000, 32, 30, 23, 30, 23);
+ create_object("Shelf 05" , 1, 2000, 64, 31, 23, 31, 23);
+ create_object("Shelf 06" , 1, 2000, 128, 32, 23, 32, 23);
+ create_object("Shelf 07" , 1, 2000, 256, 33, 23, 33, 23);
+ create_object("Shelf 08" , 1, 2000, 512, 34, 23, 34, 23);
+ create_object("Shelf 09" , 1, 2000, 1024, 35, 23, 35, 23);
+ create_object("Shelf 10" , 1, 2000, 2048, 36, 23, 36, 23);
+ create_object("Shelf 11" , 1, 2000, 4096, 37, 23, 37, 23);
+ create_object("Shelf 12" , 1, 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);
+
+ // Load Mobilia already existing
+ 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;
+ // Load NPCs
+ donpcevent "NPCs#RES_0178::OnReload";
+ end;
+
+}
+
+
diff --git a/npc/017-8/utils.txt b/npc/017-8/utils.txt
new file mode 100644
index 000000000..ae77217eb
--- /dev/null
+++ b/npc/017-8/utils.txt
@@ -0,0 +1,163 @@
+// TMW2: Moubootaur Legends scripts.
+// Author:
+// Jesusalva
+// Description:
+// Real Estate System
+// Utils take care of NPCs - Their code, and enable/disable using check_cell
+// This file is custom to every room
+
+// ID: 3
+// $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 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
+// Note: GMs and Administrators can always use super password "mouboo" to enter a locked estate
+// $ESTATE_DOORBELL[.id] → If doorbell is disabled (enabled by default)
+
+// REAL_ESTATE_CREDITS → Credits equivalent to GP the player have. Will be used first.
+
+// The sign is the main controller for rent system
+// Doorbell is the main controller for indoor
+// This is the NPC script controller
+017-8,0,0,0 script NPCs#RES_0178 NPC_HIDDEN,{
+ // load_npc ( name , map, x , y{, cell} )
+ function load_npc {
+ if (checknpccell(getarg(1), getarg(2), getarg(3), getarg(4, cell_chknopass))) {
+ enablenpc getarg(0);
+ //debugmes "ENABLING NPC %s", getarg(0);
+ } else {
+ disablenpc getarg(0);
+ //debugmes "Disabling NPC %s", getarg(0);
+ }
+
+ /*
+ debugmes "----- %s (%d,%d) cell report", getarg(1), getarg(2), getarg(3);
+ debugmes "cell_chknopass: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chknopass);
+ debugmes "cell_chknoreach: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chknoreach);
+ debugmes "cell_chkbasilica: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkbasilica);
+ debugmes "";
+ debugmes "cell_chkwater: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkwater);
+ debugmes "cell_chkwall: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkwall);
+ debugmes "cell_chkcliff: %d", checknpccell(getarg(1), getarg(2), getarg(3), cell_chkcliff);
+ debugmes "----- Npc Id: %s", getarg(0);
+ */
+ return;
+ }
+ end;
+
+OnInit:
+ // Estate Settings
+ .id=3; // Estate ID
+ .mapa$="017-8"; // Map name
+
+ // NPC Settings
+ .sex = G_OTHER;
+ .distance = 3;
+ end;
+
+// Load or unload accordingly
+OnReload:
+ //debugmes "[REAL ESTATE] NPC ONRELOAD";
+ // load_npc ( name , map, x , y{, cell} )
+ load_npc("Wardrobe#RES_0178", .mapa$, 21, 23);
+ load_npc("Cauldron#RES_0178", .mapa$, 28, 24);
+ load_npc("Piano#RES_0178" , .mapa$, 34, 25);
+ end;
+
+}
+
+017-8,21,23,0 script Wardrobe#RES_0178 NPC_NO_SPRITE,{
+ openstorage;
+ end;
+
+OnInit:
+ .distance=3;
+ end;
+}
+
+
+017-8,29,24,0 script Cauldron#RES_0178 NPC_NO_SPRITE,{
+ npctalk l("Alchemy system Not Yet Implemented - Blame Jesusalva");
+ end;
+
+OnInit:
+ .distance=3;
+ end;
+}
+
+
+017-8,34,25,0 script Piano#RES_0178 NPC_NO_SPRITE,{
+ mesc l("Do you want to play a song?");
+ mesc l("This is not saved.");
+ select
+ l("Nothing"),
+ l("Default"),
+ l("Indoors 1 (Peace)"),
+ l("Indoors 2 (Dimonds)"),
+ l("TMW Adventure"),
+ l("Sailing Away!"),
+ l("Magick Real"),
+ l("The Forest"),
+ l("Dragons and Toast"),
+ l("Unforgiving Lands"),
+ l("Arabesque (Action)"),
+ l("No Chains (Tulimshar)"),
+ l("School of Quirks (Candor)"),
+ l("Cake Town (Hurnscald)"),
+ l("Steam (LoF Village)"),
+ l("Woodland Fantasy"),
+ l("Birds in the Sunrise");
+
+ mes "";
+ .@m$="";
+ switch (@menu) {
+ case 1:
+ close;
+ case 2:
+ .@m$="8bit_the_hero.ogg"; break;
+ case 3:
+ .@m$="peace.ogg"; break;
+ case 4:
+ .@m$="peace2.ogg"; break;
+ case 5:
+ .@m$="tmw_adventure.ogg"; break;
+ case 6:
+ .@m$="sail_away.ogg"; break;
+ case 7:
+ .@m$="magick_real.ogg"; break;
+ case 8:
+ .@m$="dariunas_forest.ogg"; break;
+ case 9:
+ .@m$="dragon_and_toast.ogg"; break;
+ case 10:
+ .@m$="Unforgiving_Lands.ogg"; break;
+ case 11:
+ .@m$="Arabesque.ogg"; break;
+ case 12:
+ .@m$="mvrasseli_nochains.ogg"; break;
+ case 13:
+ .@m$="school_of_quirks.ogg"; break;
+ case 14:
+ .@m$="caketown.ogg"; break;
+ case 15:
+ .@m$="steam.ogg"; break;
+ case 16:
+ .@m$="woodland_fantasy.ogg"; break;
+ case 17:
+ .@m$="tws_birds_in_the_sunrise.ogg"; break;
+
+ }
+ changemusic "017-8", .@m$;
+ close;
+
+OnInit:
+ .distance=3;
+ end;
+}
+
diff --git a/npc/_import.txt b/npc/_import.txt
index cf02e351b..a724e22f1 100644
--- a/npc/_import.txt
+++ b/npc/_import.txt
@@ -99,6 +99,8 @@
@include "npc/017-4/_import.txt"
@include "npc/017-5/_import.txt"
@include "npc/017-6/_import.txt"
+@include "npc/017-7/_import.txt"
+@include "npc/017-8/_import.txt"
@include "npc/018-1-1/_import.txt"
@include "npc/018-1/_import.txt"
@include "npc/018-2-1/_import.txt"