Download
(10 Kb)
Download
Updated: 05-02-11 07:10 AM
Pictures
File Info
Updated:05-02-11 07:10 AM
Created:04-26-09 09:10 AM
Downloads:14,305
Favorites:373
MD5:
Ara Broker SpecSwitcher  Popular! (More than 5000 hits)
Version: r10
by: Aranarth [More]
This data broker plugin:

- swaps your talent spec (and gear set) when clicked.
- suppresses chat spam caused by a spec switch.
- sets aliases (leave blank to remove).
- associates an Equipment Manager Set to the current spec.
- mirrors changes made with Blizzard's Equipment Manager.
- toggles the talent frame when right-clicked.
- provides an easy to use interface.

and other minor customizations and utilities...


Supports the following addons:
- AddonLoader (reduces load screen time).
- TipTac (SpecSwitcher mimic its appearence).
r10
- Fixed gear switch (was delayed or prevented).
- Fixed default huge size for high res (was not using UIParent as parent).


r9
- Rewrote gear association and alias interfaces for 4.1 compat.
- Added: Shift+Click a gear set or a spec with an associated gear set to equip it.
- Added: MouseWheel on tooltip to change scale.
- Reacts on Blizzard's equipment manager "Delete" and "Change Name/Icon" actions (mirrors).
- Attempt to mimic TipTac look if you have TipTac.


r8
- Took advantage of the gear manager interface to provide a user friendly way to (dis)associate gear.
- Added a dialog box to edit aliases.
- Within that dialog box you have the option to use the associated gear's icon & name instead.
- Shift+Click (gear manager) and Control+Click (alias editor) can now edit your off-spec using Shift+RightClick and Control+RightClick.
- Changed tooltip to be clear and concise.
- Fixed following issue: if your spec switch cast failed to complete, the associated gear was still equiped.
- Attempted to fix rare issues: gear set not equipping and/or chat spam not blocked


r7
- Added the possibility to associate a Blizzard's equipment manager set to the current spec. You will have to manually type the name of the set.
- Removed borders from icons displayed in the tooltip for a cleaner look.


r6
- Fixed an error that was occurring with StatBlockCore 2.61 when you mouse over the block in combat while "No Tooltip In Combat" is set.


r5
- Fixed login issue.


r4
- Added Middle-Click to toggle hints.


r3
- Added aliases. Control-click to set one. Leave blank to remove an alias.
- Added hints to the tooltip.


r2
- Added chat spam suppression.
- Removed need for timers.


r1
- Initial release.
Optional Files (1)
File Name
Version
Size
Author
Date
Type
r10 MoP
10kB
10-02-12 02:14 AM
Patch


Archived Files (8)
File Name
Version
Size
Author
Date
r9
10kB
Aranarth
05-01-11 02:33 PM
r8
8kB
Aranarth
10-12-10 06:35 AM
r7
7kB
Aranarth
07-05-10 09:21 AM
r6
7kB
Aranarth
08-17-09 03:36 AM
r5
7kB
Aranarth
04-30-09 12:55 PM
r4
7kB
Aranarth
04-30-09 09:22 AM
r3
7kB
Aranarth
04-30-09 05:10 AM
r2
7kB
Aranarth
04-26-09 10:32 AM


Post A Reply Comment Options
Unread 09-01-12, 08:43 AM  
dickloraine
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 34
Uploads: 9
Part 3:
Lua Code:
  1. local function UpdateTablet()
  2.     f:SetScale(config.scale)
  3.     local talentGroup = GetActiveSpecGroup()
  4.     local specC, aliasC, gearC = 0, 0, 0
  5.     local hasAlias, hasGear
  6.     local nbSpec = GetNumSpecGroups()
  7.     for i = 1, nbSpec do
  8.         local id = GetSpecialization(false, false, i)
  9.         local specName, specIcon = GetTalentText(id)
  10.         local group = char[i]
  11.         local alias, gearName, gearIcon = group[specName], group.set
  12.  
  13.         if gearName then
  14.             hasGear = true
  15.             gearIcon = GetEquipmentSetInfoByName(gearName or "")
  16.         end
  17.  
  18.         if alias then
  19.             hasAlias = true
  20.         end
  21.  
  22.         local button, specW, aliasW, gearW =
  23.             SetButtonData(i, i==talentGroup, specIcon, specName, alias, gearIcon, gearName)
  24.  
  25.         if specW > specC then specC = specW end
  26.         if aliasW > aliasC then aliasC = aliasW end
  27.         if gearW > gearC then gearC = gearW end
  28.     end
  29.     local maxWidth = ICON_SIZE + TEXT_OFFSET + specC + (hasAlias and GAP + aliasC or 0) + (hasGear and GAP + ICON_SIZE + TEXT_OFFSET + gearC or 0)
  30.     for index, button in next, buttons do
  31.         if hasAlias then button.specName:SetWidth(specC) end
  32.         if hasGear then button.gearName:SetWidth(gearC) end
  33.     end
  34.     f:SetSize( GAP + maxWidth + GAP, GAP + nbSpec * BUTTON_HEIGHT + GAP )
  35.     if not (f.onBlock or f:IsMouseOver() or g:IsMouseOver()) then f:Hide() end
  36. end
  37.  
  38.  
  39. ShowGears = function(_specIndex)
  40.     specIndex = _specIndex
  41.     local nbGear = GetNumEquipmentSets()
  42.     if not nbGear or nbGear == 0 then return end
  43.     g:Show()
  44.     local currGear = char[specIndex].set
  45.     local button, maxWidth = SetGearData(0, not currGear, "", NONE)
  46.     for i=1, nbGear do
  47.         local gearName, gearIcon = GetEquipmentSetInfo(i)
  48.         local button, width = SetGearData(i, currGear == gearName, gearIcon, gearName)
  49.         if width > maxWidth then maxWidth = width end
  50.     end
  51.     g:SetSize( (GAP + ICON_SIZE + TEXT_OFFSET)*2 + maxWidth, GAP + (nbGear+1) * BUTTON_HEIGHT + GAP )
  52.     for k, v in next, gears do if k>nbGear then v:Hide() else v:Show() end end
  53.  
  54.     g:ClearAllPoints()
  55.     local horiz = f:GetCenter() > UIParent:GetWidth()/config.scale/2 and "RIGHT" or "LEFT"
  56.     local verti = (f:GetPoint()=="TOP"and f:GetTop() or f:GetBottom()) > UIParent:GetHeight()*.5 and "TOP" or "BOTTOM"
  57.     g:SetPoint(verti..horiz, f, verti..(horiz=="LEFT"and"RIGHT"or"LEFT"), 0, (1-specIndex)*BUTTON_HEIGHT )
  58. end
  59.  
  60.  
  61. local tiptacBKG = { tile = false, insets = {} }
  62. -- Setup Gradient Tip (from TipTac)
  63. local function SetupGradientTip(tip,cfg)
  64.     local g = tip.ttGradient;
  65.     if not cfg.gradientTip then
  66.         return g and g:Hide()
  67.     elseif not g then
  68.         g = tip:CreateTexture()
  69.         g:SetTexture(1,1,1,1)
  70.         tip.ttGradient = g
  71.     end
  72.     g:SetGradientAlpha("VERTICAL",0,0,0,0,unpack(cfg.gradientColor))
  73.     g:SetPoint("TOPLEFT",cfg.backdropInsets,cfg.backdropInsets * -1)
  74.     g:SetPoint("BOTTOMRIGHT",tip,"TOPRIGHT",cfg.backdropInsets * -1,-36)
  75.     g:Show()
  76. end
  77.  
  78.  
  79. local function SetTabletBG(frame, cfg)
  80.     if TipTac then
  81.         frame:SetBackdrop(tiptacBKG)
  82.         frame:SetBackdropColor(unpack(cfg.tipColor))
  83.         frame:SetBackdropBorderColor(unpack(cfg.tipBorderColor))
  84.         SetupGradientTip(frame,cfg)
  85.     elseif Skinner then
  86.         Skinner:applySkin(frame)
  87.     else
  88.         frame:SetBackdrop(backdrop)
  89.         if frame.ttGradient then frame.ttGradient:Hide() end
  90.         frame:SetBackdropColor(.1, .1, .1, .85)
  91.         frame:SetBackdropBorderColor(.3, .3, .3, .9)
  92.     end
  93. end
  94.  
  95. local function AnchorTablet(frame)
  96.     f:Show()
  97.     f.isTop, f.onBlock = select(2, frame:GetCenter()) > UIParent:GetHeight() / 2, true
  98.     f:ClearAllPoints()
  99.     f:SetPoint(f.isTop and "TOP" or "BOTTOM", frame, f.isTop and "BOTTOM" or "TOP")
  100.     local cfg
  101.     if TipTac then
  102.         cfg = TipTac_Config
  103.         tiptacBKG.bgFile = cfg.tipBackdropBG
  104.         tiptacBKG.edgeFile = cfg.tipBackdropEdge
  105.         tiptacBKG.edgeSize = cfg.backdropEdgeSize
  106.         tiptacBKG.insets.left = cfg.backdropInsets
  107.         tiptacBKG.insets.right = cfg.backdropInsets
  108.         tiptacBKG.insets.top = cfg.backdropInsets
  109.         tiptacBKG.insets.bottom = cfg.backdropInsets
  110.     end
  111.     SetTabletBG(f, cfg)
  112.     SetTabletBG(g, cfg)
  113.     UpdateHints(BLOCK)
  114.     UpdateTablet()
  115. end
  116.  
  117.  
  118. block = LibStub("LibDataBroker-1.1"):NewDataObject("|cFFFFB366Ara|r SpecSwitcher", {
  119.     type = "data source",
  120.     icon = DEFAULT_ICON,
  121.     iconCoords = { .08, .92, .08, .92 },
  122.     text = "00/00/00",
  123.  
  124.     OnEnter = AnchorTablet,
  125.  
  126.     OnLeave = function()
  127.         f.onBlock = nil
  128.         tip:Hide()
  129.         if not f:IsMouseOver() then
  130.             f:Hide()
  131.         end
  132.     end,
  133.  
  134.     OnClick = function(self, button)
  135.         if button == "RightButton" then
  136.             ToggleTalentFrame()
  137.         elseif button == "MiddleButton" then
  138.             config.hideBlockHints = not config.hideBlockHints
  139.             UpdateHints(BLOCK)
  140.         else
  141.             SetActiveSpecGroup( 3 - GetActiveSpecGroup() )
  142.         end
  143.     end
  144. })
  145.  
  146.  
  147. function f:PLAYER_TALENT_UPDATE()
  148.     local curr = char[GetActiveSpecGroup()]
  149.     local spec, icon = GetTalentText(GetSpecialization(false, false, GetActiveSpecGroup()))
  150.     block.icon = curr.aliasIsSetName and GetEquipmentSetInfoByName(curr.set or "") and ("Interface\\Icons\\"..GetEquipmentSetInfoByName(curr.set or "")) or icon
  151.     block.text = curr.aliasIsSetName and curr.set or curr[spec] or spec
  152.     if f:IsVisible() then UpdateTablet() end
  153. end
  154.  
  155. function f:ACTIVE_TALENT_GROUP_CHANGED()
  156.     t:SetScript("OnUpdate", DelayWearSet)
  157. end
  158.  
  159. function f:PLAYER_LOGIN(event, addon)
  160.     if addon ~= "Ara_Broker_SpecSwitcher" then return end
  161.     AraSpecSwitcherDBPC = AraSpecSwitcherDBPC or { {}, {} }
  162.     char = AraSpecSwitcherDBPC
  163.     AraSpecSwitcherDB = AraSpecSwitcherDB or { scale=1 }
  164.     config = AraSpecSwitcherDB
  165.  
  166.     f:SetBackdrop(backdrop)
  167.     f:SetFrameStrata"TOOLTIP"
  168.     f:SetClampedToScreen(true)
  169.  
  170.     f:SetScript( "OnEnter", Menu_OnEnter )
  171.     f:SetScript( "OnLeave", Menu_OnLeave )
  172.     f:SetScript( "OnHide", function() g:Hide() end )
  173.     f:SetScript( "OnMouseWheel", function(self, delta)
  174.         config.scale = config.scale - delta * 0.05
  175.         UpdateTablet()
  176.     end)
  177.  
  178.     g:SetBackdrop(backdrop)
  179.     g:SetFrameStrata"TOOLTIP"
  180.     g:SetFrameLevel(0)
  181.     g:SetScript( "OnEnter", Gear_OnEnter )
  182.     g:SetScript( "OnLeave", Gear_OnLeave)
  183.  
  184.     t:SetScript( "OnUpdate", function() t:SetScript("OnUpdate", nil) f:PLAYER_TALENT_UPDATE() end )
  185.     f:RegisterEvent"PLAYER_TALENT_UPDATE"
  186.     f:RegisterEvent"ACTIVE_TALENT_GROUP_CHANGED"
  187.     f:RegisterEvent"PLAYER_ENTERING_WORLD"
  188.     f:RegisterEvent"PLAYER_LEAVING_WORLD"
  189.     tip = GameTooltip
  190.  
  191.     f:UnregisterEvent(event)
  192.     f.PLAYER_LOGIN = nil
  193. end
  194.  
  195. function f:PLAYER_LEAVING_WORLD() f:UnregisterEvent"PLAYER_TALENT_UPDATE" end
  196. function f:PLAYER_ENTERING_WORLD() f:RegisterEvent"PLAYER_TALENT_UPDATE" end
  197.  
  198. f:SetScript( "OnEvent", function(self, event, ...) return self[event](self, event, ...) end )
  199. f:RegisterEvent"PLAYER_LOGIN"
dickloraine is offline Report comment to moderator  
Reply With Quote
Unread 09-01-12, 08:43 AM  
dickloraine
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 34
Uploads: 9
Part 2:
Lua Code:
  1. function f:UNIT_SPELLCAST_STOP(event, unit)
  2.     if unit ~= "player" then return end
  3.     f:UnregisterEvent"UNIT_SPELLCAST_SUCCEEDED"
  4.     f:UnregisterEvent"UNIT_SPELLCAST_STOP"
  5.     if event == "UNIT_SPELLCAST_SUCCEEDED" then return t:SetScript("OnUpdate", DelayWearSet) end
  6.     ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", SpamFilter)
  7. end
  8. f.UNIT_SPELLCAST_SUCCEEDED = f.UNIT_SPELLCAST_STOP
  9.  
  10.  
  11. local function GetTalentText(group)
  12.     local finalIcon, text = DEFAULT_ICON
  13.     --for tab = 1, 3 do
  14.         local id, name, description, icon, background, role   = GetSpecializationInfo(group)
  15.         finalIcon = icon
  16.         text = name
  17.     --end
  18.     return text, finalIcon
  19. end
  20.  
  21.  
  22. local hints = {
  23.     [BLOCK] =
  24. [[|cffffd100Hints [|cffffffffBlock|r|cffffd100]|r
  25. $Click|r to swap talent spec.
  26. $Right-Click|r to open talent frame.
  27. $Middle-Click|r to toggle hints.]],
  28.     [SPEC] =
  29. [[|cffffd100Hints|r
  30. $Click|r to set an alias.
  31. $Shift+Click|r to equip set.
  32. $Middle-Click|r to toggle hints.
  33. $MouseWheel|r to resize tooltip.]],
  34.     [GEAR] =
  35. [[|cffffd100Hints|r
  36. $Click|r to associate set.
  37. $Shift+Click|r to equip set.]],
  38. }
  39.  
  40. local function UpdateHints(cat)
  41.     if cat == BLOCK and (not f.onBlock or config.hideBlockHints) or cat ~= BLOCK and config.hideHints then return tip:Hide() end
  42.     local showRight = f:GetCenter() > UIParent:GetWidth()/config.scale/2 and "LEFT" or "RIGHT"
  43.     local showBelow = select(2, f:GetCenter()) > UIParent:GetHeight()/config.scale/2 and "TOP" or "BOTTOM"
  44.     tip:SetOwner(f, "ANCHOR_NONE")
  45.     tip:SetPoint(showBelow..showRight, f, (showBelow == "TOP" and "BOTTOM" or "TOP")..showRight )
  46.  
  47.     tip:AddLine(hints[cat]:gsub("%$","|cffff8020"), .2, 1, .2)
  48.     tip:Show()
  49. end
  50.  
  51.  
  52. local function Gear_OnClick(button, click)
  53.     if click == "LeftButton" and IsShiftKeyDown() then
  54.         return button.index > 0 and WearSet(button.index, true)
  55.     end
  56.     local spec = char[specIndex]
  57.     spec.set = button.index > 0 and button.gearName:GetText() or nil
  58.  
  59.     for i, b in next, gears do
  60.         local gearName = b.gearName:GetText()
  61.         if gearName == spec.set or not spec.set and gearName == NONE then b.check:Show() else b.check:Hide() end
  62.     end
  63.     f:PLAYER_TALENT_UPDATE()
  64. end
  65.  
  66. local function Spec_OnClick(button, click)
  67.     if click == "LeftButton" and IsShiftKeyDown() then
  68.         return WearSet(button.index)
  69.     elseif click == "MiddleButton" then
  70.         config.hideHints = not config.hideHints
  71.         return UpdateHints(SPEC)
  72.     end
  73.  
  74.     local data = char[button.index]
  75.     if StaticPopup_FindVisible( POPUP_SET_ALIAS, data ) then
  76.         return StaticPopup_Hide( POPUP_SET_ALIAS, data )
  77.     end
  78.  
  79.     local specName, specIcon = GetTalentText(button.index)
  80.     if not StaticPopupDialogs[POPUP_SET_ALIAS] then
  81.         local dialog = {
  82.             text = "Set an alias for %s (spec %i).\nLeave blank to remove alias.",
  83.             button3 = "Use gear set",
  84.             OnAccept = function(self, spec)
  85.                 local input = self.editBox:GetText()
  86.                 spec[popupData] = input ~= "" and input or nil
  87.                 spec.aliasIsSetName = false
  88.                 f:PLAYER_TALENT_UPDATE()
  89.             end,
  90.             OnShow = function(self, spec)
  91.                 self.editBox:SetText(spec[popupData]or"")
  92.                 self.editBox:SetFocus()
  93.             end,
  94.             OnAlt = function(self, spec)
  95.                 spec.aliasIsSetName = true
  96.                 f:PLAYER_TALENT_UPDATE()
  97.             end,
  98.             EditBoxOnEnterPressed = function(self, spec)
  99.                 local p = self:GetParent()
  100.                 StaticPopupDialogs[POPUP_SET_ALIAS].OnAccept(p, spec)
  101.                 p:Hide()
  102.             end,
  103.             EditBoxOnEscapePressed = function(self) self:GetParent():Hide() end,
  104.             multiple = true,
  105.         }
  106.         for k, v in next, StaticPopupDialogs.RENAME_GUILD do
  107.             if not dialog[k] then dialog[k] = v end
  108.         end
  109.         dialog.OnCancel, dialog.OnAlt = dialog.OnAlt, dialog.OnCancel
  110.         dialog.button3, dialog.button2 = dialog.button2, dialog.button3
  111.         StaticPopupDialogs[POPUP_SET_ALIAS] = dialog
  112.     end
  113.  
  114.     local talentPlate = (" |T%s:17:17:0:0:25:25:2:23:2:23|t %s"):format( specIcon, button.specName:GetText() )
  115.     popupData = specName
  116.     StaticPopup_Show( POPUP_SET_ALIAS, talentPlate, button.index, data)
  117. end
  118.  
  119.  
  120. local function Gear_OnEnter(b)
  121.     if not (b and b.index) then return end
  122.     highlight:SetAllPoints(b)
  123.     highlight:SetAlpha(1)
  124.     UpdateHints(GEAR)
  125. end
  126.  
  127. local function Gear_OnLeave(b)
  128.     highlight:ClearAllPoints()
  129.     tip:Hide()
  130.     if b then highlight:SetAlpha(0) end
  131.     if not (g:IsMouseOver() or f:IsMouseOver() or f.onBlock) then f:Hide() end
  132. end
  133.  
  134. local function Menu_OnEnter(b)
  135.     if not (b and b.index) then return end
  136.     highlight:SetAllPoints(b)
  137.     highlight:SetAlpha(1)
  138.     UpdateHints(SPEC)
  139.     ShowGears(b.index)
  140. end
  141.  
  142. local function Menu_OnLeave(b)
  143.     highlight:ClearAllPoints()
  144.     tip:Hide()
  145.     if b then highlight:SetAlpha(0) end
  146.     if not (g:IsMouseOver() or f:IsMouseOver() or f.onBlock) then f:Hide() end
  147. end
  148.  
  149. local function CreateTx(parent, ...)
  150.     local tx = parent:CreateTexture()
  151.     tx:SetSize( ICON_SIZE, ICON_SIZE )
  152.     tx:SetTexCoord( 2/25, 23/25, 2/25, 23/25 )
  153.     tx:SetPoint(...)
  154.     return tx
  155. end
  156.  
  157. local baseFont = GameFontNormal:GetFont()
  158.  
  159. local function CreateFS(parent, justify, ...)
  160.     local fs = parent:CreateFontString( nil, "OVERLAY", "SystemFont_Shadow_Med1" )
  161.     fs:SetJustifyH(justify)
  162.     fs:SetFont(baseFont, FONT_SIZE)
  163.     fs:SetPoint(...)
  164.     return fs
  165. end
  166.  
  167. gears = setmetatable( {}, { __index = function( table, key )
  168.     local button = CreateFrame( "Button", nil, g )
  169.     table[key] = button
  170.     button.index = key
  171.     button:RegisterForClicks"AnyUp"
  172.     button:SetScript( "OnEnter", Gear_OnEnter )
  173.     button:SetScript( "OnLeave", Gear_OnLeave )
  174.     button:SetScript( "OnClick", Gear_OnClick )
  175.  
  176.     button:SetHeight(BUTTON_HEIGHT)
  177.     button.check = CreateTx(button, "LEFT")
  178.     button.check:SetTexture"Interface\\Buttons\\UI-CheckBox-Check"
  179.     button.gearIcon = CreateTx(button, "LEFT", button.check, "RIGHT", TEXT_OFFSET, 0)
  180.     button.gearName = CreateFS(button, "LEFT", "LEFT", button.gearIcon, "RIGHT", TEXT_OFFSET, 0)
  181.  
  182.     local y = -GAP - key*BUTTON_HEIGHT
  183.     button:SetPoint("TOPLEFT", GAP, y)
  184.     button:SetPoint("TOPRIGHT", -GAP, y)
  185.     return button
  186. end } )
  187.  
  188. local function SetGearData(index, checked, gearIcon, gearName)
  189.     local button = gears[index]
  190.     if checked then button.check:Show() else button.check:Hide() end
  191.     button.gearIcon:SetTexture(gearIcon)
  192.     button.gearName:SetText(gearName)
  193.     return button, button.gearName:GetStringWidth()
  194. end
  195.  
  196. local buttons = setmetatable( {}, { __index = function( table, key )
  197.     local button = CreateFrame( "Button", nil, f )
  198.     table[key] = button
  199.     button.index = key
  200.     button:RegisterForClicks"AnyUp"
  201.     button:SetScript( "OnEnter", Menu_OnEnter )
  202.     button:SetScript( "OnLeave", Menu_OnLeave )
  203.     button:SetScript( "OnClick", Spec_OnClick)
  204.  
  205.     button:SetHeight(BUTTON_HEIGHT)
  206.     button.specIcon = CreateTx(button, "LEFT")
  207.     button.specName = CreateFS(button, "LEFT", "LEFT", ICON_SIZE + TEXT_OFFSET, 0)
  208.     button.aliasText= CreateFS(button, "LEFT", "LEFT", button.specName, "RIGHT", GAP, 0)
  209.     button.gearName = CreateFS(button, "LEFT", "RIGHT")
  210.     button.gearName:SetTextColor(1,.82,0)
  211.     button.gearIcon = CreateTx(button, "RIGHT", button.gearName, "LEFT", -TEXT_OFFSET, 0)
  212.  
  213.     local y = -GAP - (key-1)*BUTTON_HEIGHT
  214.     button:SetPoint("TOPLEFT", GAP, y)
  215.     button:SetPoint("TOPRIGHT", -GAP, y)
  216.     return button
  217. end } )
  218.  
  219.  
  220. local function SetButtonData(index, active, specIcon, specName, alias, gearIcon, gearName)
  221.     local button = buttons[index]
  222.     button.specIcon:SetTexture(specIcon)
  223.     button.specName:SetFormattedText("%s%s|r", active and "|cff19ff19" or "|cffff1919", specName)
  224.     if alias then button.aliasText:SetFormattedText("|cffffffff%s",alias) else button.aliasText:SetText"" end
  225.     button.gearIcon:SetTexture(gearIcon and "Interface\\Icons\\"..gearIcon or "")
  226.     button.gearName:SetText(gearIcon and gearName or "")
  227.     return  button,
  228.         button.specName:GetStringWidth(),
  229.         alias and button.aliasText:GetStringWidth() or 0,
  230.         gearIcon and button.gearName:GetStringWidth() or 0
  231. end
dickloraine is offline Report comment to moderator  
Reply With Quote
Unread 09-01-12, 08:34 AM  
dickloraine
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 34
Uploads: 9
Originally Posted by concave35
Thanks for the fix!

Works for me, although the spec names and icons are wrong. I don't know anything about WoW API but seems to me that GetSpecializationInfo() is returning the wrong info.

I just set my own alias and ignore the icon.


Originally Posted by Ross
5.0.4 update please.
Here's the final file after applying elaundar's patch, to replace your "Ara_Broker_SpecSwitcher.lua" file:
http://pastebin.com/3QUiqTcL
Since I use this in my UI, I have updated it. Unfortunately I don't know all exact changes, so here the complete code:
Part 1:
Lua Code:
  1. local   BUTTON_HEIGHT,  ICON_SIZE,  GAP,    TEXT_OFFSET,    FONT_SIZE =
  2.     17,     14,     10, 5,      12
  3.  
  4. local f = CreateFrame("Frame", nil, UIParent)
  5. local g = CreateFrame("Frame", nil, f) -- gear sets
  6. local t = CreateFrame"Frame" -- timers
  7.  
  8. local highlight = f:CreateTexture()
  9. highlight:SetTexture"Interface\\QuestFrame\\UI-QuestTitleHighlight"
  10. highlight:SetBlendMode"ADD"
  11. highlight:SetAlpha(0)
  12.  
  13. local backdrop =  {
  14.     bgFile = "Interface\\Buttons\\WHITE8X8",
  15.     edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
  16.     edgeSize=16, tile = false, tileSize=0,
  17.     insets = { left=3, right=3, top=3, bottom=3 } }
  18.  
  19. local ShowGears, specIndex, gears, popupData
  20. local block, char, tip, tipshown, config
  21. local DEFAULT_ICON = "Interface\\Icons\\Spell_Shadow_SacrificialShield"
  22. local orgSetActiveTalentGroup = SetActiveTalentGroup
  23. local POPUP_SET_ALIAS = "ABSS_SET_ALIAS"
  24. local BLOCK, SPEC, GEAR = 0, 1, 2
  25.  
  26. local spam1 = ERR_LEARN_ABILITY_S:gsub("%.", "%."):gsub("%%s", "(.*)")
  27. local spam2 = ERR_LEARN_SPELL_S:gsub("%.", "%."):gsub("%%s", "(.*)")
  28. local spam3 = ERR_SPELL_UNLEARNED_S:gsub("%.", "%."):gsub("%%s", "(.*)")
  29.  
  30. local function SpamFilter(self, event, msg)
  31.     if strfind(msg, spam1) or strfind(msg, spam2) or strfind(msg, spam3) then return true end
  32. end
  33.  
  34.  
  35. local function OnEquipmentSetChange(oldName, newName)
  36.     for i=1, GetNumSpecGroups() do
  37.         if char[i].set == oldName then char[i].set = newName end
  38.     end
  39.     f:PLAYER_TALENT_UPDATE()
  40. end
  41.  
  42. hooksecurefunc("ModifyEquipmentSet", OnEquipmentSetChange)
  43. hooksecurefunc("DeleteEquipmentSet", OnEquipmentSetChange)
  44.  
  45.  
  46. local function WearSet(arg, isGearIndex) -- defaults to talent group index
  47.     local set = type(arg) == "number" and (isGearIndex and GetEquipmentSetInfo(arg) or char[arg].set) or type(arg) == "string" and arg
  48.     if set and GetEquipmentSetInfoByName(set) then UseEquipmentSet(set) end
  49. end
  50.  
  51. local function DelayWearSet(self, elapsed)
  52.     t:SetScript("OnUpdate",nil)
  53.     ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", SpamFilter)
  54.     WearSet(GetActiveSpecGroup())
  55. end
  56.  
  57. function SetActiveTalentGroup(...)
  58.     f:RegisterEvent"UNIT_SPELLCAST_SUCCEEDED"
  59.     f:RegisterEvent"UNIT_SPELLCAST_STOP"
  60.     ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", SpamFilter)
  61.     return orgSetActiveTalentGroup(...)
  62. end
Last edited by dickloraine : 09-01-12 at 08:41 AM.
dickloraine is offline Report comment to moderator  
Reply With Quote
Unread 09-01-12, 07:59 AM  
concave35
A Kobold Labourer

Forum posts: 0
File comments: 2
Uploads: 0
Thanks for the fix!

Works for me, although the spec names and icons are wrong. I don't know anything about WoW API but seems to me that GetSpecializationInfo() is returning the wrong info.

I just set my own alias and ignore the icon.


Originally Posted by Ross
5.0.4 update please.
Here's the final file after applying elaundar's patch, to replace your "Ara_Broker_SpecSwitcher.lua" file:
http://pastebin.com/3QUiqTcL
Last edited by concave35 : 09-01-12 at 08:05 AM.
concave35 is offline Report comment to moderator  
Reply With Quote
Unread 09-01-12, 01:31 AM  
Ross
A Theradrim Guardian
AddOn Author - Click to view AddOns

Forum posts: 67
File comments: 137
Uploads: 1
5.0.4 update please.
Ross is offline Report comment to moderator  
Reply With Quote
Unread 08-31-12, 12:24 PM  
elaundar
A Kobold Labourer

Forum posts: 0
File comments: 20
Uploads: 0
I manually updated this addon - no guarantees it will work for anyone else, but here are my changes which seem to be working which might help anyone else until Aranarth has a chance to make a real fix or someone forks the project to maintain it.

The changes are in unified diff format. If you know how to use patch it should be easy to apply as is, but if not or are stuck using windows, just look for the lines that start with a minus (-) and remove those lines. Add the lines starting with plus (+) and you should be good to go. (Make sure you don't leave the '+' character at the first )

diff -r Ara_Broker_SpecSwitcher/Ara_Broker_SpecSwitcher.lua /games/wow/Interface/AddOns/Ara_Broker_SpecSwitcher/Ara_Broker_SpecSwitcher.lua -U3 -wBb

Code:
--- Ara_Broker_SpecSwitcher/Ara_Broker_SpecSwitcher.lua	2011-05-02 13:46:40.000000000 -0500
+++ /games/wow/Interface/AddOns/Ara_Broker_SpecSwitcher/Ara_Broker_SpecSwitcher.lua	2012-08-31 13:15:40.000000000 -0500
@@ -19,7 +19,7 @@
 local ShowGears, specIndex, gears, popupData
 local block, char, tip, tipshown, config
 local DEFAULT_ICON = "Interface\\Icons\\Spell_Shadow_SacrificialShield"
-local orgSetActiveTalentGroup = SetActiveTalentGroup
+local orgSetActiveSpecGroup = SetActiveSpecGroup
 local POPUP_SET_ALIAS = "ABSS_SET_ALIAS"
 local BLOCK, SPEC, GEAR = 0, 1, 2
 
@@ -33,7 +33,7 @@
 
 
 local function OnEquipmentSetChange(oldName, newName)
-	for i=1, GetNumTalentGroups() do
+	for i=1, GetNumSpecializations() do
 		if char[i].set == oldName then char[i].set = newName end
 	end
 	f:PLAYER_TALENT_UPDATE()
@@ -51,14 +51,14 @@
 local function DelayWearSet(self, elapsed)
 	t:SetScript("OnUpdate",nil)
 	ChatFrame_RemoveMessageEventFilter("CHAT_MSG_SYSTEM", SpamFilter)
-	WearSet(GetActiveTalentGroup())
+	WearSet(GetActiveSpecGroup())
 end
 
-function SetActiveTalentGroup(...)
+function SetActiveSpecGroup(...)
 	f:RegisterEvent"UNIT_SPELLCAST_SUCCEEDED"
 	f:RegisterEvent"UNIT_SPELLCAST_STOP"
 	ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", SpamFilter)
-	return orgSetActiveTalentGroup(...)
+	return orgSetActiveSpecGroup(...)
 end
 
 function f:UNIT_SPELLCAST_STOP(event, unit)
@@ -70,18 +70,13 @@
 end
 f.UNIT_SPELLCAST_SUCCEEDED = f.UNIT_SPELLCAST_STOP
 
-
 local function GetTalentText(group)
-	local maxPoints, finalIcon, text = 0, DEFAULT_ICON
-	for tab = 1, 3 do
-		local icon, points = select( 4, GetTalentTabInfo(tab,nil,nil,group) )
-		if points > maxPoints then
-			maxPoints = points
-			finalIcon = icon
-		end
-		text = ("%s%.2i"):format(text and text.."/" or "", points)
-	end
-	return text, finalIcon
+        local spec = group or GetActiveSpecGroup()
+
+        local id,name,desc,icon,back,role = GetSpecializationInfo(spec)
+        local finalIcon = icon or DEFAULT_ICON
+
+        return name, finalIcon
 end
 
 
@@ -114,7 +109,6 @@
 	tip:Show()
 end
 
-
 local function Gear_OnClick(button, click)
 	if click == "LeftButton" and IsShiftKeyDown() then
 		return button.index > 0 and WearSet(button.index, true)
@@ -129,6 +123,7 @@
 	f:PLAYER_TALENT_UPDATE()
 end
 
+
 local function Spec_OnClick(button, click)
 	if click == "LeftButton" and IsShiftKeyDown() then
 		return WearSet(button.index)
@@ -299,14 +294,17 @@
 
 local function UpdateTablet()
 	f:SetScale(config.scale)
-	local talentGroup = GetActiveTalentGroup()
+	local talentGroup = GetActiveSpecGroup()
 	local specC, aliasC, gearC = 0, 0, 0
 	local hasAlias, hasGear
-	local nbSpec = GetNumTalentGroups()
+	local nbSpec = GetNumSpecGroups() 
 	for i = 1, nbSpec do
-		local specName, specIcon = GetTalentText(i)
+                local id,specName,description,specIcon,background,role = GetSpecializationInfo(i)
 		local group = char[i]
-		local alias, gearName, gearIcon = group[specName], group.set
+                local alias,gearName,gearIcon
+                if group then
+                  alias, gearName, gearIcon = group[specName], group.set
+                end
 
 		if gearName then
 			hasGear = true
@@ -318,7 +316,7 @@
 		end
 
 		local button, specW, aliasW, gearW =
-			SetButtonData(i, i==talentGroup, specIcon, specName, alias, gearIcon, gearName)
+			SetButtonData(i, i==talentGroup, specIcon, specName or "unknown", alias, gearIcon, gearName)
 
 		if specW > specC then specC = specW end
 		if aliasW > aliasC then aliasC = aliasW end
@@ -335,11 +333,14 @@
 
 
 ShowGears = function(_specIndex)
+	if not _specIndex then return end
 	specIndex = _specIndex
 	local nbGear = GetNumEquipmentSets()
 	if not nbGear or nbGear == 0 then return end
 	g:Show()
+	if char[specIndex] then
 	local currGear = char[specIndex].set
+	end
 	local button, maxWidth = SetGearData(0, not currGear, "", NONE)
 	for i=1, nbGear do
 		local gearName, gearIcon = GetEquipmentSetInfo(i)
@@ -436,14 +437,14 @@
 			config.hideBlockHints = not config.hideBlockHints
 			UpdateHints(BLOCK)
 		else
-			SetActiveTalentGroup( 3 - GetActiveTalentGroup() )
+			SetActiveSpecGroup( 3 - GetActiveSpecGroup() )
 		end
 	end
 })
 
 
 function f:PLAYER_TALENT_UPDATE()
-	local curr = char[GetActiveTalentGroup()]
+	local curr = char[GetActiveSpecGroup()]
 	local spec, icon = GetTalentText()
 	block.icon = curr.aliasIsSetName and GetEquipmentSetInfoByName(curr.set or "") and ("Interface\\Icons\\"..GetEquipmentSetInfoByName(curr.set or "")) or icon
 	block.text = curr.aliasIsSetName and curr.set or curr[spec] or spec
elaundar is offline Report comment to moderator  
Reply With Quote
Unread 08-30-12, 02:05 AM  
RandomHero13
A Kobold Labourer
 
RandomHero13's Avatar
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 15
Uploads: 1
Damn, this is one of those addons which i never realized that i would miss it that much
RandomHero13 is offline Report comment to moderator  
Reply With Quote
Unread 08-30-12, 12:41 AM  
Basso
A Deviate Faerie Dragon
 
Basso's Avatar
AddOn Author - Click to view AddOns

Forum posts: 15
File comments: 37
Uploads: 4
Is there coming an update for this ?
I really love this addon saves so much time and easy use, but sadly doenst work since 5.0.4. ^^
Basso is offline Report comment to moderator  
Reply With Quote
Unread 05-02-11, 10:48 PM  
TheGeek
A Firelord
 
TheGeek's Avatar
AddOn Author - Click to view AddOns

Forum posts: 494
File comments: 214
Uploads: 8
BOO! fix your rep and money =D

I LOVE YOU!

haha
__________________
TheGeek is offline Report comment to moderator  
Reply With Quote
Unread 05-02-11, 03:45 AM  
Aranarth
A Deviate Faerie Dragon
 
Aranarth's Avatar
AddOn Author - Click to view AddOns

Forum posts: 14
File comments: 394
Uploads: 7
@SmuvMoney:

Thanks for your detailed report. It should be fixed quickly.


@thebadmf:

The delay is probably related to the issue SmuvMoney reported and should be fixed quickly.
And for the huge size, it's also fixed (it will appear small when moving from r9 to r10 if you scaled it down.
Last edited by Aranarth : 05-02-11 at 05:55 AM.
Aranarth is offline Report comment to moderator  
Reply With Quote
Unread 05-02-11, 01:26 AM  
thebadmf
is in disguise
 
thebadmf's Avatar

Forum posts: 5
File comments: 109
Uploads: 0
Nice changes, thanks.
Not sure if it happens for anyone else but, the gear change is not happening until 5-10 seconds after a spec change.
I have to admit, I have been using Crossdresser to accomplish the same goal (I've disabled it for now) and this does it much quicker.
Also the tooltip doesn't obey Buttonbin scale override; it's far too big. I have tiptac installed if it's of any significance.

GL
thebadmf is offline Report comment to moderator  
Reply With Quote
Unread 05-01-11, 10:38 PM  
SmuvMoney
A Defias Bandit

Forum posts: 3
File comments: 85
Uploads: 0
Set not being equipped after switching spec?

I was testing this out on my death knight who is Blood/Frost dual spec. The names of the equipment sets mapped to those specs in the Equipment Manager are Blood and DPS respectively. When I switch spec by clicking on the LDB icon, I am able to switch specs without issue. However, the equipment set does not change unless I mouse over the LDB icon. At that point, the equipment set does switch for the respective set. I am using the r9 version. Thanks for your time.
__________________
Peace & God Bless,

$muvMoney
John 14:27 & Numbers 6:24
SmuvMoney is offline Report comment to moderator  
Reply With Quote
Unread 12-14-10, 01:12 PM  
Goncyn
A Defias Bandit

Forum posts: 3
File comments: 12
Uploads: 0
Is it possible to display in the tooltip the equipment information for the associated set, similar to the tooltip in the equipment manage? E.g. "15 items equipped, 1 in bags, wrist missing." It would be extremely useful for verifying that you have the proper gear equipped after experimenting with alternatives. A modified-click to re-equip the appropriate set would be even better!
Goncyn is offline Report comment to moderator  
Reply With Quote
Unread 11-10-10, 07:58 PM  
Aranarth
A Deviate Faerie Dragon
 
Aranarth's Avatar
AddOn Author - Click to view AddOns

Forum posts: 14
File comments: 394
Uploads: 7
Re: one proposal

Are you experiencing some leaked spam when switching ?


@next96:

If it's a popular demand, maybe. Until then, you can set alias as "Arms 31/03/02".
Last edited by Aranarth : 11-10-10 at 07:58 PM.
Aranarth is offline Report comment to moderator  
Reply With Quote
Unread 10-29-10, 12:04 AM  
next96
A Kobold Labourer

Forum posts: 0
File comments: 5
Uploads: 0
one proposal

hi

LDB Display 03/31/02 now.

for example Warrior.

Arms 31/03/02

so, main spec name add plz.

thank you
next96 is offline Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: