From f5afaaa6266275527d8f84d3d41929f8fc2a84e8 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Fri, 19 Feb 2016 16:30:44 +0100 Subject: [PATCH 1/3] Don't error out when no item id could be parsed --- BagSync.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BagSync.lua b/BagSync.lua index 143b4c6..1a45d1c 100644 --- a/BagSync.lua +++ b/BagSync.lua @@ -846,7 +846,9 @@ local function AddItemToTooltip(frame, link) --workaround end end end - link = select(2, GetItemInfo(newItemId)) -- replace original link with our found link + if newItemId then + link = select(2, GetItemInfo(newItemId)) -- replace original link with our found link + end end end -- 1.7.9.5 From 59f3c8374495a55d526ff3f230c071eef7e7c29a Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Wed, 20 Jul 2016 13:10:32 +0200 Subject: [PATCH 2/3] Ignore Dalaran Hearthstone --- BagSync.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BagSync.lua b/BagSync.lua index 1a45d1c..83d97f5 100644 --- a/BagSync.lua +++ b/BagSync.lua @@ -866,7 +866,7 @@ local function AddItemToTooltip(frame, link) --workaround end --ignore the hearthstone and blacklisted items - if itemLink and tonumber(itemLink) and (tonumber(itemLink) == 6948 or tonumber(itemLink) == 110560 or BS_BL[tonumber(itemLink)]) then + if itemLink and tonumber(itemLink) and (tonumber(itemLink) == 6948 or tonumber(itemLink) == 110560 or tonumber(itemLink) == 140192 or BS_BL[tonumber(itemLink)]) then frame:Show() return end -- 1.7.9.5 From b0c331bab2c8faecc86d01a48fad101140ea9384 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Wed, 20 Jul 2016 13:10:46 +0200 Subject: [PATCH 3/3] Update TradeSkill API --- BagSync.lua | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/BagSync.lua b/BagSync.lua index 83d97f5..4e2de79 100644 --- a/BagSync.lua +++ b/BagSync.lua @@ -834,14 +834,14 @@ end local function AddItemToTooltip(frame, link) --workaround if (link) then local itemId = tonumber(string.match(link, "item:(%d+):")) -- get itemID // itemID seems to be "0" for every reagent in profession window?! - if (itemId == 0 and TradeSkillFrame ~= nil and TradeSkillFrame:IsVisible()) then -- some other frames show ID = 0 aswell, so limit this workaround to the profession window || IMPORTANT: TradeSkillFrame ~= nil has to be checked BEFORE TradeSkillFrame:IsVisible() + if (itemId == nil or itemId == 0 and TradeSkillFrame ~= nil and TradeSkillFrame:IsVisible()) then -- some other frames show ID = 0 aswell, so limit this workaround to the profession window || IMPORTANT: TradeSkillFrame ~= nil has to be checked BEFORE TradeSkillFrame:IsVisible() local newItemId - if ((GetMouseFocus():GetName()) == "TradeSkillSkillIcon") then --replace TradeSkill - newItemId = tonumber(GetTradeSkillItemLink(TradeSkillFrame.selectedSkill):match("item:(%d+):")) + if (GetMouseFocus() == TradeSkillFrame.DetailsFrame.Contents.ResultIcon) then --replace TradeSkill + newItemId = tonumber(C_TradeSkillUI.GetRecipeItemLink(TradeSkillFrame.RecipeList.selectedRecipeID):match("item:(%d+):")) else -- could check if a reagent is under mouse, but since we have to check it 3 lines later again... for i = 1, 12 do -- how many reagents can a reciepe have? lets assume not more than 12 - if ((GetMouseFocus():GetName()) == "TradeSkillReagent"..i) then --replace TradeSkillReagents - newItemId = tonumber(GetTradeSkillReagentItemLink(TradeSkillFrame.selectedSkill, i):match("item:(%d+):")) + if (GetMouseFocus() == TradeSkillFrame.DetailsFrame.Contents["Reagent" .. i]) then --replace TradeSkillReagents + newItemId = tonumber(C_TradeSkillUI.GetRecipeReagentItemLink(TradeSkillFrame.RecipeList.selectedRecipeID, i):match("item:(%d+):")) break --end loop if correct one already found end end @@ -1426,9 +1426,9 @@ end function BagSync:TRADE_SKILL_SHOW() --IsTradeSkillLinked() returns true only if trade window was opened from chat link (meaning another player) - if (not IsTradeSkillLinked()) then + if (not C_TradeSkillUI.IsTradeSkillLinked()) then - local tradename = _G.GetTradeSkillLine() + local tradename = C_TradeSkillUI.GetTradeSkillLine() local prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions() local iconProf1 = prof1 and select(2, GetProfessionInfo(prof1)) @@ -1442,9 +1442,9 @@ function BagSync:TRADE_SKILL_SHOW() } --prof1 - if prof1 and (GetProfessionInfo(prof1) == tradename) and GetTradeSkillListLink() then + if prof1 and (GetProfessionInfo(prof1) == tradename) and C_TradeSkillUI.GetTradeSkillListLink() then local skill = select(3, GetProfessionInfo(prof1)) - BS_CD[1] = { tradename, GetTradeSkillListLink(), skill } + BS_CD[1] = { tradename, C_TradeSkillUI.GetTradeSkillListLink(), skill } elseif prof1 and iconProf1 and noLinkTS[iconProf1] then --only store if it's herbalism, skinning, or mining doRegularTradeSkill(prof1, 1) @@ -1454,9 +1454,9 @@ function BagSync:TRADE_SKILL_SHOW() end --prof2 - if prof2 and (GetProfessionInfo(prof2) == tradename) and GetTradeSkillListLink() then + if prof2 and (GetProfessionInfo(prof2) == tradename) and C_TradeSkillUI.GetTradeSkillListLink() then local skill = select(3, GetProfessionInfo(prof2)) - BS_CD[2] = { tradename, GetTradeSkillListLink(), skill } + BS_CD[2] = { tradename, C_TradeSkillUI.GetTradeSkillListLink(), skill } elseif prof2 and iconProf2 and noLinkTS[iconProf2] then --only store if it's herbalism, skinning, or mining doRegularTradeSkill(prof2, 2) @@ -1482,18 +1482,18 @@ function BagSync:TRADE_SKILL_SHOW() end --cooking - if cooking and (GetProfessionInfo(cooking) == tradename) and GetTradeSkillListLink() then + if cooking and (GetProfessionInfo(cooking) == tradename) and C_TradeSkillUI.GetTradeSkillListLink() then local skill = select(3, GetProfessionInfo(cooking)) - BS_CD[5] = { tradename, GetTradeSkillListLink(), skill } + BS_CD[5] = { tradename, C_TradeSkillUI.GetTradeSkillListLink(), skill } elseif not cooking and BS_CD[5] then --they removed a profession BS_CD[5] = nil end --firstAid - if firstAid and (GetProfessionInfo(firstAid) == tradename) and GetTradeSkillListLink() then + if firstAid and (GetProfessionInfo(firstAid) == tradename) and C_TradeSkillUI.GetTradeSkillListLink() then local skill = select(3, GetProfessionInfo(firstAid)) - BS_CD[6] = { tradename, GetTradeSkillListLink(), skill } + BS_CD[6] = { tradename, C_TradeSkillUI.GetTradeSkillListLink(), skill } elseif not firstAid and BS_CD[6] then --they removed a profession BS_CD[6] = nil -- 1.7.9.5