Comparer les révisions

..

1 Révisions

Auteur SHA1 Message Date
Albirew 7f8de2408c release 1.0.4 2021-05-24 18:05:09 +02:00
20 fichiers modifiés avec 686 ajouts et 824 suppressions

35
Bar.lua
Voir le fichier

@ -71,7 +71,6 @@ function Bar.New(BarSave)
ButtonFrame:SetAttribute("_onshow", [[local B, Key;
for i = 1, #Buttons do
B = Buttons[i];
B:Enable();
Key = B:GetAttribute("KeyBindValue");
if (Key) then
B:SetBindingClick(false, Key, B);
@ -81,7 +80,6 @@ function Bar.New(BarSave)
ButtonFrame:SetAttribute("_onshow", [[local B, Key;
for i = 1, #Buttons do
B = Buttons[i];
B:Enable();
Key = B:GetAttribute("KeyBindValue");
if (Key) then
B:SetBindingClick(false, Key, B, "KeyBind");
@ -91,7 +89,6 @@ function Bar.New(BarSave)
ButtonFrame:SetAttribute("_onhide", [[local B, Key;
for i = 1, #Buttons do
B = Buttons[i];
B:Disable();
Key = B:GetAttribute("KeyBindValue");
if (Key) then
B:ClearBindings();
@ -141,8 +138,7 @@ function Bar.New(BarSave)
NewBar.ButtonFrame = ButtonFrame;
--[[Background Layer, this will contain all controls and is used in resizing]]--
local Background = CreateFrame("FRAME", nil, ControlFrame);
Mixin(Background, BackdropTemplateMixin)
local Background = CreateFrame("FRAME", nil, ControlFrame, "BackdropTemplate");
Background:SetSize(1, 1);
Background:SetPoint("TOPLEFT", ControlFrame, "TOPLEFT");
Background:SetBackdrop({bgFile = Const.ImagesDir.."Backdrop.tga", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, insets = {left=3, right=3, bottom=3, top=3}});
@ -183,8 +179,7 @@ function Bar.New(BarSave)
NewBar.TileTexture = TileTexture;
--[[Label Frame]]--
local LabelFrame = CreateFrame("FRAME", nil, ControlFrame);
Mixin(LabelFrame, BackdropTemplateMixin)
local LabelFrame = CreateFrame("FRAME", nil, ControlFrame, "BackdropTemplate");
LabelFrame:SetSize(1, 1);
LabelFrame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 8, insets = {left=1.5, right=1.5, bottom=1.5, top=1.5}});
LabelFrame:SetBackdropColor(0, 0, 0, 1);
@ -325,8 +320,7 @@ function Bar.New(BarSave)
--table.insert(NewBar.LeftControls, NewBar.LabelButton);
-- a bit hacky - but to get this out sooner rather than a bigger refactor
-- local NumSpecs = GetNumSpecializations() -- DOESN'T EXIST IN CLASSIC
local NumSpecs = 1;
local NumSpecs = GetNumSpecializations()
for i = 1, NumSpecs do
--[[Hide On Talent # Button]]--
NewBar["HSpec"..i.."Button"] = UILib.CreateButton(Background, Const.MiniIconSize, Const.MiniIconSize, --parent, width, height
@ -525,6 +519,7 @@ function Bar:Configure(BarSave)
self:SetHSpec4(BarSave["HSpec4"]);
self:SetHVehicle(BarSave["HVehicle"]);
self:SetHBonusBar(BarSave["HBonusBar"]);
self:SetHPetBattle(BarSave["HPetBattle"]);
self:SetVD(BarSave["VDriver"]);
self:SetGridAlwaysOn(BarSave["GridAlwaysOn"]);
self:SetButtonsLocked(BarSave["ButtonsLocked"]);
@ -1139,7 +1134,7 @@ end
--]]
function Bar:DestroyBar()
if (not InCombatLockdown()) then
PlaySoundFile("sound/spells/meltoretarget.ogg"); --PlaySoundFile(569366)
PlaySoundFile(569366); --sound/spells/meltoretarget.ogg
Util.DeallocateBar(self);
end
UILib.ToggleDestroyBarMode(true);
@ -1582,6 +1577,23 @@ function Bar:GetHBonusBar()
end
end
function Bar:SetHPetBattle(Value)
if (not InCombatLockdown()) then
if (Value == "toggle") then
Value = not self.BarSave["HPetBattle"];
end
self.BarSave["HPetBattle"] = Value;
self:SetVD(self.BarSave["VDriver"]);
end
end
function Bar:GetHPetBattle()
if (self.BarSave["HPetBattle"]) then
return self.BarSave["HPetBattle"], Util.GetLocaleString("Hidden");
else
return self.BarSave["HPetBattle"], Util.GetLocaleString("Shown");
end
end
--[[
Handle updating the Visibility State Driver
--]]
@ -1603,6 +1615,9 @@ function Bar:SetVD(VDText)
if (not self.BarSave["Enabled"]) then
Text = Text.."hide; ";
end
if (self.BarSave["HPetBattle"]) then
Text = Text.."[petbattle] hide; ";
end
if (self.BarSave["HSpec1"]) then
Text = Text.."[spec:1] hide; ";
end

Voir le fichier

@ -195,6 +195,9 @@ function Button:Configure(Parent, ButtonSave, ButtonLocked, TooltipEnabled, Macr
elseif (Mode == "customaction") then
self:SetCommandExplicitCustomAction(ButtonSave["CustomActionName"]);
elseif (Mode == "battlepet") then
self:SetCommandExplicitBattlePet(ButtonSave["BattlePetId"]);
else
self:ClearCommand();
@ -553,6 +556,8 @@ function Button:SetCommandFromTriplet(Command, Data, Subvalue, Subsubvalue)
self:SetCommandFlyout(Data); --Data = Id
elseif (Command == "customaction") then
self:SetCommandCustomAction(Data); --Data = Action
elseif (Command == "battlepet") then
self:SetCommandBattlePet(Data);
elseif (Command == nil or Command == "") then
self:ClearCommand();
else
@ -573,7 +578,7 @@ end
--[[ Set the individual types of actions including obtained any extra data they may need --]]
function Button:SetCommandSpell(Id)
local Name, Rank = Util.GetSpellInfo(Id); -- TBC Fix 2021/06/18
local Name, Rank = GetSpellInfo(Id);
local NameRank = Util.GetFullSpellName(Name, Rank);
self:SetCommandExplicitSpell(Id, NameRank, Name, Book);
end
@ -609,6 +614,9 @@ end
function Button:SetCommandCustomAction(Name)
self:SetCommandExplicitCustomAction(Name);
end
function Button:SetCommandBattlePet(Id)
self:SetCommandExplicitBattlePet(Id);
end
--[[ Set the individual types of actions (all data needed is supplied to the functions as args) --]]
function Button:SetCommandExplicitSpell(Id, NameRank, Name, Book)
@ -660,6 +668,11 @@ function Button:SetCommandExplicitCustomAction(Name)
self:SetAttributes("customaction", Name);
self:SaveCustomAction(Name);
end
function Button:SetCommandExplicitBattlePet(Id)
self:SetEnvBattlePet(Id);
self:SetAttributes("battlepet", Id);
self:SaveBattlePet(Id);
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)
@ -982,6 +995,35 @@ function Button:SetEnvCustomAction(Name)
self:DisplayActive(TexCoords);
Util.AddBonusAction(self);
end
function Button:SetEnvBattlePet(Id)
self.UpdateTexture = Button.Empty;
self.UpdateChecked = Button.UpdateCheckedBattlePet;
self.UpdateEquipped = Button.Empty;
self.UpdateCooldown = Button.UpdateCooldownBattlePet;
self.UpdateUsable = Button.UpdateUsableBattlePet;
self.UpdateTextCount = Button.Empty;
self.UpdateTooltipFunc = Button.UpdateTooltipBattlePet;
self.UpdateRangeTimer = Button.Empty;
self.CheckRangeTimer = Button.Empty;
self.UpdateFlash = Button.Empty;
self.UpdateFlyout = Button.Empty;
self.GetCursor = Button.GetCursorBattlePet;
self.FullRefresh = Button.FullRefresh;
self.Mode = "battlepet";
self.BattlePetId = Id;
if (Id == Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_ID) then
self.Texture = Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_TEXTURE;
else
self.Texture = select(9, C_PetJournal.GetPetInfoByPetID(Id));
end
self.Target = "target";
self:ResetAppearance();
self:DisplayActive();
end
function Button:SetEnvClear()
self.UpdateTexture = Button.Empty;
self.UpdateChecked = Button.UpdateChecked;
@ -1056,6 +1098,11 @@ function Button:SaveCustomAction(Name)
self.ButtonSave["Mode"] = "customaction";
self.ButtonSave["CustomActionName"] = Name;
end
function Button:SaveBattlePet(Id)
self:SaveClear();
self.ButtonSave["Mode"] = "battlepet";
self.ButtonSave["BattlePetId"] = Id;
end
function Button:SaveClear()
self.ButtonSave["SpellId"] = nil;
self.ButtonSave["SpellNameRank"] = nil;
@ -1084,6 +1131,7 @@ function Button:SaveClear()
self.ButtonSave["BonusActionId"] = nil;
self.ButtonSave["FlyoutId"] = nil;
self.ButtonSave["CustomActionName"] = nil;
self.ButtonSave["BattlePetId"] = nil;
self.ButtonSave["Mode"] = nil;
end
@ -1101,9 +1149,25 @@ function Button:SetAttributes(Type, Value)
--Now if a valid type is passed in set it
if (Type == "spell") then
-- Patch to fix some spell that doesnt like to be cast with ID (Thrash, Stampeding Roar, ...)
prof1, prof2 = GetProfessions();
if ( prof1 ) then
prof1_name, _, _, _, _, _, prof1_skillLine = GetProfessionInfo(prof1);
end
if ( prof2 ) then
prof2_name, _, _, _, _, _, prof2_skillLine = GetProfessionInfo(prof2);
end
local SpellName = GetSpellInfo(Value);
if ( SpellName ) then
-- Patch to fix tradeskills
if ( prof1 and SpellName == prof1_name ) then
self.Widget:SetAttribute("type", "macro");
self.Widget:SetAttribute("macrotext", "/run RunScript('if (select(6, C_TradeSkillUI.GetTradeSkillLine()) == prof1_skillLine) then C_TradeSkillUI.CloseTradeSkill() else C_TradeSkillUI.OpenTradeSkill("..prof1_skillLine..") end')");
elseif ( prof2 and SpellName == prof2_name ) then
self.Widget:SetAttribute("type", "macro");
self.Widget:SetAttribute("macrotext", "/run RunScript('if (select(6, C_TradeSkillUI.GetTradeSkillLine()) == prof2_skillLine) then C_TradeSkillUI.CloseTradeSkill() else C_TradeSkillUI.OpenTradeSkill("..prof2_skillLine..") end')");
-- Patch to fix some spell that doesnt like to be cast with ID (Thrash, Stampeding Roar, ...)
elseif ( SpellName ) then
self.Widget:SetAttribute("type", Type);
self.Widget:SetAttribute(Type, SpellName);
else
@ -1136,7 +1200,10 @@ function Button:SetAttributes(Type, Value)
self.Widget:SetAttribute("spell", Value);
elseif (Type == "customaction") then
CustomAction.SetAttributes(Value, self.Widget);
end
elseif (Type == "battlepet") then
self.Widget:SetAttribute("type", "macro");
self.Widget:SetAttribute("macrotext", "/summonpet "..Value);
end
end
@ -1230,9 +1297,7 @@ function Button:TranslateMacro()
self.CompanionIndex = CompanionID;
end
self.SpellName = SpellName;
-- self.SpellNameRank = GetSpellInfo(SpellName); --BFA fix: Cache is indexed by name and the old function returned the ID
local Rank = Util.GetSpellRank(SpellId) -- TBC Fix 2021/06/17
self.SpellNameRank = Util.GetFullSpellName(SpellName, Rank); -- TBC Fix 2021/06/17
self.SpellNameRank = GetSpellInfo(SpellName); --BFA fix: Cache is indexed by name and the old function returned the ID
self.SpellId = SpellId;
self.MacroMode = "spell";
else
@ -1311,7 +1376,7 @@ function Button:UpdateTextureMacro()
end
function Button:UpdateTextureBonusAction()
local action = self.Widget:GetAttribute("action");
if (HasOverrideActionBar()) then
if (HasOverrideActionBar() or HasVehicleActionBar()) then
local Texture = GetActionTexture(action);
if (not Texture) then
self.WIcon:SetTexture(Const.ImagesDir.."Bonus"..self.BonusActionId);
@ -1409,7 +1474,7 @@ function Button:UpdateCheckedCompanion()
end
function Button:UpdateCheckedBonusAction()
local action = self.Widget:GetAttribute("action");
if ((HasOverrideActionBar()) and (IsCurrentAction(action) or IsAutoRepeatAction(action))) then
if ((HasOverrideActionBar() or HasVehicleActionBar()) and (IsCurrentAction(action) or IsAutoRepeatAction(action))) then
self.Widget:SetChecked(true);
else
self.Widget:SetChecked(false);
@ -1418,6 +1483,10 @@ end
function Button:UpdateCheckedCustomAction()
self.Widget:SetChecked(CustomAction.GetChecked(self.CustomActionName));
end
function Button:UpdateCheckedBattlePet()
local Active = self.BattlePetId == C_PetJournal.GetSummonedPetGUID();
self.Widget:SetChecked(Active);
end
@ -1494,13 +1563,17 @@ function Button:UpdateCooldownCompanion()
--as of 5.0.4 doesn't appear to exist anymore?!
end
function Button:UpdateCooldownBonusAction()
if (HasOverrideActionBar()) then
if (HasOverrideActionBar() or HasVehicleActionBar()) then
local action = self.Widget:GetAttribute("action");
Util.CooldownFrame_SetTimer(self.WCooldown, GetActionCooldown(action));
else
self.WCooldown:Hide();
end
end
function Button:UpdateCooldownBattlePet()
--CooldownFrame_SetTimer(self.WCooldown, GetCompanionCooldown(self.CompanionType, self.CompanionIndex));
--as of 5.0.4 doesn't appear to exist anymore?!
end
@ -1525,7 +1598,7 @@ function Button:UpdateUsableSpell()
end
function Button:UpdateUsableItem()
local IsUsable, NotEnoughMana = IsUsableItem(self.ItemId);
-- IsUsable = IsUsable or PlayerHasToy(self.ItemId);
IsUsable = IsUsable or PlayerHasToy(self.ItemId);
if (IsUsable) then
self.WIcon:SetVertexColor(1.0, 1.0, 1.0);
self.WNormalTexture:SetVertexColor(1.0, 1.0, 1.0);
@ -1563,7 +1636,7 @@ end
function Button:UpdateUsableBonusAction()
local action = self.Widget:GetAttribute("action");
local IsUsable, NotEnoughMana = IsUsableAction(action);
if (IsUsable or (HasOverrideActionBar() == nil)) then
if (IsUsable or (HasOverrideActionBar() == nil and HasVehicleActionBar() == nil)) then
self.WIcon:SetVertexColor(1.0, 1.0, 1.0);
self.WNormalTexture:SetVertexColor(1.0, 1.0, 1.0);
elseif (NotEnoughMana) then
@ -1587,6 +1660,16 @@ function Button:UpdateUsableCustomAction()
self.WNormalTexture:SetVertexColor(1.0, 1.0, 1.0);
end
end
function Button:UpdateUsableBattlePet()
--local IsUsable, NotEnoughMana = IsUsableItem(self.ItemName);
--if (self.CompanionType == "MOUNT" and IsIndoors()) then
-- self.WIcon:SetVertexColor(0.4, 0.4, 0.4);
-- self.WNormalTexture:SetVertexColor(1.0, 1.0, 1.0);
--else
self.WIcon:SetVertexColor(1.0, 1.0, 1.0);
self.WNormalTexture:SetVertexColor(1.0, 1.0, 1.0);
--end
end
--[[----------------------------------------------------------------------------
@ -1633,7 +1716,7 @@ function Button:UpdateTextCountMacro()
end
function Button:UpdateTextCountBonusAction()
local action = self.Widget:GetAttribute("action");
if ((HasOverrideActionBar()) and (IsConsumableAction(action) or IsStackableAction(action))) then
if ((HasOverrideActionBar() or HasVehicleActionBar()) and (IsConsumableAction(action) or IsStackableAction(action))) then
self.WCount:SetText(GetActionCount(action));
else
self.WCount:SetText("");
@ -1723,7 +1806,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()) then
if (HasOverrideActionBar() or HasVehicleActionBar()) then
GameTooltip:SetAction(action);
else
GameTooltip:SetText(self.Tooltip, nil, nil, nil, nil, 1);
@ -1742,7 +1825,22 @@ function Button:UpdateTooltipCustomAction()
CustomAction.UpdateTooltip(self.CustomActionName);
end
function Button:UpdateTooltipBattlePet()
self = self.ParentButton or self; --This is a sneaky cheat incase the widget was used to get here...
local speciesID, customName, level, xp, maxXp, displayID, isFavorite
, name = C_PetJournal.GetPetInfoByPetID(self.BattlePetId);
if ( customName or name ) then
GameTooltip:SetText(customName or name, 1, 1, 1);
GameTooltip:AddLine(SPELL_CAST_TIME_INSTANT, 1, 1, 1, true);
GameTooltip:AddLine(string.format(BATTLE_PET_TOOLTIP_SUMMON, name), nil, nil, nil, true);
GameTooltip:Show();
elseif (self.BattlePetId == Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_ID) then
GameTooltip:SetText(PET_JOURNAL_SUMMON_RANDOM_FAVORITE_PET, 1, 1, 1);
GameTooltip:AddLine(SPELL_CAST_TIME_INSTANT, 1, 1, 1, true);
GameTooltip:Show();
end
end
@ -1776,6 +1874,9 @@ end
function Button:GetCursorCustomAction()
return self.Mode, self.CustomActionName, nil;
end
function Button:GetCursorBattlePet()
return self.Mode, self.BattlePetId, nil;
end
@ -1804,7 +1905,7 @@ function Button:UpdateFlashMacro()
end
function Button:UpdateFlashBonusAction()
local action = self.Widget:GetAttribute("action");
if ((HasOverrideActionBar()) and ((IsAttackAction(action) and IsCurrentAction(action)) or IsAutoRepeatAction(action))) then
if ((HasOverrideActionBar() or HasVehicleActionBar()) and ((IsAttackAction(action) and IsCurrentAction(action)) or IsAutoRepeatAction(action))) then
if (not self.FlashOn) then
self:AddToFlash();
end
@ -1869,7 +1970,7 @@ function Button:UpdateRangeTimerMacro()
end
function Button:UpdateRangeTimerBonusAction()
local action = self.Widget:GetAttribute("action");
if ((HasOverrideActionBar()) and IsActionInRange(action)) then
if ((HasOverrideActionBar() or HasVehicleActionBar()) and IsActionInRange(action)) then
if (not self.RangeTimerOn) then
self:AddToRangeTimer();
end
@ -2036,8 +2137,7 @@ function Button:PromoteSpell()
end
--[[
if (self.Mode == "spell") then
-- local Name, Rank = GetSpellInfo(self.SpellName); --This will actually retrieve for the highest rank of the spell
local Name, Rank = Util.GetSpellInfo(self.SpellName) -- TBC Fix 2021/06/18
local Name, Rank = GetSpellInfo(self.SpellName); --This will actually retrieve for the highest rank of the spell
if (Name) then
if (Util.LookupNewSpellIndex(Name.."("..Rank..")")) then
if (strfind(Rank, Util.GetLocaleString("SpellRank"), 1, true) and strfind(self.SpellNameRank, Util.GetLocaleString("SpellRank"), 1, true)) then
@ -2058,6 +2158,18 @@ function Button:RefreshSpell()
end
end
function Button:RefreshBattlePet()
if (self.Mode == "battlepet") then
if (self.BattlePetId == Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_ID) then
self.Texture = Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_TEXTURE;
else
self.Texture = select(9, C_PetJournal.GetPetInfoByPetID(self.BattlePetId));
end
self.Texture = self.Texture or "Interface/Icons/INV_Misc_QuestionMark";
self:DisplayActive();
end
end
function Button:RefreshCompanion()
if (InCombatLockdown()) then
return;

Voir le fichier

@ -1,10 +1,10 @@
## Interface: 20501
## Title: Button Forge |cff69f0d1(Classic-TBC)|r
## Version: 1.0.5-classic-TBC
## Author: Massiner of Nathrezim, Albirew
## Interface: 90005
## Title: Button Forge
## 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.4
## Author: Massiner of Nathrezim
## SavedVariables: ButtonForgeGlobalSettings, ButtonForgeGlobalProfiles, ButtonForgeGlobalBackup
## SavedVariablesPerCharacter: ButtonForgeSave
## SavedVariablesPerCharacter: ButtonForgeSave, BFSave
## OptionalDeps: Masque
Declares.lua
Const.lua

Voir le fichier

@ -9,8 +9,10 @@
local Const = BFConst;
Const.SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544;
Const.SUMMON_RANDOM_FAVORITE_MOUNT_ID = 268435455;
Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_ID = "BattlePet-0-FFFFFFFFFFFFFF";
Const.SUMMON_RANDOM_FAVORITE_BATTLE_PET_TEXTURE = "Interface/Icons/INV_Pet_Achievement_CaptureAPetFromEachFamily_Battle";
Const.Version = 1.0;
Const.VersionMinor = 0.5;
Const.VersionMinor = 0.4;
Const.MAX_ACCOUNT_MACROS = 120;
Const.ButtonNaming = "ButtonForge"
Const.ButtonSeq = 1; --This value will increment (so not technically a const...)
@ -34,7 +36,7 @@ Const.KeyBindOverlayColor = {0.3, 0.7, 0.1, 0.4};
Const.BarBackdrop = {0.1, 0.1, 0.4, 0.85};
Const.BonusBarBackdrop = {0.1, 0.5, 0.1, 0.85};
Const.IconDragOverlayColor = {0.0, 0.1, 0.3, 0.0};
Const.ImagesDir = "Interface\\AddOns\\ButtonForge\\Images\\";
Const.ImagesDir = "Interface\\Addons\\ButtonForge\\Images\\";
Const.SlashNumLines = 4; --Num of lines to show before breaking the message up
Const.DisableAutoAlignAgainstDefaultBars = false; --Set to true and reload UI in order to not check the Blizzard bars when performing auto-alignment, this probably isn't needed but just in case
@ -117,6 +119,7 @@ Const.SlashCommands["-hidespec3"] = {params = "bool", group = "bar"};
Const.SlashCommands["-hidespec4"] = {params = "bool", group = "bar"};
Const.SlashCommands["-hidevehicle"] = {params = "bool", group = "bar"};
Const.SlashCommands["-hideoverridebar"] = {params = "bool", group = "bar"};
Const.SlashCommands["-hidepetbattle"] = {params = "bool", group = "bar"};
Const.SlashCommands["-vismacro"] = {params = "^%s*(.-)%s*$", group = "bar"}; -- I'm tempted to make this one require a bar, but to some degree it is player beware until/if I implement an undo stack
Const.SlashCommands["-gui"] = {params = "bool", group = "bar"};
Const.SlashCommands["-alpha"] = {params = "^%s*(%d*%.?%d+)%s*$", group = "bar", validate = function (p) return tonumber(p) <= 1; end};

Voir le fichier

@ -36,6 +36,7 @@ local CompatibleActions = {
, ["flyout"] = true
, ["petaction"] = true
, ["companion"] = true
, ["battlepet"] = true
, ["equipmentset"] = true};
function CursorUtil.CursorHasAction()
return CompatibleActions[GetCursorInfo()] or CustomCommand ~= nil;

Voir le fichier

@ -7,17 +7,11 @@
]]
BFLocales = {};
BFConst = {};
BFUtil = {};
BFUILib = {};
BFButton = {};
BFBar = {};
BFCustomAction = {};
ButtonForge_API1 = {};
ButtonForgeSave = {};
ButtonForgeGlobalSettings = {};
ButtonForgeGlobalProfiles = {};
ButtonForgeGlobalBackup = {};
BFLocales = {};
BFConst = {};
BFUtil = {};
BFUILib = {};
BFButton = {};
BFBar = {};
BFCustomAction = {};
ButtonForge_API1 = {};

Voir le fichier

@ -1,247 +0,0 @@
local _G = getfenv(0)
local addon, L = ...;
DS_Color1 = "|cff3399ff"
DS_Color2 = "|cff1eff00"
DS_Loaded = false
DS_pName = UnitName("player")
DS_pClass = UnitClass("player")
local function myprint(msg)
if msg ~= nil then
msg = tostring(msg)
print(DS_Color1..addon..": "..DS_Color2..msg)
return
end
end
local function DS_PadiSpellId(t)
if strlen(t) == 2 then
tnum = "0000"..t
return tnum
elseif strlen(t) == 3 then
tnum = "000"..t
return tnum
elseif strlen(t) == 4 then
tnum = "00"..t
return tnum
elseif strlen(t) == 5 then
tnum = "0"..t
return tnum
end
return t
end
function Init_DS_Tables()
-- known spells
if DS_kSpellsTable == nil then DS_kSpellsTable = {} end
if DS_kSpellsTable2 == nil then DS_kSpellsTable2 = {} end
if DS_kSpellsTable3 == nil then DS_kSpellsTable3 = {} end
if DS_ktblSpellNames == nil then DS_ktblSpellNames = {} end
if DS_kSpellsRank == nil then DS_kSpellsRank = {} end
if DS_ktblSpellCount == nil then DS_ktblSpellCount = {} end
DS_kSpellsTable[DS_pName] = {}
DS_kSpellsTable2[DS_pName] = {}
DS_kSpellsTable3[DS_pName] = {}
DS_ktblSpellNames[DS_pName] = {}
DS_kSpellsRank[DS_pName] = {}
DS_ktblSpellCount[DS_pName] = 0
-- all spells not pet
if DS_aSpellsTable == nil then DS_aSpellsTable = {} end
if DS_aSpellsTable2 == nil then DS_aSpellsTable2 = {} end
if DS_atblSpellNames == nil then DS_atblSpellNames = {} end
if DS_aSpellsRank == nil then DS_aSpellsRank = {} end
if DS_atblSpellCount == nil then DS_atblSpellCount = {} end
DS_aSpellsTable[DS_pName] = {}
DS_aSpellsTable2[DS_pName] = {}
DS_atblSpellNames[DS_pName] = {}
DS_aSpellsRank[DS_pName] = {}
DS_atblSpellCount[DS_pName] = 0
end
-- RegisterEvents
local DS_Eventframe = CreateFrame("FRAME")
DS_Eventframe:RegisterEvent("ADDON_LOADED")
DS_Eventframe:RegisterEvent("PLAYER_LOGIN")
local function DS_OnEvent(self, event, arg1, ...)
if event == "ADDON_LOADED" and arg1 == addon then
myprint("Addon_Loaded")
DS_Loaded = true
self:UnregisterEvent("ADDON_LOADED")
end
if event == "PLAYER_LOGIN" and DS_Loaded then
myprint("Player_Loaded")
myprint("Current Player :"..DS_pName)
myprint("Current Class :"..DS_pClass)
DS_GetSpellBook()
DS_Eventframe:UnregisterEvent("PLAYER_LOGIN")
end
end
DS_Eventframe:SetScript("OnEvent", DS_OnEvent)
-- Parse player's spellbook and build a list of available spells
function DS_GetSpellBook()
Init_DS_Tables()
-- known spells for character
local i = 0
local iIndex = 0
local iSpellId = 0
local old_iSpellId = 0
local txt_iSpellId = ""
for i = 1, GetNumSpellTabs() do
local _, _, offset, numSlots = GetSpellTabInfo(i)
for iIndex = offset, offset+numSlots do
local slotType, iSpellId = GetSpellBookItemInfo(iIndex, BOOKTYPE_SPELL)
if slotType == "SPELL" then
local slotName = GetSpellBookItemName(iIndex, "spell")
local spellName = GetSpellInfo(slotName)
if (spellName) then
txt_iSpellId = DS_PadiSpellId(tostring(iSpellId))
-- make sure iSpellId has not been seen
if not DS_kSpellsRank[DS_pName][iSpellId] then
DS_kSpellsRank[DS_pName][iSpellId] = 0
DS_ktblSpellNames[DS_pName][spellName] = spellName
if old_iSpellId ~= iSpellId then
old_iSpellId = iSpellId
DS_ktblSpellCount[DS_pName] = DS_ktblSpellCount[DS_pName] + 1
DS_kSpellsTable2[DS_pName][DS_ktblSpellCount[DS_pName]] = DS_pClass..", known, "..spellName..", "..txt_iSpellId
DS_kSpellsTable[DS_pName][DS_ktblSpellCount[DS_pName]] = { DS_pClass, "known", spellName, txt_iSpellId, 0 }
end
end
end
end
end -- for
end -- for
-- all non pet spells for character
local i = 0
local iIndex = 0
local iSpellId = 0
local old_iSpellId = 0
local txt_iSpellId = ""
for i = 1, GetNumSpellTabs() do
local _, _, offset, numSlots = GetSpellTabInfo(i)
for iIndex = offset, offset+numSlots do
local slotType, iSpellId = GetSpellBookItemInfo(iIndex, BOOKTYPE_SPELL)
if slotType == "SPELL" or slotType == "FUTURESPELL" then
local slotName = GetSpellBookItemName(iIndex, "spell")
local spellName = GetSpellInfo(slotName)
if (spellName) then
txt_iSpellId = DS_PadiSpellId(tostring(iSpellId))
-- make sure iSpellId has not been seen
if not DS_aSpellsRank[DS_pName][iSpellId] then
DS_aSpellsRank[DS_pName][iSpellId] = 0
DS_atblSpellNames[DS_pName][spellName] = spellName
if old_iSpellId ~= iSpellId then
old_iSpellId = iSpellId
DS_atblSpellCount[DS_pName] = DS_atblSpellCount[DS_pName] + 1
DS_aSpellsTable2[DS_pName][DS_atblSpellCount[DS_pName]] = DS_pClass..", all, "..spellName..", "..txt_iSpellId
DS_aSpellsTable[DS_pName][DS_atblSpellCount[DS_pName]] = { DS_pClass, "all", spellName, txt_iSpellId, 0 }
end
end
end
end
end -- for
end -- for
table.sort({DS_aSpellsTable[DS_pName]})
table.sort(DS_aSpellsTable2[DS_pName])
table.sort({DS_kSpellsTable[DS_pName]})
table.sort(DS_kSpellsTable2[DS_pName])
local spellRank = 0
local findinstr = ""
local findinstr2 = ""
-- known entries
for spellName, _ in pairs(DS_ktblSpellNames[DS_pName]) do
spellRank = 0
for loop = 1, DS_ktblSpellCount[DS_pName] do
findinstr = DS_kSpellsTable2[DS_pName][loop]
if string.match(findinstr, spellName) then
spellRank = spellRank + 1
DS_kSpellsTable2[DS_pName][loop] = findinstr..", Rank-"..spellRank
findinstr2 = DS_kSpellsTable2[DS_pName][loop]
for loop2 = 1, DS_ktblSpellCount[DS_pName] do
txt_iSpellId = DS_kSpellsTable[DS_pName][loop2][4]
if string.match(findinstr2,txt_iSpellId) then
DS_kSpellsTable[DS_pName][loop2][5] = spellRank
DS_kSpellsRank[DS_pName][tonumber(txt_iSpellId)] = spellRank
end
end
end
end
end
-- build table3
for loop = 1, DS_atblSpellCount[DS_pName] do
spellName = DS_kSpellsTable[DS_pName][loop][3]
iSpellId = tonumber(DS_kSpellsTable[DS_pName][loop][4])
if DS_kSpellsTable3[DS_pName][spellName] == nil then
DS_kSpellsTable3[DS_pName][spellName] = {}
end
table.insert(DS_kSpellsTable3[DS_pName][spellName], iSpellId)
end
-- test getting spellid for a rank
-- spellName = "Healing Touch"
-- r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14 = unpack(DS_kSpellsTable3[DS_pName][spellName])
-- myprint("Spell is: "..spellName..", Max Ranks for this spell is: "..#DS_kSpellsTable3[DS_pName][spellName]..", Rank 10 spellId is: "..r10)
-- all entries
for spellName, _ in pairs(DS_atblSpellNames[DS_pName]) do
spellRank = 0
for loop = 1, DS_atblSpellCount[DS_pName] do
findinstr = DS_aSpellsTable2[DS_pName][loop]
if string.match(findinstr, spellName) then
spellRank = spellRank + 1
DS_aSpellsTable2[DS_pName][loop] = findinstr..", Rank-"..spellRank
findinstr2 = DS_aSpellsTable2[DS_pName][loop]
for loop2 = 1, DS_atblSpellCount[DS_pName] do
txt_iSpellId = DS_aSpellsTable[DS_pName][loop2][4]
if string.match(findinstr2,txt_iSpellId) then
DS_aSpellsTable[DS_pName][loop2][5] = spellRank
DS_aSpellsRank[DS_pName][tonumber(txt_iSpellId)] = spellRank
end
end
end
end
end
end

Voir le fichier

@ -77,11 +77,14 @@ end
--[[------------------------------------------------------------------------
Misc Resync type events
--------------------------------------------------------------------------]]
Misc:RegisterEvent("COMPANION_LEARNED"); --resync companions
Misc:RegisterEvent("PET_JOURNAL_LIST_UPDATE"); --textures etc should now be available
Misc:RegisterEvent("LEARNED_SPELL_IN_TAB"); --refresh/promote spells
Misc:RegisterEvent("SPELLS_CHANGED"); --refresh spells depending on play style this could trigger often, we will instead rely on other events to keep spells synched
Misc:RegisterEvent("CHARACTER_POINTS_CHANGED"); --refresh spells
Misc:RegisterEvent("UPDATE_MACROS"); --resync macros
--Misc:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED"); --refresh spells (and prevent spell promotion)
Misc:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED"); --refresh spells (and prevent spell promotion)
Misc:RegisterEvent("EQUIPMENT_SETS_CHANGED"); --resync equip sets
Misc:RegisterEvent("PLAYER_REGEN_DISABLED"); --enter combat
Misc:RegisterEvent("PLAYER_REGEN_ENABLED"); --out of combat
Misc:RegisterEvent("CURSOR_UPDATE"); --possibly show button grids
@ -89,10 +92,13 @@ Misc:RegisterEvent("ACTIONBAR_SHOWGRID"); --...
Misc:RegisterEvent("ACTIONBAR_HIDEGRID"); --...
Misc:RegisterEvent("BAG_UPDATE"); --Refresh the bag item index cache
Misc:RegisterEvent("UNIT_INVENTORY_CHANGED"); --Refresh the inv (equipped) item index cache
--Misc:RegisterEvent("SPELL_FLYOUT_UPDATE"); --Refresh the spell_flyouts (mainly due to default blizz code that forces my custom flyout border off)
Misc:RegisterEvent("SPELL_FLYOUT_UPDATE"); --Refresh the spell_flyouts (mainly due to default blizz code that forces my custom flyout border off)
Misc:RegisterEvent("UI_SCALE_CHANGED");
Misc:RegisterEvent("MODIFIER_STATE_CHANGED");
Misc:RegisterEvent("ZONE_CHANGED");
Misc:RegisterEvent("ZONE_CHANGED_INDOORS");
Misc:RegisterEvent("ZONE_CHANGED_NEW_AREA");
@ -101,14 +107,18 @@ Misc:RegisterEvent("MODIFIER_STATE_CHANGED");
--------------------------------------------------------------------------]]
Checked:RegisterEvent("TRADE_SKILL_SHOW");
Checked:RegisterEvent("TRADE_SKILL_CLOSE");
Checked:RegisterEvent("ARCHAEOLOGY_TOGGLE");
Checked:RegisterEvent("ARCHAEOLOGY_CLOSED");
Checked:RegisterEvent("COMPANION_UPDATE");
Checked:RegisterEvent("PET_BATTLE_PET_CHANGED");
Checked:RegisterEvent("CURRENT_SPELL_CAST_CHANGED");
Checked:RegisterEvent("ACTIONBAR_UPDATE_STATE"); --I am not certain how excessive this event is yet, it may not be needed and is a canidate to remove
Checked:RegisterEvent("PLAYER_ENTER_COMBAT");
Checked:RegisterEvent("PLAYER_LEAVE_COMBAT");
Checked:RegisterEvent("START_AUTOREPEAT_SPELL");
Checked:RegisterEvent("STOP_AUTOREPEAT_SPELL");
--Checked:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR");
--Checked:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR");
Checked:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR");
Checked:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR");
Checked:RegisterEvent("ACTIONBAR_PAGE_CHANGED");
--[[------------------------------------------------------------------------
@ -125,10 +135,10 @@ Usable:RegisterEvent("PLAYER_CONTROL_LOST");
Usable:RegisterEvent("PLAYER_CONTROL_GAINED");
Usable:RegisterEvent("BAG_UPDATE");
Usable:RegisterEvent("MINIMAP_UPDATE_ZOOM");
--Usable:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR");
--Usable:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR");
Usable:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR");
Usable:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR");
Usable:RegisterEvent("ACTIONBAR_UPDATE_USABLE"); --Use this as a backup...
--Usable:RegisterEvent("VEHICLE_UPDATE");
Usable:RegisterEvent("VEHICLE_UPDATE");
Usable:RegisterEvent("ACTIONBAR_PAGE_CHANGED");
--BFA fix: UPDATE_WORLD_STATES is deprecated
-- Usable:RegisterEvent("UPDATE_WORLD_STATES");
@ -155,8 +165,8 @@ Text:RegisterEvent("UNIT_AURA");
--[[------------------------------------------------------------------------
Glow Events
--------------------------------------------------------------------------]]
--Glow:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW");
--Glow:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_HIDE");
Glow:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_SHOW");
Glow:RegisterEvent("SPELL_ACTIVATION_OVERLAY_GLOW_HIDE");
--[[------------------------------------------------------------------------
@ -180,21 +190,21 @@ Flash:RegisterEvent("STOP_AUTOREPEAT_SPELL");
--------------------------------------------------------------------------]]
Conditional:RegisterEvent("MODIFIER_STATE_CHANGED"); --mod:
Conditional:RegisterEvent("PLAYER_TARGET_CHANGED"); --harm, help, etc
--Conditional:RegisterEvent("PLAYER_FOCUS_CHANGED"); --harm, help, etc
Conditional:RegisterEvent("PLAYER_FOCUS_CHANGED"); --harm, help, etc
Conditional:RegisterEvent("ACTIONBAR_PAGE_CHANGED"); --actionbar
--Conditional:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR");
--Conditional:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR");
Conditional:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR");
Conditional:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR");
Conditional:RegisterEvent("PLAYER_REGEN_ENABLED"); --nocombat
Conditional:RegisterEvent("PLAYER_REGEN_DISABLED"); --combat
Conditional:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START"); --channel:
Conditional:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP"); --channel:
Conditional:RegisterEvent("PLAYER_EQUIPMENT_CHANGED"); --equipped:
--Conditional:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED"); --spec:
Conditional:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED"); --spec:
Conditional:RegisterEvent("UPDATE_SHAPESHIFT_COOLDOWN"); --stance/form:
Conditional:RegisterEvent("UPDATE_SHAPESHIFT_FORM"); --stance/form:
Conditional:RegisterEvent("UPDATE_STEALTH"); --stealth
--Conditional:RegisterEvent("UNIT_ENTERED_VEHICLE"); --vehicleui
--Conditional:RegisterEvent("UNIT_EXITED_VEHICLE"); --vehicleui
Conditional:RegisterEvent("UNIT_ENTERED_VEHICLE"); --vehicleui
Conditional:RegisterEvent("UNIT_EXITED_VEHICLE"); --vehicleui
Conditional:RegisterEvent("MINIMAP_UPDATE_ZOOM"); --indoors/outdoors
Conditional:RegisterEvent("ACTIONBAR_SLOT_CHANGED"); --This event is excessive, the system is designed not to need it; although at times it may provide slightly (very slightly) faster macro refreshes
@ -211,6 +221,7 @@ Conditional:RegisterEvent("ACTIONBAR_SLOT_CHANGED"); --This event is excessive,
Full Events (includes init events)
---------------------------------------------------------------------------]]
Full:RegisterEvent("PLAYER_ENTERING_WORLD"); --Both Full Refresh, and also Spell/Companion cache (definte spell, possibly companion)
Full:RegisterEvent("COMPANION_UPDATE"); --Cache companion (possibly... not used here after init)
Full:RegisterEvent("VARIABLES_LOADED"); --Macros are available
Full:RegisterEvent("ADDON_LOADED"); --Saved info is available
@ -223,12 +234,10 @@ STOP_AUTOREPEAT_SPELL
--]]
function Full:InitialOnEvent(Event, Arg1)
if (Event == "ADDON_LOADED" and Arg1 == "ButtonForge") then
self.AddonLoaded = true; --Before setting up is complete we also need to have spell, and macro data available
self.AddonLoaded = true; --Before setting up is complete we also need to have companion, spell, and macro data available
elseif (Event == "PLAYER_ENTERING_WORLD") then
Util.CacheSpellBookRanks() -- TBC Fix 2021/06/17
Util.CacheCompanions();
Util.CacheSpellIndexes();
Util.CachePetSpellIndexes();
@ -239,9 +248,12 @@ function Full:InitialOnEvent(Event, Arg1)
elseif (Event == "VARIABLES_LOADED") then
self.MacrosLoaded = true;
elseif (Event == "COMPANION_UPDATE") then
Util.CacheCompanions(); --Just while we are starting up we are trying to cache companion info... there is no reliable event to let us know when this is possible - it could be this overloaded event or none at all?!?
end
if (self.AddonLoaded and self.MacrosLoaded and self.SpellsCached) then
if (Util.CompanionsCached and self.AddonLoaded and self.MacrosLoaded and self.SpellsCached) then
self:SetScript("OnEvent", nil); --Swap to our standard event processor
if (LibStub) then
Util.LBF = LibStub("Masque", true);
@ -261,6 +273,7 @@ function Full:InitialOnEvent(Event, Arg1)
--self:SetScript("OnUpdate", self.OnUpdate);
self:UnregisterEvent("COMPANION_UPDATE");
end
end
@ -436,6 +449,9 @@ function Misc:OnEvent(Event, ...)
elseif (Event == "UNIT_INVENTORY_CHANGED") then
Util.CacheInvItems();
elseif (Event == "PET_JOURNAL_LIST_UPDATE") then
Util.RefreshBattlePets();
elseif (Event == "SPELL_FLYOUT_UPDATE") then
Full.RefreshButtons = true;
Full.RefFlyouts = true;
@ -450,18 +466,18 @@ function Misc:OnEvent(Event, ...)
self.RefreshSpells = true;
self:SetScript("OnUpdate", self.OnUpdate);
-- elseif (Event =="ACTIVE_TALENT_GROUP_CHANGED") then
elseif (Event =="ACTIVE_TALENT_GROUP_CHANGED") then
--Set the talentswap flag so we know not to auto promote any spells
-- self.RefreshSpells = true;
-- self.TalentSwap = true;
-- self:SetScript("OnUpdate", self.OnUpdate);
self.RefreshSpells = true;
self.TalentSwap = true;
self:SetScript("OnUpdate", self.OnUpdate);
-- elseif (Event == "COMPANION_LEARNED") then
-- Util.CacheCompanions();
-- Util.RefreshCompanions();
elseif (Event == "COMPANION_LEARNED") then
Util.CacheCompanions();
Util.RefreshCompanions();
-- elseif (Event == "EQUIPMENT_SETS_CHANGED") then
-- Util.RefreshEquipmentSets();
elseif (Event == "EQUIPMENT_SETS_CHANGED") then
Util.RefreshEquipmentSets();
elseif (Event == "PLAYER_REGEN_DISABLED") then
Util.PreCombatStateUpdate();
@ -475,6 +491,10 @@ function Misc:OnEvent(Event, ...)
elseif (Event == "EDITBOX_MESSAGE") then
self.EditBoxMessage, self.EditBox = ...;
self:SetScript("OnUpdate", self.OnUpdate);
elseif (Event == "ZONE_CHANGED" or Event == "ZONE_CHANGED_INDOORS" or Event == "ZONE_CHANGED_NEW_AREA") then
Util.RefreshZoneAbility();
end
end
function Misc:OnUpdate(Elapsed)

Voir le fichier

@ -42,7 +42,7 @@
</Scripts>
</Frame>
<Frame name="BFBindingDialog" parent="UIParent" hidden="true" clampedtoscreen="true" enablemouse="true" movable="true" frameStrata="FULLSCREEN_DIALOG">
<Frame name="BFBindingDialog" parent="UIParent" hidden="true" clampedtoscreen="true" enablemouse="true" movable="true" frameStrata="FULLSCREEN_DIALOG" inherits="BackdropTemplate">
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508883-59c2-4f83-ae10-27aaad48391b" />-->
<Size>
<AbsDimension x="341" y="137" />

Voir le fichier

@ -95,22 +95,23 @@ Locale["SlashHelpFormatted"] =
"|c"..Const.LightBlue.."-scale <size>|r (1 is normal scale)\n"..
"|c"..Const.LightBlue.."-gap <size>|r (6 is normal gap)\n"..
"|c"..Const.LightBlue.."-coords <left> <top>|r\n"..
"|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.."-tooltips <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-emptybuttons <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-lockbuttons <on/off/toggle>|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"..
"|c"..Const.LightBlue.."-hidespec2 <on/off>|r\n"..
"|c"..Const.LightBlue.."-hidespec3 <on/off>|r\n"..
"|c"..Const.LightBlue.."-hidespec4 <on/off>|r\n"..
"|c"..Const.LightBlue.."-hidevehicle <on/off>|r\n"..
"|c"..Const.LightBlue.."-hideoverridebar <on/off>|r\n"..
"|c"..Const.LightBlue.."-macrotext <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-keybindtext <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-hidespec1 <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-hidespec2 <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-hidespec3 <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-hidespec4 <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-hidevehicle <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-hideoverridebar <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-hidepetbattle <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-vismacro <visibility macro>|r\n"..
"|c"..Const.LightBlue.."-gui <on/off>|r (off = hides bar without disabling keybinds)\n"..
"|c"..Const.LightBlue.."-gui <on/off/toggle>|r (off = hides bar without disabling keybinds)\n"..
"|c"..Const.LightBlue.."-alpha <opacity>|r (0 - 1, 1 is completely opaque)\n"..
"|c"..Const.LightBlue.."-enabled <on/off>|r\n"..
"|c"..Const.LightBlue.."-enabled <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-info|r\n"..
"|c"..Const.LightBlue.."-technicalinfo|r\n"..
"|c"..Const.LightBlue.."-createbar <bar name>|r\n"..
@ -122,9 +123,9 @@ Locale["SlashHelpFormatted"] =
"|c"..Const.LightBlue.."-deleteprofile <profile name>|r\n"..
"|c"..Const.LightBlue.."-listprofiles|r\n"..
"|c"..Const.LightBlue.."-macrocheckdelay <number>|r (5 seconds is default) \n"..
"|c"..Const.LightBlue.."-removemissingmacros <on/off>|r\n"..
"|c"..Const.LightBlue.."-forceoffcastonkeydown <on/off>|r (will apply at next login)\n"..
"|c"..Const.LightBlue.."-usecollectionsfavoritemountbutton <on/off>|r\n"..
"|c"..Const.LightBlue.."-removemissingmacros <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-forceoffcastonkeydown <on/off/toggle>|r (will apply at next login)\n"..
"|c"..Const.LightBlue.."-usecollectionsfavoritemountbutton <on/off/toggle>|r\n"..
"|c"..Const.LightBlue.."-globalsettings|r\n"..
"Examples:\n"..
"|c"..Const.LightBlue.."/bufo -bar Mounts -tooltips off -emptybuttons off -scale 0.75|r\n"..
@ -194,6 +195,7 @@ Locale["InfoHSpec3"] = "Visibility for Spec 3";
Locale["InfoHSpec4"] = "Visibility for Spec 4";
Locale["InfoHVehicle"] = "Visibility in Vehicle";
Locale["InfoHBonusBar5"] = "Visibility when Override Bar active";
Locale["InfoHPetBattle"] = "Visibility when in a Pet Battle";
Locale["InfoVisibilityMacro"] = "Visibility Macro";
Locale["InfoGUI"] = "GUI";
Locale["InfoAlpha"] = "Alpha";

Voir le fichier

@ -98,6 +98,7 @@ Locale["SlashHelpFormatted"] =
"|c"..Const.LightBlue.."-hidespec4 <on/off>|r\n"..
"|c"..Const.LightBlue.."-hidevehicle <on/off>|r\n"..
"|c"..Const.LightBlue.."-hideoverridebar <on/off>|r\n"..
"|c"..Const.LightBlue.."-hidepetbattle <on/off>|r\n"..
"|c"..Const.LightBlue.."-vismacro <visibility macro>|r\n"..
"|c"..Const.LightBlue.."-gui <on/off>|r (off = hides bar without disabling keybinds)\n"..
"|c"..Const.LightBlue.."-alpha <opacity>|r (0 - 1, 1 is completely opaque)\n"..

Voir le fichier

@ -100,6 +100,7 @@ Locale["SlashHelpFormatted"] =
"|c"..Const.LightBlue.."-hidespec4 <on/off>|r\n"..
"|c"..Const.LightBlue.."-hidevehicle <on/off>|r\n"..
"|c"..Const.LightBlue.."-hideoverridebar <on/off>|r\n"..
"|c"..Const.LightBlue.."-hidepetbattle <on/off>|r\n"..
"|c"..Const.LightBlue.."-vismacro <visibility macro>|r\n"..
"|c"..Const.LightBlue.."-gui <on/off>|r (off = hides bar without disabling keybinds)\n"..
"|c"..Const.LightBlue.."-alpha <opacity>|r (0 - 1, 1 is completely opaque)\n"..

206
README.md
Voir le fichier

@ -1,206 +0,0 @@
# ButtonForge-classic
Unofficial fork of ButtonForge addon for World of Warcraft classic.
![Featured Image](screenshot.jpg)
## Overview
Button Forge is an Action Bar addon that allows you to create completely new Action Bars (as many as you want). Each bar can have up to 1500 buttons organised into rows and columns (up to 5000 buttons total).
Your existing UI wont be changed by Button Forge, it will continue to function and look how it currently does. The bars you create are totally independent allowing you to simply and cleanly add additional action bars to your UI.
The new buttons operate almost identically to the default action buttons (i.e. drag and drop actions as you normally would, etc); there are a few subtle differences though, such as the ability to drop non usable items into the buttons (handy for keeping count of items you're harvesting).
Creation and configuration of the bars is done via the mouse using a GUI interface. This GUI is designed to be straight forward and easy to use, although there is documentation for both basic and advanced configuration options below.
## Features
* Create as many bars as you wish (theoretical limit is 5000)
* Create as many buttons as you wish (up to 1500 per bar with a total maximum of 5000)
* Fully graphical configuration
* Key Bindings
* Drag and drop actions to buttons (spells, items, macros, companions, equipment sets, Button Forge commands)
* Set the scale of the Bars
* Control how many rows and columns of buttons are on a bar
* Setup visibility macros for your bars so that they can be shown and hidden (even during combat)
* Button Facade Support
## How Do I (Basics)
#### Enter into configuration mode
Configuration mode is where you will do things such as create new bars and buttons, position them, etc...
There are several ways, any of the following can be used:
* Enter the Button Forge page in Interface->Addons and use the button found there
* Create a Key Binding in the Key Bindings menu under the Button Forge section
* Drag the Configuration Mode button found on the Button Forge toolbar onto a Button Forge bar, it can then be used to quickly enter and exit configuration mode (recommended)
#### Exit configuration mode
All of the ways to activate config mode will also deactivate it
#### Create a bar
Click the Create Bar button, then click on screen where you want your new bar
#### Destroy a bar
Click the Destroy Bar button, then click on the bar you wish to destroy
#### Add or remove rows and columns of buttons on a bar
Use the Column and Row drag icons on the bar to adjust how many rows and columns of buttons there are
#### Change the scale of a bar
Use the Scale icon on the bar to adjust the size of the buttons
#### Position the bar
Click on the bar background and drag it to the desired location
#### Make the bar only visible for a given talent spec
Use the Spec 1/2 Buttons found on the left side of the bar (a faded icon means it wont be displayed for that talent spec)
#### Make the bar visible when in a vehicle
By default bars are invisible while in a vehicle, use the vehicle button found on the left side of the bar to change this (a faded icon means it wont be displayed while in a vehicle)
## How Do I (Advanced)
#### Enable advanced configuration controls for the bars
Click the advanced tools button on the Button Forge toolbar to toggle the display of the advanced options
#### Set key bindings for the buttons
Click the keyboard icon on the bar to enter Key Bind mode
Click the button you wish to set a binding for
On the binding dialog that has popped up click the key binding button (similar to the standard Key Binding UI)
Press the key binding you want to assign
The dialog can be closed by clicking the x this will close the dialog but leave the bar in Key Bind mode, or press esc to completely #### exit Key Bind mode
Notes:
* Key Bindings in Button Forge are implemented as overrides, this means that any existing bindings wont be removed, but if identical the override will be triggered instead (at least provided the bar is visible on screen)
* Button Forge currently wont inform you if the binding already exists on another Button Forge button and it will allow multiple bars to have the same binding, this feature allows some advance ui configurations to be created which will be described further down
* If multiple Button Forge bars have the same key binding it will be ambiguous which button will be triggered, however if only one bar is currently visible that is the button that will be triggered
* The Button Forge UI for Key Bindings may see some alteration in v1 (I feel the flow of creating bindings is not yet as smooth as it could be)
#### Make a bar only visible while in combat... or out of combat, or while stealthed, cat form, etc...
Any macro conditional in the game can potentially also be used to control if a Button Forge bar is hidden or visible (even during combat)
To setup a visibility macro click the Eye icon and type in the conditional and then press enter (or escape to cancel)... Some basic examples are:
* [combat] hide; show
* [stealth, harm] show; hide
* [form:3] show; hide
Notes:
* Visibility macros are more commonly known as visibility state drivers (I just call them visibility macros to draw attention to the fact that you use macro conditionals to control the visibility)
* The Spec and Vehicle show/hide options (the ones just above the eye icon) also use the visibility macro to control when the bar is displayed. If you specify a visibility conditional and also have one or more of the Spec/Vehicle options set to hide then _behind the scenes_ the necessary rules will be prepended to your visibility macro for the bar... e.g:
* Spec 1 is hidden, and Vehicle is hidden, no visibility macro is set would result in the following state driver: [spec:1] hide; [vehicleui] hide; show
* Vehicle hidden, and the combat macro example from above is set would result in the following state driver: [spec:1] hide; [vehicleui] hide; [combat] hide; show
* Spec 1/2 both shown, Vehicle shown and no visibility macro set: ...No visibility driver will be set for the bar, and it will always be visible
#### Make the actions on a bar change depending on combat status, or while stealthed, or cat form, etc...
This actually can't be done, but the same effect can be achieved by taking visibility macros a step further.
You can place several bars into the same position on screen and setup visibility macros so that only 1 is displayed at any given time, I will describe the following example to illustrate how to do this.
Lets say you are a druid and want a bar in the center of the screen to have actions for catform and bearform in the same position, and to swap between them depending on your current form:
Create a bar and position it where you want, set it's scale and the number of buttons you want on it
Optionally add a label to it to help identify it easier in the interface (lets make this one the bear bar)
Drag the abilities you want on to it
Set the visibility macro to [bonusbar:3] show; hide
Create another bar place it in the same position as the first one... You might notice that it has docking to make this really easy
Double click the scale button to default the bar to have the same scale as the first bar (double click again will revert back to the standard scale of 1)
Optionally label the bar (for cat form this time)
Drag the abilities you want to it
Set the visibility macro to [bonusbar:1] show; hide
Exit configuration mode and give it a try
If you also wanted to setup key bindings you could do this as well since you can reuse bindings. The buttons in each position on the two bars can have the same binding since only one bar will show up at a time (if at all). Also note that if you want to alternate between which bar you are working on during configuration mode you can use the Send to Front and Send to Back icons so you don't have to move bars out of the way.
#### Make tabs for bars so that it is easier to configure bars located in the same place on screen
Set a label for the bar and position the top left corner of the bar be the same as another bars. Each bar that has a label set will have that label organised from left to right above the bars. Clicking the respective tab (label) will bring that bar to the top.
Note: Even without a tab for the bar you can still bring it to the front or send it to the back by clicking on it's Send To Front and Senf To Back buttons respectively.
#### Create a bonus bar (contains the abilities when you enter a vehicle, possess another unit, or the special abilities given during specific fights)
This can be done using the Create Bonus Bar button. Note that the standard Bonus Bar will continue to function as normal so creating a Button Forge bonus bar is purely optional.
Notes:
* The Button Forge bonus bar is a clone of Bonus Bar 5; that is the action bar that receives special actions at certain times during game play (e.g. the actions you can use in a vehicle, or while possessing another unit, etc)
* It is possible to create multiple BF bonus bars
* The BF Bonus Bar is almost identical to a standard BF Bar except for the following:
* It is green in configuration mode
* By default standard BF bars will hide when BonusBar 5 is active, whereas by default BF bonus bars will display (handled via the visibility macro)
* Several of the default settings for the BF bonus bar are different to the standard BF bars
* It starts populated with Bonus Actions 1 - 12, leave vehicle, and cancel possession
* Whenever the Bonus Bar has the number of cols or rows updated it will attempt to replace any missing bonus actions if they have been removed from the bar (this makes it easy to change from a horizontal to vertical bar)
* All the actions found on the Button Forge bonus bar can be dragged into different positions, and also onto other BF bars (by default the Bonus Bar has the buttons locked, so this would need to be changed first)
* Changing around the actions on a BF bonus bar will have no effect on the normal Bonus Bar
#### Enable Right Click Self Cast
This can be done using the Right Click Self Cast button.
#### Some slash commands
`/bufo saveprofile <profile name>`
`/bufo loadprofile <profile name>`
`/bufo loadprofiletemplate <profile name>` (load the bar layout but not the actions on the buttons)
`/bufo undoprofile` (reverts to how things were before you ran loadprofile)
`/bufo deleteprofile <profile name>`
`/bufo listprofiles`
## F.A.Q
You may have some questions not covered above, I will try to address those here.
#### Why do all bars and buttons show up in configuration mode even when some are configured not to show up currently?
This is done so that you always can configure a bar even if it has a rule set to prevent it from being visible. This also means you can assign actions to bars that you otherwise wouldn't be able to without having to temporarily unset their visibility macro etc...
#### Why do certain bars/buttons hide in configuration mode when I enter combat?
This happens because sometimes combat may happen when you least expect it. So that you don't have a messy UI which could make it very hard for you to respond to the threat, the Bars and buttons will obey their display rules when in combat regardless of if you are in configuration mode or not.
#### Why does my key combination trigger some strange action when in configuration mode?
If you have the same key binding for multiple buttons it could be triggering any of them... and most likely not the one you intend! This is because while in configuration mode all buttons are visible and so it is ambigous which key binding to use, while this is annoying (it even trips me up sometimes) it will correct itself once you exit configuration mode (or enter combat).
#### Why does my key combination trigger some strange action when not in configuration mode?
This will most likely be because you have used the same key binding for multiple buttons and those buttons are visible at the same time, in such a case you will need to either choose a different binding, or configure the display rules for the bars such that only one of the buttons is visible at a time (please note that even if empty buttons are hidden, the key binding will still apply... it is only when the bar itself is configured to hide that the binding wont apply).
#### Why can't I allocated more buttons to my bar?
Several configuration options wont work while in combat. Or alternatively you may have hit the upper limit for the number of buttons on the bar (currently 1500), or the total number of allowed buttons may be exceeded (currently 5000).
#### Why can't I set the scale?
Several configuration options wont work while in combat. Or alternatively the desired scale may cause the bar to exceed the size of the screen in which case the scale will be rejected.
#### I've setup bars for my different druid forms but when switching between them the bars dissappear briefly?!
This is because the visibility rules are treated exactly and there may be a brief swap over period where none of the conditionals are true.
E.g. If you were using [form:1] show; hide for Bear, and [form:3] show; hide for cat to show the bar, when you switch between cat and bear form there is actually a brief period where you are neither of those forms and so neither of those bars will show.
To get around this issue use the [bonusbar:#] conditional in place of the form conditional. It responds to shapeshift changes etc but will keep the bar available the same length of time the default ui keeps it available. (this could also apply to other classes and conditionals where the bonusbar may be a slightly better choice)
#### Why doesn't my bar have a tab?
Either the bar has not been assigned a label, or its the only bar with its Top Left corner in that position... If you wish for the bar to have a tab either assign it a label and/or align its top left corner to another bars top left corner (auto docking will take care of this when dragging the bar close to another... except in the case mentioned next)
#### Why aren't my bars auto-docking?
This is most likely because you are in combat, it is not possible to autodock in this case unfortunately... Note also that auto docking will only take place when the top left corner of two bars get fairly close to each other.
#### Bonus Actions are appearing on my Bonus Bar when I change the number of rows/cols, why?
This is intentional so that changing the orientation of the bar is easy... Note that having multiple rows and columns could sometimes result in the abilities being repopulated into locations which might seem strange, this is due to the specific rules of how the bonus actions are repopulated (always remember an action wont be populated back onto the bar if it is already there, and also that button positions are always counted from left to right, top to bottom).
#### Why can I sometimes trigger actions on the BF bonus bar even when Bonus Bar 5 is not active (and I'm seeing the blue Bonus Action number icons)
This is because sometimes the bonus actions assigned remain available even after the bonus bar is gone (e.g. Mind of the Beast), I believe this is the case when it is for actions you could trigger anyway (e.g. if a hunter possesses his pet, even after the possession ends all the pets actions are still available and valid).
The default (and recommended) behaviour is for the bonus bar to be hidden when not available.
#### There are no raise and lower aim commands on the Bonus Bar even while in a vehicle that supports them
This is because the action that the standard raise and lower buttons have (which is raise/lower while held down) cannot be duplicated by an addon; instead the the aim can only be raised/lowered in increments. For this first release of BF with Bonus Bar support I have decided to not create buttons to do this... (If people request it I can look to introduce it however).
Note that using mouse look to raise lower will work as normal, as will the standard raise and lower buttons.

281
ReadMe.txt Fichier normal
Voir le fichier

@ -0,0 +1,281 @@
Button Forge
Mod for World of Warcraft
Author: Massiner of Nathrezim
Contributor: xfsbill
Past Contributors: DT85, DandierSphinx
Version: 1.0.4
Description: Graphically create as many Action Bars and Buttons in the game as you choose
Usage:
- From the Button Forge Toolbar click the various buttons to enter into create/destroy bar mode
- Advanced options will display additional advanced options for each Bar created (such as key bindings)
- Drag the bars where you wish them to be placed
- When you are happy with your layout close the Button Forge Toolbar to hide the configuration gui either via the Key Binding, the Addon Configuration page, or the Red X on the Toolbar
- It is also possible to drag commands from the Button Forge Toolbar onto Button Forge bars, this is advisable for the Button Forge Configuration button
- Pretty much all of the gui configuration options are available via /bufo or /buttonforge commands (type them without any parameters for a listing of options). In addition there are several advanced
options only available via the / commands.
Restrictions:
- Most (but not all) configuration options will not function during combat
History:
09-March-2021 v1.0.4 - Updated for Wow v9.0.5
- Updated help (/bufo)
- Fixed an issue disabling/enabling button frames
28-Jan-2021 v1.0.3 - Replaced Stealth and Prowl with their proper stealth icon
- Experimental: Configurable flyout direction through slash commands
02-Dec-2020 v1.0.2 - Removed Zone Ability frame when placed into a bar
- Added slash commands to list bars and allow to interact with bars without a label
- Reintroduced clamping bars to the screen (a feature that was disabled all the way back in 2015)
- Added keybind support for gamepads
23-Nov-2020 v1.0.1 - Fixed an issue opening/closing some tradeskills window
19-Nov-2020 v1 - Updated for Wow v9.0 - This update is provided by xfsbill , jee_dae (possibly others ?) - thanks for keeping a version of the addon working all this time!
26-July-2018 v0.9.50 - Updated for Wow v8.0 - this update is provided by DT85 (Zaranias - Aman'thul) & DandierSphinx... A big thanks for this!!!
- The below issues all prevented Button Forge functioning correctly or in some cases at all
- Corrected issue with removed UPDATE_WORLD_STATES event
- Corrected audio from Button Forge specific actions (e.g. opening/closing BF BUI)
- Corrected handling of Spells
- Corrected detection of when the Wisp Spell Icon should display
28-November-2016 v0.9.47 - Updated for WoW v7.1
04-October-2016 v0.9.46 - Fixed Icon display for Equipment Sets... Again! (also some corrections for talents etc which were actually added in .45 I believe?!, my book keeping on this one has been a bit iffy :S)
09-August-2016 v0.9.45 - Fixed Icon display for Equipment Sets on Button Forge
01-August-2016 v0.9.44 - Fixed problem causing talent abilities to show up as '?'
- Fixed BF load error affecting some players that utilise the profiles functionality
- Effectively eliminated the few cases that Button Forge uses the /Run command removing the need to enable scripts to run (see notes below)
- Summon Mounts, switched back to using a spell cast
- Summon battlepets, now uses the /summonpet macro command
- Exit vehicle, now uses /leavevehicle macro command
- Cancel Possession, this button has been removed (the BF bonus bar typically does not appear for possession anyway, unless specifically setup to by the player)
- Summon Favorite mount, this is coded to force load the Blizzard Collections addon, and /click the Favorite Mount button
- Added a new global setting for Button Forge "-usecollectionsfavoritemountbutton" with the following behaviour
- set False: Uses a /run command and will need scripts enabled by the player (advantage is it doesn't rely on the Blizzard Collections module so wont force load it)
- set True: Uses a /click of the Favorite Button in the Collections Module, and forces it to load
- On introduction of the setting
- Defaults to False if allow dangerous scripts is already enabled by the player
- Defaults to True if allow dangerous scripts is not enabled by the player
- NOTE: Basically don't worry about this setting unless there is a very specific reason to alter it
25-July-2016 v0.9.43 - Added safety check for the mount to clear it if it's not properly detected
- Fixed macrocheckdelay so that it doesn't cause an error (note this setting is not recommended to alter)
24-July-2016 v0.9.42 - Added support for toggling all specialisations on and off
24-July-2016 v0.9.41 - Updated for WoW v7.0
- Updated how Mounts are handled (Bliz keep tinkering with the API in this area)
01-July-2015 v0.9.40 - Updated for WoW v6.2
- Fixed issue with mounts - as the previous hack is no longer needed, and due to a slight change
with GetCursorInfo became incompatible
- Toys should now show up more correctly on BF bars
- Battlepets should now have Tooltips
- Added zhTW locale that was supplied by Moripi
28-February-2015 v0.9.39 - Updated for WoW v6.1
- Bars will not be clamped to screen in this version; due to clamp offsets becoming broken
this will be reveresed at a later date when the clamp offsets work again
22-October-2014 v0.9.38 - Character settings are backed up to the Global Save for Button Forge
this is to get around a WoW Mac issue preventing some char settings from loading
This change is temporary and will likely be removed once Blizzard correct the issue
- Paladin Mounts can now be triggered from BF Buttons
- The Edge Cooldown effect will now also hide if visibility for BF Bars is off
- A problem was causing Button Forge to often lose Character specific macros from its Buttons
when new macros were created or deleted - this should behave a lot better now
18-October-2014 v0.9.37 - Corrected Cooldown Swipe/Bling when Buttons are partially or fully hidden
- Corrected Priest Holy Word not being addable to Button Forge
- For some people, Button Forge was erroring on login, this should be resolved
16-October-2014 v0.9.36 - Corrected issue preventing ButtonForge loading when Battlepets were present (Battlepets use a new ID system and needed to be cleared)
- Added migration code to also update data stored in ButtonForge profiles
15-October-2014 v0.9.35 - Corrected issue with Macros that would prevent Button Forge working properly
15-October-2014 v0.9.34 - Another Quick Update to get Button Forge working against v6.0.2 which just went live.
- Mounts will now work
25-August-2014 v0.9.33 - Quick and ROUGH update to get Button Forge functioning against Warlords of Draenor BETA
- Adjusted SetChecked code
- Adjusted Initialization of mount info (note that mounts and probably pets will not work correctly on BF at the moment)
20-November-2013 v0.9.32 - Fixed unrecognised Flyout actions causing an error on when on BF bars (either from loading a profile, or from inherited settings from a prior same named character)
- Also corrected issue that caused flyout actions to not correctly be put on the cursor when removed from BF bars
20-September-2013 v0.9.31 - Added Profile support to Button Forge, only available via Slash commands
* -saveprofile (saves the current setup as a profile for later use)
* -loadprofile (loads a profile, along with all actions on the buttons - this can even be done for diff classes, the actions simply wont be recognised in some cases)
* -loadprofiletemplate (loads a profile but all buttons are blanked, treating the profile as a template for other chars)
* -undoprofile (reverts back to the setup prior to the last loadprofile, even if that was a previous session... note this itself can not be undone, so beware)
* -deleteprofile (simply deletes a previously saved profile)
* -listprofiles
- Also updated to be WoW v5.4 compatible
04-June-2013 v0.9.30 - Button Forge will now cast keybindings on the key down phase in the same manner the standard action buttons do, this behaviour is also toggled using the standard Interface-Combat option "Cast action keybinds on key down"*
- * Added a new global setting for Button Forge "ForceOffCastOnKeyDown" that will override the above feature so that it is always off if desired, you must log back in for this setting to take effect
(When ForceOffCastOnKeyDown is set, it will actually cause the original ButtonForge click handling pre v0.9.30 to apply)
24-May-2013 v0.9.29 - Fixed issue in previous version preventing non-masque users from running Button Forge
23-May-2013 v0.9.28 - Update to work against wow v5.3
- Improved support of Masque skinning
- Slightly update look of Buttons to match with the current style of the standard buttons in wow
06-March-2013 v0.9.27 - Updated to work against wow v5.2 (no code changes)
12-December-2012 v0.9.26 - More support for spell charges (particularly for the warlock demonology spells)
- slash options that accept a yes/no will now also accept toggle
09-December-2012 v0.9.25 - Button Forge will now display spell charges on its buttons when appropriate (this also applies if the spell is from a macro)
- a new slash command -hidepetbattle allows making it so that Button Forge bars can stay visible during a pet battle (by turning that option for the bar off, by default it's on)
02-December-2012 v0.9.24 - Buttonf Forge has been updated for WoW v5.1
- BattlePets have been updated to work with WoW v5.1
17-October-2012 v0.9.23 - BattlePets can now be added to Button Forge bars (tooltips are not yet available for them)
- All Button Forge bars will hide during Pet Battles
09-September-2012 v0.9.22 - Fixed the bonus bar (now the override/vehicle bar) to function again
- Dragging Button Forge custom icons will now no longer show a black box over the icon.
03-September-2012 v0.9.21 - Fixed bars to hide by default when the Override Bar becomes enabled (this used to be BonusBar:5)
28-August-2012 v0.9.20 - Updated for WoW v5.0.4
Issues that were resolved for the updated WoW API:
- Lua errors prevening Button Forge even working
- Cooldown error for mounts and companion pets
- Picking up spells wasn't working
- Handling of dynamic spells was largely unusable
Still outstanding:
- Now that pets are battle pets they can't be set or activated from Button Forge (your existing pets still show up and can be picked up and moved, but that's it)
- Flyout spells (the one with the little arrow) is dropped rather than put on the cursor when removing from Button Forge
- Also a minor graphic glitch that the little arrow sometimes doesn't show for the flyouts
- dragging Button Forge specific actions (e.g. the open Button Forge config button) has a black square
- Some code tidy up to remove redundant code (there are now better options to achieving some functionality)
- Others???
06-February-2012 v0.9.17 - Localisation Support for
deDE Translation provided by Rumorix/PUNK2018
Fixed: Button Forge will now only show the action tooltip for a macro if the macro has the #showtooltip tag in it
Features:
* New bar option 'GUI' available via /bufo commands, defaults to 'on'. Turning the gui off for a bar will cause it to be hidden and to no longer interact with the mouse
but its keybindings will be unaffected (think of it as Key Bind only mode)
The GUI will be temporarily forced 'on' provided you're not in combat, and are in Button Forge config mode, or are holding the Shift key while also have an item on the cursor (this is to ease setting the bar up how you want it)
* New bar option 'Alpha' available via /bufo commands, defaults to 1. This will simply change the opacity of the bar, the mouse will still interact with the bar, even if
it's fully transparent (unlike the new 'GUI' option, the alpha will not be forced up when in config mode etc...)
11-December-2011 v0.9.16 - Updated toc to make Buttonf Forge Compatible with v4.3 of WoW
Fixed:
* Bars would bounce out a little when pushing right up against the left or bottom of the screen if the buttongap had been adjusted; this should no longer happen
* Macros are still causing trouble for some users (hopefully only a small few), this occurs because the WoW API sometimes lags at loging with making the macro info available and simply reports the player has none (with seemingly no way to know if this has occurred; I had thought in the last update I found a reliable event to use). The following two changes have been added in an attempt to provide a lasting solution
a) A 3second delay has now been introduced before ButtonForge prunes missing macros, the setting can be adjusted using /bufo -macrocheckdelay # (where # is the number of seconds), this will delay all macro checks so do not set this value extremely high or it will have unintended consequences (next version I will probably put an upper limit on it!)
b) If a reliable delay time cant be found, use /bufo -removemissingmacros no. That will disable automatic pruning of missing macros, if you delete a macro, you will need to manually remove it from the bar in this scenerio - but it will be preferable to having them possibly dissappear at login
The following change has been made to allow some users familiar with how widgets in the WoW gui work to perform some external specialised customisations
* The frame that controls visibility (not position) of the buttonforge bars buttons will now be given a frame name (relevant for some highly technical players). It works as follows:
- Each bar will have a frame named something like ButtonForgeBar_<BarLabel>_ButtonFrame; where <BarLabel> is the label applied to the bar
- If the full frame name is non unique, a number will be applied after the <BarLabel> to make it unique
- The frame will almost definitely have a visibility macro (Button Forge utilises them quite a bit to avoid possible taint issues), Button Forge (currently) does not parent the ButtonFrame, so it will probably be ok to set this in order to have an external api/addon hide Button Forge bars with its own rules.
- IMPORTANT; You will need to log out and back into the game world for the name of the Frame to be updated (the frame names cant be changed while playing the game)
- For best results, give the bar a unique label if you wish to use the frame
- to get the frame names use /bufo -technicalinfo (the ButtonFrame currently isn't given a size, so you wont have much luck with identifying it spatially)
- Any given usage of the frame is unsupported
19-September-2011 v0.9.15 - Fixed: Macros were sometimes disappearing from Button Forge bars
Feature: Localisation support for zhCN has been added - Translation provided by s.F
23-July-2011 v0.9.14 - Updated toc to make Button Forge compatible with v4.2 of WoW
28-April-2011 v0.9.13 - Features:
* Many more of the configuration options are now available via slash commands
* Added slash command to change the gap between buttons
* Added slash command to disable and enable bars
* Improved the feedback when slash commands are not correctly supplied
* Added a basic API to allow other addons to query information from Button Forge
Fixed:
* Buttons weren't being properly deallocated when a bar was destroyed
* In rare situations item caching in Button Forge was causing an error
16-January-2011 v0.9.12 - Features:
* Slash commands are now available (/buttonforge or /bufo)
* Slash commands include abiltity to turn off keybind and macro name plates
* Holding shift will override button locks (same as the default UI)
* Holding shift will bring Button Forge bars to the top if holding an item with the cursor
Fixed:
* Macros can now have the same name (although this is still not advised!)
* Macro tracking will be a little more resilient (this affects when macros are changed). NB, this can never be perfect with the way the game currently works
* Auto-alignement could sometimes have a lua error if other mods changed the default bars, this should not happen now
* Spells with the same name would sometimes display as though they were the other spell, this should now be resolved
03-January-2011 v0.9.11 - Features:
* Button Forge Buttons will come to the foreground when the mouse
has a placeable action (except items) to make placing spells easier
* Key-binding has been tweaked to be more streamlined
* While dragging bars, auto-alignment will now work off all sides of the bar
and also provide guide lines
- Fixed:
* Better detection of shapeshift has been added (this allows icons for
macros with forms rules to visually update a bit more quickly in some cases)
* Archaeology Buttons will now check and uncheck correctly
22-Decembet-2010 v0.9.10 - Feature:
Localisation support for
koKR Translation provided by chkid (주시자의눈 of Elune)
ruRU Translation provided by Another
- Fixed:
ButtonFacade keybindings will not dissappear now
Improved how wisp spell detection works (made it independant of localisation)
13-December-2010 v0.9.9 - Fixed: Corrected issue preventing binding of mouse buttons (note that the left and right button cannot be bound ever).
- Feature: Button Facade support
18-October-2010 v0.9.8 - Fixed:
Putting Companions and Mounts on the Bar was bugged, this has been fixed (any companions or mounts that are permanently highlighted should be removed and readded)
17-October-2010 v0.9.7 - Fixed:
Work around the issue of some spells causing an issue when dragged onto the bar (issue was observed with hunter traps)
- Feature:
Support for Flyouts
Support for Glow effect on certain spells
13-October-2010 v0.9.6 - Fixed:
Macros that use items are having a problem with the cooldown display, this has been fixed.
Picking up most items wasn't causing hidden button grids to show (while out of combat), this has also been fixed
12-October-2010 v0.9.5 - Fixed:
Item counts will now show counts for items that use a consumable reagent
Spells will no longer inadvertently change rank (a non issue now that v4 is available anyway)
- Features:
Updated to be compatible with v4.0.1
02-September-2010 v0.9.4 - Fixed:
Creating a macro with an empty body or deleting a macro could sometimes cause visual errors in Button Forge, this has been resolved
Tooltips for companions were dissappearing very quickly after displaying, this has been resolved
26-August-2010 v0.9.3 - Fixed:
Tooltips now refresh while being displayed
In some cases (particularly macros) item display was not updating, this has been resolved
- Features:
Bonus Bars are now supported
A Right Click Self Casting option is now available
10-August-2010 v0.9.2 - Fixed:
Scale - The Double Click default sometimes wouldn't detect the settings of a bar if one was in the same position, this has been resolved
Dragging Custom Actions (Button Forge Configuration options) - These would sometimes drop straight off the cursor, this has been resolved
Key Bind dialog has been shifted to appear above other UI elements (it is also possible to drag this dialog)
- Features:
Updated the GUI appearance
Bar labels will now organise themselves for so they can be clicked to allow tabbing between bars if bars are in the same position
Bar controls will now rearrange themselves to better use the space around the Action buttons
05-August-2010 v0.9.1 - Fixed:
Equipment Sets will now be placed on the cursor when picked up off a Button Forge Bar
Resolved stack overflow when creating excessively large bars (e.g. over 1000 buttons)
Resolved issues causing some newly allocated buttons to be hidden and the bar to sometimes dissappear when allocating buttons
- Features:
Set a limit of 1500 buttons per bar and 5000 buttons total
Added button for configuration mode
Added ability to drag Button Forge Toolbar buttons to Button Forge bars
Updated tooltip information
31-July-2010 v0.9.0 - Beta version of Button Forge

Voir le fichier

@ -2,7 +2,7 @@
<Script file="UILibLayers.lua"/>
<Frame name="BFOverlay" mixin="BackdropTemplateMixin" enablemouse="true" hidden="true" virtual="true">
<Frame name="BFOverlay" enablemouse="true" hidden="true" virtual="true" inherits="BackdropTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="UIParent" relativePoint="TOPLEFT">
<Offset>

Voir le fichier

@ -9,13 +9,11 @@
local UILib = BFUILib;
local Const = BFConst;
local VertLine = CreateFrame("FRAME", nil, UIParent);
Mixin(VertLine, BackdropTemplateMixin)
local VertLine = CreateFrame("FRAME", nil, UIParent, "BackdropTemplate");
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);
Mixin(HorizLine, BackdropTemplateMixin)
local HorizLine = CreateFrame("FRAME", nil, UIParent, "BackdropTemplate");
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,6 +16,7 @@ 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);
@ -39,12 +40,14 @@ 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;
@ -80,12 +83,14 @@ 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

@ -2,7 +2,7 @@
<!--Autogenerated by wowuides, Version=1.0.300.0, Culture=neutral, PublicKeyToken=null-->
<Script file="UILibToolbar.lua"/>
<Frame name="BFToolbar" parent="BFConfigureLayer" enablemouse="true" movable="true">
<Frame name="BFToolbar" parent="BFConfigureLayer" enablemouse="true" movable="true" inherits="BackdropTemplate">
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508883-59c2-4f83-ae10-27aaad48391b" />-->
<KeyValues>
<KeyValue key="backdropInfo" value="BACKDROP_DIALOG_32_32" type="global"/>
@ -25,17 +25,6 @@
</Offset>
</Anchor>
</Anchors>
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11" />
</BackgroundInsets>
<TileSize>
<AbsValue val="32" />
</TileSize>
<EdgeSize>
<AbsValue val="32" />
</EdgeSize>
</Backdrop>
<Layers>
<Layer>
<Texture name="$parentTitleBorder" file="Interface\DialogFrame\UI-DialogBox-Header">
@ -122,6 +111,41 @@
</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>

376
Util.lua
Voir le fichier

@ -82,10 +82,7 @@ local function PickupSpellBookItem(NameRank, Book)
return G_PickupSpellBookItem(NameRank);
end
--Dirty fix for classic, will keep it as is until i know what the hell does HasOverrideActionBar...
function HasOverrideActionBar()
return false;
end
--[[
Make sure that the saved data is kept inline with the version being run
@ -105,15 +102,22 @@ function Util.UpdateSavedData()
------The following section updates the per character saved data------
--Need to allocate save structure
if (not ButtonForgeSave or ButtonForgeSave["Version"] == nil) then
if (not ButtonForgeSave) then
--Swap v0.9.0 / v0.9.1 / v0.9.2 users to the new save structure
ButtonForgeSave = {};
ButtonForgeSave["ConfigureMode"] = true;
ButtonForgeSave["AdvancedMode"] = false;
ButtonForgeSave["RightClickSelfCast"] = false;
ButtonForgeSave["Version"] = Const.Version;
ButtonForgeSave["VersionMinor"] = Const.VersionMinor;
ButtonForgeSave.Bars = {};
if (type(BFSave) == "table" and BFSave["Version"] and BFSave["VersionMinor"] and
BFSave["Version"] == 0.9 and BFSave["VersionMinor"] <= 2) then
--the above test checks if a legitimate ButtonForge BFSave exists before we adopt it to the new table name
ButtonForgeSave = BFSave;
BFSave = nil;
else
ButtonForgeSave = {};
ButtonForgeSave["ConfigureMode"] = true;
ButtonForgeSave["AdvancedMode"] = false;
ButtonForgeSave["RightClickSelfCast"] = false;
ButtonForgeSave["Version"] = Const.Version;
ButtonForgeSave["VersionMinor"] = Const.VersionMinor;
ButtonForgeSave.Bars = {};
end
ButtonForgeSave["AddonName"] = "Button Forge";
end
@ -170,6 +174,9 @@ function Util.UpdateSavedData()
--v0.9.25 update
if (ButtonForgeSave["Version"] == 0.9 and ButtonForgeSave["VersionMinor"] < 25) then
for i = 1, #ButtonForgeSave.Bars do
ButtonForgeSave.Bars[i]["HPetBattle"] = true;
end
ButtonForgeSave["VersionMinor"] = 25;
DEFAULT_CHAT_FRAME:AddMessage(Util.GetLocaleString("UpgradedChatMsg").."v0.9.25", .5, 1, 0, 1);
end
@ -185,9 +192,14 @@ function Util.UpdateSavedData()
-- v0.9.36 update
if (ButtonForgeSave["Version"] == 0.9 and ButtonForgeSave["VersionMinor"] < 36) then
for i = 1, #ButtonForgeSave.Bars do
Util.UpdateBattlePets602(ButtonForgeSave.Bars[i].Buttons);
end
if (ButtonForgeSave.UndoProfileBars ~= nil) then
for i = 1, #ButtonForgeSave.UndoProfileBars do
Util.UpdateMounts602(ButtonForgeSave.UndoProfileBars[i].Buttons);
Util.UpdateBattlePets602(ButtonForgeSave.UndoProfileBars[i].Buttons);
end
end
ButtonForgeSave["VersionMinor"] = 36;
@ -255,7 +267,7 @@ function Util.UpdateSavedData()
-----This section updates the global button forge data (introduced at 0.9.16)
if (not ButtonForgeGlobalSettings) or (ButtonForgeGlobalSettings == nil) or (ButtonForgeGlobalSettings["Version"] == nil) then
if (not ButtonForgeGlobalSettings) then
ButtonForgeGlobalSettings = {};
ButtonForgeGlobalSettings["Version"] = 0.9;
ButtonForgeGlobalSettings["VersionMinor"] = 16;
@ -276,7 +288,7 @@ function Util.UpdateSavedData()
end
--pre v0.9.36 Safety process
if (not ButtonForgeGlobalProfiles) or (ButtonForgeGlobalProfiles == nil) then
if (not ButtonForgeGlobalProfiles) then
ButtonForgeGlobalProfiles = {};
end
@ -285,6 +297,7 @@ function Util.UpdateSavedData()
for k,v in pairs(ButtonForgeGlobalProfiles) do
for i = 1, #v.Bars do
Util.UpdateMounts602(v.Bars[i].Buttons);
Util.UpdateBattlePets602(v.Bars[i].Buttons);
end
end
ButtonForgeGlobalSettings["VersionMinor"] = 36;
@ -363,6 +376,15 @@ function Util.UpdateMounts602(Buttons)
end
end
function Util.UpdateBattlePets602(Buttons)
for j = 1, #Buttons do
if (Buttons[j]["Mode"] == "battlepet") then
Buttons[j]["Mode"] = nil;
Buttons[j]["BattlePetId"] = nil;
end
end
end
function Util.UpdateMounts700(Buttons)
for j = 1, #Buttons do
if (Buttons[j]["Mode"] == "mount") then
@ -716,6 +738,7 @@ function Util.NewBarSave()
Save["HSpec3"] = false;
Save["HSpec4"] = false;
Save["HBonusBar"] = true;
Save["HPetBattle"] = true;
Save["GridAlwaysOn"] = true;
Save["ButtonsLocked"] = false;
Save["TooltipsOn"] = true;
@ -741,9 +764,6 @@ function Util.NewBar(Left, Top, BarSave)
BarSave = Util.NewBarSave();
BarSave["Left"] = Left;
BarSave["Top"] = Top;
if (ButtonForgeSave.Bars == nil) then
ButtonForgeSave.Bars = {};
end;
table.insert(ButtonForgeSave.Bars, BarSave);
PlaySound(177, "Master");
end
@ -781,9 +801,6 @@ function Util.NewBonusBar(Left, Top)
BarSave["VDriver"] = "[overridebar][vehicleui] show; hide";
BarSave["ButtonsLocked"] = true;
BarSave["GridAlwaysOn"] = false;
if (ButtonForgeSave.Bars == nil) then
ButtonForgeSave.Bars = {};
end;
table.insert(ButtonForgeSave.Bars, BarSave);
PlaySound(177, "Master");
return Util.NewBar(Left, Top, BarSave);
@ -1421,6 +1438,10 @@ function Util.ApplySlashCommands(Commands, Bar)
Bar:SetHBonusBar(Commands["-hideoverridebar"][1]);
end
if (Commands["-hidepetbattle"]) then
Bar:SetHPetBattle(Commands["-hidepetbattle"][1]);
end
if (Commands["-vismacro"]) then
Bar:SetVD(Commands["-vismacro"][1]);
end
@ -1459,6 +1480,7 @@ function Util.ApplySlashCommands(Commands, Bar)
Util.GetLocaleString("InfoHSpec4")..": "..select(2, Bar:GetHSpec4()).."\n"..
Util.GetLocaleString("InfoHVehicle")..": "..select(2, Bar:GetHVehicle()).."\n"..
Util.GetLocaleString("InfoHBonusBar5")..": "..select(2, Bar:GetHBonusBar()).."\n"..
Util.GetLocaleString("InfoHPetBattle")..": "..select(2, Bar:GetHPetBattle()).."\n"..
Util.GetLocaleString("InfoVisibilityMacro")..": "..(Bar:GetVD() or "").."\n"..
Util.GetLocaleString("InfoGUI")..": "..select(2, Bar:GetGUI()).."\n"..
Util.GetLocaleString("InfoAlpha")..": "..Bar:GetAlpha().."\n"..
@ -1549,14 +1571,41 @@ end
function Util.SetCursor(Command, Data, Subvalue, Subsubvalue)
ClearCursor();
UILib.StopDraggingIcon();
-- SpellFlyout:Hide();
SpellFlyout:Hide();
if (Command == "spell") then
-- pet spell or not
local name = GetSpellInfo(Subsubvalue);
if ( Util.PetSpellIndex[name] ) then
PickupSpellBookItem(Util.PetSpellIndex[name], BOOKTYPE_PET);
else
PickupSpell(Subsubvalue);
-- Shadowlands Covenants spells seem to be different from standard spell
-- attempt to detect them because PickupSpell won't work with those
skillType, contextualID = GetSpellBookItemInfo(name);
if contextualID ~= nil then
PickupSpell(Subsubvalue);
else
-- scan spellbook and pickupspell by slot id
function findSpell(spellName, bookType)
local i, s;
local found = false;
for i = 1, MAX_SKILLLINE_TABS do
local name, texture, offset, numSpells = GetSpellTabInfo(i);
if (not name) then break; end
for s = offset + 1, offset + numSpells do
local spell, rank = GetSpellBookItemName(s, bookType);
if (spell == spellName) then found = true; end
if (found and spell ~=spellName) then return s-1; end
end
end
if (found) then return s; end
return nil;
end
local bookType = BOOKTYPE_SPELL;
local id = findSpell(name, bookType);
if id ~= nil then
PickupSpellBookItem(id,bookType);
end
end
end;
elseif (Command == "item") then
PickupItem(Data);
@ -1582,7 +1631,7 @@ function Util.SetCursor(Command, Data, Subvalue, Subsubvalue)
page = 14;
end
local Texture = GetActionTexture(Data + ((page - 1) * 12));
if (Texture and (HasOverrideActionBar())) then
if (Texture and (HasOverrideActionBar() or HasVehicleActionBar())) then
UILib.StartDraggingIcon(Texture, 23, 23, "bonusaction", Data);
else
UILib.StartDraggingIcon(Const.ImagesDir.."Bonus"..Data, 23, 23, "bonusaction", Data);
@ -1594,6 +1643,8 @@ function Util.SetCursor(Command, Data, Subvalue, Subsubvalue)
end
elseif (Command == "customaction") then
CustomAction.SetCursor(Data);
elseif (Command == "battlepet") then
C_PetJournal.PickupPet(Data);
end
end
@ -1704,30 +1755,27 @@ function Util.GetSpellId(NameRank)
end
function Util.IsSpellIdTalent(SpellId)
-- local TalentInfoFuncs = {GetTalentInfo, GetPvpTalentInfo};
local TalentInfoFuncs = GetTalentInfo;
local TalentInfoFuncs = {GetTalentInfo, GetPvpTalentInfo};
-- Scan both normal and PvP talents
-- Note rather than assume number of talents, we just scan till the rows and columns till we hit a nil
--for _, TalentInfoFunc in ipairs(TalentInfoFuncs) do
for _, TalentInfoFunc in ipairs(TalentInfoFuncs) do
local r = 1;
local c = 1;
-- local TalentSpellID = select(6, TalentInfoFunc(r, c, 1));
local TalentSpellID = select(6, TalentInfoFuncs(r, c));
while (TalentSpellID <= 0) do
while (TalentSpellID <= 0) do
local TalentSpellID = select(6, TalentInfoFunc(r, c, 1));
while (TalentSpellID) do
while (TalentSpellID) do
if (TalentSpellID == SpellId) then
return true;
end
c = c + 1;
-- TalentSpellID = select(6, TalentInfoFunc(r, c, 1));
TalentSpellID = select(6, TalentInfoFuncs(r, c));
TalentSpellID = select(6, TalentInfoFunc(r, c, 1));
end
r = r + 1;
c = 1;
-- TalentSpellID = select(6, TalentInfoFunc(r, c, 1));
TalentSpellID = select(6, TalentInfoFunc(r, c, 1));
end
--end
end
return false;
end
@ -1746,8 +1794,8 @@ function Util.CacheSpellIndexes()
for i = total, 1, -1 do
ItemType, Id = GetSpellBookItemInfo(i, BOOKTYPE_SPELL);
-- local Name, Rank, Icon, castTime, minRange, maxRange, spellId = GetSpellInfo(i, BOOKTYPE_SPELL);
local Name, Rank, Icon, castTime, minRange, maxRange, spellId = Util.GetSpellInfo(Id); -- TBC Fix 2021/06/18
--local Name, Rank, Icon, PowerCost, IsFunnel, PowerType = GetSpellInfo(i, BOOKTYPE_SPELL);
local Name, Rank, Icon, PowerCost, IsFunnel, PowerType = GetSpellInfo(Id);
local NameRank = Util.GetFullSpellName(Name, Rank);
if (ItemType == "SPELL") then
NewSI[NameRank] = i;
@ -1856,9 +1904,34 @@ function Util.RefreshSpells()
end
end
function Util.RefreshBattlePets()
for k, v in pairs(Util.ActiveButtons) do
v:RefreshBattlePet();
end
end
function Util.RefreshZoneAbility()
local zoneAbilities = C_ZoneAbility.GetActiveAbilities();
local found = 0;
for i, zoneAbility in ipairs(zoneAbilities) do
for j, spell in ipairs(Util.ActiveSpells) do
if ( zoneAbility.spellID == spell.SpellId ) then
found = found + 1;
break;
end
end
end
if (found == table.getn(zoneAbilities)) then
ZoneAbilityFrame:SetShown(false);
else
ZoneAbilityFrame:SetShown(true);
end
end
function Util.AddSpell(Value)
if (not Util.FindInTable(Util.ActiveSpells, Value)) then
table.insert(Util.ActiveSpells, Value);
Util.RefreshZoneAbility();
end
end
@ -1866,6 +1939,7 @@ function Util.RemoveSpell(Value)
local Index = Util.FindInTable(Util.ActiveSpells, Value);
if (Index) then
table.remove(Util.ActiveSpells, Index);
Util.RefreshZoneAbility();
end
end
@ -1889,7 +1963,6 @@ function Util.CacheCompanions()
end]]
Util.Mounts = {};
--[[
for i, mountID in pairs(C_MountJournal.GetMountIDs()) do
local creatureName, spellID = C_MountJournal.GetMountInfoByID(mountID);
if (not creatureName) then
@ -1897,7 +1970,7 @@ function Util.CacheCompanions()
end
Util.Mounts[spellID] = mountID;
end
Util.CompanionsCached = true;]]
Util.CompanionsCached = true;
end
function Util.LookupCompanion(Name)
@ -2374,6 +2447,8 @@ function Util.GetButtonActionInfo(ButtonName)
return "equipmentset", Button.EquipmentSetName;
elseif (Button.Mode == "flyout") then
return "flyout", Button.FlyoutId;
elseif (Button.Mode == "battlepet") then
return "battlepet", Button.BattlePetId;
end
end
@ -2397,9 +2472,7 @@ function Util.GetButtonActionInfo2(ButtonName)
--]]
if (Button.Mode == "spell") then
-- local Rank = select(2, GetSpellInfo(Button.SpellId));
local Rank = select(2, Util.GetSpellInfo(Button.SpellId)); -- TBC Fix 2021/06/18
local Rank = select(2, GetSpellInfo(Button.SpellId));
return "spell", Button.SpellName, Rank, Button.SpellId, Util.LookupSpellIndex(Button.SpellNameRank), Button.SpellBook;
elseif (Button.Mode == "item") then
return "item", Button.ItemId, Button.ItemName;
@ -2415,6 +2488,8 @@ function Util.GetButtonActionInfo2(ButtonName)
return "bonusaction", Button.BonusActionSlot;
elseif (Button.Mode == "customaction") then
return "customaction", Button.CustomActionName;
elseif (Button.Mode == "battlepet") then
return "battlepet", Button.BattlePetId;
end
end
@ -2558,223 +2633,6 @@ function Util.LookupEquipmentSetIndex(EquipmentSetID)
end
end
return nil;
end
-- TBC Fix new functions for ranks 06/17/2021
function Util.InitCacheSpellBookRanksVars()
BF_PlayerName = UnitName("player")
BF_ClassName = UnitClass("player")
-- table of spellnames, spellIds and spellranks
BF_kwnSpellsTable = {}
BF_kwnSpellsTable[BF_PlayerName] = {}
-- used to build spellranks using string.find, sorted by spellname, spellid
BF_kwnSpellsTableVis = {}
BF_kwnSpellsTableVis[BF_PlayerName] = {}
-- for looped, each time spellname found, rank is bumped up
BF_kwntblSpellNames = {}
BF_kwntblSpellNames[BF_PlayerName] = {}
-- stores rank for each spellId found
BF_kwnSpellsRank = {}
BF_kwnSpellsRank[BF_PlayerName] = {}
-- stores spellId for max rank for spellname
BF_kwnSpellsTableR = {}
BF_kwnSpellsTableR[BF_PlayerName] = {}
-- total known spells found
BF_kwntblSpellCount = {}
BF_kwntblSpellCount[BF_PlayerName] = 0
end
-- spellId converted to text and padded for sorting
function Util.PadiSpellId(t)
if strlen(t) == 2 then
tnum = "0000"..t
return tnum
elseif strlen(t) == 3 then
tnum = "000"..t
return tnum
elseif strlen(t) == 4 then
tnum = "00"..t
return tnum
elseif strlen(t) == 5 then
tnum = "0"..t
return tnum
end
return t
end
-- Parse player's spellbook and build a list of available spells
function Util.CacheSpellBookRanks()
Util.InitCacheSpellBookRanksVars() -- reset known spells for character
local i = 0
local iIndex = 0
local iSpellId = 0
local old_iSpellId = 0
local txt_iSpellId = ""
for i = 1, GetNumSpellTabs() do
local _, _, offset, numSlots = GetSpellTabInfo(i)
for iIndex = offset, offset+numSlots do
local slotType, iSpellId = GetSpellBookItemInfo(iIndex, BOOKTYPE_SPELL)
if slotType == "SPELL" then
local slotName = GetSpellBookItemName(iIndex, "spell")
local spellName = GetSpellInfo(slotName)
if (spellName) then
txt_iSpellId = Util.PadiSpellId(tostring(iSpellId))
-- make sure iSpellId has not been seen
if not BF_kwnSpellsRank[BF_PlayerName][iSpellId] then
BF_kwnSpellsRank[BF_PlayerName][iSpellId] = 0
BF_kwntblSpellNames[BF_PlayerName][spellName] = spellName
if old_iSpellId ~= iSpellId then
old_iSpellId = iSpellId
BF_kwntblSpellCount[BF_PlayerName] = BF_kwntblSpellCount[BF_PlayerName] + 1
BF_kwnSpellsTable[BF_PlayerName][BF_kwntblSpellCount[BF_PlayerName]] = { BF_ClassName, "known", spellName, txt_iSpellId, 0 }
BF_kwnSpellsTableVis[BF_PlayerName][BF_kwntblSpellCount[BF_PlayerName]] = BF_ClassName..", known, "..spellName..", "..txt_iSpellId
end
end
end
end
end -- for
end -- for
table.sort({BF_kwnSpellsTable[BF_PlayerName]})
table.sort(BF_kwnSpellsTableVis[BF_PlayerName])
local spellRank = 0
local tstr = ""
-- known entries, spellranks for each spellId
for spellName, _ in pairs(BF_kwntblSpellNames[BF_PlayerName]) do
spellRank = 0
for loop = 1, BF_kwntblSpellCount[BF_PlayerName] do
tstr = BF_kwnSpellsTableVis[BF_PlayerName][loop]
if string.match(tstr, spellName) then
spellRank = spellRank + 1
BF_kwnSpellsTableVis[BF_PlayerName][loop] = tstr..", Rank-"..spellRank
tstr2 = BF_kwnSpellsTableVis[BF_PlayerName][loop]
for loop2 = 1, BF_kwntblSpellCount[BF_PlayerName] do
txt_iSpellId = BF_kwnSpellsTable[BF_PlayerName][loop2][4]
if string.match(tstr2,txt_iSpellId) then
BF_kwnSpellsTable[BF_PlayerName][loop2][5] = spellRank
BF_kwnSpellsRank[BF_PlayerName][tonumber(txt_iSpellId)] = spellRank
end
end
end
end
end
-- build spell maxrank table
for loop = 1, BF_kwntblSpellCount[BF_PlayerName] do
spellName = BF_kwnSpellsTable[BF_PlayerName][loop][3]
iSpellId = tonumber(BF_kwnSpellsTable[BF_PlayerName][loop][4])
if BF_kwnSpellsTableR[BF_PlayerName][spellName] == nil then
BF_kwnSpellsTableR[BF_PlayerName][spellName] = {}
end
table.insert(BF_kwnSpellsTableR[BF_PlayerName][spellName], iSpellId)
end
end
--[[ example to find max rank for spellId
if BF_kwnSpellsTableR[BF_PlayerName][spellName] ~= nil then
maxrank = #BF_kwnSpellsTableR[BF_PlayerName][spellName]
findSpellId = BF_kwnSpellsTableR[BF_PlayerName][spellName][maxrank]
return
end
]]
-- return highest rank for spellname
function Util.GetMaxSpellRank(spellname)
-- print("Function Util.GetMaxSpellRank(spellname) :"..spellname)
local Rank = 1
if BF_kwnSpellsRank[BF_PlayerName][spellname] ~= nil then
Rank = #BF_kwnSpellsRank[BF_PlayerName][spellname]
-- print("Function Util.GetMaxSpellRank(spellname) :"..spellname..", Max Rank found :"..Rank)
return Rank
end
-- print("Function Util.GetMaxSpellRank(spellname) :"..spellname..", Max Rank not found")
return Rank
end
-- return rank for spellId
function Util.GetSpellRank(Id)
-- print("Function Util.GetSpellRank(Id) :"..Id)
local Rank = 1
if BF_kwnSpellsRank[BF_PlayerName][Id] ~= nil then
Rank = BF_kwnSpellsRank[BF_PlayerName][Id]
-- print("Function Util.GetSpellRank(Id) :"..Id..", Rank found :"..Rank)
return Rank
end
-- print("Function Util.GetSpellRank(Id) :"..Id..", Rank not found")
return Rank
end
-- our wrapper for GetSpellInfo() 06/18/2021
function Util.GetSpellInfo(sName, spellId_or_Rank)
local rank = 1
-- Util.GetSpellInfo("Thorns",3) -- example: return info for spell thorns, rank 3 spellId
if (type(sName) ~= "number" and type(spellId_or_Rank) == "number") then -- spellname and looking for spellid of rank
sRank = spellId_or_Rank
rank = sRank
if BF_kwnSpellsTableR[BF_PlayerName][sName] ~= nil then
if BF_kwnSpellsTableR[BF_PlayerName][sName][sRank] ~= nil then
spellId = BF_kwnSpellsTableR[BF_PlayerName][sName][sRank]
local name, _, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(spellId);
return name,rank,icon,castTime,minRange,maxRange,spellId
end
end
-- rank not found in BF_kwnSpellsTableR, this should not happen
rank = 0
local name, _, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(sName);
return name,rank,icon,castTime,minRange,maxRange,spellId
-- Util.GetSpellInfo("Thorns") -- example: return info for spellId for highest rank known for Thorns
elseif type(sName) ~= "number" then -- spellname only, return spellId for max rank
if BF_kwnSpellsTableR[BF_PlayerName][sName] ~= nil then
maxrank = #BF_kwnSpellsTableR[BF_PlayerName][sName]
Id = BF_kwnSpellsTableR[BF_PlayerName][sName][maxrank]
local name, _, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(Id);
return name,maxrank,icon,castTime,minRange,maxRange,Id
end
-- rank not found in BF_kwnSpellsTableR, this should not happen
rank = 0
local name, _, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(sName);
return name,rank,icon,castTime,minRange,maxRange,spellId
-- Util.GetSpellInfo(9910) -- example: return info for spellId
elseif type(sName) == "number" then -- spellId passed, not spell name, don't bother with sRank here
Id = sName
local name, _, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(Id);
rank = Util.GetSpellRank(Id)
if spellId ~= Id then
print("Error in Util.GetSpellInfo, spellid mismatch "..spellId.." should match "..Id)
end
return name,rank,icon,castTime,minRange,maxRange,Id
end
print("Error in Util.GetSpellInfo, params match didn't happen")
local name, _, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(sName);
return name, 0
end

Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 54 KiB