summaryrefslogtreecommitdiff
path: root/npc/012-1
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-03-05 16:32:43 +0000
committerJesusaves <cpntb1@ymail.com>2019-03-05 16:32:43 +0000
commitf7267c5a15949048afdd3560fdb7f52a36dfd88f (patch)
treed96465bc7ff8985cff14441cbc16744fd71f2a7e /npc/012-1
parent5c2ffa919d82c5a1b41c74ce1b5f9309af1d2e7e (diff)
downloadserverdata-f7267c5a15949048afdd3560fdb7f52a36dfd88f.tar.gz
serverdata-f7267c5a15949048afdd3560fdb7f52a36dfd88f.tar.bz2
serverdata-f7267c5a15949048afdd3560fdb7f52a36dfd88f.tar.xz
serverdata-f7267c5a15949048afdd3560fdb7f52a36dfd88f.zip
Real Estate attains the expected functionality.
Now we still need utility NPCs (eg. Piano could allow change map music)
Diffstat (limited to 'npc/012-1')
-rw-r--r--npc/012-1/_import.txt1
-rw-r--r--npc/012-1/estate.txt199
2 files changed, 200 insertions, 0 deletions
diff --git a/npc/012-1/_import.txt b/npc/012-1/_import.txt
index c9898eea0..57e4e73f5 100644
--- a/npc/012-1/_import.txt
+++ b/npc/012-1/_import.txt
@@ -5,6 +5,7 @@
"npc/012-1/andrei.txt",
"npc/012-1/bot.txt",
"npc/012-1/dyrinthetraveler.txt",
+"npc/012-1/estate.txt",
"npc/012-1/guards.txt",
"npc/012-1/gwendolyn.txt",
"npc/012-1/hinnak.txt",
diff --git a/npc/012-1/estate.txt b/npc/012-1/estate.txt
new file mode 100644
index 000000000..57f578f1d
--- /dev/null
+++ b/npc/012-1/estate.txt
@@ -0,0 +1,199 @@
+// TMW2: Moubootaur Legends scripts.
+// Author:
+// Jesusalva
+// Description:
+// Real Estate System
+
+// ID: 1
+// $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
+012-1,94,70,0 script Sign#RES_0128 NPC_SWORDS_SIGN,{
+
+ if ($ESTATE_RENTTIME[.id] < gettimetick(2))
+ goto L_RentAvailable;
+
+ if ($ESTATE_OWNER[.id] == getcharid(3))
+ 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_0128::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"));
+
+ 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;
+ }
+ goto L_Manage;
+ close;
+
+OnInit:
+ .sex = G_OTHER;
+ .distance = 3;
+
+ // Estate Settings
+ .id=1; // Estate ID
+ .price=120000; // Monthly rent price
+ .time=60*60*24*30; // How long last default rent time. In future could consider month.
+ end;
+
+}
+
+// Door entrance
+012-1,95,69,0 script #RES_0128 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 "012-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=1; // Estate ID
+ end;
+
+}
+