View Single Post
12-05-20, 03:38 PM   #2
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
I think you can use the id number in place of an actual path based on Blizzard's code:
Lua Code:
  1. function CreateTextureMarkup(file, fileWidth, fileHeight, width, height, left, right, top, bottom, xOffset, yOffset)
  2.     return ("|T%s:%d:%d:%d:%d:%d:%d:%d:%d:%d:%d|t"):format(
  3.           file
  4.         , height
  5.         , width
  6.         , xOffset or 0
  7.         , yOffset or 0
  8.         , fileWidth
  9.         , fileHeight
  10.         , left * fileWidth
  11.         , right * fileWidth
  12.         , top * fileHeight
  13.         , bottom * fileHeight
  14.     );
  15. end
  16.  
  17. function GetCurrencyString(currencyID, overrideAmount, colorCode, abbreviate)
  18.     colorCode = colorCode or HIGHLIGHT_FONT_COLOR_CODE;
  19.  
  20.     local currencyInfo = C_CurrencyInfo.GetCurrencyInfo(currencyID);
  21.     if currencyInfo then
  22.         local currencyTexture = currencyInfo.iconFileID;
  23.         local markup = CreateTextureMarkup(currencyTexture, 64, 64, 16, 16, 0, 1, 0, 1);
  24.         local amountString;
  25.         if abbreviate then
  26.             amountString = AbbreviateNumbers(overrideAmount or currencyInfo.quantity);
  27.         else
  28.             amountString = BreakUpLargeNumbers(overrideAmount or currencyInfo.quantity);
  29.         end
  30.         return ("%s%s %s|r"):format(colorCode, amountString, markup);
  31.     end
  32.  
  33.     return "";
  34. end
  Reply With Quote