Im trying to use LibActionButton-1.0 to create action bars.
I get the problems that all actionbars are showing the exact same spells.
Code first:
Lua Code:
LybrialActionBars.customExitButton = {
func = function()
if (UNITS:UnitExists("vehicle")) then
VehicleExit();
else
PetDismiss();
end
end,
texture = [[Interface\Icons\Spell_Shadow_SacrificialShield]],
tooltip = _G.LEAVE_VEHICLE,
}
function LybrialActionBars:SetupBars()
TABLES:ForEach(self.db.profile.bars, function(index, bar)
local frameName = ADDON_NAME .. "_" .. index .. "_Frame";
if (bar.enabled and (self.bars[frameName] == nil)) then
local dbPosition = self.db.profile.bars[index].layout.container.position;
local defaultPosition = defaults.profile.bars[index].layout.container.position;
local path = "bars," .. index;
self.bars[frameName] = FRAMES:CreateFrame("Frame", frameName, FRAMES.UIParent, "SecureHandlerStateTemplate", true, LOCALE["ACTION_BAR"], self.db, dbPosition, defaultPosition, path);
self.bars[frameName]:SetFrameStrata("LOW");
self.bars[frameName]:SetFrameRef("MainMenuBarArtFrame", _G.MainMenuBarArtFrame);
self.bars[frameName].id = index;
self.bars[frameName].buttons = {};
self.bars[frameName].buttonsBind = self.db.profile.bars[index].buttons.bind;
self.bars[frameName].buttonsConfig = {};
self.bars[frameName].db = self.db.profile.bars[index];
self.bars[frameName]:CreateTemplateBackdrop();
end
end);
end
function LybrialActionBars:UpdateBars()
TABLES:ForEach(self.bars, function(_, bar)
LAYOUT:Setup(bar, bar.buttons, bar.db.layout, bar.db.buttons.max);
VISIBILITY:UnregisterFrame(bar);
VISIBILITY:RegisterFrame(bar, bar.db.layout.container.visibility);
end);
end
function LybrialActionBars:SetupButtons()
TABLES:ForEach(self.bars, function(_, bar)
for i = 1, 12 do
bar.buttons[i] = ACTION_BUTTON:CreateButton(i, STRINGS:Format(bar:GetName() .. "_Button_%d", i), bar, nil);
bar.buttons[i]:SetState(0, "action", i);
for k = 1, 14 do
bar.buttons[i]:SetState(k, "action", ((k - 1) * 12) + i);
end
if i == 12 then
bar.buttons[i]:SetState(12, "custom", LybrialActionBars.customExitButton);
end
end
end);
end
function LybrialActionBars:UpdateButtons()
TABLES:ForEach(self.bars, function(_, bar)
TABLES:ForEach(bar.buttons, function(index, button)
bar.buttonsConfig.keyBoundTarget = STRINGS:Format(bar.buttonsBind .. "%d", index);
button.keyBoundTarget = bar.buttonsConfig.keyBoundTarget;
button:SetAttribute("checkselfcast", true);
button:SetAttribute("checkfocuscast", true);
button:UpdateConfig(bar.buttonsConfig);
end);
end);
end
Create the action bars this way results in the following:
The shortcuts are showing the correct values but the macro text and spells are all the same on each bar.
Does anyone has experience with that library and can tell me what im doing wrong?