Originally Posted by Dridzt
Code:
local QueueStatusMinimapButton_OnClick_orig = QueueStatusMinimapButton_OnClick
QueueStatusMinimapButton_OnClick = function(...)
local _, instanceType = IsInInstance()
local _, button = ...
if instanceType == "pvp" and button == "LeftButton" then
local shown = WorldStateScoreFrame:IsVisible() and WorldStateScoreFrame:Hide() or WorldStateScoreFrame:Show()
else
QueueStatusMinimapButton_OnClick_orig(...)
end
end
Warning: drycoded
Alternative version of the same thing in case the button is using 'new style' <OnShow function='blah'/> handler.
Code:
local QueueStatusMinimapButton_OnClick_orig = QueueStatusMinimapButton:GetScript("OnClick")
QueueStatusMinimapButton:SetScript("OnClick", function(...)
local _, instanceType = IsInInstance()
local _, button = ...
if instanceType == "pvp" and button == "LeftButton" then
local shown = WorldStateScoreFrame:IsVisible() and WorldStateScoreFrame:Hide() or WorldStateScoreFrame:Show()
else
QueueStatusMinimapButton_OnClick_orig(...)
end
end)
|
Thank you, saving the original function was the part I was missing.
Final code (seems to be working fine as far as my testing goes):
Lua Code:
local QueueStatusMinimapButton_OnClick_orig = QueueStatusMinimapButton:GetScript("OnClick")
QueueStatusMinimapButton:SetScript("OnClick", function(...)
local isInstance, instanceType = IsInInstance()
local _, button = ...
if isInstance and instanceType == "pvp" and button == "LeftButton" then
if WorldStateScoreFrame:IsVisible() then
WorldStateScoreFrame:Hide()
else
WorldStateScoreFrame:Show()
end
else
QueueStatusMinimapButton_OnClick_orig(...)
end
end)