Mercurial > wow > hansgar_and_franzok_assist
diff Libs/DF/fw.lua @ 42:e0a8f43009ea
- toc and framework update.
| author | Tercio |
|---|---|
| date | Tue, 25 Oct 2016 16:38:32 -0200 |
| parents | a960d5372b0c |
| children | 2bbf129690b0 |
line wrap: on
line diff
--- a/Libs/DF/fw.lua Sat Sep 03 17:53:04 2016 -0300 +++ b/Libs/DF/fw.lua Tue Oct 25 16:38:32 2016 -0200 @@ -1,5 +1,5 @@ -local dversion = 44 +local dversion = 48 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -115,6 +115,7 @@ "CreateAnimation", "CreateScrollBox", "CreateBorder", + "FormatNumber", } DF.table = {} @@ -217,6 +218,43 @@ mmoc = {0, 0.7890625, 80/123, 123/128}, } +local symbol_1K, symbol_10K, symbol_1B +if (GetLocale() == "koKR") then + symbol_1K, symbol_10K, symbol_1B = "천", "만", "억" +elseif (GetLocale() == "zhCN") then + symbol_1K, symbol_10K, symbol_1B = "千", "万", "亿" +elseif (GetLocale() == "zhTW") then + symbol_1K, symbol_10K, symbol_1B = "千", "萬", "億" +end + +if (symbol_1K) then + function DF.FormatNumber (numero) + if (numero > 99999999) then + return format ("%.2f", numero/100000000) .. symbol_1B + elseif (numero > 999999) then + return format ("%.2f", numero/10000) .. symbol_10K + elseif (numero > 99999) then + return floor (numero/10000) .. symbol_10K + elseif (numero > 9999) then + return format ("%.1f", (numero/10000)) .. symbol_10K + elseif (numero > 999) then + return format ("%.1f", (numero/1000)) .. symbol_1K + end + return format ("%.1f", numero) + end +else + function DF.FormatNumber (numero) + if (numero > 999999) then + return format ("%.2f", numero/1000000) .. "M" + elseif (numero > 99999) then + return floor (numero/1000) .. "K" + elseif (numero > 999) then + return format ("%.1f", (numero/1000)) .. "K" + end + return format ("%.1f", numero) + end +end + function DF:IntegerToTimer (value) return "" .. floor (value/60) .. ":" .. format ("%02.f", value%60) end
