From da9945ae7ea7e6d862e12f473812bcccf7ea87c7 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Tue, 12 Mar 2019 18:15:02 -0300 Subject: Make L_Manage in Real Estate System a global function, too. --- npc/009-1/estate.txt | 78 +---------------------------------------- npc/009-1/estate_2.txt | 78 +---------------------------------------- npc/012-1/estate.txt | 80 ++---------------------------------------- npc/017-1/estate.txt | 78 +---------------------------------------- npc/017-1/estate2.txt | 78 +---------------------------------------- npc/functions/estate.txt | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 96 insertions(+), 386 deletions(-) diff --git a/npc/009-1/estate.txt b/npc/009-1/estate.txt index 5cc0e1e45..5f13e1114 100644 --- a/npc/009-1/estate.txt +++ b/npc/009-1/estate.txt @@ -43,83 +43,7 @@ L_RentAvailable: 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; + realestate_manage(.id, (.price*7/10)); close; OnInit: diff --git a/npc/009-1/estate_2.txt b/npc/009-1/estate_2.txt index 1dc723d1e..94d8ad3a1 100644 --- a/npc/009-1/estate_2.txt +++ b/npc/009-1/estate_2.txt @@ -43,83 +43,7 @@ L_RentAvailable: 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; + realestate_manage(.id, (.price*7/10)); close; OnInit: diff --git a/npc/012-1/estate.txt b/npc/012-1/estate.txt index 12055a35d..69493dc18 100644 --- a/npc/012-1/estate.txt +++ b/npc/012-1/estate.txt @@ -43,83 +43,7 @@ L_RentAvailable: 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; + realestate_manage(.id, (.price*7/10)); close; OnInit: @@ -128,7 +52,7 @@ OnInit: // Estate Settings .id=1; // Estate ID - .price=120000; // Monthly rent price + .price=120000; // Monthly rent price. Renew is only 70% from this value. .time=60*60*24*30; // How long last default rent time. In future could consider month. end; diff --git a/npc/017-1/estate.txt b/npc/017-1/estate.txt index 3fa82e631..0f2e52793 100644 --- a/npc/017-1/estate.txt +++ b/npc/017-1/estate.txt @@ -43,83 +43,7 @@ L_RentAvailable: 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; + realestate_manage(.id, (.price*7/10)); close; OnInit: diff --git a/npc/017-1/estate2.txt b/npc/017-1/estate2.txt index 82bb3744c..66a33e439 100644 --- a/npc/017-1/estate2.txt +++ b/npc/017-1/estate2.txt @@ -43,83 +43,7 @@ L_RentAvailable: 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; + realestate_manage(.id, (.price*7/10)); close; OnInit: diff --git a/npc/functions/estate.txt b/npc/functions/estate.txt index b60f48191..e0290a12d 100644 --- a/npc/functions/estate.txt +++ b/npc/functions/estate.txt @@ -172,3 +172,93 @@ function script realestate_rent { + +// L_Manage Label +// Returns true regardless of player decision +// realestate_manage ( estate_id, price, ) +function script realestate_manage { + .id=getarg(0); + .price=getarg(1); + .time=getarg(2, 2592000); // Defaults to 30 days + + do + { + 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: + 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); + } + } + } while (@menu != 1); + return true; +} + -- cgit v1.2.3-70-g09d2