Fix calling the wrong function

This commit is contained in:
rilgamon 2021-04-03 16:27:56 +02:00
parent 28161e3070
commit b12e3b475c
1 changed files with 13 additions and 11 deletions

View File

@ -3,11 +3,11 @@ local childName = addon['childName']
local child = addon[childName]
local events, db = {}
local hookedCraft = {}
local craftTip = CreateFrame( "GameTooltip", format("%sCraftReagentTip",childName), nil, "GameTooltipTemplate")
local function CraftReagent_OnLeave(self,...)
local craftTip = CreateFrame("GameTooltip", format("%sCraftReagentTip",childName), nil, "GameTooltipTemplate")
local function CraftReagent_OnLeave(self)
craftTip:Hide()
end
local function CraftReagent_OnEnter(self,...)
local function CraftReagent_OnEnter(self)
if(self.hasItem==1) then
local itemName = self['Name']:GetText()
if(itemName) then
@ -17,7 +17,7 @@ local function CraftReagent_OnEnter(self,...)
craftTip:SetOwner(self, "ANCHOR_TOPLEFT")
if(id) then
craftTip:SetItemByID(id)
GameTooltip_OnTooltipSetItem(craftTip)
child.GameTooltip_OnTooltipSetItem(craftTip)
else
craftTip:SetCraftItem(GetCraftSelectionIndex(), self:GetID())
end
@ -26,13 +26,15 @@ local function CraftReagent_OnEnter(self,...)
end
end
end
function events:CRAFT_SHOW(...)
for i = 1, MAX_CRAFT_REAGENTS,1 do
local reag = format("CraftReagent%i", i)
if(not hookedCraft[reag]) then
_G[reag]:SetScript("OnEnter", CraftReagent_OnEnter)
_G[reag]:SetScript("OnLeave", CraftReagent_OnLeave)
hookedCraft[reag] = true
function events:CRAFT_SHOW()
if(not db['donthookCraftFrame']) then
for i = 1, MAX_CRAFT_REAGENTS do
local reag = format("CraftReagent%i", i)
if(not hookedCraft[reag]) then
_G[reag]:SetScript("OnEnter", CraftReagent_OnEnter)
_G[reag]:SetScript("OnLeave", CraftReagent_OnLeave)
hookedCraft[reag] = true
end
end
end
end