Merge branch 'original'

also removed advanced "create bonus bar" button since non-existant in classic
Cette révision appartient à :
Albirew 2021-01-30 17:15:42 +01:00
révision 00bf15fb7b
9 fichiers modifiés avec 102 ajouts et 61 suppressions

35
Bar.lua
Voir le fichier

@ -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;

Voir le fichier

@ -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();

Voir le fichier

@ -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

Voir le fichier

@ -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"}};

Voir le fichier

@ -98,6 +98,7 @@ Locale["SlashHelpFormatted"] =
"|c"..Const.LightBlue.."-tooltips <on/off>|r\n"..
"|c"..Const.LightBlue.."-emptybuttons <on/off>|r\n"..
"|c"..Const.LightBlue.."-lockbuttons <on/off>|r\n"..
"|c"..Const.LightBlue.."-flyout <up/down/left/right>|r\n"..
"|c"..Const.LightBlue.."-macrotext <on/off>|r\n"..
"|c"..Const.LightBlue.."-keybindtext <on/off>|r\n"..
"|c"..Const.LightBlue.."-hidespec1 <on/off>|r\n"..

Voir le fichier

@ -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());

Voir le fichier

@ -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;

Voir le fichier

@ -4,6 +4,9 @@
<Frame name="BFToolbar" parent="BFConfigureLayer" enablemouse="true" movable="true">
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508883-59c2-4f83-ae10-27aaad48391b" />-->
<KeyValues>
<KeyValue key="backdropInfo" value="BACKDROP_DIALOG_32_32" type="global"/>
</KeyValues>
<Scripts>
<OnMouseDown>
self:StartMoving();
@ -119,41 +122,6 @@
</Scripts>
</CheckButton>
<!-- Create Bonus Bar, This button toggles create bonus bar mode -->
<CheckButton name="$parentCreateBonusBar" inherits="ActionButtonTemplate" hidden="true">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="20" y="-74" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
_G[self:GetName().."Icon"]:SetTexture(BFConst.ImagesDir.."CreateBonusBar.tga");
self:RegisterForDrag("LeftButton", "RightButton");
self.Tooltip = BFUtil.GetLocaleString("CreateBonusBarTooltip");
self:SetScale(0.66);
self:ClearAllPoints();
self:SetPoint("TOPLEFT", self:GetParent(), "TOPLEFT", 20 / 0.66, -74 / 0.66);
</OnLoad>
<OnClick>
-- Toggle CreateBar Mode
BFUILib.ToggleCreateBonusBarMode();
</OnClick>
<OnDragStart>
BFCustomAction.SetCursor("createbonusbarmode");
</OnDragStart>
<OnEnter>
GameTooltip:SetOwner(self:GetParent(), "ANCHOR_TOPLEFT");
GameTooltip:SetText(self.Tooltip, nil, nil, nil, nil, 1);
</OnEnter>
<OnLeave>
GameTooltip_Hide();
</OnLeave>
</Scripts>
</CheckButton>
<!-- Destroy Bar, this button toggles destroy bar mode -->
<CheckButton name="$parentDestroyBar" inherits="ActionButtonTemplate">
<Anchors>

Voir le fichier

@ -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