Slightly altering tekkub's tekkrush addon, I'm trying to let it automatically accept BoP confirm windows. This is what I have (relevant parts are red):
Code:
local f = CreateFrame("Frame")
f:RegisterEvent("CONFIRM_DISENCHANT_ROLL")
f:RegisterEvent("CONFIRM_LOOT_ROLL")
f:RegisterEvent("LOOT_BIND_CONFIRM")
f:SetScript("OnEvent", function(self, event, id, rollType)
for i=1,STATICPOPUP_NUMDIALOGS do
local frame = _G["StaticPopup"..i]
if frame.which == "CONFIRM_LOOT_ROLL" and frame.data == id and frame.data2 == rollType and frame:IsVisible() then StaticPopup_OnClick(frame, 1) end
if frame.which == "LOOT_BIND" then StaticPopup_OnClick(frame, 1) end
end
end)
It works, but the problem is I have to click the item twice. The first time nothing happens, the second time it's looted.
Anyone know what I'm doing wrong?