Merge pull request #61 from ElvUI-Vanilla/testupdates

Testupdates
This commit is contained in:
Crum
2018-11-09 23:04:44 -06:00
committed by GitHub
60 changed files with 1950 additions and 327 deletions
+45 -4
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,32 @@ 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_CombatText",
"Blizzard_CraftUI",
"Blizzard_GMSurveyUI",
"Blizzard_InspectUI",
"Blizzard_MacroUI",
"Blizzard_RaidUI",
"Blizzard_TalentUI",
"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,8 +169,10 @@ 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)
end end
end end
+3 -1
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"/>
</Ui> <Script file="StatusReport.lua"/>
<Script file="modulecopy.lua"/>
</Ui>
+173 -27
View File
@@ -4,10 +4,11 @@ local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, Profi
--Lua functions --Lua functions
local _G = _G local _G = _G
local pairs, assert = pairs, assert local pairs, assert = pairs, assert
local getn, tremove, tContains, tinsert, wipe = table.getn, tremove, tContains, tinsert, table.wipe local getn, setn, tremove, tContains, tinsert, wipe = table.getn, table.setn, tremove, tContains, tinsert, table.wipe
local lower = string.lower local lower = string.lower
--WoW API / Variables --WoW API / Variables
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local IsAddOnLoaded = IsAddOnLoaded
local UnitIsDeadOrGhost, InCinematic = UnitIsDeadOrGhost, InCinematic local UnitIsDeadOrGhost, InCinematic = UnitIsDeadOrGhost, InCinematic
local GetBindingFromClick, RunBinding = GetBindingFromClick, RunBinding local GetBindingFromClick, RunBinding = GetBindingFromClick, RunBinding
local PurchaseSlot, GetBankSlotCost = PurchaseSlot, GetBankSlotCost local PurchaseSlot, GetBankSlotCost = PurchaseSlot, GetBankSlotCost
@@ -15,12 +16,13 @@ local MoneyFrame_Update = MoneyFrame_Update
local SetCVar, DisableAddOn = SetCVar, DisableAddOn local SetCVar, DisableAddOn = SetCVar, DisableAddOn
local ReloadUI, PlaySound, StopMusic = ReloadUI, PlaySound, StopMusic local ReloadUI, PlaySound, StopMusic = ReloadUI, PlaySound, StopMusic
local StaticPopup_Resize = StaticPopup_Resize local StaticPopup_Resize = StaticPopup_Resize
local YES, NO, OKAY, CANCEL, ACCEPT, DECLINE = YES, NO, OKAY, CANCEL, ACCEPT, DECLINE
E.PopupDialogs = {} E.PopupDialogs = {}
E.StaticPopup_DisplayedFrames = {} E.StaticPopup_DisplayedFrames = {}
E.PopupDialogs["ELVUI_UPDATE_AVAILABLE"] = { E.PopupDialogs["ELVUI_UPDATE_AVAILABLE"] = {
text = L["ElvUI is five or more revisions out of date. You can download the newest version from https://github.com/ElvUI-Vanilla/ElvUI/"], text = L["ElvUI is five or more revisions out of date. You can download the newest version from https://github.com/ElvUI-TBC/ElvUI/"],
hasEditBox = 1, hasEditBox = 1,
OnShow = function() OnShow = function()
this.editBox:SetAutoFocus(false) this.editBox:SetAutoFocus(false)
@@ -55,6 +57,52 @@ E.PopupDialogs["ELVUI_UPDATE_AVAILABLE"] = {
showAlert = 1 showAlert = 1
} }
E.PopupDialogs["ELVUI_EDITBOX"] = {
text = E.title,
button1 = OKAY,
hasEditBox = 1,
OnShow = function()
this.editBox:SetAutoFocus(false)
this.editBox.width = this.editBox:GetWidth()
E:Width(this.editBox, 280)
this.editBox:AddHistoryLine("text")
this.editBox.temptxt = arg1
this.editBox:SetText(arg1)
this.editBox:HighlightText()
this.editBox:SetJustifyH("CENTER")
end,
OnHide = function()
E:Width(this.editBox, this.editBox.width or 50)
this.editBox.width = nil
this.temptxt = nil
end,
EditBoxOnEnterPressed = function()
this:GetParent():Hide()
end,
EditBoxOnEscapePressed = function()
this:GetParent():Hide()
end,
EditBoxOnTextChanged = function()
if this:GetText() ~= this.temptxt then
this:SetText(this.temptxt)
end
this:HighlightText()
this:ClearFocus()
end,
OnAccept = E.noop,
timeout = 0,
whileDead = 1,
preferredIndex = 3,
hideOnEscape = 1,
}
E.PopupDialogs["CLIENT_UPDATE_REQUEST"] = {
text = L["Detected that your ElvUI Config addon is out of date. Not having your ElvUI Config addon up to date will result in missing options."],
button1 = OKAY,
OnAccept = E.noop,
showAlert = 1
}
E.PopupDialogs["CLIQUE_ADVERT"] = { E.PopupDialogs["CLIQUE_ADVERT"] = {
text = L["Using the healer layout it is highly recommended you download the addon Clique if you wish to have the click-to-heal function."], text = L["Using the healer layout it is highly recommended you download the addon Clique if you wish to have the click-to-heal function."],
button1 = YES, button1 = YES,
@@ -136,16 +184,6 @@ E.PopupDialogs["CONFIGAURA_SET"] = {
hideOnEscape = false hideOnEscape = false
} }
E.PopupDialogs["QUEUE_TAINT"] = {
text = L["You have changed your UIScale, however you still have the AutoScale option enabled in ElvUI. Press accept if you would like to disable the Auto Scale option."],
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = ReloadUI,
timeout = 0,
whileDead = 1,
hideOnEscape = false
}
E.PopupDialogs["FAILED_UISCALE"] = { E.PopupDialogs["FAILED_UISCALE"] = {
text = L["You have changed your UIScale, however you still have the AutoScale option enabled in ElvUI. Press accept if you would like to disable the Auto Scale option."], text = L["You have changed your UIScale, however you still have the AutoScale option enabled in ElvUI. Press accept if you would like to disable the Auto Scale option."],
button1 = ACCEPT, button1 = ACCEPT,
@@ -186,6 +224,56 @@ E.PopupDialogs["PRIVATE_RL"] = {
hideOnEscape = false hideOnEscape = false
} }
E.PopupDialogs["RESET_UF_UNIT"] = {
text = L["Accepting this will reset the UnitFrame settings for %s. Are you sure?"],
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = function()
if this.data and this.data.unit then
local UF = E:GetModule("UnitFrames")
UF:ResetUnitSettings(this.data.unit)
if this.data.mover then
E:ResetMovers(this.data.mover)
end
if this.data.unit == "raidpet" then
UF:CreateAndUpdateHeaderGroup(this.data.unit, nil, nil, true)
end
if IsAddOnLoaded("ElvUI_Config") then
local ACD = LibStub and LibStub("AceConfigDialog-3.0-ElvUI")
if ACD and ACD.OpenFrames and ACD.OpenFrames.ElvUI then
ACD:SelectGroup("ElvUI", "unitframe", this.data.unit)
end
end
else
E:Print(L["Error resetting UnitFrame."])
end
end,
timeout = 0,
whileDead = 1,
hideOnEscape = false,
}
E.PopupDialogs["RESET_NP_AF"] = {
text = L["Accepting this will reset your Filter Priority lists for all auras on NamePlates. Are you sure?"],
button1 = ACCEPT,
button2 = CANCEL,
OnAccept = function()
for unitType, content in pairs(E.db.nameplates.units) do
if content.buffs and content.buffs.filters then
content.buffs.filters.priority = P.nameplates.units[unitType].buffs.filters.priority
end
if content.debuffs and content.debuffs.filters then
content.debuffs.filters.priority = P.nameplates.units[unitType].debuffs.filters.priority
end
end
end,
timeout = 0,
whileDead = 1,
hideOnEscape = false,
}
E.PopupDialogs["KEYBIND_MODE"] = { E.PopupDialogs["KEYBIND_MODE"] = {
text = L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the escape key or right click to clear the current actionbutton's keybinding."], text = L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the escape key or right click to clear the current actionbutton's keybinding."],
button1 = L["Save"], button1 = L["Save"],
@@ -342,6 +430,7 @@ E.PopupDialogs["APPLY_FONT_WARNING"] = {
E.db.chat.tapFontSize = fontSize E.db.chat.tapFontSize = fontSize
E.db.datatexts.font = font E.db.datatexts.font = font
E.db.datatexts.fontSize = fontSize E.db.datatexts.fontSize = fontSize
E.db.general.minimap.locationFont = font
E.db.tooltip.font = font E.db.tooltip.font = font
E.db.tooltip.fontSize = fontSize E.db.tooltip.fontSize = fontSize
E.db.tooltip.headerFontSize = fontSize E.db.tooltip.headerFontSize = fontSize
@@ -365,6 +454,14 @@ E.PopupDialogs["APPLY_FONT_WARNING"] = {
hideOnEscape = false hideOnEscape = false
} }
E.PopupDialogs["MODULE_COPY_CONFIRM"] = {
button1 = ACCEPT,
button2 = CANCEL,
timeout = 0,
whileDead = 1,
hideOnEscape = false
}
local MAX_STATIC_POPUPS = 4 local MAX_STATIC_POPUPS = 4
function E:StaticPopup_OnShow() function E:StaticPopup_OnShow()
@@ -372,12 +469,27 @@ function E:StaticPopup_OnShow()
local dialog = E.PopupDialogs[this.which] local dialog = E.PopupDialogs[this.which]
local OnShow = dialog.OnShow local OnShow = dialog.OnShow
if OnShow then if OnShow then
OnShow(this.data) OnShow(this.data)
end end
if dialog.enterClicksFirstButton then if dialog.enterClicksFirstButton then
this:SetScript("OnKeyDown", E.StaticPopup_OnKeyDown) this:SetScript("OnKeyDown", E.StaticPopup_OnKeyDown)
end end
-- boost static popups over ace gui
--[[ if IsAddOnLoaded("ElvUI_Config") then
local ACD = LibStub and LibStub("AceConfigDialog-3.0")
if ACD and ACD.OpenFrames and ACD.OpenFrames.ElvUI then
this.frameStrataIncreased = true
this:SetFrameStrata("FULLSCREEN_DIALOG")
local popupFrameLevel = this:GetFrameLevel()
if popupFrameLevel < 100 then
this:SetFrameLevel(popupFrameLevel+100)
end
end
end--]]
end end
function E:StaticPopup_EscapePressed() function E:StaticPopup_EscapePressed()
@@ -451,20 +563,21 @@ function E:StaticPopup_IsLastDisplayedFrame(frame)
end end
function E:StaticPopup_OnKeyDown(key) function E:StaticPopup_OnKeyDown(key)
if GetBindingFromClick(key) == "TOGGLEGAMEMENU" then if GetBindingKey(key) == "TOGGLEGAMEMENU" then
return E:StaticPopup_EscapePressed() return E:StaticPopup_EscapePressed()
elseif GetBindingFromClick(key) == "SCREENSHOT" then elseif GetBindingKey(key) == "SCREENSHOT" then
RunBinding("SCREENSHOT") RunBinding("SCREENSHOT")
return return
end end
local dialog = E.PopupDialogs[this.which] local dialog = E.PopupDialogs[this.which]
if dialog then if dialog then
if arg1 == "ENTER" and dialog.enterClicksFirstButton then print(key, arg1)
if key == "ENTER" and dialog.enterClicksFirstButton then
local frameName = this:GetName() local frameName = this:GetName()
local button local button
local i = 1 local i = 1
while true do while(true) do
button = _G[frameName.."Button"..i] button = _G[frameName.."Button"..i]
if button then if button then
if button:IsShown() then if button:IsShown() then
@@ -493,6 +606,17 @@ function E:StaticPopup_OnHide()
if dialog.enterClicksFirstButton then if dialog.enterClicksFirstButton then
this:SetScript("OnKeyDown", nil) this:SetScript("OnKeyDown", nil)
end end
-- static popup was boosted over ace gui, set it back to normal
--[[ if this.frameStrataIncreased then
this.frameStrataIncreased = nil
this:SetFrameStrata("DIALOG")
local popupFrameLevel = this:GetFrameLevel()
if popupFrameLevel > 100 then
this:SetFrameLevel(popupFrameLevel-100)
end
end--]]
end end
function E:StaticPopup_OnUpdate() function E:StaticPopup_OnUpdate()
@@ -535,9 +659,8 @@ function E:StaticPopup_OnUpdate()
end end
function E:StaticPopup_OnClick(index) function E:StaticPopup_OnClick(index)
if not self:IsShown() then if not self:IsShown() then return end
return
end
local which = self.which local which = self.which
local info = E.PopupDialogs[which] local info = E.PopupDialogs[which]
if not info then if not info then
@@ -573,6 +696,7 @@ function E:StaticPopup_EditBoxOnEnterPressed()
which = parent.which which = parent.which
dialog = parent dialog = parent
elseif parent:GetParent().which then elseif parent:GetParent().which then
-- This is needed if this is a money input frame since it's nested deeper than a normal edit box
which = parent:GetParent().which which = parent:GetParent().which
dialog = parent:GetParent() dialog = parent:GetParent()
end end
@@ -603,7 +727,7 @@ function E:StaticPopup_FindVisible(which, data)
end end
for index = 1, MAX_STATIC_POPUPS, 1 do for index = 1, MAX_STATIC_POPUPS, 1 do
local frame = _G["ElvUI_StaticPopup"..index] local frame = _G["ElvUI_StaticPopup"..index]
if (frame:IsShown() and (frame.which == which) and (not info.multiple or (frame.data == data))) then if frame:IsShown() and (frame.which == which) and (not info.multiple or (frame.data == data)) then
return frame return frame
end end
end end
@@ -679,7 +803,7 @@ function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
if info.cancels then if info.cancels then
for index = 1, MAX_STATIC_POPUPS, 1 do for index = 1, MAX_STATIC_POPUPS, 1 do
local frame = _G["ElvUI_StaticPopup"..index] local frame = _G["ElvUI_StaticPopup"..index]
if (frame:IsShown() and (frame.which == info.cancels)) then if frame:IsShown() and (frame.which == info.cancels) then
frame:Hide() frame:Hide()
local OnCancel = E.PopupDialogs[frame.which].OnCancel local OnCancel = E.PopupDialogs[frame.which].OnCancel
if OnCancel then if OnCancel then
@@ -731,10 +855,12 @@ function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
dialog.maxHeightSoFar, dialog.maxWidthSoFar = 0, 0 dialog.maxHeightSoFar, dialog.maxWidthSoFar = 0, 0
-- Set the text of the dialog
local name = dialog:GetName() local name = dialog:GetName()
local text = _G[name.."Text"] local text = _G[name.."Text"]
text:SetText(format(info.text, text_arg1, text_arg2)) text:SetText(format(info.text, text_arg1, text_arg2))
-- Show or hide the close button
if info.closeButton then if info.closeButton then
local closeButton = _G[name.."CloseButton"] local closeButton = _G[name.."CloseButton"]
if info.closeButtonIsHide then if info.closeButtonIsHide then
@@ -749,6 +875,7 @@ function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
_G[name.."CloseButton"]:Hide() _G[name.."CloseButton"]:Hide()
end end
-- Set the editbox of the dialog
local editBox = _G[name.."EditBox"] local editBox = _G[name.."EditBox"]
if info.hasEditBox then if info.hasEditBox then
editBox:Show() editBox:Show()
@@ -769,41 +896,49 @@ function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
editBox:Hide() editBox:Hide()
end end
-- Show or hide money frame
if info.hasMoneyFrame then if info.hasMoneyFrame then
_G[name.."MoneyFrame"]:Show() _G[name.."MoneyFrame"]:Show()
else else
_G[name.."MoneyFrame"]:Hide() _G[name.."MoneyFrame"]:Hide()
end end
-- Set the miscellaneous variables for the dialog
dialog.which = which dialog.which = which
dialog.timeleft = info.timeout dialog.timeleft = info.timeout
dialog.hideOnEscape = info.hideOnEscape dialog.hideOnEscape = info.hideOnEscape
dialog.exclusive = info.exclusive dialog.exclusive = info.exclusive
dialog.enterClicksFirstButton = info.enterClicksFirstButton dialog.enterClicksFirstButton = info.enterClicksFirstButton
-- Clear out data
dialog.data = data dialog.data = data
-- Set the buttons of the dialog
local button1 = _G[name.."Button1"] local button1 = _G[name.."Button1"]
local button2 = _G[name.."Button2"] local button2 = _G[name.."Button2"]
do do --If there is any recursion in this block, we may get errors (tempButtonLocs is static). If you have to recurse, we'll have to create a new table each time.
assert(getn(tempButtonLocs) == 0) assert(getn(tempButtonLocs) == 0) --If this fails, we're recursing. (See the table.wipe at the end of the block)
tinsert(tempButtonLocs, button1) tinsert(tempButtonLocs, button1)
tinsert(tempButtonLocs, button2) tinsert(tempButtonLocs, button2)
for i = getn(tempButtonLocs), 1, -1 do for i = getn(tempButtonLocs), 1, -1 do
--Do this stuff before we move it. (This is why we go back-to-front)
if info["button"..i] then if info["button"..i] then
tempButtonLocs[i]:SetText(info["button"..i]) tempButtonLocs[i]:SetText(info["button"..i])
end end
tempButtonLocs[i]:Hide() tempButtonLocs[i]:Hide()
tempButtonLocs[i]:ClearAllPoints() tempButtonLocs[i]:ClearAllPoints()
if not (info["button"..i] and (not info["DisplayButton"..i] or info["DisplayButton"..i](dialog))) then --Now we possibly remove it.
if not (info["button"..i] and ( not info["DisplayButton"..i] or info["DisplayButton"..i](dialog))) then
tremove(tempButtonLocs, i) tremove(tempButtonLocs, i)
end end
end end
local numButtons = getn(tempButtonLocs) local numButtons = getn(tempButtonLocs)
--Save off the number of buttons.
dialog.numButtons = numButtons dialog.numButtons = numButtons
if numButtons == 2 then if numButtons == 2 then
tempButtonLocs[1]:SetPoint("BOTTOMRIGHT", dialog, "BOTTOM", -6, 16) tempButtonLocs[1]:SetPoint("BOTTOMRIGHT", dialog, "BOTTOM", -6, 16)
elseif numButtons == 1 then elseif numButtons == 1 then
@@ -826,9 +961,10 @@ function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
end end
wipe(tempButtonLocs) wipe(tempButtonLocs)
table.setn(tempButtonLocs, 0) setn(tempButtonLocs, 0)
end end
-- Show or hide the alert icon
local alertIcon = _G[name.."AlertIcon"] local alertIcon = _G[name.."AlertIcon"]
if info.showAlert then if info.showAlert then
alertIcon:SetTexture("Interface\\DialogFrame\\DialogAlertIcon") alertIcon:SetTexture("Interface\\DialogFrame\\DialogAlertIcon")
@@ -866,7 +1002,7 @@ end
function E:StaticPopup_Hide(which, data) function E:StaticPopup_Hide(which, data)
for index = 1, MAX_STATIC_POPUPS, 1 do for index = 1, MAX_STATIC_POPUPS, 1 do
local dialog = _G["ElvUI_StaticPopup"..index] local dialog = _G["ElvUI_StaticPopup"..index]
if ((dialog.which == which) and (not data or (data == dialog.data))) then if (dialog.which == which) and (not data or (data == dialog.data)) then
dialog:Hide() dialog:Hide()
end end
end end
@@ -880,6 +1016,7 @@ function E:Contruct_StaticPopups()
E.StaticPopupFrames[index] = CreateFrame("Frame", "ElvUI_StaticPopup"..index, E.UIParent, "StaticPopupTemplate") E.StaticPopupFrames[index] = CreateFrame("Frame", "ElvUI_StaticPopup"..index, E.UIParent, "StaticPopupTemplate")
E.StaticPopupFrames[index]:SetID(index) E.StaticPopupFrames[index]:SetID(index)
--Fix Scripts
E.StaticPopupFrames[index]:SetScript("OnShow", E.StaticPopup_OnShow) E.StaticPopupFrames[index]:SetScript("OnShow", E.StaticPopup_OnShow)
E.StaticPopupFrames[index]:SetScript("OnHide", E.StaticPopup_OnHide) E.StaticPopupFrames[index]:SetScript("OnHide", E.StaticPopup_OnHide)
E.StaticPopupFrames[index]:SetScript("OnUpdate", E.StaticPopup_OnUpdate) E.StaticPopupFrames[index]:SetScript("OnUpdate", E.StaticPopup_OnUpdate)
@@ -901,6 +1038,7 @@ function E:Contruct_StaticPopups()
_G[name.."EditBox"]:SetScript("OnEscapePressed", E.StaticPopup_EditBoxOnEscapePressed) _G[name.."EditBox"]:SetScript("OnEscapePressed", E.StaticPopup_EditBoxOnEscapePressed)
_G[name.."EditBox"]:SetScript("OnTextChanged", E.StaticPopup_EditBoxOnTextChanged) _G[name.."EditBox"]:SetScript("OnTextChanged", E.StaticPopup_EditBoxOnTextChanged)
--Skin
E:SetTemplate(E.StaticPopupFrames[index], "Transparent") E:SetTemplate(E.StaticPopupFrames[index], "Transparent")
E.StaticPopupFrames[index].text = _G[name.."Text"] E.StaticPopupFrames[index].text = _G[name.."Text"]
@@ -909,6 +1047,14 @@ function E:Contruct_StaticPopups()
_G[name.."EditBox"]:DisableDrawLayer("BACKGROUND") _G[name.."EditBox"]:DisableDrawLayer("BACKGROUND")
S:HandleEditBox(_G[name.."EditBox"]) S:HandleEditBox(_G[name.."EditBox"])
for k = 1, _G[name.."EditBox"]:GetNumRegions() do
local region = select(k, _G[name.."EditBox"]:GetRegions())
if region and region:IsObjectType("Texture") then
if region:GetTexture() == "Interface\\ChatFrame\\UI-ChatInputBorder-Left" or region:GetTexture() == "Interface\\ChatFrame\\UI-ChatInputBorder-Right" then
E:Kill(region)
end
end
end
S:HandleEditBox(_G[name.."MoneyInputFrameGold"]) S:HandleEditBox(_G[name.."MoneyInputFrameGold"])
S:HandleEditBox(_G[name.."MoneyInputFrameSilver"]) S:HandleEditBox(_G[name.."MoneyInputFrameSilver"])
@@ -919,4 +1065,4 @@ function E:Contruct_StaticPopups()
E:SecureHook("StaticPopup_Resize", "StaticPopup_SetUpPosition") E:SecureHook("StaticPopup_Resize", "StaticPopup_SetUpPosition")
E:SecureHook("StaticPopup_OnHide", "StaticPopup_CollapseTable") E:SecureHook("StaticPopup_OnHide", "StaticPopup_CollapseTable")
end end
+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
+185 -147
View File
@@ -6,7 +6,7 @@ local LSM = LibStub("LibSharedMedia-3.0");
local _G = _G local _G = _G
local tonumber, pairs, ipairs, error, unpack, select, tostring = tonumber, pairs, ipairs, error, unpack, select, tostring local tonumber, pairs, ipairs, error, unpack, select, tostring = tonumber, pairs, ipairs, error, unpack, select, tostring
local assert, print, type, collectgarbage, pcall, date = assert, print, type, collectgarbage, pcall, date local assert, print, type, collectgarbage, pcall, date = assert, print, type, collectgarbage, pcall, date
local twipe, tinsert, tremove, next = table.wipe, tinsert, tremove, next local getn, twipe, tinsert, tremove, next = table.getn, table.wipe, tinsert, tremove, next
local floor = floor local floor = floor
local format, find, match, strrep, len, sub, gsub = string.format, string.find, string.match, strrep, string.len, string.sub, string.gsub local format, find, match, strrep, len, sub, gsub = string.format, string.find, string.match, strrep, string.len, string.sub, string.gsub
--WoW API / Variables --WoW API / Variables
@@ -15,27 +15,28 @@ local GetCVar = GetCVar
local GetFunctionCPUUsage = GetFunctionCPUUsage local GetFunctionCPUUsage = GetFunctionCPUUsage
local GetTalentTabInfo = GetTalentTabInfo local GetTalentTabInfo = GetTalentTabInfo
local IsAddOnLoaded = IsAddOnLoaded local IsAddOnLoaded = IsAddOnLoaded
local IsInGuild = IsInGuild
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 UnitFactionGroup = UnitFactionGroup
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.myLocalizedClass, E.myclass = 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 +86,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 +117,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 +131,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
@@ -162,19 +150,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
func(unpack(delayedFuncs[func]))
end end
else
return assignedRole twipe(delayedFuncs)
end delayedTimer = nil
end, 0.05)
end end
function E:CheckClassColor(r, g, b) function E:CheckClassColor(r, g, b)
@@ -205,7 +195,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 +261,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 +272,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 +290,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()
@@ -424,9 +415,9 @@ end
E.UIParent = CreateFrame("Frame", "ElvUIParent", UIParent) E.UIParent = CreateFrame("Frame", "ElvUIParent", UIParent)
E.UIParent:SetFrameLevel(UIParent:GetFrameLevel()) E.UIParent:SetFrameLevel(UIParent:GetFrameLevel())
E.UIParent:SetPoint("CENTER", UIParent, "CENTER") E.UIParent:SetPoint("CENTER", UIParent, "CENTER")
E.UIParent:SetHeight(GetScreenHeight())
E.UIParent:SetWidth(GetScreenWidth()) E.UIParent:SetWidth(GetScreenWidth())
tinsert(E["snapBars"], E.UIParent) E.UIParent:SetHeight(GetScreenHeight())
E["snapBars"][getn(E["snapBars"]) + 1] = E.UIParent
E.HiddenFrame = CreateFrame("Frame") E.HiddenFrame = CreateFrame("Frame")
E.HiddenFrame:Hide() E.HiddenFrame:Hide()
@@ -439,11 +430,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 +444,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 +453,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 +580,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)")
@@ -611,30 +621,30 @@ function E:TableToLuaString(inTable)
local ret = "{\n" local ret = "{\n"
local function recurse(table, level) local function recurse(table, level)
for i, v in pairs(table) do for i, v in pairs(table) do
ret = ret .. strrep(" ", level).."[" ret = ret..strrep(" ", level).."["
if type(i) == "string" then if type(i) == "string" then
ret = ret .. "\"" .. i .. "\"" ret = ret.."\""..i.."\""
else else
ret = ret .. i ret = ret..i
end end
ret = ret .. "] = " ret = ret.."] = "
if type(v) == "number" then if type(v) == "number" then
ret = ret .. v .. ",\n" ret = ret..v..",\n"
elseif type(v) == "string" then elseif type(v) == "string" then
ret = ret .. "\"" .. gsub(gsub(gsub(v, "\\", "\\\\"), "\n", "\\n"), "\"", "\\\"") .. "\",\n" ret = ret.."\""..gsub(gsub(gsub(v, "\\", "\\\\"), "\n", "\\n"), "\"", "\\\"").."\",\n"
elseif type(v) == "boolean" then elseif type(v) == "boolean" then
if v then if v then
ret = ret .. "true,\n" ret = ret.."true,\n"
else else
ret = ret .. "false,\n" ret = ret.."false,\n"
end end
elseif type(v) == "table" then elseif type(v) == "table" then
ret = ret .. "{\n" ret = ret.."{\n"
recurse(v, level + 1) recurse(v, level + 1)
ret = ret .. strrep(" ", level) .. "},\n" ret = ret..strrep(" ", level).."},\n"
else else
ret = ret .. "\""..tostring(v) .. "\",\n" ret = ret.."\""..tostring(v).."\",\n"
end end
end end
end end
@@ -651,18 +661,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 = ""
@@ -673,9 +680,9 @@ function E:ProfileTableToPluginFormat(inTable, profileType)
local str = profileText local str = profileText
for _, v in ipairs(lineStructureTable) do for _, v in ipairs(lineStructureTable) do
if type(v) == "string" then if type(v) == "string" then
str = str .. "[\"" .. v .. "\"]" str = str.."[\""..v.."\"]"
else else
str = str .. "[" .. v .. "]" str = str.."["..v.."]"
end end
end end
@@ -686,38 +693,38 @@ function E:ProfileTableToPluginFormat(inTable, profileType)
lineStructure = buildLineStructure() lineStructure = buildLineStructure()
for k, v in pairs(tbl) do for k, v in pairs(tbl) do
if not sameLine then if not sameLine then
returnString = returnString .. lineStructure returnString = returnString..lineStructure
end end
returnString = returnString .. "[" returnString = returnString.."["
if type(k) == "string" then if type(k) == "string" then
returnString = returnString.."\"" .. k .. "\"" returnString = returnString.."\""..k.."\""
else else
returnString = returnString .. k returnString = returnString..k
end end
if type(v) == "table" then if type(v) == "table" then
tinsert(lineStructureTable, k) tinsert(lineStructureTable, k)
sameLine = true sameLine = true
returnString = returnString .. "]" returnString = returnString.."]"
recurse(v) recurse(v)
else else
sameLine = false sameLine = false
returnString = returnString .. "] = " returnString = returnString.."] = "
if type(v) == "number" then if type(v) == "number" then
returnString = returnString .. v .. "\n" returnString = returnString..v.."\n"
elseif type(v) == "string" then elseif type(v) == "string" then
returnString = returnString .. "\"" .. gsub(gsub(gsub(v, "\\", "\\\\"), "\n", "\\n"), "\"", "\\\"") .. "\"\n" returnString = returnString.."\""..gsub(gsub(gsub(v, "\\", "\\\\"), "\n", "\\n"), "\"", "\\\"").."\"\n"
elseif type(v) == "boolean" then elseif type(v) == "boolean" then
if v then if v then
returnString = returnString .. "true\n" returnString = returnString.."true\n"
else else
returnString = returnString .. "false\n" returnString = returnString.."false\n"
end end
else else
returnString = returnString .. "\"" .. tostring(v) .. "\"\n" returnString = returnString.."\""..tostring(v).."\"\n"
end end
end end
end end
@@ -739,7 +746,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 +761,63 @@ 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()
SendAddonMessage("ELVUI_VERSIONCHK", E.version, "BATTLEGROUND") if instanceType == "pvp" then
else SendAddonMessage("ELVUI_VERSIONCHK", E.version, "BATTLEGROUND")
if numRaid > 0 then else
SendAddonMessage("ELVUI_VERSIONCHK", E.version, "RAID") SendAddonMessage("ELVUI_VERSIONCHK", E.version, "RAID")
elseif numParty > 0 then
SendAddonMessage("ELVUI_VERSIONCHK", E.version, "PARTY")
end end
elseif numParty > 0 then
SendAddonMessage("ELVUI_VERSIONCHK", E.version, "PARTY")
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 local prefix, message, sender = arg1, arg2, arg4
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 arg1 == "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/"]) E:StaticPopup_Show("ELVUI_UPDATE_AVAILABLE")
end
if arg2 - tonumber(E.version) >= 0.05 then E.recievedOutOfDateMessage = true
E:StaticPopup_Show("ELVUI_UPDATE_AVAILABLE") end
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
E.recievedOutOfDateMessage = true
end end
else 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 +825,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 +837,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
@@ -844,15 +862,21 @@ 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")
DT.db = self.db.datatexts DT.db = self.db.datatexts
DT:LoadDataTexts() DT:LoadDataTexts()
local NP = self:GetModule("NamePlates") -- local NP = self:GetModule("NamePlates")
NP.db = self.db.nameplates -- NP.db = self.db.nameplates
NP:ConfigureAll() -- NP:StyleFilterInitializeAllFilters()
-- NP:ConfigureAll()
local DataBars = self:GetModule("DataBars") local DataBars = self:GetModule("DataBars")
DataBars.db = E.db.databars DataBars.db = E.db.databars
@@ -860,16 +884,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 +919,7 @@ function E:UpdateAll(ignoreInstall)
LO:TopPanelVisibility() LO:TopPanelVisibility()
LO:SetDataPanelStyle() LO:SetDataPanelStyle()
self:GetModule("Blizzard"):SetWatchFrameHeight() collectgarbage()
end end
function E:ResetAllUI() function E:ResetAllUI()
@@ -1056,6 +1085,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
@@ -1084,6 +1116,8 @@ function E:GetTopCPUFunc(msg)
end end
function E:Initialize() function E:Initialize()
self.myfaction, self.myLocalizedFaction = UnitFactionGroup("player")
twipe(self.db) twipe(self.db)
twipe(self.global) twipe(self.global)
twipe(self.private) twipe(self.private)
@@ -1092,6 +1126,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,24 +1140,27 @@ 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
self:Install() self:Install()
end end
-- if not find(date(), "04/01/") then -- if not find(date(), "04/01/") then
-- E.global.aprilFools = nil -- E.global.aprilFools = nil
-- end -- end
--if self:HelloKittyFixCheck() then -- if self:HelloKittyFixCheck() then
-- self:HelloKittyFix() -- self:HelloKittyFix()
--end -- end
self:UpdateMedia() self:UpdateMedia()
self:UpdateFrameTemplates() self:UpdateFrameTemplates()
--self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED", "CheckRole") self:UpdateBorderColors()
self:UpdateBackdropColors()
self:UpdateStatusBars()
-- 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")
self:RegisterEvent("PLAYER_ENTERING_WORLD") self:RegisterEvent("PLAYER_ENTERING_WORLD")
@@ -1140,4 +1178,4 @@ function E:Initialize()
if self.db.general.loginmessage then if self.db.general.loginmessage then
print(select(2, E:GetModule("Chat"):FindURL("CHAT_MSG_DUMMY", format(L["LOGIN_MSG"], self["media"].hexvaluecolor, self["media"].hexvaluecolor, self.version)))..".") print(select(2, E:GetModule("Chat"):FindURL("CHAT_MSG_DUMMY", format(L["LOGIN_MSG"], self["media"].hexvaluecolor, self["media"].hexvaluecolor, self.version)))..".")
end end
end end
+40 -29
View File
@@ -30,7 +30,7 @@ function D:Initialize()
self:RegisterComm(REQUEST_PREFIX) self:RegisterComm(REQUEST_PREFIX)
self:RegisterEvent("CHAT_MSG_ADDON") self:RegisterEvent("CHAT_MSG_ADDON")
self.statusBar = CreateFrame("StatusBar", "ElvUI_Download", UIParent) self.statusBar = CreateFrame("StatusBar", "ElvUI_Download", E.UIParent)
E:RegisterStatusBar(self.statusBar) E:RegisterStatusBar(self.statusBar)
E:CreateBackdrop(self.statusBar, "Default") E:CreateBackdrop(self.statusBar, "Default")
self.statusBar:SetStatusBarTexture(E.media.normTex) self.statusBar:SetStatusBarTexture(E.media.normTex)
@@ -78,23 +78,26 @@ function D:Distribute(target, otherServer, isGlobal)
return return
end end
else else
self:SendCommMessage(REQUEST_PREFIX, message, "WHISPER", target) self:SendCommMessage(REQUEST_PREFIX, message, "PARTY", target)
end end
self:RegisterComm(REPLY_PREFIX) self:RegisterComm(REPLY_PREFIX)
E:StaticPopup_Show("DISTRIBUTOR_WAITING") E:StaticPopup_Show("DISTRIBUTOR_WAITING")
end end
function D:CHAT_MSG_ADDON() function D:CHAT_MSG_ADDON()
if not Downloads[arg4] then return end local prefix, message, sender = arg1, arg2, arg4
local cur = len(arg2)
local max = Downloads[arg4].length
Downloads[arg4].current = Downloads[arg4].current + cur
if Downloads[arg4].current > max then if --[[prefix ~= TRANSFER_PREFIX or --]] not Downloads[sender] then return end
Downloads[arg4].current = max
local cur = len(message)
local max = Downloads[sender].length
Downloads[sender].current = Downloads[sender].current + cur
if Downloads[sender].current > max then
Downloads[sender].current = max
end end
self.statusBar:SetValue(Downloads[arg4].current) self.statusBar:SetValue(Downloads[sender].current)
end end
function D:OnCommReceived(prefix, msg, dist, sender) function D:OnCommReceived(prefix, msg, dist, sender)
@@ -131,14 +134,14 @@ function D:OnCommReceived(prefix, msg, dist, sender)
button2 = CANCEL, button2 = CANCEL,
timeout = 32, timeout = 32,
whileDead = 1, whileDead = 1,
hideOnEscape = 1, hideOnEscape = 1
} }
E:StaticPopup_Show("DISTRIBUTOR_RESPONSE") E:StaticPopup_Show("DISTRIBUTOR_RESPONSE")
Downloads[sender] = { Downloads[sender] = {
current = 0, current = 0,
length = tonumber(length), length = tonumber(length),
profile = profile, profile = profile
} }
self:RegisterComm(TRANSFER_PREFIX) self:RegisterComm(TRANSFER_PREFIX)
@@ -184,7 +187,7 @@ function D:OnCommReceived(prefix, msg, dist, sender)
E:UpdateAll(true) E:UpdateAll(true)
Downloads[sender] = nil Downloads[sender] = nil
end, end,
OnShow = function(self) self.editBox:SetText(profileKey) self.editBox:SetFocus() end, OnShow = function() this.editBox:SetText(profileKey) this.editBox:SetFocus() end,
timeout = 0, timeout = 0,
exclusive = 1, exclusive = 1,
whileDead = 1, whileDead = 1,
@@ -215,7 +218,7 @@ function D:OnCommReceived(prefix, msg, dist, sender)
button1 = YES, button1 = YES,
button2 = NO, button2 = NO,
whileDead = 1, whileDead = 1,
hideOnEscape = 1, hideOnEscape = 1
} }
E:StaticPopup_Show("DISTRIBUTOR_CONFIRM") E:StaticPopup_Show("DISTRIBUTOR_CONFIRM")
@@ -248,7 +251,11 @@ local function GetProfileData(profileType)
profileKey = ElvDB.profileKeys[E.myname.." - "..E.myrealm] profileKey = ElvDB.profileKeys[E.myname.." - "..E.myrealm]
end end
--Copy current profile data
profileData = E:CopyTable(profileData , ElvDB.profiles[profileKey]) profileData = E:CopyTable(profileData , ElvDB.profiles[profileKey])
--This table will also hold all default values, not just the changed settings.
--This makes the table huge, and will cause the WoW client to lock up for several seconds.
--We compare against the default table and remove all duplicates from our table. The table is now much smaller.
profileData = E:RemoveTableDuplicates(profileData, P) profileData = E:RemoveTableDuplicates(profileData, P)
elseif profileType == "private" then elseif profileType == "private" then
local privateProfileKey = E.myname.." - "..E.myrealm local privateProfileKey = E.myname.." - "..E.myrealm
@@ -305,9 +312,7 @@ local function GetProfileExport(profileType, exportFormat)
if exportFormat == "text" then if exportFormat == "text" then
local serialData = D:Serialize(profileData) local serialData = D:Serialize(profileData)
exportString = D:CreateProfileExport(serialData, profileType, profileKey) exportString = D:CreateProfileExport(serialData, profileType, profileKey)
local compressedData = LibCompress:Compress(exportString) local compressedData = LibCompress:Compress(exportString)
local encodedData = LibBase64:Encode(compressedData) local encodedData = LibBase64:Encode(compressedData)
profileExport = encodedData profileExport = encodedData
@@ -338,7 +343,7 @@ function D:GetImportStringType(dataString)
if LibBase64:IsBase64(dataString) then if LibBase64:IsBase64(dataString) then
stringType = "Base64" stringType = "Base64"
elseif find(dataString, "{") then elseif find(dataString, "{") then --Basic check to weed out obviously wrong strings
stringType = "Table" stringType = "Table"
end end
@@ -359,14 +364,14 @@ function D:Decode(dataString)
end end
local serializedData, success local serializedData, success
serializedData, profileInfo = E:StringSplitMultiDelim(decompressedData, "^^::") serializedData, profileInfo = E:StringSplitMultiDelim(decompressedData, "^^::") -- "^^" indicates the end of the AceSerializer string
if not profileInfo then if not profileInfo then
E:Print("Error importing profile. String is invalid or corrupted!") E:Print("Error importing profile. String is invalid or corrupted!")
return return
end end
serializedData = format("%s%s", serializedData, "^^") serializedData = format("%s%s", serializedData, "^^") --Add back the AceSerializer terminator
profileType, profileKey = E:StringSplitMultiDelim(profileInfo, "::") profileType, profileKey = E:StringSplitMultiDelim(profileInfo, "::")
success, profileData = D:Deserialize(serializedData) success, profileData = D:Deserialize(serializedData)
@@ -376,7 +381,7 @@ function D:Decode(dataString)
end end
elseif stringType == "Table" then elseif stringType == "Table" then
local profileDataAsString local profileDataAsString
profileDataAsString, profileInfo = E:StringSplitMultiDelim(dataString, "}::") profileDataAsString, profileInfo = E:StringSplitMultiDelim(dataString, "}::") -- "}::" indicates the end of the table
if not profileInfo then if not profileInfo then
E:Print("Error extracting profile info. Invalid import string!") E:Print("Error extracting profile info. Invalid import string!")
@@ -388,7 +393,8 @@ function D:Decode(dataString)
return return
end end
profileDataAsString = format("%s%s", profileDataAsString, "}") profileDataAsString = format("%s%s", profileDataAsString, "}") --Add back the missing "}"
profileDataAsString = gsub(profileDataAsString, "\124\124", "\124") --Remove escape pipe characters
profileType, profileKey = E:StringSplitMultiDelim(profileInfo, "::") profileType, profileKey = E:StringSplitMultiDelim(profileInfo, "::")
local profileToTable = loadstring(format("%s %s", "return", profileDataAsString)) local profileToTable = loadstring(format("%s %s", "return", profileDataAsString))
@@ -413,10 +419,13 @@ local function SetImportedProfile(profileType, profileKey, profileData, force)
if profileType == "profile" then if profileType == "profile" then
if not ElvDB.profiles[profileKey] or force then if not ElvDB.profiles[profileKey] or force then
if force and E.data.keys.profile == profileKey then if force and E.data.keys.profile == profileKey then
--Overwriting an active profile doesn't update when calling SetProfile
--So make it look like we use a different profile
local tempKey = profileKey.."_Temp" local tempKey = profileKey.."_Temp"
E.data.keys.profile = tempKey E.data.keys.profile = tempKey
end end
ElvDB.profiles[profileKey] = profileData ElvDB.profiles[profileKey] = profileData
--Calling SetProfile will now update all settings correctly
E.data:SetProfile(profileKey) E.data:SetProfile(profileKey)
else else
D.profileType = profileType D.profileType = profileType
@@ -443,6 +452,7 @@ local function SetImportedProfile(profileType, profileKey, profileData, force)
E:CopyTable(ElvDB.global.unitframe, profileData.unitframe) E:CopyTable(ElvDB.global.unitframe, profileData.unitframe)
end end
--Update all ElvUI modules
E:UpdateAll(true) E:UpdateAll(true)
end end
@@ -453,6 +463,7 @@ function D:ExportProfile(profileType, exportFormat)
end end
local profileKey, profileExport = GetProfileExport(profileType, exportFormat) local profileKey, profileExport = GetProfileExport(profileType, exportFormat)
return profileKey, profileExport return profileKey, profileExport
end end
@@ -475,28 +486,28 @@ E.PopupDialogs["DISTRIBUTOR_SUCCESS"] = {
text = L["Your profile was successfully recieved by the player."], text = L["Your profile was successfully recieved by the player."],
whileDead = 1, whileDead = 1,
hideOnEscape = 1, hideOnEscape = 1,
button1 = OKAY, button1 = OKAY
} }
E.PopupDialogs["DISTRIBUTOR_WAITING"] = { E.PopupDialogs["DISTRIBUTOR_WAITING"] = {
text = L["Profile request sent. Waiting for response from player."], text = L["Profile request sent. Waiting for response from player."],
whileDead = 1, whileDead = 1,
hideOnEscape = 1, hideOnEscape = 1,
timeout = 35, timeout = 35
} }
E.PopupDialogs["DISTRIBUTOR_REQUEST_DENIED"] = { E.PopupDialogs["DISTRIBUTOR_REQUEST_DENIED"] = {
text = L["Request was denied by user."], text = L["Request was denied by user."],
whileDead = 1, whileDead = 1,
hideOnEscape = 1, hideOnEscape = 1,
button1 = OKAY, button1 = OKAY
} }
E.PopupDialogs["DISTRIBUTOR_FAILED"] = { E.PopupDialogs["DISTRIBUTOR_FAILED"] = {
text = L["Lord! It's a miracle! The download up and vanished like a fart in the wind! Try Again!"], text = L["Lord! It's a miracle! The download up and vanished like a fart in the wind! Try Again!"],
whileDead = 1, whileDead = 1,
hideOnEscape = 1, hideOnEscape = 1,
button1 = OKAY, button1 = OKAY
} }
E.PopupDialogs["DISTRIBUTOR_RESPONSE"] = {} E.PopupDialogs["DISTRIBUTOR_RESPONSE"] = {}
@@ -515,11 +526,11 @@ E.PopupDialogs["IMPORT_PROFILE_EXISTS"] = {
local profileData = D.profileData local profileData = D.profileData
SetImportedProfile(profileType, profileKey, profileData, true) SetImportedProfile(profileType, profileKey, profileData, true)
end, end,
EditBoxOnTextChanged = function(self) EditBoxOnTextChanged = function()
if self:GetText() == "" then if this:GetText() == "" then
self:GetParent().button1:Disable() this:GetParent().button1:Disable()
else else
self:GetParent().button1:Enable() this:GetParent().button1:Enable()
end end
end, end,
OnShow = function() this.editBox:SetText(D.profileKey) this.editBox:SetFocus() end, OnShow = function() this.editBox:SetText(D.profileKey) this.editBox:SetFocus() end,
@@ -544,4 +555,4 @@ local function InitializeCallback()
D:Initialize() D:Initialize()
end end
E:RegisterModule(D:GetName(), InitializeCallback) E:RegisterModule(D:GetName(), InitializeCallback)
+15 -12
View File
@@ -3,25 +3,26 @@ local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, Profi
--Cache global variables --Cache global variables
--Lua functions --Lua functions
local _G = _G local _G = _G
local format = format local format = string.format
--WoW API / Variables --WoW API / Variables
local CreateFrame = CreateFrame local ChangeChatColor = ChangeChatColor
local IsAddOnLoaded = IsAddOnLoaded local ChatFrame_ActivateCombatMessages = ChatFrame_ActivateCombatMessages
local GetScreenWidth = GetScreenWidth local ChatFrame_AddChannel = ChatFrame_AddChannel
local SetCVar = SetCVar
local PlaySoundFile = PlaySoundFile
local ReloadUI = ReloadUI
local UIFrameFadeOut = UIFrameFadeOut
local ChatFrame_AddMessageGroup = ChatFrame_AddMessageGroup local ChatFrame_AddMessageGroup = ChatFrame_AddMessageGroup
local ChatFrame_RemoveAllMessageGroups = ChatFrame_RemoveAllMessageGroups local ChatFrame_RemoveAllMessageGroups = ChatFrame_RemoveAllMessageGroups
local ChatFrame_AddChannel = ChatFrame_AddChannel
local ChatFrame_RemoveChannel = ChatFrame_RemoveChannel local ChatFrame_RemoveChannel = ChatFrame_RemoveChannel
local ChangeChatColor = ChangeChatColor local CreateFrame = CreateFrame
local FCF_SetLocked = FCF_SetLocked
local FCF_DockFrame, FCF_UnDockFrame = FCF_DockFrame, FCF_UnDockFrame local FCF_DockFrame, FCF_UnDockFrame = FCF_DockFrame, FCF_UnDockFrame
local FCF_OpenNewWindow = FCF_OpenNewWindow local FCF_OpenNewWindow = FCF_OpenNewWindow
local FCF_SetWindowName = FCF_SetWindowName
local FCF_SetChatWindowFontSize = FCF_SetChatWindowFontSize local FCF_SetChatWindowFontSize = FCF_SetChatWindowFontSize
local FCF_SetLocked = FCF_SetLocked
local FCF_SetWindowName = FCF_SetWindowName
local GetScreenWidth = GetScreenWidth
local IsAddOnLoaded = IsAddOnLoaded
local PlaySoundFile = PlaySoundFile
local ReloadUI = ReloadUI
local SetCVar = SetCVar
local UIFrameFadeOut = UIFrameFadeOut
local RAID_CLASS_COLORS = RAID_CLASS_COLORS local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS
@@ -169,6 +170,8 @@ local function SetupChat()
ChatFrame_AddMessageGroup(ChatFrame1, "IGNORED") ChatFrame_AddMessageGroup(ChatFrame1, "IGNORED")
ChatFrame_AddMessageGroup(ChatFrame1, "CHANNEL") ChatFrame_AddMessageGroup(ChatFrame1, "CHANNEL")
ChatFrame_ActivateCombatMessages(ChatFrame2)
ChatFrame_AddChannel(ChatFrame1, GENERAL) ChatFrame_AddChannel(ChatFrame1, GENERAL)
ChatFrame_RemoveMessageGroup(ChatFrame1, "SKILL") ChatFrame_RemoveMessageGroup(ChatFrame1, "SKILL")
ChatFrame_RemoveMessageGroup(ChatFrame1, "LOOT") ChatFrame_RemoveMessageGroup(ChatFrame1, "LOOT")
+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)
+22 -18
View File
@@ -7,8 +7,12 @@ local match = string.match
--WoW API / Variables --WoW API / Variables
local GetCVar, SetCVar = GetCVar, SetCVar local GetCVar, SetCVar = GetCVar, SetCVar
local scale --Global variables that we don"t cache, list them here for the mikk"s Find Globals script
-- GLOBALS: UIParent, WorldMapFrame
--Determine if Eyefinity is being used, setup the pixel perfect script.
local scale
function E:UIScale(event) function E:UIScale(event)
local width = E.screenwidth local width = E.screenwidth
local height = E.screenheight local height = E.screenheight
@@ -26,24 +30,24 @@ function E:UIScale(event)
end end
if width < 1600 then if width < 1600 then
E.lowversion = true E.lowversion = true
elseif width >= 3840 and E.global.general.eyefinity then elseif width >= 3840 and E.global.general.eyefinity then
-- because some user enable bezel compensation, we need to find the real width of a single monitor. -- because some user enable bezel compensation, we need to find the real width of a single monitor.
-- I don't know how it really work, but i'm assuming they add pixel to width to compensate the bezel. :P -- I don't know how it really work, but i'm assuming they add pixel to width to compensate the bezel. :P
-- HQ resolution -- HQ resolution
if width >= 9840 then width = 3280 end -- WQSXGA if width >= 9840 then width = 3280 end -- WQSXGA
if width >= 7680 and width < 9840 then width = 2560 end -- WQXGA if width >= 7680 and width < 9840 then width = 2560 end -- WQXGA
if width >= 5760 and width < 7680 then width = 1920 end -- WUXGA & HDTV if width >= 5760 and width < 7680 then width = 1920 end -- WUXGA & HDTV
if width >= 5040 and width < 5760 then width = 1680 end -- WSXGA+ if width >= 5040 and width < 5760 then width = 1680 end -- WSXGA+
-- adding height condition here to be sure it work with bezel compensation because WSXGA+ and UXGA/HD+ got approx same width -- adding height condition here to be sure it work with bezel compensation because WSXGA+ and UXGA/HD+ got approx same width
if width >= 4800 and width < 5760 and height == 900 then width = 1600 end -- UXGA & HD+ if width >= 4800 and width < 5760 and height == 900 then width = 1600 end -- UXGA & HD+
-- low resolution screen -- low resolution screen
if width >= 4320 and width < 4800 then width = 1440 end -- WSXGA if width >= 4320 and width < 4800 then width = 1440 end -- WSXGA
if width >= 4080 and width < 4320 then width = 1360 end -- WXGA if width >= 4080 and width < 4320 then width = 1360 end -- WXGA
if width >= 3840 and width < 4080 then width = 1224 end -- SXGA & SXGA (UVGA) & WXGA & HDTV if width >= 3840 and width < 4080 then width = 1224 end -- SXGA & SXGA (UVGA) & WXGA & HDTV
-- yep, now set ElvUI to lower resolution if screen #1 width < 1600 -- yep, now set ElvUI to lower resolution if screen #1 width < 1600
if width < 1600 then if width < 1600 then
@@ -55,8 +59,8 @@ function E:UIScale(event)
end end
E.mult = 768/height/scale E.mult = 768/height/scale
E.Spacing = E.PixelMode and 0 or E.mult E.Spacing = (E.PixelMode and 0) or E.mult
E.Border = (E.PixelMode and E.mult or E.mult*2) E.Border = (E.PixelMode and E.mult) or E.mult*2
if E.global.general.autoScale then if E.global.general.autoScale then
--Set UIScale, NOTE: SetCVar for UIScale can cause taints so only do this when we need to.. --Set UIScale, NOTE: SetCVar for UIScale can cause taints so only do this when we need to..
@@ -77,8 +81,8 @@ function E:UIScale(event)
-- if autoscale is off, find a new width value of E.UIParent for screen #1. -- if autoscale is off, find a new width value of E.UIParent for screen #1.
if not E.global.general.autoScale or height > 1200 then if not E.global.general.autoScale or height > 1200 then
local h = UIParent:GetHeight() local h = UIParent:GetHeight()
local ratio = height / h local ratio = (height / h)
local w = width / ratio local w = (width / ratio)
width = w width = w
height = h height = h
@@ -88,15 +92,15 @@ function E:UIScale(event)
Dragging moveable frames outside the box and reloading the UI ensures that they are saving position correctly. Dragging moveable frames outside the box and reloading the UI ensures that they are saving position correctly.
]] ]]
else else
width = UIParent:GetWidth() width, height = UIParent:GetWidth(), UIParent:GetHeight()
height = UIParent:GetHeight()
end end
E.UIParent:SetWidth(width) E.UIParent:SetWidth(width)
E.UIParent:SetHeight(height) E.UIParent:SetHeight(height)
E.UIParent:ClearAllPoints() E.UIParent:ClearAllPoints()
E.UIParent:SetAllPoints(UIParent) E.UIParent:SetAllPoints(UIParent)
--Calculate potential coordinate differences
E.diffGetLeft = E:Round(abs(UIParent:GetLeft() - E.UIParent:GetLeft())) E.diffGetLeft = E:Round(abs(UIParent:GetLeft() - E.UIParent:GetLeft()))
E.diffGetRight = E:Round(abs(UIParent:GetRight() - E.UIParent:GetRight())) E.diffGetRight = E:Round(abs(UIParent:GetRight() - E.UIParent:GetRight()))
E.diffGetTop = E:Round(abs(UIParent:GetTop() - E.UIParent:GetTop())) E.diffGetTop = E:Round(abs(UIParent:GetTop() - E.UIParent:GetTop()))
@@ -121,5 +125,5 @@ end
-- pixel perfect script of custom ui scale. -- pixel perfect script of custom ui scale.
function E:Scale(x) function E:Scale(x)
return E.mult*floor(x/E.mult+.5) return E.mult * floor(x/E.mult+.5)
end end
+90 -28
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
@@ -310,4 +309,67 @@ function E:StyleButton(button, noHover, noPushed, noChecked)
cooldown:ClearAllPoints() cooldown:ClearAllPoints()
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--]]
+89 -8
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,10 +169,56 @@ 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
mode = "Open" 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"
end
else
mode = "Open"
end
end
ACD[mode](ACD, AddOnName)
if pages and (mode == "Open") then
ACD:SelectGroup(AddOnName, unpack(pages))
end end
if mode == "Open" then if mode == "Open" then
+2 -2
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()
@@ -414,4 +414,4 @@ local function InitializeCallback()
LO:Initialize() LO:Initialize()
end end
E:RegisterModule(LO:GetName(), InitializeCallback) E:RegisterModule(LO:GetName(), InitializeCallback)
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

+2
View File
@@ -529,6 +529,8 @@ function AB:Initialize()
self:SecureHook("PetActionBar_Update", "UpdatePet") self:SecureHook("PetActionBar_Update", "UpdatePet")
LOCK_ACTIONBAR = (self.db.lockActionBars == true and "1" or "0")
function _G.ActionButton_OnUpdate(elapsed) function _G.ActionButton_OnUpdate(elapsed)
if not this.updateTooltip then return end if not this.updateTooltip then return end
+3 -1
View File
@@ -349,7 +349,7 @@ function CH:UpdateAnchors()
E:Point(frame, "TOPRIGHT", ChatFrame1, "TOPRIGHT", noBackdrop and 10 or 4, LeftChatTab:GetHeight() + (noBackdrop and 1 or 4)) E:Point(frame, "TOPRIGHT", ChatFrame1, "TOPRIGHT", noBackdrop and 10 or 4, LeftChatTab:GetHeight() + (noBackdrop and 1 or 4))
end end
CH:PositionChat(true) -- CH:PositionChat(true)
end end
local function FindRightChatID() local function FindRightChatID()
@@ -1054,6 +1054,8 @@ function CH:SetupChat()
end end
DEFAULT_CHAT_FRAME:SetParent(LeftChatPanel) DEFAULT_CHAT_FRAME:SetParent(LeftChatPanel)
self:PositionChat(true)
self:ScheduleTimer("PositionChat", 1) self:ScheduleTimer("PositionChat", 1)
end end
+8 -6
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,15 +278,17 @@ 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")
E:Size(self.AFKMode.bottom.faction, 140) E:Size(self.AFKMode.bottom.faction, 140)
self.AFKMode.bottom.name = self.AFKMode.bottom:CreateFontString(nil, "OVERLAY") self.AFKMode.bottom.name = self.AFKMode.bottom:CreateFontString(nil, "OVERLAY")
@@ -320,4 +322,4 @@ local function InitializeCallback()
AFK:Initialize() AFK:Initialize()
end end
E:RegisterModule(AFK:GetName(), InitializeCallback) E:RegisterModule(AFK:GetName(), InitializeCallback)
+3
View File
@@ -73,10 +73,13 @@ local function LoadSkin()
for j = 1, UIDROPDOWNMENU_MAXBUTTONS do for j = 1, UIDROPDOWNMENU_MAXBUTTONS do
local button = _G["DropDownList"..i.."Button"..j] local button = _G["DropDownList"..i.."Button"..j]
local buttonHighlight = _G["DropDownList"..i.."Button"..j.."Highlight"] local buttonHighlight = _G["DropDownList"..i.."Button"..j.."Highlight"]
local colorSwatch = _G["DropDownList"..i.."Button"..j.."ColorSwatch"]
button:SetFrameLevel(buttonBackdrop:GetFrameLevel() + 1) button:SetFrameLevel(buttonBackdrop:GetFrameLevel() + 1)
buttonHighlight:SetTexture(1, 1, 1, 0.3) buttonHighlight:SetTexture(1, 1, 1, 0.3)
buttonHighlight:SetAllPoints(button) buttonHighlight:SetAllPoints(button)
colorSwatch:SetFrameLevel(button:GetFrameLevel() + 2)
if i == 1 then if i == 1 then
E:Point(buttonHighlight, "TOPLEFT", button, "TOPLEFT", -8, 0) E:Point(buttonHighlight, "TOPLEFT", button, "TOPLEFT", -8, 0)
+98 -1
View File
@@ -32,4 +32,101 @@ 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
@@ -80,6 +80,7 @@ local function BuildABConfig()
E.db.actionbar[ info[getn(info)] ] = value E.db.actionbar[ info[getn(info)] ] = value
AB:UpdateButtonSettings() AB:UpdateButtonSettings()
LOCK_ACTIONBAR = (value == true and 1 or 0) LOCK_ACTIONBAR = (value == true and 1 or 0)
E:StaticPopup_Show("CONFIG_RL")
end end
}, },
movementModifier = { movementModifier = {
+67 -40
View File
@@ -1,29 +1,34 @@
local E, L, V, P, G = unpack(ElvUI); local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local D = E:GetModule("Distributor"); local D = E:GetModule("Distributor");
local AceGUI = LibStub("AceGUI-3.0"); local AceGUI = LibStub("AceGUI-3.0");
local pairs = pairs; --Cache global variables
local tsort, tinsert = table.sort, table.insert; --Lua functions
local format = string.format; local pairs = pairs
local tsort, tinsert = table.sort, table.insert
local format = string.format
--WoW API / Variables
local GetNumPartyMembers = GetNumPartyMembers
local GetNumRaidMembers = GetNumRaidMembers
local UnitExists = UnitExists
local UnitIsFriend = UnitIsFriend
local UnitIsPlayer = UnitIsPlayer
local UnitIsUnit = UnitIsUnit
local UnitName = UnitName
local UnitInParty = UnitInParty
local UnitExists = UnitExists; local DEFAULT_WIDTH = 890
local UnitIsFriend = UnitIsFriend; local DEFAULT_HEIGHT = 651
local UnitIsPlayer = UnitIsPlayer; local AC = LibStub("AceConfig-3.0")
local UnitIsUnit = UnitIsUnit; local ACD = LibStub("AceConfigDialog-3.0")
local UnitName = UnitName; local ACR = LibStub("AceConfigRegistry-3.0")
local DEFAULT_WIDTH = 890; AC.RegisterOptionsTable(E, "ElvUI", E.Options)
local DEFAULT_HEIGHT = 651; ACD:SetDefaultSize("ElvUI", DEFAULT_WIDTH, DEFAULT_HEIGHT)
local AC = LibStub("AceConfig-3.0");
local ACD = LibStub("AceConfigDialog-3.0");
local ACR = LibStub("AceConfigRegistry-3.0");
AC.RegisterOptionsTable(E, "ElvUI", E.Options);
ACD:SetDefaultSize("ElvUI", DEFAULT_WIDTH, DEFAULT_HEIGHT);
function E:RefreshGUI() function E:RefreshGUI()
self:RefreshCustomTextsConfigs(); self:RefreshCustomTextsConfigs()
ACR:NotifyChange("ElvUI"); ACR:NotifyChange("ElvUI")
end end
E.Options.args = { E.Options.args = {
@@ -37,42 +42,42 @@ E.Options.args = {
order = 2, order = 2,
type = "toggle", type = "toggle",
name = L["Login Message"], name = L["Login Message"],
get = function(info) return E.db.general.loginmessage; end, get = function(info) return E.db.general.loginmessage end,
set = function(info, value) E.db.general.loginmessage = value; end set = function(info, value) E.db.general.loginmessage = value end
}, },
ToggleTutorial = { ToggleTutorial = {
order = 3, order = 3,
type = "execute", type = "execute",
name = L["Toggle Tutorials"], name = L["Toggle Tutorials"],
func = function() E:Tutorials(true); E:ToggleConfig(); end func = function() E:Tutorials(true) E:ToggleConfig() end
}, },
Install = { Install = {
order = 4, order = 4,
type = "execute", type = "execute",
name = L["Install"], name = L["Install"],
desc = L["Run the installation process."], desc = L["Run the installation process."],
func = function() E:Install(); E:ToggleConfig(); end func = function() E:Install() E:ToggleConfig() end
}, },
ToggleAnchors = { ToggleAnchors = {
order = 5, order = 5,
type = "execute", type = "execute",
name = L["Toggle Anchors"], name = L["Toggle Anchors"],
desc = L["Unlock various elements of the UI to be repositioned."], desc = L["Unlock various elements of the UI to be repositioned."],
func = function() E:ToggleConfigMode(); end func = function() E:ToggleConfigMode() end
}, },
ResetAllMovers = { ResetAllMovers = {
order = 6, order = 6,
type = "execute", type = "execute",
name = L["Reset Anchors"], name = L["Reset Anchors"],
desc = L["Reset all frames to their original positions."], desc = L["Reset all frames to their original positions."],
func = function() E:ResetUI(); end func = function() E:ResetUI() end
} }
}; }
local DONATOR_STRING = ""; local DONATOR_STRING = ""
local DEVELOPER_STRING = ""; local DEVELOPER_STRING = ""
local TESTER_STRING = ""; local TESTER_STRING = ""
local LINE_BREAK = "\n"; local LINE_BREAK = "\n"
local DONATORS = { local DONATORS = {
"Dandruff", "Dandruff",
"Tobur/Tarilya", "Tobur/Tarilya",
@@ -113,7 +118,7 @@ local DONATORS = {
"Pyrokee", "Pyrokee",
"Portable", "Portable",
"Ithilyn" "Ithilyn"
}; }
local DEVELOPERS = { local DEVELOPERS = {
"Tukz", "Tukz",
@@ -121,7 +126,7 @@ local DEVELOPERS = {
"Nightcracker", "Nightcracker",
"Omega1970", "Omega1970",
"Hydrazine" "Hydrazine"
}; }
local TESTERS = { local TESTERS = {
"Tukui Community", "Tukui Community",
@@ -143,22 +148,22 @@ local TESTERS = {
"Catok" "Catok"
} }
tsort(DONATORS, function(a, b) return a < b end); tsort(DONATORS, function(a, b) return a < b end)
for _, donatorName in pairs(DONATORS) do for _, donatorName in pairs(DONATORS) do
tinsert(E.CreditsList, donatorName); tinsert(E.CreditsList, donatorName)
DONATOR_STRING = DONATOR_STRING .. LINE_BREAK .. donatorName; DONATOR_STRING = DONATOR_STRING .. LINE_BREAK .. donatorName
end end
tsort(DEVELOPERS, function(a,b) return a < b end); tsort(DEVELOPERS, function(a,b) return a < b end)
for _, devName in pairs(DEVELOPERS) do for _, devName in pairs(DEVELOPERS) do
tinsert(E.CreditsList, devName); tinsert(E.CreditsList, devName)
DEVELOPER_STRING = DEVELOPER_STRING .. LINE_BREAK .. devName; DEVELOPER_STRING = DEVELOPER_STRING .. LINE_BREAK .. devName
end end
tsort(TESTERS, function(a, b) return a < b end) tsort(TESTERS, function(a, b) return a < b end)
for _, testerName in pairs(TESTERS) do for _, testerName in pairs(TESTERS) do
tinsert(E.CreditsList, testerName); tinsert(E.CreditsList, testerName)
TESTER_STRING = TESTER_STRING .. LINE_BREAK .. testerName; TESTER_STRING = TESTER_STRING .. LINE_BREAK .. testerName
end end
E.Options.args.credits = { E.Options.args.credits = {
@@ -417,10 +422,21 @@ E.Options.args.profiles.plugins["ElvUI"] = {
desc = L["Sends your current profile to your target."], desc = L["Sends your current profile to your target."],
type = "execute", type = "execute",
func = function() func = function()
if (GetNumPartyMembers() <= 0 or GetNumPartyMembers() <= 0) then
E:Print(L["You must be in a group."])
return
end
if not UnitExists("target") or not UnitIsPlayer("target") or not UnitIsFriend("player", "target") or UnitIsUnit("player", "target") then if not UnitExists("target") or not UnitIsPlayer("target") or not UnitIsFriend("player", "target") or UnitIsUnit("player", "target") then
E:Print(L["You must be targeting a player."]) E:Print(L["You must be targeting a player."])
return return
end end
if not (UnitInParty("target") or UnitInRaid("target")) then
E:Print(L["You must be targeting a player within your group."])
return
end
local name, server = UnitName("target") local name, server = UnitName("target")
if name and not server or server == "" then if name and not server or server == "" then
D:Distribute(name) D:Distribute(name)
@@ -435,10 +451,21 @@ E.Options.args.profiles.plugins["ElvUI"] = {
name = L["Share Filters"], name = L["Share Filters"],
desc = L["Sends your filter settings to your target."], desc = L["Sends your filter settings to your target."],
func = function() func = function()
if (GetNumPartyMembers() <= 0 or GetNumPartyMembers() <= 0) then
E:Print(L["You must be in a group."])
return
end
if not UnitExists("target") or not UnitIsPlayer("target") or not UnitIsFriend("player", "target") or UnitIsUnit("player", "target") then if not UnitExists("target") or not UnitIsPlayer("target") or not UnitIsFriend("player", "target") or UnitIsUnit("player", "target") then
E:Print(L["You must be targeting a player."]) E:Print(L["You must be targeting a player."])
return return
end end
if not (UnitInParty("target") or UnitInRaid("target")) then
E:Print(L["You must be targeting a player within your group."])
return
end
local name, server = UnitName("target") local name, server = UnitName("target")
if name and not server or server == "" then if name and not server or server == "" then
D:Distribute(name, false, true) D:Distribute(name, false, true)
+2 -1
View File
@@ -20,4 +20,5 @@ Skins.lua
Tooltip.lua Tooltip.lua
Unitframes.lua Unitframes.lua
DataBars.lua DataBars.lua
Maps.lua Maps.lua
ModuleControl.lua
@@ -51,7 +51,7 @@ local function ColorSwatch_OnClick()
local self = this.obj local self = this.obj
if not self.disabled then if not self.disabled then
ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG") ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG")
ColorPickerFrame:SetFrameLevel(this:GetFrameLevel() + 10) ColorPickerFrame:SetFrameLevel(this:GetFrameLevel() + 2)
ColorPickerFrame:SetClampedToScreen(true) ColorPickerFrame:SetClampedToScreen(true)
ColorPickerFrame.func = function() ColorPickerFrame.func = function()
+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 COLOR = COLOR
--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 = COLOR,
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
}
}
}
}
}
+2 -1
View File
@@ -1,5 +1,6 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local NP = E:GetModule("NamePlates"); local NP = E:GetModule("NamePlates");
local ACD = LibStub("AceConfigDialog-3.0");
--Cache global variables --Cache global variables
--Lua functions --Lua functions
@@ -626,7 +627,7 @@ E.Options.args.nameplate = {
motionType = { motionType = {
order = 1, order = 1,
type = "select", type = "select",
name = "UNIT_NAMEPLATES_TYPES", name = L["Nameplate Motion Type"],
desc = L["Set to either stack nameplates vertically or allow them to overlap."], desc = L["Set to either stack nameplates vertically or allow them to overlap."],
values = { values = {
["STACKED"] = "STACKED", ["STACKED"] = "STACKED",