Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Lint
on:
push:
branches: [master]
paths: ['**.lua', '**.xml', '*.toc', '.luacheckrc', '.github/workflows/lint.yml']
paths: ['**.lua', '**.xml', '*.toc', '.luacheckrc', 'Makefile', '.github/workflows/lint.yml']
pull_request:
paths: ['**.lua', '**.xml', '*.toc', '.luacheckrc', '.github/workflows/lint.yml']
paths: ['**.lua', '**.xml', '*.toc', '.luacheckrc', 'Makefile', '.github/workflows/lint.yml']

jobs:
check:
Expand All @@ -24,3 +24,19 @@ jobs:

- name: TOC check
uses: lua-wow/toc-check@v1

test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Install Lua 5.1
run: sudo apt-get update && sudo apt-get install -y lua5.1

- name: Tests
run: make test LUA=lua5.1
17 changes: 13 additions & 4 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ ignore = {
'631', -- line is too long
}

-- data files keep the full expansion ladder for authoring entries
files['data/shared/blacklist.lua'] = { ignore = { '211/LE_EXPANSION_.*' } }
files['data/shared/cooldowns.lua'] = { ignore = { '211/LE_EXPANSION_.*' } }

-- globals Filger is allowed to set or mutate
globals = {
-- slash commands
Expand All @@ -48,6 +44,19 @@ read_globals = {
'C_UnitAuras',

-- constants
'LE_EXPANSION_BATTLE_FOR_AZEROTH',
'LE_EXPANSION_BURNING_CRUSADE',
'LE_EXPANSION_CATACLYSM',
'LE_EXPANSION_CLASSIC',
'LE_EXPANSION_DRAGONFLIGHT',
'LE_EXPANSION_LEGION',
'LE_EXPANSION_LEVEL_CURRENT',
'LE_EXPANSION_MIDNIGHT',
'LE_EXPANSION_MISTS_OF_PANDARIA',
'LE_EXPANSION_SHADOWLANDS',
'LE_EXPANSION_WAR_WITHIN',
'LE_EXPANSION_WARLORDS_OF_DRAENOR',
'LE_EXPANSION_WRATH_OF_THE_LICH_KING',
'WOW_PROJECT_BURNING_CRUSADE_CLASSIC',
'WOW_PROJECT_CAMELOT',
'WOW_PROJECT_CATACLYSM_CLASSIC',
Expand Down
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ APIs and by secret values. Don't assume existing code is correct.
**No configuration.** No options UI, slash-command configuration (`/filger` is help/dev only),
profiles, per-character or per-client settings, and no SavedVariables added just to make
something configurable. Decisions are made in code and constants (`config.lua`, `data/`).
The declared SavedVariable (`FilgerData`) is currently unused. If a feature genuinely needs new persistent state, explain
There are no SavedVariables. If a feature genuinely needs persistent state, explain
why before adding it.

**Minimalism.** No frameworks, abstractions, compatibility layers, helper systems or
Expand Down Expand Up @@ -51,6 +51,8 @@ architecture win when they conflict.

- Blizzard `wow-ui-source` (local clone in `../refs`, read-only) is the API authority. Use
targeted searches, not broad exploration. Map: [docs/references.md](docs/references.md).
- `../spellbook` (separate tool) caches per-client spell DB2 tables and checks `data/` spell IDs.
Use it to verify IDs instead of memory: [docs/references.md](docs/references.md#spellbook-spell-db2-data-and-checks).

## Git & GitHub

Expand Down
7 changes: 1 addition & 6 deletions Filger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@ end)
function Filger:ADDON_LOADED(addon)
if (addon ~= "Filger") then return end

-- order matters: config reads the validated data, the backdrop API reads the config
-- order matters: config reads the validated data
ns.data.Finalize()
ns.BuildConfig()

-- Filger standalone
if ns.MergeAPI then
ns.MergeAPI()
end
end

function Filger:PLAYER_LOGIN()
Expand Down
3 changes: 1 addition & 2 deletions Filger.toc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
## Credits: Nils Ruesch, Shestak, Affli, Garagar, hidekki, FourOne, Tukz

## OptionalDeps: Tainted, Tukui, ElvUI
## SavedVariables: FilgerData

## Notes: Minimal buff/debuff tracker
## Title: |cffff8000Filger|r
Expand All @@ -19,12 +18,12 @@ libs\LibDispel\LibDispel.xml [AllowLoadGameType classic]
core\compat.lua
core\util.lua
core\data.lua
core\init.xml
data\[Game]\blacklist.lua
data\[Game]\cooldowns.lua
data\[Game]\spells.lua
data\shared\blacklist.lua
data\shared\cooldowns.lua
core\init.xml
config.lua
elements\cooldowns.lua
elements\[Family]\auras.lua
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c

LUACHECK ?= luacheck
LUA ?= lua

# -- help ---------------------

Expand All @@ -17,3 +18,9 @@ help: ## Show available commands
.PHONY: check
check: ## Run static analysis (see .luacheckrc)
@$(LUACHECK) .

# -- tests --------------------

.PHONY: test
test: ## Run unit tests (tests/run.lua)
@$(LUA) tests/run.lua
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Spells shown or hidden per client are listed in [data/](./data).
- `/filger help` - List all available commands.
- `/filger auras <player|target|focus> <buffs|debuffs>` - List your auras on a unit with their spell IDs.
Out of combat only on Retail, while auras are secret.
- `/filger validate` - List configured spell IDs that don't exist on this client.

## Configuration

Expand Down
2 changes: 1 addition & 1 deletion config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ns.config = {
["size"] = 1
},
["gametooltip"] = true, -- enabled tooltips
["dev"] = false, -- enables dev/development.lua commands
["dev"] = true, -- enables dev/development.lua commands
}
}

Expand Down
64 changes: 15 additions & 49 deletions core/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@ function ns.SetBorderColor(backdrop, color)
end
end

-- skip it if a UI with its own CreateBackdrop is loaded
if IsAddOnLoaded("Tainted") or IsAddOnLoaded("Tukui") or IsAddOnLoaded("ElvUI") then
return
end
-- these UIs add their own CreateBackdrop to every frame; OptionalDeps loads them first
local hasUIBackdrop = IsAddOnLoaded("Tainted") or IsAddOnLoaded("Tukui") or IsAddOnLoaded("ElvUI")

---------------------------------------------------
-- API
---------------------------------------------------
local API = {}

local Scale = function(size)
-- Ensure 'size' is a valid number, default to 1 if not
size = tonumber(size) or 1
Expand All @@ -41,8 +37,10 @@ local Scale = function(size)
return mult * math.floor(size / mult + 0.5)
end

API.CreateBackdrop = function(self, template)
if not self.Backdrop then
function ns.CreateBackdrop(frame, template)
if hasUIBackdrop and frame.CreateBackdrop then
frame:CreateBackdrop(template)
elseif not frame.Backdrop then
local backdropTexture = textures.blank
local backdropColor = ns.config.general.backdrop.color
local backdropAlpha = (template == "transparent") and 0.70 or 1
Expand All @@ -61,46 +59,14 @@ API.CreateBackdrop = function(self, template)
backdrop.insets = { top = inset, left = inset, bottom = inset, right = inset }
end

local level = self:GetFrameLevel() or 1

self.Backdrop = CreateFrame("Frame", nil, self, "BackdropTemplate")
self.Backdrop:SetPoint("TOPLEFT", -inset, inset)
self.Backdrop:SetPoint("BOTTOMRIGHT", inset, -inset)
self.Backdrop:SetFrameLevel(level - 1)
self.Backdrop:SetBackdrop(backdrop)
self.Backdrop:SetBackdropColor(backdropColor.r, backdropColor.g, backdropColor.b, backdropAlpha)
self.Backdrop:SetBackdropBorderColor(borderColor.r, borderColor.g, borderColor.b)
local level = frame:GetFrameLevel() or 1

frame.Backdrop = CreateFrame("Frame", nil, frame, "BackdropTemplate")
frame.Backdrop:SetPoint("TOPLEFT", -inset, inset)
frame.Backdrop:SetPoint("BOTTOMRIGHT", inset, -inset)
frame.Backdrop:SetFrameLevel(level - 1)
frame.Backdrop:SetBackdrop(backdrop)
frame.Backdrop:SetBackdropColor(backdropColor.r, backdropColor.g, backdropColor.b, backdropAlpha)
frame.Backdrop:SetBackdropBorderColor(borderColor.r, borderColor.g, borderColor.b)
end
end

--------------------------------------------------
-- Merge Filger API with WoW API
--------------------------------------------------
function ns.MergeAPI()
local AddAPI = function(obj)
local mt = getmetatable(obj).__index
for name, func in pairs(API) do
if (not obj[name]) then mt[name] = func end
end
end

local Handled = {
["Frame"] = true
}

local Object = CreateFrame("Frame")
AddAPI(Object)
AddAPI(Object:CreateTexture())
AddAPI(Object:CreateFontString())

Object = EnumerateFrames()

while (Object) do
local t = Object:GetObjectType()
if (not Object:IsForbidden() and not Handled[t]) then
AddAPI(Object)
Handled[t] = true
end
Object = EnumerateFrames(Object)
end
end
2 changes: 1 addition & 1 deletion core/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ do
-- aura container buttons are unnamed; "$parent" would create globals like "Icon"
local name = button:GetName()

button:CreateBackdrop()
ns.CreateBackdrop(button)
-- ElvUI stores its backdrop as `backdrop`
button.Backdrop = button.Backdrop or button.backdrop

Expand Down
25 changes: 25 additions & 0 deletions core/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,28 @@ local auras = function(arg)
end

ns.AddCommand("auras", auras, "list your auras on a unit with their spell IDs (/filger auras player buffs)")

-- lists configured IDs that don't resolve on this client
local validate = function()
local groups, keys = {}, {}
for _, entry in ipairs(ns.data.invalid) do
local key = entry.kind .. (entry.class and ("/" .. entry.class) or "")
if not groups[key] then
groups[key] = {}
table.insert(keys, key)
end
table.insert(groups[key], entry.id)
end

if #keys == 0 then
print(Filger.title, "all configured IDs are valid.")
return
end

table.sort(keys)
for _, key in ipairs(keys) do
print(Filger.title, "|cffff8000" .. key .. "|r", table.concat(groups[key], ", "))
end
end

ns.AddCommand("validate", validate, "list configured IDs that don't exist on this client")
Loading
Loading