diff --git a/Bar.lua b/Bar.lua index d9ac086..7c3722c 100644 --- a/Bar.lua +++ b/Bar.lua @@ -561,6 +561,27 @@ function Bar:GetPosition() return self.BarSave["Left"], self.BarSave["Top"], self.BarSave["Left"]..", "..self.BarSave["Top"]; end +function Bar:SetFlyoutDirection(Direction) + local flyoutDirection = "UP"; -- default + if (Direction == "left" or Direction == "LEFT") then + flyoutDirection = "LEFT"; + elseif (Direction == "right" or Direction == "RIGHT") then + flyoutDirection = "RIGHT"; + elseif (Direction == "down" or Direction == "DOWN") then + flyoutDirection = "DOWN"; + end + + self.BarSave["FlyoutDirection"] = flyoutDirection; + + for r = 1, self.Rows do + for c = 1, self.Cols do + local i = (r-1) * self.Cols + c; + self.Buttons[i].Widget:SetAttribute("flyoutDirection", flyoutDirection); + self.Buttons[i]:UpdateFlyout(); + end + end +end + function Bar:SetScale(Scale, NoCheck) Scale = (Scale or 0) + 0; if (Scale <= 0) then @@ -604,6 +625,10 @@ function Bar:SetButtonsFromSave() local NewButton = Util.NewButton(self.ButtonFrame, self.BarSave["Buttons"][i], self.BarSave["ButtonsLocked"], self.BarSave["TooltipsOn"], self.BarSave["MacroText"], self.BarSave["KeyBindText"]); table.insert(self.Buttons, i, NewButton); NewButton.Widget:SetPoint("TOPLEFT", self.ButtonFrame, "TOPLEFT", (c-1) * self.BSize, (1-r) * self.BSize); + if (self.BarSave["FlyoutDirection"]) then + NewButton.Widget:SetAttribute("flyoutDirection", self.BarSave["FlyoutDirection"]); + NewButton:UpdateFlyout(); + end end end @@ -667,6 +692,10 @@ function Bar:SetNumButtons(Cols, Rows) local NewButton = Util.NewButton(BFrame, ButtonSave, self.BarSave["ButtonsLocked"], self.BarSave["TooltipsOn"], self.BarSave["MacroText"], self.BarSave["KeyBindText"]); table.insert(Buttons, i, NewButton); NewButton.Widget:SetPoint("TOPLEFT", BFrame, "TOPLEFT", (c-1) * self.BSize, (1-r) * self.BSize); + if (self.BarSave["FlyoutDirection"]) then + NewButton.Widget:SetAttribute("flyoutDirection", self.BarSave["FlyoutDirection"]); + NewButton:UpdateFlyout(); + end end end self.Cols = Cols; @@ -678,7 +707,11 @@ function Bar:SetNumButtons(Cols, Rows) local ButtonSave = {}; local NewButton = Util.NewButton(BFrame, ButtonSave, self.BarSave["ButtonsLocked"], self.BarSave["TooltipsOn"], self.BarSave["MacroText"], self.BarSave["KeyBindText"]); table.insert(Buttons, i, NewButton); - NewButton.Widget:SetPoint("TOPLEFT", BFrame, "TOPLEFT", (c-1) * self.BSize, (1-r) * self.BSize); + NewButton.Widget:SetPoint("TOPLEFT", BFrame, "TOPLEFT", (c-1) * self.BSize, (1-r) * self.BSize); + if (self.BarSave["FlyoutDirection"]) then + NewButton.Widget:SetAttribute("flyoutDirection", self.BarSave["FlyoutDirection"]); + NewButton:UpdateFlyout(); + end end end self.Rows = Rows; diff --git a/Button.lua b/Button.lua index 9d4e284..f6b4806 100644 --- a/Button.lua +++ b/Button.lua @@ -663,7 +663,7 @@ end --[[ The following functions will configure the button to operate correctly for the specific type of action (these functions must be able to handle the player not knowing spells/macros etc) --]] function Button:SetEnvSpell(Id, NameRank, Name, Book, IsTalent) - self.UpdateTexture = Button.Empty; + self.UpdateTexture = Button.UpdateTextureSpell; self.UpdateChecked = Button.UpdateCheckedSpell; self.UpdateEquipped = Button.Empty; self.UpdateCooldown = Button.UpdateCooldownSpell; @@ -1275,6 +1275,27 @@ function Button:UnitBuffBySpell(unit, spell) return nil; end; +function Button:UpdateTextureSpell() + local spellHasBuffActive = false; + for i=1,40 do + local spellId = select(10, UnitBuff("player", i)); + if spellId then + if spellId == self.SpellId then + spellHasBuffActive = true; + break; + end + else + -- no more buffs + break; + end; + end; + + if (spellHasBuffActive == true and Const.StealthSpellIds[self.SpellId] ~= nil) then + self.WIcon:SetTexture("Interface/Icons/Spell_Nature_Invisibilty"); + else + self.WIcon:SetTexture(self.Texture); + end +end function Button:UpdateTextureWispSpell() --BFA fix: UnitBuff can no longer be called with the spell name as a param if (self.UnitBuffBySpell("player", self.SpellName)) then --NOTE: This en-US, hopefully it will be fine for other locales as well?? @@ -1386,7 +1407,7 @@ function Button:UpdateCheckedCompanion() end function Button:UpdateCheckedBonusAction() local action = self.Widget:GetAttribute("action"); - if ((HasOverrideActionBar() or HasVehicleActionBar()) and (IsCurrentAction(action) or IsAutoRepeatAction(action))) then + if ((HasOverrideActionBar()) and (IsCurrentAction(action) or IsAutoRepeatAction(action))) then self.Widget:SetChecked(true); else self.Widget:SetChecked(false); @@ -1471,7 +1492,7 @@ function Button:UpdateCooldownCompanion() --as of 5.0.4 doesn't appear to exist anymore?! end function Button:UpdateCooldownBonusAction() - if (HasOverrideActionBar() or HasVehicleActionBar()) then + if (HasOverrideActionBar()) then local action = self.Widget:GetAttribute("action"); Util.CooldownFrame_SetTimer(self.WCooldown, GetActionCooldown(action)); else @@ -1540,7 +1561,7 @@ end function Button:UpdateUsableBonusAction() local action = self.Widget:GetAttribute("action"); local IsUsable, NotEnoughMana = IsUsableAction(action); - if (IsUsable or (HasOverrideActionBar() == nil and HasVehicleActionBar() == nil)) then + if (IsUsable or (HasOverrideActionBar() == nil)) then self.WIcon:SetVertexColor(1.0, 1.0, 1.0); self.WNormalTexture:SetVertexColor(1.0, 1.0, 1.0); elseif (NotEnoughMana) then @@ -1578,8 +1599,8 @@ function Button:UpdateTextCountSpell() self.WCount:SetText(count); return; end - local charges = GetSpellCharges(self.SpellNameRank); - if (charges ~= nil) then + local charges, maxCharges = GetSpellCharges(self.SpellNameRank); + if (charges ~= nil and maxCharges ~= 1) then self.WCount:SetText(charges); return; end @@ -1610,7 +1631,7 @@ function Button:UpdateTextCountMacro() end function Button:UpdateTextCountBonusAction() local action = self.Widget:GetAttribute("action"); - if ((HasOverrideActionBar() or HasVehicleActionBar()) and (IsConsumableAction(action) or IsStackableAction(action))) then + if ((HasOverrideActionBar()) and (IsConsumableAction(action) or IsStackableAction(action))) then self.WCount:SetText(GetActionCount(action)); else self.WCount:SetText(""); @@ -1700,7 +1721,7 @@ end function Button:UpdateTooltipBonusAction() self = self.ParentButton or self; --This is a sneaky cheat incase the widget was used to get here... local action = self.Widget:GetAttribute("action"); - if (HasOverrideActionBar() or HasVehicleActionBar()) then + if (HasOverrideActionBar()) then GameTooltip:SetAction(action); else GameTooltip:SetText(self.Tooltip, nil, nil, nil, nil, 1); @@ -1781,7 +1802,7 @@ function Button:UpdateFlashMacro() end function Button:UpdateFlashBonusAction() local action = self.Widget:GetAttribute("action"); - if ((HasOverrideActionBar() or HasVehicleActionBar()) and ((IsAttackAction(action) and IsCurrentAction(action)) or IsAutoRepeatAction(action))) then + if ((HasOverrideActionBar()) and ((IsAttackAction(action) and IsCurrentAction(action)) or IsAutoRepeatAction(action))) then if (not self.FlashOn) then self:AddToFlash(); end @@ -1846,7 +1867,7 @@ function Button:UpdateRangeTimerMacro() end function Button:UpdateRangeTimerBonusAction() local action = self.Widget:GetAttribute("action"); - if ((HasOverrideActionBar() or HasVehicleActionBar()) and IsActionInRange(action)) then + if ((HasOverrideActionBar()) and IsActionInRange(action)) then if (not self.RangeTimerOn) then self:AddToRangeTimer(); end @@ -2097,13 +2118,20 @@ function Button:UpdateFlyout() -- Update arrow Widget.FlyoutArrow:Show(); Widget.FlyoutArrow:ClearAllPoints(); - --if (self:GetParent() == MultiBarRight or self:GetParent() == MultiBarLeft) then - --self.FlyoutArrow:SetPoint("LEFT", self, "LEFT", -arrowDistance, 0); - --SetClampedTextureRotation(self.FlyoutArrow, 270); - --else + local direction = self.Widget:GetAttribute("flyoutDirection"); + if (direction == "LEFT") then + Widget.FlyoutArrow:SetPoint("LEFT", Widget, "LEFT", -arrowDistance, 0); + SetClampedTextureRotation(Widget.FlyoutArrow, 270); + elseif (direction == "RIGHT") then + Widget.FlyoutArrow:SetPoint("RIGHT", Widget, "RIGHT", arrowDistance, 0); + SetClampedTextureRotation(Widget.FlyoutArrow, 90); + elseif (direction == "DOWN") then + Widget.FlyoutArrow:SetPoint("BOTTOM", Widget, "BOTTOM", 0, -arrowDistance); + SetClampedTextureRotation(Widget.FlyoutArrow, 180); + else Widget.FlyoutArrow:SetPoint("TOP", Widget, "TOP", 0, arrowDistance); SetClampedTextureRotation(Widget.FlyoutArrow, 0); - --end + end else Widget.FlyoutBorder:Hide(); Widget.FlyoutBorderShadow:Hide(); diff --git a/ButtonForge.toc b/ButtonForge.toc index e2b8c8f..6e27329 100644 --- a/ButtonForge.toc +++ b/ButtonForge.toc @@ -1,8 +1,8 @@ ## Interface: 11306 ## Title: Button Forge |cff69ccf0(Classic)|r -## Notes: Add as many or few extra Action Bars and Buttons to your user interface to complement the standard (or other) Action Bars -## Version: 1.0.2-classic +## Version: 1.0.3-classic ## Author: Massiner of Nathrezim, Albirew +## Notes: Add as many or few extra Action Bars and Buttons to your user interface to complement the standard (or other) Action Bars ## SavedVariables: ButtonForgeGlobalSettings, ButtonForgeGlobalProfiles, ButtonForgeGlobalBackup ## SavedVariablesPerCharacter: ButtonForgeSave ## OptionalDeps: Masque diff --git a/Const.lua b/Const.lua index 2773d08..1119ee7 100644 --- a/Const.lua +++ b/Const.lua @@ -54,6 +54,11 @@ Const.ThresholdHSnapSq = 10 * 10; Const.ThresholdHPressureSq = 20 * 20; +Const.StealthSpellIds = {}; +Const.StealthSpellIds[1784] = 1; -- Stealth +Const.StealthSpellIds[5215] = 1; -- Prowl + + Const.WispSpellIds = {}; Const.WispSpellIds[19746] = 1; --Concentration Aura Const.WispSpellIds[32223] = 1; --Crusader Aura @@ -96,6 +101,7 @@ Const.SlashCommands["-keybindtext"] = {params = "bool", group = "bar"}; Const.SlashCommands["-tooltips"] = {params = "bool", group = "bar"}; Const.SlashCommands["-emptybuttons"] = {params = "bool", group = "bar"}; Const.SlashCommands["-lockbuttons"] = {params = "bool", group = "bar"}; +Const.SlashCommands["-flyout"] = {params = "^%s*(..-)%s*$", group = "bar"}; Const.SlashCommands["-scale"] = {params = "^%s*(%d*%.?%d+)%s*$", group = "bar"}; Const.SlashCommands["-rows"] = {params = "^%s*(%d+)%s*$", group = "bar", requires = {"-createbar", "-bar"}}; Const.SlashCommands["-cols"] = {params = "^%s*(%d+)%s*$", group = "bar", requires = {"-createbar", "-bar"}}; diff --git a/Locale-enUS.lua b/Locale-enUS.lua index e4811ec..98e9aa8 100644 --- a/Locale-enUS.lua +++ b/Locale-enUS.lua @@ -98,6 +98,7 @@ Locale["SlashHelpFormatted"] = "|c"..Const.LightBlue.."-tooltips |r\n".. "|c"..Const.LightBlue.."-emptybuttons |r\n".. "|c"..Const.LightBlue.."-lockbuttons |r\n".. + "|c"..Const.LightBlue.."-flyout |r\n".. "|c"..Const.LightBlue.."-macrotext |r\n".. "|c"..Const.LightBlue.."-keybindtext |r\n".. "|c"..Const.LightBlue.."-hidespec1 |r\n".. diff --git a/UILibLines.lua b/UILibLines.lua index 00d4a2a..314f4f9 100644 --- a/UILibLines.lua +++ b/UILibLines.lua @@ -10,11 +10,11 @@ local UILib = BFUILib; local Const = BFConst; local VertLine = CreateFrame("FRAME", nil, UIParent); -VertLine:SetBackdrop({bgFile = Const.ImagesDir.."VertLine.tga", edgeFile = nil, tile = false, tileSize = 1, edgeSize = 0, insets = {left=0, right=0, bottom=0, top=0}}); +VertLine:SetBackdrop({bgFile = Const.ImagesDir.."VertLine.tga", edgeFile = nil, tile = false, tileSize = 1, edgeSize = 1, insets = {left=0, right=0, bottom=0, top=0}}); VertLine:SetWidth(Const.VLineThickness / UIParent:GetScale()); local HorizLine = CreateFrame("FRAME", nil, UIParent); -HorizLine:SetBackdrop({bgFile = Const.ImagesDir.."HorizontalLine.tga", edgeFile = nil, tile = false, tileSize = 1, edgeSize = 0, insets = {left=0, right=0, bottom=0, top=0}}); +HorizLine:SetBackdrop({bgFile = Const.ImagesDir.."HorizontalLine.tga", edgeFile = nil, tile = false, tileSize = 1, edgeSize = 1, insets = {left=0, right=0, bottom=0, top=0}}); HorizLine:SetHeight(Const.HLineThickness / UIParent:GetScale()); diff --git a/UILibToolbar.lua b/UILibToolbar.lua index 921d763..dd487de 100644 --- a/UILibToolbar.lua +++ b/UILibToolbar.lua @@ -16,7 +16,6 @@ function UILib.ToggleCreateBarMode(ForceOff) if (BFCreateBarOverlay:IsShown() or ForceOff) then BFCreateBarOverlay:Hide(); BFToolbarCreateBar:SetChecked(false); - BFToolbarCreateBonusBar:SetChecked(false); UILib.CreateBarMode = false; UILib.CreateBonusBarMode = false; SetCursor(nil); @@ -40,14 +39,12 @@ function UILib.ToggleCreateBonusBarMode(ForceOff) if (BFCreateBarOverlay:IsShown() or ForceOff) then BFCreateBarOverlay:Hide(); BFToolbarCreateBar:SetChecked(false); - BFToolbarCreateBonusBar:SetChecked(false); UILib.CreateBarMode = false; UILib.CreateBonusBarMode = false; SetCursor(nil); elseif (not InCombatLockdown()) then UILib.CreateBonusBarMode = true; BFCreateBarOverlay:Show(); - BFToolbarCreateBonusBar:SetChecked(true); SetCursor("REPAIRNPC_CURSOR"); end EventFull.RefreshButtons = true; @@ -83,14 +80,12 @@ function UILib.ToggleAdvancedTools() BFToolbarAdvanced:SetChecked(false); ButtonForgeSave.AdvancedMode = false; BFToolbar:SetSize(216, 88); - BFToolbarCreateBonusBar:Hide(); BFToolbarRightClickSelfCast:Hide(); else BFAdvancedToolsLayer:Show(); BFToolbarAdvanced:SetChecked(true); ButtonForgeSave.AdvancedMode = true; BFToolbar:SetSize(216, 116); - BFToolbarCreateBonusBar:Show(); BFToolbarRightClickSelfCast:Show(); end EventFull.RefreshButtons = true; diff --git a/UILibToolbar.xml b/UILibToolbar.xml index c3662c9..665fe09 100644 --- a/UILibToolbar.xml +++ b/UILibToolbar.xml @@ -4,6 +4,9 @@ + + + self:StartMoving(); @@ -119,41 +122,6 @@ - - - diff --git a/Util.lua b/Util.lua index fe9d589..51e3fd7 100644 --- a/Util.lua +++ b/Util.lua @@ -1372,6 +1372,10 @@ function Util.ApplySlashCommands(Commands, Bar) if (Commands["-lockbuttons"]) then Bar:SetButtonsLocked(Commands["-lockbuttons"][1]); end + + if (Commands["-flyout"]) then + Bar:SetFlyoutDirection(Commands["-flyout"][1]); + end if (Commands["-scale"]) then Bar:SetScale(tonumber(Commands["-scale"][1])); @@ -1547,7 +1551,13 @@ function Util.SetCursor(Command, Data, Subvalue, Subsubvalue) UILib.StopDraggingIcon(); -- SpellFlyout:Hide(); if (Command == "spell") then - PickupSpell(Subsubvalue); + -- pet spell or not + local name = GetSpellInfo(Subsubvalue); + if ( Util.PetSpellIndex[name] ) then + PickupSpellBookItem(Util.PetSpellIndex[name], BOOKTYPE_PET); + else + PickupSpell(Subsubvalue); + end; elseif (Command == "item") then PickupItem(Data); elseif (Command == "macro") then