diff --git a/modules/micromenu.lua b/modules/micromenu.lua index 9082208..dc3f017 100644 --- a/modules/micromenu.lua +++ b/modules/micromenu.lua @@ -101,7 +101,7 @@ function MenuModule:Refresh() if name == 'menu' then frame:SetPoint("LEFT", xb.db.profile.modules.microMenu.iconSpacing, 0) totalWidth = totalWidth + frame:GetWidth() + xb.db.profile.modules.microMenu.iconSpacing - elseif name == 'chat' then + elseif frame:GetParent():GetName() == 'menu' then frame:SetPoint("LEFT", frame:GetParent(), "RIGHT", xb.db.profile.modules.microMenu.mainMenuSpacing, 0) totalWidth = totalWidth + frame:GetWidth() + xb.db.profile.modules.microMenu.mainMenuSpacing else diff --git a/modules/old/armor.lua b/modules/old/armor.lua deleted file mode 100644 index e211304..0000000 --- a/modules/old/armor.lua +++ /dev/null @@ -1,72 +0,0 @@ -local addon, ns = ... -local cfg = ns.cfg -local unpack = unpack --------------------------------------------------------------- -if not cfg.armor.show then return end - -local armorFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -armorFrame:SetPoint("LEFT",590,0) -armorFrame:EnableMouse(true) -armorFrame:RegisterForClicks("AnyUp") - -local armorIcon = armorFrame:CreateTexture(nil,"OVERLAY",nil,7) -armorIcon:SetPoint("LEFT") -armorIcon:SetTexture(cfg.mediaFolder.."datatexts\\repair") -armorIcon:SetVertexColor(unpack(cfg.color.inactive)) - -local armorText = armorFrame:CreateFontString(nil, "OVERLAY") -armorText:SetFont(cfg.text.font, cfg.text.normalFontSize) -armorText:SetPoint("RIGHT", armorFrame,2,0) -armorText:SetTextColor(unpack(cfg.color.normal)) - -armorFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - armorIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -armorFrame:SetScript("OnLeave", function() - local durMin = 100 - for i = 1, 18 do - local durCur, durMax = GetInventoryItemDurability(i) - if ( durCur ~= durMax ) then durMin = min(durMin, durCur*(100/durMax)) end - end - if durMin >= cfg.armor.minArmor then - armorIcon:SetVertexColor(unpack(cfg.color.inactive)) - else - armorIcon:SetVertexColor(unpack(cfg.color.normal)) - end -end) - -armorFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - - end -end) - -local eventframe = CreateFrame("Frame") -eventframe:RegisterEvent("PLAYER_ENTERING_WORLD") -eventframe:RegisterEvent("UPDATE_INVENTORY_DURABILITY") - -eventframe:SetScript("OnEvent", function(self,event, ...) - local durMin, durCol - durMin, durCol = 100, "ffffff" - for i = 1, 18 do - local durCur, durMax = GetInventoryItemDurability(i) - if ( durCur ~= durMax ) then durMin = min(durMin, durCur*(100/durMax)) end - end - - if durMin >= cfg.armor.maxArmor then - local overallilvl, equippedilvl = GetAverageItemLevel() - armorText:SetText(floor(equippedilvl).." ilvl") - else - armorText:SetText(floor(durMin).."% - "..floor(select(2,GetAverageItemLevel())).." ilvl") - end - - if durMin >= cfg.armor.minArmor then - armorIcon:SetVertexColor(unpack(cfg.color.inactive)) - else - armorIcon:SetVertexColor(unpack(cfg.color.normal)) - end - armorFrame:SetSize(armorText:GetStringWidth()+18, 16) -end) \ No newline at end of file diff --git a/modules/old/clock.lua b/modules/old/clock.lua deleted file mode 100644 index 80c17a3..0000000 --- a/modules/old/clock.lua +++ /dev/null @@ -1,110 +0,0 @@ -local addon, ns = ... -local cfg = ns.cfg -local unpack = unpack --------------------------------------------------------------- -if not cfg.clock.show then return end - -local hour, minu = 0,0 -local AmPmTimeText = "" - -local clockFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -clockFrame:SetSize(32, 32) -clockFrame:SetPoint("CENTER") -clockFrame:EnableMouse(true) -clockFrame:RegisterForClicks("AnyUp") - -local clockText = clockFrame:CreateFontString(nil, "OVERLAY") -clockText:SetFont(cfg.text.font, cfg.SXframe:GetHeight()-4) -clockText:SetPoint("LEFT") -clockText:SetTextColor(unpack(cfg.color.normal)) - -local amText = clockFrame:CreateFontString(nil, "OVERLAY") -amText:SetFont(cfg.text.font, cfg.text.normalFontSize) -amText:SetPoint("RIGHT") -amText:SetTextColor(unpack(cfg.color.inactive)) - -local calendarText = clockFrame:CreateFontString(nil, "OVERLAY") -calendarText:SetFont(cfg.text.font, cfg.text.smallFontSize) -calendarText:SetPoint("CENTER", clockFrame, "TOP") -if cfg.core.position ~= "BOTTOM" then - calendarText:SetPoint("CENTER", clockFrame, "BOTTOM") -end -calendarText:SetTextColor(unpack(cfg.color.normal)) - -local elapsed = 0 -clockFrame:SetScript('OnUpdate', function(self, e) - elapsed = elapsed + e - if elapsed >= 1 then - hour, minu = GetGameTime() - if minu < 10 then minu = ("0"..minu) end - if ( GetCVarBool("timeMgrUseLocalTime") ) then - if ( GetCVarBool("timeMgrUseMilitaryTime") ) then - clockText:SetText(date("%H:%M")) - amText:SetText("") - else - clockText:SetText(date("%I:%M")) - amText:SetText(date("%p")) - end - else - if ( GetCVarBool("timeMgrUseMilitaryTime") ) then - clockText:SetText(hour..":"..minu) - amText:SetText("") - else - if hour > 12 then - hour = hour - 12 - hour = ("0"..hour) - AmPmTimeText = "PM" - else - AmPmTimeText = "AM" - end - clockText:SetText(hour..":"..minu) - amText:SetText(AmPmTimeText) - end - - end - if (CalendarGetNumPendingInvites() > 0) then - calendarText:SetText(string.format("%s (|cffffff00%i|r)", "New Event!", (CalendarGetNumPendingInvites()))) - else - calendarText:SetText("") - end - clockFrame:SetWidth(clockText:GetStringWidth() + amText:GetStringWidth()) - clockFrame:SetPoint("CENTER", cfg.SXframe) - elapsed = 0 - end -end) - ---[[ - ---]] - -clockFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - clockText:SetTextColor(unpack(cfg.color.hover)) - if cfg.clock.showTooltip then - hour, minu = GetGameTime() - if minu < 10 then minu = ("0"..minu) end - GameTooltip:SetOwner(clockFrame, cfg.tooltipPos) - GameTooltip:AddLine("[|cff6699FFClock|r]") - GameTooltip:AddLine(" ") - if ( GetCVarBool("timeMgrUseLocalTime") ) then - GameTooltip:AddDoubleLine("Realm Time", hour..":"..minu, 1, 1, 0, 1, 1, 1) - else - GameTooltip:AddDoubleLine("Local Time", date("%H:%M"), 1, 1, 0, 1, 1, 1) - end - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine("<Left-click>", "Open Calendar", 1, 1, 0, 1, 1, 1) - GameTooltip:AddDoubleLine("<Right-click>", "Open Clock", 1, 1, 0, 1, 1, 1) - GameTooltip:Show() - end -end) - -clockFrame:SetScript("OnLeave", function() if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end clockText:SetTextColor(unpack(cfg.color.normal)) end) - -clockFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - ToggleCalendar() - elseif button == "RightButton" then - ToggleTimeManager() - end -end) \ No newline at end of file diff --git a/modules/old/config.lua b/modules/old/config.lua deleted file mode 100644 index 4dc5ad9..0000000 --- a/modules/old/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/old/currency.lua b/modules/old/currency.lua deleted file mode 100644 index 13bbc53..0000000 --- a/modules/old/currency.lua +++ /dev/null @@ -1,321 +0,0 @@ -local addon, ns = ... -local cfg = ns.cfg -local unpack = unpack --------------------------------------------------------------- -if not cfg.currency.show then return end - -local iconPos = "RIGHT" -local textPos = "LEFT" - -if cfg.currency.textOnRight then - iconPos = "LEFT" - textPos = "RIGHT" -end - -local currencyFrame = CreateFrame("Frame",nil, cfg.SXframe) -currencyFrame:SetPoint("LEFT", cfg.SXframe, "CENTER", 340,0) -currencyFrame:SetSize(16, 16) - ---------------------------------------------- --- XP BAR ---------------------------------------------- -local xpFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -xpFrame:SetPoint("LEFT", cfg.SXframe, "CENTER", 350,0) -xpFrame:SetSize(16, 16) -xpFrame:EnableMouse(true) -xpFrame:RegisterForClicks("AnyUp") - -local xpIcon = xpFrame:CreateTexture(nil,"OVERLAY",nil,7) -xpIcon:SetSize(16, 16) -xpIcon:SetPoint("LEFT") -xpIcon:SetTexture(cfg.mediaFolder.."datatexts\\exp") -xpIcon:SetVertexColor(unpack(cfg.color.normal)) - -local xpText = xpFrame:CreateFontString(nil, "OVERLAY") -xpText:SetFont(cfg.text.font, cfg.text.normalFontSize) -xpText:SetPoint("RIGHT",xpFrame,2,0 ) -xpText:SetTextColor(unpack(cfg.color.normal)) - -local xpStatusbar = CreateFrame("StatusBar", nil, xpFrame) -xpStatusbar:SetStatusBarTexture(1,1,1) -xpStatusbar:SetStatusBarColor(unpack(cfg.color.normal)) -xpStatusbar:SetPoint("TOPLEFT", xpText, "BOTTOMLEFT",0,-2) - -local xpStatusbarBG = xpStatusbar:CreateTexture(nil,"BACKGROUND",nil,7) -xpStatusbarBG:SetPoint("TOPLEFT", xpText, "BOTTOMLEFT",0,-2) -xpStatusbarBG:SetColorTexture(unpack(cfg.color.inactive)) - -xpFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - xpIcon:SetVertexColor(unpack(cfg.color.hover)) - xpStatusbar:SetStatusBarColor(unpack(cfg.color.hover)) - if not cfg.currency.showTooltip then return end - local mxp = UnitXPMax("player") - local xp = UnitXP("player") - local nxp = mxp - xp - local rxp = GetXPExhaustion() - local name, standing, minrep, maxrep, value = GetWatchedFactionInfo() - - if cfg.core.position ~= "BOTTOM" then - GameTooltip:SetOwner(xpStatusbar, cfg.tooltipPos) - else - GameTooltip:SetOwner(xpFrame, cfg.tooltipPos) - end - - GameTooltip:AddLine("[|cff6699FFExperience Bar|r]") - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine(COMBAT_XP_GAIN, format(cfg.SVal(xp)).."|cffffd100/|r"..format(cfg.SVal(mxp)).." |cffffd100/|r "..floor((xp/mxp)*1000)/10 .."%",NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b,1,1,1) - GameTooltip:AddDoubleLine(NEED, format(cfg.SVal(nxp)).." |cffffd100/|r "..floor((nxp/mxp)*1000)/10 .."%",NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b,1,1,1) - if rxp then - GameTooltip:AddDoubleLine(TUTORIAL_TITLE26, format(cfg.SVal(rxp)) .." |cffffd100/|r ".. floor((rxp/mxp)*1000)/10 .."%", NORMAL_FONT_COLOR.r,NORMAL_FONT_COLOR.g,NORMAL_FONT_COLOR.b,1,1,1) - end - GameTooltip:Show() -end) - -xpFrame:SetScript("OnLeave", function() - xpIcon:SetVertexColor(unpack(cfg.color.normal)) - xpStatusbar:SetStatusBarColor(unpack(cfg.color.normal)) - if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end -end) - ---------------------------------------------- --- REROLL ---------------------------------------------- -local rerollFrame = CreateFrame("BUTTON",nil, currencyFrame) -rerollFrame:SetPoint("LEFT") -rerollFrame:SetSize(16, 16) -rerollFrame:EnableMouse(true) -rerollFrame:RegisterForClicks("AnyUp") - -local rerollIcon = rerollFrame:CreateTexture(nil,"OVERLAY",nil,7) -rerollIcon:SetSize(16, 16) -rerollIcon:SetPoint(iconPos) -rerollIcon:SetTexture(cfg.mediaFolder.."datatexts\\reroll") -rerollIcon:SetVertexColor(unpack(cfg.color.inactive)) - -local rerollText = rerollFrame:CreateFontString(nil, "OVERLAY") -rerollText:SetFont(cfg.text.font, cfg.text.normalFontSize) ---rerollText:SetPoint(iconPos,rerollIcon,textPos,-2,0) -rerollText:SetPoint(textPos) -rerollText:SetTextColor(unpack(cfg.color.inactive)) - -rerollFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - rerollIcon:SetVertexColor(unpack(cfg.color.hover)) - if not cfg.currency.showTooltip then return end - GameTooltip:SetOwner(currencyFrame, cfg.tooltipPos) - GameTooltip:AddLine("[|cff6699FFReroll|r]") - GameTooltip:AddLine(" ") - local SoIFname, SoIFamount, SoIFicon, SoIFearnedThisWeek, SoIFweeklyMax, SoIFtotalMax, SoIFisDiscovered = GetCurrencyInfo(1129) - if SoIFamount > 0 then - GameTooltip:AddLine(SoIFname,1,1,0) - GameTooltip:AddDoubleLine("|cffffff00Weekly: |cffffffff"..SoIFearnedThisWeek.."|cffffff00/|cffffffff"..SoIFweeklyMax, "|cffffff00Total: |cffffffff"..SoIFamount.."|cffffff00/|cffffffff"..SoIFtotalMax) - else - local SoTFname, SoTFamount, SoTFicon, SoTFearnedThisWeek, SoTFweeklyMax, SoTFtotalMax, SoTFisDiscovered = GetCurrencyInfo(994) - if SoTFamount > 0 then - GameTooltip:AddDoubleLine(SoTFname, "|cffffff00Total: |cffffffff"..SoTFamount.."|cffffff00/|cffffffff"..SoTFtotalMax) - end - end - GameTooltip:Show() -end) - -rerollFrame:SetScript("OnLeave", function() - if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end - rerollIcon:SetVertexColor(unpack(cfg.color.inactive)) -end) - -rerollFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - ToggleCharacter("TokenFrame") - end -end) - ---------------------------------------------- --- HONOR ---------------------------------------------- - -local honorFrame = CreateFrame("BUTTON",nil, currencyFrame) -honorFrame:SetPoint("LEFT",rerollFrame,"RIGHT",2,0) -honorFrame:SetSize(16, 16) -honorFrame:EnableMouse(true) -honorFrame:RegisterForClicks("AnyUp") - -local honorIcon = honorFrame:CreateTexture(nil,"OVERLAY",nil,7) -honorIcon:SetSize(16, 16) -honorIcon:SetPoint(iconPos) -honorIcon:SetTexture(cfg.mediaFolder.."datatexts\\honor") -honorIcon:SetVertexColor(unpack(cfg.color.inactive)) - -local honorText = honorFrame:CreateFontString(nil, "OVERLAY") -honorText:SetFont(cfg.text.font, cfg.text.normalFontSize) -honorText:SetPoint(textPos) -honorText:SetTextColor(unpack(cfg.color.inactive)) - -honorFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - honorIcon:SetVertexColor(unpack(cfg.color.hover)) - if not cfg.currency.showTooltip then return end - GameTooltip:SetOwner(currencyFrame, cfg.tooltipPos) - GameTooltip:AddLine("[|cff6699FFHonor Level:|r"..UnitHonorLevel("player").."]") - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine(concName,"|cffffff00Honor: |cffffffff"..UnitHonor("player").."|cffffff00/|cffffffff"..UnitHonorMax("player")) - GameTooltip:Show() -end) - -honorFrame:SetScript("OnLeave", function() - if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end - honorIcon:SetVertexColor(unpack(cfg.color.inactive)) -end) - -honorFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - ToggleCharacter("TokenFrame") - end -end) - ---------------------------------------------- --- GARRISON RECOURCES ---------------------------------------------- - -local garrisonFrame = CreateFrame("BUTTON",nil, currencyFrame) -garrisonFrame:SetPoint("LEFT",honorFrame,"RIGHT",2,0) -garrisonFrame:SetSize(16, 16) -garrisonFrame:EnableMouse(true) -garrisonFrame:RegisterForClicks("AnyUp") - -local garrisonIcon = garrisonFrame:CreateTexture(nil,"OVERLAY",nil,7) -garrisonIcon:SetSize(16, 16) -garrisonIcon:SetPoint(iconPos) -garrisonIcon:SetTexture(cfg.mediaFolder.."datatexts\\garres") -garrisonIcon:SetVertexColor(unpack(cfg.color.inactive)) - -local garrisonText = garrisonFrame:CreateFontString(nil, "OVERLAY") -garrisonText:SetFont(cfg.text.font, cfg.text.normalFontSize) -garrisonText:SetPoint(textPos) -garrisonText:SetTextColor(unpack(cfg.color.inactive)) - -garrisonFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - garrisonIcon:SetVertexColor(unpack(cfg.color.hover)) - if not cfg.currency.showTooltip then return end - GameTooltip:SetOwner(currencyFrame, cfg.tooltipPos) - GameTooltip:AddLine("[|cff6699FFGarrison Recources|r]") - GameTooltip:AddLine(" ") - local grName, grAmount, _, _, _, grTotalMax = GetCurrencyInfo(824) - local oilName, oilAmount, _, _, _, oilTotalMax, oilIsDiscovered = GetCurrencyInfo(1101) - local apexisName, apexisAmount = GetCurrencyInfo(823) - local DICName, DICAmount, _, _, _, DICTotalMax = GetCurrencyInfo(980) - - GameTooltip:AddDoubleLine(grName, "|cffffffff"..format(cfg.SVal(grAmount)).."|cffffff00/|cffffffff"..format(cfg.SVal(grTotalMax))) - if oilIsDiscovered then - GameTooltip:AddDoubleLine(oilName, "|cffffffff"..format(cfg.SVal(oilAmount)).."|cffffff00/|cffffffff"..format(cfg.SVal(oilTotalMax))) - end - GameTooltip:AddDoubleLine(apexisName, "|cffffffff"..format(cfg.SVal(apexisAmount))) - if DICAmount > 0 then - GameTooltip:AddDoubleLine(DICName, "|cffffffff"..format(cfg.SVal(DICAmount)).."|cffffff00/|cffffffff"..format(cfg.SVal(DICTotalMax))) - end - GameTooltip:Show() -end) - -garrisonFrame:SetScript("OnLeave", function() - if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end - garrisonIcon:SetVertexColor(unpack(cfg.color.inactive)) -end) - -garrisonFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - ToggleCharacter("TokenFrame") - end -end) - - ---------------------------------------------- --- FUNCTIONS ---------------------------------------------- -local function updateXP(xp, mxp) - if UnitLevel("player") == MAX_PLAYER_LEVEL or not cfg.currency.showXPbar then - xpFrame:Hide() - xpFrame:EnableMouse(false) - currencyFrame:Show() - else - currencyFrame:Hide() - xpFrame:Show() - xpFrame:EnableMouse(true) - xpStatusbar:SetMinMaxValues(0, mxp) - xpStatusbar:SetValue(xp) - xpText:SetText("LEVEL "..UnitLevel("player").." "..cfg.CLASS) - xpFrame:SetSize(xpText:GetStringWidth()+18, 16) - xpStatusbar:SetSize(xpText:GetStringWidth(),3) - xpStatusbarBG:SetSize(xpText:GetStringWidth(),3) - end -end - ---------------------------------------------- --- EVENT HANDELING ---------------------------------------------- - -local eventframe = CreateFrame("Frame") -eventframe:RegisterEvent("PLAYER_ENTERING_WORLD") -eventframe:RegisterEvent("PLAYER_XP_UPDATE") -eventframe:RegisterEvent("PLAYER_LEVEL_UP") -eventframe:RegisterEvent("CURRENCY_DISPLAY_UPDATE") -eventframe:RegisterEvent("CHAT_MSG_CURRENCY") -eventframe:RegisterEvent("TRADE_CURRENCY_CHANGED") -eventframe:RegisterEvent("MODIFIER_STATE_CHANGED") - -eventframe:SetScript("OnEvent", function(this, event, arg1, arg2, arg3, arg4, ...) - --if event == "PLAYER_ENTERING_WORLD" or event == "PLAYER_XP_UPDATE" or event == "PLAYER_LEVEL_UP" then - if UnitLevel("player") ~= MAX_PLAYER_LEVEL and cfg.currency.showXPbar then - mxp = UnitXPMax("player") - xp = UnitXP("player") - updateXP(xp, mxp) - currencyFrame:Hide() - else - xpFrame:Hide() - end - - if event == "MODIFIER_STATE_CHANGED" then - if InCombatLockdown() then return end - if arg1 == "LSHIFT" or arg1 == "RSHIFT" then - if UnitLevel("player") == MAX_PLAYER_LEVEL or not cfg.currency.showXPbar then return end - if arg2 == 1 then - xpFrame:Hide() - xpFrame:EnableMouse(false) - currencyFrame:Show() - elseif arg2 == 0 then - currencyFrame:Hide() - xpFrame:EnableMouse(true) - xpFrame:Show() - end - end - end - - - - - -- reroll currency - local SoIFname, SoIFamount, _, _, _, SoIFtotalMax, SoIFisDiscovered = GetCurrencyInfo(1129) - if SoIFamount > 0 then - rerollText:SetText(SoIFamount) - else - local SoTFname, SoTFamount, _, _, _, SoTFtotalMax, SoTFisDiscovered = GetCurrencyInfo(994) - if SoTFamount > 0 then rerollText:SetText(SoTFamount) end - end - rerollFrame:SetSize(rerollText:GetStringWidth()+18, 16) - - -- honor currency - honorText:SetText(UnitHonor("player")) - honorFrame:SetSize(honorText:GetStringWidth()+18, 16) - - currencyFrame:SetSize(rerollFrame:GetWidth()+honorFrame:GetWidth()+6,16) - - -- garrison currency - local grName, grAmount, _, grEarnedThisWeek, grWeeklyMax, grTotalMax, grIsDiscovered = GetCurrencyInfo(824) - garrisonText:SetText(grAmount) - garrisonFrame:SetSize(garrisonText:GetStringWidth()+18, 16) - - currencyFrame:SetSize(rerollFrame:GetWidth()+honorFrame:GetWidth()+garrisonFrame:GetWidth()+6,16) -end) diff --git a/modules/old/gold.lua b/modules/old/gold.lua deleted file mode 100644 index 0d4fb3f..0000000 --- a/modules/old/gold.lua +++ /dev/null @@ -1,242 +0,0 @@ -local addon, ns = ... -local cfg = ns.cfg -local unpack = unpack --------------------------------------------------------------- -if not cfg.gold.show then return end - -local onHover = false - -local function goldConverter(money) - local g, s, c = abs(money/10000), abs(mod(money/100, 100)), abs(mod(money, 100)) - local cash - if ( g < 1 ) then g = "" else g = string.format("|cffffffff%d|cffffd700g|r ", g) end - if ( s < 1 ) then s = "" else s = string.format("|cffffffff%d|cffc7c7cfs|r ", s) end - if ( c == 0 ) then c = "" else c = string.format("|cffffffff%d|cffeda55fc|r", c) end - cash = string.format("%s%s%s", g, s, c) - if money == 0 then cash = "|cffffffff0" end - return cash -end - -local playerName, playerFaction, playerRealm = UnitName("player"), UnitFactionGroup("player"), GetRealmName() - -local positiveSign = "|cff00ff00+ " -local negativeSign = "|cffff0000- " - -local goldFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -goldFrame:SetPoint("RIGHT",-270,0) -goldFrame:SetSize(16, 16) -goldFrame:EnableMouse(true) -goldFrame:RegisterForClicks("AnyUp") - - local function goldFrameOnEnter() - if not cfg.gold.showTooltip then return end - if not onHover then return end - GameTooltip:SetOwner(goldFrame, cfg.tooltipPos) - GameTooltip:AddLine("[|cff6699FFGold|r]") - GameTooltip:AddLine(" ") - --------------------------------------------------- - - local gold = GetMoney() - local logDate = ns.playerData.lastLoginDate - - local sessionGold = ns.playerData["money_on_session_start"] - local sessionGoldIcon = "" - sessionGold = sessionGold - gold - - if sessionGold < 0 then - sessionGoldIcon = positiveSign - elseif sessionGold > 0 then - sessionGoldIcon = negativeSign - else - end - - local dayGold = ns.playerData["money_on_first_login_today"] - local dayGoldIcon = "" - dayGold = dayGold - gold - - if dayGold < 0 then - dayGoldIcon = positiveSign - elseif dayGold > 0 then - dayGoldIcon = negativeSign - else - end - - - local weekGold = ns.playerData["money_on_first_weekday"] - local weekGoldIcon = "" - weekGold = weekGold - gold - - if weekGold < 0 then - weekGoldIcon = positiveSign - elseif weekGold > 0 then - weekGoldIcon = negativeSign - else - end - - - local totalGold = 0 - for key, val in pairs(ns.realmData[playerFaction]) do - for k, v in pairs(val) do - if k == "money_on_log_out" then - totalGold = totalGold + v - end - end - end - - local realmDailyGold = 0 - for key, val in pairs(ns.realmData[playerFaction]) do - for k, v in pairs(val) do - if k == "money_on_first_login_today" then - realmDailyGold = realmDailyGold + v - end - end - end - - local realmDayGoldIcon = "" - realmDailyGold = realmDailyGold - totalGold - - if realmDailyGold < 0 then - realmDayGoldIcon = positiveSign - elseif realmDailyGold > 0 then - realmDayGoldIcon = negativeSign - else - end - - - local realmWeeklyGold = 0 - for key, val in pairs(ns.realmData[playerFaction]) do - for k, v in pairs(val) do - if k == "money_on_first_weekday" then - realmWeeklyGold = realmWeeklyGold + v - end - end - end - - local realmWeekGoldIcon = "" - realmWeeklyGold = realmWeeklyGold - totalGold - - if realmWeeklyGold < 0 then - realmWeekGoldIcon = positiveSign - elseif realmWeeklyGold > 0 then - realmWeekGoldIcon = negativeSign - else - end - - GameTooltip:AddDoubleLine(playerName.."|r's Gold",format(goldConverter(gold))) - GameTooltip:AddLine(" ") - - if IsShiftKeyDown() then - GameTooltip:AddDoubleLine("Realm Daily Balance",realmDayGoldIcon..format(goldConverter(realmDailyGold))) - GameTooltip:AddDoubleLine("Realm Weekly Balance",realmWeekGoldIcon..format(goldConverter(realmWeeklyGold))) - GameTooltip:AddLine(" ") - for key, val in pairs(ns.realmData[playerFaction]) do - for k, v in pairs(val) do - if k == "money_on_log_out" then - GameTooltip:AddDoubleLine(key,format(goldConverter(v))) - end - end - end - - else - GameTooltip:AddDoubleLine("Session Balance",sessionGoldIcon..format(goldConverter(sessionGold))) - GameTooltip:AddDoubleLine("Daily Balance",dayGoldIcon..format(goldConverter(dayGold))) - GameTooltip:AddDoubleLine("Weekly Balance",weekGoldIcon..format(goldConverter(weekGold))) - - end - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine("Realm Gold","|cffffffff"..format(goldConverter(totalGold))) - if not IsShiftKeyDown() then - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine("<Shift-hold>", "Show the |cffffff00"..playerRealm.." - "..playerFaction.."|r gold", 1, 1, 0, 1, 1, 1) - end - GameTooltip:Show() - end - - local function freeSpaceBags() - local freeSlots = 0 - for i=0, 4,1 do - freeSlots = freeSlots+select(1,GetContainerNumFreeSlots(i)) - end - return freeSlots -end - -local goldIcon = goldFrame:CreateTexture(nil,"OVERLAY",nil,7) -goldIcon:SetPoint("LEFT",goldFrame,17,0) -goldIcon:SetTexture(cfg.mediaFolder.."datatexts\\gold") -goldIcon:SetVertexColor(unpack(cfg.color.normal)) - -local goldText = goldFrame:CreateFontString(nil, "OVERLAY") -goldText:SetFont(cfg.text.font, cfg.text.normalFontSize) -goldText:SetPoint("LEFT", goldIcon,15,0) -goldText:SetTextColor(unpack(cfg.color.normal)) - -local spaceText = goldFrame:CreateFontString(nil,"OVERLAY") -spaceText:SetPoint("LEFT", goldIcon,-17,0) -spaceText:SetFont(cfg.text.font, cfg.text.normalFontSize) - -goldFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - goldIcon:SetVertexColor(unpack(cfg.color.hover)) - onHover = true - goldFrameOnEnter() -end) - -goldFrame:SetScript("OnLeave", function() if ( GameTooltip:IsShown() ) then GameTooltip:Hide() onHover = false end goldIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -goldFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - OpenAllBags() - elseif button == "RightButton" then - CloseAllBags() - end -end) - -local eventframe = CreateFrame("Frame") -eventframe:RegisterEvent("PLAYER_ENTERING_WORLD") -eventframe:RegisterEvent("PLAYER_MONEY") -eventframe:RegisterEvent("SEND_MAIL_MONEY_CHANGED") -eventframe:RegisterEvent("SEND_MAIL_COD_CHANGED") -eventframe:RegisterEvent("PLAYER_TRADE_MONEY") -eventframe:RegisterEvent("TRADE_MONEY_CHANGED") -eventframe:RegisterEvent("TRADE_CLOSED") -eventframe:RegisterEvent("MODIFIER_STATE_CHANGED") -eventframe:RegisterEvent("BAG_UPDATE") - -eventframe:SetScript("OnEvent", function(this, event, arg1, arg2, arg3, arg4, ...) - - goldFrameOnEnter() - if event == "MODIFIER_STATE_CHANGED" then - if InCombatLockdown() then return end - if arg1 == "LSHIFT" or arg1 == "RSHIFT" then - if arg2 == 1 then - goldFrameOnEnter() - elseif arg2 == 0 then - goldFrameOnEnter() - end - end - end - - if event=="BAG_UPDATE" and cfg.gold.showFreeBagSpace then - spaceText:SetText("("..freeSpaceBags()..")") - end - - - local gold = GetMoney() - - ns.playerData["money_on_log_out"] = gold - - local g, s, c = abs(gold/10000), abs(mod(gold/100, 100)), abs(mod(gold, 100)) - - if g > 1 then - goldText:SetText(floor(g).."g") - elseif s > 1 then - goldText:SetText(floor(s).."s") - else - goldText:SetText(floor(c).."c") - end - if gold == 0 then goldText:SetText("0") end - - - goldFrame:SetSize(goldText:GetStringWidth()+18, 16) -end) diff --git a/modules/old/heartstone.lua b/modules/old/heartstone.lua deleted file mode 100644 index 322ca4b..0000000 --- a/modules/old/heartstone.lua +++ /dev/null @@ -1,251 +0,0 @@ -local addon, ns = ... -local cfg = ns.cfg -local unpack = unpack --------------------------------------------------------------- -if not cfg.heartstone.show then return end - -local garrOnHover = false -local hsOnHover = false - -local teleportFrame = CreateFrame("Frame",nil, cfg.SXframe) -teleportFrame:SetPoint("RIGHT",-4,0) -teleportFrame:SetSize(16, 16) ---------------------------------------------------------------------- -local HSFrame = CreateFrame("BUTTON","hsButton", teleportFrame, "SecureActionButtonTemplate") -HSFrame:SetPoint("RIGHT") -HSFrame:SetSize(16, 16) -HSFrame:EnableMouse(true) -HSFrame:RegisterForClicks("AnyUp") -HSFrame:SetAttribute("type", "macro") - -local HSText = HSFrame:CreateFontString(nil, "OVERLAY") -HSText:SetFont(cfg.text.font, cfg.text.normalFontSize) -HSText:SetPoint("RIGHT") -HSText:SetTextColor(unpack(cfg.color.normal)) - -local HSIcon = HSFrame:CreateTexture(nil,"OVERLAY",nil,7) -HSIcon:SetSize(16, 16) -HSIcon:SetPoint("RIGHT", HSText,"LEFT",-2,0) -HSIcon:SetTexture(cfg.mediaFolder.."datatexts\\hearth") -HSIcon:SetVertexColor(unpack(cfg.color.normal)) - -HSFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - HSIcon:SetVertexColor(unpack(cfg.color.hover)) - if not cfg.heartstone.showTooltip then return end - local startTime, duration = GetItemCooldown(6948) - if startTime ~= 0 then - local CDremaining = (startTime+duration)-GetTime() - GameTooltip:SetOwner(teleportFrame, cfg.tooltipPos) - GameTooltip:AddDoubleLine("Cooldown",SecondsToTime(CDremaining),1,1,0,1,1,1) - GameTooltip:Show() - end - hsOnHover = true -end) - -HSFrame:SetScript("OnLeave", function() - hsOnHover = false - if IsUsableItem(6948) and GetItemCooldown(6948) == 0 or IsPlayerSpell(556) and GetSpellCooldown(556) == 0 then - HSIcon:SetVertexColor(unpack(cfg.color.normal)) - else - HSIcon:SetVertexColor(unpack(cfg.color.inactive)) - end -end) - --- Change the button action before the click reaches it: -function HSFrame:ChangeAction(action) - if InCombatLockdown() then return end -- can't change attributes in combat - self:SetAttribute("macrotext", action) -end - -HSFrame:SetScript("PreClick", function(self) - if InCombatLockdown() then return end -- can't change attributes in combat - - -- Innkeeper's Daughter - if PlayerHasToy(64488) and GetItemCooldown(64488) == 0 then - local itemName, itemLink, _, _, _, _, _, _, _, itemIcon = GetItemInfo(64488) - return self:ChangeAction("/use " .. itemName) - - -- Hearthstone - elseif IsUsableItem(6948) and GetItemCooldown(6948) == 0 then - local itemName, itemLink, _, _, _, _, _, _, _, itemIcon = GetItemInfo(6948) - return self:ChangeAction("/use " .. itemName) - - -- Astral Recall - elseif IsPlayerSpell(556) and GetSpellCooldown(556) == 0 then - local spellName, _, spellIcon = GetSpellInfo(556) - return self:ChangeAction("/cast " .. spellName) - end - - local playerLevel = UnitLevel("player") - - if playerLevel > 70 and IsUsableItem(44315) and GetItemCooldown(44315) == 0 then - return self:SetAttribute("macrotext", "/use Scroll of Recall III") - - elseif playerLevel > 40 and IsUsableItem(44314) and GetItemCooldown(44314) == 0 then - return self:SetAttribute("macrotext", "/use Scroll of Recall II") - - elseif playerLevel <= 39 and IsUsableItem(37118) and GetItemCooldown(37118) == 0 then - return self:SetAttribute("macrotext", "/use Scroll of Recall") - - end -end) ---------------------------------------------------------------------- -local garrisonFrame = CreateFrame("BUTTON","garrisonButton", teleportFrame, "SecureActionButtonTemplate") -garrisonFrame:SetPoint("LEFT") -garrisonFrame:SetSize(16, 16) -garrisonFrame:EnableMouse(true) -garrisonFrame:RegisterForClicks("AnyUp") -garrisonFrame:SetAttribute("*type1", "macro") - --- Change the button action before the click reaches it: -function garrisonFrame:ChangeAction(action) - if InCombatLockdown() then return end -- can't change attributes in combat - self:SetAttribute("macrotext", action) -end - -garrisonFrame:SetScript("PreClick", function(self) - if InCombatLockdown() then return end -- can't change attributes in combat - - if IsShiftKeyDown() then - if IsUsableItem(128353) and GetItemCooldown(128353) == 0 then - local itemName, itemLink, _, _, _, _, _, _, _, itemIcon = GetItemInfo(128353) - return self:ChangeAction("/use " .. itemName) - end - else - if IsUsableItem(110560) and GetItemCooldown(110560) == 0 then - local itemName, itemLink, _, _, _, _, _, _, _, itemIcon = GetItemInfo(110560) - return self:ChangeAction("/use " .. itemName) - end - end -end) - - -local garrisonIcon = garrisonFrame:CreateTexture(nil,"OVERLAY",nil,7) -garrisonIcon:SetSize(16, 16) -garrisonIcon:SetPoint("LEFT") -garrisonIcon:SetTexture(cfg.mediaFolder.."datatexts\\garr") -garrisonIcon:SetVertexColor(unpack(cfg.color.normal)) - -local garrisonText = garrisonFrame:CreateFontString(nil, "OVERLAY") -garrisonText:SetFont(cfg.text.font, cfg.text.normalFontSize) -garrisonText:SetPoint("LEFT", garrisonIcon,"RIGHT",2,0) -garrisonText:SetText("GARRISON") -garrisonText:SetTextColor(unpack(cfg.color.normal)) - -garrisonFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - local startTime, duration = GetItemCooldown(110560) - if startTime ~= 0 then - local CDremaining = (startTime+duration)-GetTime() - GameTooltip:SetOwner(teleportFrame, cfg.tooltipPos) - GameTooltip:AddDoubleLine("Cooldown",SecondsToTime(CDremaining),1,1,0,1,1,1) - GameTooltip:Show() - end - garrisonIcon:SetVertexColor(unpack(cfg.color.hover)) - garrOnHover = true -end) - -garrisonFrame:SetScript("OnLeave", function() - garrOnHover = false - if IsUsableItem(110560) and GetItemCooldown(110560) == 0 then - garrisonIcon:SetVertexColor(unpack(cfg.color.normal)) - else - garrisonIcon:SetVertexColor(unpack(cfg.color.inactive)) - end - GameTooltip:Hide() -end) - -local function hsHover() -local startTime, duration = GetItemCooldown(6948) - if startTime ~= 0 then - local CDremaining = (startTime+duration)-GetTime() - GameTooltip:SetOwner(teleportFrame, cfg.tooltipPos) - GameTooltip:AddDoubleLine("Cooldown",SecondsToTime(CDremaining),1,1,0,1,1,1) - GameTooltip:Show() - end - HSIcon:SetVertexColor(unpack(cfg.color.hover)) -end - -local function garrHover() -local startTime, duration = GetItemCooldown(110560) - if startTime ~= 0 then - local CDremaining = (startTime+duration)-GetTime() - GameTooltip:SetOwner(teleportFrame, cfg.tooltipPos) - GameTooltip:AddDoubleLine("Cooldown",SecondsToTime(CDremaining),1,1,0,1,1,1) - GameTooltip:Show() - end - garrisonIcon:SetVertexColor(unpack(cfg.color.hover)) -end - -local function updateTeleportText() -local playerLevel = UnitLevel("player") - if PlayerHasToy(64488) and GetItemCooldown(64488) == 0 - or IsUsableItem(6948) and GetItemCooldown(6948) == 0 - or IsPlayerSpell(556) and GetSpellCooldown(556) == 0 - or playerLevel > 70 and IsUsableItem(44315) and GetItemCooldown(44315) == 0 - or playerLevel > 40 and IsUsableItem(44314) and GetItemCooldown(44314) == 0 - or playerLevel <= 39 and IsUsableItem(37118) and GetItemCooldown(37118) == 0 - then - HSIcon:SetVertexColor(unpack(cfg.color.normal)) - HSText:SetTextColor(unpack(cfg.color.normal)) - else - HSIcon:SetVertexColor(unpack(cfg.color.inactive)) - HSText:SetTextColor(unpack(cfg.color.inactive)) - end - - if IsUsableItem(110560) and GetItemCooldown(110560) == 0 then - garrisonIcon:SetVertexColor(unpack(cfg.color.normal)) - garrisonText:SetTextColor(unpack(cfg.color.normal)) - else - garrisonIcon:SetVertexColor(unpack(cfg.color.inactive)) - garrisonText:SetTextColor(unpack(cfg.color.inactive)) - end -end - -local elapsed = 0 -teleportFrame:SetScript('OnUpdate', function(self, e) - elapsed = elapsed + e - if elapsed >= 1 then - updateTeleportText() - if garrOnHover then garrHover() end - if hsOnHover then hsHover() end - elapsed = 0 - end -end) - -local eventframe = CreateFrame("Frame") -eventframe:RegisterEvent("PLAYER_ENTERING_WORLD") -eventframe:RegisterEvent("BAG_UPDATE") -eventframe:RegisterEvent("HEARTHSTONE_BOUND") -eventframe:RegisterEvent("MODIFIER_STATE_CHANGED") - -eventframe:SetScript("OnEvent", function(this, event, arg1, arg2, arg3, arg4, ...) -if InCombatLockdown() then return end - -HSText:SetText(strupper(GetBindLocation())) -HSFrame:SetSize(HSText:GetStringWidth()+16, 16) - - -if IsUsableItem(110560) then - garrisonFrame:Show() -else - garrisonFrame:Hide() -end - -if event == "MODIFIER_STATE_CHANGED" then - if arg1 == "LSHIFT" or arg1 == "RSHIFT" then - if arg2 == 1 then - if IsUsableItem(128353) then - garrisonText:SetText("SHIPYARD") - garrisonIcon:SetTexture(cfg.mediaFolder.."datatexts\\shipcomp") - end - elseif arg2 == 0 then - garrisonText:SetText("GARRISON") - garrisonIcon:SetTexture(cfg.mediaFolder.."datatexts\\garr") - end - end -end - garrisonFrame:SetSize(garrisonText:GetStringWidth()+16, 16) - teleportFrame:SetSize(HSFrame:GetWidth()+garrisonFrame:GetWidth()+8, 16) -end) diff --git a/modules/old/micromenu.lua b/modules/old/micromenu.lua deleted file mode 100644 index 96d762a..0000000 --- a/modules/old/micromenu.lua +++ /dev/null @@ -1,371 +0,0 @@ -local addon, ns = ... -local cfg = ns.cfg -local unpack = unpack --------------------------------------------------------------- -if not cfg.micromenu.show then return end ---------------------------------------------- --- GAME MENU ---------------------------------------------- - -PlayerFrame.name:SetFont("Interface\\AddOns\\oUF_Drk\\media\\BigNoodleTitling.ttf", 11, "THINOUTLINE") -TargetFrame.name:SetFont("Interface\\AddOns\\oUF_Drk\\media\\BigNoodleTitling.ttf", 11, "THINOUTLINE") - -local isBeautiful = IsAddOnLoaded("Blizzard_RaidUI") --!Beautycase check - -if isBeautiful then - subframes.name:SetFont("Interface\\AddOns\\oUF_Drk\\media\\BigNoodleTitling.ttf",11,"THINOUTLINE") -end - - -local gameMenuFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -gameMenuFrame:SetSize(32, 32) -gameMenuFrame:SetPoint("LEFT",2,0) -gameMenuFrame:EnableMouse(true) -gameMenuFrame:RegisterForClicks("AnyUp") -local gameMenuIcon = gameMenuFrame:CreateTexture(nil,"OVERLAY",nil,7) -gameMenuIcon:SetPoint("CENTER") -gameMenuIcon:SetTexture(cfg.mediaFolder.."microbar\\menu") -gameMenuIcon:SetVertexColor(unpack(cfg.color.normal)) - -gameMenuFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - gameMenuIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -gameMenuFrame:SetScript("OnLeave", function() gameMenuIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -gameMenuFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - ToggleFrame(GameMenuFrame) - elseif button == "RightButton" then - if IsShiftKeyDown() then ReloadUI() - elseif IsAltKeyDown() then - if cfg.useConfig then - --if cfg.SXconfigFrame:IsShown() then - ToggleFrame(cfg.SXconfigFrame) - --else - --ToggleFrame(cfg.SXconfigFrame) - --end - end - else ToggleFrame(AddonList) end - end -end) - ---------------------------------------------- --- CHARACTER FRAME ---------------------------------------------- - -local characterFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -characterFrame:SetSize(32, 32) -characterFrame:SetPoint("LEFT",174,0) -characterFrame:EnableMouse(true) -characterFrame:RegisterForClicks("AnyUp") -local characterFrameIcon = characterFrame:CreateTexture(nil,"OVERLAY",nil,7) -characterFrameIcon:SetAllPoints() -characterFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\char") -characterFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -characterFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - characterFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -characterFrame:SetScript("OnLeave", function() characterFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -characterFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - ToggleCharacter("PaperDollFrame") - end -end) - ---------------------------------------------- --- SPELLS ---------------------------------------------- - -local spellFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -spellFrame:SetSize(32, 32) -spellFrame:SetPoint("LEFT",characterFrame,"RIGHT",4,0) -spellFrame:EnableMouse(true) -spellFrame:RegisterForClicks("AnyUp") -local spellFrameIcon = spellFrame:CreateTexture(nil,"OVERLAY",nil,7) -spellFrameIcon:SetSize(32,32) -spellFrameIcon:SetPoint("CENTER") -spellFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\spell") -spellFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -spellFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - spellFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -spellFrame:SetScript("OnLeave", function() spellFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -spellFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - ToggleFrame(SpellBookFrame) - end -end) - ---------------------------------------------- --- TALENT ---------------------------------------------- - -local talentFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -talentFrame:SetSize(32, 32) -talentFrame:SetPoint("LEFT",spellFrame,"RIGHT",4,0) -talentFrame:EnableMouse(true) -talentFrame:RegisterForClicks("AnyUp") -local talentFrameIcon = talentFrame:CreateTexture(nil,"OVERLAY",nil,7) -talentFrameIcon:SetSize(32,32) -talentFrameIcon:SetPoint("CENTER") -talentFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\talent") -talentFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -talentFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - talentFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -talentFrame:SetScript("OnLeave", function() talentFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -talentFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - TalentMicroButton:Click() - end -end) - ---------------------------------------------- --- ACHIV ---------------------------------------------- - -local achievementFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -achievementFrame:SetSize(32, 32) -achievementFrame:SetPoint("LEFT",talentFrame,"RIGHT",4,0) -achievementFrame:EnableMouse(true) -achievementFrame:RegisterForClicks("AnyUp") -local achievementFrameIcon = achievementFrame:CreateTexture(nil,"OVERLAY",nil,7) -achievementFrameIcon:SetSize(32,32) -achievementFrameIcon:SetPoint("CENTER") -achievementFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\ach") -achievementFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -achievementFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - achievementFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -achievementFrame:SetScript("OnLeave", function() achievementFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -achievementFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - securecall(ToggleAchievementFrame) - end -end) - ---------------------------------------------- --- QUEST ---------------------------------------------- - -local questFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -questFrame:SetSize(32, 32) -questFrame:SetPoint("LEFT",achievementFrame,"RIGHT",4,0) -questFrame:EnableMouse(true) -questFrame:RegisterForClicks("AnyUp") -local questFrameIcon = questFrame:CreateTexture(nil,"OVERLAY",nil,7) -questFrameIcon:SetSize(32,32) -questFrameIcon:SetPoint("CENTER") -questFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\quest") -questFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -questFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - questFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -questFrame:SetScript("OnLeave", function() questFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -questFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - QuestLogMicroButton:Click() - end -end) - ---------------------------------------------- --- LFG ---------------------------------------------- - -local lfgFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -lfgFrame:SetSize(32, 32) -lfgFrame:SetPoint("LEFT",questFrame,"RIGHT",4,0) -lfgFrame:EnableMouse(true) -lfgFrame:RegisterForClicks("AnyUp") -local lfgFrameIcon = lfgFrame:CreateTexture(nil,"OVERLAY",nil,7) -lfgFrameIcon:SetSize(32,32) -lfgFrameIcon:SetPoint("CENTER") -lfgFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\lfg") -lfgFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -lfgFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - lfgFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -lfgFrame:SetScript("OnLeave", function() lfgFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -lfgFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - securecall(PVEFrame_ToggleFrame, 'GroupFinderFrame') - end -end) - ---------------------------------------------- --- ADVENTURE GUIDE ---------------------------------------------- - -local adventureFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -adventureFrame:SetSize(32, 32) -adventureFrame:SetPoint("LEFT",lfgFrame,"RIGHT",4,0) -adventureFrame:EnableMouse(true) -adventureFrame:RegisterForClicks("AnyUp") -local adventureFrameIcon = adventureFrame:CreateTexture(nil,"OVERLAY",nil,7) -adventureFrameIcon:SetSize(32,32) -adventureFrameIcon:SetPoint("CENTER") -adventureFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\journal") -adventureFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -adventureFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - adventureFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -adventureFrame:SetScript("OnLeave", function() adventureFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -adventureFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - EJMicroButton:Click() - end -end) - ---------------------------------------------- --- PvP ---------------------------------------------- - -local pvpFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -pvpFrame:SetSize(32, 32) -pvpFrame:SetPoint("LEFT",adventureFrame,"RIGHT",4,0) -pvpFrame:EnableMouse(true) -pvpFrame:RegisterForClicks("AnyUp") -local pvpFrameIcon = pvpFrame:CreateTexture(nil,"OVERLAY",nil,7) -pvpFrameIcon:SetSize(32,32) -pvpFrameIcon:SetPoint("CENTER") -pvpFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\pvp") -pvpFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -pvpFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - pvpFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -pvpFrame:SetScript("OnLeave", function() pvpFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -pvpFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - securecall(PVEFrame_ToggleFrame, 'PVPUIFrame', HonorFrame) - end -end) - ---------------------------------------------- --- MOUNTS ---------------------------------------------- - -local mountFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -mountFrame:SetSize(32, 32) -mountFrame:SetPoint("LEFT",pvpFrame,"RIGHT",4,0) -mountFrame:EnableMouse(true) -mountFrame:RegisterForClicks("AnyUp") -local mountFrameIcon = mountFrame:CreateTexture(nil,"OVERLAY",nil,7) -mountFrameIcon:SetSize(32,32) -mountFrameIcon:SetPoint("CENTER") -mountFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\pet") -mountFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -mountFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - mountFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -mountFrame:SetScript("OnLeave", function() mountFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -mountFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - securecall(ToggleCollectionsJournal, 1) - end -end) - ---------------------------------------------- --- SHOP ---------------------------------------------- - -local shopFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -shopFrame:SetSize(32, 32) -shopFrame:SetPoint("LEFT",mountFrame,"RIGHT",4,0) -shopFrame:EnableMouse(true) -shopFrame:RegisterForClicks("AnyUp") -local shopFrameIcon = shopFrame:CreateTexture(nil,"OVERLAY",nil,7) -shopFrameIcon:SetSize(32,32) -shopFrameIcon:SetPoint("CENTER") -shopFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\shop") -shopFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -shopFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - shopFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -shopFrame:SetScript("OnLeave", function() shopFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -shopFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - StoreMicroButton:Click() - end -end) - ---------------------------------------------- --- HELP ---------------------------------------------- - -local helpFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -helpFrame:SetSize(32, 32) -helpFrame:SetPoint("LEFT",shopFrame,"RIGHT",4,0) -helpFrame:EnableMouse(true) -helpFrame:RegisterForClicks("AnyUp") -local helpFrameIcon = helpFrame:CreateTexture(nil,"OVERLAY",nil,7) -helpFrameIcon:SetSize(32,32) -helpFrameIcon:SetPoint("CENTER") -helpFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\help") -helpFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -helpFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - helpFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -helpFrame:SetScript("OnLeave", function() helpFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -helpFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - securecall(ToggleHelpFrame) - end -end) diff --git a/modules/old/social.lua b/modules/old/social.lua deleted file mode 100644 index 0f70414..0000000 --- a/modules/old/social.lua +++ /dev/null @@ -1,272 +0,0 @@ -local addon, ns = ... -local cfg = ns.cfg -local unpack = unpack --------------------------------------------------------------- -if not cfg.micromenu.show then return end - -local chatFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -chatFrame:SetSize(32, 32) -chatFrame:SetPoint("LEFT",52,0) -chatFrame:EnableMouse(true) -chatFrame:RegisterForClicks("AnyUp") -local chatFrameIcon = chatFrame:CreateTexture(nil,"OVERLAY",nil,7) -chatFrameIcon:SetSize(32,32) -chatFrameIcon:SetPoint("CENTER") -chatFrameIcon:SetTexture(cfg.mediaFolder.."microbar\\chat") -chatFrameIcon:SetVertexColor(unpack(cfg.color.normal)) - -chatFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - chatFrameIcon:SetVertexColor(unpack(cfg.color.hover)) -end) - -chatFrame:SetScript("OnLeave", function() chatFrameIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -chatFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - ChatMenu:SetScale(cfg.core.scale) - ChatMenu:ClearAllPoints() - if not ChatMenu:IsShown() then - if cfg.core.position == "BOTTOM" then - ChatMenu:SetPoint("BOTTOMLEFT", chatFrame, "TOPLEFT") - else - ChatMenu:SetPoint("TOPLEFT", chatFrame, "BOTTOMLEFT") - end - ChatFrameMenuButton:Click() - else ChatMenu:Hide() end - end -end) - - -local guildFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -guildFrame:SetSize(32, 32) -guildFrame:SetPoint("LEFT",chatFrame,36,0) -guildFrame:EnableMouse(true) -guildFrame:RegisterForClicks("AnyUp") - -local guildIcon = guildFrame:CreateTexture(nil,"OVERLAY",nil,7) -guildIcon:SetPoint("CENTER") -guildIcon:SetTexture(cfg.mediaFolder.."microbar\\guild") -guildIcon:SetVertexColor(unpack(cfg.color.normal)) - -local guildText = guildFrame:CreateFontString(nil, "OVERLAY") -guildText:SetFont(cfg.text.font, cfg.text.smallFontSize) -guildText:SetPoint("CENTER", guildFrame, "TOP") -if cfg.core.position ~= "BOTTOM" then - guildText:SetPoint("CENTER", guildFrame, "BOTTOM") -end - -local guildTextBG = guildFrame:CreateTexture(nil,"OVERLAY",nil,7) -guildTextBG:SetPoint("CENTER",guildText) -guildTextBG:SetColorTexture(unpack(cfg.color.barcolor)) - -guildFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - guildIcon:SetVertexColor(unpack(cfg.color.hover)) - if not cfg.micromenu.showTooltip then return end -if ( IsInGuild() ) then - GameTooltip:SetOwner(guildFrame, cfg.tooltipPos) - GameTooltip:AddLine("[|cff6699FFGuild|r]") - GameTooltip:AddLine(" ") - -------------------------- - - guildList = {} - guildName, guildRank, _ = GetGuildInfo("player") - guildMotto = GetGuildRosterMOTD() - - GameTooltip:AddDoubleLine("Guild:", guildName, 1, 1, 0, 0, 1, 0) - for i = 0, select(1, GetNumGuildMembers()) do - local name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName, achievementPoints, achievementRank, isMobile, canSoR = GetGuildRosterInfo(i) - if ( online ) then - if status == 0 then status = "" elseif status == 1 then status = "AFK" elseif status == 2 then status = "DND" end - local cCol = string.format("%02X%02X%02X", RAID_CLASS_COLORS[classFileName].r*255, RAID_CLASS_COLORS[classFileName].g*255, RAID_CLASS_COLORS[classFileName].b*255) - local lineL = string.format("%s |cff%s%s|r %s %s", level, cCol, name, status, note) - local lineR = string.format("%s|cffffffff %s", isMobile and "|cffffff00[M]|r " or "", zone or "") - GameTooltip:AddDoubleLine(lineL,lineR) - end - end -else - --GameTooltip:AddLine("No Guild") -end -GameTooltip:AddLine(" ") -if ( IsInGuild() ) then GameTooltip:AddDoubleLine("<Left-click>", "Open Guild Page", 1, 1, 0, 1, 1, 1) end ------------------------ -GameTooltip:Show() -end) - -guildFrame:SetScript("OnLeave", function() if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end guildIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -guildFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - if ( IsInGuild() ) then - ToggleGuildFrame() - GuildFrameTab2:Click() - else - print"|cff6699FFSXUI|r: You are not in a guild" - end - end -end) - -local friendFrame = CreateFrame("BUTTON",nil, cfg.SXframe) -friendFrame:SetSize(32, 32) -friendFrame:SetPoint("LEFT",guildFrame,36,0) -friendFrame:EnableMouse(true) -friendFrame:RegisterForClicks("AnyUp") - -local friendIcon = friendFrame:CreateTexture(nil,"OVERLAY",nil,7) -friendIcon:SetSize(32,32) -friendIcon:SetPoint("CENTER") -friendIcon:SetTexture(cfg.mediaFolder.."microbar\\social") -friendIcon:SetVertexColor(unpack(cfg.color.normal)) - -local friendText = guildFrame:CreateFontString(nil, "OVERLAY") -friendText:SetFont(cfg.text.font, cfg.text.smallFontSize) -friendText:SetPoint("CENTER", friendFrame, "TOP") -if cfg.core.position ~= "BOTTOM" then - friendText:SetPoint("CENTER", friendFrame, "BOTTOM") -end - -local friendTextBG = guildFrame:CreateTexture(nil,"OVERLAY",nil,7) -friendTextBG:SetColorTexture(unpack(cfg.color.barcolor)) - - -friendFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - friendIcon:SetVertexColor(unpack(cfg.color.hover)) - if not cfg.micromenu.showTooltip then return end - local totalBNet, numBNetOnline = BNGetNumFriends() - if numBNetOnline then - GameTooltip:SetOwner(friendFrame, cfg.tooltipPos) - GameTooltip:AddLine("[|cff6699FFSocial|r]") - GameTooltip:AddLine(" ") - -------------------------- - local onlineBnetFriends = false - for j = 1, BNGetNumFriends() do - local BNid, BNname, battleTag, _, toonname, toonid, client, online, lastonline, isafk, isdnd, broadcast, note = BNGetFriendInfo(j) - if ( online ) then - - if (not battleTag) then battleTag = "[noTag]" end - local status = "" - - local statusIcon = "Interface\\FriendsFrame\\StatusIcon-Online.blp" - if ( isafk ) then - statusIcon = "Interface\\FriendsFrame\\StatusIcon-Away.blp" - status = "(AFK)" - end - if ( isdnd ) == "D3" then - statusIcon = "Interface\\FriendsFrame\\StatusIcon-DnD.blp" - status = "(DND)" - end - - local gameIcon = "Interface\\Icons\\INV_Misc_QuestionMark.blp" - if client == "App" then - gameIcon = "Interface\\FriendsFrame\\Battlenet-Battleneticon.blp" - client = "Bnet" - elseif client == "D3" then - gameIcon = "Interface\\FriendsFrame\\Battlenet-D3icon.blp" - client = "Diablo III" - elseif client == "Hero" then - gameIcon = "Interface\\FriendsFrame\\Battlenet-HotSicon.blp" - client = "Hero of the Storm" - elseif client == "S2" then - gameIcon = "Interface\\FriendsFrame\\Battlenet-Sc2icon.blp" - client = "Starcraft 2" - elseif client == "WoW" then - gameIcon = "Interface\\FriendsFrame\\Battlenet-WoWicon.blp" - elseif client == "WTCG" then - gameIcon = "Interface\\FriendsFrame\\Battlenet-WTCGicon.blp" - client = "Heartstone" - end - if client == "WoW" then - toonname = ("(|cffecd672"..toonname.."|r)") - else - toonname = "" - end - - if not note then - note = "" - else - note = ("(|cffecd672"..note.."|r)") - end - - local lineL = string.format("|T%s:16|t|cff82c5ff %s|r %s",statusIcon, BNname, note) - local lineR = string.format("%s %s |T%s:16|t",toonname, client or "", gameIcon) - GameTooltip:AddDoubleLine(lineL,lineR) - onlineBnetFriends = true - end - end - -if onlineBnetFriends then GameTooltip:AddLine(" ") end - -local onlineFriends = false - for i = 1, GetNumFriends() do - local name, lvl, class, area, online, status, note = GetFriendInfo(i) - if ( online ) then - local status = "" - local statusIcon = "Interface\\FriendsFrame\\StatusIcon-Online.blp" - if ( isafk ) then - statusIcon = "Interface\\FriendsFrame\\StatusIcon-Away.blp" - status = "(AFK)" - end - if ( isdnd ) == "D3" then - statusIcon = "Interface\\FriendsFrame\\StatusIcon-DnD.blp" - status = "(DND)" - end - local lineL = string.format("|T%s:16|t %s, lvl:%s %s", statusIcon, name, lvl, class) - local lineR = string.format("%s", area or "") - GameTooltip:AddDoubleLine(lineL,lineR) - onlineFriends = true - end - end -if onlineFriends then GameTooltip:AddLine(" ") end -GameTooltip:AddDoubleLine("<Left-click>", "Open Friends List", 1, 1, 0, 1, 1, 1) ------------------------ -GameTooltip:Show() -end -end) - -friendFrame:SetScript("OnLeave", function() if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end friendIcon:SetVertexColor(unpack(cfg.color.normal)) end) - -friendFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - ToggleFriendsFrame() - end -end) - -local eventframe = CreateFrame("Frame") -eventframe:RegisterEvent("PLAYER_ENTERING_WORLD") - -eventframe:RegisterEvent("FRIENDLIST_UPDATE") -eventframe:RegisterEvent("BN_FRIEND_ACCOUNT_ONLINE") -eventframe:RegisterEvent("BN_FRIEND_ACCOUNT_OFFLINE") - -eventframe:RegisterEvent("GUILD_ROSTER_UPDATE") -eventframe:RegisterEvent("GUILD_TRADESKILL_UPDATE") -eventframe:RegisterEvent("GUILD_MOTD") -eventframe:RegisterEvent("GUILD_NEWS_UPDATE") -eventframe:RegisterEvent("PLAYER_GUILD_UPDATE") - -eventframe:SetScript("OnEvent", function(self,event, ...) - local numOnline = "" - if IsInGuild() then - _, numOnline, _ = GetNumGuildMembers() - end - guildText:SetText(numOnline) - guildTextBG:SetSize(guildText:GetWidth()+4,guildText:GetHeight()+2) - guildTextBG:SetPoint("CENTER",guildText) - - local totalBNet, numBNetOnline = BNGetNumFriends() - friendText:SetText(numBNetOnline) - - if numBNetOnline == 0 then - friendText:SetText("") - else - - end - friendTextBG:SetSize(friendText:GetWidth()+4,friendText:GetHeight()+2) - friendTextBG:SetPoint("CENTER",friendText) - -end) \ No newline at end of file diff --git a/modules/old/system.lua b/modules/old/system.lua deleted file mode 100644 index 649f9c5..0000000 --- a/modules/old/system.lua +++ /dev/null @@ -1,228 +0,0 @@ -local addon, ns = ... -local cfg = ns.cfg -local unpack = unpack --------------------------------------------------------------- -if not cfg.system.show then return end - -local onHover = false - - local memformat = function(number) - if number > 1024 then - return string.format("%.2f|r mb", (number / 1024)) - else - return string.format("%.1f|r kb", floor(number)) - end - end - -local systemFrame = CreateFrame("Frame",nil, cfg.SXframe) -systemFrame:SetPoint("RIGHT", -350,0) -systemFrame:SetSize(120, 16) ---------------------------------------------------------------------- - -local addoncompare = function(a, b) - return a.memory > b.memory -end - - local function systemBarOnEnter() - if not cfg.system.showTooltip then return end - GameTooltip:SetOwner(systemFrame, cfg.tooltipPos) - GameTooltip:AddLine("[|cff6699FFPerformance|r]") - GameTooltip:AddLine(" ") - --------------------------------------------------- - local color = { r=1, g=1, b=0 } - local blizz = collectgarbage("count") - local addons = {} - local enry, memory - local total = 0 - local nr = 0 - local numberOfAddons = 0 - UpdateAddOnMemoryUsage() - if IsShiftKeyDown() then - GameTooltip:AddLine("Top "..cfg.system.addonListShift.." AddOns", 1,1,0) - else - GameTooltip:AddLine("Top "..cfg.system.addonList.." AddOns", 1,1,0) - end - GameTooltip:AddLine(" ") - for i=1, GetNumAddOns(), 1 do - if (GetAddOnMemoryUsage(i) > 0 ) then - memory = GetAddOnMemoryUsage(i) - entry = {name = GetAddOnInfo(i), memory = memory} - table.insert(addons, entry) - total = total + memory - end - end - table.sort(addons, addoncompare) - for _, entry in pairs(addons) do - if IsShiftKeyDown() then - numberOfAddons = cfg.system.addonListShift - else - numberOfAddons = cfg.system.addonList - end - if nr < numberOfAddons then - GameTooltip:AddDoubleLine(entry.name, memformat(entry.memory), 1, 1, 0, 1, 1, 1) - nr = nr+1 - end - end - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine("Total", memformat(total), 1,1,0, 1,1,0) - GameTooltip:AddDoubleLine("Total incl. Blizzard", memformat(blizz), 1,1,0, 1,1,0) - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine("<Left-click>", "Force garbage collection", 1, 1, 0, 1, 1, 1) - if not IsShiftKeyDown() then - GameTooltip:AddDoubleLine("<Shift-hold>", "Show |cffffff00"..cfg.system.addonListShift.."|r addons", 1, 1, 0, 1, 1, 1) - end - ------------------------------------------- - GameTooltip:Show() -end - -local function systemBarOnLeave() - if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end -end - ---------------------------------------------------------------------- - -local pingFrame = CreateFrame("BUTTON","SX_pingFrame", systemFrame) -pingFrame:SetPoint("CENTER") -pingFrame:SetSize(16, 16) -pingFrame:EnableMouse(true) -pingFrame:RegisterForClicks("AnyUp") - -local pingIcon = pingFrame:CreateTexture(nil,"OVERLAY",nil,7) -pingIcon:SetSize(16, 16) -pingIcon:SetPoint("CENTER") -pingIcon:SetTexture(cfg.mediaFolder.."datatexts\\ping") -pingIcon:SetVertexColor(unpack(cfg.color.normal)) - -local pingText = pingFrame:CreateFontString(nil, "OVERLAY") -pingText:SetFont(cfg.text.font, cfg.text.normalFontSize) -pingText:SetPoint("LEFT", pingIcon,"RIGHT",2,0) -pingText:SetTextColor(unpack(cfg.color.normal)) - -pingFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - pingIcon:SetVertexColor(unpack(cfg.color.hover)) - onHover = true - systemBarOnEnter() -end) - -pingFrame:SetScript("OnLeave", function() - pingIcon:SetVertexColor(unpack(cfg.color.normal)) - onHover = false - systemBarOnLeave() -end) - -pingFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - UpdateAddOnMemoryUsage() - local before = gcinfo() - collectgarbage() - UpdateAddOnMemoryUsage() - local after = gcinfo() - print("|cff6699FFSXUI|r: Cleaned: |cffffff00"..memformat(before-after)) - elseif button == "RightButton" then - ToggleFrame(VideoOptionsFrame) - end -end) ---------------------------------------------------------------------- -local fpsFrame = CreateFrame("BUTTON",nil, systemFrame) -fpsFrame:SetPoint("LEFT") -fpsFrame:SetSize(16, 16) -fpsFrame:EnableMouse(true) -fpsFrame:RegisterForClicks("AnyUp") - -local fpsIcon = fpsFrame:CreateTexture(nil,"OVERLAY",nil,7) -fpsIcon:SetSize(16, 16) -fpsIcon:SetPoint("LEFT") -fpsIcon:SetTexture(cfg.mediaFolder.."datatexts\\fps") -fpsIcon:SetVertexColor(unpack(cfg.color.normal)) - -local fpsText = fpsFrame:CreateFontString(nil, "OVERLAY") -fpsText:SetFont(cfg.text.font, cfg.text.normalFontSize) -fpsText:SetPoint("LEFT", fpsIcon,"RIGHT",2,0) -fpsText:SetTextColor(unpack(cfg.color.normal)) - -fpsFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - fpsIcon:SetVertexColor(unpack(cfg.color.hover)) - onHover = true - systemBarOnEnter() -end) - -fpsFrame:SetScript("OnLeave", function() - fpsIcon:SetVertexColor(unpack(cfg.color.normal)) - onHover = false - systemBarOnLeave() -end) - -fpsFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - UpdateAddOnMemoryUsage() - local before = gcinfo() - collectgarbage() - UpdateAddOnMemoryUsage() - local after = gcinfo() - print("|cff6699FFSXUI|r: Cleaned: |cffffff00"..memformat(before-after)) - elseif button == "RightButton" then - ToggleFrame(VideoOptionsFrame) - end -end) ---------------------------------------------------------------------- - -local function SXUImemory() -local t = 0 -UpdateAddOnMemoryUsage() -for i=1, GetNumAddOns(), 1 do - t = t + GetAddOnMemoryUsage(i) -end -return cfg.memformat(t) - -end - -local function updatePerformanceText() - local fps = floor(GetFramerate()) - local BWIn, BWOut, LCHome, LCWorld = GetNetStats() - local pingString = LCHome.."ms"; - if cfg.system.showWorldPing then - pingString = pingString.." "..LCWorld.."ms" - end - - pingText:SetText(pingString) - pingFrame:SetSize(pingText:GetStringWidth()+18, 16) - fpsText:SetText(fps.."fps") - fpsFrame:SetSize(fpsText:GetStringWidth()+18, 16) - if onHover then - systemBarOnEnter() - end -end - -local elapsed = 0 -systemFrame:SetScript('OnUpdate', function(self, e) - elapsed = elapsed + e - if elapsed >= 1 then - updatePerformanceText() - elapsed = 0 - end -end) - -local eventframe = CreateFrame("Frame") -eventframe:RegisterEvent("MODIFIER_STATE_CHANGED") - -eventframe:SetScript("OnEvent", function(this, event, arg1, arg2, arg3, arg4, ...) - -if event == "MODIFIER_STATE_CHANGED" then - if InCombatLockdown() then return end - if arg1 == "LSHIFT" or arg1 == "RSHIFT" then - if arg2 == 1 then - if onHover then - systemBarOnEnter() - end - elseif arg2 == 0 then - if onHover then - systemBarOnEnter() - end - end - end - end -end) diff --git a/modules/old/talent.lua b/modules/old/talent.lua deleted file mode 100644 index f9f0fce..0000000 --- a/modules/old/talent.lua +++ /dev/null @@ -1,340 +0,0 @@ -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/old/tradeskill.lua b/modules/old/tradeskill.lua deleted file mode 100644 index 433d6d3..0000000 --- a/modules/old/tradeskill.lua +++ /dev/null @@ -1,292 +0,0 @@ -local addon, ns = ... -local cfg = ns.cfg -local unpack = unpack --------------------------------------------------------------- -if not cfg.tradeSkill.show then return end - -if not IsAddOnLoaded("Blizzard_TradeSkillUI") then - TradeSkillFrame_LoadUI(); -end - -local proffessions = { - ['ALCHEMY'] = {"Alchemical Catalyst", "Secrets of Draenor Alchemy", "Northrend Alchemy Research"}, - ['BLACKSMITHING'] = {"Truesteel Ignot", "Secrets of Draenor Blacksmithing"}, - ['ENCHANTING'] = {"Temporal Crystal", "Secrets of Draenor Enchanting"}, - ['ENGINEERING'] = {"Gearsoring Parts", "Secrets of Draenor Engineering"}, - ['INSCRIPTION'] = {"War Paints", "Secrets of Draenor Inscription","Draenor Merchant Order"}, - ['JEWELCRAFTING'] = {"Taladite Crystal", "Secrets of Draenor Jewelcrafting"}, - ['LEATHERWORKING'] = {"Burnished Leather", "Secrets of Draenor Leatherworking"}, - ['TAILORING'] = {"Hexweave Cloth", "Secrets of Draenor Tailoring"}, -} - -local profIcons = { - [164] = 'blacksmithing', - [165] = 'leatherworking', - [171] = 'alchemy', - [182] = 'herbalism', - [186] = 'mining', - [202] = 'engineering', - [333] = 'enchanting', - [755] = 'jewelcrafting', - [773] = 'inscription', - [197] = 'tailoring', - [393] = 'skinning' -} - -local prof1OnCooldown = false -local prof2OnCooldown = false - -local tradeSkillFrame = CreateFrame("Frame",nil, cfg.SXframe) -tradeSkillFrame:SetPoint("LEFT", cfg.SXframe, "CENTER", 110,0) -tradeSkillFrame:SetSize(16, 16) ---------------------------------------------------------------------- -local primaryTradeSkillFrame = CreateFrame("BUTTON",nil, tradeSkillFrame) -primaryTradeSkillFrame:SetSize(16, 16) -primaryTradeSkillFrame:SetPoint("LEFT") -primaryTradeSkillFrame:EnableMouse(true) -primaryTradeSkillFrame:RegisterForClicks("AnyUp") - -local primaryTradeSkillIcon = primaryTradeSkillFrame:CreateTexture(nil,"OVERLAY",nil,7) -primaryTradeSkillIcon:SetSize(16, 16) -primaryTradeSkillIcon:SetPoint("LEFT") -primaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.normal)) - -local primaryTradeSkillText = primaryTradeSkillFrame:CreateFontString(nil, "OVERLAY") -primaryTradeSkillText:SetFont(cfg.text.font, cfg.text.normalFontSize) -primaryTradeSkillText:SetPoint("RIGHT",primaryTradeSkillFrame,2,0 ) -primaryTradeSkillText:SetTextColor(unpack(cfg.color.normal)) - -local primaryTradeSkillStatusbar = CreateFrame("StatusBar", nil, primaryTradeSkillFrame) -primaryTradeSkillStatusbar:SetStatusBarTexture(1,1,1) -primaryTradeSkillStatusbar:SetStatusBarColor(unpack(cfg.color.normal)) -primaryTradeSkillStatusbar:SetPoint("TOPLEFT", primaryTradeSkillText, "BOTTOMLEFT",0,-2) - -local primaryTradeSkillStatusbarBG = primaryTradeSkillStatusbar:CreateTexture(nil,"BACKGROUND",nil,7) -primaryTradeSkillStatusbarBG:SetPoint("TOPLEFT", primaryTradeSkillText, "BOTTOMLEFT",0,-2) -primaryTradeSkillStatusbarBG:SetColorTexture(unpack(cfg.color.inactive)) - -primaryTradeSkillFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - primaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.hover)) - primaryTradeSkillStatusbar:SetStatusBarColor(unpack(cfg.color.hover)) - if not cfg.tradeSkill.showTooltip then return end - GameTooltip:SetOwner(tradeSkillFrame, cfg.tooltipPos) - addCooldownsToTooltip() - GameTooltip:Show() -end) - -primaryTradeSkillFrame:SetScript("OnLeave", function() - if prof1OnCooldown then - primaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.inactive)) - primaryTradeSkillText:SetTextColor(unpack(cfg.color.inactive)) - else - primaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.normal)) - primaryTradeSkillText:SetTextColor(unpack(cfg.color.normal)) - end - primaryTradeSkillStatusbar:SetStatusBarColor(unpack(cfg.color.normal)) - if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end -end) - -primaryTradeSkillFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - local prof1, prof2 = GetProfessions() - if prof1 then - if (GetProfessionInfo(prof1) == ('Herbalism')) then - ToggleSpellBook(BOOKTYPE_PROFESSION) - elseif(GetProfessionInfo(prof1) == ('Skinning')) then - ToggleSpellBook(BOOKTYPE_PROFESSION) - elseif(GetProfessionInfo(prof1) == ('Mining')) then - CastSpellByName("Smelting") - else - CastSpellByName((GetProfessionInfo(prof1))) - end - end - elseif button == "RightButton" then - ToggleSpellBook(BOOKTYPE_PROFESSION) - end -end) ---------------------------------------------------------------------- -local secondaryTradeSkillFrame = CreateFrame("BUTTON",nil, tradeSkillFrame) -secondaryTradeSkillFrame:SetPoint("RIGHT") -secondaryTradeSkillFrame:SetSize(16, 16) -secondaryTradeSkillFrame:EnableMouse(true) -secondaryTradeSkillFrame:RegisterForClicks("AnyUp") - -local secondaryTradeSkillIcon = secondaryTradeSkillFrame:CreateTexture(nil,"OVERLAY",nil,7) -secondaryTradeSkillIcon:SetSize(16, 16) -secondaryTradeSkillIcon:SetPoint("LEFT") -secondaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.normal)) - -local secondaryTradeSkillText = secondaryTradeSkillFrame:CreateFontString(nil, "OVERLAY") -secondaryTradeSkillText:SetFont(cfg.text.font, cfg.text.normalFontSize) -secondaryTradeSkillText:SetPoint("LEFT", secondaryTradeSkillIcon,"RIGHT",2,0) -secondaryTradeSkillText:SetTextColor(unpack(cfg.color.normal)) - -local secondaryTradeSkillStatusbar = CreateFrame("StatusBar", nil, secondaryTradeSkillFrame) -secondaryTradeSkillStatusbar:SetStatusBarTexture(1,1,1) -secondaryTradeSkillStatusbar:SetStatusBarColor(unpack(cfg.color.normal)) -secondaryTradeSkillStatusbar:SetPoint("TOPLEFT", secondaryTradeSkillText, "BOTTOMLEFT",0,-2) - -local secondaryTradeSkillStatusbarBG = secondaryTradeSkillStatusbar:CreateTexture(nil,"BACKGROUND",nil,7) -secondaryTradeSkillStatusbarBG:SetPoint("TOPLEFT", secondaryTradeSkillText, "BOTTOMLEFT",0,-2) -secondaryTradeSkillStatusbarBG:SetColorTexture(unpack(cfg.color.inactive)) - -secondaryTradeSkillFrame:SetScript("OnEnter", function() - if InCombatLockdown() then return end - secondaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.hover)) - secondaryTradeSkillStatusbar:SetStatusBarColor(unpack(cfg.color.hover)) - if not cfg.tradeSkill.showTooltip then return end - GameTooltip:SetOwner(tradeSkillFrame, cfg.tooltipPos) - addCooldownsToTooltip() - GameTooltip:Show() -end) - -secondaryTradeSkillFrame:SetScript("OnLeave", function() - if prof2OnCooldown then - secondaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.inactive)) - secondaryTradeSkillText:SetTextColor(unpack(cfg.color.inactive)) - else - secondaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.normal)) - secondaryTradeSkillText:SetTextColor(unpack(cfg.color.normal)) - end - secondaryTradeSkillStatusbar:SetStatusBarColor(unpack(cfg.color.normal)) - if ( GameTooltip:IsShown() ) then GameTooltip:Hide() end -end) - -secondaryTradeSkillFrame:SetScript("OnClick", function(self, button, down) - if InCombatLockdown() then return end - if button == "LeftButton" then - local prof1, prof2 = GetProfessions() - if prof2 then - if (GetProfessionInfo(prof2) == ('Herbalism')) then - ToggleSpellBook(BOOKTYPE_PROFESSION) - elseif(GetProfessionInfo(prof2) == ('Skinning')) then - ToggleSpellBook(BOOKTYPE_PROFESSION) - elseif(GetProfessionInfo(prof2) == ('Mining')) then - CastSpellByName("Smelting") - else - CastSpellByName((GetProfessionInfo(prof2))) - end - end - elseif button == "RightButton" then - ToggleSpellBook(BOOKTYPE_PROFESSION) - end -end) ---------------------------------------------------------------------- - -local eventframe = CreateFrame("Frame") -eventframe:RegisterEvent("PLAYER_ENTERING_WORLD") -eventframe:RegisterEvent("TRADE_SKILL_UPDATE") -eventframe:RegisterEvent("TRAINER_CLOSED") -eventframe:RegisterEvent("SPELLS_CHANGED") -eventframe:RegisterUnitEvent("UNIT_SPELLCAST_STOP", "player") - -eventframe:SetScript("OnEvent", function(self,event, ...) - local prof1, prof2 = GetProfessions() - if prof1 then - local prof1Name, _, prof1Rank, prof1MaxRank, _, _, prof1SkillLine = GetProfessionInfo(prof1) - prof1Name = string.upper(prof1Name) - primaryTradeSkillText:SetText(prof1Name) - primaryTradeSkillIcon:SetTexture(cfg.mediaFolder.."profession\\"..profIcons[prof1SkillLine]) - if prof1Rank == prof1MaxRank then - primaryTradeSkillStatusbar:Hide() - else - primaryTradeSkillStatusbar:Show() - end - primaryTradeSkillStatusbar:SetMinMaxValues(0, prof1MaxRank) - primaryTradeSkillStatusbar:SetValue(prof1Rank) - primaryTradeSkillFrame:SetSize(primaryTradeSkillText:GetStringWidth()+18, 16) - primaryTradeSkillStatusbar:SetSize(primaryTradeSkillText:GetStringWidth(),3) - primaryTradeSkillStatusbarBG:SetSize(primaryTradeSkillText:GetStringWidth(),3) - primaryTradeSkillFrame:Show() - primaryTradeSkillFrame:EnableMouse(true) - - primaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.normal)) - primaryTradeSkillText:SetTextColor(unpack(cfg.color.normal)) - - --[[for i=1,GetNumTradeSkills() do - local cooldown = GetTradeSkillCooldown(i) - if cooldown then - local name = GetTradeSkillInfo(i) - for k, v in pairs(proffessions) do - for u = 1, #v do - if k == prof1Name then - if v[u] == name then - if not prof1OnCooldown then prof1OnCooldown = true end - primaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.inactive)) - primaryTradeSkillText:SetTextColor(unpack(cfg.color.inactive)) - if not prof1OnCooldown then - primaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.normal)) - primaryTradeSkillText:SetTextColor(unpack(cfg.color.normal)) - end - end - end - end - end - end - end]]-- - else - primaryTradeSkillFrame:Hide() - primaryTradeSkillFrame:EnableMouse(false) - end - - if prof2 then - local prof2Name, _, prof2rank, prof2maxRank, _, _, prof2SkillLine = GetProfessionInfo(prof2) - prof2Name = string.upper(prof2Name) - secondaryTradeSkillText:SetText(prof2Name) - secondaryTradeSkillIcon:SetTexture(cfg.mediaFolder.."profession\\"..profIcons[prof2SkillLine]) - if prof2rank == prof2maxRank then - secondaryTradeSkillStatusbar:Hide() - else - secondaryTradeSkillStatusbar:Show() - end - secondaryTradeSkillStatusbar:SetMinMaxValues(0, prof2maxRank) - secondaryTradeSkillStatusbar:SetValue(prof2rank) - secondaryTradeSkillFrame:SetSize(secondaryTradeSkillText:GetStringWidth()+18, 16) - secondaryTradeSkillStatusbar:SetSize(secondaryTradeSkillText:GetStringWidth(),3) - secondaryTradeSkillStatusbarBG:SetSize(secondaryTradeSkillText:GetStringWidth(),3) - secondaryTradeSkillFrame:Show() - secondaryTradeSkillFrame:EnableMouse(true) - - secondaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.normal)) - secondaryTradeSkillText:SetTextColor(unpack(cfg.color.normal)) - - --[[for i=1,GetNumTradeSkills() do - local cooldown = GetTradeSkillCooldown(i) - if cooldown then - local name = GetTradeSkillInfo(i) - for k, v in pairs(proffessions) do - for u = 1, #v do - if k == prof2Name then - if v[u] == name then - if not prof2OnCooldown then prof2OnCooldown = true end - secondaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.inactive)) - secondaryTradeSkillText:SetTextColor(unpack(cfg.color.inactive)) - if not prof2OnCooldown then - secondaryTradeSkillIcon:SetVertexColor(unpack(cfg.color.normal)) - secondaryTradeSkillText:SetTextColor(unpack(cfg.color.normal)) - end - end - end - end - end - end - end]]-- - else - secondaryTradeSkillFrame:Hide() - secondaryTradeSkillFrame:EnableMouse(false) - end - tradeSkillFrame:SetSize((primaryTradeSkillFrame:GetWidth())+(secondaryTradeSkillFrame:GetWidth()+4), 16) -end) - - -function addCooldownsToTooltip() - for i,v in pairs(C_TradeSkillUI.GetFilteredRecipeIDs()) do - local _, cooldown, secondsToCooldown, dunno = C_TradeSkillUI.GetRecipeCooldown(v) - if cooldown then - local name = C_TradeSkillUI.GetRecipeInfo(v).name - GameTooltip:AddDoubleLine(name, SecondsToTime(secondsToCooldown), 1, 1, 0, 1, 1, 1) - end - end -end diff --git a/modules/system.lua b/modules/system.lua index a913020..cf6e32d 100644 --- a/modules/system.lua +++ b/modules/system.lua @@ -115,8 +115,8 @@ function SystemModule:UpdateTexts() self.fpsText:SetText(floor(GetFramerate())..FPS_ABBR) local _, _, homePing, worldPing = GetNetStats() - self.pingText:SetText(L['L']..":"..floor(homePing)..MILLISECONDS_ABBR) - self.worldPingText:SetText(L['W']..":"..floor(worldPing)..MILLISECONDS_ABBR) + self.pingText:SetText(L['L']..": "..floor(homePing)..MILLISECONDS_ABBR) + self.worldPingText:SetText(L['W']..": "..floor(worldPing)..MILLISECONDS_ABBR) end function SystemModule:CreateFrames()