View Single Post
03-21-15, 11:44 AM   #11
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
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