mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: add GetCoinTextureString/GetCoinText Lua money formatting utility
Formats copper amounts into "Xg Ys Zc" strings for addon display. GetCoinText is aliased to GetCoinTextureString. Used by money display addons (Titan Panel, MoneyFu) and auction/vendor price formatting.
This commit is contained in:
parent
b659ab9caf
commit
df55242c50
1 changed files with 14 additions and 0 deletions
|
|
@ -1988,6 +1988,20 @@ void LuaEngine::registerCoreAPI() {
|
|||
" SHAMAN={r=0.0,g=0.44,b=0.87}, MAGE={r=0.41,g=0.80,b=0.94},\n"
|
||||
" WARLOCK={r=0.58,g=0.51,b=0.79}, DRUID={r=1.0,g=0.49,b=0.04},\n"
|
||||
"}\n"
|
||||
// Money formatting utility
|
||||
"function GetCoinTextureString(copper)\n"
|
||||
" if not copper or copper == 0 then return '0c' end\n"
|
||||
" copper = math.floor(copper)\n"
|
||||
" local g = math.floor(copper / 10000)\n"
|
||||
" local s = math.floor(math.fmod(copper, 10000) / 100)\n"
|
||||
" local c = math.fmod(copper, 100)\n"
|
||||
" local r = ''\n"
|
||||
" if g > 0 then r = r .. g .. 'g ' end\n"
|
||||
" if s > 0 then r = r .. s .. 's ' end\n"
|
||||
" if c > 0 or r == '' then r = r .. c .. 'c' end\n"
|
||||
" return r\n"
|
||||
"end\n"
|
||||
"GetCoinText = GetCoinTextureString\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue