diff --git a/locales/enUS.lua b/locales/enUS.lua
index b2cd922..58b265f 100644
--- a/locales/enUS.lua
+++ b/locales/enUS.lua
@@ -104,3 +104,7 @@ L['Garbage Collect'] = true;
L['Use Class Colors'] = true;
L['Cooldowns'] = true;
+
+L['Set Specialization'] = true;
+L['Set Loot Specialization'] = true;
+L['Current Specialization'] = true;
diff --git a/modules/config.lua b/modules/config.lua
deleted file mode 100644
index 4dc5ad9..0000000
--- a/modules/config.lua
+++ /dev/null
@@ -1,268 +0,0 @@
-local addon, ns = ...
-local cfg = ns.cfg
-local unpack = unpack
---------------------------------------------------------------
-
-if not cfg.useConfig then return end
-
-local configFrame = CreateFrame("Frame",nil,cfg.SXconfigFrame,"ButtonFrameTemplate")
-configFrame:SetSize(350,400)
-configFrame:ClearAllPoints()
-configFrame:SetPoint("TOPLEFT",UIparent,20,-75)
---configFrame:SetScale(1.5)
-configFrame:SetClampedToScreen(true)
-configFrame:EnableMouse(true)
-configFrame:SetMovable(true)
-configFrame:RegisterForDrag("LeftButton")
-configFrame:SetScript("OnDragStart",configFrame.StartMoving)
-configFrame:SetScript("OnDragStop",configFrame.StopMovingOrSizing)
-
-local icon = configFrame:CreateTexture("$parentIcon", "OVERLAY", nil, -8)
-icon:SetSize(60,60)
-icon:SetPoint("TOPLEFT",-5,7)
-icon:SetTexture("Interface\\FriendsFrame\\Battlenet-Portrait")
---SetPortraitTexture(icon, "Interface\\FriendsFrame\\Battlenet-Portrait")
---icon:SetTexCoord(0,1,0,1)
-
-local configFrameText = configFrame:CreateFontString(nil, "OVERLAY")
-configFrameText:SetFont(STANDARD_TEXT_FONT, cfg.text.normalFontSize, "OUTLINE")
-configFrameText:SetPoint("TOP",0,-6)
-configFrameText:SetText(addon.." Configuration")
-
-local globalCheckButton = CreateFrame("CheckButton", "globalCheckButton", configFrame, "UICheckButtonTemplate")
-globalCheckButton:ClearAllPoints()
-globalCheckButton:SetPoint("TOPLEFT",60,-25)
-_G[globalCheckButton:GetName() .. "Text"]:SetText("Use Module Coloring")
-globalCheckButton:SetScript("OnClick", function(self,event,arg1)
- if self:GetChecked() then
- UIDropDownMenu_EnableDropDown(globalModuleDropdown)
- globalActiveModuleText:SetTextColor(1,1,1,1)
- else
- UIDropDownMenu_DisableDropDown(globalModuleDropdown)
- UIDropDownMenu_SetText(dropDown, "Select Module")
- globalActiveModuleText:SetTextColor(1,1,1,0.4)
- end
-end)
-
-
-local resetButton = CreateFrame("Button", "MyButton", configFrame, "UIPanelButtonTemplate")
-resetButton:SetSize(80 ,22) -- width, height
-resetButton:SetText("Reset Color")
-resetButton:SetPoint("TOPRIGHT",-10,-30)
-resetButton:SetScript("OnClick", function()
- if IsShiftKeyDown() then
- cfg.color = {
- normal = {1,1,1,.75},
- inactive = {1,1,1,.25},
- hover = {cfg.cc.r,cfg.cc.g,cfg.cc.b,.75},
- barcolor = {.094,.094,.102,.45},
- }
- print"The colors have been set to default."
- else
- print"Hold <Shift> if you want to set the colors to default."
- end
-end)
-
-
-local activeModuleText = configFrame:CreateFontString(nil, "OVERLAY")
-activeModuleText:SetFont(STANDARD_TEXT_FONT, cfg.text.normalFontSize, "OUTLINE")
-activeModuleText:SetPoint("TOPRIGHT",configFrame,"TOP",-20,-75)
-activeModuleText:SetText("Active Module:")
-globalActiveModuleText = activeModuleText
-
-local dropDown = CreateFrame("frame", "selectModuleDropDown", configFrame, "UIDropDownMenuTemplate")
-dropDown:SetPoint("LEFT",activeModuleText, "RIGHT", -10,-5)
-UIDropDownMenu_SetText(dropDown, "Select Module")
-UIDropDownMenu_JustifyText(dropDown, "LEFT")
-
-globalModuleDropdown = dropDown
-
-local modules = {
- "None",
- "Micromenu",
- "Armor",
- "Talent",
- "Clock",
- "Trade Skill",
- "Currency",
- "System",
- "Gold",
- "Heartstone",
-}
-
-local function OnClick(self)
- UIDropDownMenu_SetSelectedID(dropDown, self:GetID())
- if self:GetID() == 1 then
-
- elseif self:GetID() == 2 then
-
- elseif self:GetID() == 3 then
-
- elseif self:GetID() == 4 then
-
- elseif self:GetID() == 5 then
-
- elseif self:GetID() == 6 then
-
- elseif self:GetID() == 7 then
-
- elseif self:GetID() == 8 then
-
- elseif self:GetID() == 9 then
-
- elseif self:GetID() == 10 then
-
- end
-end
-
-local function initialize(self, level)
- local info = UIDropDownMenu_CreateInfo()
- for k,v in pairs(modules) do
- info = UIDropDownMenu_CreateInfo()
- info.text = v
- info.value = v
- info.func = OnClick
- UIDropDownMenu_AddButton(info, level)
- end
-end
-
-UIDropDownMenu_Initialize(dropDown, initialize)
-UIDropDownMenu_SetWidth(dropDown, 100);
-UIDropDownMenu_SetButtonWidth(dropDown, 75)
-
-
-local function showColorPicker(r,g,b,a,callback)
- ColorPickerFrame:SetColorRGB(r,g,b)
- ColorPickerFrame.hasOpacity, ColorPickerFrame.opacity = (a ~= nil), a
- ColorPickerFrame.previousValues = {r,g,b,a}
- ColorPickerFrame.func, ColorPickerFrame.opacityFunc, ColorPickerFrame.cancelFunc = callback, callback, callback
- ColorPickerFrame:Hide() -- Need to run the OnShow handler.
- ColorPickerFrame:Show()
-end
-
-local barColorFrame = CreateFrame("FRAME",nil,configFrame)
-barColorFrame:SetSize(18,18)
-barColorFrame:SetPoint("TOPLEFT",configFrame,15,-100)
---text
-barColorFrame.text = barColorFrame:CreateFontString(nil, "OVERLAY")
-barColorFrame.text:SetFont(STANDARD_TEXT_FONT, 16, "OUTLINE")
-barColorFrame.text:SetPoint("CENTER")
-barColorFrame.text:SetText("Bar Color")
-barColorFrame.text:SetTextColor(1,1,1,.75)
-barColorFrame:SetWidth(barColorFrame.text:GetStringWidth())
-
-local normalColor = CreateFrame("FRAME",nil,configFrame)
-normalColor:SetSize(100,20)
-normalColor:SetPoint("TOPLEFT",barColorFrame,0,-40)
---text
-normalColor.text = normalColor:CreateFontString(nil, "OVERLAY")
-normalColor.text:SetFont(STANDARD_TEXT_FONT, 16, "OUTLINE")
-normalColor.text:SetPoint("CENTER")
-normalColor.text:SetText("Normal Color")
-normalColor.text:SetTextColor(1,1,1,.75)
-normalColor:SetWidth(normalColor.text:GetStringWidth())
-
-local inactiveColor = CreateFrame("FRAME",nil,configFrame)
-inactiveColor:SetSize(100,20)
-inactiveColor:SetPoint("TOPLEFT",normalColor,0,-40)
---text
-inactiveColor.text = inactiveColor:CreateFontString(nil, "OVERLAY")
-inactiveColor.text:SetFont(STANDARD_TEXT_FONT, 16, "OUTLINE")
-inactiveColor.text:SetPoint("CENTER")
-inactiveColor.text:SetText("Inactive Color")
-inactiveColor.text:SetTextColor(1,1,1,.25)
-inactiveColor:SetWidth(normalColor.text:GetStringWidth())
-
-local hoverColorFrame = CreateFrame("FRAME",nil,configFrame)
-hoverColorFrame:SetSize(18,18)
-hoverColorFrame:SetPoint("TOPLEFT",inactiveColor,0,-40)
---text
-hoverColorFrame.text = hoverColorFrame:CreateFontString(nil, "OVERLAY")
-hoverColorFrame.text:SetFont(STANDARD_TEXT_FONT, 16, "OUTLINE")
-hoverColorFrame.text:SetPoint("CENTER")
-hoverColorFrame.text:SetText("Hover Color")
-hoverColorFrame.text:SetTextColor(cfg.cc.r,cfg.cc.g,cfg.cc.b,.75)
-hoverColorFrame:SetWidth(hoverColorFrame.text:GetStringWidth())
-
---recolor callback function
-normalColor.recolorTexture = function(color)
- local r,g,b,a
- if color then
- r,g,b,a = unpack(color)
- else
- r,g,b = ColorPickerFrame:GetColorRGB()
- a = OpacitySliderFrame:GetValue()
- end
- normalColor.text:SetTextColor(r,g,b,a)
- cfg.color.normal = {r,g,b,a}
- globalNormColSlider:SetValue(a*100)
- globalNormColEditBox:SetNumber(a*100)
-end
-normalColor:EnableMouse(true)
-normalColor:SetScript("OnMouseDown", function(self,button,...)
- if button == "LeftButton" then
- local r,g,b,a = self.text:GetTextColor()
- showColorPicker(r,g,b,a,self.recolorTexture)
- end
-end)
-
-local normalClassColorCheckButton = CreateFrame("CheckButton", "classColorNormalCheckButton", normalColor, "UIRadioButtonTemplate")
-normalClassColorCheckButton:ClearAllPoints()
-normalClassColorCheckButton:SetPoint("RIGHT",50,0)
-_G[normalClassColorCheckButton:GetName() .. "Text"]:SetText("Class color")
-normalClassColorCheckButton:SetScript("OnClick", function(self,event,arg1)
- if self:GetChecked() then
- normalColor.text:SetTextColor(cfg.cc.r,cfg.cc.g,cfg.cc.b)
- normalColor:EnableMouse(false)
- globalNormColEditBox:Enable()
- globalNormColSlider:Enable()
- globalNormColSlider:SetAlpha(1)
- else
- normalColor.text:SetTextColor(1,1,1,.75)
- normalColor:EnableMouse(true)
- globalNormColEditBox:Disable()
- globalNormColSlider:Disable()
- globalNormColSlider:SetAlpha(.4)
- end
-end)
-
-local slider = CreateFrame("Slider","MyExampleSlider",normalClassColorCheckButton,"OptionsSliderTemplate") --frameType, frameName, frameParent, frameTemplate
-slider:SetPoint("TOPLEFT",0,-30)
-slider.textLow = _G["MyExampleSlider".."Low"]
-slider.textHigh = _G["MyExampleSlider".."High"]
-slider.text = _G["MyExampleSlider".."Text"]
-slider:SetMinMaxValues(0, 100)
-slider.minValue, slider.maxValue = slider:GetMinMaxValues()
-slider.textLow:SetText(slider.minValue)
-slider.textHigh:SetText(slider.maxValue)
-slider.text:SetText("Class Color Alpha:")
-slider:SetValue(100)
-slider:SetValueStep(1)
-slider:Disable()
-slider:SetAlpha(.4)
-slider:SetScript("OnValueChanged", function(self,event,arg1)
- normalColor.text:SetAlpha(event/100)
- globalNormColEditBox:SetNumber(event)
-end)
-globalNormColSlider = slider
-
-local EditBox = CreateFrame("EditBox",nil,slider)
-EditBox:SetWidth(32)
-EditBox:SetHeight(16)
-EditBox:SetPoint("LEFT",slider.text,"RIGHT",2,0)
-EditBox:SetFontObject(GameFontNormal)
-EditBox:SetAutoFocus(false)
-EditBox:SetMaxLetters(3)
-EditBox:SetNumeric()
-EditBox:SetScript("OnEnterPressed", function(self)
- self:ClearFocus()
- globalNormColSlider:SetValue(EditBox:GetNumber())
-end)
-
-globalNormColEditBox = EditBox
-
---[
-UIDropDownMenu_DisableDropDown(globalModuleDropdown)
-globalActiveModuleText:SetTextColor(1,1,1,0.4)
-globalNormColEditBox:Disable()
---]]
\ No newline at end of file
diff --git a/modules/load_modules.xml b/modules/load_modules.xml
index ee7ec0d..10e910d 100644
--- a/modules/load_modules.xml
+++ b/modules/load_modules.xml
@@ -8,4 +8,5 @@
<Script file="tradeskill.lua" />
<Script file="currency.lua" />
<Script file="system.lua" />
+ <Script file="talent.lua" />
</Ui>
diff --git a/modules/old/config.lua b/modules/old/config.lua
new file mode 100644
index 0000000..4dc5ad9
--- /dev/null
+++ b/modules/old/config.lua
@@ -0,0 +1,268 @@
+local addon, ns = ...
+local cfg = ns.cfg
+local unpack = unpack
+--------------------------------------------------------------
+
+if not cfg.useConfig then return end
+
+local configFrame = CreateFrame("Frame",nil,cfg.SXconfigFrame,"ButtonFrameTemplate")
+configFrame:SetSize(350,400)
+configFrame:ClearAllPoints()
+configFrame:SetPoint("TOPLEFT",UIparent,20,-75)
+--configFrame:SetScale(1.5)
+configFrame:SetClampedToScreen(true)
+configFrame:EnableMouse(true)
+configFrame:SetMovable(true)
+configFrame:RegisterForDrag("LeftButton")
+configFrame:SetScript("OnDragStart",configFrame.StartMoving)
+configFrame:SetScript("OnDragStop",configFrame.StopMovingOrSizing)
+
+local icon = configFrame:CreateTexture("$parentIcon", "OVERLAY", nil, -8)
+icon:SetSize(60,60)
+icon:SetPoint("TOPLEFT",-5,7)
+icon:SetTexture("Interface\\FriendsFrame\\Battlenet-Portrait")
+--SetPortraitTexture(icon, "Interface\\FriendsFrame\\Battlenet-Portrait")
+--icon:SetTexCoord(0,1,0,1)
+
+local configFrameText = configFrame:CreateFontString(nil, "OVERLAY")
+configFrameText:SetFont(STANDARD_TEXT_FONT, cfg.text.normalFontSize, "OUTLINE")
+configFrameText:SetPoint("TOP",0,-6)
+configFrameText:SetText(addon.." Configuration")
+
+local globalCheckButton = CreateFrame("CheckButton", "globalCheckButton", configFrame, "UICheckButtonTemplate")
+globalCheckButton:ClearAllPoints()
+globalCheckButton:SetPoint("TOPLEFT",60,-25)
+_G[globalCheckButton:GetName() .. "Text"]:SetText("Use Module Coloring")
+globalCheckButton:SetScript("OnClick", function(self,event,arg1)
+ if self:GetChecked() then
+ UIDropDownMenu_EnableDropDown(globalModuleDropdown)
+ globalActiveModuleText:SetTextColor(1,1,1,1)
+ else
+ UIDropDownMenu_DisableDropDown(globalModuleDropdown)
+ UIDropDownMenu_SetText(dropDown, "Select Module")
+ globalActiveModuleText:SetTextColor(1,1,1,0.4)
+ end
+end)
+
+
+local resetButton = CreateFrame("Button", "MyButton", configFrame, "UIPanelButtonTemplate")
+resetButton:SetSize(80 ,22) -- width, height
+resetButton:SetText("Reset Color")
+resetButton:SetPoint("TOPRIGHT",-10,-30)
+resetButton:SetScript("OnClick", function()
+ if IsShiftKeyDown() then
+ cfg.color = {
+ normal = {1,1,1,.75},
+ inactive = {1,1,1,.25},
+ hover = {cfg.cc.r,cfg.cc.g,cfg.cc.b,.75},
+ barcolor = {.094,.094,.102,.45},
+ }
+ print"The colors have been set to default."
+ else
+ print"Hold <Shift> if you want to set the colors to default."
+ end
+end)
+
+
+local activeModuleText = configFrame:CreateFontString(nil, "OVERLAY")
+activeModuleText:SetFont(STANDARD_TEXT_FONT, cfg.text.normalFontSize, "OUTLINE")
+activeModuleText:SetPoint("TOPRIGHT",configFrame,"TOP",-20,-75)
+activeModuleText:SetText("Active Module:")
+globalActiveModuleText = activeModuleText
+
+local dropDown = CreateFrame("frame", "selectModuleDropDown", configFrame, "UIDropDownMenuTemplate")
+dropDown:SetPoint("LEFT",activeModuleText, "RIGHT", -10,-5)
+UIDropDownMenu_SetText(dropDown, "Select Module")
+UIDropDownMenu_JustifyText(dropDown, "LEFT")
+
+globalModuleDropdown = dropDown
+
+local modules = {
+ "None",
+ "Micromenu",
+ "Armor",
+ "Talent",
+ "Clock",
+ "Trade Skill",
+ "Currency",
+ "System",
+ "Gold",
+ "Heartstone",
+}
+
+local function OnClick(self)
+ UIDropDownMenu_SetSelectedID(dropDown, self:GetID())
+ if self:GetID() == 1 then
+
+ elseif self:GetID() == 2 then
+
+ elseif self:GetID() == 3 then
+
+ elseif self:GetID() == 4 then
+
+ elseif self:GetID() == 5 then
+
+ elseif self:GetID() == 6 then
+
+ elseif self:GetID() == 7 then
+
+ elseif self:GetID() == 8 then
+
+ elseif self:GetID() == 9 then
+
+ elseif self:GetID() == 10 then
+
+ end
+end
+
+local function initialize(self, level)
+ local info = UIDropDownMenu_CreateInfo()
+ for k,v in pairs(modules) do
+ info = UIDropDownMenu_CreateInfo()
+ info.text = v
+ info.value = v
+ info.func = OnClick
+ UIDropDownMenu_AddButton(info, level)
+ end
+end
+
+UIDropDownMenu_Initialize(dropDown, initialize)
+UIDropDownMenu_SetWidth(dropDown, 100);
+UIDropDownMenu_SetButtonWidth(dropDown, 75)
+
+
+local function showColorPicker(r,g,b,a,callback)
+ ColorPickerFrame:SetColorRGB(r,g,b)
+ ColorPickerFrame.hasOpacity, ColorPickerFrame.opacity = (a ~= nil), a
+ ColorPickerFrame.previousValues = {r,g,b,a}
+ ColorPickerFrame.func, ColorPickerFrame.opacityFunc, ColorPickerFrame.cancelFunc = callback, callback, callback
+ ColorPickerFrame:Hide() -- Need to run the OnShow handler.
+ ColorPickerFrame:Show()
+end
+
+local barColorFrame = CreateFrame("FRAME",nil,configFrame)
+barColorFrame:SetSize(18,18)
+barColorFrame:SetPoint("TOPLEFT",configFrame,15,-100)
+--text
+barColorFrame.text = barColorFrame:CreateFontString(nil, "OVERLAY")
+barColorFrame.text:SetFont(STANDARD_TEXT_FONT, 16, "OUTLINE")
+barColorFrame.text:SetPoint("CENTER")
+barColorFrame.text:SetText("Bar Color")
+barColorFrame.text:SetTextColor(1,1,1,.75)
+barColorFrame:SetWidth(barColorFrame.text:GetStringWidth())
+
+local normalColor = CreateFrame("FRAME",nil,configFrame)
+normalColor:SetSize(100,20)
+normalColor:SetPoint("TOPLEFT",barColorFrame,0,-40)
+--text
+normalColor.text = normalColor:CreateFontString(nil, "OVERLAY")
+normalColor.text:SetFont(STANDARD_TEXT_FONT, 16, "OUTLINE")
+normalColor.text:SetPoint("CENTER")
+normalColor.text:SetText("Normal Color")
+normalColor.text:SetTextColor(1,1,1,.75)
+normalColor:SetWidth(normalColor.text:GetStringWidth())
+
+local inactiveColor = CreateFrame("FRAME",nil,configFrame)
+inactiveColor:SetSize(100,20)
+inactiveColor:SetPoint("TOPLEFT",normalColor,0,-40)
+--text
+inactiveColor.text = inactiveColor:CreateFontString(nil, "OVERLAY")
+inactiveColor.text:SetFont(STANDARD_TEXT_FONT, 16, "OUTLINE")
+inactiveColor.text:SetPoint("CENTER")
+inactiveColor.text:SetText("Inactive Color")
+inactiveColor.text:SetTextColor(1,1,1,.25)
+inactiveColor:SetWidth(normalColor.text:GetStringWidth())
+
+local hoverColorFrame = CreateFrame("FRAME",nil,configFrame)
+hoverColorFrame:SetSize(18,18)
+hoverColorFrame:SetPoint("TOPLEFT",inactiveColor,0,-40)
+--text
+hoverColorFrame.text = hoverColorFrame:CreateFontString(nil, "OVERLAY")
+hoverColorFrame.text:SetFont(STANDARD_TEXT_FONT, 16, "OUTLINE")
+hoverColorFrame.text:SetPoint("CENTER")
+hoverColorFrame.text:SetText("Hover Color")
+hoverColorFrame.text:SetTextColor(cfg.cc.r,cfg.cc.g,cfg.cc.b,.75)
+hoverColorFrame:SetWidth(hoverColorFrame.text:GetStringWidth())
+
+--recolor callback function
+normalColor.recolorTexture = function(color)
+ local r,g,b,a
+ if color then
+ r,g,b,a = unpack(color)
+ else
+ r,g,b = ColorPickerFrame:GetColorRGB()
+ a = OpacitySliderFrame:GetValue()
+ end
+ normalColor.text:SetTextColor(r,g,b,a)
+ cfg.color.normal = {r,g,b,a}
+ globalNormColSlider:SetValue(a*100)
+ globalNormColEditBox:SetNumber(a*100)
+end
+normalColor:EnableMouse(true)
+normalColor:SetScript("OnMouseDown", function(self,button,...)
+ if button == "LeftButton" then
+ local r,g,b,a = self.text:GetTextColor()
+ showColorPicker(r,g,b,a,self.recolorTexture)
+ end
+end)
+
+local normalClassColorCheckButton = CreateFrame("CheckButton", "classColorNormalCheckButton", normalColor, "UIRadioButtonTemplate")
+normalClassColorCheckButton:ClearAllPoints()
+normalClassColorCheckButton:SetPoint("RIGHT",50,0)
+_G[normalClassColorCheckButton:GetName() .. "Text"]:SetText("Class color")
+normalClassColorCheckButton:SetScript("OnClick", function(self,event,arg1)
+ if self:GetChecked() then
+ normalColor.text:SetTextColor(cfg.cc.r,cfg.cc.g,cfg.cc.b)
+ normalColor:EnableMouse(false)
+ globalNormColEditBox:Enable()
+ globalNormColSlider:Enable()
+ globalNormColSlider:SetAlpha(1)
+ else
+ normalColor.text:SetTextColor(1,1,1,.75)
+ normalColor:EnableMouse(true)
+ globalNormColEditBox:Disable()
+ globalNormColSlider:Disable()
+ globalNormColSlider:SetAlpha(.4)
+ end
+end)
+
+local slider = CreateFrame("Slider","MyExampleSlider",normalClassColorCheckButton,"OptionsSliderTemplate") --frameType, frameName, frameParent, frameTemplate
+slider:SetPoint("TOPLEFT",0,-30)
+slider.textLow = _G["MyExampleSlider".."Low"]
+slider.textHigh = _G["MyExampleSlider".."High"]
+slider.text = _G["MyExampleSlider".."Text"]
+slider:SetMinMaxValues(0, 100)
+slider.minValue, slider.maxValue = slider:GetMinMaxValues()
+slider.textLow:SetText(slider.minValue)
+slider.textHigh:SetText(slider.maxValue)
+slider.text:SetText("Class Color Alpha:")
+slider:SetValue(100)
+slider:SetValueStep(1)
+slider:Disable()
+slider:SetAlpha(.4)
+slider:SetScript("OnValueChanged", function(self,event,arg1)
+ normalColor.text:SetAlpha(event/100)
+ globalNormColEditBox:SetNumber(event)
+end)
+globalNormColSlider = slider
+
+local EditBox = CreateFrame("EditBox",nil,slider)
+EditBox:SetWidth(32)
+EditBox:SetHeight(16)
+EditBox:SetPoint("LEFT",slider.text,"RIGHT",2,0)
+EditBox:SetFontObject(GameFontNormal)
+EditBox:SetAutoFocus(false)
+EditBox:SetMaxLetters(3)
+EditBox:SetNumeric()
+EditBox:SetScript("OnEnterPressed", function(self)
+ self:ClearFocus()
+ globalNormColSlider:SetValue(EditBox:GetNumber())
+end)
+
+globalNormColEditBox = EditBox
+
+--[
+UIDropDownMenu_DisableDropDown(globalModuleDropdown)
+globalActiveModuleText:SetTextColor(1,1,1,0.4)
+globalNormColEditBox:Disable()
+--]]
\ No newline at end of file
diff --git a/modules/old/talent.lua b/modules/old/talent.lua
new file mode 100644
index 0000000..f9f0fce
--- /dev/null
+++ b/modules/old/talent.lua
@@ -0,0 +1,340 @@
+local addon, ns = ...
+local cfg = ns.cfg
+local unpack = unpack
+--------------------------------------------------------------
+if not cfg.talent.show then return end
+
+local currentSpec = 0 -- from 1-4
+local currentSpecID, currentSpecName = 0,0 --global id
+local lootspecid = 0
+local id, name = 0,0
+
+local talentFrame = CreateFrame("Frame",'SX_TalentFrame', cfg.SXframe)
+talentFrame:SetPoint("RIGHT", cfg.SXframe, "CENTER", -110,0)
+talentFrame:SetSize(16, 16)
+---------------------------------------------
+-- LOOTSPEC FRAME
+---------------------------------------------
+local lootSpecFrame = CreateFrame("BUTTON",'SX_LootSpecFrame', talentFrame)
+if cfg.core.position ~= "BOTTOM" then
+ lootSpecFrame:SetPoint("TOP", talentFrame, "BOTTOM", 0,-6)
+else
+ lootSpecFrame:SetPoint("BOTTOM", talentFrame, "TOP", 0,8)
+end
+lootSpecFrame:RegisterForClicks("AnyUp")
+lootSpecFrame:Hide()
+lootSpecFrame:EnableMouse(true)
+
+lootSpecFrame:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "RightButton" then
+ lootSpecFrame:Hide()
+ end
+end)
+
+local lootSpecText = lootSpecFrame:CreateFontString(nil, "OVERLAY")
+lootSpecText:SetFont(cfg.text.font, cfg.text.normalFontSize)
+lootSpecText:SetPoint("TOP")
+lootSpecText:SetText("LOOT SPECIALIZATION")
+lootSpecText:SetTextColor(unpack(cfg.color.normal))
+
+local defaultLootTypeButton = CreateFrame("BUTTON",nil, lootSpecFrame)
+defaultLootTypeButton:SetSize(lootSpecText:GetStringWidth(),cfg.text.normalFontSize)
+defaultLootTypeButton:SetPoint("CENTER",lootSpecText)
+defaultLootTypeButton:EnableMouse(true)
+defaultLootTypeButton:RegisterForClicks("AnyUp")
+
+defaultLootTypeButton:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "LeftButton" then
+ if GetLootSpecialization() ~= 0 then
+ SetLootSpecialization(0)
+ print("|cffffff00Loot Specialization set to: Current Specialization")
+ lootSpecFrame:Hide()
+ end
+ elseif button == "RightButton" then
+ lootSpecFrame:Hide()
+ end
+end)
+
+local lootSpectBG = lootSpecFrame:CreateTexture(nil,"OVERLAY",nil,7)
+lootSpectBG:SetPoint("TOP")
+lootSpectBG:SetColorTexture(unpack(cfg.color.barcolor))
+globalLootSpecFrame = lootSpecFrame
+
+---------------------------------------------
+-- SPEC CHANGE FRAME
+---------------------------------------------
+local specFrame = CreateFrame("BUTTON",'SX_SpecFrame', talentFrame)
+if cfg.core.position ~= "BOTTOM" then
+ specFrame:SetPoint("TOP", talentFrame, "BOTTOM", 0,-6)
+else
+ specFrame:SetPoint("BOTTOM", talentFrame, "TOP", 0,8)
+end
+specFrame:RegisterForClicks("AnyUp")
+specFrame:Hide()
+specFrame:EnableMouse(true)
+
+specFrame:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "RightButton" then
+ specFrame:Hide()
+ end
+end)
+
+local specText = specFrame:CreateFontString(nil, "OVERLAY")
+specText:SetFont(cfg.text.font, cfg.text.normalFontSize)
+specText:SetPoint("TOP")
+specText:SetText("SET SPECIALIZATION")
+specText:SetTextColor(unpack(cfg.color.normal))
+
+local specBG = specFrame:CreateTexture(nil,"OVERLAY",nil,7)
+specBG:SetPoint("TOP")
+specBG:SetColorTexture(unpack(cfg.color.barcolor))
+globalSpecFrame = specFrame
+
+---------------------------------------------
+-- PRIMARY SPEC FRAME
+---------------------------------------------
+
+local primarySpecFrame = CreateFrame("BUTTON",nil, talentFrame)
+primarySpecFrame:SetPoint("RIGHT")
+primarySpecFrame:SetSize(16, 16)
+primarySpecFrame:EnableMouse(true)
+primarySpecFrame:RegisterForClicks("AnyUp")
+
+local primarySpecText = primarySpecFrame:CreateFontString(nil, "OVERLAY")
+primarySpecText:SetFont(cfg.text.font, cfg.text.normalFontSize)
+primarySpecText:SetPoint("RIGHT")
+primarySpecText:SetTextColor(unpack(cfg.color.normal))
+
+local primarySpecIcon = primarySpecFrame:CreateTexture(nil,"OVERLAY",nil,7)
+primarySpecIcon:SetSize(16, 16)
+primarySpecIcon:SetPoint("RIGHT", primarySpecText,"LEFT",-2,0)
+primarySpecIcon:SetVertexColor(unpack(cfg.color.normal))
+
+primarySpecFrame:SetScript("OnEnter", function()
+ if InCombatLockdown() then return end
+ GameTooltip:SetOwner(talentFrame, cfg.tooltipPos)
+ currentSpec = GetSpecialization()
+ currentSpecID, currentSpecName = GetSpecializationInfo(currentSpec)
+ lootspecid = GetLootSpecialization()
+ if lootspecid == 0 then lootspecid = currentSpecID end
+ id, name = GetSpecializationInfoByID(lootspecid)
+ GameTooltip:AddLine("|cffffffffLoot is currently set to |cffffff00"..name.."|cffffffff spec")
+ GameTooltip:AddDoubleLine("<Left-Click>", "Change spec", 1, 1, 0, 1, 1, 1)
+ GameTooltip:AddDoubleLine("<Right-Click>", "Change lootspec", 1, 1, 0, 1, 1, 1)
+ primarySpecIcon:SetVertexColor(unpack(cfg.color.hover))
+ GameTooltip:Show()
+end)
+
+primarySpecFrame:SetScript("OnLeave", function()
+ if GetActiveSpecGroup() == 1 then
+ primarySpecIcon:SetVertexColor(unpack(cfg.color.normal))
+ else
+ primarySpecIcon:SetVertexColor(unpack(cfg.color.inactive))
+ end
+ if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end
+end)
+
+primarySpecFrame:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "LeftButton" then
+ if globalSpecFrame:IsShown() then
+ globalSpecFrame:Hide()
+ else
+ if globalLootSpecFrame:IsShown() then
+ globalLootSpecFrame:Hide()
+ end
+ globalSpecFrame:Show()
+ end
+ elseif button == "RightButton" then
+ if globalLootSpecFrame:IsShown() then
+ globalLootSpecFrame:Hide()
+ else
+ if globalSpecFrame:IsShown() then
+ globalSpecFrame:Hide()
+ end
+ globalLootSpecFrame:Show()
+ end
+ end
+end)
+---------------------------------------------------------------------
+
+local function createLootSpecButtons()
+for index = 1,4 do
+ local id, name = GetSpecializationInfo(index)
+ if ( name ) then
+ lootSpecFrame:SetSize(lootSpecText:GetStringWidth()+16, (index+1)*18)
+ lootSpectBG:SetSize(lootSpecFrame:GetSize())
+ currentSpecID, currentSpecName = GetSpecializationInfo(index)
+
+ local lootSpecButton = CreateFrame("BUTTON",nil, lootSpecFrame)
+ lootSpecButton:SetPoint("TOPLEFT", lootSpecText, 0, index*-18)
+ lootSpecButton:SetSize(16, 16)
+ lootSpecButton:EnableMouse(true)
+ lootSpecButton:RegisterForClicks("AnyUp")
+
+
+ local lootSpecbuttonText = lootSpecButton:CreateFontString(nil, "OVERLAY")
+ lootSpecbuttonText:SetFont(cfg.text.font, cfg.text.smallFontSize)
+ lootSpecbuttonText:SetPoint("RIGHT")
+ if currentSpecName then currentSpecName = string.upper(currentSpecName) end
+ lootSpecbuttonText:SetText(currentSpecName)
+
+ local lootSpecbuttonIcon = lootSpecButton:CreateTexture(nil,"OVERLAY",nil,7)
+ lootSpecbuttonIcon:SetSize(16, 16)
+ lootSpecbuttonIcon:SetPoint("LEFT")
+ lootSpecbuttonIcon:SetTexture(cfg.mediaFolder.."spec\\"..cfg.CLASS)
+ lootSpecbuttonIcon:SetTexCoord(unpack(cfg.specCoords[index]))
+
+ local id = GetSpecializationInfo(index)
+ if GetLootSpecialization() == id then
+ lootSpecbuttonText:SetTextColor(unpack(cfg.color.normal))
+ lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.normal))
+ else
+ lootSpecbuttonText:SetTextColor(unpack(cfg.color.inactive))
+ lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.inactive))
+ end
+ lootSpecButton:SetSize(lootSpecbuttonText:GetStringWidth()+18,16)
+
+ lootSpecButton:SetScript("OnEnter", function() if InCombatLockdown() then return end lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.hover)) end)
+ lootSpecButton:SetScript("OnLeave", function()
+ local id = GetSpecializationInfo(index)
+ if GetLootSpecialization() == id then
+ lootSpecbuttonText:SetTextColor(unpack(cfg.color.normal))
+ lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.normal))
+ else
+ lootSpecbuttonText:SetTextColor(unpack(cfg.color.inactive))
+ lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.inactive))
+ end
+ end)
+
+ lootSpecButton:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "LeftButton" then
+ if IsShiftKeyDown() then
+ SetSpecialization(index)
+ else
+ local id = GetSpecializationInfo(index)
+ SetLootSpecialization(id)
+ lootSpecbuttonText:SetTextColor(unpack(cfg.color.normal))
+ lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.normal))
+ end
+ lootSpecFrame:Hide()
+ elseif button == "RightButton" then
+ lootSpecFrame:Hide()
+ end
+ end)
+ end
+end
+end
+
+---------------------------------------------------------------------
+
+local function createSpecButtons()
+ local curSpec = GetSpecialization()
+ for index = 1,GetNumSpecializations() do
+ local id, name = GetSpecializationInfo(index)
+ if ( name ) then
+ specFrame:SetSize(specText:GetStringWidth()+16, (index+1)*18)
+ specBG:SetSize(specFrame:GetSize())
+ currentSpecID, currentSpecName = GetSpecializationInfo(index)
+
+ local specButton = CreateFrame("BUTTON",nil, specFrame)
+ specButton:SetPoint("TOPLEFT", specText, 0, index*-18)
+ specButton:SetSize(16, 16)
+ specButton:EnableMouse(true)
+ specButton:RegisterForClicks("AnyUp")
+
+ local specButtonText = specButton:CreateFontString(nil, "OVERLAY")
+ specButtonText:SetFont(cfg.text.font, cfg.text.smallFontSize)
+ specButtonText:SetPoint("RIGHT")
+ if currentSpecName then currentSpecName = string.upper(currentSpecName) end
+ specButtonText:SetText(currentSpecName)
+
+ local specButtonIcon = specButton:CreateTexture(nil,"OVERLAY",nil,7)
+ specButtonIcon:SetSize(16, 16)
+ specButtonIcon:SetPoint("LEFT")
+ specButtonIcon:SetTexture(cfg.mediaFolder.."spec\\"..cfg.CLASS)
+ specButtonIcon:SetTexCoord(unpack(cfg.specCoords[index]))
+
+ --local id = GetSpecializationInfo(index)
+ if GetSpecialization() == index then
+ specButtonText:SetTextColor(unpack(cfg.color.normal))
+ specButtonIcon:SetVertexColor(unpack(cfg.color.normal))
+ else
+ specButtonText:SetTextColor(unpack(cfg.color.inactive))
+ specButtonIcon:SetVertexColor(unpack(cfg.color.inactive))
+ end
+ specButton:SetSize(specButtonText:GetStringWidth()+18,16)
+
+ specButton:SetScript("OnEnter", function() if InCombatLockdown() then return end specButtonIcon:SetVertexColor(unpack(cfg.color.hover)) end)
+ specButton:SetScript("OnLeave", function()
+ local id = GetSpecializationInfo(index)
+ if GetSpecialization() == id then
+ specButtonText:SetTextColor(unpack(cfg.color.normal))
+ specButtonIcon:SetVertexColor(unpack(cfg.color.normal))
+ else
+ specButtonText:SetTextColor(unpack(cfg.color.inactive))
+ specButtonIcon:SetVertexColor(unpack(cfg.color.inactive))
+ end
+ end)
+
+ specButton:SetScript("OnClick", function(self, button, down)
+ if InCombatLockdown() then return end
+ if button == "LeftButton" then
+ SetSpecialization(index)
+ specFrame:Hide()
+ elseif button == "RightButton" then
+ specFrame:Hide()
+ end
+ end)
+ end
+ end
+end
+
+---------------------------------------------
+-- EVENTS
+---------------------------------------------
+
+local eventframe = CreateFrame("Frame")
+eventframe:RegisterEvent("PLAYER_ENTERING_WORLD")
+eventframe:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
+eventframe:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
+eventframe:RegisterEvent("PLAYER_LOOT_SPEC_UPDATED")
+eventframe:RegisterEvent("PLAYER_REGEN_DISABLED")
+
+eventframe:SetScript("OnEvent", function(self,event, ...)
+ if event == ("PLAYER_ENTERING_WORLD") then
+ createSpecButtons()
+ createLootSpecButtons()
+ end
+ if event == ("PLAYER_REGEN_DISABLED") then
+ if lootSpecFrame:IsShown() then
+ lootSpecFrame:Hide()
+ end
+ if specFrame:IsShown() then
+ specFrame:Hide()
+ end
+ end
+
+ local primarySpec = GetSpecialization(false, false, 1)
+ if primarySpec ~= nil then
+ local id, name = GetSpecializationInfo(primarySpec)
+ if name then name = string.upper(name) end
+ --name = string.upper(name)
+ primarySpecText:SetText(name)
+ primarySpecIcon:SetTexture(cfg.mediaFolder.."spec\\"..cfg.CLASS)
+ primarySpecIcon:SetTexCoord(unpack(cfg.specCoords[primarySpec]))
+ primarySpecFrame:SetSize(primarySpecText:GetStringWidth()+18, 16)
+ primarySpecFrame:Show()
+ primarySpecFrame:EnableMouse(true)
+ else
+ primarySpecFrame:Hide()
+ primarySpecFrame:EnableMouse(false)
+ end
+ primarySpecIcon:SetVertexColor(unpack(cfg.color.normal))
+ primarySpecText:SetTextColor(unpack(cfg.color.normal))
+ talentFrame:SetSize((primarySpecFrame:GetWidth()), 16)
+end)
diff --git a/modules/system.lua b/modules/system.lua
index fe4ad77..09ff40e 100644
--- a/modules/system.lua
+++ b/modules/system.lua
@@ -60,14 +60,16 @@ function SystemModule:Refresh()
self.pingText:SetFont(xb:GetFont(db.text.fontSize))
self.worldPingText:SetFont(xb:GetFont(db.text.fontSize))
- if self.fpsFrame:IsMouseOver() or self.pingFrame:IsMouseOver() then
+ self.fpsText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ self.pingText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ self.worldPingText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+
+ if self.fpsFrame:IsMouseOver() then
self.fpsText:SetTextColor(unpack(xb:HoverColors()))
+ end
+ if self.pingFrame:IsMouseOver() then
self.pingText:SetTextColor(unpack(xb:HoverColors()))
self.worldPingText:SetTextColor(unpack(xb:HoverColors()))
- else
- self.fpsText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
- self.pingText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
- self.worldPingText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
end
self.worldPingText:SetText('000'..MILLISECONDS_ABBR)
@@ -120,9 +122,13 @@ end
function SystemModule:HoverFunction()
if InCombatLockdown() then return; end
- self.fpsText:SetTextColor(unpack(xb:HoverColors()))
- self.pingText:SetTextColor(unpack(xb:HoverColors()))
- self.worldPingText:SetTextColor(unpack(xb:HoverColors()))
+ if self.fpsFrame:IsMouseOver() then
+ self.fpsText:SetTextColor(unpack(xb:HoverColors()))
+ end
+ if self.pingFrame:IsMouseOver() then
+ self.pingText:SetTextColor(unpack(xb:HoverColors()))
+ self.worldPingText:SetTextColor(unpack(xb:HoverColors()))
+ end
if xb.db.profile.modules.system.showTooltip then
self:ShowTooltip()
end
diff --git a/modules/talent.lua b/modules/talent.lua
index f9f0fce..ec48091 100644
--- a/modules/talent.lua
+++ b/modules/talent.lua
@@ -1,340 +1,492 @@
-local addon, ns = ...
-local cfg = ns.cfg
-local unpack = unpack
---------------------------------------------------------------
-if not cfg.talent.show then return end
-
-local currentSpec = 0 -- from 1-4
-local currentSpecID, currentSpecName = 0,0 --global id
-local lootspecid = 0
-local id, name = 0,0
-
-local talentFrame = CreateFrame("Frame",'SX_TalentFrame', cfg.SXframe)
-talentFrame:SetPoint("RIGHT", cfg.SXframe, "CENTER", -110,0)
-talentFrame:SetSize(16, 16)
----------------------------------------------
--- LOOTSPEC FRAME
----------------------------------------------
-local lootSpecFrame = CreateFrame("BUTTON",'SX_LootSpecFrame', talentFrame)
-if cfg.core.position ~= "BOTTOM" then
- lootSpecFrame:SetPoint("TOP", talentFrame, "BOTTOM", 0,-6)
-else
- lootSpecFrame:SetPoint("BOTTOM", talentFrame, "TOP", 0,8)
+local AddOnName, XIVBar = ...;
+local _G = _G;
+local xb = XIVBar;
+local L = XIVBar.L;
+
+local TalentModule = xb:NewModule("TalentModule", 'AceEvent-3.0')
+
+function TalentModule:GetName()
+ return TALENTS;
+end
+
+function TalentModule:OnInitialize()
+ self.currentSpecID = 0
+ self.currentLootSpecID = 0
+ self.specCoords = {
+ [1] = { 0.00, 0.25, 0, 1 },
+ [2] = { 0.25, 0.50, 0, 1 },
+ [3] = { 0.50, 0.75, 0, 1 },
+ [4] = { 0.75, 1.00, 0, 1 }
+ }
+ self.extraPadding = (xb.constants.popupPadding * 3)
+ self.optionTextExtra = 4
+ self.specButtons = {}
+ self.lootSpecButtons = {}
+ self.classIcon = xb.constants.mediaPath..'spec\\'..xb.constants.playerClass
+end
+
+function TalentModule:OnEnable()
+ if self.talentFrame == nil then
+ self.talentFrame = CreateFrame("FRAME", nil, xb:GetFrame('bar'))
+ xb:RegisterFrame('talentFrame', self.talentFrame)
+ end
+ self.talentFrame:Show()
+
+ self.currentSpecID = GetSpecialization()
+ self.currentLootSpecID = GetLootSpecialization()
+
+ self:CreateFrames()
+ self:RegisterFrameEvents()
+ self:Refresh()
+end
+
+function TalentModule:OnDisable()
+ self.talentFrame:Hide()
+ self:UnregisterEvent('TRADE_SKILL_UPDATE')
+ self:UnregisterEvent('SPELLS_CHANGED')
+ self:UnregisterEvent('UNIT_SPELLCAST_STOP')
+end
+
+function TalentModule:Refresh()
+ if InCombatLockdown() then return; end
+
+ local db = xb.db.profile
+ if self.talentFrame == nil then return; end
+ if not db.modules.talent.enabled then return; end
+
+ self.currentSpecID = GetSpecialization()
+ self.currentLootSpecID = GetLootSpecialization()
+
+ local iconSize = db.text.fontSize + db.general.barPadding
+ local _, name, _ = GetSpecializationInfo(self.currentSpecID)
+
+
+ --local textHeight = floor((xb:GetHeight() - 4) / 2) -- This will be useful once we add artifact info
+ local textHeight = db.text.fontSize
+ self.specIcon:SetTexture(self.classIcon)
+ self.specIcon:SetTexCoord(unpack(self.specCoords[self.currentSpecID]))
+
+ self.specIcon:SetSize(iconSize, iconSize)
+ self.specIcon:SetPoint('LEFT')
+ self.specIcon:SetVertexColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+
+ self.specText:SetFont(xb:GetFont(textHeight))
+ self.specText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ self.specText:SetText(string.upper(name))
+
+ self.specText:SetPoint('LEFT', self.specIcon, 'RIGHT', 5, 0)
+
+ self.lootSpecButtons[0].icon:SetTexture(self.classIcon)
+ self.lootSpecButtons[0].icon:SetTexCoord(unpack(self.specCoords[self.currentSpecID]))
+ --[[
+ if skill == cap then
+ self.specText:SetPoint('LEFT', self.specIcon, 'RIGHT', 5, 0)
+ else
+ self.specText:SetPoint('TOPLEFT', self.specIcon, 'TOPRIGHT', 5, 0)
+ self.specBar:SetStatusBarTexture(1, 1, 1)
+ if db.modules.tradeskill.barCC then
+ self.specBar:SetStatusBarColor(xb:GetClassColors())
+ else
+ self.specBar:SetStatusBarColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+ end
+ self.specBar:SetSize(self.specText:GetStringWidth(), (iconSize - textHeight - 2))
+ self.specBar:SetPoint('BOTTOMLEFT', self.specIcon, 'BOTTOMRIGHT', 5, 0)
+
+ self.specBarBg:SetAllPoints()
+ self.specBarBg:SetColorTexture(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ end]]--
+ self.specFrame:SetSize(iconSize + self.specText:GetStringWidth() + 5, xb:GetHeight())
+ self.specFrame:SetPoint('LEFT')
+
+ self.talentFrame:SetSize(self.specFrame:GetWidth(), xb:GetHeight())
+
+ self.specPopup:SetPoint('BOTTOM', self.specFrame, 'TOP', 0, xb.constants.popupPadding)
+ self.specPopupTexture:SetColorTexture(db.color.barColor.r, db.color.barColor.g, db.color.barColor.b, db.color.barColor.a)
+ self.specPopupTexture:SetAllPoints()
+ self.specPopup:Hide()
+
+ self.lootSpecPopup:SetPoint('BOTTOM', self.specFrame, 'TOP', 0, xb.constants.popupPadding)
+ self.lootSpecPopupTexture:SetColorTexture(db.color.barColor.r, db.color.barColor.g, db.color.barColor.b, db.color.barColor.a)
+ self.lootSpecPopupTexture:SetAllPoints()
+ self.lootSpecPopup:Hide()
+
+ local relativeAnchorPoint = 'LEFT'
+ local xOffset = db.general.moduleSpacing
+ if not xb:GetFrame('clockFrame'):IsVisible() then
+ relativeAnchorPoint = 'RIGHT'
+ xOffset = 0
+ end
+ self.talentFrame:SetPoint('RIGHT', xb:GetFrame('clockFrame'), relativeAnchorPoint, -(xOffset), 0)
end
-lootSpecFrame:RegisterForClicks("AnyUp")
-lootSpecFrame:Hide()
-lootSpecFrame:EnableMouse(true)
-
-lootSpecFrame:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "RightButton" then
- lootSpecFrame:Hide()
- end
-end)
-
-local lootSpecText = lootSpecFrame:CreateFontString(nil, "OVERLAY")
-lootSpecText:SetFont(cfg.text.font, cfg.text.normalFontSize)
-lootSpecText:SetPoint("TOP")
-lootSpecText:SetText("LOOT SPECIALIZATION")
-lootSpecText:SetTextColor(unpack(cfg.color.normal))
-
-local defaultLootTypeButton = CreateFrame("BUTTON",nil, lootSpecFrame)
-defaultLootTypeButton:SetSize(lootSpecText:GetStringWidth(),cfg.text.normalFontSize)
-defaultLootTypeButton:SetPoint("CENTER",lootSpecText)
-defaultLootTypeButton:EnableMouse(true)
-defaultLootTypeButton:RegisterForClicks("AnyUp")
-
-defaultLootTypeButton:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "LeftButton" then
- if GetLootSpecialization() ~= 0 then
- SetLootSpecialization(0)
- print("|cffffff00Loot Specialization set to: Current Specialization")
- lootSpecFrame:Hide()
- end
- elseif button == "RightButton" then
- lootSpecFrame:Hide()
- end
-end)
-
-local lootSpectBG = lootSpecFrame:CreateTexture(nil,"OVERLAY",nil,7)
-lootSpectBG:SetPoint("TOP")
-lootSpectBG:SetColorTexture(unpack(cfg.color.barcolor))
-globalLootSpecFrame = lootSpecFrame
-
----------------------------------------------
--- SPEC CHANGE FRAME
----------------------------------------------
-local specFrame = CreateFrame("BUTTON",'SX_SpecFrame', talentFrame)
-if cfg.core.position ~= "BOTTOM" then
- specFrame:SetPoint("TOP", talentFrame, "BOTTOM", 0,-6)
-else
- specFrame:SetPoint("BOTTOM", talentFrame, "TOP", 0,8)
+
+function TalentModule:CreateFrames()
+ self.specFrame = self.specFrame or CreateFrame("BUTTON", nil, self.talentFrame, 'SecureActionButtonTemplate')
+ self.specIcon = self.specIcon or self.specFrame:CreateTexture(nil, 'OVERLAY')
+ self.specText = self.specText or self.specFrame:CreateFontString(nil, 'OVERLAY')
+ self.specBar = self.specBar or CreateFrame('STATUSBAR', nil, self.specFrame)
+ self.specBarBg = self.specBarBg or self.specBar:CreateTexture(nil, 'BACKGROUND')
+
+ self.specPopup = self.specPopup or CreateFrame('BUTTON', nil, self.specFrame)
+ self.specPopupTexture = self.specPopupTexture or self.specPopup:CreateTexture(nil, 'BACKGROUND')
+ self.lootSpecPopup = self.lootSpecPopup or CreateFrame('BUTTON', nil, self.specFrame)
+ self.lootSpecPopupTexture = self.lootSpecPopupTexture or self.lootSpecPopup:CreateTexture(nil, 'BACKGROUND')
+ self:CreateSpecPopup()
+ self:CreateLootSpecPopup()
end
-specFrame:RegisterForClicks("AnyUp")
-specFrame:Hide()
-specFrame:EnableMouse(true)
-
-specFrame:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "RightButton" then
- specFrame:Hide()
- end
-end)
-
-local specText = specFrame:CreateFontString(nil, "OVERLAY")
-specText:SetFont(cfg.text.font, cfg.text.normalFontSize)
-specText:SetPoint("TOP")
-specText:SetText("SET SPECIALIZATION")
-specText:SetTextColor(unpack(cfg.color.normal))
-
-local specBG = specFrame:CreateTexture(nil,"OVERLAY",nil,7)
-specBG:SetPoint("TOP")
-specBG:SetColorTexture(unpack(cfg.color.barcolor))
-globalSpecFrame = specFrame
-
----------------------------------------------
--- PRIMARY SPEC FRAME
----------------------------------------------
-
-local primarySpecFrame = CreateFrame("BUTTON",nil, talentFrame)
-primarySpecFrame:SetPoint("RIGHT")
-primarySpecFrame:SetSize(16, 16)
-primarySpecFrame:EnableMouse(true)
-primarySpecFrame:RegisterForClicks("AnyUp")
-
-local primarySpecText = primarySpecFrame:CreateFontString(nil, "OVERLAY")
-primarySpecText:SetFont(cfg.text.font, cfg.text.normalFontSize)
-primarySpecText:SetPoint("RIGHT")
-primarySpecText:SetTextColor(unpack(cfg.color.normal))
-
-local primarySpecIcon = primarySpecFrame:CreateTexture(nil,"OVERLAY",nil,7)
-primarySpecIcon:SetSize(16, 16)
-primarySpecIcon:SetPoint("RIGHT", primarySpecText,"LEFT",-2,0)
-primarySpecIcon:SetVertexColor(unpack(cfg.color.normal))
-
-primarySpecFrame:SetScript("OnEnter", function()
- if InCombatLockdown() then return end
- GameTooltip:SetOwner(talentFrame, cfg.tooltipPos)
- currentSpec = GetSpecialization()
- currentSpecID, currentSpecName = GetSpecializationInfo(currentSpec)
- lootspecid = GetLootSpecialization()
- if lootspecid == 0 then lootspecid = currentSpecID end
- id, name = GetSpecializationInfoByID(lootspecid)
- GameTooltip:AddLine("|cffffffffLoot is currently set to |cffffff00"..name.."|cffffffff spec")
- GameTooltip:AddDoubleLine("<Left-Click>", "Change spec", 1, 1, 0, 1, 1, 1)
- GameTooltip:AddDoubleLine("<Right-Click>", "Change lootspec", 1, 1, 0, 1, 1, 1)
- primarySpecIcon:SetVertexColor(unpack(cfg.color.hover))
- GameTooltip:Show()
-end)
-
-primarySpecFrame:SetScript("OnLeave", function()
- if GetActiveSpecGroup() == 1 then
- primarySpecIcon:SetVertexColor(unpack(cfg.color.normal))
- else
- primarySpecIcon:SetVertexColor(unpack(cfg.color.inactive))
- end
- if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end
-end)
-
-primarySpecFrame:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "LeftButton" then
- if globalSpecFrame:IsShown() then
- globalSpecFrame:Hide()
- else
- if globalLootSpecFrame:IsShown() then
- globalLootSpecFrame:Hide()
- end
- globalSpecFrame:Show()
- end
- elseif button == "RightButton" then
- if globalLootSpecFrame:IsShown() then
- globalLootSpecFrame:Hide()
- else
- if globalSpecFrame:IsShown() then
- globalSpecFrame:Hide()
- end
- globalLootSpecFrame:Show()
- end
- end
-end)
----------------------------------------------------------------------
-
-local function createLootSpecButtons()
-for index = 1,4 do
- local id, name = GetSpecializationInfo(index)
- if ( name ) then
- lootSpecFrame:SetSize(lootSpecText:GetStringWidth()+16, (index+1)*18)
- lootSpectBG:SetSize(lootSpecFrame:GetSize())
- currentSpecID, currentSpecName = GetSpecializationInfo(index)
-
- local lootSpecButton = CreateFrame("BUTTON",nil, lootSpecFrame)
- lootSpecButton:SetPoint("TOPLEFT", lootSpecText, 0, index*-18)
- lootSpecButton:SetSize(16, 16)
- lootSpecButton:EnableMouse(true)
- lootSpecButton:RegisterForClicks("AnyUp")
-
-
- local lootSpecbuttonText = lootSpecButton:CreateFontString(nil, "OVERLAY")
- lootSpecbuttonText:SetFont(cfg.text.font, cfg.text.smallFontSize)
- lootSpecbuttonText:SetPoint("RIGHT")
- if currentSpecName then currentSpecName = string.upper(currentSpecName) end
- lootSpecbuttonText:SetText(currentSpecName)
-
- local lootSpecbuttonIcon = lootSpecButton:CreateTexture(nil,"OVERLAY",nil,7)
- lootSpecbuttonIcon:SetSize(16, 16)
- lootSpecbuttonIcon:SetPoint("LEFT")
- lootSpecbuttonIcon:SetTexture(cfg.mediaFolder.."spec\\"..cfg.CLASS)
- lootSpecbuttonIcon:SetTexCoord(unpack(cfg.specCoords[index]))
-
- local id = GetSpecializationInfo(index)
- if GetLootSpecialization() == id then
- lootSpecbuttonText:SetTextColor(unpack(cfg.color.normal))
- lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.normal))
- else
- lootSpecbuttonText:SetTextColor(unpack(cfg.color.inactive))
- lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.inactive))
- end
- lootSpecButton:SetSize(lootSpecbuttonText:GetStringWidth()+18,16)
-
- lootSpecButton:SetScript("OnEnter", function() if InCombatLockdown() then return end lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.hover)) end)
- lootSpecButton:SetScript("OnLeave", function()
- local id = GetSpecializationInfo(index)
- if GetLootSpecialization() == id then
- lootSpecbuttonText:SetTextColor(unpack(cfg.color.normal))
- lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.normal))
- else
- lootSpecbuttonText:SetTextColor(unpack(cfg.color.inactive))
- lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.inactive))
- end
- end)
-
- lootSpecButton:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "LeftButton" then
- if IsShiftKeyDown() then
- SetSpecialization(index)
- else
- local id = GetSpecializationInfo(index)
- SetLootSpecialization(id)
- lootSpecbuttonText:SetTextColor(unpack(cfg.color.normal))
- lootSpecbuttonIcon:SetVertexColor(unpack(cfg.color.normal))
- end
- lootSpecFrame:Hide()
- elseif button == "RightButton" then
- lootSpecFrame:Hide()
- end
- end)
- end
+
+function TalentModule:RegisterFrameEvents()
+
+ self:RegisterEvent('PLAYER_SPECIALIZATION_CHANGED', 'Refresh')
+ self:RegisterEvent('ACTIVE_TALENT_GROUP_CHANGED', 'Refresh')
+
+ self.specFrame:EnableMouse(true)
+ self.specFrame:RegisterForClicks('AnyUp')
+
+ self.specFrame:SetScript('OnEnter', function()
+ if InCombatLockdown() then return; end
+ self.specText:SetTextColor(unpack(xb:HoverColors()))
+ if xb.db.profile.modules.tradeskill.showTooltip then
+ self:ShowTooltip()
+ end
+ end)
+ self.specFrame:SetScript('OnLeave', function()
+ if InCombatLockdown() then return; end
+ local db = xb.db.profile
+ self.specText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ if xb.db.profile.modules.tradeskill.showTooltip then
+ GameTooltip:Hide()
+ end
+ end)
+ self.specFrame:SetScript('OnClick', function(_, button)
+ if button == 'LeftButton' then
+ if not InCombatLockdown() then
+ if self.specPopup:IsVisible() then
+ self.specPopup:Hide()
+ else
+ self.lootSpecPopup:Hide()
+ self.specPopup:Show()
+ end
+ end
+ end
+
+ if button == 'RightButton' then
+ if not InCombatLockdown() then
+ if self.lootSpecPopup:IsVisible() then
+ self.lootSpecPopup:Hide()
+ else
+ self.specPopup:Hide()
+ self.lootSpecPopup:Show()
+ end
+ end
+ end
+ end)
+
+ --[[
+ self.talentFrame:RegisterUnitEvent('UNIT_SPELLCAST_STOP', 'player')
+ self.talentFrame:SetScript('OnEvent', function(_, event)
+ if event == 'UNIT_SPELLCAST_STOP' then
+ self:Refresh()
+ end
+ end)
+
+
+ self.firstProfFrame:SetAttribute('*type1', 'spell')
+ self.firstProfFrame:SetAttribute('unit', 'player')
+
+ self.secondProfFrame:EnableMouse(true)
+ self.secondProfFrame:RegisterForClicks('AnyUp')
+
+ self.secondProfFrame:SetScript('OnEnter', function()
+ if InCombatLockdown() then return; end
+ self.secondProfText:SetTextColor(unpack(xb:HoverColors()))
+ if xb.db.profile.modules.tradeskill.showTooltip then
+ self:ShowTooltip()
+ end
+ end)
+ self.secondProfFrame:SetScript('OnLeave', function()
+ if InCombatLockdown() then return; end
+ local db = xb.db.profile
+ self.secondProfText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ if xb.db.profile.modules.tradeskill.showTooltip then
+ GameTooltip:Hide()
+ end
+ end)
+ self.secondProfFrame:SetAttribute('*type1', 'spell')
+ self.secondProfFrame:SetAttribute('unit', 'player')
+
+ self.talentFrame:EnableMouse(true)
+ self.talentFrame:SetScript('OnEnter', function()
+ if xb.db.profile.modules.tradeskill.showTooltip then
+ self:ShowTooltip()
+ end
+ end)
+ self.talentFrame:SetScript('OnLeave', function()
+ if xb.db.profile.modules.tradeskill.showTooltip then
+ GameTooltip:Hide()
+ end
+ end)]]--
+
+ self:RegisterMessage('XIVBar_FrameHide', function(_, name)
+ if name == 'clockFrame' then
+ self:Refresh()
+ end
+ end)
+
+ self:RegisterMessage('XIVBar_FrameShow', function(_, name)
+ if name == 'clockFrame' then
+ self:Refresh()
+ end
+ end)
end
+
+function TalentModule:CreateSpecPopup()
+ if not self.specPopup then return; end
+
+ local db = xb.db.profile
+ local iconSize = db.text.fontSize + db.general.barPadding
+ self.specOptionString = self.specOptionString or self.specPopup:CreateFontString(nil, 'OVERLAY')
+ self.specOptionString:SetFont(xb:GetFont(db.text.fontSize + self.optionTextExtra))
+ self.specOptionString:SetTextColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+ self.specOptionString:SetText(L['Set Specialization'])
+ self.specOptionString:SetPoint('TOP', 0, -(xb.constants.popupPadding))
+ self.specOptionString:SetPoint('CENTER')
+
+ local popupWidth = self.specPopup:GetWidth()
+ local popupHeight = xb.constants.popupPadding + db.text.fontSize + self.optionTextExtra
+ local changedWidth = false
+ for i = 1, GetNumSpecializations() do
+ if self.specButtons[i] == nil then
+
+ local _, name, _ = GetSpecializationInfo(i)
+ local button = CreateFrame('BUTTON', nil, self.specPopup)
+ local buttonText = button:CreateFontString(nil, 'OVERLAY')
+ local buttonIcon = button:CreateTexture(nil, 'OVERLAY')
+
+ buttonIcon:SetTexture(self.classIcon)
+ buttonIcon:SetTexCoord(unpack(self.specCoords[i]))
+ buttonIcon:SetSize(iconSize, iconSize)
+ buttonIcon:SetPoint('LEFT')
+ buttonIcon:SetVertexColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+
+ buttonText:SetFont(xb:GetFont(db.text.fontSize))
+ buttonText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ buttonText:SetText(name)
+ buttonText:SetPoint('LEFT', buttonIcon, 'RIGHT', 5, 0)
+ local textWidth = iconSize + 5 + buttonText:GetStringWidth()
+
+ button:SetID(i)
+ button:SetSize(textWidth, iconSize)
+ button.isSettable = true
+
+ button:EnableMouse(true)
+ button:RegisterForClicks('AnyUp')
+
+ button:SetScript('OnEnter', function()
+ buttonText:SetTextColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+ end)
+
+ button:SetScript('OnLeave', function()
+ buttonText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ end)
+
+ button:SetScript('OnClick', function(self, button)
+ if InCombatLockdown() then return; end
+ if button == 'LeftButton' then
+ SetSpecialization(self:GetID())
+ end
+ TalentModule.specPopup:Hide()
+ end)
+
+ self.specButtons[i] = button
+
+ if textWidth > popupWidth then
+ popupWidth = textWidth
+ changedWidth = true
+ end
+ end -- if nil
+ end -- for ipairs portOptions
+ for portId, button in pairs(self.specButtons) do
+ if button.isSettable then
+ button:SetPoint('LEFT', xb.constants.popupPadding, 0)
+ button:SetPoint('TOP', 0, -(popupHeight + xb.constants.popupPadding))
+ button:SetPoint('RIGHT')
+ popupHeight = popupHeight + xb.constants.popupPadding + db.text.fontSize
+ else
+ button:Hide()
+ end
+ end -- for id/button in portButtons
+ if changedWidth then
+ popupWidth = popupWidth + self.extraPadding
+ end
+
+ if popupWidth < self.specFrame:GetWidth() then
+ popupWidth = self.specFrame:GetWidth()
+ end
+
+ if popupWidth < (self.specOptionString:GetStringWidth() + self.extraPadding) then
+ popupWidth = (self.specOptionString:GetStringWidth() + self.extraPadding)
+ end
+ self.specPopup:SetSize(popupWidth, popupHeight + xb.constants.popupPadding)
end
----------------------------------------------------------------------
-
-local function createSpecButtons()
- local curSpec = GetSpecialization()
- for index = 1,GetNumSpecializations() do
- local id, name = GetSpecializationInfo(index)
- if ( name ) then
- specFrame:SetSize(specText:GetStringWidth()+16, (index+1)*18)
- specBG:SetSize(specFrame:GetSize())
- currentSpecID, currentSpecName = GetSpecializationInfo(index)
-
- local specButton = CreateFrame("BUTTON",nil, specFrame)
- specButton:SetPoint("TOPLEFT", specText, 0, index*-18)
- specButton:SetSize(16, 16)
- specButton:EnableMouse(true)
- specButton:RegisterForClicks("AnyUp")
-
- local specButtonText = specButton:CreateFontString(nil, "OVERLAY")
- specButtonText:SetFont(cfg.text.font, cfg.text.smallFontSize)
- specButtonText:SetPoint("RIGHT")
- if currentSpecName then currentSpecName = string.upper(currentSpecName) end
- specButtonText:SetText(currentSpecName)
-
- local specButtonIcon = specButton:CreateTexture(nil,"OVERLAY",nil,7)
- specButtonIcon:SetSize(16, 16)
- specButtonIcon:SetPoint("LEFT")
- specButtonIcon:SetTexture(cfg.mediaFolder.."spec\\"..cfg.CLASS)
- specButtonIcon:SetTexCoord(unpack(cfg.specCoords[index]))
-
- --local id = GetSpecializationInfo(index)
- if GetSpecialization() == index then
- specButtonText:SetTextColor(unpack(cfg.color.normal))
- specButtonIcon:SetVertexColor(unpack(cfg.color.normal))
- else
- specButtonText:SetTextColor(unpack(cfg.color.inactive))
- specButtonIcon:SetVertexColor(unpack(cfg.color.inactive))
- end
- specButton:SetSize(specButtonText:GetStringWidth()+18,16)
-
- specButton:SetScript("OnEnter", function() if InCombatLockdown() then return end specButtonIcon:SetVertexColor(unpack(cfg.color.hover)) end)
- specButton:SetScript("OnLeave", function()
- local id = GetSpecializationInfo(index)
- if GetSpecialization() == id then
- specButtonText:SetTextColor(unpack(cfg.color.normal))
- specButtonIcon:SetVertexColor(unpack(cfg.color.normal))
- else
- specButtonText:SetTextColor(unpack(cfg.color.inactive))
- specButtonIcon:SetVertexColor(unpack(cfg.color.inactive))
- end
- end)
-
- specButton:SetScript("OnClick", function(self, button, down)
- if InCombatLockdown() then return end
- if button == "LeftButton" then
- SetSpecialization(index)
- specFrame:Hide()
- elseif button == "RightButton" then
- specFrame:Hide()
- end
- end)
- end
- end
+function TalentModule:CreateLootSpecPopup()
+ if not self.lootSpecPopup then return; end
+
+ local db = xb.db.profile
+ local iconSize = db.text.fontSize + db.general.barPadding
+ self.lootSpecOptionString = self.lootSpecOptionString or self.lootSpecPopup:CreateFontString(nil, 'OVERLAY')
+ self.lootSpecOptionString:SetFont(xb:GetFont(db.text.fontSize + self.optionTextExtra))
+ self.lootSpecOptionString:SetTextColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+ self.lootSpecOptionString:SetText(L['Set Loot Specialization'])
+ self.lootSpecOptionString:SetPoint('TOP', 0, -(xb.constants.popupPadding))
+ self.lootSpecOptionString:SetPoint('CENTER')
+
+ local popupWidth = self.lootSpecPopup:GetWidth()
+ local popupHeight = xb.constants.popupPadding + db.text.fontSize + self.optionTextExtra
+ local changedWidth = false
+ for i = 0, GetNumSpecializations() do
+ if self.lootSpecButtons[i] == nil then
+ local specId = i
+ local name = ''
+ if i == 0 then
+ name = L['Current Specialization'];
+ specId = self.currentSpecID
+ else
+ _, name, _ = GetSpecializationInfo(i)
+ end
+ local button = CreateFrame('BUTTON', nil, self.lootSpecPopup)
+ local buttonText = button:CreateFontString(nil, 'OVERLAY')
+ local buttonIcon = button:CreateTexture(nil, 'OVERLAY')
+
+ buttonIcon:SetTexture(self.classIcon)
+ buttonIcon:SetTexCoord(unpack(self.specCoords[specId]))
+ buttonIcon:SetSize(iconSize, iconSize)
+ buttonIcon:SetPoint('LEFT')
+ buttonIcon:SetVertexColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+
+ buttonText:SetFont(xb:GetFont(db.text.fontSize))
+ buttonText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ buttonText:SetText(name)
+ buttonText:SetPoint('LEFT', buttonIcon, 'RIGHT', 5, 0)
+ local textWidth = iconSize + 5 + buttonText:GetStringWidth()
+
+ button:SetID(i)
+ button:SetSize(textWidth, iconSize)
+ button.isSettable = true
+ button.text = buttonText
+ button.icon = buttonIcon
+
+ button:EnableMouse(true)
+ button:RegisterForClicks('AnyUp')
+
+ button:SetScript('OnEnter', function()
+ buttonText:SetTextColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a)
+ end)
+
+ button:SetScript('OnLeave', function()
+ buttonText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a)
+ end)
+
+ button:SetScript('OnClick', function(self, button)
+ if InCombatLockdown() then return; end
+ if button == 'LeftButton' then
+ local id = 0
+ if self:GetID() ~= 0 then
+ id = GetSpecializationInfo(self:GetID())
+ end
+ SetLootSpecialization(id)
+ end
+ TalentModule.lootSpecPopup:Hide()
+ end)
+
+ self.lootSpecButtons[i] = button
+
+ if textWidth > popupWidth then
+ popupWidth = textWidth
+ changedWidth = true
+ end
+ end -- if nil
+ end -- for ipairs portOptions
+ for portId, button in pairs(self.lootSpecButtons) do
+ if button.isSettable then
+ button:SetPoint('LEFT', xb.constants.popupPadding, 0)
+ button:SetPoint('TOP', 0, -(popupHeight + xb.constants.popupPadding))
+ button:SetPoint('RIGHT')
+ popupHeight = popupHeight + xb.constants.popupPadding + db.text.fontSize
+ else
+ button:Hide()
+ end
+ end -- for id/button in portButtons
+ if changedWidth then
+ popupWidth = popupWidth + self.extraPadding
+ end
+
+ if popupWidth < self.specFrame:GetWidth() then
+ popupWidth = self.specFrame:GetWidth()
+ end
+
+ if popupWidth < (self.lootSpecOptionString:GetStringWidth() + self.extraPadding) then
+ popupWidth = (self.lootSpecOptionString:GetStringWidth() + self.extraPadding)
+ end
+ self.lootSpecPopup:SetSize(popupWidth, popupHeight + xb.constants.popupPadding)
end
----------------------------------------------
--- EVENTS
----------------------------------------------
-
-local eventframe = CreateFrame("Frame")
-eventframe:RegisterEvent("PLAYER_ENTERING_WORLD")
-eventframe:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
-eventframe:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
-eventframe:RegisterEvent("PLAYER_LOOT_SPEC_UPDATED")
-eventframe:RegisterEvent("PLAYER_REGEN_DISABLED")
-
-eventframe:SetScript("OnEvent", function(self,event, ...)
- if event == ("PLAYER_ENTERING_WORLD") then
- createSpecButtons()
- createLootSpecButtons()
- end
- if event == ("PLAYER_REGEN_DISABLED") then
- if lootSpecFrame:IsShown() then
- lootSpecFrame:Hide()
- end
- if specFrame:IsShown() then
- specFrame:Hide()
- end
- end
-
- local primarySpec = GetSpecialization(false, false, 1)
- if primarySpec ~= nil then
- local id, name = GetSpecializationInfo(primarySpec)
- if name then name = string.upper(name) end
- --name = string.upper(name)
- primarySpecText:SetText(name)
- primarySpecIcon:SetTexture(cfg.mediaFolder.."spec\\"..cfg.CLASS)
- primarySpecIcon:SetTexCoord(unpack(cfg.specCoords[primarySpec]))
- primarySpecFrame:SetSize(primarySpecText:GetStringWidth()+18, 16)
- primarySpecFrame:Show()
- primarySpecFrame:EnableMouse(true)
- else
- primarySpecFrame:Hide()
- primarySpecFrame:EnableMouse(false)
- end
- primarySpecIcon:SetVertexColor(unpack(cfg.color.normal))
- primarySpecText:SetTextColor(unpack(cfg.color.normal))
- talentFrame:SetSize((primarySpecFrame:GetWidth()), 16)
-end)
+function TalentModule:ShowTooltip()
+ return
+ --[[
+ GameTooltip:SetOwner(self.talentFrame, 'ANCHOR_'..xb.miniTextPosition)
+ GameTooltip:AddLine("[|cff6699FF"..L['Cooldowns'].."|r]")
+ GameTooltip:AddLine(" ")
+
+ local recipeIds = C_TradeSkillUI.GetAllRecipeIDs()
+
+ GameTooltip:AddLine(" ")
+ GameTooltip:AddDoubleLine('<'..L['Left-Click']..'>', L['Toggle Currency Frame'], 1, 1, 0, 1, 1, 1)
+ GameTooltip:Show()]]--
+end
+
+function TalentModule:GetDefaultOptions()
+ return 'talent', {
+ enabled = true,
+ barCC = false,
+ showTooltip = true
+ }
+end
+
+function TalentModule:GetConfig()
+ return {
+ name = self:GetName(),
+ type = "group",
+ args = {
+ enable = {
+ name = ENABLE,
+ order = 0,
+ type = "toggle",
+ get = function() return xb.db.profile.modules.talent.enabled; end,
+ set = function(_, val)
+ xb.db.profile.modules.talent.enabled = val
+ if val then
+ self:Enable()
+ else
+ self:Disable()
+ end
+ end,
+ width = "full"
+ },
+ barCC = {
+ name = L['Use Class Colors'],
+ order = 2,
+ type = "toggle",
+ get = function() return xb.db.profile.modules.talent.barCC; end,
+ set = function(_, val) xb.db.profile.modules.talent.barCC = val; self:Refresh(); end
+ },
+ showTooltip = {
+ name = L['Show Tooltips'],
+ order = 3,
+ type = "toggle",
+ get = function() return xb.db.profile.modules.talent.showTooltip; end,
+ set = function(_, val) xb.db.profile.modules.talent.showTooltip = val; self:Refresh(); end
+ }
+ }
+ }
+end