Thread Tools Display Modes
06-03-15, 09:24 AM   #1
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
Help understanding Blizzard magic when Crafting

Apparently Druids (and Warlocks) can't craft while shapeshifted. The Blizzard Tradeskill UI solves this problem by automagically shifting to "normal" form when you click the "Create" button. The Skillet UI gets an error "You are in shapeshift form" instead.

I've looked at Blizzard_TradeSkillUI.lua and Blizzard_TradeSkillUI.xml and I don't see any "magic", the create button calls "DoTradeSkill(TradeSkillFrame.selectedSkill, TradeSkillInputBox:GetNumber());".

Skillet calls "DoTradeSkill(skillIndexLookup[command.recipeID],command.count)" as well.

Can anyone provide some insight into how the "magic" works so I can implement it in Skillet?
  Reply With Quote
06-03-15, 10:03 AM   #2
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by bsmorgan View Post
Apparently Druids (and Warlocks) can't craft while shapeshifted. The Blizzard Tradeskill UI solves this problem by automagically shifting to "normal" form when you click the "Create" button. The Skillet UI gets an error "You are in shapeshift form" instead.

I've looked at Blizzard_TradeSkillUI.lua and Blizzard_TradeSkillUI.xml and I don't see any "magic", the create button calls "DoTradeSkill(TradeSkillFrame.selectedSkill, TradeSkillInputBox:GetNumber());".

Skillet calls "DoTradeSkill(skillIndexLookup[command.recipeID],command.count)" as well.

Can anyone provide some insight into how the "magic" works so I can implement it in Skillet?
The function is probably gets executed in the C server side code, so you can't really see into that.

My guess would be since it's gets called by a secure Blizzard addon it can run codes like shapeshit into and out of forms. While when it gets called by a 3rd party addon, that part of the code fails silently and you only get the error message.

Long story short you won't be able to do this without breaking the TOS.
  Reply With Quote
06-03-15, 11:25 AM   #3
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Just do it securely?
  Reply With Quote
06-03-15, 12:22 PM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by p3lim View Post
Just do it securely?
Worth a try, but it might not work even like that.
  Reply With Quote
06-03-15, 12:48 PM   #5
bsmorgan
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 219
Thanks for the insight. I'll close the Skillet ticket that was entered but now I can at least explain why!
  Reply With Quote
06-03-15, 01:20 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
What I've done before is create a SecureActionButton that runs /cancelform and put the DoTradeSkill() call in a PostClick handler. You can also do button:HookScript() on the OnClick handler to securely post-hook the existing script used by the SecureActionButtonTemplate.

Method 1:
Lua Code:
  1. local button=CreateFrame("Button",nil,nil,"SecureActionButtonTemplate");
  2. button:RegisterForClicks("AnyUp");
  3. button:SetAttribute("type","macro");
  4. button:SetAttribute("macrotext",SLASH_CANCELFORM1);-- Using this constant makes sure this code works on all locales
  5.  
  6. button:SetScript("PostClick",function(self,button)
  7.     -- Do stuff and make your DoTradeSkill() call here
  8. );

Method 2:
Lua Code:
  1. local button=CreateFrame("Button",nil,nil,"SecureActionButtonTemplate");
  2. button:RegisterForClicks("AnyUp");
  3. button:SetAttribute("type","macro");
  4. button:SetAttribute("macrotext",SLASH_CANCELFORM1);-- Using this constant makes sure this code works on all locales
  5.  
  6. button:HookScript("OnClick",function(self,button)
  7.     -- Do stuff and make your DoTradeSkill() call here
  8. );
__________________
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

WoWInterface » Developer Discussions » Lua/XML Help » Help understanding Blizzard magic when Crafting


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