Thread Tools Display Modes
04-03-17, 01:12 AM   #1
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
travel form to cat stance

Hi all,
is there an addon or it will be possible to code an addon that when I am playing my druid and I cast the travel form (being indoor where it is not possible) it automatically change to the cat form instead of the human form so I get at least a minor benefit bonus on speed ?

I know that it could be easily done by a macro, but I really like to continue to use the standard stance bar.

P.s.
Another question could also be: May I use a macro in the standard stance bar ?

Thanks.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
04-03-17, 06:00 AM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
This is an extremely experimental hack, but should provide the effect you want.
Lua Code:
  1. if select(2,UnitClass("player"))~="DRUID" then return; end--    Don't run if not a druid
  2. local WatchFrame=CreateFrame("Frame",nil,nil,"SecureHandlerStateTemplate");--   Create State Driver
  3. WatchFrame:SetFrameRef("StanceButton",StanceButton3);-- Link StanceButton3
  4. WatchFrame:SetAttribute("_onstate-form","self:GetFrameRef('StanceButton'):SetID(newstate)");--  Set ID of StanceButton to whatever 'form' state is set to
  5. RegisterStateDriver(WatchFrame,"form","[indoors] 2; 3");--  Register 'form' state to swap when we go indoors/outdoors

The action and stance bars don't use the SecureActionButtonTemplate, so they can't be reconfigured to run custom macros without using up macro slots. The stance bar being non-configurable at all in that respect. The code I posted exploits the fact the stance buttons' OnClick handler references each button's ID, so that's manipulated to toggle which form is used. This is done with secure code and a state driver to make sure taint isn't an issue.

Notes:
- The button texture doesn't change to reflect which form is configured. This is because only the OnClick handler references the button's ID, not the update function. This could be fixed with more code, but at this point, it's just a proof of concept.
- The client and server briefly argue indoors/outdoors when transitioning between them. Be sure to allow a few seconds to pass before activating the button.
__________________
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 : 04-03-17 at 06:25 AM.
  Reply With Quote
04-03-17, 06:01 AM   #3
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
The stance bar is just another bar that appears. It is just like any other bar, you can move things around.
  Reply With Quote
04-03-17, 11:36 AM   #4
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Originally Posted by Kanegasi View Post
The stance bar is just another bar that appears. It is just like any other bar, you can move things around.
Hi,
I was able to move the stance bar but not to put a macro in its buttons.
Am I miss something ?

Thanks anyway for your kind reply...
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
04-03-17, 11:44 AM   #5
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Originally Posted by SDPhantom View Post
This is an extremely experimental hack, but should provide the effect you want.
Lua Code:
  1. if select(2,UnitClass("player"))~="DRUID" then return; end--    Don't run if not a druid
  2. local WatchFrame=CreateFrame("Frame",nil,nil,"SecureHandlerStateTemplate");--   Create State Driver
  3. WatchFrame:SetFrameRef("StanceButton",StanceButton3);-- Link StanceButton3
  4. WatchFrame:SetAttribute("_onstate-form","self:GetFrameRef('StanceButton'):SetID(newstate)");--  Set ID of StanceButton to whatever 'form' state is set to
  5. RegisterStateDriver(WatchFrame,"form","[indoors] 2; 3");--  Register 'form' state to swap when we go indoors/outdoors

The action and stance bars don't use the SecureActionButtonTemplate, so they can't be reconfigured to run custom macros without using up macro slots. The stance bar being non-configurable at all in that respect. The code I posted exploits the fact the stance buttons' OnClick handler references each button's ID, so that's manipulated to toggle which form is used. This is done with secure code and a state driver to make sure taint isn't an issue.

Notes:
- The button texture doesn't change to reflect which form is configured. This is because only the OnClick handler references the button's ID, not the update function. This could be fixed with more code, but at this point, it's just a proof of concept.
- The client and server briefly argue indoors/outdoors when transitioning between them. Be sure to allow a few seconds to pass before activating the button.
Hi SDPhantom,
it works like a charm ...

I have put on the top of my rActionBar_Gm addon and it works great.

I have changed a little bit only to works with other classes because otherwhise the if not druid returned and the other part of the addon was not executed...


Lua Code:
  1. -- Based on:
  2. -- rActionBar_Default: layout
  3. -- zork, 2016
  4.  
  5. -- Default Bar Layout for rActionBar
  6.  
  7. -----------------------------
  8. -- Variables
  9. -----------------------------
  10.  
  11. local A, L = ...
  12.  
  13. -- Don't run if not a druid
  14. -- code by SDPhantom
  15. -- [url]http://www.wowinterface.com/forums/showthread.php?p=322800[/url]
  16. if select(2,UnitClass("player"))=="DRUID" then
  17. --  Create State Driver
  18.     local WatchFrame = CreateFrame("Frame",nil,nil,"SecureHandlerStateTemplate")
  19.     WatchFrame:SetFrameRef("StanceButton",StanceButton3) -- Link StanceButton3
  20.     WatchFrame:SetAttribute("_onstate-form","self:GetFrameRef('StanceButton'):SetID(newstate)") -- Set ID of StanceButton to whatever 'form' state is set to
  21.     RegisterStateDriver(WatchFrame,"form","[indoors] 2; 3") --  Register 'form' state to swap when we go indoors/outdoors
  22. end
  23.  
  24. -- etc etc ---

The buttons texture change accordingly. So I press travel form, enter in cat form and the cat form texture "used" is shown. So it is correct

Thanks so much again.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » travel form to cat stance


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