SecureHandlers and 'equipmentset'
I'm working on my action bar addon an would like to support equipment sets from the Blizz equipment manager.
I've found the following code in SecureHandlers.lua:
local function PickupAny(kind, target, detail, ...)
if (kind == "clear") then
kind, target, detail = target, detail, ...;
if kind == 'action' then
elseif kind == 'bag' then
elseif kind == 'bagslot' then
elseif kind == 'inventory' then
elseif kind == 'item' then
elseif kind == 'macro' then
elseif kind == 'merchant' then
elseif kind == 'petaction' then
elseif kind == 'money' then
elseif kind == 'spell' then
elseif kind == 'companion' then
elseif kind == 'equipmentset' then
function SecureHandler_OnDragEvent(self, snippetAttr, button)
local body = self:GetAttribute(snippetAttr);
if (body) then
body, button, GetCursorInfo()) );
Doesn't that mean that a frame that inherits SecureActionButtonTemplate will support the type 'equipmentset'?
Unfortunatly something like
does not work.
Does someone know if "equipmentset" actually is a valid value for "type"?
Based on that code and the API documentation for PickupEquipmentSet
, it looks like you need to use the set index, not the set name, and I'd expect this to work:
If you want to let the user enter a name instead of an index, you can find the index like this:
I'm not that knowledgable about the equipment set API in general, though... if the indices are not fixed (eg. they can change if the user renames the set or adds a new set) then you probably want to store the set by name, and check its ID every time something changes.
Thank you white cat.
I've tried this:
local button = CreateFrame("CheckButton", "testbutton1", UIParent, "SecureActionButtonTemplate, ActionButtonTemplate")
button:SetPoint("CENTER", UIParent, "CENTER")
local button = CreateFrame("CheckButton", "testbutton2", UIParent, "SecureActionButtonTemplate, ActionButtonTemplate")
button:SetPoint("CENTER", UIParent, "CENTER", 0, 55)
The first button does work (at least on my mage *g*).
The second button still does not. :/
I've created a set named "test". GetEquipmentSetIDByName("test") does return '1', so I'm sure that this is the right index.
I've still no idea what's wrong with it or if "equipmentset" is even a valid type. Any other ideas?
That code from SecureHandlers.lua is for handling dragging. The code to handle clicking/using a button is in SecureTemplates.lua, specifically the possible options for "type" are the entries in the SECURE_ACTIONS table. Based on that you will probably want:
button:SetAttribute("macrotext", "/equipset test")
Oh. Ok. I'll use a macro. :/ Thank you.
But why the hell do they implement draging for a type that is not handled?
Those were possible returns from GetCursorInfo that it was checking.
I'm again digging into this. Now with flyout buttons. :)
I've finally managed to set up a flyout button without using the type "action".
But ... I didn't found a way to support a pick up action for the button.
Right now I'm picking up the button via the flyout id and the PickupSpellBookItem.
local name = GetFlyoutInfo(value)
local spellName = ""
local i = 1
while true do
local spellName = GetSpellBookItemName(i, BOOKTYPE_SPELL)
if spellName == name then
found = i
if not spellName then
do break end
i = i + 1
if found then
But, well ... this is unsecure. Is there really no way to support dragging flyout buttons from the button frame without using "action" and an action id?
I have no idea, but I wouldn't be surprised if there wasn't. If you want to make real custom action buttons outside of the action scope (in API terms), it's suddenly a whole other deal. There's lots of events and function for "actions" only.
|All times are GMT -6. The time now is 07:49 AM.
vBulletin © 2018, Jelsoft Enterprises Ltd
© 2004 - 2017 MMOUI