summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2017-01-27 16:17:44 -0500
committergumi <mekolat@users.noreply.github.com>2017-01-28 09:53:54 -0500
commit9cac9a4af2100aaf8eb6c171c015926c0c3fa376 (patch)
tree413e32320199035ad5f9a8f6ac373c381c4d634f
parentd939ac4a4974b5cb879aa43d931d79bbe80f25de (diff)
downloadserverdata-9cac9a4af2100aaf8eb6c171c015926c0c3fa376.tar.gz
serverdata-9cac9a4af2100aaf8eb6c171c015926c0c3fa376.tar.bz2
serverdata-9cac9a4af2100aaf8eb6c171c015926c0c3fa376.tar.xz
serverdata-9cac9a4af2100aaf8eb6c171c015926c0c3fa376.zip
add `format_number` function, make the banker use it
-rw-r--r--npc/functions/bank.txt39
-rw-r--r--npc/functions/string.txt27
2 files changed, 47 insertions, 19 deletions
diff --git a/npc/functions/bank.txt b/npc/functions/bank.txt
index 38cc4744..d9ed5b94 100644
--- a/npc/functions/bank.txt
+++ b/npc/functions/bank.txt
@@ -9,7 +9,8 @@ function script MerchantGuild_Bank {
if (#MerchantBank > 0)
{
speech 1 | 4,
- l("You currently have @@ Esperin on your bank account.", #MerchantBank),
+ l("You currently have @@ Esperin on your bank account.",
+ format_number(#MerchantBank)),
l("What do you want to do with your money?");
}
else
@@ -31,14 +32,14 @@ function script MerchantGuild_Bank {
menuint
l("Other."), -1,
- rif(Zeny >= 5000, "5,000 E."), 5000,
- rif(Zeny >= 10000, "10,000 E."), 10000,
- rif(Zeny >= 25000, "25,000 E."), 25000,
- rif(Zeny >= 50000, "50,000 E."), 50000,
- rif(Zeny >= 100000, "100,000 E."), 100000,
- rif(Zeny >= 250000, "250,000 E."), 250000,
- rif(Zeny >= 500000, "500,000 E."), 500000,
- rif(Zeny >= 1000000, "1,000,000 E."), 1000000,
+ rif(Zeny >= 5000, format_number(5000) + " E."), 5000,
+ rif(Zeny >= 10000, format_number(10000) + " E."), 10000,
+ rif(Zeny >= 25000, format_number(25000) + " E."), 25000,
+ rif(Zeny >= 50000, format_number(50000) + " E."), 50000,
+ rif(Zeny >= 100000, format_number(100000) + " E."), 100000,
+ rif(Zeny >= 250000, format_number(250000) + " E."), 250000,
+ rif(Zeny >= 500000, format_number(500000) + " E."), 500000,
+ rif(Zeny >= 1000000, format_number(1000000) + " E."), 1000000,
l("All of my money."), -2,
l("I changed my mind."), -3;
@@ -71,7 +72,7 @@ function script MerchantGuild_Bank {
Zeny -= .@deposit; // remove from inventory
speech 1 | 4,
- l("You made a cash deposit of @@ E.", .@deposit);
+ l("You made a cash deposit of @@ E.", format_number(.@deposit));
}
}
break;
@@ -82,14 +83,14 @@ function script MerchantGuild_Bank {
menuint
l("Other."), -1,
- rif(#MerchantBank >= 5000, "5,000 E."), 5000,
- rif(#MerchantBank >= 10000, "10,000 E."), 10000,
- rif(#MerchantBank >= 25000, "25,000 E."), 25000,
- rif(#MerchantBank >= 50000, "50,000 E."), 50000,
- rif(#MerchantBank >= 100000, "100,000 E."), 100000,
- rif(#MerchantBank >= 250000, "250,000 E."), 250000,
- rif(#MerchantBank >= 500000, "500,000 E."), 500000,
- rif(#MerchantBank >= 1000000, "1,000,000 E."), 1000000,
+ 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,
l("All of my money."), -2,
l("I changed my mind."), -3;
@@ -122,7 +123,7 @@ function script MerchantGuild_Bank {
#MerchantBank -= .@withdrawal; // remove from bank
speech 1 | 4,
- l("You withdrew a total of @@ E.", .@withdrawal);
+ l("You withdrew a total of @@ E.", format_number(.@withdrawal));
}
}
break;
diff --git a/npc/functions/string.txt b/npc/functions/string.txt
index ef910961..7ee2562b 100644
--- a/npc/functions/string.txt
+++ b/npc/functions/string.txt
@@ -64,3 +64,30 @@ function script zfill {
return .@str$;
}
+
+// format_number( integer [, "separator"] )
+//
+// formats a number properly according to the language of the player,
+// or using the given separator
+function script format_number {
+ .@number$ = str(getarg(0));
+ .@len = getstrlen(.@number$);
+ .@separator$ = getarg(1, ",");
+
+ if (getargcount() < 2 && playerattached())
+ {
+ // get from user language
+ switch (Lang)
+ {
+ case 1: .@separator$ = " "; break; // French
+ default: .@separator$ = ","; // English (default)
+ }
+ }
+
+ for (.@i = .@len - 3; .@i > 0; .@i -= 3)
+ {
+ .@number$ = insertchar(.@number$, .@separator$, .@i);
+ }
+
+ return .@number$;
+}