Drift and TSM with Blizzard Merchant Frame
Arcus323 opened this issue ยท 1 comments
The merchant frame was the only frame Drift seemed to be unable to remember the location of after login/reload. I finally got fed up and started looking into the code to figure out why that was and discovered the FixTradeSkillMaster function and the bug report that generated it. While that definitely fixed the issue with the window when using TSM's merchant window, it introduced a new bug when using TSM but Blizzard's default merchant window by zeroing out Drift's saved variables for the merchant window on load.
After some poking around to see what calls were being triggered when TSM's button to swap between their frame and Blizzard's frame, I found that DriftHelpers:resetScaleAndPosition would get called so I injected a call to DriftHelpers:FixTradeSkillMaster in there and updated DriftHelpers:FixTradeSkillMaster as follows. This preserved the Blizzard's frame's location when swapping to TSM's frame while also hiding the frame when swapping to TSM's frame.
I realize this is probably pretty kludgy since i don't have a ton of WoW Lua experience but I'm hoping you might be able to add something for a future release so the merchant window works if you have TSM but don't use their version.
function DriftHelpers:FixTradeSkillMaster()
if not IsAddOnLoaded("TradeSkillMaster") then
return
end
if hasFixedTradeSkillMaster and not TradeSkillMasterDB["g@ @vendoringUIContext@showDefault"] then
return
end
if hasFixedTradeSkillMaster and TradeSkillMasterDB["g@ @vendoringUIContext@showDefault"] then
DriftPoints[MerchantFrame:GetName()] = DriftPoints[MerchantFrame:GetName().."TSM"]
MerchantFrame:SetClampedToScreen(true)
hasFixedTradeSkillMaster = false
return
end
if MerchantFrame and not TradeSkillMasterDB["g@ @vendoringUIContext@showDefault"] then
DriftPoints[MerchantFrame:GetName().."TSM"] = DriftPoints[MerchantFrame:GetName()]
DriftPoints[MerchantFrame:GetName()] = nil
MerchantFrame:SetClampedToScreen(false)
hasFixedTradeSkillMaster = true
end
end