Quantcast ToggleTalentFrame() / ToggleGlyphFrame() taint issue - WoWInterface
Thread Tools Display Modes
03-21-15, 09:23 AM   #1
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 427
ToggleTalentFrame() / ToggleGlyphFrame() taint issue

Hello, I'm trying to create a custom game menu and I'm having trouble with two buttons pertaining to the talent and glyph frames.

The taint issue comes from calling ToggleTalentFrame() and ToggleGlyphFrame() insecurely. Since these frames are not loaded by default, I can't use ToggleFrame() as I do with the Spellbook. My question is whether it's possible to actually open these frames with code without it blowing up in my face.

Edit: Here's the updated code:
Lua Code:
  1. local function ToggleTalentUI()
  2.     if not PlayerTalentFrame then
  3.         LoadAddOn("Blizzard_TalentUI");
  4.     end
  5.     ShowUIPanel(PlayerTalentFrame);
  6. end
  7.  
  8. local customButtons = {
  9.     {name = "Character",    title = "Character Info",   ClickFunc = ToggleCharacter,    arg = "PaperDollFrame"},
  10.     {name = "Spellbook",    title = "Spellbook",        ClickFunc = ToggleFrame,        arg = SpellBookFrame},
  11.     {name = "Talent",       title = "Specialization",   ClickFunc = ToggleTalentUI,     arg = nil},
  12.     {name = "Bag",          title = "Bags",             ClickFunc = ToggleAllBags,      arg = nil},
  13.     {name = "Achievement",  title = "Achievements",     ClickFunc = ToggleAchievementFrame, arg = nil},
  14.     {name = "QuestLog",     title = "Quest Log",        ClickFunc = ToggleQuestLog,     arg = nil},
  15.     {name = "LFD",          title = "Group Finder",     ClickFunc = PVEFrame_ToggleFrame, arg = nil},
  16.     {name = "PvP",          title = "PvP",              ClickFunc = TogglePVPUI,        arg = nil},
  17.     {name = "Collections",  title = "Collections",      ClickFunc = ToggleCollectionsJournal, arg = nil},
  18.     {name = "EJ",           title = "Dungeon Journal",  ClickFunc = ToggleEncounterJournal, arg = nil},
  19.     {name = "Garrison",     title = "Garrison Report",  ClickFunc = ToggleGarrisonReport, arg = nil},
  20.     {name = "Score",        title = "Score Screen",     ClickFunc = ToggleWorldStateScoreFrame, arg = nil},
  21.     {name = "Social",       title = "Social",           ClickFunc = ToggleFriendsFrame, arg = nil},
  22.     {name = "Guild",        title = "Guild",            ClickFunc = ToggleGuildFrame,   arg = nil},
  23. }
  24.  
  25. for i, btn in pairs(customButtons) do
  26.     local button = CreateFrame("BUTTON", "GameMenuButton"..btn.name, GameMenuFrame, "GameMenuButtonTemplate");
  27.     local anchor = customButtons[i-1] and customButtons[i-1].name or nil;
  28.     button:SetText(btn.title);
  29.     if anchor then
  30.         button:SetPoint("TOP", _G["GameMenuButton"..anchor], "BOTTOM", 0, -1);
  31.     else
  32.         button:SetPoint("TOPRIGHT", GameMenuFrame, "TOPRIGHT", -20, -20);
  33.     end
  34.     button:SetScript("OnClick", function(...)
  35.         ToggleFrame(GameMenuFrame);
  36.         btn.ClickFunc(btn.arg);
  37.     end);
  38.     table.insert(buttons, button);
  39. end
Here's what it ends up looking like atm.
__________________

Last edited by MunkDev : 03-21-15 at 02:04 PM.
  Reply With Quote
03-21-15, 10:16 AM   #2
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 579
I use this in Click Menu for the talents, I don't call glyphs though.

Code:
if (not PlayerTalentFrame) then
LoadAddOn('Blizzard_TalentUI')
end

if (not GlyphFrame) then
  LoadAddOn('Blizzard_GlyphUI')
end

securecall(ToggleTalentFrame)
__________________
Tweets Facebook YouTube Website
  Reply With Quote
03-21-15, 10:21 AM   #3
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
I know a decent way to avoid taint is to run the click method on any buttons that exist. You could run the click method on the micro menus' TalentMicroButton. You could then run the click method on the "Glyphs" tab.

Lua Code:
  1. TalentMicroButton:Click()

Lua Code:
  1. if (PlayerTalentFrame:IsShown()) then
  2.     PlayerTalentFrameTab3:Click()
  3. end

I know that doesn't help with load on demand issues, but it is a start.
  Reply With Quote
03-21-15, 10:25 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Lua Code:
  1. ShowUIPanel(PlayerTalentFrame) -- Always opens on the last used tab
  2. HideUIPanel(PlayerTalentFrame)
  3.  
  4. PlayerTalentFrame_Toggle(GetActiveSpecGroup()) -- 1 for primary 2 for secondary
  5.  
  6. PlayerTalentFrame_ToggleGlyphFrame(GetActiveSpecGroup()) -- 1 for primary 2 for secondary

Last edited by Resike : 03-21-15 at 10:30 AM.
  Reply With Quote
03-21-15, 10:30 AM   #5
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 427
Resike: Your approach works for opening the talent frame, but using
Lua Code:
  1. PlayerTalentFrame_ToggleGlyphFrame(GetActiveSpecGroup())
seems to still cause the taint in the glyph frame.

The other solutions you guys provided cause full on taint, just like my original approach.

Edit: Maybe I should add I'm not clicking these with my mouse.
__________________

Last edited by MunkDev : 03-21-15 at 10:54 AM.
  Reply With Quote
03-21-15, 11:02 AM   #6
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 427
Bah, I've decided against a dedicated Glyph button. It's not that necessary.
Thanks for the help everyone.
__________________
  Reply With Quote
03-21-15, 11:04 AM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by MunkDev View Post
Bah, I've decided against a dedicated Glyph button. It's not that necessary.
Thanks for the help everyone.
Nononon, here you go:
Lua Code:
  1. function ToggleTalentTab(tabNumber)
  2.     if not PlayerTalentFrame or not PlayerTalentFrame:IsShown() then
  3.         GlyphFrame_LoadUI()
  4.         ShowUIPanel(PlayerTalentFrame)
  5.         PanelTemplates_SetTab(PlayerTalentFrame, tabNumber)
  6.         PlayerTalentFrame_HideTalentTab()
  7.         PlayerTalentFrame_HideSpecsTab()
  8.         PlayerTalentFrame_ShowGlyphFrame()
  9.         PlayerTalentFrame_HidePetSpecTab()
  10.     else
  11.         HideUIPanel(PlayerTalentFrame)
  12.     end
  13. end
  14.  
  15. -- To toggle tabs [1-4]
  16. ToggleTalentTab(3)

Edit: Made some changes should work for every tab now and it's toggleable.

Last edited by Resike : 03-21-15 at 11:12 AM.
  Reply With Quote
03-21-15, 11:10 AM   #8
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 427
Originally Posted by Resike View Post
Nononon, here you go:
Lua Code:
  1. function ToggleTalentTab(tabNumber)
  2.         if not PlayerTalentFrame:IsShown() then
  3.             GlyphFrame_LoadUI()
  4.             ShowUIPanel(PlayerTalentFrame)
  5.             PanelTemplates_SetTab(PlayerTalentFrame, tabNumber)
  6.             PlayerTalentFrame_HideTalentTab()
  7.             PlayerTalentFrame_HideSpecsTab()
  8.             PlayerTalentFrame_ShowGlyphFrame()
  9.             PlayerTalentFrame_HidePetSpecTab()
  10.         else
  11.                 HideUIPanel(PlayerTalentFrame)
  12.         end
  13. end
  14.  
  15. -- To show it [1-4] tabs
  16. ToggleTalentTab(3)
Lol. That actually works! Alright, I'll keep it. Haha. Thanks.
__________________
  Reply With Quote
03-21-15, 11:14 AM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by MunkDev View Post
Lol. That actually works! Alright, I'll keep it. Haha. Thanks.
No problem, well we elminated an another nasty taint.
  Reply With Quote
03-21-15, 11:16 AM   #10
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 427
This does work for the glyph frame, but it opens the glyph frame regardless of the tabnumber given!
__________________
  Reply With Quote
03-21-15, 11:44 AM   #11
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,289
Originally Posted by MunkDev View Post
This does work for the glyph frame, but it opens the glyph frame regardless of the tabnumber given!
Havn't really tested the last one through, but try this one:

Lua Code:
  1. function ToggleTalentTab(tabNumber)
  2.     if not PlayerTalentFrame then
  3.         LoadAddOn("Blizzard_TalentUI")
  4.     end
  5.     if not PlayerTalentFrame:IsShown() then
  6.         -- To prevent feral specs to pop up
  7.         if type(tabNumber) ~= "number" then
  8.             return
  9.         end
  10.         if tabNumber < 1 or tabNumber > 4 then
  11.             return
  12.         end
  13.         ShowUIPanel(PlayerTalentFrame)
  14.         PanelTemplates_SetTab(PlayerTalentFrame, tabNumber)
  15.         if tabNumber == 1 then
  16.             PlayerTalentFrame_ShowsSpecTab()
  17.             PlayerTalentFrame_HideTalentTab()
  18.             PlayerTalentFrame_HideGlyphFrame()
  19.             PlayerTalentFrame_HidePetSpecTab()
  20.         elseif tabNumber == 2 then
  21.             PlayerTalentFrame_HideSpecsTab()
  22.             PlayerTalentFrame_ShowTalentTab()
  23.             PlayerTalentFrame_HideGlyphFrame()
  24.             PlayerTalentFrame_HidePetSpecTab()
  25.             -- This is some serious real hack here
  26.             HideUIPanel(PlayerTalentFrame)
  27.             ShowUIPanel(PlayerTalentFrame)
  28.         elseif tabNumber == 3 then
  29.             GlyphFrame_LoadUI()
  30.             PlayerTalentFrame_HideTalentTab()
  31.             PlayerTalentFrame_HideSpecsTab()
  32.             PlayerTalentFrame_ShowGlyphFrame()
  33.             PlayerTalentFrame_HidePetSpecTab()
  34.         elseif tabNumber == 4 then
  35.             PlayerTalentFrame_HideTalentTab()
  36.             PlayerTalentFrame_HideSpecsTab()
  37.             PlayerTalentFrame_HideGlyphFrame()
  38.             PlayerTalentFrame_ShowPetSpecTab()
  39.         end
  40.     else
  41.         HideUIPanel(PlayerTalentFrame)
  42.     end
  43. end

Edit: Fixed a typo.

Lua Code:
  1. PlayerTalentFrame_ShowsSpecTab
  2. PlayerTalentFrame_HideSpecsTab

Seems like the show is only spec, while the hide function is specs.

This should work now properly.

The best thing if you call it without an argument 2-3 times then you can choose a feral spec. :P

Last edited by Resike : 03-21-15 at 11:59 AM.
  Reply With Quote
08-22-15, 04:42 AM   #12
evilbib
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 30
Lua Code:
  1. PanelTemplates_SetTab(PlayerTalentFrame, tabNumber)

Actually this causes a taint if you want to remove talents (glyphs are working). Is there a way around?

Last edited by evilbib : 08-22-15 at 04:50 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » ToggleTalentFrame() / ToggleGlyphFrame() taint issue

Thread Tools
Display Modes

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