From 0a973c034c314eec7574c4afae82c96dc1a6d0b3 Mon Sep 17 00:00:00 2001 From: gumi Date: Tue, 25 Apr 2017 21:04:22 -0400 Subject: convert the old bank vault to the new bank vault --- npc/001-2-19/lloyd.txt | 8 ++++++++ npc/commands/debug-preset.txt | 2 +- npc/commands/debug.txt | 2 +- npc/commands/zeny.txt | 24 ++++++++++++------------ npc/functions/bank.txt | 40 ++++++++++++++++++++-------------------- 5 files changed, 42 insertions(+), 34 deletions(-) diff --git a/npc/001-2-19/lloyd.txt b/npc/001-2-19/lloyd.txt index 2f3a959b..67e3fbc0 100644 --- a/npc/001-2-19/lloyd.txt +++ b/npc/001-2-19/lloyd.txt @@ -233,4 +233,12 @@ OnInit: .sex = G_MALE; .distance = 4; end; + +OnPCLoginEvent: + if (#MerchantBank) + { + BankVault += max(0, #MerchantBank); + #MerchantBank = 0; + } + end; } diff --git a/npc/commands/debug-preset.txt b/npc/commands/debug-preset.txt index 59cda9f2..a0112e58 100644 --- a/npc/commands/debug-preset.txt +++ b/npc/commands/debug-preset.txt @@ -217,7 +217,7 @@ function script DoRoutine { break; case 122: /* z => zeny */ Zeny = parsev(Zeny, .@args$[0], 0, 0x7FFFFFFE); - #MerchantBank = parsev(#MerchantBank, .@args$[1], 0, 0x7FFFFFFF); + BankVault = parsev(BankVault, .@args$[1], 0, MAX_BANK_ZENY); break; } } diff --git a/npc/commands/debug.txt b/npc/commands/debug.txt index fc352bd2..193abb5b 100644 --- a/npc/commands/debug.txt +++ b/npc/commands/debug.txt @@ -10,7 +10,7 @@ function script GlobalDebugMenu { closedialog; doevent "::OnGlobalQuestReset"; // executes in all quest npcs // FIXME: maybe have a `resetquest` buildin? Zeny = 0; - #MerchantBank = 0; + BankVault = 0; clearitem; warp "000-0", 0, 0; // starting point end; // script must end for doevent to execute diff --git a/npc/commands/zeny.txt b/npc/commands/zeny.txt index ff323465..3dd9b4c3 100644 --- a/npc/commands/zeny.txt +++ b/npc/commands/zeny.txt @@ -25,15 +25,15 @@ OnCall: Zeny = 0; if (.@delta$ == "---") { - #MerchantBank = 0; + BankVault = 0; } } else if (debug && (startswith(.@delta$, "++") || .@delta$ == "")) { - Zeny = 0x7FFFFFFE; + Zeny = MAX_ZENY; if (.@delta$ == "+++") { - #MerchantBank = 0x7FFFFFFF; + BankVault = MAX_BANK_ZENY; } } else @@ -45,14 +45,14 @@ OnCall: if (.@a < 0) // If we can't remove that much zeny, try removing from bank too { Zeny = 0; - .@b = #MerchantBank + .@a; // amount remaining in bank after + .@b = BankVault + .@a; // amount remaining in bank after if (.@b < 0) { - #MerchantBank = 0; + BankVault = 0; } else { - #MerchantBank += .@a; + BankVault += .@a; } } else // We can remove that much zeny @@ -63,18 +63,18 @@ OnCall: else { .@a = Zeny + .@d; // The amount of zeny after - if (.@a < 0 || .@a >= 0x7FFFFFFE) // If we can't add that much zeny, try adding to bank + if (.@a < 0 || .@a >= MAX_ZENY) // If we can't add that much zeny, try adding to bank { .@c = .@d - (.@a - Zeny); // the amount to put in bank - Zeny = 0x7FFFFFFE; - .@b = #MerchantBank + .@c; // amout in bank after - if (.@b < 0 || .@b == 0x7FFFFFFF) + Zeny = MAX_ZENY; + .@b = BankVault + .@c; // amout in bank after + if (.@b < 0 || .@b == MAX_BANK_ZENY) { - #MerchantBank = 0x7FFFFFFF; + BankVault = MAX_BANK_ZENY; } else { - #MerchantBank += .@c; + BankVault += .@c; } } else // We can add that much zeny diff --git a/npc/functions/bank.txt b/npc/functions/bank.txt index d9ed5b94..95a51842 100644 --- a/npc/functions/bank.txt +++ b/npc/functions/bank.txt @@ -6,11 +6,11 @@ function script MerchantGuild_Bank { do { - if (#MerchantBank > 0) + if (BankVault > 0) { speech 1 | 4, l("You currently have @@ Esperin on your bank account.", - format_number(#MerchantBank)), + format_number(BankVault)), l("What do you want to do with your money?"); } else @@ -21,7 +21,7 @@ function script MerchantGuild_Bank { select rif(Zeny > 0, l("Deposit.")), - rif(#MerchantBank > 0, l("Withdraw.")), + rif(BankVault > 0, l("Withdraw.")), l("I'm done."); switch (@menu) @@ -61,14 +61,14 @@ function script MerchantGuild_Bank { break; } - @menuret = min(0x7FFFFFFF, @menuret); // make sure the variable can't overflow - .@before = #MerchantBank; // amount before the deposit - .@max = 0x7FFFFFFF - #MerchantBank; // maximum possible deposit + @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) { - #MerchantBank += .@deposit; // add to bank + BankVault += .@deposit; // add to bank Zeny -= .@deposit; // remove from inventory speech 1 | 4, @@ -83,14 +83,14 @@ function script MerchantGuild_Bank { menuint l("Other."), -1, - rif(#MerchantBank >= 5000, format_number(5000) + " E."), 5000, - rif(#MerchantBank >= 10000, format_number(10000) + " E."), 10000, - rif(#MerchantBank >= 25000, format_number(25000) + " E."), 25000, - rif(#MerchantBank >= 50000, format_number(50000) + " E."), 50000, - rif(#MerchantBank >= 100000, format_number(100000) + " E."), 100000, - rif(#MerchantBank >= 250000, format_number(250000) + " E."), 250000, - rif(#MerchantBank >= 500000, format_number(500000) + " E."), 500000, - rif(#MerchantBank >= 1000000, format_number(1000000) + " E."), 1000000, + rif(BankVault >= 5000, format_number(5000) + " E."), 5000, + rif(BankVault >= 10000, format_number(10000) + " E."), 10000, + rif(BankVault >= 25000, format_number(25000) + " E."), 25000, + rif(BankVault >= 50000, format_number(50000) + " E."), 50000, + rif(BankVault >= 100000, format_number(100000) + " E."), 100000, + rif(BankVault >= 250000, format_number(250000) + " E."), 250000, + rif(BankVault >= 500000, format_number(500000) + " E."), 500000, + rif(BankVault >= 1000000, format_number(1000000) + " E."), 1000000, l("All of my money."), -2, l("I changed my mind."), -3; @@ -100,27 +100,27 @@ function script MerchantGuild_Bank { input @menuret; break; case -2: - @menuret = #MerchantBank; + @menuret = BankVault; } if (@menuret > 0) { - if (@menuret > #MerchantBank) + if (@menuret > BankVault) { speech 1 | 4, l("You do not have enough Esperin on your bank account."); break; } - @menuret = min(0x7FFFFFFE, @menuret); // make sure the variable can't overflow + @menuret = min(MAX_ZENY, @menuret); // make sure the variable can't overflow .@before = Zeny; // amount before the withdrawal - .@max = 0x7FFFFFFE - Zeny; // maximum possible withdrawal + .@max = MAX_ZENY - Zeny; // maximum possible withdrawal .@withdrawal = min(.@max, @menuret); // actual withdrawal if (.@withdrawal > 0) { Zeny += .@withdrawal; // add to inventory - #MerchantBank -= .@withdrawal; // remove from bank + BankVault -= .@withdrawal; // remove from bank speech 1 | 4, l("You withdrew a total of @@ E.", format_number(.@withdrawal)); -- cgit v1.2.3-60-g2f50