WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   [BETA] Tokens in tooltip (https://www.wowinterface.com/forums/showthread.php?t=58263)

cokedrivers 10-10-20 09:26 AM

[BETA] Tokens in tooltip
 
I am having issues showing my backpack tokens in my toolip of my datatext.

Here is the code from beta:
Code:

                        for i = 1, GetNumWatchedTokens() do
                                local name, count, extraCurrencyType, icon, itemID = C_CurrencyInfo.GetBackpackCurrencyInfo(i)
                                if name and i == 1 then
                                        GameTooltip:AddLine(" ")
                                        GameTooltip:AddLine(CURRENCY..":")
                                end
                                local r, g, b = 1,1,1
                                if itemID then r, g, b = GetItemQualityColor(select(3, GetItemInfo(itemID))) end
                                if name and count then GameTooltip:AddDoubleLine(name, count, r, g, b, 1, 1, 1) end
                        end

Here is the screenshot:


and the code from retail:
Code:

                        for i = 1, GetNumWatchedTokens() do
                                local name, count, extraCurrencyType, icon, itemID = GetBackpackCurrencyInfo(i)
                                if name and i == 1 then
                                        GameTooltip:AddLine(" ")
                                        GameTooltip:AddLine(CURRENCY..":")
                                end
                                local r, g, b = 1,1,1
                                if itemID then r, g, b = GetItemQualityColor(select(3, GetItemInfo(itemID))) end
                                if name and count then GameTooltip:AddDoubleLine(name, count, r, g, b, 1, 1, 1) end
                        end

her is a screen shot:


as you can see the only thing i changes was GetBackpackCurrencyInfo to C_CurrencyInfo.GetBackpackCurrencyInfo.

Thanks for any help with this.

Voopie 10-11-20 06:39 AM

In haste ^-^

https://www.townlong-yak.com/framexm...ckCurrencyInfo
https://www.townlong-yak.com/framexm...etCurrencyInfo

Lua Code:
  1. local currencyInfo;
  2. local r, g, b = 1, 1, 1;
  3.  
  4. for i = 1, GetNumWatchedTokens() do
  5.     currencyInfo = C_CurrencyInfo.GetBackpackCurrencyInfo(i);
  6.  
  7.     if currencyInfo and currencyInfo.name then
  8.         if i == 1 then
  9.             GameTooltip:AddLine(' ');
  10.             GameTooltip:AddLine(CURRENCY .. ':');
  11.         end
  12.  
  13.         r, g, b = GetItemQualityColor(C_CurrencyInfo.GetCurrencyInfo(currencyInfo.currencyTypesID).quality);
  14.         GameTooltip:AddDoubleLine(currencyInfo.name, currencyInfo.quantity, r, g, b, 1, 1, 1);
  15.     end
  16. end

cokedrivers 10-13-20 05:53 AM

Quote:

Originally Posted by Voopie (Post 337081)
In haste ^-^

https://www.townlong-yak.com/framexm...ckCurrencyInfo
https://www.townlong-yak.com/framexm...etCurrencyInfo

Lua Code:
  1. local currencyInfo;
  2. local r, g, b = 1, 1, 1;
  3.  
  4. for i = 1, GetNumWatchedTokens() do
  5.     currencyInfo = C_CurrencyInfo.GetBackpackCurrencyInfo(i);
  6.  
  7.     if currencyInfo and currencyInfo.name then
  8.         if i == 1 then
  9.             GameTooltip:AddLine(' ');
  10.             GameTooltip:AddLine(CURRENCY .. ':');
  11.         end
  12.  
  13.         r, g, b = GetItemQualityColor(C_CurrencyInfo.GetCurrencyInfo(currencyInfo.currencyTypesID).quality);
  14.         GameTooltip:AddDoubleLine(currencyInfo.name, currencyInfo.quantity, r, g, b, 1, 1, 1);
  15.     end
  16. end

Thank You so much for the help. Works Great.


All times are GMT -6. The time now is 07:25 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI