Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 

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