Skip to content

Commit

Permalink
more tww fixes, fix fill function
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbuds committed Jul 19, 2024
1 parent b8727b6 commit 07aa5b8
Showing 1 changed file with 37 additions and 11 deletions.
48 changes: 37 additions & 11 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,39 @@ local GetSpellCooldown = GetSpellCooldown or function(spellID)
end
end

local BOOKTYPE_SPELL = "spell";
local BOOKTYPE_SPELL = Enum.SpellBookSpellBank.Player or "spell"

local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines

local GetSpellBookItemName = GetSpellBookItemName or function(index, bookType)
local spellBank = (bookType == BOOKTYPE_SPELL) and Enum.SpellBookSpellBank.Player or Enum.SpellBookSpellBank.Pet;
return C_SpellBook.GetSpellBookItemName(index, spellBank);
end

local IsPassiveSpell = IsPassiveSpell or C_SpellBook.IsSpellBookItemPassive
local PickupSpellBookItem = PickupSpellBookItem or C_SpellBook.PickupSpellBookItem
local GetSpellTabInfo = GetSpellTabInfo or function(index)
local skillLineInfo = C_SpellBook.GetSpellBookSkillLineInfo(index);
if skillLineInfo then
return skillLineInfo.name,
skillLineInfo.iconID,
skillLineInfo.itemIndexOffset,
skillLineInfo.numSpellBookItems,
skillLineInfo.isGuild,
skillLineInfo.offSpecID,
skillLineInfo.shouldHide,
skillLineInfo.specID;
end
end
local UnitAura = UnitAura or function(unitToken, index, filter)
local auraData = C_UnitAuras.GetAuraDataByIndex(unitToken, index, filter);
if not auraData then
return nil;
end

return AuraUtil.UnpackAuraData(auraData);
end

local frame = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
frame:SetBackdrop(backdrop)
frame:SetBackdropColor(0, 0, 0)
Expand Down Expand Up @@ -722,16 +748,16 @@ function fill()

local frameID = 1
for i = 2, GetNumSpellTabs() do
local offset, numSlots = select(3, GetSpellTabInfo(i))
for j = offset+1, offset+numSlots do
if not IsPassiveSpell(j, BOOKTYPE_SPELL) then
PickupSpellBookItem(j, BOOKTYPE_SPELL)
local actionSlot = frames[frameID] and frames[frameID].action
if actionSlot then
PlaceAction(actionSlot)
frameID = frameID + 1
end
local offset, numSlots = select(3, GetSpellTabInfo(i))
for j = offset+1, offset+numSlots do
if not IsPassiveSpell(j, BOOKTYPE_SPELL) then
PickupSpellBookItem(j, BOOKTYPE_SPELL)
local actionSlot = frames[frameID] and frames[frameID].action
if actionSlot then
PlaceAction(actionSlot)
frameID = frameID + 1
end
end
end
end
end
end

0 comments on commit 07aa5b8

Please sign in to comment.