diff options
Diffstat (limited to 'npc/functions/banker.txt')
-rw-r--r-- | npc/functions/banker.txt | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/npc/functions/banker.txt b/npc/functions/banker.txt new file mode 100644 index 00000000..5692d238 --- /dev/null +++ b/npc/functions/banker.txt @@ -0,0 +1,182 @@ +// Bank scripts +function script Banking { + do + { + if (BankVault > 0) { + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("You currently have @@ GP on your bank account.", + format_number(BankVault)), + l("What do you want to do with your money?"); + } else { + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("What do you want to do with your money?"); + } + + select + rif(Zeny > 0, l("Deposit.")), + rif(BankVault > 0, l("Withdraw.")), + l("I'm done."); + + switch (@menu) + { + case 1: + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("How much do you want to deposit?"); + + menuint + l("Other."), -1, + rif(Zeny >= 1000, format_number(1000) + " GP."), 1000, + rif(Zeny >= 2500, format_number(2500) + " GP."), 2500, + rif(Zeny >= 5000, format_number(5000) + " GP."), 5000, + rif(Zeny >= 10000, format_number(10000) + " GP."), 10000, + rif(Zeny >= 25000, format_number(25000) + " GP."), 25000, + rif(Zeny >= 50000, format_number(50000) + " GP."), 50000, + rif(Zeny >= 100000, format_number(100000) + " GP."), 100000, + l("All of my money."), -2, + l("I changed my mind."), -3; + + switch (@menuret) { + case -1: + input @menuret; + break; + case -2: + @menuret = Zeny; + } + + if (@menuret > 0) { + if (@menuret > Zeny) { + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("You do not have enough Gold on yourself."); + break; + } + + @menuret = min(MAX_BANK_ZENY, @menuret); // make sure the variable can't overflow + .@before = BankVault; // amount before the deposit + .@max = MAX_BANK_ZENY - BankVault; // maximum possible deposit + .@deposit = min(.@max, @menuret); // actual deposit + + if (.@deposit > 0) { + BankVault += .@deposit; // add to bank + Zeny -= .@deposit; // remove from inventory + + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("You made a cash deposit of @@ GP.", format_number(.@deposit)); + } + } + break; + + case 2: + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("How much do you want to withdraw?"); + + menuint + l("Other."), -1, + rif(BankVault >= 1000, format_number(1000) + " GP."), 1000, + rif(BankVault >= 2500, format_number(2500) + " GP."), 2500, + rif(BankVault >= 5000, format_number(5000) + " GP."), 5000, + rif(BankVault >= 10000, format_number(10000) + " GP."), 10000, + rif(BankVault >= 25000, format_number(25000) + " GP."), 25000, + rif(BankVault >= 50000, format_number(50000) + " GP."), 50000, + rif(BankVault >= 100000, format_number(100000) + " GP."), 100000, + l("All of my money."), -2, + l("I changed my mind."), -3; + + switch (@menuret) + { + case -1: + input @menuret; + break; + case -2: + @menuret = BankVault; + } + + if (@menuret > 0) { + if (@menuret > BankVault) { + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("You do not have enough Gold Pieces on your bank account."); + break; + } + + @menuret = min(MAX_ZENY, @menuret); // make sure the variable can't overflow + .@before = Zeny; // amount before the withdrawal + .@max = MAX_ZENY - Zeny; // maximum possible withdrawal + .@withdrawal = min(.@max, @menuret); // actual withdrawal + + if (.@withdrawal > 0) { + Zeny += .@withdrawal; // add to inventory + BankVault -= .@withdrawal; // remove from bank + + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("You withdrew a total of @@ GP.", format_number(.@withdrawal)); + } + } + break; + default: return; + } + } while (true); +} + +function script Banker { + mesn; + mes l("\"Welcome to the bank!"); + mes l("How can I help you?\""); + next; + do + { + select + l("I would like to store some items."), + l("I would like to perform money transactions."), + l("Did I received any mail?"), + rif(getcharid(2) > 0, l("I would like to open Guild Storage.")), + l("Bye."); + + switch (@menu) { + case 1: + closeclientdialog; + openstorage; + close; + break; + case 2: + Banking(); + // Shader quest + if (BankVault >= 10000000 && + BaseLevel >= 85 && + getq(General_Banker) < 1) { + mesq l("Oh."); + next; + mesq l("It seems you managed to amass quite a fortune!"); + next; + mesq l("Thank you for using our services. Please accept this little gift."); + setq General_Banker, 1; + getitem CashiersShade, 1; + next; + } + break; + case 3: + // NOTE: These values are HARDCODED, do not try changing it! + mesc l("Note: Transfering items on mail cost %s GP/item", fnum(2500)); + mesc l("Money transference will have a %d %% fee as well.", 2); + next; + closeclientdialog; + openmail(); + close; + break; + case 4: + if (getcharid(3) != getguildinfo(GUILDINFO_MASTER_CID, getcharid(2))) { + mesn; + mesq l("Only %s is authorized to use the Guild Storage.", getguildinfo(GUILDINFO_MASTER_NAME, getcharid(2))); + break; + } else { + if (guildopenstorage()) + mesc l("Storage temporarily unavailable, someone else might be using it."); + } + } + if (@menu != 5) { + speech S_FIRST_BLANK_LINE | S_LAST_NEXT | S_NO_NPC_NAME, + l("Something else?"); + } + } while (@menu != 5); + closeclientdialog; + goodbye; + close; +} |