From df55242c50ada4c8aad045dd0b613bccf8395a54 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 20:44:59 -0700 Subject: [PATCH] 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. --- src/addons/lua_engine.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index 9ee23afb..e75d5359 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -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" ); }