Spellflyout, SpellFlyout_Toggle, and taint
Hello all
I'm stuck with a bad problem again. :) My intention is to use Blizzards spellflyout feature, and to modify the layout of the flyout itself if the flyout buttons are shown (means: the expanding list of spells). My first approach was this: Lua Code:
SpellFlyoutButton1 is the first of the expanding flyout buttons, and the solution works very well for the first button. The buttons new position is exactly as expected. But ... there's a problem with the next buttons (a flyout can have a lot of buttons as you know). If the UI loads then only the first of the buttons (SpellFlyoutButton1) is created. All other buttons are created 'on the fly' if they are really needed. Here's a part of the code for this from the Blizz interface file SpellFlyout.lua ("Createframe" at the bottom): Lua Code:
Now the problem: Obviously I can't set up my WrapScript before the button exists. So I have to listen if the player clicks on a flyout button for the first time (for example via hooking "SpellFlyout_Toggle" - see above) and to apply my script then. Unfortunately this could happen if the player is in combat. And if I then set the WrapScript everything is tainted. :/ The only possible way to work around this I can think of is to force the creation of all flyout buttons before the player enters combat. My first approach to do this was calling SpellFlyout_Toggle() with a set of suitable arguments to initiate the frame creation. Which worked fine. I've managed it to call the function, the flyout was visible, I've wrapped my script to all of the flyout buttons and everything was great. Until I entered combat and tried to open the flyout button ... then the interface stated my code was tainted (when executing the wrapped script). :/ That means, if I call SpellFlyout_Toggle() manually from unsecure code, and if the flyout frames are created by SpellFlyout_Toggle() then they are unsecure!? I'm not sure if I do understand why. The second point is: how do I force the flyout button frames to get build from secure code (like inside a secure snippet) if I can't use SpellFlyout_Toggle() or reference the "Spellflyout" frame there? I'm a bit lost to be honest. Any thoughts or words that could help to enlighten me are greatly appreciated. Thank you. :) |
You should modify them as they are created. Don't force them to be created.
|
Quote:
[e] Nevermind. Thanks for your reply. I guess it's less time consuming to build my own flyout feature than trying to use the existing one. |
The bad thing is, my own flyout would mean I have to call GetFlyoutInfo(). Which means the flyout spells could be dragged to the button out of combat only. :/
The secure framework is such a mess. :( |
Couldn't you store a reference to a secure frame inside an array in combat, and after combat, loop through that same array, do stuff and wipe it after that?
|
Hm.
To implement my own flyout functionality I'll have to query and store the spells/spellids that a flyout (like the mage 'Portal') provides in when the player drags the flyout to my action button. If the player then actually opens the flyout I'll have to set those spellids to all the pop out flyout buttons. The only way to get the actual spellids of a flyout is GetFlyoutInfo()/GetFlyoutSlotInfo(). Which is unsecure and can't be directly called insided a secure snippet. I could call it via CallMethod() and unsecure code. But this will cause taint if I do this in combat. So as far as I understand the whole thing is, that it is impossible to get the actual spell ids of a flyout in combat without tainting my frames. Am I wrong? [e] I could pre-build a simple list of all flyout spells that are available to get around GetFlyoutInfo. Not smart but at least working. Does anyone have an idea where to get a list of all available flyout spells? [e2] Doh. Ok. New idea: I'll query all flyoutIDs up to ... whatever ... 1k and query and store all slots for flyoutIDs that exist on addon load. Then I'll pre-setup flyout action buttons for all of them on addon load. And in combat, if a player drags a flyout to an action button, I'll just have to move/show them. Don't know if this could work, but I'll try it tonight. Also not smart, but could work. :) |
Quote:
Lua Code:
(I'm pretty sure nobody has any flyouts on the General tab, but if they do, just start the i loop from 1 instead of offset.) |
Ok, this is finaly working. If someone has ever to add a flyout functionality to an action button without using type="action" ... this is how it could be done:
Query the players spellbook for all flyout 'spells' if the addon loads (code from Phanx above this post) and store the flyoutid and all the spells for each flyoutid. Create your secure action button frames. Create a set of secure action buttons for the Pop up flyout bar (like 10 should be enough). Use SetFrameRef to add to each of your standard action buttons a reference to all of the 10 Pop up flyout buttons. Like this Lua Code:
Lua Code:
Handle the type "flyout" in the "ReceivingDrag" wrap script for your action buttons as usual and set up a valid texture, etc for your action button. Set the type to "myflyout" and "spell" to the flyoutID (is provided with value or extra value ...). Now use everything within the "OnClick" wrapscript of your action buttons, and set the flyout pop up buttons. Like this: Lua Code:
I don't know if this is the only way. Or if it is unreasonably complicated. But this is the only way I could figure out to to this. If you have any improvements or whatever I would love to hear it. :) [e] There's still one point where this flyout is different from the standard flyout: it can be dragged from your button in combat, but it's not possible to set the dragged button to the cursor (the secure codes pickup don't handle "flyout" actions and doing it myself with PickupSpellBookItem would cause taint again). :/ |
Quote:
|
Quote:
|
All times are GMT -6. The time now is 08:49 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI