This commit is contained in:
Crum
2018-11-01 22:32:19 -05:00
parent 355c8fcac2
commit 7d7fdb61ab
49 changed files with 1617 additions and 193 deletions
+48 -3
View File
@@ -38,12 +38,24 @@ function FarmMode()
if Minimap:IsShown() then if Minimap:IsShown() then
UIFrameFadeOut(Minimap, 0.3) UIFrameFadeOut(Minimap, 0.3)
UIFrameFadeIn(FarmModeMap, 0.3) UIFrameFadeIn(FarmModeMap, 0.3)
Minimap.fadeInfo.finishedFunc = function() Minimap:Hide() Minimap.backdrop:Hide() _G.MinimapZoomIn:Click() _G.MinimapZoomOut:Click() Minimap:SetAlpha(1) end Minimap.fadeInfo.finishedFunc = function()
Minimap:Hide()
Minimap.backdrop:Hide()
_G.MinimapZoomIn:Click()
_G.MinimapZoomOut:Click()
Minimap:SetAlpha(1)
end
FarmModeMap.enabled = true FarmModeMap.enabled = true
else else
UIFrameFadeOut(FarmModeMap, 0.3) UIFrameFadeOut(FarmModeMap, 0.3)
UIFrameFadeIn(Minimap, 0.3) UIFrameFadeIn(Minimap, 0.3)
FarmModeMap.fadeInfo.finishedFunc = function() FarmModeMap:Hide() Minimap.backdrop:Show() _G.MinimapZoomIn:Click() _G.MinimapZoomOut:Click() Minimap:SetAlpha(1) end FarmModeMap.fadeInfo.finishedFunc = function()
FarmModeMap:Hide()
Minimap.backdrop:Show()
_G.MinimapZoomIn:Click()
_G.MinimapZoomOut:Click()
Minimap:SetAlpha(1)
end
FarmModeMap.enabled = false FarmModeMap.enabled = false
end end
end end
@@ -75,6 +87,8 @@ function E:LuaError(msg)
msg = lower(msg) msg = lower(msg)
if msg == "on" then if msg == "on" then
DisableAllAddOns() DisableAllAddOns()
EnableAddOn("!Compatibility")
EnableAddOn("!DebugTools")
EnableAddOn("ElvUI") EnableAddOn("ElvUI")
EnableAddOn("ElvUI_Config") EnableAddOn("ElvUI_Config")
SetCVar("ShowErrors", "1") SetCVar("ShowErrors", "1")
@@ -114,7 +128,36 @@ function E:DelayScriptCall(msg)
self:Print("usage: /in <seconds> <command>") self:Print("usage: /in <seconds> <command>")
self:Print("example: /in 1.5 /say hi") self:Print("example: /in 1.5 /say hi")
else else
E:ScheduleTimer(OnCallback, secs, command) E:Delay(secs, OnCallback, command)
end
end
local BLIZZARD_ADDONS = {
"Blizzard_AuctionUI",
"Blizzard_BattlefieldMinimap",
"Blizzard_BindingUI",
"Blizzard_CombatLog",
"Blizzard_CombatText",
"Blizzard_CraftUI",
"Blizzard_GMSurveyUI",
"Blizzard_GuildBankUI",
"Blizzard_InspectUI",
"Blizzard_ItemSocketingUI",
"Blizzard_MacroUI",
"Blizzard_RaidUI",
"Blizzard_TalentUI",
"Blizzard_TimeManager",
"Blizzard_TradeSkillUI",
"Blizzard_TrainerUI"
}
function E:EnableBlizzardAddOns()
for _, addon in pairs(BLIZZARD_ADDONS) do
local reason = select(5, GetAddOnInfo(addon))
if reason == "DISABLED" then
EnableAddOn(addon)
E:Print("The following addon was re-enabled:", addon)
end
end end
end end
@@ -130,6 +173,8 @@ function E:LoadCommands()
self:RegisterChatCommand("enable", "EnableAddon") self:RegisterChatCommand("enable", "EnableAddon")
self:RegisterChatCommand("disable", "DisableAddon") self:RegisterChatCommand("disable", "DisableAddon")
self:RegisterChatCommand("farmmode", "FarmMode") self:RegisterChatCommand("farmmode", "FarmMode")
self:RegisterChatCommand("enableblizzard", "EnableBlizzardAddOns")
self:RegisterChatCommand("estatus", "ShowStatusReport")
if E:GetModule("ActionBars") and E.private.actionbar.enable then if E:GetModule("ActionBars") and E.private.actionbar.enable then
self:RegisterChatCommand("kb", E:GetModule("ActionBars").ActivateBindMode) self:RegisterChatCommand("kb", E:GetModule("ActionBars").ActivateBindMode)
+2
View File
@@ -15,4 +15,6 @@
<Script file="Cooldowns.lua"/> <Script file="Cooldowns.lua"/>
<Script file="pluginInstaller.lua"/> <Script file="pluginInstaller.lua"/>
<Script file="ClassCache.lua"/> <Script file="ClassCache.lua"/>
<Script file="StatusReport.lua"/>
<Script file="modulecopy.lua"/>
</Ui> </Ui>
+235
View File
@@ -0,0 +1,235 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
--Cache global variables
--Lua functions
local select = select
local max = math.max
--WoW API / Variables
local CreateFrame = CreateFrame
local GetAddOnInfo = GetAddOnInfo
local GetCurrentResolution = GetCurrentResolution
local GetCVar = GetCVar
local GetLocale = GetLocale
local GetNumAddOns = GetNumAddOns
local GetRealZoneText = GetRealZoneText
local GetScreenResolutions = GetScreenResolutions
local UnitLevel = UnitLevel
local function AreOtherAddOnsEnabled()
local name, loadable, reason, _
for i = 1, GetNumAddOns() do
name, _, _, loadable, reason = GetAddOnInfo(i)
if (name ~= "ElvUI" and name ~= "ElvUI_Config" and name ~= "!Compatibility" and name ~= "!DebugTools") and (loadable or (not loadable and reason == "DEMAND_LOADED")) then --Loaded or load on demand
return "Yes"
end
end
return "No"
end
local function GetUiScale()
local uiScale = GetCVar("uiScale")
local minUiScale = E.global.general.minUiScale
return max(uiScale, minUiScale)
end
local function GetDisplayMode()
local window, maximize = GetCVar("gxWindow"), GetCVar("gxMaximize")
local displayMode
if window == "1" then
if maximize == "1" then
displayMode = "Windowed (Fullscreen)"
else
displayMode = "Windowed"
end
else
displayMode = "Fullscreen"
end
return displayMode
end
local EnglishClassName = {
["DRUID"] = "Druid",
["HUNTER"] = "Hunter",
["MAGE"] = "Mage",
["PALADIN"] = "Paladin",
["PRIEST"] = "Priest",
["ROGUE"] = "Rogue",
["SHAMAN"] = "Shaman",
["WARLOCK"] = "Warlock",
["WARRIOR"] = "Warrior"
}
local function GetResolution()
return (({GetScreenResolutions()})[GetCurrentResolution()] or GetCVar("gxWindowedResolution"))
end
function E:CreateStatusFrame()
local function CreateSection(width, height, parent, anchor1, anchorTo, anchor2, yOffset)
local section = CreateFrame("Frame", nil, parent)
E:Size(section, width, height)
E:Point(section, anchor1, anchorTo, anchor2, 0, yOffset)
section.Header = CreateFrame("Frame", nil, section)
E:Size(section.Header, 300, 30)
E:Point(section.Header, "TOP", section)
section.Header.Text = section.Header:CreateFontString(nil, "ARTWORK", "SystemFont")
E:Point(section.Header.Text, "TOP")
E:Point(section.Header.Text, "BOTTOM")
section.Header.Text:SetJustifyH("CENTER")
section.Header.Text:SetJustifyV("MIDDLE")
local font, height, flags = section.Header.Text:GetFont()
section.Header.Text:SetFont(font, height*1.3, flags)
section.Header.LeftDivider = section.Header:CreateTexture(nil, "ARTWORK")
E:Height(section.Header.LeftDivider, 8)
E:Point(section.Header.LeftDivider, "LEFT", section.Header, "LEFT", 5, 0)
E:Point(section.Header.LeftDivider, "RIGHT", section.Header.Text, "LEFT", -5, 0)
section.Header.LeftDivider:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
section.Header.LeftDivider:SetTexCoord(0.81, 0.94, 0.5, 1)
section.Header.RightDivider = section.Header:CreateTexture(nil, "ARTWORK")
E:Height(section.Header.RightDivider, 8)
E:Point(section.Header.RightDivider, "RIGHT", section.Header, "RIGHT", -5, 0)
E:Point(section.Header.RightDivider, "LEFT", section.Header.Text, "RIGHT", 5, 0)
section.Header.RightDivider:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
section.Header.RightDivider:SetTexCoord(0.81, 0.94, 0.5, 1)
return section
end
local function CreateContentLines(num, parent, anchorTo)
local content = CreateFrame("Frame", nil, parent)
E:Size(content, 240, (num * 20) + ((num - 1) * 5)) --20 height and 5 spacing
E:Point(content, "TOP", anchorTo, "BOTTOM", 0, -5)
for i = 1, num do
local line = CreateFrame("Frame", nil, content)
E:Size(line, 240, 20)
line.Text = line:CreateFontString(nil, "ARTWORK", "SystemFont")
line.Text:SetTextColor(1, 1, 1)
line.Text:SetAllPoints()
line.Text:SetJustifyH("LEFT")
line.Text:SetJustifyV("MIDDLE")
content["Line"..i] = line
if i == 1 then
E:Point(content["Line"..i], "TOP", content, "TOP")
else
E:Point(content["Line"..i], "TOP", content["Line"..(i - 1)], "BOTTOM", 0, -5)
end
end
return content
end
--Main frame
local StatusFrame = CreateFrame("Frame", "ElvUIStatusReport", E.UIParent)
E:Size(StatusFrame, 300, 640)
E:Point(StatusFrame, "CENTER", E.UIParent, "CENTER")
StatusFrame:SetFrameStrata("HIGH")
E:CreateBackdrop(StatusFrame, "Transparent", nil, true)
StatusFrame:Hide()
E:CreateCloseButton(StatusFrame)
StatusFrame:SetClampedToScreen(true)
StatusFrame:SetMovable(true)
StatusFrame:EnableMouse(true)
StatusFrame:RegisterForDrag("LeftButton", "RightButton")
StatusFrame:SetScript("OnDragStart", function()
this:StartMoving()
end)
StatusFrame:SetScript("OnDragStop", function()
this:StopMovingOrSizing()
end)
--Title logo
StatusFrame.TitleLogoFrame = CreateFrame("Frame", nil, StatusFrame)
E:Size(StatusFrame.TitleLogoFrame, 128, 64)
E:Point(StatusFrame.TitleLogoFrame, "CENTER", StatusFrame, "TOP", 0, 0)
StatusFrame.TitleLogoFrame.Texture = StatusFrame.TitleLogoFrame:CreateTexture(nil, "ARTWORK")
StatusFrame.TitleLogoFrame.Texture:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\logo.tga")
StatusFrame.TitleLogoFrame.Texture:SetAllPoints()
--Sections
StatusFrame.Section1 = CreateSection(300, 150, StatusFrame, "TOP", StatusFrame, "TOP", -30)
StatusFrame.Section2 = CreateSection(300, 175, StatusFrame, "TOP", StatusFrame.Section1, "BOTTOM", 0)
StatusFrame.Section3 = CreateSection(300, 220, StatusFrame, "TOP", StatusFrame.Section2, "BOTTOM", 0)
StatusFrame.Section4 = CreateSection(300, 60, StatusFrame, "TOP", StatusFrame.Section3, "BOTTOM", 0)
--Section headers
StatusFrame.Section1.Header.Text:SetText("|cfffe7b2cAddOn Info|r")
StatusFrame.Section2.Header.Text:SetText("|cfffe7b2cWoW Info|r")
StatusFrame.Section3.Header.Text:SetText("|cfffe7b2cCharacter Info|r")
StatusFrame.Section4.Header.Text:SetText("|cfffe7b2cExport To|r")
--Section content
StatusFrame.Section1.Content = CreateContentLines(4, StatusFrame.Section1, StatusFrame.Section1.Header)
StatusFrame.Section2.Content = CreateContentLines(5, StatusFrame.Section2, StatusFrame.Section2.Header)
StatusFrame.Section3.Content = CreateContentLines(7, StatusFrame.Section3, StatusFrame.Section3.Header)
StatusFrame.Section4.Content = CreateFrame("Frame", nil, StatusFrame.Section4)
E:Size(StatusFrame.Section4.Content, 240, 25)
E:Point(StatusFrame.Section4.Content, "TOP", StatusFrame.Section4.Header, "BOTTOM", 0, 0)
--Content lines
StatusFrame.Section1.Content.Line1.Text:SetText(format("Version of ElvUI: |cff4beb2c%s|r", E.version))
StatusFrame.Section1.Content.Line2.Text:SetText(format("Other AddOns Enabled: |cff4beb2c%s|r", AreOtherAddOnsEnabled()))
StatusFrame.Section1.Content.Line3.Text:SetText(format("Auto Scale Enabled: |cff4beb2c%s|r", (E.global.general.autoScale == true and "Yes" or "No")))
StatusFrame.Section1.Content.Line4.Text:SetText(format("UI Scale Is: |cff4beb2c%.4f|r", GetUiScale()))
StatusFrame.Section2.Content.Line1.Text:SetText(format("Version of WoW: |cff4beb2c%s (build %s)|r", E.wowpatch, E.wowbuild))
StatusFrame.Section2.Content.Line2.Text:SetText(format("Client Language: |cff4beb2c%s|r", GetLocale()))
StatusFrame.Section2.Content.Line3.Text:SetText(format("Display Mode: |cff4beb2c%s|r", GetDisplayMode()))
StatusFrame.Section2.Content.Line4.Text:SetText(format("Resolution: |cff4beb2c%s|r", GetResolution()))
StatusFrame.Section2.Content.Line5.Text:SetText(format("Using Mac Client: |cff4beb2c%s|r", (E.isMacClient == true and "Yes" or "No")))
StatusFrame.Section3.Content.Line1.Text:SetText(format("Faction: |cff4beb2c%s|r", E.myfaction))
StatusFrame.Section3.Content.Line2.Text:SetText(format("Race: |cff4beb2c%s|r", E.myrace))
StatusFrame.Section3.Content.Line3.Text:SetText(format("Class: |cff4beb2c%s|r", EnglishClassName[E.myclass]))
StatusFrame.Section3.Content.Line4.Text:SetText(format("Specialization: |cff4beb2c%s|r", select(2, E:GetTalentSpecInfo())))
StatusFrame.Section3.Content.Line5.Text:SetText(format("Level: |cff4beb2c%s|r", UnitLevel("player")))
StatusFrame.Section3.Content.Line6.Text:SetText(format("Zone: |cff4beb2c%s|r", GetRealZoneText()))
StatusFrame.Section3.Content.Line7.Text:SetText(format("Realm: |cff4beb2c%s|r", E.myrealm))
--Export buttons
StatusFrame.Section4.Content.Button1 = CreateFrame("Button", nil, StatusFrame.Section4.Content, "UIPanelButtonTemplate")
E:Size(StatusFrame.Section4.Content.Button1, 100, 25)
E:Point(StatusFrame.Section4.Content.Button1, "LEFT", StatusFrame.Section4.Content, "LEFT")
StatusFrame.Section4.Content.Button1:SetText("Forum")
StatusFrame.Section4.Content.Button1:SetButtonState("DISABLED")
E:GetModule("Skins"):HandleButton(StatusFrame.Section4.Content.Button1, true)
StatusFrame.Section4.Content.Button2 = CreateFrame("Button", nil, StatusFrame.Section4.Content, "UIPanelButtonTemplate")
E:Size(StatusFrame.Section4.Content.Button2, 100, 25)
E:Point(StatusFrame.Section4.Content.Button2, "RIGHT", StatusFrame.Section4.Content, "RIGHT")
StatusFrame.Section4.Content.Button2:SetText("Ticket")
StatusFrame.Section4.Content.Button2:SetButtonState("DISABLED")
E:GetModule("Skins"):HandleButton(StatusFrame.Section4.Content.Button2, true)
E.StatusFrame = StatusFrame
end
local function UpdateDynamicValues()
E.StatusFrame.Section2.Content.Line3.Text:SetText(format("Display Mode: |cff4beb2c%s|r", GetDisplayMode()))
E.StatusFrame.Section2.Content.Line4.Text:SetText(format("Resolution: |cff4beb2c%s|r", GetResolution()))
E.StatusFrame.Section3.Content.Line4.Text:SetText(format("Specialization: |cff4beb2c%s|r", select(2, E:GetTalentSpecInfo())))
E.StatusFrame.Section3.Content.Line5.Text:SetText(format("Level: |cff4beb2c%s|r", UnitLevel("player")))
E.StatusFrame.Section3.Content.Line6.Text:SetText(format("Zone: |cff4beb2c%s|r", GetRealZoneText()))
end
function E:ShowStatusReport()
if not self.StatusFrame then
self:CreateStatusFrame()
end
if not self.StatusFrame:IsShown() then
UpdateDynamicValues()
self.StatusFrame:Raise() --Set framelevel above everything else
self.StatusFrame:Show()
else
self.StatusFrame:Hide()
end
end
+140 -106
View File
@@ -18,24 +18,24 @@ local IsAddOnLoaded = IsAddOnLoaded
local IsInInstance, GetNumPartyMembers, GetNumRaidMembers = IsInInstance, GetNumPartyMembers, GetNumRaidMembers local IsInInstance, GetNumPartyMembers, GetNumRaidMembers = IsInInstance, GetNumPartyMembers, GetNumRaidMembers
local RequestBattlefieldScoreData = RequestBattlefieldScoreData local RequestBattlefieldScoreData = RequestBattlefieldScoreData
local SendAddonMessage = SendAddonMessage local SendAddonMessage = SendAddonMessage
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS local NONE = NONE
local RAID_CLASS_COLORS = RAID_CLASS_COLORS local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local _ -- Constants
_, E.myclass = UnitClass("player") -- Constants
_, E.myrace = UnitRace("player")
_, E.myfaction = UnitFactionGroup("player")
-- The E.myfaction may error when in GM mode
E.myfaction = E.myfaction or "Others"
E.myname = UnitName("player")
E.version = GetAddOnMetadata("ElvUI", "Version")
E.myrealm = GetRealmName()
_, E.wowbuild = GetBuildInfo() E.wowbuild = tonumber(E.wowbuild)
E.resolution = GetCVar("gxResolution")
E.screenheight = tonumber(match(E.resolution, "%d+x(%d+)"));
E.screenwidth = tonumber(match(E.resolution, "(%d+)x+%d"));
E.isMacClient = IsMacClient()
E.LSM = LSM E.LSM = LSM
E.noop = function() end
E.title = format("|cff175581E|r|cffC4C4C4lvUI|r")
E.myfaction, E.myLocalizedFaction = UnitFactionGroup("player")
E.myLocalizedClass, E.myclass, E.myClassID = UnitClass("player")
E.myLocalizedRace, E.myrace = UnitRace("player")
E.myname = UnitName("player")
E.myrealm = GetRealmName()
E.version = GetAddOnMetadata("ElvUI", "Version")
E.wowpatch, E.wowbuild = GetBuildInfo() E.wowbuild = tonumber(E.wowbuild)
E.resolution = GetCVar("gxResolution")
E.screenheight = tonumber(match(E.resolution, "%d+x(%d+)"))
E.screenwidth = tonumber(match(E.resolution, "(%d+)x+%d"))
E.isMacClient = IsMacClient()
E["media"] = {} E["media"] = {}
E["frames"] = {} E["frames"] = {}
@@ -85,14 +85,7 @@ E.DispelClasses = {
["DRUID"] = { ["DRUID"] = {
["Curse"] = true, ["Curse"] = true,
["Poison"] = true ["Poison"] = true
},
} }
E.HealingClasses = {
PALADIN = 1,
SHAMAN = 3,
DRUID = 3,
PRIEST = {1, 2}
} }
E.ClassRole = { E.ClassRole = {
@@ -123,19 +116,13 @@ E.ClassRole = {
} }
} }
E.DEFAULT_FILTER = { E.DEFAULT_FILTER = {}
["CCDebuffs"] = "Whitelist", for filter, tbl in pairs(G.unitframe.aurafilters) do
["TurtleBuffs"] = "Whitelist", E.DEFAULT_FILTER[filter] = tbl.type
["PlayerBuffs"] = "Whitelist", end
["Blacklist"] = "Blacklist",
["Whitelist"] = "Whitelist",
["RaidDebuffs"] = "Whitelist",
}
E.noop = function() end
local colorizedName local colorizedName
function E:ColorizedName(name, colon) function E:ColorizedName(name, arg2)
local length = len(name) local length = len(name)
for i = 1, length do for i = 1, length do
local letter = sub(name, i, i) local letter = sub(name, i, i)
@@ -143,7 +130,7 @@ function E:ColorizedName(name, colon)
colorizedName = format("|cff175581%s", letter) colorizedName = format("|cff175581%s", letter)
elseif i == 2 then elseif i == 2 then
colorizedName = format("%s|r|cffC4C4C4%s", colorizedName, letter) colorizedName = format("%s|r|cffC4C4C4%s", colorizedName, letter)
elseif i == length and colon then elseif i == length and arg2 then
colorizedName = format("%s%s|r|cff175581:|r", colorizedName, letter) colorizedName = format("%s%s|r|cff175581:|r", colorizedName, letter)
else else
colorizedName = colorizedName..letter colorizedName = colorizedName..letter
@@ -153,7 +140,7 @@ function E:ColorizedName(name, colon)
end end
function E:Print(msg) function E:Print(msg)
print(self:ColorizedName("ElvUI", true), msg) print(_G[self.db.general.messageRedirect] or DEFAULT_CHAT_FRAME):AddMessage(strjoin("", self:ColorizedName("ElvUI", true), msg)) -- I put DEFAULT_CHAT_FRAME as a fail safe.
end end
E.PriestColors = { E.PriestColors = {
@@ -162,19 +149,21 @@ E.PriestColors = {
b = 0.99 b = 0.99
} }
function E:GetPlayerRole() local delayedTimer
local assignedRole = UnitGroupRolesAssigned("player") local delayedFuncs = {}
if assignedRole == "NONE" or not assignedRole then function E:ShapeshiftDelayedUpdate(func, ...)
if self.HealingClasses[self.myclass] ~= nil and self:CheckTalentTree(self.HealingClasses[E.myclass]) then delayedFuncs[func] = {unpack(arg)}
return "HEALER"
elseif E.Role == "Tank" then if delayedTimer then return end
return "TANK"
else delayedTimer = E:ScheduleTimer(function()
return "DAMAGER" for func in pairs(delayedFuncs) do
end func(unpack(delayedFuncs[func]))
else
return assignedRole
end end
twipe(delayedFuncs)
delayedTimer = nil
end, 0.05)
end end
function E:CheckClassColor(r, g, b) function E:CheckClassColor(r, g, b)
@@ -205,7 +194,7 @@ function E:GetColorTable(data)
end end
function E:UpdateMedia() function E:UpdateMedia()
if (not self.db["general"] or not self.private["general"]) then return end if not (self.db and self.db["general"] and self.private["general"]) then return end
-- Fonts -- Fonts
self["media"].normFont = LSM:Fetch("font", self.db["general"].font) self["media"].normFont = LSM:Fetch("font", self.db["general"].font)
@@ -271,7 +260,7 @@ end
local function LSMCallback() local function LSMCallback()
E:UpdateMedia() E:UpdateMedia()
end end
E.LSM.RegisterCallback(E, "LibSharedMedia_Registered", LSMCallback) LSM.RegisterCallback(E, "LibSharedMedia_Registered", LSMCallback)
local LBF = LibStub("LibButtonFacade", true) local LBF = LibStub("LibButtonFacade", true)
@@ -282,6 +271,7 @@ local LBFGroupToTableElement = {
function E:LBFCallback(SkinID, _, _, Group) function E:LBFCallback(SkinID, _, _, Group)
if not E.private then return end if not E.private then return end
local element = LBFGroupToTableElement[Group] local element = LBFGroupToTableElement[Group]
if element then if element then
if E.private[element].lbf.enable then if E.private[element].lbf.enable then
@@ -299,11 +289,11 @@ function E:RequestBGInfo()
end end
function E:PLAYER_ENTERING_WORLD() function E:PLAYER_ENTERING_WORLD()
-- self:ScheduleTimer("CheckRole", 0.01)
if not self.MediaUpdated then if not self.MediaUpdated then
self:UpdateMedia() self:UpdateMedia()
self.MediaUpdated = true self.MediaUpdated = true
-- else
-- self:ScheduleTimer("CheckRole", 0.01)
end end
local _, instanceType = IsInInstance() local _, instanceType = IsInInstance()
@@ -426,7 +416,7 @@ E.UIParent:SetFrameLevel(UIParent:GetFrameLevel())
E.UIParent:SetPoint("CENTER", UIParent, "CENTER") E.UIParent:SetPoint("CENTER", UIParent, "CENTER")
E.UIParent:SetHeight(GetScreenHeight()) E.UIParent:SetHeight(GetScreenHeight())
E.UIParent:SetWidth(GetScreenWidth()) E.UIParent:SetWidth(GetScreenWidth())
tinsert(E["snapBars"], E.UIParent) E["snapBars"][getn(E["snapBars"]) + 1] = E.UIParent
E.HiddenFrame = CreateFrame("Frame") E.HiddenFrame = CreateFrame("Frame")
E.HiddenFrame:Hide() E.HiddenFrame:Hide()
@@ -439,11 +429,11 @@ function E:IsDispellableByMe(debuffType)
end end
end end
function E:GetTalentSpecInfo() function E:GetTalentSpecInfo(isInspect)
local maxPoints, specIdx, specName, specIcon = 0, 0 local maxPoints, specIdx, specName, specIcon = 0, 0
for i = 1, 3 do for i = 1, 3 do
local name, icon, pointsSpent = GetTalentTabInfo(i) local name, icon, pointsSpent = GetTalentTabInfo(i, isInspect)
if maxPoints < pointsSpent then if maxPoints < pointsSpent then
maxPoints = pointsSpent maxPoints = pointsSpent
specIdx = i specIdx = i
@@ -453,7 +443,7 @@ function E:GetTalentSpecInfo()
end end
if not specName then if not specName then
specName = "None" specName = NONE
end end
if not specIcon then if not specIcon then
specIcon = "Interface\\Icons\\INV_Misc_QuestionMark" specIcon = "Interface\\Icons\\INV_Misc_QuestionMark"
@@ -462,19 +452,6 @@ function E:GetTalentSpecInfo()
return specIdx, specName, specIcon return specIdx, specName, specIcon
end end
function E:CheckTalentTree(tree)
local talentTree = self.TalentTree
if not talentTree then return false end
if type(tree) == "number" then
return tree == talentTree
elseif type(tree) == "table" then
for _, index in pairs(tree) do
return index == talentTree
end
end
end
function E:CheckRole() function E:CheckRole()
local talentTree = self:GetTalentSpecInfo() local talentTree = self:GetTalentSpecInfo()
local role local role
@@ -602,6 +579,38 @@ function E:RemoveTableDuplicates(cleanTable, checkTable)
return cleaned return cleaned
end end
--Compare 2 tables and remove blacklisted key/value pairs
--param cleanTable : table you want cleaned
--param blacklistTable : table you want to check against.
--return : a copy of cleanTable with blacklisted key/value pairs removed
function E:FilterTableFromBlacklist(cleanTable, blacklistTable)
if type(cleanTable) ~= "table" then
E:Print("Bad argument #1 to 'FilterTableFromBlacklist' (table expected)")
return
end
if type(blacklistTable) ~= "table" then
E:Print("Bad argument #2 to 'FilterTableFromBlacklist' (table expected)")
return
end
local cleaned = {}
for option, value in pairs(cleanTable) do
if type(value) == "table" and blacklistTable[option] and type(blacklistTable[option]) == "table" then
cleaned[option] = self:FilterTableFromBlacklist(value, blacklistTable[option])
else
-- Filter out blacklisted keys
if blacklistTable[option] ~= true then
cleaned[option] = value
end
end
end
--Clean out empty sub-tables
self:RemoveEmptySubTables(cleaned)
return cleaned
end
function E:TableToLuaString(inTable) function E:TableToLuaString(inTable)
if type(inTable) ~= "table" then if type(inTable) ~= "table" then
E:Print("Invalid argument #1 to E:TableToLuaString (table expected)") E:Print("Invalid argument #1 to E:TableToLuaString (table expected)")
@@ -651,18 +660,15 @@ local profileFormat = {
["profile"] = "E.db", ["profile"] = "E.db",
["private"] = "E.private", ["private"] = "E.private",
["global"] = "E.global", ["global"] = "E.global",
["filtersNP"] = "E.global", ["filters"] = "E.global",
["filtersUF"] = "E.global", ["styleFilters"] = "E.global"
["filtersAll"] = "E.global"
} }
local lineStructureTable = {} local lineStructureTable = {}
function E:ProfileTableToPluginFormat(inTable, profileType) function E:ProfileTableToPluginFormat(inTable, profileType)
local profileText = profileFormat[profileType] local profileText = profileFormat[profileType]
if not profileText then if not profileText then return end
return
end
twipe(lineStructureTable) twipe(lineStructureTable)
local returnString = "" local returnString = ""
@@ -739,7 +745,7 @@ function E:StringSplitMultiDelim(s, delim)
local start = 1 local start = 1
local t = {} local t = {}
while true do while(true) do
local pos = find(s, delim, start, true) local pos = find(s, delim, start, true)
if not pos then if not pos then
break break
@@ -754,53 +760,61 @@ function E:StringSplitMultiDelim(s, delim)
return unpack(t) return unpack(t)
end end
local SendMessageTimer -- prevent setting multiple timers at once
function E:SendMessage() function E:SendMessage()
local numParty, numRaid = GetNumPartyMembers(), GetNumRaidMembers() local numRaid, numParty = GetNumRaidMembers(), GetNumPartyMembers()
local inInstance, instanceType = IsInInstance() if numRaid > 1 then
if inInstance and (instanceType == "pvp") then local _, instanceType = IsInInstance()
if instanceType == "pvp" then
SendAddonMessage("ELVUI_VERSIONCHK", E.version, "BATTLEGROUND") SendAddonMessage("ELVUI_VERSIONCHK", E.version, "BATTLEGROUND")
else else
if numRaid > 0 then
SendAddonMessage("ELVUI_VERSIONCHK", E.version, "RAID") SendAddonMessage("ELVUI_VERSIONCHK", E.version, "RAID")
end
elseif numParty > 0 then elseif numParty > 0 then
SendAddonMessage("ELVUI_VERSIONCHK", E.version, "PARTY") SendAddonMessage("ELVUI_VERSIONCHK", E.version, "PARTY")
end elseif IsInGuild() then
SendAddonMessage("ELVUI_VERSIONCHK", E.version, "GUILD")
end end
if E.SendMSGTimer then SendMessageTimer = nil
self:CancelTimer(E.SendMSGTimer)
E.SendMSGTimer = nil
end
end end
local SendRecieveGroupSize local SendRecieveGroupSize = 0
local function SendRecieve() local function SendRecieve()
if not E.global.general.versionCheck then return end
if event == "CHAT_MSG_ADDON" then if event == "CHAT_MSG_ADDON" then
if arg1 ~= "ELVUI_VERSIONCHK" then return end if sender == E.myname then return end
if not arg4 or arg4 == E.myname or E.recievedOutOfDateMessage then return end
arg2 = tonumber(arg2) if prefix == "ELVUI_VERSIONCHK" then
local msg, ver = tonumber(message), tonumber(E.version)
if msg and (msg > ver) then -- you're outdated D:
if not E.recievedOutOfDateMessage then
E:Print(L["ElvUI is out of date. You can download the newest version from https://github.com/ElvUI-TBC/ElvUI/"])
if arg2 and arg2 > tonumber(E.version) then if msg and ((msg - ver) >= 0.01) then
E:Print(L["ElvUI is out of date. You can download the newest version from https://github.com/ElvUI-Vanilla/ElvUI/"])
if arg2 - tonumber(E.version) >= 0.05 then
E:StaticPopup_Show("ELVUI_UPDATE_AVAILABLE") E:StaticPopup_Show("ELVUI_UPDATE_AVAILABLE")
end end
E.recievedOutOfDateMessage = true E.recievedOutOfDateMessage = true
end end
else elseif msg and (msg < ver) then -- Send Message Back if you intercept and are higher revision
if not SendMessageTimer then
SendMessageTimer = E:ScheduleTimer("SendMessage", 10)
end
end
end
elseif event == "PARTY_MEMBERS_CHANGED" or event == "RAID_ROSTER_UPDATE" then
local numRaid, numParty = GetNumRaidMembers(), GetNumPartyMembers() + 1 local numRaid, numParty = GetNumRaidMembers(), GetNumPartyMembers() + 1
local num = numRaid > 0 and numRaid or numParty local num = numRaid > 0 and numRaid or numParty
if num ~= SendRecieveGroupSize then if num ~= SendRecieveGroupSize then
if num > 1 and SendRecieveGroupSize and num > SendRecieveGroupSize then if num > 1 and num > SendRecieveGroupSize then
E.SendMSGTimer = E:ScheduleTimer("SendMessage", 12) if not SendMessageTimer then
SendMessageTimer = E:ScheduleTimer("SendMessage", 10)
end
end end
SendRecieveGroupSize = num SendRecieveGroupSize = num
end end
elseif not SendMessageTimer then
SendMessageTimer = E:ScheduleTimer("SendMessage", 10)
end end
end end
@@ -808,6 +822,7 @@ local f = CreateFrame("Frame")
f:RegisterEvent("RAID_ROSTER_UPDATE") f:RegisterEvent("RAID_ROSTER_UPDATE")
f:RegisterEvent("PARTY_MEMBERS_CHANGED") f:RegisterEvent("PARTY_MEMBERS_CHANGED")
f:RegisterEvent("CHAT_MSG_ADDON") f:RegisterEvent("CHAT_MSG_ADDON")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", SendRecieve) f:SetScript("OnEvent", SendRecieve)
function E:UpdateAll(ignoreInstall) function E:UpdateAll(ignoreInstall)
@@ -819,7 +834,7 @@ function E:UpdateAll(ignoreInstall)
self:SetMoversPositions() self:SetMoversPositions()
self:UpdateMedia() self:UpdateMedia()
self:UpdateCooldownSettings() self:UpdateCooldownSettings("all")
local UF = self:GetModule("UnitFrames") local UF = self:GetModule("UnitFrames")
UF.db = self.db.unitframe UF.db = self.db.unitframe
@@ -835,6 +850,7 @@ function E:UpdateAll(ignoreInstall)
AB.db = self.db.actionbar AB.db = self.db.actionbar
AB:UpdateButtonSettings() AB:UpdateButtonSettings()
AB:UpdateMicroPositionDimensions() AB:UpdateMicroPositionDimensions()
AB:ToggleDesaturation()
local bags = E:GetModule("Bags") local bags = E:GetModule("Bags")
bags.db = self.db.bags bags.db = self.db.bags
@@ -844,6 +860,11 @@ function E:UpdateAll(ignoreInstall)
bags:UpdateItemLevelDisplay() bags:UpdateItemLevelDisplay()
bags:UpdateCountDisplay() bags:UpdateCountDisplay()
local totems = E:GetModule("Totems")
totems.db = self.db.general.totems
totems:PositionAndSize()
totems:ToggleEnable()
self:GetModule("Layout"):ToggleChatPanels() self:GetModule("Layout"):ToggleChatPanels()
local DT = self:GetModule("DataTexts") local DT = self:GetModule("DataTexts")
@@ -852,6 +873,7 @@ function E:UpdateAll(ignoreInstall)
local NP = self:GetModule("NamePlates") local NP = self:GetModule("NamePlates")
NP.db = self.db.nameplates NP.db = self.db.nameplates
NP:StyleFilterInitializeAllFilters()
NP:ConfigureAll() NP:ConfigureAll()
local DataBars = self:GetModule("DataBars") local DataBars = self:GetModule("DataBars")
@@ -860,16 +882,21 @@ function E:UpdateAll(ignoreInstall)
DataBars:EnableDisable_ExperienceBar() DataBars:EnableDisable_ExperienceBar()
DataBars:EnableDisable_ReputationBar() DataBars:EnableDisable_ReputationBar()
local T = self:GetModule("Threat")
T.db = self.db.general.threat
T:UpdatePosition()
T:ToggleEnable()
self:GetModule("Auras").db = self.db.auras self:GetModule("Auras").db = self.db.auras
self:GetModule("Tooltip").db = self.db.tooltip self:GetModule("Tooltip").db = self.db.tooltip
if ElvUIPlayerBuffs then -- if ElvUIPlayerBuffs then
E:GetModule("Auras"):UpdateHeader(ElvUIPlayerBuffs) -- E:GetModule("Auras"):UpdateHeader(ElvUIPlayerBuffs)
end -- end
if ElvUIPlayerDebuffs then -- if ElvUIPlayerDebuffs then
E:GetModule("Auras"):UpdateHeader(ElvUIPlayerDebuffs) -- E:GetModule("Auras"):UpdateHeader(ElvUIPlayerDebuffs)
end -- end
if not (self.private.install_complete or ignoreInstall) then if not (self.private.install_complete or ignoreInstall) then
self:Install() self:Install()
@@ -890,7 +917,7 @@ function E:UpdateAll(ignoreInstall)
LO:TopPanelVisibility() LO:TopPanelVisibility()
LO:SetDataPanelStyle() LO:SetDataPanelStyle()
self:GetModule("Blizzard"):SetWatchFrameHeight() collectgarbage("collect")
end end
function E:ResetAllUI() function E:ResetAllUI()
@@ -1056,6 +1083,9 @@ function E:GetTopCPUFunc(msg)
E:Print("cpuusage: module (arg1) is required! This can be set as 'all' too.") E:Print("cpuusage: module (arg1) is required! This can be set as 'all' too.")
return return
end end
local module, showall, delay, minCalls = msg:match("^(%S+)%s*(%S*)%s*(%S*)%s*(.*)$")
local checkCore, mod = (not module or module == "") and "E"
showall = (showall == "true" and true) or false showall = (showall == "true" and true) or false
delay = (delay == "nil" and nil) or tonumber(delay) or 5 delay = (delay == "nil" and nil) or tonumber(delay) or 5
minCalls = (minCalls == "nil" and nil) or tonumber(minCalls) or 15 minCalls = (minCalls == "nil" and nil) or tonumber(minCalls) or 15
@@ -1092,6 +1122,7 @@ function E:Initialize()
self.data.RegisterCallback(self, "OnProfileChanged", "UpdateAll") self.data.RegisterCallback(self, "OnProfileChanged", "UpdateAll")
self.data.RegisterCallback(self, "OnProfileCopied", "UpdateAll") self.data.RegisterCallback(self, "OnProfileCopied", "UpdateAll")
self.data.RegisterCallback(self, "OnProfileReset", "OnProfileReset") self.data.RegisterCallback(self, "OnProfileReset", "OnProfileReset")
self.charSettings = LibStub("AceDB-3.0"):New("ElvPrivateDB", self.privateVars) self.charSettings = LibStub("AceDB-3.0"):New("ElvPrivateDB", self.privateVars)
self.private = self.charSettings.profile self.private = self.charSettings.profile
self.db = self.data.profile self.db = self.data.profile
@@ -1105,7 +1136,7 @@ function E:Initialize()
self:LoadCommands() self:LoadCommands()
self:InitializeModules() self:InitializeModules()
self:LoadMovers() self:LoadMovers()
self:UpdateCooldownSettings() self:UpdateCooldownSettings("all")
self.initialized = true self.initialized = true
if self.private.install_complete == nil then if self.private.install_complete == nil then
@@ -1122,6 +1153,9 @@ function E:Initialize()
self:UpdateMedia() self:UpdateMedia()
self:UpdateFrameTemplates() self:UpdateFrameTemplates()
self:UpdateBorderColors()
self:UpdateBackdropColors()
self:UpdateStatusBars()
-- self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", "CheckRole") -- self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", "CheckRole")
-- self:RegisterEvent("CHARACTER_POINTS_CHANGED", "CheckRole") -- self:RegisterEvent("CHARACTER_POINTS_CHANGED", "CheckRole")
self:RegisterEvent("CVAR_UPDATE", "UIScale") self:RegisterEvent("CVAR_UPDATE", "UIScale")
+276
View File
@@ -0,0 +1,276 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local CP = E:NewModule("CopyProfile", "AceEvent-3.0","AceTimer-3.0","AceComm-3.0","AceSerializer-3.0")
--Cache global variables
--Lua functions
local pairs, next, type = pairs, next, type
local format, error = format, error
local getn = table.getn
--WoW API / Variables
--This table to reserve settings names in E.global.profileCopy. Used in export/imports functions
--Pligins can add own values for their internal settings for safechecks here
CP.InternalOptions = {
["selected"] = true,
["movers"] = true
}
--Default template for a config group for a single module.
--Contains header, general group toggle (shown only if the setting actually exists) and imports button.
--Usage as seen in ElvUI_Config\modulecopy.lua
function CP:CreateModuleConfigGroup(Name, section, pluginSection)
local config = {
order = 10,
type = "group",
name = Name,
args = {
header = {
order = 0,
type = "header",
name = Name
},
general = {
order = 1,
type = "toggle",
name = GENERAL
},
PreButtonSpacer = {
order = 200,
type = "description",
name = ""
},
import = {
order = 201,
type = "execute",
name = L["Import Now"],
func = function()
E.PopupDialogs["MODULE_COPY_CONFIRM"].text = format(L["You are going to copy settings for |cffD3CF00\"%s\"|r from |cff4beb2c\"%s\"|r profile to your current |cff4beb2c\"%s\"|r profile. Are you sure?"], Name, E.global.profileCopy.selected, ElvDB["profileKeys"][E.myname.." - "..E.myrealm])
E.PopupDialogs["MODULE_COPY_CONFIRM"].OnAccept = function()
CP:ImportFromProfile(section, pluginSection)
end
E:StaticPopup_Show("MODULE_COPY_CONFIRM")
end
},
export = {
order = 202,
type = "execute",
name = L["Export Now"],
func = function()
E.PopupDialogs["MODULE_COPY_CONFIRM"].text = format(L["You are going to copy settings for |cffD3CF00\"%s\"|r from your current |cff4beb2c\"%s\"|r profile to |cff4beb2c\"%s\"|r profile. Are you sure?"], Name, ElvDB["profileKeys"][E.myname.." - "..E.myrealm], E.global.profileCopy.selected)
E.PopupDialogs["MODULE_COPY_CONFIRM"].OnAccept = function()
CP:ExportToProfile(section, pluginSection)
end
E:StaticPopup_Show("MODULE_COPY_CONFIRM")
end
}
}
}
if pluginSection then
config.args.general.hidden = function(info) return E.global.profileCopy[pluginSection][section][ info[getn(info)] ] == nil end
config.args.general.get = function(info) return E.global.profileCopy[pluginSection][section][ info[getn(info)] ] end
config.args.general.set = function(info, value) E.global.profileCopy[pluginSection][section][ info[getn(info)] ] = value end
else
config.args.general.hidden = function(info) return E.global.profileCopy[section][ info[getn(info)] ] == nil end
config.args.general.get = function(info) return E.global.profileCopy[section][ info[getn(info)] ] end
config.args.general.set = function(info, value) E.global.profileCopy[section][ info[getn(info)] ] = value end
end
return config
end
function CP:CreateMoversConfigGroup()
local config = {
header = {
order = 0,
type = "header",
name = L["On screen positions for different elements."],
},
PreButtonSpacer = {
order = 200,
type = "description",
name = "",
},
import = {
order = 201,
type = "execute",
name = L["Import Now"],
func = function()
E.PopupDialogs["MODULE_COPY_CONFIRM"].text = format(L["You are going to copy settings for |cffD3CF00\"%s\"|r from |cff4beb2c\"%s\"|r profile to your current |cff4beb2c\"%s\"|r profile. Are you sure?"], L["Movers"], E.global.profileCopy.selected, ElvDB["profileKeys"][E.myname.." - "..E.myrealm])
E.PopupDialogs["MODULE_COPY_CONFIRM"].OnAccept = function()
CP:CopyMovers("import")
end
E:StaticPopup_Show("MODULE_COPY_CONFIRM")
end
},
export = {
order = 202,
type = "execute",
name = L["Export Now"],
func = function()
E.PopupDialogs["MODULE_COPY_CONFIRM"].text = format(L["You are going to copy settings for |cffD3CF00\"%s\"|r from your current |cff4beb2c\"%s\"|r profile to |cff4beb2c\"%s\"|r profile. Are you sure?"], L["Movers"], ElvDB["profileKeys"][E.myname.." - "..E.myrealm], E.global.profileCopy.selected)
E.PopupDialogs["MODULE_COPY_CONFIRM"].OnAccept = function()
CP:CopyMovers("export")
end
E:StaticPopup_Show("MODULE_COPY_CONFIRM")
end
}
}
for moverName, data in pairs(E.CreatedMovers) do
if not G.profileCopy.movers[moverName] then G.profileCopy.movers[moverName] = false end
config[moverName] = {
order = 1,
type = "toggle",
name = data.text,
get = function(info) return E.global.profileCopy.movers[moverName] end,
set = function(info, value) E.global.profileCopy.movers[moverName] = value end
}
end
for moverName, data in pairs(E.DisabledMovers) do
if not G.profileCopy.movers[moverName] then G.profileCopy.movers[moverName] = false end
config[moverName] = {
order = 1,
type = "toggle",
name = data.text,
get = function(info) return E.global.profileCopy.movers[moverName] end,
set = function(info, value) E.global.profileCopy.movers[moverName] = value end
}
end
return config
end
function CP:CopyTable(CopyFrom, CopyTo, CopyDefault, module)
for key, value in pairs(CopyTo) do
if type(value) ~= "table" then
if module == true or (type(module) == "table" and module.general == nil or (not CopyTo.general and module.general)) then --Some dark magic of a logic to figure out stuff
--This check is to see if the profile we are copying from has keys absent from defaults.
--If key exists, then copy. If not, then clear obsolite key from the profile.
if CopyDefault[key] ~= nil then
CopyTo[key] = CopyFrom[key] or CopyDefault[key]
else
CopyFrom[key] = nil
end
end
else
if module == true then --Copy over entire section of profile subgroup
E:CopyTable(CopyTo, CopyDefault)
E:CopyTable(CopyTo, CopyFrom)
elseif module[key] ~= nil then
--Making sure tables actually exist in profiles (e.g absent values in ElvDB["profiles"] are for default values)
CopyFrom[key], CopyTo[key] = CP:TablesExist(CopyFrom[key], CopyTo[key], CopyDefault[key])
--If key exists, then copy. If not, then clear obsolite key from the profile.
--Someone should double check this logic. Cause for single keys it is fine, but I'm no sure bout whole tables @Darth
if CopyFrom[key] ~= nil then
CP:CopyTable(CopyFrom[key], CopyTo[key], CopyDefault[key], module[key])
else
CopyTo[key] = nil
end
end
end
end
end
--[[
* Valid copy templates should be as follows
G["profileCopy"][YourOptionGroupName] = {
[SubGroupName1] = true,
[SubGroupName2] = true,
...
}
* For example
G["profileCopy"]["auras"] = {
["general"] = true,
["buffs"] = true,
["debuffs"] = true,
["cooldown"] = true,
}
* "general" key can refer to a similar named subtable or all non-table variables inside your group
* If you leave the table as G["profileCopy"][YourOptionGroupName] = {}, this will result in no valid copy template error.
* If set to G["profileCopy"][YourOptionGroupName] = true, then this will copy everything without selecting
any particular subcategory from your settings table.
* Plugins can use "pluginSection" argument to determain their own table if they keep settings apart from core ElvUI settings.
Examples S&L uses "sle" table, MerathilisUI uses "mui" table, BenikUI uses "benikui" and core table
]]
function CP:TablesExist(CopyFrom, CopyTo, CopyDefault)
if not CopyFrom then CopyFrom = CopyDefault end
if not CopyTo then CopyTo = CopyDefault end
return CopyFrom, CopyTo
end
function CP:ImportFromProfile(section, pluginSection)
--Some checks for the occasion someone passes wrong stuff
if not section then error("No profile section provided. Usage CP:ImportFromProfile(\"section\")") end
if not pluginSection and CP.InternalOptions[section] then error(format("Section name could not be \"%s\". This name is reserved for internal setting"), section) end
if pluginSection and CP.InternalOptions[pluginSection][section] then error(format("Section name for plugin group \"%s\" could not be \"%s\". This name is reserved for internal setting"), pluginSection, section) end
local module = pluginSection and E.global.profileCopy[pluginSection][section] or E.global.profileCopy[section]
if not module then error(format("Provided section name \"%s\" does not have a template for profile copy.", section)) end
--Starting digging through the settings
local CopyFrom = pluginSection and ElvDB["profiles"][E.global.profileCopy.selected][pluginSection][section] or ElvDB["profiles"][E.global.profileCopy.selected][section]
local CopyTo = pluginSection and E.db[pluginSection][section] or E.db[section]
local CopyDefault = pluginSection and P[pluginSection][section] or P[section]
--Making sure tables actually exist in profiles (e.g absent values in ElvDB["profiles"] are for default values)
CopyFrom, CopyTo = CP:TablesExist(CopyFrom, CopyTo, CopyDefault)
if type(module) == "table" and next(module) then --This module is not an empty table
CP:CopyTable(CopyFrom, CopyTo, CopyDefault, module)
elseif type(module) == "boolean" then --Copy over entire section of profile subgroup
E:CopyTable(CopyTo, CopyDefault)
E:CopyTable(CopyTo, CopyFrom)
else
error(format("Provided section name \"%s\" does not have a valid copy template.", section))
end
E:UpdateAll(true)
end
function CP:ExportToProfile(section, pluginSection)
--Some checks for the occasion someone passes wrong stuff
if not section then error("No profile section provided. Usage CP:ExportToProfile(\"section\")") end
if not pluginSection and CP.InternalOptions[section] then error(format("Section name could not be \"%s\". This name is reserved for internal setting"), section) end
if pluginSection and CP.InternalOptions[pluginSection][section] then error(format("Section name for plugin group \"%s\" could not be \"%s\". This name is reserved for internal setting"), pluginSection, section) end
local module = pluginSection and E.global.profileCopy[pluginSection][section] or E.global.profileCopy[section]
if not module then error(format("Provided section name \"%s\" does not have a template for profile copy.", section)) end
--Making sure tables actually exist
if not ElvDB["profiles"][E.global.profileCopy.selected][section] then ElvDB["profiles"][E.global.profileCopy.selected][section] = {} end
if not E.db[section] then E.db[section] = {} end
--Starting digging through the settings
local CopyFrom = pluginSection and E.db[pluginSection][section] or E.db[section]
local CopyTo = pluginSection and ElvDB["profiles"][E.global.profileCopy.selected][pluginSection][section] or ElvDB["profiles"][E.global.profileCopy.selected][section]
local CopyDefault = pluginSection and P[pluginSection][section] or P[section]
if type(module) == "table" and next(module) then --This module is not an empty table
CP:CopyTable(CopyFrom, CopyTo, CopyDefault, module)
elseif type(module) == "boolean" then --Copy over entire section of profile subgroup
E:CopyTable(CopyTo, CopyDefault)
E:CopyTable(CopyTo, CopyFrom)
else
error(format("Provided section name \"%s\" does not have a valid copy template.", section))
end
end
function CP:CopyMovers(mode)
if not E.db.movers then E.db.movers = {} end --Nothing was moved in cutrrent profile
if not ElvDB["profiles"][E.global.profileCopy.selected].movers then ElvDB["profiles"][E.global.profileCopy.selected].movers = {} end --Nothing was moved in selected profile
local CopyFrom, CopyTo
if mode == "export" then
CopyFrom, CopyTo = E.db.movers, ElvDB["profiles"][E.global.profileCopy.selected].movers
else
CopyFrom, CopyTo = ElvDB["profiles"][E.global.profileCopy.selected].movers or {}, E.db.movers
end
for moverName in pairs(E.CreatedMovers) do
if E.global.profileCopy.movers[moverName] then
CopyTo[moverName] = CopyFrom[moverName]
end
end
E:SetMoversPositions()
end
--Maybe actually not needed at all
function CP:Initialize()
end
local function InitializeCallback()
CP:Initialize()
end
E:RegisterModule(CP:GetName(), InitializeCallback)
+89 -27
View File
@@ -4,11 +4,10 @@ local LSM = LibStub("LibSharedMedia-3.0");
--Cache global variables --Cache global variables
--Lua functions --Lua functions
local _G = _G local _G = _G
local unpack, type = unpack, type local unpack, type, select, getmetatable = unpack, type, select, getmetatable
--WoW API / Variables --WoW API / Variables
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local RAID_CLASS_COLORS = RAID_CLASS_COLORS local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
--Preload shit.. --Preload shit..
E.mult = 1 E.mult = 1
@@ -17,7 +16,7 @@ local backdropr, backdropg, backdropb, backdropa, borderr, borderg, borderb = 0,
local function GetTemplate(t, isUnitFrameElement) local function GetTemplate(t, isUnitFrameElement)
backdropa = 1 backdropa = 1
if t == "ClassColor" then if t == "ClassColor" then
if(CUSTOM_CLASS_COLORS) then if CUSTOM_CLASS_COLORS then
borderr, borderg, borderb = CUSTOM_CLASS_COLORS[E.myclass].r, CUSTOM_CLASS_COLORS[E.myclass].g, CUSTOM_CLASS_COLORS[E.myclass].b borderr, borderg, borderb = CUSTOM_CLASS_COLORS[E.myclass].r, CUSTOM_CLASS_COLORS[E.myclass].g, CUSTOM_CLASS_COLORS[E.myclass].b
else else
borderr, borderg, borderb = RAID_CLASS_COLORS[E.myclass].r, RAID_CLASS_COLORS[E.myclass].g, RAID_CLASS_COLORS[E.myclass].b borderr, borderg, borderb = RAID_CLASS_COLORS[E.myclass].r, RAID_CLASS_COLORS[E.myclass].g, RAID_CLASS_COLORS[E.myclass].b
@@ -30,14 +29,14 @@ local function GetTemplate(t, isUnitFrameElement)
end end
elseif t == "Transparent" then elseif t == "Transparent" then
if isUnitFrameElement then if isUnitFrameElement then
borderr, borderg, borderb = unpack(E["media"].bordercolor) borderr, borderg, borderb = unpack(E["media"].unitframeBorderColor)
else else
borderr, borderg, borderb = unpack(E["media"].bordercolor) borderr, borderg, borderb = unpack(E["media"].bordercolor)
end end
backdropr, backdropg, backdropb, backdropa = unpack(E["media"].backdropfadecolor) backdropr, backdropg, backdropb, backdropa = unpack(E["media"].backdropfadecolor)
else else
if isUnitFrameElement then if isUnitFrameElement then
borderr, borderg, borderb = unpack(E["media"].bordercolor) borderr, borderg, borderb = unpack(E["media"].unitframeBorderColor)
else else
borderr, borderg, borderb = unpack(E["media"].bordercolor) borderr, borderg, borderb = unpack(E["media"].bordercolor)
end end
@@ -52,6 +51,7 @@ function E:Size(frame, width, height)
end end
function E:Width(frame, width) function E:Width(frame, width)
assert(width)
frame:SetWidth(E:Scale(width)) frame:SetWidth(E:Scale(width))
end end
@@ -61,7 +61,7 @@ function E:Height(frame, height)
end end
function E:Point(obj, arg1, arg2, arg3, arg4, arg5) function E:Point(obj, arg1, arg2, arg3, arg4, arg5)
if(arg2 == nil) then if arg2 == nil then
arg2 = obj:GetParent() arg2 = obj:GetParent()
end end
@@ -105,33 +105,33 @@ end
function E:SetTemplate(f, t, glossTex, ignoreUpdates, forcePixelMode, isUnitFrameElement) function E:SetTemplate(f, t, glossTex, ignoreUpdates, forcePixelMode, isUnitFrameElement)
GetTemplate(t, isUnitFrameElement) GetTemplate(t, isUnitFrameElement)
if(t) then if t then
f.template = t f.template = t
end end
if(glossTex) then if glossTex then
f.glossTex = glossTex f.glossTex = glossTex
end end
if(ignoreUpdates) then if ignoreUpdates then
f.ignoreUpdates = ignoreUpdates f.ignoreUpdates = ignoreUpdates
end end
if(forcePixelMode) then if forcePixelMode then
f.forcePixelMode = forcePixelMode f.forcePixelMode = forcePixelMode
end end
local bgFile = E.media.blankTex local bgFile = E.media.blankTex
if(glossTex) then if glossTex then
bgFile = E.media.glossTex bgFile = E.media.glossTex
end end
if(isUnitFrameElement) then if isUnitFrameElement then
f.isUnitFrameElement = isUnitFrameElement f.isUnitFrameElement = isUnitFrameElement
end end
if(t ~= "NoBackdrop") then if t ~= "NoBackdrop" then
if(E.private.general.pixelPerfect or f.forcePixelMode) then if E.private.general.pixelPerfect or f.forcePixelMode then
f:SetBackdrop({ f:SetBackdrop({
bgFile = bgFile, bgFile = bgFile,
edgeFile = E["media"].blankTex, edgeFile = E["media"].blankTex,
@@ -177,7 +177,7 @@ function E:SetTemplate(f, t, glossTex, ignoreUpdates, forcePixelMode, isUnitFram
f:SetBackdropColor(backdropr, backdropg, backdropb, backdropa) f:SetBackdropColor(backdropr, backdropg, backdropb, backdropa)
f:SetBackdropBorderColor(borderr, borderg, borderb) f:SetBackdropBorderColor(borderr, borderg, borderb)
if(not f.ignoreUpdates) then if not f.ignoreUpdates then
if f.isUnitFrameElement then if f.isUnitFrameElement then
E["unitFrameElements"][f] = true E["unitFrameElements"][f] = true
else else
@@ -187,19 +187,20 @@ function E:SetTemplate(f, t, glossTex, ignoreUpdates, forcePixelMode, isUnitFram
end end
function E:CreateBackdrop(f, t, tex, ignoreUpdates, forcePixelMode, isUnitFrameElement) function E:CreateBackdrop(f, t, tex, ignoreUpdates, forcePixelMode, isUnitFrameElement)
if not f then return end if not t then t = "Default" end
if(not t) then t = "Default" end
local b = CreateFrame("Frame", nil, f) local parent = f.IsObjectType and f:IsObjectType("Texture") and f:GetParent() or f
if(f.forcePixelMode or forcePixelMode) then
local b = CreateFrame("Frame", nil, parent)
if f.forcePixelMode or forcePixelMode then
E:SetOutside(b, nil, E.mult, E.mult) E:SetOutside(b, nil, E.mult, E.mult)
else else
E:SetOutside(b) E:SetOutside(b)
end end
E:SetTemplate(b, t, tex, ignoreUpdates, forcePixelMode, isUnitFrameElement) E:SetTemplate(b, t, tex, ignoreUpdates, forcePixelMode, isUnitFrameElement)
if(f:GetFrameLevel() - 1 >= 0) then if (parent:GetFrameLevel() - 1) >= 0 then
b:SetFrameLevel(f:GetFrameLevel() - 1) b:SetFrameLevel(parent:GetFrameLevel() - 1)
else else
b:SetFrameLevel(0) b:SetFrameLevel(0)
end end
@@ -217,10 +218,7 @@ function E:CreateShadow(f)
shadow:SetFrameLevel(1) shadow:SetFrameLevel(1)
shadow:SetFrameStrata(f:GetFrameStrata()) shadow:SetFrameStrata(f:GetFrameStrata())
E:SetOutside(shadow, f, 3, 3) E:SetOutside(shadow, f, 3, 3)
shadow:SetBackdrop({ shadow:SetBackdrop({edgeFile = LSM:Fetch("border", "ElvUI GlowBorder"), edgeSize = E:Scale(3)})
edgeFile = LSM:Fetch("border", "ElvUI GlowBorder"), edgeSize = E:Scale(3),
insets = {left = E:Scale(5), right = E:Scale(5), top = E:Scale(5), bottom = E:Scale(5)}
})
shadow:SetBackdropColor(backdropr, backdropg, backdropb, 0) shadow:SetBackdropColor(backdropr, backdropg, backdropb, 0)
shadow:SetBackdropBorderColor(borderr, borderg, borderb, 0.9) shadow:SetBackdropBorderColor(borderr, borderg, borderb, 0.9)
f.shadow = shadow f.shadow = shadow
@@ -238,7 +236,8 @@ function E:Kill(object)
end end
function E:StripTextures(object, kill) function E:StripTextures(object, kill)
for _, region in ipairs({object:GetRegions()}) do for i = 1, object:GetNumRegions() do
local region = select(i, object:GetRegions())
if region and region:GetObjectType() == "Texture" then if region and region:GetObjectType() == "Texture" then
if kill and type(kill) == "boolean" then if kill and type(kill) == "boolean" then
E:Kill(region) E:Kill(region)
@@ -262,7 +261,7 @@ function E:FontTemplate(fs, font, fontSize, fontStyle)
fontSize = fontSize or E.db.general.fontSize fontSize = fontSize or E.db.general.fontSize
if fontStyle == "OUTLINE" and (E.db.general.font == "Homespun") then if fontStyle == "OUTLINE" and (E.db.general.font == "Homespun") then
if (fontSize > 10 and not fs.fontSize) then if fontSize > 10 and not fs.fontSize then
fontStyle = "MONOCHROMEOUTLINE" fontStyle = "MONOCHROMEOUTLINE"
fontSize = 10 fontSize = 10
end end
@@ -311,3 +310,66 @@ function E:StyleButton(button, noHover, noPushed, noChecked)
E:SetInside(cooldown) E:SetInside(cooldown)
end end
end end
function E:CreateCloseButton(frame, size, offset, texture, backdrop)
size = (size or 16)
offset = (offset or -6)
texture = (texture or "Interface\\AddOns\\ElvUI\\media\\textures\\close.tga")
local CloseButton = CreateFrame("Button", nil, frame)
E:Size(CloseButton, size)
E:Point(CloseButton, "TOPRIGHT", offset, offset)
if backdrop then
E:CreateBackdrop(CloseButton, "Default", true)
end
CloseButton.Texture = CloseButton:CreateTexture(nil, "OVERLAY")
CloseButton.Texture:SetAllPoints()
CloseButton.Texture:SetTexture(texture)
CloseButton:SetScript("OnClick", function()
this:GetParent():Hide()
end)
CloseButton:SetScript("OnEnter", function()
this.Texture:SetVertexColor(unpack(E["media"].rgbvaluecolor))
end)
CloseButton:SetScript("OnLeave", function()
this.Texture:SetVertexColor(1, 1, 1)
end)
frame.CloseButton = CloseButton
end
--[[local function addapi(object)
local mt = getmetatable(object).__index
if not object.Size then mt.Size = Size end
if not object.Point then mt.Point = Point end
if not object.SetOutside then mt.SetOutside = SetOutside end
if not object.SetInside then mt.SetInside = SetInside end
if not object.SetTemplate then mt.SetTemplate = SetTemplate end
if not object.CreateBackdrop then mt.CreateBackdrop = CreateBackdrop end
if not object.CreateShadow then mt.CreateShadow = CreateShadow end
if not object.Kill then mt.Kill = Kill end
if not object.Width then mt.Width = Width end
if not object.Height then mt.Height = Height end
if not object.FontTemplate then mt.FontTemplate = FontTemplate end
if not object.StripTextures then mt.StripTextures = StripTextures end
if not object.StyleButton then mt.StyleButton = StyleButton end
if not object.CreateCloseButton then mt.CreateCloseButton = CreateCloseButton end
end
local handled = {["Frame"] = true}
local object = CreateFrame("Frame")
addapi(object)
addapi(object:CreateTexture())
addapi(object:CreateFontString())
object = EnumerateFrames()
while object do
if not handled[object:GetObjectType()] then
addapi(object)
handled[object:GetObjectType()] = true
end
object = EnumerateFrames(object)
end--]]
+88 -7
View File
@@ -1,12 +1,36 @@
ElvUI = {}
--Cache global variables
--Lua functions
local _G = _G local _G = _G
local pairs, unpack = pairs, unpack
local getn, wipe = table.getn, wipe
local format, strsplit = string.format, string.split
--WoW API / Variables
local CreateFrame = CreateFrame
local GetAddOnInfo = GetAddOnInfo
local GetAddOnMetadata = GetAddOnMetadata
local HideUIPanel = HideUIPanel
local IsAddOnLoaded = IsAddOnLoaded
local LoadAddOn = LoadAddOn
local ReloadUI = ReloadUI
local GameMenuFrame = GameMenuFrame
local GameMenuButtonLogout = GameMenuButtonLogout
BINDING_HEADER_ELVUI = GetAddOnMetadata("ElvUI", "Title") BINDING_HEADER_ELVUI = GetAddOnMetadata("ElvUI", "Title")
local AddOnName, Engine = "ElvUI", {} local AddOnName, Engine = "ElvUI", ElvUI
local AddOn = LibStub("AceAddon-3.0"):NewAddon(AddOnName, "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0", "AceHook-3.0") local AddOn = LibStub("AceAddon-3.0"):NewAddon(AddOnName, "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0", "AceHook-3.0")
AddOn.callbacks = AddOn.callbacks or
LibStub("CallbackHandler-1.0"):New(AddOn) AddOn.callbacks = AddOn.callbacks or LibStub("CallbackHandler-1.0"):New(AddOn)
AddOn.DF = {} AddOn.DF["profile"] = {} AddOn.DF["global"] = {} AddOn.privateVars = {} AddOn.privateVars["profile"] = {} -- Defaults
-- Defaults
AddOn.DF = {}
AddOn.DF["profile"] = {}
AddOn.DF["global"] = {}
AddOn.privateVars = {}
AddOn.privateVars["profile"] = {}
AddOn.Options = { AddOn.Options = {
type = "group", type = "group",
name = AddOnName, name = AddOnName,
@@ -27,6 +51,10 @@ function AddOn:OnInitialize()
ElvCharacterDB = {} ElvCharacterDB = {}
end end
ElvCharacterData = nil --Depreciated
ElvPrivateData = nil --Depreciated
ElvData = nil --Depreciated
self.db = tcopy(self.DF.profile, true) self.db = tcopy(self.DF.profile, true)
self.global = tcopy(self.DF.global, true) self.global = tcopy(self.DF.global, true)
if ElvDB then if ElvDB then
@@ -77,7 +105,7 @@ function AddOn:OnInitialize()
GameMenuButton:SetWidth(GameMenuButtonLogout:GetWidth()) GameMenuButton:SetWidth(GameMenuButtonLogout:GetWidth())
GameMenuButton:SetHeight(GameMenuButtonLogout:GetHeight()) GameMenuButton:SetHeight(GameMenuButtonLogout:GetHeight())
GameMenuButton:SetText(self:ColorizedName(AddOnName)) GameMenuButton:SetText(self.title)
GameMenuButton:SetScript("OnClick", function() GameMenuButton:SetScript("OnClick", function()
AddOn:ToggleConfig() AddOn:ToggleConfig()
HideUIPanel(GameMenuFrame) HideUIPanel(GameMenuFrame)
@@ -86,7 +114,7 @@ function AddOn:OnInitialize()
HookScript(GameMenuFrame, "OnShow", function() HookScript(GameMenuFrame, "OnShow", function()
if not GameMenuFrame.isElvUI then if not GameMenuFrame.isElvUI then
GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + GameMenuButtonLogout:GetHeight() + 1) GameMenuFrame:SetHeight(GameMenuFrame:GetHeight() + GameMenuButtonLogout:GetHeight() + 17)
GameMenuFrame.isElvUI = true GameMenuFrame.isElvUI = true
end end
local _, relTo = GameMenuButtonLogout:GetPoint() local _, relTo = GameMenuButtonLogout:GetPoint()
@@ -123,7 +151,14 @@ function AddOn:ToggleConfig()
if not IsAddOnLoaded("ElvUI_Config") then if not IsAddOnLoaded("ElvUI_Config") then
local _, _, _, _, _, reason = GetAddOnInfo("ElvUI_Config") local _, _, _, _, _, reason = GetAddOnInfo("ElvUI_Config")
if reason ~= "MISSING" and reason ~= "DISABLED" then if reason ~= "MISSING" and reason ~= "DISABLED" then
self.GUIFrame = false
LoadAddOn("ElvUI_Config") LoadAddOn("ElvUI_Config")
--For some reason, GetAddOnInfo reason is "DEMAND_LOADED" even if the addon is disabled.
--Workaround: Try to load addon and check if it is loaded right after.
if not IsAddOnLoaded("ElvUI_Config") then
self:Print("|cffff0000Error -- Addon 'ElvUI_Config' not found or is disabled.|r")
return
end
if GetAddOnMetadata("ElvUI_Config", "Version") ~= "1.01" then if GetAddOnMetadata("ElvUI_Config", "Version") ~= "1.01" then
self:StaticPopup_Show("CLIENT_UPDATE_REQUEST") self:StaticPopup_Show("CLIENT_UPDATE_REQUEST")
end end
@@ -134,11 +169,57 @@ function AddOn:ToggleConfig()
end end
local ACD = LibStub("AceConfigDialog-3.0") local ACD = LibStub("AceConfigDialog-3.0")
local ConfigOpen = ACD.OpenFrames[AddOnName]
local pages, msgStr
if msg and msg ~= "" then
pages = {strsplit(",", msg)}
msgStr = gsub(msg, ",","\001")
end
local mode = "Close" local mode = "Close"
if not ACD.OpenFrames[AddOnName] then if not ConfigOpen or (pages ~= nil) then
if pages ~= nil then
local pageCount, index, mainSel = getn(pages)
if pageCount > 1 then
wipe(pageNodes)
index = 0
local main, mainNode, mainSelStr, sub, subNode, subSel
for i = 1, pageCount do
if i == 1 then
main = pages[i] and ACD.Status and ACD.Status.ElvUI
mainSel = main and main.status and main.status.groups and main.status.groups.selected
mainSelStr = mainSel and (gsub("^"..mainSel, "([%(%)%.%%%+%-%*%?%[%^%$])","%%%1").."\001")
mainNode = main and main.children and main.children[pages[i]]
pageNodes[index + 1], pageNodes[index + 2] = main, mainNode
else
sub = pages[i] and pageNodes[i] and ((i == pageCount and pageNodes[i]) or pageNodes[i].children[pages[i]])
subSel = sub and sub.status and sub.status.groups and sub.status.groups.selected
subNode = (mainSelStr and match(msgStr, gsub(mainSelStr..pages[i], "([%(%)%.%%%+%-%*%?%[%^%$])","%%%1").."$") and (subSel and subSel == pages[i])) or ((i == pageCount and not subSel) and mainSel and mainSel == msgStr)
pageNodes[index + 1], pageNodes[index + 2] = sub, subNode
end
index = index + 2
end
else
local main = pages[1] and ACD.Status and ACD.Status.ElvUI
mainSel = main and main.status and main.status.groups and main.status.groups.selected
end
if ConfigOpen and ((not index and mainSel and mainSel == msg) or (index and pageNodes and pageNodes[index])) then
mode = "Close"
else
mode = "Open" mode = "Open"
end end
else
mode = "Open"
end
end
ACD[mode](ACD, AddOnName)
if pages and (mode == "Open") then
ACD:SelectGroup(AddOnName, unpack(pages))
end
if mode == "Open" then if mode == "Open" then
PlaySound("igMainMenuOpen") PlaySound("igMainMenuOpen")
+2 -1
View File
@@ -44,7 +44,7 @@ function LO:Initialize()
end end
function LO:BottomPanelVisibility() function LO:BottomPanelVisibility()
if(E.db.general.bottomPanel) then if E.db.general.bottomPanel then
self.BottomPanel:Show() self.BottomPanel:Show()
else else
self.BottomPanel:Hide() self.BottomPanel:Hide()
@@ -163,6 +163,7 @@ function LO:SetDataPanelStyle()
E:SetTemplate(LeftMiniPanel, "Transparent") E:SetTemplate(LeftMiniPanel, "Transparent")
E:SetTemplate(RightMiniPanel, "Transparent") E:SetTemplate(RightMiniPanel, "Transparent")
E:SetTemplate(ElvConfigToggle, "Transparent")
else else
if not E.db.datatexts.panelBackdrop then if not E.db.datatexts.panelBackdrop then
E:SetTemplate(LeftChatDataPanel, "NoBackdrop") E:SetTemplate(LeftChatDataPanel, "NoBackdrop")
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

+5 -3
View File
@@ -217,6 +217,7 @@ end
local function OnKeyDown() local function OnKeyDown()
if ignoreKeys[arg1] then return end if ignoreKeys[arg1] then return end
if printKeys[arg1] then if printKeys[arg1] then
Screenshot() Screenshot()
else else
@@ -244,8 +245,7 @@ function AFK:Initialize()
E.global.afkEnabled = nil E.global.afkEnabled = nil
end end
local _, class = UnitClass("player") local classColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[E.myclass] or RAID_CLASS_COLORS[E.myclass]
local classColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
self.AFKMode = CreateFrame("Frame", "ElvUIAFKFrame") self.AFKMode = CreateFrame("Frame", "ElvUIAFKFrame")
self.AFKMode:SetFrameLevel(1) self.AFKMode:SetFrameLevel(1)
@@ -278,12 +278,14 @@ function AFK:Initialize()
self.AFKMode.bottom:SetFrameLevel(0) self.AFKMode.bottom:SetFrameLevel(0)
E:SetTemplate(self.AFKMode.bottom, "Transparent") E:SetTemplate(self.AFKMode.bottom, "Transparent")
E:Point(self.AFKMode.bottom, "BOTTOM", self.AFKMode, "BOTTOM", 0, -E.Border) E:Point(self.AFKMode.bottom, "BOTTOM", self.AFKMode, "BOTTOM", 0, -E.Border)
E:Size(self.AFKMode.bottom, GetScreenWidth() + (E.Border*2), GetScreenHeight() * 0.1) E:Width(self.AFKMode.bottom, GetScreenWidth() + (E.Border*2))
E:Height(self.AFKMode.bottom, GetScreenHeight() * 0.1)
self.AFKMode.bottom.logo = self.AFKMode:CreateTexture(nil, "OVERLAY") self.AFKMode.bottom.logo = self.AFKMode:CreateTexture(nil, "OVERLAY")
E:Size(self.AFKMode.bottom.logo, 320, 150) E:Size(self.AFKMode.bottom.logo, 320, 150)
E:Point(self.AFKMode.bottom.logo, "CENTER", self.AFKMode.bottom, "CENTER", 0, 50) E:Point(self.AFKMode.bottom.logo, "CENTER", self.AFKMode.bottom, "CENTER", 0, 50)
self.AFKMode.bottom.logo:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\logo") self.AFKMode.bottom.logo:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\logo")
self.AFKMode.bottom.faction = self.AFKMode.bottom:CreateTexture(nil, "OVERLAY") self.AFKMode.bottom.faction = self.AFKMode.bottom:CreateTexture(nil, "OVERLAY")
E:Point(self.AFKMode.bottom.faction, "BOTTOMLEFT", self.AFKMode.bottom, "BOTTOMLEFT", -20, -16) E:Point(self.AFKMode.bottom.faction, "BOTTOMLEFT", self.AFKMode.bottom, "BOTTOMLEFT", -20, -16)
self.AFKMode.bottom.faction:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\"..E.myfaction.."-Logo") self.AFKMode.bottom.faction:SetTexture("Interface\\AddOns\\ElvUI\\media\\textures\\"..E.myfaction.."-Logo")
+97
View File
@@ -33,3 +33,100 @@ G["chat"] = {
G["bags"] = { G["bags"] = {
["ignoredItems"] = {} ["ignoredItems"] = {}
} }
G["profileCopy"] = {
--Specific values
["selected"] = "Minimalistic",
["movers"] = {},
--Modules
["actionbar"] = {
["general"] = true,
["bar1"] = true,
["bar2"] = true,
["bar3"] = true,
["bar4"] = true,
["bar5"] = true,
["bar6"] = true,
["barPet"] = true,
["barShapeShift"] = true,
["microbar"] = true,
["cooldown"] = true
},
["auras"] = {
["general"] = true,
["cooldown"] = true
},
["bags"] = {
["general"] = true,
["split"] = true,
["vendorGrays"] = true,
["bagBar"] = true,
["cooldown"] = true
},
["chat"] = {
["general"] = true
},
["cooldown"] = {
["general"] = true,
["fonts"] = true
},
["databars"] = {
["experience"] = true,
["reputation"] = true
},
["datatexts"] = {
["general"] = true,
["panels"] = true
},
["general"] = {
["general"] = true,
["minimap"] = true,
["threat"] = true,
["totems"] = true
},
["nameplates"] = {
["general"] = true,
["reactions"] = true,
["units"] = {
["FRIENDLY_PLAYER"] = true,
["ENEMY_PLAYER"] = true,
["FRIENDLY_NPC"] = true,
["ENEMY_NPC"] = true
}
},
["tooltip"] = {
["general"] = true,
["visibility"] = true,
["healthBar"] = true
},
["unitframes"] = {
["general"] = true,
["cooldown"] = true,
["colors"] = {
["general"] = true,
["power"] = true,
["reaction"] = true,
["healPrediction"] = true,
["classResources"] = true,
["frameGlow"] = true,
["debuffHighlight"] = true
},
["units"] = {
["player"] = true,
["target"] = true,
["targettarget"] = true,
["targettargettarget"] = true,
["focus"] = true,
["focustarget"] = true,
["pet"] = true,
["pettarget"] = true,
["arena"] = true,
["party"] = true,
["raid"] = true,
["raid40"] = true,
["raidpet"] = true,
["tank"] = true,
["assist"] = true
}
}
}
+1
View File
@@ -21,3 +21,4 @@ Tooltip.lua
Unitframes.lua Unitframes.lua
DataBars.lua DataBars.lua
Maps.lua Maps.lua
ModuleControl.lua
+588
View File
@@ -0,0 +1,588 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
local NP = E:GetModule("NamePlates");
local CP = E:GetModule("CopyProfile");
--Cache global variables
--Lua functions
local getn = table.getn
--WoW API / Variables
local XPBAR_LABEL = XPBAR_LABEL
local REPUTATION = REPUTATION
local MINIMAP_LABEL = MINIMAP_LABEL
local COLORS = COLORS
--Actionbars
local function CreateActionbarsConfig()
local config = CP:CreateModuleConfigGroup(L["ActionBars"], "actionbar")
for i = 1, 6 do
config.args["bar"..i] = {
order = i + 1,
type = "toggle",
name = L["Bar "]..i,
get = function(info) return E.global.profileCopy.actionbar[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.actionbar[ info[getn(info)] ] = value end
}
end
config.args.barPet = {
order = 8,
type = "toggle",
name = L["Pet Bar"],
get = function(info) return E.global.profileCopy.actionbar[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.actionbar[ info[getn(info)] ] = value end
}
config.args.barShapeShift = {
order = 9,
type = "toggle",
name = L["Stance Bar"],
get = function(info) return E.global.profileCopy.actionbar[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.actionbar[ info[getn(info)] ] = value end
}
config.args.microbar = {
order = 10,
type = "toggle",
name = L["Micro Bar"],
get = function(info) return E.global.profileCopy.actionbar[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.actionbar[ info[getn(info)] ] = value end
}
config.args.cooldown = {
order = 11,
type = "toggle",
name = L["Cooldown Text"],
get = function(info) return E.global.profileCopy.actionbar[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.actionbar[ info[getn(info)] ] = value end
}
return config
end
--Auras
local function CreateAurasConfig()
local config = CP:CreateModuleConfigGroup(L["Auras"], "auras")
config.args.cooldown = {
order = 2,
type = "toggle",
name = L["Cooldown Text"],
get = function(info) return E.global.profileCopy.auras[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.auras[ info[getn(info)] ] = value end
}
return config
end
--Bags
local function CreateBagsConfig()
local config = CP:CreateModuleConfigGroup(L["Bags"], "bags")
config.args.bagBar = {
order = 2,
type = "toggle",
name = L["Bag-Bar"],
get = function(info) return E.global.profileCopy.bags[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.bags[ info[getn(info)] ] = value end
}
config.args.cooldown = {
order = 3,
type = "toggle",
name = L["Cooldown Text"],
get = function(info) return E.global.profileCopy.bags[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.bags[ info[getn(info)] ] = value end
}
config.args.split = {
order = 4,
type = "toggle",
name = L["Split"],
get = function(info) return E.global.profileCopy.bags[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.bags[ info[getn(info)] ] = value end
}
config.args.vendorGrays = {
order = 5,
type = "toggle",
name = L["Vendor Grays"],
get = function(info) return E.global.profileCopy.bags[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.bags[ info[getn(info)] ] = value end
}
return config
end
--Chat
local function CreateChatConfig()
local config = CP:CreateModuleConfigGroup(L["Chat"], "chat")
return config
end
--Cooldowns
local function CreateCooldownConfig()
local config = CP:CreateModuleConfigGroup(L["Cooldown Text"], "cooldown")
config.args.fonts = {
order = 2,
type = "toggle",
name = L["Fonts"],
get = function(info) return E.global.profileCopy.cooldown[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.cooldown[ info[getn(info)] ] = value end
}
return config
end
--DataBars
local function CreateDatatbarsConfig()
local config = CP:CreateModuleConfigGroup(L["DataBars"], "databars")
config.args.experience = {
order = 2,
type = "toggle",
name = XPBAR_LABEL,
get = function(info) return E.global.profileCopy.databars[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.databars[ info[getn(info)] ] = value end
}
config.args.reputation = {
order = 3,
type = "toggle",
name = REPUTATION,
get = function(info) return E.global.profileCopy.databars[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.databars[ info[getn(info)] ] = value end
}
return config
end
--DataTexts
local function CreateDatatextsConfig()
local config = CP:CreateModuleConfigGroup(L["DataTexts"], "datatexts")
config.args.panels = {
order = 2,
type = "toggle",
name = L["Panels"],
get = function(info) return E.global.profileCopy.datatexts[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.datatexts[ info[getn(info)] ] = value end
}
return config
end
--General
local function CreateGeneralConfig()
local config = CP:CreateModuleConfigGroup(L["General"], "general")
config.args.minimap = {
order = 2,
type = "toggle",
name = MINIMAP_LABEL,
get = function(info) return E.global.profileCopy.general[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.general[ info[getn(info)] ] = value end
}
config.args.threat = {
order = 3,
type = "toggle",
name = L["Threat"],
get = function(info) return E.global.profileCopy.general[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.general[ info[getn(info)] ] = value end
}
config.args.totems = {
order = 4,
type = "toggle",
name = L["Totem Bar"],
get = function(info) return E.global.profileCopy.general[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.general[ info[getn(info)] ] = value end
}
return config
end
--NamePlates
local function CreateNamePlatesConfig()
local config = CP:CreateModuleConfigGroup(L["NamePlates"], "nameplates")
config.args.reactions = {
order = 2,
type = "toggle",
name = L["Reaction Colors"],
get = function(info) return E.global.profileCopy.nameplates[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.nameplates[ info[getn(info)] ] = value end
}
config.args.units = {
order = 3,
type = "group",
guiInline = true,
name = L["UnitFrames"],
get = function(info) return E.global.profileCopy.nameplates[info[getn(info) - 1]][ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.nameplates[info[getn(info) - 1]][ info[getn(info)] ] = value end,
args = {
["FRIENDLY_PLAYER"] = {
order = 1,
type = "toggle",
name = L["Friendly Player Frames"]
},
["ENEMY_PLAYER"] = {
order = 2,
type = "toggle",
name = L["Enemy Player Frames"]
},
["FRIENDLY_NPC"] = {
order = 3,
type = "toggle",
name = L["Friendly NPC Frames"]
},
["ENEMY_NPC"] = {
order = 4,
type = "toggle",
name = L["Enemy NPC Frames"]
}
}
}
return config
end
--Tooltip
local function CreateTooltipConfig()
local config = CP:CreateModuleConfigGroup(L["Tooltip"], "tooltip")
config.args.visibility = {
order = 2,
type = "toggle",
name = L["Visibility"],
get = function(info) return E.global.profileCopy.tooltip[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.tooltip[ info[getn(info)] ] = value end
}
config.args.healthBar = {
order = 3,
type = "toggle",
name = L["Health Bar"],
get = function(info) return E.global.profileCopy.tooltip[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.tooltip[ info[getn(info)] ] = value end
}
return config
end
--UnitFrames
local function CreateUnitframesConfig()
local config = CP:CreateModuleConfigGroup(L["UnitFrames"], "unitframes")
config.args.cooldown = {
order = 2,
type = "toggle",
name = L["Cooldown Text"],
get = function(info) return E.global.profileCopy.unitframes[ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.unitframes[ info[getn(info)] ] = value end
}
config.args.colors = {
order = 3,
type = "group",
guiInline = true,
name = COLORS,
get = function(info) return E.global.profileCopy.unitframes[info[getn(info) - 1]][ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.unitframes[info[getn(info) - 1]][ info[getn(info)] ] = value end,
args = {
["general"] = {
order = 1,
type = "toggle",
name = L["General"]
},
["power"] = {
order = 2,
type = "toggle",
name = L["Powers"]
},
["reaction"] = {
order = 3,
type = "toggle",
name = L["Reactions"]
},
["healPrediction"] = {
order = 4,
type = "toggle",
name = L["Heal Prediction"]
},
["classResources"] = {
order = 5,
type = "toggle",
name = L["Class Resources"]
},
["frameGlow"] = {
order = 6,
type = "toggle",
name = L["Frame Glow"]
},
["debuffHighlight"] = {
order = 7,
type = "toggle",
name = L["Debuff Highlighting"]
}
}
}
config.args.units = {
order = 4,
type = "group",
guiInline = true,
name = L["UnitFrames"],
get = function(info) return E.global.profileCopy.unitframes[info[getn(info) - 1]][ info[getn(info)] ] end,
set = function(info, value) E.global.profileCopy.unitframes[info[getn(info) - 1]][ info[getn(info)] ] = value end,
args = {
["player"] = {
order = 1,
type = "toggle",
name = L["Player Frame"]
},
["target"] = {
order = 2,
type = "toggle",
name = L["Target Frame"]
},
["targettarget"] = {
order = 3,
type = "toggle",
name = L["TargetTarget Frame"]
},
["targettargettarget"] = {
order = 4,
type = "toggle",
name = L["TargetTargetTarget Frame"]
},
["focus"] = {
order = 5,
type = "toggle",
name = L["Focus Frame"]
},
["focustarget"] = {
order = 6,
type = "toggle",
name = L["FocusTarget Frame"]
},
["pet"] = {
order = 7,
type = "toggle",
name = L["Pet Frame"]
},
["pettarget"] = {
order = 8,
type = "toggle",
name = L["PetTarget Frame"]
},
["arena"] = {
order = 9,
type = "toggle",
name = L["Arena Frames"]
},
["party"] = {
order = 10,
type = "toggle",
name = L["Party Frames"]
},
["raid"] = {
order = 11,
type = "toggle",
name = L["Raid Frames"]
},
["raid40"] = {
order = 12,
type = "toggle",
name = L["Raid-40 Frames"]
},
["raidpet"] = {
order = 13,
type = "toggle",
name = L["Raid Pet Frames"]
},
["tank"] = {
order = 14,
type = "toggle",
name = L["Tank Frames"]
},
["assist"] = {
order = 15,
type = "toggle",
name = L["Assist Frames"]
}
}
}
return config
end
E.Options.args.modulecontrol= {
order = -2,
type = "group",
name = L["Module Control"],
childGroups = "tab",
args = {
modulecopy = {
type = "group",
name = L["Module Copy"],
order = 1,
childGroups = "select",
handler = E.Options.args.profiles.handler,
args = {
header = {
order = 0,
type = "header",
name = L["Module Copy"]
},
intro = {
order = 1,
type = "description",
name = L["This section will allow you to copy settings to a select module from or to a different profile."]
},
pluginInfo = {
order = 2,
type = "description",
name = L["If you have any plugins supporting this feature installed you can find them in the selection dropdown to the right."]
},
profile = {
order = 3,
type = "select",
name = L["Profile"],
desc = L["Select a profile to copy from/to."],
get = function(info) return E.global.profileCopy.selected end,
set = function(info, value) E.global.profileCopy.selected = value end,
values = E.Options.args.profiles.args.copyfrom.values,
disabled = E.Options.args.profiles.args.copyfrom.disabled,
arg = E.Options.args.profiles.args.copyfrom.arg
},
elvui = {
order = 10,
type = "group",
name = E.title,
childGroups = "tab",
disabled = E.Options.args.profiles.args.copyfrom.disabled,
args = {
header = {
order = 0,
type = "header",
name = L["Core |cff00b30bE|r|cffC4C4C4lvUI|r options."]
},
actionbar = CreateActionbarsConfig(),
auras = CreateAurasConfig(),
bags = CreateBagsConfig(),
chat = CreateChatConfig(),
cooldown = CreateCooldownConfig(),
databars = CreateDatatbarsConfig(),
datatexts = CreateDatatextsConfig(),
general = CreateGeneralConfig(),
nameplates = CreateNamePlatesConfig(),
tooltip = CreateTooltipConfig(),
uniframes = CreateUnitframesConfig()
}
},
movers = {
order = 20,
type = "group",
name = L["Movers"],
desc = L["On screen positions for different elements."],
childGroups = "tab",
disabled = E.Options.args.profiles.args.copyfrom.disabled,
args = CP:CreateMoversConfigGroup()
}
}
},
modulereset = {
type = "group",
name = L["Module Reset"],
order = 2,
args = {
header = {
order = 0,
type = "header",
name = L["Module Reset"]
},
intro = {
order = 1,
type = "description",
name = L["This section will help reset specfic settings back to default."]
},
space1 = {
order = 2,
type = "description",
name = ""
},
general = {
order = 3,
type = "execute",
name = L["General"],
confirm = true,
confirmText = L["Are you sure you want to reset General settings?"],
func = function() E:CopyTable(E.db.general, P.general) end
},
actionbar = {
order = 5,
type = "execute",
name = L["ActionBars"],
confirm = true,
confirmText = L["Are you sure you want to reset ActionBars settings?"],
func = function() E:CopyTable(E.db.actionbar, P.actionbar) end
},
bags = {
order = 6,
type = "execute",
name = L["Bags"],
confirm = true,
confirmText = L["Are you sure you want to reset Bags settings?"],
func = function() E:CopyTable(E.db.bags, P.bags) end
},
auras = {
order = 7,
type = "execute",
name = L["Auras"],
confirm = true,
confirmText = L["Are you sure you want to reset Auras settings?"],
func = function() E:CopyTable(E.db.auras, P.auras) end
},
chat = {
order = 8,
type = "execute",
name = L["Chat"],
confirm = true,
confirmText = L["Are you sure you want to reset Chat settings?"],
func = function() E:CopyTable(E.db.chat, P.chat) end
},
cooldown = {
order = 9,
type = "execute",
name = L["Cooldown Text"],
confirm = true,
confirmText = L["Are you sure you want to reset Cooldown settings?"],
func = function() E:CopyTable(E.db.cooldown, P.cooldown) end
},
databars = {
order = 10,
type = "execute",
name = L["DataBars"],
confirm = true,
confirmText = L["Are you sure you want to reset DataBars settings?"],
func = function() E:CopyTable(E.db.databars, P.databars) end
},
datatexts = {
order = 11,
type = "execute",
name = L["DataTexts"],
confirm = true,
confirmText = L["Are you sure you want to reset DataTexts settings?"],
func = function() E:CopyTable(E.db.datatexts, P.datatexts) end
},
nameplates = {
order = 12,
type = "execute",
name = L["NamePlates"],
confirm = true,
confirmText = L["Are you sure you want to reset NamePlates settings?"],
func = function() E:CopyTable(E.db.nameplates, P.nameplates) end
},
tooltip = {
order = 13,
type = "execute",
name = L["Tooltip"],
confirm = true,
confirmText = L["Are you sure you want to reset Tooltip settings?"],
func = function() E:CopyTable(E.db.tooltip, P.tooltip) end
},
uniframes = {
order = 14,
type = "execute",
name = L["UnitFrames"],
confirm = true,
confirmText = L["Are you sure you want to reset UnitFrames settings?"],
func = function() E:CopyTable(E.db.unitframe, P.unitframe) UF:Update_AllFrames() end
}
}
}
}
}