diff options
author | Jesusaves <cpntb1@ymail.com> | 2019-03-12 18:08:50 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2019-03-12 18:08:50 -0300 |
commit | 3512510a49bc237da531035d918c437c847c3c6b (patch) | |
tree | 74b0af59f48779876dc756eb92371401472ef3ad /npc | |
parent | c3534f514cd5305cc85d69d17be36ff228f16224 (diff) | |
download | serverdata-3512510a49bc237da531035d918c437c847c3c6b.tar.gz serverdata-3512510a49bc237da531035d918c437c847c3c6b.tar.bz2 serverdata-3512510a49bc237da531035d918c437c847c3c6b.tar.xz serverdata-3512510a49bc237da531035d918c437c847c3c6b.zip |
Start simplifying Real Estate by making L_RentAvailable a function
Diffstat (limited to 'npc')
-rw-r--r-- | npc/009-1/estate.txt | 54 | ||||
-rw-r--r-- | npc/009-1/estate_2.txt | 54 | ||||
-rw-r--r-- | npc/012-1/estate.txt | 54 | ||||
-rw-r--r-- | npc/017-1/estate.txt | 54 | ||||
-rw-r--r-- | npc/017-1/estate2.txt | 54 | ||||
-rw-r--r-- | npc/functions/estate.txt | 78 |
6 files changed, 83 insertions, 265 deletions
diff --git a/npc/009-1/estate.txt b/npc/009-1/estate.txt index 87043c9c2..5cc0e1e45 100644 --- a/npc/009-1/estate.txt +++ b/npc/009-1/estate.txt @@ -39,59 +39,7 @@ 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."); - } + realestate_rent(.id, .price); close; L_Manage: diff --git a/npc/009-1/estate_2.txt b/npc/009-1/estate_2.txt index d6e03daec..1dc723d1e 100644 --- a/npc/009-1/estate_2.txt +++ b/npc/009-1/estate_2.txt @@ -39,59 +39,7 @@ 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."); - } + realestate_rent(.id, .price); close; L_Manage: diff --git a/npc/012-1/estate.txt b/npc/012-1/estate.txt index ac8dbae78..12055a35d 100644 --- a/npc/012-1/estate.txt +++ b/npc/012-1/estate.txt @@ -39,59 +39,7 @@ 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."); - } + realestate_rent(.id, .price); close; L_Manage: diff --git a/npc/017-1/estate.txt b/npc/017-1/estate.txt index 95155bda5..3fa82e631 100644 --- a/npc/017-1/estate.txt +++ b/npc/017-1/estate.txt @@ -39,59 +39,7 @@ 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."); - } + realestate_rent(.id, .price); close; L_Manage: diff --git a/npc/017-1/estate2.txt b/npc/017-1/estate2.txt index 69dfcd777..82bb3744c 100644 --- a/npc/017-1/estate2.txt +++ b/npc/017-1/estate2.txt @@ -39,59 +39,7 @@ 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."); - } + realestate_rent(.id, .price); close; L_Manage: diff --git a/npc/functions/estate.txt b/npc/functions/estate.txt index 7a537e579..b60f48191 100644 --- a/npc/functions/estate.txt +++ b/npc/functions/estate.txt @@ -94,3 +94,81 @@ function script realestate_hasmobilia { return false; } + + +////////////////////////////////////////////////////////////////////////////// +///////////// Dialog Helpers +// "If you copy-paste the same line too often, make a function for it" + + +// Rent_Available Label +// Returns true regardless of player decision +// realestate_rent ( estate_id, price, <rent time> ) +function script realestate_rent { + .id=getarg(0); + .price=getarg(1); + .time=getarg(2, 2592000); // Defaults to 30 days + + do + { + 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.") + " " + l("The rent lasts 30 days."); + 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."); + next; + } + } while (@menu == 2); + return true; +} + + + + |