Thread Tools Display Modes
10-10-20, 09:26 AM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
[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.
  Reply With Quote
10-11-20, 06:39 AM   #2
Voopie
A Murloc Raider
 
Voopie's Avatar
Join Date: Sep 2018
Posts: 4
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
  Reply With Quote
10-13-20, 05:53 AM   #3
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by Voopie View Post
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.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » [BETA] Tokens in tooltip

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off