Thread Tools Display Modes
11-30-23, 01:22 PM   #1
Buenclima
A Kobold Labourer
Join Date: Nov 2023
Posts: 1
Cast Druid Forms

Hello!

I started developing an addon and I have encounter an issue. (Wotlk Classic)

The addon is able to cast the spell of mounts owned by the user.
The user can store his flying and ground mount and with a simple macro:
“/ms mount” the addon checks if the flying can be done or not (it also checks if possible to use fly in Dalaran), then it casts the spell.

With Druid forms, it is an actual spell and it is protected, I have read the documentation and tried to do like a button using the secure template but no luck… (Example)

Code:
# Example 1
function DebugCastSwiftFlightForm()
    print("Druid Casting")
   
    local btn = CreateFrame("Button", "SwiftFlightFormButton", UIParent, "SecureActionButtonTemplate")
   
    -- Set the macro to cast Swift Flight Form
    btn:SetAttribute("type", "macro")
    btn:SetAttribute("macrotext", "/cast [nostance] Swift Flight Form; [stance:2] !Swift Flight Form")
   
  
    btn:Click("LeftButton")
  
    btn:Hide()
end
Code:
# Example 2
function DebugCastSwiftFlightForm()
    local btn = CreateFrame("Button", "SwiftFlightFormButton", UIParent, "SecureActionButtonTemplate")
   
    -- Set the spell to Swift Flight Form
    btn:SetAttribute("type", "spell")
    btn:SetAttribute("spell", "Swift Flight Form")
   
    
    btn:Click("LeftButton")
end
With Paladins, the mount is available in the new mounts journal so It actually works.

Anyone could help me find information or an example to implement a secure way to cast the flying forms of a druid?

Thank you!

P.S. Here you can have a look at the code (it is my first addon, please forgive me): https://github.com/ravelaso/MountSwitcher
  Reply With Quote
11-30-23, 08:50 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,324
Secure actions can't be run from the command line except for /click. The only alternatives are by physically clicking a button or running a keybind.
__________________
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
11-30-23, 09:15 PM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,929
This might help, or at least explain if it doesn't help. Sounds like the same problem you are having.

https://github.com/Stanzilla/WoWUIBugs/issues/268
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
12-09-23, 12:41 AM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,324
They're calling :Click() directly, which carries their addon taint and throws an action blocked error.
This is completely different than the issue with depending on CVar settings, SecureActionButton templates only activate on either up or down, so you have to register both to function reliably.
__________________
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)

Last edited by SDPhantom : 12-09-23 at 12:44 AM.
  Reply With Quote
12-09-23, 01:08 PM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,929
Ah .. I totally missed that line
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Cast Druid Forms


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