Comparer les révisions

...

12 Révisions

Auteur SHA1 Message Date
Albirew 05c592f66f updated with latest fixes from Sunnova 2021-07-26 22:13:56 +02:00
Albirew 176330e352 removed regression 2021-05-25 19:18:40 +02:00
Albirew 199fd9cd09 update for classic BC 2021-05-24 18:34:34 +02:00
Albirew 4763a6c340 Merge branch 'master' of https://git.dess.ga/Albirew/ButtonForge-classic 2021-02-20 14:13:48 +01:00
Albirew 7fbbf2f98d fixed issue 70
https://www.curseforge.com/wow/addons/button-forge/issues/70
2021-02-20 14:13:01 +01:00
Albirew 813a26859a Mise à jour de 'README.md' 2021-02-20 11:24:09 +00:00
Albirew e6d11fcdc6 added some slash commands 2021-02-20 11:23:18 +00:00
Albirew 00bf15fb7b Merge branch 'original'
also removed advanced "create bonus bar" button since non-existant in classic
2021-01-30 17:15:42 +01:00
Albirew d42e06d3de release 1.0.3 2021-01-30 15:10:55 +01:00
Albirew fabebbfe11 release 1.0.2 2020-12-15 05:05:07 +01:00
Albirew 58a8ef7de9 update to 1.0.1 2020-11-26 02:32:29 +01:00
Albirew 9da175d295 update to 1.0.0 2020-11-26 02:31:28 +01:00
13 fichiers modifiés avec 609 ajouts et 80 suppressions

37
Bar.lua
Voir le fichier

@ -142,6 +142,7 @@ function Bar.New(BarSave)
--[[Background Layer, this will contain all controls and is used in resizing]]--
local Background = CreateFrame("FRAME", nil, ControlFrame);
Mixin(Background, BackdropTemplateMixin)
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,6 +184,7 @@ function Bar.New(BarSave)
--[[Label Frame]]--
local LabelFrame = CreateFrame("FRAME", nil, ControlFrame);
Mixin(LabelFrame, BackdropTemplateMixin)
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);
@ -561,6 +563,27 @@ function Bar:GetPosition()
return self.BarSave["Left"], self.BarSave["Top"], self.BarSave["Left"]..", "..self.BarSave["Top"];
end
function Bar:SetFlyoutDirection(Direction)
local flyoutDirection = "UP"; -- default
if (Direction == "left" or Direction == "LEFT") then
flyoutDirection = "LEFT";
elseif (Direction == "right" or Direction == "RIGHT") then
flyoutDirection = "RIGHT";
elseif (Direction == "down" or Direction == "DOWN") then
flyoutDirection = "DOWN";
end
self.BarSave["FlyoutDirection"] = flyoutDirection;
for r = 1, self.Rows do
for c = 1, self.Cols do
local i = (r-1) * self.Cols + c;
self.Buttons[i].Widget:SetAttribute("flyoutDirection", flyoutDirection);
self.Buttons[i]:UpdateFlyout();
end
end
end
function Bar:SetScale(Scale, NoCheck)
Scale = (Scale or 0) + 0;
if (Scale <= 0) then
@ -604,6 +627,10 @@ function Bar:SetButtonsFromSave()
local NewButton = Util.NewButton(self.ButtonFrame, self.BarSave["Buttons"][i], self.BarSave["ButtonsLocked"], self.BarSave["TooltipsOn"], self.BarSave["MacroText"], self.BarSave["KeyBindText"]);
table.insert(self.Buttons, i, NewButton);
NewButton.Widget:SetPoint("TOPLEFT", self.ButtonFrame, "TOPLEFT", (c-1) * self.BSize, (1-r) * self.BSize);
if (self.BarSave["FlyoutDirection"]) then
NewButton.Widget:SetAttribute("flyoutDirection", self.BarSave["FlyoutDirection"]);
NewButton:UpdateFlyout();
end
end
end
@ -667,6 +694,10 @@ function Bar:SetNumButtons(Cols, Rows)
local NewButton = Util.NewButton(BFrame, ButtonSave, self.BarSave["ButtonsLocked"], self.BarSave["TooltipsOn"], self.BarSave["MacroText"], self.BarSave["KeyBindText"]);
table.insert(Buttons, i, NewButton);
NewButton.Widget:SetPoint("TOPLEFT", BFrame, "TOPLEFT", (c-1) * self.BSize, (1-r) * self.BSize);
if (self.BarSave["FlyoutDirection"]) then
NewButton.Widget:SetAttribute("flyoutDirection", self.BarSave["FlyoutDirection"]);
NewButton:UpdateFlyout();
end
end
end
self.Cols = Cols;
@ -678,7 +709,11 @@ function Bar:SetNumButtons(Cols, Rows)
local ButtonSave = {};
local NewButton = Util.NewButton(BFrame, ButtonSave, self.BarSave["ButtonsLocked"], self.BarSave["TooltipsOn"], self.BarSave["MacroText"], self.BarSave["KeyBindText"]);
table.insert(Buttons, i, NewButton);
NewButton.Widget:SetPoint("TOPLEFT", BFrame, "TOPLEFT", (c-1) * self.BSize, (1-r) * self.BSize);
NewButton.Widget:SetPoint("TOPLEFT", BFrame, "TOPLEFT", (c-1) * self.BSize, (1-r) * self.BSize);
if (self.BarSave["FlyoutDirection"]) then
NewButton.Widget:SetAttribute("flyoutDirection", self.BarSave["FlyoutDirection"]);
NewButton:UpdateFlyout();
end
end
end
self.Rows = Rows;

Voir le fichier

@ -573,7 +573,7 @@ end
--[[ Set the individual types of actions including obtained any extra data they may need --]]
function Button:SetCommandSpell(Id)
local Name, Rank = GetSpellInfo(Id);
local Name, Rank = Util.GetSpellInfo(Id); -- TBC Fix 2021/06/18
local NameRank = Util.GetFullSpellName(Name, Rank);
self:SetCommandExplicitSpell(Id, NameRank, Name, Book);
end
@ -663,7 +663,7 @@ end
--[[ The following functions will configure the button to operate correctly for the specific type of action (these functions must be able to handle the player not knowing spells/macros etc) --]]
function Button:SetEnvSpell(Id, NameRank, Name, Book, IsTalent)
self.UpdateTexture = Button.Empty;
self.UpdateTexture = Button.UpdateTextureSpell;
self.UpdateChecked = Button.UpdateCheckedSpell;
self.UpdateEquipped = Button.Empty;
self.UpdateCooldown = Button.UpdateCooldownSpell;
@ -1230,7 +1230,9 @@ 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
-- 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.SpellId = SpellId;
self.MacroMode = "spell";
else
@ -1275,6 +1277,27 @@ function Button:UnitBuffBySpell(unit, spell)
return nil;
end;
function Button:UpdateTextureSpell()
local spellHasBuffActive = false;
for i=1,40 do
local spellId = select(10, UnitBuff("player", i));
if spellId then
if spellId == self.SpellId then
spellHasBuffActive = true;
break;
end
else
-- no more buffs
break;
end;
end;
if (spellHasBuffActive == true and Const.StealthSpellIds[self.SpellId] ~= nil) then
self.WIcon:SetTexture("Interface/Icons/Spell_Nature_Invisibilty");
else
self.WIcon:SetTexture(self.Texture);
end
end
function Button:UpdateTextureWispSpell()
--BFA fix: UnitBuff can no longer be called with the spell name as a param
if (self.UnitBuffBySpell("player", self.SpellName)) then --NOTE: This en-US, hopefully it will be fine for other locales as well??
@ -1386,7 +1409,7 @@ function Button:UpdateCheckedCompanion()
end
function Button:UpdateCheckedBonusAction()
local action = self.Widget:GetAttribute("action");
if ((HasOverrideActionBar() or HasVehicleActionBar()) and (IsCurrentAction(action) or IsAutoRepeatAction(action))) then
if ((HasOverrideActionBar()) and (IsCurrentAction(action) or IsAutoRepeatAction(action))) then
self.Widget:SetChecked(true);
else
self.Widget:SetChecked(false);
@ -1471,7 +1494,7 @@ function Button:UpdateCooldownCompanion()
--as of 5.0.4 doesn't appear to exist anymore?!
end
function Button:UpdateCooldownBonusAction()
if (HasOverrideActionBar() or HasVehicleActionBar()) then
if (HasOverrideActionBar()) then
local action = self.Widget:GetAttribute("action");
Util.CooldownFrame_SetTimer(self.WCooldown, GetActionCooldown(action));
else
@ -1540,7 +1563,7 @@ end
function Button:UpdateUsableBonusAction()
local action = self.Widget:GetAttribute("action");
local IsUsable, NotEnoughMana = IsUsableAction(action);
if (IsUsable or (HasOverrideActionBar() == nil and HasVehicleActionBar() == nil)) then
if (IsUsable or (HasOverrideActionBar() == nil)) then
self.WIcon:SetVertexColor(1.0, 1.0, 1.0);
self.WNormalTexture:SetVertexColor(1.0, 1.0, 1.0);
elseif (NotEnoughMana) then
@ -1578,8 +1601,8 @@ function Button:UpdateTextCountSpell()
self.WCount:SetText(count);
return;
end
local charges = GetSpellCharges(self.SpellNameRank);
if (charges ~= nil) then
local charges, maxCharges = GetSpellCharges(self.SpellNameRank);
if (charges ~= nil and maxCharges ~= 1) then
self.WCount:SetText(charges);
return;
end
@ -1610,7 +1633,7 @@ function Button:UpdateTextCountMacro()
end
function Button:UpdateTextCountBonusAction()
local action = self.Widget:GetAttribute("action");
if ((HasOverrideActionBar() or HasVehicleActionBar()) and (IsConsumableAction(action) or IsStackableAction(action))) then
if ((HasOverrideActionBar()) and (IsConsumableAction(action) or IsStackableAction(action))) then
self.WCount:SetText(GetActionCount(action));
else
self.WCount:SetText("");
@ -1700,7 +1723,7 @@ end
function Button:UpdateTooltipBonusAction()
self = self.ParentButton or self; --This is a sneaky cheat incase the widget was used to get here...
local action = self.Widget:GetAttribute("action");
if (HasOverrideActionBar() or HasVehicleActionBar()) then
if (HasOverrideActionBar()) then
GameTooltip:SetAction(action);
else
GameTooltip:SetText(self.Tooltip, nil, nil, nil, nil, 1);
@ -1781,7 +1804,7 @@ function Button:UpdateFlashMacro()
end
function Button:UpdateFlashBonusAction()
local action = self.Widget:GetAttribute("action");
if ((HasOverrideActionBar() or HasVehicleActionBar()) and ((IsAttackAction(action) and IsCurrentAction(action)) or IsAutoRepeatAction(action))) then
if ((HasOverrideActionBar()) and ((IsAttackAction(action) and IsCurrentAction(action)) or IsAutoRepeatAction(action))) then
if (not self.FlashOn) then
self:AddToFlash();
end
@ -1846,7 +1869,7 @@ function Button:UpdateRangeTimerMacro()
end
function Button:UpdateRangeTimerBonusAction()
local action = self.Widget:GetAttribute("action");
if ((HasOverrideActionBar() or HasVehicleActionBar()) and IsActionInRange(action)) then
if ((HasOverrideActionBar()) and IsActionInRange(action)) then
if (not self.RangeTimerOn) then
self:AddToRangeTimer();
end
@ -2013,7 +2036,8 @@ 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 = 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
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
@ -2097,13 +2121,20 @@ function Button:UpdateFlyout()
-- Update arrow
Widget.FlyoutArrow:Show();
Widget.FlyoutArrow:ClearAllPoints();
--if (self:GetParent() == MultiBarRight or self:GetParent() == MultiBarLeft) then
--self.FlyoutArrow:SetPoint("LEFT", self, "LEFT", -arrowDistance, 0);
--SetClampedTextureRotation(self.FlyoutArrow, 270);
--else
local direction = self.Widget:GetAttribute("flyoutDirection");
if (direction == "LEFT") then
Widget.FlyoutArrow:SetPoint("LEFT", Widget, "LEFT", -arrowDistance, 0);
SetClampedTextureRotation(Widget.FlyoutArrow, 270);
elseif (direction == "RIGHT") then
Widget.FlyoutArrow:SetPoint("RIGHT", Widget, "RIGHT", arrowDistance, 0);
SetClampedTextureRotation(Widget.FlyoutArrow, 90);
elseif (direction == "DOWN") then
Widget.FlyoutArrow:SetPoint("BOTTOM", Widget, "BOTTOM", 0, -arrowDistance);
SetClampedTextureRotation(Widget.FlyoutArrow, 180);
else
Widget.FlyoutArrow:SetPoint("TOP", Widget, "TOP", 0, arrowDistance);
SetClampedTextureRotation(Widget.FlyoutArrow, 0);
--end
end
else
Widget.FlyoutBorder:Hide();
Widget.FlyoutBorderShadow:Hide();

Voir le fichier

@ -1,8 +1,8 @@
## Interface: 11306
## Title: Button Forge |cff69ccf0(Classic)|r
## Notes: Add as many or few extra Action Bars and Buttons to your user interface to complement the standard (or other) Action Bars
## Version: 1.0.2-classic
## Interface: 20501
## Title: Button Forge |cff69f0d1(Classic-TBC)|r
## Version: 1.0.5-classic-TBC
## Author: Massiner of Nathrezim, Albirew
## Notes: Add as many or few extra Action Bars and Buttons to your user interface to complement the standard (or other) Action Bars
## SavedVariables: ButtonForgeGlobalSettings, ButtonForgeGlobalProfiles, ButtonForgeGlobalBackup
## SavedVariablesPerCharacter: ButtonForgeSave
## OptionalDeps: Masque

Voir le fichier

@ -10,7 +10,7 @@ local Const = BFConst;
Const.SUMMON_RANDOM_FAVORITE_MOUNT_SPELL = 150544;
Const.SUMMON_RANDOM_FAVORITE_MOUNT_ID = 268435455;
Const.Version = 1.0;
Const.VersionMinor = 0.2;
Const.VersionMinor = 0.5;
Const.MAX_ACCOUNT_MACROS = 120;
Const.ButtonNaming = "ButtonForge"
Const.ButtonSeq = 1; --This value will increment (so not technically a const...)
@ -54,6 +54,11 @@ Const.ThresholdHSnapSq = 10 * 10;
Const.ThresholdHPressureSq = 20 * 20;
Const.StealthSpellIds = {};
Const.StealthSpellIds[1784] = 1; -- Stealth
Const.StealthSpellIds[5215] = 1; -- Prowl
Const.WispSpellIds = {};
Const.WispSpellIds[19746] = 1; --Concentration Aura
Const.WispSpellIds[32223] = 1; --Crusader Aura
@ -96,6 +101,7 @@ Const.SlashCommands["-keybindtext"] = {params = "bool", group = "bar"};
Const.SlashCommands["-tooltips"] = {params = "bool", group = "bar"};
Const.SlashCommands["-emptybuttons"] = {params = "bool", group = "bar"};
Const.SlashCommands["-lockbuttons"] = {params = "bool", group = "bar"};
Const.SlashCommands["-flyout"] = {params = "^%s*(..-)%s*$", group = "bar"};
Const.SlashCommands["-scale"] = {params = "^%s*(%d*%.?%d+)%s*$", group = "bar"};
Const.SlashCommands["-rows"] = {params = "^%s*(%d+)%s*$", group = "bar", requires = {"-createbar", "-bar"}};
Const.SlashCommands["-cols"] = {params = "^%s*(%d+)%s*$", group = "bar", requires = {"-createbar", "-bar"}};

247
DumpSpells.lua Fichier normal
Voir le fichier

@ -0,0 +1,247 @@
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

@ -228,6 +228,7 @@ function Full:InitialOnEvent(Event, Arg1)
self.AddonLoaded = true; --Before setting up is complete we also need to have spell, and macro data available
elseif (Event == "PLAYER_ENTERING_WORLD") then
Util.CacheSpellBookRanks() -- TBC Fix 2021/06/17
Util.CacheCompanions();
Util.CacheSpellIndexes();
Util.CachePetSpellIndexes();

Voir le fichier

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

Voir le fichier

@ -144,6 +144,18 @@ Notes:
#### 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

Voir le fichier

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

Voir le fichier

@ -10,11 +10,13 @@ local UILib = BFUILib;
local Const = BFConst;
local VertLine = CreateFrame("FRAME", nil, UIParent);
VertLine:SetBackdrop({bgFile = Const.ImagesDir.."VertLine.tga", edgeFile = nil, tile = false, tileSize = 1, edgeSize = 0, insets = {left=0, right=0, bottom=0, top=0}});
Mixin(VertLine, BackdropTemplateMixin)
VertLine:SetBackdrop({bgFile = Const.ImagesDir.."VertLine.tga", edgeFile = nil, tile = false, tileSize = 1, edgeSize = 1, insets = {left=0, right=0, bottom=0, top=0}});
VertLine:SetWidth(Const.VLineThickness / UIParent:GetScale());
local HorizLine = CreateFrame("FRAME", nil, UIParent);
HorizLine:SetBackdrop({bgFile = Const.ImagesDir.."HorizontalLine.tga", edgeFile = nil, tile = false, tileSize = 1, edgeSize = 0, insets = {left=0, right=0, bottom=0, top=0}});
Mixin(HorizLine, BackdropTemplateMixin)
HorizLine:SetBackdrop({bgFile = Const.ImagesDir.."HorizontalLine.tga", edgeFile = nil, tile = false, tileSize = 1, edgeSize = 1, insets = {left=0, right=0, bottom=0, top=0}});
HorizLine:SetHeight(Const.HLineThickness / UIParent:GetScale());

Voir le fichier

@ -16,7 +16,6 @@ function UILib.ToggleCreateBarMode(ForceOff)
if (BFCreateBarOverlay:IsShown() or ForceOff) then
BFCreateBarOverlay:Hide();
BFToolbarCreateBar:SetChecked(false);
BFToolbarCreateBonusBar:SetChecked(false);
UILib.CreateBarMode = false;
UILib.CreateBonusBarMode = false;
SetCursor(nil);
@ -40,14 +39,12 @@ function UILib.ToggleCreateBonusBarMode(ForceOff)
if (BFCreateBarOverlay:IsShown() or ForceOff) then
BFCreateBarOverlay:Hide();
BFToolbarCreateBar:SetChecked(false);
BFToolbarCreateBonusBar:SetChecked(false);
UILib.CreateBarMode = false;
UILib.CreateBonusBarMode = false;
SetCursor(nil);
elseif (not InCombatLockdown()) then
UILib.CreateBonusBarMode = true;
BFCreateBarOverlay:Show();
BFToolbarCreateBonusBar:SetChecked(true);
SetCursor("REPAIRNPC_CURSOR");
end
EventFull.RefreshButtons = true;
@ -83,14 +80,12 @@ function UILib.ToggleAdvancedTools()
BFToolbarAdvanced:SetChecked(false);
ButtonForgeSave.AdvancedMode = false;
BFToolbar:SetSize(216, 88);
BFToolbarCreateBonusBar:Hide();
BFToolbarRightClickSelfCast:Hide();
else
BFAdvancedToolsLayer:Show();
BFToolbarAdvanced:SetChecked(true);
ButtonForgeSave.AdvancedMode = true;
BFToolbar:SetSize(216, 116);
BFToolbarCreateBonusBar:Show();
BFToolbarRightClickSelfCast:Show();
end
EventFull.RefreshButtons = true;

Voir le fichier

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

257
Util.lua
Voir le fichier

@ -1372,6 +1372,10 @@ function Util.ApplySlashCommands(Commands, Bar)
if (Commands["-lockbuttons"]) then
Bar:SetButtonsLocked(Commands["-lockbuttons"][1]);
end
if (Commands["-flyout"]) then
Bar:SetFlyoutDirection(Commands["-flyout"][1]);
end
if (Commands["-scale"]) then
Bar:SetScale(tonumber(Commands["-scale"][1]));
@ -1547,7 +1551,13 @@ function Util.SetCursor(Command, Data, Subvalue, Subsubvalue)
UILib.StopDraggingIcon();
-- SpellFlyout:Hide();
if (Command == "spell") then
PickupSpell(Subsubvalue);
-- pet spell or not
local name = GetSpellInfo(Subsubvalue);
if ( Util.PetSpellIndex[name] ) then
PickupSpellBookItem(Util.PetSpellIndex[name], BOOKTYPE_PET);
else
PickupSpell(Subsubvalue);
end;
elseif (Command == "item") then
PickupItem(Data);
elseif (Command == "macro") then
@ -1736,8 +1746,8 @@ function Util.CacheSpellIndexes()
for i = total, 1, -1 do
ItemType, Id = GetSpellBookItemInfo(i, BOOKTYPE_SPELL);
--local Name, Rank, Icon, PowerCost, IsFunnel, PowerType = GetSpellInfo(i, BOOKTYPE_SPELL);
local Name, Rank, Icon, PowerCost, IsFunnel, PowerType = GetSpellInfo(Id);
-- 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 NameRank = Util.GetFullSpellName(Name, Rank);
if (ItemType == "SPELL") then
NewSI[NameRank] = i;
@ -1878,15 +1888,16 @@ function Util.CacheCompanions()
Util.Critters[Name] = i;
end]]
-- Util.Mounts = {};
-- for i, mountID in pairs(C_MountJournal.GetMountIDs()) do
-- local creatureName, spellID = C_MountJournal.GetMountInfoByID(mountID);
-- if (not creatureName) then
-- return;
-- end
-- Util.Mounts[spellID] = mountID;
-- end
-- Util.CompanionsCached = true;
Util.Mounts = {};
--[[
for i, mountID in pairs(C_MountJournal.GetMountIDs()) do
local creatureName, spellID = C_MountJournal.GetMountInfoByID(mountID);
if (not creatureName) then
return;
end
Util.Mounts[spellID] = mountID;
end
Util.CompanionsCached = true;]]
end
function Util.LookupCompanion(Name)
@ -2386,7 +2397,9 @@ function Util.GetButtonActionInfo2(ButtonName)
--]]
if (Button.Mode == "spell") then
local Rank = select(2, GetSpellInfo(Button.SpellId));
-- local Rank = select(2, GetSpellInfo(Button.SpellId));
local Rank = select(2, Util.GetSpellInfo(Button.SpellId)); -- TBC Fix 2021/06/18
return "spell", Button.SpellName, Rank, Button.SpellId, Util.LookupSpellIndex(Button.SpellNameRank), Button.SpellBook;
elseif (Button.Mode == "item") then
return "item", Button.ItemId, Button.ItemName;
@ -2547,3 +2560,221 @@ function Util.LookupEquipmentSetIndex(EquipmentSetID)
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