Thread Tools Display Modes
05-20-11, 07:24 AM   #1
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Auto confirm BoP

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?
  Reply With Quote
05-21-11, 08:11 PM   #2
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 115
I remember toying around with this a while back and the only way that I was able to get it to work was to force it to wait and then loot the item. This is what I use to loot BoP items while solo.
Code:
local g = CreateFrame("Frame")
g:RegisterEvent("LOOT_BIND_CONFIRM")
g:SetScript("OnEvent", function(self, event, id)
	if GetNumRaidMembers() == 0 and GetNumPartyMembers() == 0 then
		local elapsed = 0
		self:SetScript("OnUpdate", function(self, elap)
			elapsed = elapsed + elap
			if elapsed < 0.2 then
				StaticPopup_Hide("LOOT_BIND")
				return
			end
			elapsed = 0
			ConfirmLootSlot(id)
		end)
	end
end)
I don't know if this is the most efficient method, but it does work.
  Reply With Quote
05-21-11, 11:23 PM   #3
Gsusnme
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 55
I believe Confirm Loot Roll does exactly what you are trying to do, maybe take a gander at it's code?

Or you know, just use that one.
  Reply With Quote
05-21-11, 11:27 PM   #4
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 115
Originally Posted by Gsusnme View Post
I believe Confirm Loot Roll does exactly what you are trying to do, maybe take a gander at it's code?

Or you know, just use that one.
That just suppresses the BoP warning when you're rolling on items in groups.
  Reply With Quote
05-22-11, 04:33 AM   #5
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Thanks for the reply, Dainton. I guess this works just as well.
  Reply With Quote
05-22-11, 05:12 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Originally Posted by Haleth View Post
... the problem is I have to click the item twice. The first time nothing happens, the second time it's looted.
The game tends to require a certain amount of time to pass between looting a BoP item and confirming a loot roll. This only happens when you're solo (not in a party/raid) and the time seems to only start at the first loot attempt.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Auto confirm BoP


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off