diff --git a/ElvUI/Core/Movers.lua b/ElvUI/Core/Movers.lua
index a134dfa..f9b742d 100644
--- a/ElvUI/Core/Movers.lua
+++ b/ElvUI/Core/Movers.lua
@@ -165,7 +165,7 @@ local function CreateMover(parent, name, text, overlay, snapOffset, postdrag, sh
E.AssignFrameToNudge(this)
coordFrame.child = this
UpdateCoords(coordFrame)
- --coordFrame:GetScript("OnUpdate")(coordFrame)
+ coordFrame:GetScript("OnUpdate")(coordFrame)
end
local function OnMouseDown(button)
diff --git a/ElvUI/Modules/ActionBars/ActionBars.lua b/ElvUI/Modules/ActionBars/ActionBars.lua
index 4294b77..3d76e97 100644
--- a/ElvUI/Modules/ActionBars/ActionBars.lua
+++ b/ElvUI/Modules/ActionBars/ActionBars.lua
@@ -264,7 +264,7 @@ function AB:UpdateButtonSettings()
end
--self:PositionAndSizeBarPet()
- --self:PositionAndSizeBarShapeShift()
+ self:PositionAndSizeBarShapeShift()
end
function AB:StyleButton(button, noBackdrop)
@@ -485,6 +485,8 @@ function AB:Initialize()
self:CreateBar(i)
end
+ self:CreateBarShapeShift()
+
self:UpdateButtonSettings()
self:LoadKeyBinder()
diff --git a/ElvUI/Modules/ActionBars/BarShapeShift.lua b/ElvUI/Modules/ActionBars/BarShapeShift.lua
new file mode 100644
index 0000000..102f284
--- /dev/null
+++ b/ElvUI/Modules/ActionBars/BarShapeShift.lua
@@ -0,0 +1,310 @@
+local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
+local AB = E:GetModule("ActionBars");
+
+--Cache global variables
+--Lua functions
+local _G = _G
+local ceil, mod = math.ceil, math.mod
+--WoW API / Variables
+local CreateFrame = CreateFrame
+local GetShapeshiftForm = GetShapeshiftForm
+local GetNumShapeshiftForms = GetNumShapeshiftForms
+local GetShapeshiftFormCooldown = GetShapeshiftFormCooldown
+local GetShapeshiftFormInfo = GetShapeshiftFormInfo
+local GetSpellTexture = GetSpellTexture
+local GetBindingKey = GetBindingKey
+local NUM_SHAPESHIFT_SLOTS = NUM_SHAPESHIFT_SLOTS
+
+local bar = CreateFrame("Frame", "ElvUI_StanceBar", E.UIParent)
+
+function AB:SPELL_UPDATE_COOLDOWN()
+ local numForms = GetNumShapeshiftForms()
+ local start, duration, enable, cooldown
+ for i = 1, NUM_SHAPESHIFT_SLOTS do
+ if i <= numForms then
+ cooldown = _G["ElvUI_StanceBarButton"..i.."Cooldown"]
+ start, duration, enable = GetShapeshiftFormCooldown(i)
+ CooldownFrame_SetTimer(cooldown, start, duration, enable)
+ end
+ end
+
+ self:StyleShapeShift("SPELL_UPDATE_COOLDOWN")
+end
+
+function AB:StyleShapeShift()
+ local numForms = GetNumShapeshiftForms()
+ local texture, name, isActive, isCastable, _
+ local buttonName, button, icon, cooldown
+ local numForms = GetNumShapeshiftForms()
+ local stance = GetShapeshiftFormInfo(numForms)
+
+ for i = 1, NUM_SHAPESHIFT_SLOTS do
+ buttonName = "ElvUI_StanceBarButton"..i
+ button = _G[buttonName]
+ icon = _G[buttonName.."Icon"]
+ cooldown = _G[buttonName.."Cooldown"]
+
+ if i <= numForms then
+ texture, name, isActive, isCastable = GetShapeshiftFormInfo(i)
+
+ if self.db.barShapeShift.style == "darkenInactive" then
+ if name then
+ texture = texture
+ -- texture = GetSpellTexture(name, BOOKTYPE_SPELL)
+ end
+ end
+
+ if not texture then
+ texture = "Interface\\Icons\\Spell_Nature_WispSplode"
+ end
+
+ icon:SetTexture(texture)
+
+ if texture then
+ cooldown:SetAlpha(1)
+ else
+ cooldown:SetAlpha(0)
+ end
+
+ if isActive then
+ ShapeshiftBarFrame.lastSelected = button:GetID()
+ if numForms == 1 then
+ button:GetCheckedTexture():SetTexture(1, 1, 1, 0.5)
+ button:SetChecked(true)
+ else
+ button:GetCheckedTexture():SetTexture(1, 1, 1, 0.5)
+ button:SetChecked(self.db.barShapeShift.style ~= "darkenInactive")
+ end
+ else
+ if numForms == 1 or stance == 0 then
+ button:SetChecked(false)
+ else
+ button:SetChecked(self.db.barShapeShift.style == "darkenInactive")
+ button:GetCheckedTexture():SetAlpha(1)
+ if self.db.barShapeShift.style == "darkenInactive" then
+ button:GetCheckedTexture():SetTexture(0, 0, 0, 0.5)
+ else
+ button:GetCheckedTexture():SetTexture(1, 1, 1, 0.5)
+ end
+ end
+ end
+
+ if isCastable then
+ icon:SetVertexColor(1.0, 1.0, 1.0)
+ else
+ icon:SetVertexColor(0.4, 0.4, 0.4)
+ end
+ end
+ end
+end
+
+function AB:PositionAndSizeBarShapeShift()
+ local buttonSpacing = E:Scale(self.db["barShapeShift"].buttonspacing)
+ local backdropSpacing = E:Scale((self.db["barShapeShift"].backdropSpacing or self.db["barShapeShift"].buttonspacing))
+ local buttonsPerRow = self.db["barShapeShift"].buttonsPerRow
+ local numButtons = self.db["barShapeShift"].buttons
+ local size = E:Scale(self.db["barShapeShift"].buttonsize)
+ local point = self.db["barShapeShift"].point
+ local widthMult = self.db["barShapeShift"].widthMult
+ local heightMult = self.db["barShapeShift"].heightMult
+ if bar.mover then
+ bar.mover.positionOverride = point
+ E:UpdatePositionOverride(bar.mover:GetName())
+ end
+ bar.db = self.db["barShapeShift"]
+ bar.db.position = nil --Depreciated
+ bar.mouseover = self.db["barShapeShift"].mouseover
+
+ if bar.LastButton and numButtons > bar.LastButton then
+ numButtons = bar.LastButton
+ end
+
+ if bar.LastButton and buttonsPerRow > bar.LastButton then
+ buttonsPerRow = bar.LastButton
+ end
+
+ if numButtons < buttonsPerRow then
+ buttonsPerRow = numButtons
+ end
+
+ local numColumns = ceil(numButtons / buttonsPerRow)
+ if numColumns < 1 then
+ numColumns = 1
+ end
+
+ if self.db["barShapeShift"].backdrop == true then
+ bar.backdrop:Show()
+ else
+ bar.backdrop:Hide()
+
+ widthMult = 1
+ heightMult = 1
+ end
+
+ local barWidth = (size * (buttonsPerRow * widthMult)) + ((buttonSpacing * (buttonsPerRow - 1)) * widthMult) + (buttonSpacing * (widthMult-1)) + ((self.db["barShapeShift"].backdrop == true and (E.Border + backdropSpacing) or E.Spacing)*2)
+ local barHeight = (size * (numColumns * heightMult)) + ((buttonSpacing * (numColumns - 1)) * heightMult) + (buttonSpacing * (heightMult-1)) + ((self.db["barShapeShift"].backdrop == true and (E.Border + backdropSpacing) or E.Spacing)*2)
+ bar:SetWidth(barWidth)
+ bar:SetHeight(barHeight)
+
+ if self.db["barShapeShift"].enabled then
+ bar:SetScale(1)
+ bar:SetAlpha(bar.db.alpha)
+ E:EnableMover(bar.mover:GetName())
+ else
+ bar:SetScale(0.0001)
+ bar:SetAlpha(0)
+ E:DisableMover(bar.mover:GetName())
+ end
+
+ local horizontalGrowth, verticalGrowth
+ if point == "TOPLEFT" or point == "TOPRIGHT" then
+ verticalGrowth = "DOWN"
+ else
+ verticalGrowth = "UP"
+ end
+
+ if point == "BOTTOMLEFT" or point == "TOPLEFT" then
+ horizontalGrowth = "RIGHT"
+ else
+ horizontalGrowth = "LEFT"
+ end
+
+ if self.db["barShapeShift"].inheritGlobalFade then
+ bar:SetParent(self.fadeParent)
+ else
+ bar:SetParent(E.UIParent)
+ end
+
+ local button, lastButton, lastColumnButton
+ local firstButtonSpacing = (self.db["barShapeShift"].backdrop == true and (E.Border + backdropSpacing) or E.Spacing)
+ for i = 1, NUM_SHAPESHIFT_SLOTS do
+ button = _G["ElvUI_StanceBarButton"..i]
+ lastButton = _G["ElvUI_StanceBarButton"..i-1]
+ lastColumnButton = _G["ElvUI_StanceBarButton"..i-buttonsPerRow]
+ button:SetParent(bar)
+ button:ClearAllPoints()
+ button:SetWidth(size)
+ button:SetHeight(size)
+
+ if self.db["barShapeShift"].mouseover == true then
+ bar:SetAlpha(0)
+ else
+ bar:SetAlpha(bar.db.alpha)
+ end
+
+ if i == 1 then
+ local x, y
+ if point == "BOTTOMLEFT" then
+ x, y = firstButtonSpacing, firstButtonSpacing
+ elseif point == "TOPRIGHT" then
+ x, y = -firstButtonSpacing, -firstButtonSpacing
+ elseif point == "TOPLEFT" then
+ x, y = firstButtonSpacing, -firstButtonSpacing
+ else
+ x, y = -firstButtonSpacing, firstButtonSpacing
+ end
+
+ button:SetPoint(point, bar, point, x, y)
+ elseif mod((i - 1), buttonsPerRow) == 0 then
+ local x = 0
+ local y = -buttonSpacing
+ local buttonPoint, anchorPoint = "TOP", "BOTTOM"
+ if verticalGrowth == "UP" then
+ y = buttonSpacing
+ buttonPoint = "BOTTOM"
+ anchorPoint = "TOP"
+ end
+ button:SetPoint(buttonPoint, lastColumnButton, anchorPoint, x, y)
+ else
+ local x = buttonSpacing
+ local y = 0
+ local buttonPoint, anchorPoint = "LEFT", "RIGHT"
+ if horizontalGrowth == "LEFT" then
+ x = -buttonSpacing
+ buttonPoint = "RIGHT"
+ anchorPoint = "LEFT"
+ end
+
+ button:SetPoint(buttonPoint, lastButton, anchorPoint, x, y)
+ end
+
+ if i > numButtons then
+ button:SetScale(0.0001)
+ button:SetAlpha(0)
+ else
+ button:SetScale(1)
+ button:SetAlpha(bar.db.alpha)
+ end
+
+ if not button.FlyoutUpdateFunc then
+ self:StyleButton(button, nil, self.LBFGroup and E.private.actionbar.lbf.enable and true or nil)
+ end
+ end
+
+ if (self.LBFGroup and E.private.actionbar.lbf.enable) then self.LBFGroup:Skin(E.private.actionbar.lbf.skin) end
+end
+
+function AB:AdjustMaxStanceButtons(event)
+ for i = 1, getn(bar.buttons) do
+ bar.buttons[i]:Hide()
+ end
+ local numButtons = GetNumShapeshiftForms()
+ for i = 1, NUM_SHAPESHIFT_SLOTS do
+ if not bar.buttons[i] then
+ bar.buttons[i] = CreateFrame("CheckButton", format(bar:GetName().."Button%d", i), bar, "ShapeshiftButtonTemplate")
+ bar.buttons[i]:SetID(i)
+ if self.LBFGroup and E.private.actionbar.lbf.enable then
+ self.LBFGroup:AddButton(bar.buttons[i])
+ end
+ self:HookScript(bar.buttons[i], "OnEnter", "Button_OnEnter")
+ self:HookScript(bar.buttons[i], "OnLeave", "Button_OnLeave")
+ end
+
+ if i <= numButtons then
+ bar.buttons[i]:Show()
+ bar.LastButton = i
+ else
+ bar.buttons[i]:Hide()
+ end
+ end
+
+ self:PositionAndSizeBarShapeShift()
+
+ if event == "UPDATE_SHAPESHIFT_FORMS" then
+ self:StyleShapeShift()
+ end
+end
+
+function AB:UpdateStanceBindings()
+ for i = 1, NUM_SHAPESHIFT_SLOTS do
+ if self.db.hotkeytext then
+ _G["ElvUI_StanceBarButton"..i.."HotKey"]:Show()
+ _G["ElvUI_StanceBarButton"..i.."HotKey"]:SetText(GetBindingKey("SHAPESHIFTBUTTON" .. i))
+ self:FixKeybindText(_G["ElvUI_StanceBarButton"..i])
+ else
+ _G["ElvUI_StanceBarButton"..i.."HotKey"]:Hide()
+ end
+ end
+end
+
+function AB:CreateBarShapeShift()
+ E:CreateBackdrop(bar, "Default")
+ bar.backdrop:SetAllPoints()
+ bar:SetPoint("TOPLEFT", E.UIParent, "TOPLEFT", 4, -4)
+ bar.buttons = {}
+
+ self:HookScript(bar, "OnEnter", "Bar_OnEnter")
+ self:HookScript(bar, "OnLeave", "Bar_OnLeave")
+
+ self:RegisterEvent("UPDATE_SHAPESHIFT_FORMS", "AdjustMaxStanceButtons")
+ self:RegisterEvent("SPELL_UPDATE_COOLDOWN")
+ self:RegisterEvent("SPELL_UPDATE_USABLE", "StyleShapeShift")
+ self:RegisterEvent("PLAYER_AURAS_CHANGED", "StyleShapeShift")
+ self:RegisterEvent("ACTIONBAR_PAGE_CHANGED", "StyleShapeShift")
+
+ E:CreateMover(bar, "ShiftAB", L["Stance Bar"], nil, -3, nil, "ALL,ACTIONBARS")
+ self:AdjustMaxStanceButtons()
+ self:PositionAndSizeBarShapeShift()
+ self:StyleShapeShift()
+ self:UpdateStanceBindings()
+end
\ No newline at end of file
diff --git a/ElvUI/Modules/ActionBars/Load_ActionBars.xml b/ElvUI/Modules/ActionBars/Load_ActionBars.xml
index e0aafda..7aa2993 100644
--- a/ElvUI/Modules/ActionBars/Load_ActionBars.xml
+++ b/ElvUI/Modules/ActionBars/Load_ActionBars.xml
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/ElvUI_Config/ActionBars.lua b/ElvUI_Config/ActionBars.lua
index 5c41a31..9bcbd8c 100644
--- a/ElvUI_Config/ActionBars.lua
+++ b/ElvUI_Config/ActionBars.lua
@@ -201,6 +201,159 @@ local function BuildABConfig()
}
}
}
+ group["stanceBar"] = {
+ order = 6,
+ name = L["Stance Bar"],
+ type = "group",
+ guiInline = false,
+ disabled = function() return not E.ActionBars end,
+ get = function(info) return E.db.actionbar["barShapeShift"][ info[getn(info)] ] end,
+ set = function(info, value) E.db.actionbar["barShapeShift"][ info[getn(info)] ] = value; AB:PositionAndSizeBarShapeShift() end,
+ args = {
+ info = {
+ order = 1,
+ type = "header",
+ name = L["Stance Bar"]
+ },
+ enabled = {
+ order = 2,
+ type = "toggle",
+ name = L["Enable"]
+ },
+ restorePosition = {
+ order = 3,
+ type = "execute",
+ name = L["Restore Bar"],
+ desc = L["Restore the actionbars default settings"],
+ func = function() E:CopyTable(E.db.actionbar["barShapeShift"], P.actionbar["barShapeShift"]) E:ResetMovers(L["Stance Bar"]) AB:PositionAndSizeBarShapeShift() end,
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ spacer = {
+ order = 4,
+ type = "description",
+ name = " "
+ },
+ backdrop = {
+ order = 5,
+ type = "toggle",
+ name = L["Backdrop"],
+ desc = L["Toggles the display of the actionbars backdrop."],
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ mouseover = {
+ order = 6,
+ type = "toggle",
+ name = L["Mouse Over"],
+ desc = L["The frame is not shown unless you mouse over the frame."],
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ inheritGlobalFade = {
+ order = 7,
+ type = "toggle",
+ name = L["Inherit Global Fade"],
+ desc = L["Inherit the global fade, mousing over, targetting, setting focus, losing health, entering combat will set the remove transparency. Otherwise it will use the transparency level in the general actionbar settings for global fade alpha."],
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ point = {
+ order = 8,
+ type = "select",
+ name = L["Anchor Point"],
+ desc = L["The first button anchors itself to this point on the bar."],
+ values = points,
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ buttons = {
+ order = 9,
+ type = "range",
+ name = L["Buttons"],
+ desc = L["The amount of buttons to display."],
+ min = 1, max = NUM_PET_ACTION_SLOTS, step = 1,
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ buttonsPerRow = {
+ order = 10,
+ type = "range",
+ name = L["Buttons Per Row"],
+ desc = L["The amount of buttons to display per row."],
+ min = 1, max = NUM_PET_ACTION_SLOTS, step = 1,
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ buttonsize = {
+ order = 11,
+ type = "range",
+ name = L["Button Size"],
+ desc = L["The size of the action buttons."],
+ min = 15, max = 60, step = 1,
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ buttonspacing = {
+ order = 12,
+ type = "range",
+ name = L["Button Spacing"],
+ desc = L["The spacing between buttons."],
+ min = -1, max = 10, step = 1,
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ backdropSpacing = {
+ order = 13,
+ type = "range",
+ name = L["Backdrop Spacing"],
+ desc = L["The spacing between the backdrop and the buttons."],
+ min = 0, max = 10, step = 1,
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ heightMult = {
+ order = 14,
+ type = "range",
+ name = L["Height Multiplier"],
+ desc = L["Multiply the backdrops height or width by this value. This is usefull if you wish to have more than one bar behind a backdrop."],
+ min = 1, max = 5, step = 1,
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ widthMult = {
+ order = 15,
+ type = "range",
+ name = L["Width Multiplier"],
+ desc = L["Multiply the backdrops height or width by this value. This is usefull if you wish to have more than one bar behind a backdrop."],
+ min = 1, max = 5, step = 1,
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ alpha = {
+ order = 16,
+ type = "range",
+ isPercent = true,
+ name = L["Alpha"],
+ min = 0, max = 1, step = 0.01,
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ style = {
+ order = 17,
+ type = "select",
+ name = L["Style"],
+ desc = L["This setting will be updated upon changing stances."],
+ values = {
+ ["darkenInactive"] = L["Darken Inactive"],
+ ["classic"] = L["Classic"]
+ },
+ disabled = function() return not E.db.actionbar.barShapeShift.enabled end
+ },
+ visibility = {
+ order = 18,
+ type = "input",
+ name = L["Visibility State"],
+ desc = L["This works like a macro, you can run different situations to get the actionbar to show/hide differently.\n Example: '[combat] show;hide'"],
+ width = "full",
+ multiline = true,
+ set = function(info, value)
+ if value and value:match("[\n\r]") then
+ value = value:gsub("[\n\r]","")
+ end
+ E.db.actionbar["barShapeShift"]["visibility"] = value;
+ AB:UpdateButtonSettings()
+ end
+ }
+ }
+ }
group["microbar"] = {
order = 7,
type = "group",