comparison 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
comparison
equal deleted inserted replaced
41:b740f601e824 42:e0a8f43009ea
1 1
2 local dversion = 44 2 local dversion = 48
3 local major, minor = "DetailsFramework-1.0", dversion 3 local major, minor = "DetailsFramework-1.0", dversion
4 local DF, oldminor = LibStub:NewLibrary (major, minor) 4 local DF, oldminor = LibStub:NewLibrary (major, minor)
5 5
6 if (not DF) then 6 if (not DF) then
7 DetailsFrameworkCanLoad = false 7 DetailsFrameworkCanLoad = false
113 "CreateInCombatTexture", 113 "CreateInCombatTexture",
114 "CreateAnimationHub", 114 "CreateAnimationHub",
115 "CreateAnimation", 115 "CreateAnimation",
116 "CreateScrollBox", 116 "CreateScrollBox",
117 "CreateBorder", 117 "CreateBorder",
118 "FormatNumber",
118 } 119 }
119 120
120 DF.table = {} 121 DF.table = {}
121 122
122 function DF:GetFrameworkFolder() 123 function DF:GetFrameworkFolder()
214 texture = "feedback_sites", 215 texture = "feedback_sites",
215 wowi = {0, 0.7890625, 0, 37/128}, 216 wowi = {0, 0.7890625, 0, 37/128},
216 curse = {0, 0.7890625, 38/123, 79/128}, 217 curse = {0, 0.7890625, 38/123, 79/128},
217 mmoc = {0, 0.7890625, 80/123, 123/128}, 218 mmoc = {0, 0.7890625, 80/123, 123/128},
218 } 219 }
220
221 local symbol_1K, symbol_10K, symbol_1B
222 if (GetLocale() == "koKR") then
223 symbol_1K, symbol_10K, symbol_1B = "천", "만", "억"
224 elseif (GetLocale() == "zhCN") then
225 symbol_1K, symbol_10K, symbol_1B = "千", "万", "亿"
226 elseif (GetLocale() == "zhTW") then
227 symbol_1K, symbol_10K, symbol_1B = "千", "萬", "億"
228 end
229
230 if (symbol_1K) then
231 function DF.FormatNumber (numero)
232 if (numero > 99999999) then
233 return format ("%.2f", numero/100000000) .. symbol_1B
234 elseif (numero > 999999) then
235 return format ("%.2f", numero/10000) .. symbol_10K
236 elseif (numero > 99999) then
237 return floor (numero/10000) .. symbol_10K
238 elseif (numero > 9999) then
239 return format ("%.1f", (numero/10000)) .. symbol_10K
240 elseif (numero > 999) then
241 return format ("%.1f", (numero/1000)) .. symbol_1K
242 end
243 return format ("%.1f", numero)
244 end
245 else
246 function DF.FormatNumber (numero)
247 if (numero > 999999) then
248 return format ("%.2f", numero/1000000) .. "M"
249 elseif (numero > 99999) then
250 return floor (numero/1000) .. "K"
251 elseif (numero > 999) then
252 return format ("%.1f", (numero/1000)) .. "K"
253 end
254 return format ("%.1f", numero)
255 end
256 end
219 257
220 function DF:IntegerToTimer (value) 258 function DF:IntegerToTimer (value)
221 return "" .. floor (value/60) .. ":" .. format ("%02.f", value%60) 259 return "" .. floor (value/60) .. ":" .. format ("%02.f", value%60)
222 end 260 end
223 261