SetCurrencyByID, SetCurrencyToken and SetCurrencyTokenByID not firing? - WoWInterface
Thread Tools Display Modes
Prev Previous Post   Next Post Next
04-09-20, 08:20 AM   #1
A Flamescale Wyrmkin
Xruptor's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 122
SetCurrencyByID, SetCurrencyToken and SetCurrencyTokenByID not firing?

So I'm having this bizarre issue where SetCurrencyByID, SetCurrencyToken and SetCurrencyTokenByID are not firing at all when hovering over a token cost in token vendors. Such as War Resources or Honor Tokens and such.

I've tried several methods to figure out why they aren't firing and can only assume another hidden function is being used for GameTooltip. I know it has to do with AltCurrency but can't seem to figure out how to grab the CurrencyID or token being fired for the GameTooltip. Some of these token currencies are pushed to AltCurrencyFrame_Update. Yet not matter what I do or what I hook, I cannot get the token currency to fire for GameTooltip.

Does anyone have any ideas?

I've tried the following.

		hooksecurefunc(GameTooltip, "SetCurrencyToken", function(self, index)
		print('SetCurrencyToken', self, index)

		hooksecurefunc(GameTooltip, "SetCurrencyTokenByID", function(self, currencyID)
		print('SetCurrencyToken', self, currencyID)

		hooksecurefunc(GameTooltip, "SetCurrencyByID", function(self, currencyID)
                print('SetCurrencyByID', self, currencyID)

None of the above works when you hover over a token under a token vendor. Like I said the only thing I can assume is that it's not GameTooltip being used or the Currency is being set by a hidden function. That or it's being passed somehow differently.

The ONLY thing that seems to work is to hook into the token frames themselves under the merchant frame.

		hooksecurefunc("MerchantFrame_UpdateAltCurrency", function(index, indexOnPage, canAfford)
			local itemCount = GetMerchantItemCostInfo(index)
			local frameName = "MerchantItem"..indexOnPage.."AltCurrencyFrame"
			local usedCurrencies = 0

			-- update Alt Currency Frame with itemValues
			if ( itemCount > 0 ) then
				for i=1, MAX_ITEM_COST do
					local itemTexture, itemValue, itemLink = GetMerchantItemCostItem(index, i)
					if ( itemTexture ) then
						usedCurrencies = usedCurrencies + 1
						if not _G[frameName.."Item"..usedCurrencies].isHooked then
							_G[frameName.."Item"..usedCurrencies]:HookScript("OnEnter", function() 
                                                           print('currency', itemLink)
							_G[frameName.."Item"..usedCurrencies].isHooked = true
this code also works, pretty much the same as above but going directly to AltCurrency

		local oldAltCurrencyFrame_Update = AltCurrencyFrame_Update
		AltCurrencyFrame_Update = function(frameName, texture, cost, canAfford)
			if _G[frameName] and _G[frameName].itemLink then
				if not _G[frameName].isHooked then
					_G[frameName]:HookScript("OnEnter", function() 
					_G[frameName].isHooked = true
				print(frameName, texture, cost, canAfford, _G[frameName].itemLink)
			oldAltCurrencyFrame_Update(frameName, texture, cost, canAfford)
Does anyone have any idea of what's going on?
Click HERE for the ultimate idiot test.

if (sizeof(sadness) > sizeof(happiness)) { initDepression(); }

Last edited by Xruptor : 04-09-20 at 08:47 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SetCurrencyByID, SetCurrencyToken and SetCurrencyTokenByID not firing?

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