Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Bunny67 committed Aug 20, 2019
1 parent 97787a2 commit 01de002
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 72 deletions.
8 changes: 2 additions & 6 deletions ElvUI_CastBarOverlay/ElvUI_CastBarOverlay.toc
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
## Interface: 30300
## Author: Blazeflack
## Version: 1.03
## Version: 1.09
## Title: |cff1784d1E|r|cffe5e3e3lvUI|r |cff1784d1C|r|cffe5e3e3ast|r |cff1784d1B|r|cffe5e3e3ar|r |cff1784d1O|r|cffe5e3e3verlay|r
## Notes: Allows you to overlay castbars on other frames.
## RequiredDeps: ElvUI
## OptionalDeps: ElvUI_CastBarSnap

locales.lua
config.lua
core.lua

## X-Tukui-ProjectID: 294
## X-Tukui-ProjectFolders: ElvUI_CastBarOverlay
core.lua
37 changes: 14 additions & 23 deletions ElvUI_CastBarOverlay/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ V['CBO'] = {

P['CBO'] = {
['player'] = {
['overlay'] = true,
['overlay'] = false,
["overlayOnFrame"] = "POWER",
['hidetext'] = false,
['xOffsetText'] = 4,
Expand All @@ -18,7 +18,7 @@ P['CBO'] = {
['yOffsetTime'] = 0,
},
['target'] = {
['overlay'] = true,
['overlay'] = false,
["overlayOnFrame"] = "POWER",
['hidetext'] = false,
['xOffsetText'] = 4,
Expand All @@ -27,7 +27,7 @@ P['CBO'] = {
['yOffsetTime'] = 0,
},
['focus'] = {
['overlay'] = true,
['overlay'] = false,
["overlayOnFrame"] = "POWER",
['hidetext'] = false,
['xOffsetText'] = 4,
Expand All @@ -36,7 +36,7 @@ P['CBO'] = {
['yOffsetTime'] = 0,
},
['pet'] = {
['overlay'] = true,
['overlay'] = false,
["overlayOnFrame"] = "POWER",
['hidetext'] = false,
['xOffsetText'] = 4,
Expand All @@ -45,7 +45,7 @@ P['CBO'] = {
['yOffsetTime'] = 0,
},
['boss'] = {
['overlay'] = true,
['overlay'] = false,
["overlayOnFrame"] = "POWER",
['hidetext'] = false,
['xOffsetText'] = 4,
Expand All @@ -54,7 +54,7 @@ P['CBO'] = {
['yOffsetTime'] = 0,
},
['arena'] = {
['overlay'] = true,
['overlay'] = false,
["overlayOnFrame"] = "POWER",
['hidetext'] = false,
['xOffsetText'] = 4,
Expand All @@ -65,15 +65,6 @@ P['CBO'] = {
}

function CBO:InsertOptions()
if not E.Options.args.blazeplugins then
E.Options.args.blazeplugins = {
order = -2,
type = 'group',
name = 'Plugins (by Blazeflack)',
args = {},
}
end

local function CreateOptionsGroup(order, name, unit, updateFunc)
local group = {
order = order,
Expand Down Expand Up @@ -174,29 +165,29 @@ function CBO:InsertOptions()
},
},
}

return group
end

E.Options.args.blazeplugins.args.CBO = {
order = 10,
E.Options.args.plugins.args.CBO = {
type = 'group',
name = 'CastBarOverlay',
childGroups = 'tab',
disabled = function() return not E.private.unitframe.enable end,
args = {},
}
local options = E.Options.args.blazeplugins.args.CBO.args

local options = E.Options.args.plugins.args.CBO.args
options.player = CreateOptionsGroup(1, L["Player"], "player", CBO.UpdateSettings)
options.target = CreateOptionsGroup(2, L["Target"], "target", CBO.UpdateSettings)
options.focus = CreateOptionsGroup(3, L["Focus"], "focus", CBO.UpdateSettings)
options.pet = CreateOptionsGroup(4, L["Pet"], "pet", CBO.UpdateSettings)
options.arena = CreateOptionsGroup(5, L["Arena"], "arena", CBO.UpdateSettings)
options.boss = CreateOptionsGroup(6, L["Boss"], "boss", CBO.UpdateSettings)
end

--Disable player overlay if CastBarSnap is enabled
E.Options.args.blazeplugins.args.CBO.args.player.args.overlay.disabled = function() return IsAddOnLoaded('ElvUI_CastBarSnap') end
local function InitializeCallback()
CBO:Initialize()
end

E:RegisterModule(CBO:GetName())
E:RegisterModule(CBO:GetName(), InitializeCallback)
49 changes: 6 additions & 43 deletions ElvUI_CastBarOverlay/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,10 @@ local CBO = E:GetModule("CastBarOverlay")
local UF = E:GetModule("UnitFrames");
local EP = LibStub("LibElvUIPlugin-1.0")
local addon, ns = ...
local CBS_Enabled = false

--Cache global variables
local _G = _G

-- Create compatibility warning popup
E.PopupDialogs["CBOCompatibility"] = {
text = L["CBO_CONFLICT_WARNING"],
button1 = L["I understand"],
OnAccept = function() E.private.CBO.warned = true end,
timeout = 0,
whileDead = 1,
preferredIndex = 3,
}

E.PopupDialogs["CBO_CBPOWARNING"] = {
text = L["CBO_CBPOWARNING"],
button1 = L["I understand"],
OnAccept = function() DisableAddOn("ElvUI_CastBarPowerOverlay"); ReloadUI() end,
timeout = 0,
whileDead = 1,
preferredIndex = 3,
}

-- Warn about trying to overlay on disabled power bar
E.PopupDialogs["CBO_PowerDisabled"] = {
text = L["CBO_POWER_DISABLED"],
Expand Down Expand Up @@ -63,13 +43,13 @@ local function SetCastbarSizeAndPosition(unit, unitframe, overlayFrame)
castbar:SetFrameStrata(frameStrata)
castbar:SetFrameLevel(frameLevel)

--Adjust size of castbar icon
castbar.ButtonIcon.bg:Size(overlayHeight + unitframe.BORDER*2)

-- Position the castbar on overLayFrame
if (not cdb.iconAttached) then
castbar:SetInside(overlayFrame, 0, 0)
else
--Adjust size of castbar icon
castbar.ButtonIcon.bg:Size(overlayHeight + unitframe.BORDER*2)

local iconWidth = cdb.icon and (castbar.ButtonIcon.bg:GetWidth() - unitframe.BORDER) or 0
castbar:ClearAllPoints()
if(unitframe.ORIENTATION == "RIGHT") then
Expand Down Expand Up @@ -157,7 +137,7 @@ local function ConfigureCastbar(unit, unitframe)

if db.overlay then
local OverlayFrame = db.overlayOnFrame == "HEALTH" and unitframe.Health or unitframe.Power
SetCastbarSizeAndPosition(unit, unitframe, OverlayFrame)
E:Delay(0.01, function() SetCastbarSizeAndPosition(unit, unitframe, OverlayFrame) end) --Delay it a bit, so size of overlayFrame is updated before we grab it.
ConfigureText(unit, castbar)
elseif castbar.isOverlayed then
ResetCastbarSizeAndPosition(unit, unitframe)
Expand All @@ -176,7 +156,7 @@ function CBO:UpdateSettings(unit)
E.db.CBO[unit].overlayOnFrame = "HEALTH"
end

if (unit == "player" and not CBS_Enabled) or unit == "target" or unit == "focus" or unit == "pet" then
if unit == "player" or unit == "target" or unit == "focus" or unit == "pet" then
local unitFrameName = "ElvUF_"..E:StringTitle(unit)
local unitframe = _G[unitFrameName]
ConfigureCastbar(unit, unitframe)
Expand Down Expand Up @@ -210,26 +190,9 @@ function CBO:Initialize()
--ElvUI UnitFrames are not enabled, stop right here!
if E.private.unitframe.enable ~= true then return end

if IsAddOnLoaded("ElvUI_CastBarSnap") then
CBS_Enabled = true
if not E.private.CBO.warned then
-- Warn user about CastBarPowerOverlay being disabled for Player CastBar
E:StaticPopup_Show("CBOCompatibility")
end
E.db.CBO.player.overlay = false
else
E.private.CBO.warned = false
end

--Check if the old CastBarPowerOverlay is enabled
if IsAddOnLoaded("ElvUI_CastBarPowerOverlay") then
E:StaticPopup_Show("CBO_CBPOWARNING")
end

--Profile changed, update castbar overlay settings
hooksecurefunc(E, "UpdateAll", function()
--Delay it a bit to allow all db changes to take effect before we update
self:ScheduleTimer("UpdateAllCastbars", 0.5)
CBO:UpdateAllCastbars()
end)

--Castbar was modified, re-apply settings
Expand Down

0 comments on commit 01de002

Please sign in to comment.