├── .github
└── workflows
│ └── release.yml
├── .gitignore
├── .luacheckrc
├── BarIntegrations.lua
├── ClassicCompat.lua
├── ColorGradient.lua
├── Controller.lua
├── Controller.xml
├── LICENSE.txt
├── LiteButtonAuras.toc
├── Localization.lua
├── Options.lua
├── Overlay.lua
├── Overlay.xml
├── README.md
├── SlashCommand.lua
├── SpellData.lua
├── Textures
├── Overlay.tga
└── Square_FullWhite.tga
├── UI
├── AceGUIWidgets-LBAAnchorButtons.lua
├── AceGUIWidgets-LBAInputFocus.lua
├── AceGUIWidgets-LBAInputSpellID.lua
├── AceGUIWidgets-LBAInputValidSpell.lua
└── Options.lua
├── embeds.xml
├── fetchlocale.sh
├── get-libs.sh
└── pkgmeta.yaml
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Package and release
2 |
3 | on:
4 | push:
5 | tags:
6 | - '**'
7 |
8 | jobs:
9 |
10 | release:
11 |
12 | runs-on: ubuntu-latest
13 |
14 | env:
15 | CF_API_KEY: ${{ secrets.CF_API_KEY }}
16 | WOWI_API_TOKEN: ${{ secrets.WOWI_API_TOKEN }}
17 | WAGO_API_TOKEN: ${{ secrets.WAGO_API_TOKEN }}
18 | GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
19 |
20 | steps:
21 |
22 | - name: Clone project
23 | uses: actions/checkout@v3
24 | with:
25 | fetch-depth: 0
26 |
27 | - name: Package and release
28 | uses: BigWigsMods/packager@v2
29 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .release
2 | Libs/*
3 |
--------------------------------------------------------------------------------
/.luacheckrc:
--------------------------------------------------------------------------------
1 | exclude_files = {
2 | ".luacheckrc",
3 | "Tests/",
4 | "Libs/",
5 | }
6 |
7 | -- https://luacheck.readthedocs.io/en/stable/warnings.html
8 |
9 | ignore = {
10 | "11./BINDING_.*", -- Setting an undefined (Keybinding) global variable
11 | "211", -- Unused local variable
12 | "212", -- Unused argument
13 | "213", -- Unused loop variable
14 | "432/self", -- Shadowing a local variable
15 | "542", -- empty if branch
16 | "631", -- line too long
17 | }
18 |
19 | globals = {
20 | "LiteButtonAurasControllerMixin",
21 | "LiteButtonAurasOverlayMixin",
22 | "SlashCmdList",
23 | }
24 |
25 | read_globals = {
26 | "ABP_NS",
27 | "ADD",
28 | "ActionBarButtonEventsFrame",
29 | "ActionButton_HideOverlayGlow",
30 | "ActionButton_SetupOverlayGlow",
31 | "AuraUtil",
32 | "C_UnitAuras",
33 | "C_Item",
34 | "C_Spell",
35 | "C_SpellBook",
36 | "ChatFontNormal",
37 | "ContinuableContainer",
38 | "CopyTable",
39 | "CreateFrame",
40 | "CreateFromMixins",
41 | "DEFAULT",
42 | "DELETE",
43 | "DebuffTypeColor",
44 | "Dominos",
45 | "GAMEMENU_HELP",
46 | "GENERAL",
47 | "GRAY_FONT_COLOR",
48 | "GameFontHighlight",
49 | "GameFontNormal",
50 | "GameTooltip",
51 | "GameTooltip_Hide",
52 | "GetActionInfo",
53 | "GetActionText",
54 | "GetKeysArray",
55 | "GetLocale",
56 | "GetMacroIndexByName",
57 | "GetMacroItem",
58 | "GetMacroSpell",
59 | "GetTime",
60 | "GetTotemInfo",
61 | "GetValuesArray",
62 | "GetWeaponEnchantInfo",
63 | "HIGHLIGHT_FONT_COLOR",
64 | "HasAction",
65 | "IsMouseButtonDown",
66 | "IsPlayerSpell",
67 | "IsSpellOverlayed",
68 | "LibStub",
69 | "LiteButtonAurasController",
70 | "MAX_TOTEMS",
71 | "Mixin",
72 | "NONE",
73 | "NORMAL_FONT_COLOR",
74 | "NumberFontNormal",
75 | "OKAY",
76 | "ORANGE_FONT_COLOR",
77 | "REMOVE",
78 | "SELECTED_CHAT_FRAME",
79 | "SETTINGS",
80 | "Settings",
81 | "Spell",
82 | "UIParent",
83 | "UnitCanAttack",
84 | "UnitCastingInfo",
85 | "UnitChannelInfo",
86 | "UnitIsFriend",
87 | "WOW_PROJECT_CLASSIC",
88 | "WOW_PROJECT_ID",
89 | "WithinRange",
90 | "format",
91 | "hooksecurefunc",
92 | "sort",
93 | "strsplit",
94 | "tContains",
95 | "tDeleteItem",
96 | "table",
97 | }
98 |
--------------------------------------------------------------------------------
/BarIntegrations.lua:
--------------------------------------------------------------------------------
1 | --[[----------------------------------------------------------------------------
2 |
3 | LiteButtonAuras
4 | Copyright 2021 Mike "Xodiv" Battersby
5 |
6 | Create overlays for actionbuttons and hook update when they change. Note
7 | that hooksecurefunc() is kinda slow and should be avoided in cases where
8 | the actionbutton provides its own hook.
9 |
10 | ----------------------------------------------------------------------------]]--
11 |
12 | local _, LBA = ...
13 |
14 | LBA.BarIntegrations = {}
15 |
16 | local C_Item = LBA.C_Item or C_Item
17 | local C_Spell = LBA.C_Spell or C_Spell
18 |
19 | local GetActionInfo = GetActionInfo
20 | local HasAction = HasAction
21 |
22 | -- Generic ---------------------------------------------------------------------
23 |
24 | local function GenericGetActionID(overlay)
25 | return overlay:GetParent().action
26 | end
27 |
28 | local function GenericGetActionInfo(overlay)
29 | return GetActionInfo(overlay:GetParent().action)
30 | end
31 |
32 | local function GenericHasAction(overlay)
33 | return HasAction(overlay:GetParent().action)
34 | end
35 |
36 | local function GenericInitButton(actionButton)
37 | local overlay = LiteButtonAurasController:CreateOverlay(actionButton)
38 | overlay.GetActionID = GenericGetActionID
39 | overlay.GetActionInfo = GenericGetActionInfo
40 | overlay.HasAction = GenericHasAction
41 |
42 | if not overlay.isHooked then
43 | hooksecurefunc(actionButton, 'Update', function () overlay:Update() end)
44 | overlay.isHooked = true
45 | end
46 | end
47 |
48 | -- Blizzard Classic ------------------------------------------------------------
49 |
50 | -- Classic doesn't have an 'Update' method on the ActionButtons to hook
51 | -- so we have to hook the global function ActionButton_Update
52 |
53 | local function ClassicButtonUpdate(actionButton)
54 | local overlay = LiteButtonAurasController:GetOverlay(actionButton)
55 | if overlay then overlay:Update() end
56 | end
57 |
58 | local function ClassicInitButton(actionButton)
59 | local overlay = LiteButtonAurasController:CreateOverlay(actionButton)
60 | overlay.GetActionID = GenericGetActionID
61 | overlay.GetActionInfo = GenericGetActionInfo
62 | overlay.HasAction = GenericHasAction
63 | end
64 |
65 | function LBA.BarIntegrations:ClassicInit()
66 | if WOW_PROJECT_ID == 1 then return end
67 | for _, actionButton in pairs(ActionBarButtonEventsFrame.frames) do
68 | if actionButton:GetName():sub(1,8) ~= 'Override' then
69 | ClassicInitButton(actionButton)
70 | end
71 | end
72 | hooksecurefunc('ActionButton_Update', ClassicButtonUpdate)
73 | end
74 |
75 | -- Blizzard Retail -------------------------------------------------------------
76 |
77 | -- The OverrideActionButtons have the same action (ID) as the main buttons and
78 | -- we don't want to handle them.
79 |
80 | function LBA.BarIntegrations:RetailInit()
81 | if WOW_PROJECT_ID ~= 1 then return end
82 | for _, actionButton in pairs(ActionBarButtonEventsFrame.frames) do
83 | if actionButton:GetName():sub(1,8) ~= 'Override' then
84 | GenericInitButton(actionButton)
85 | end
86 | end
87 | end
88 |
89 |
90 | -- Button Forge ----------------------------------------------------------------
91 |
92 | -- These are ActionButton but they don't use the action ID they are set up as per
93 | -- SecureActionButtonTemplate with SetAttribute("type", ...) etc.
94 | --
95 | -- The hook here on widget.icon.SetTexture is not exactly kosher but it does work.
96 | -- Hoping the author will add a BUTTON_UPDATE calback hook or similar.
97 |
98 | -- Localize for Minor speedup
99 | local ButtonForge_API1
100 |
101 | local function ButtonForgeGetActionID(overlay)
102 | return 0
103 | end
104 |
105 | -- Note that this returns the old-style Blizzard GetActionInfo where macro
106 | -- never returns a subType and id is always the macro ID. So it doesn't have the
107 | -- bugs that the new style does with item macros.
108 | -- See LiteButtonAurasOverlayMixin:SetUpAction() where type == "macro"
109 |
110 | local function ButtonForgeGetActionInfo(overlay)
111 | local widget = overlay:GetParent()
112 | return ButtonForge_API1.GetButtonActionInfo(widget:GetName())
113 | end
114 |
115 | -- The buttons are re-used, but it's ok because CreateOverlay checks for that
116 |
117 | local function ButtonForgeInitButton(widget)
118 | local overlay = LiteButtonAurasController:CreateOverlay(widget)
119 | overlay.GetActionID = ButtonForgeGetActionID
120 | overlay.GetActionInfo = ButtonForgeGetActionInfo
121 | overlay.HasAction = ButtonForgeGetActionInfo
122 | hooksecurefunc(widget.icon, 'SetTexture', function () overlay:Update() end)
123 | end
124 |
125 | local function ButtonForgeCallback(_, event, actionButtonName)
126 | if event == "BUTTON_ALLOCATED" then
127 | local widget = _G[actionButtonName]
128 | ButtonForgeInitButton(widget)
129 | --[[
130 | -- This would be nicer than hooking .icon.SetTexture if it got implemented.
131 | elseif event == "BUTTON_UPDATED" then
132 | local widget = _G[actionButtonName]
133 | local overlay = LiteButtonAurasController:GetOverlay(widget)
134 | if overlay then overlay:Update() end
135 | ]]
136 | end
137 | end
138 |
139 | function LBA.BarIntegrations:ButtonForgeInit()
140 | ButtonForge_API1 = _G.ButtonForge_API1
141 | if ButtonForge_API1 then
142 | ButtonForge_API1.RegisterCallback(ButtonForgeCallback)
143 | end
144 | end
145 |
146 |
147 | -- Dominos ---------------------------------------------------------------------
148 |
149 | -- On classic Dominos re-uses the Blizzard action buttons and then adds some
150 | -- more of its own. On retail it uses all its own buttons, but they still use
151 | -- the ActionBarButton API enough for us.
152 |
153 | function LBA.BarIntegrations:DominosInit()
154 | local Init = WOW_PROJECT_ID == 1 and GenericInitButton or ClassicInitButton
155 | if Dominos and not Dominos.BlizzardActionButtons then
156 | -- "New" dominos with their own buttons
157 | for actionButton in pairs(Dominos.ActionButtons.buttons) do
158 | Init(actionButton)
159 | end
160 | hooksecurefunc(Dominos.ActionButton, 'OnCreate',
161 | function (button, id) Init(button) end)
162 | end
163 | end
164 |
165 |
166 | -- ActionBarPlus ---------------------------------------------------------------
167 |
168 | -- All SecureActionButton without any actionID
169 |
170 | -- I'm not 100% convinced about the wisdom of supporting this. The addon is
171 | -- overengineered and still doesn't support basic things like putting a pet
172 | -- action on a button. The code is inscrutable to me and looks like the kind
173 | -- of thing you get when you believe boolean should be a class and have a
174 | -- BooleanFactory to create one. But this does seem to work.
175 |
176 | local function ABPGetActionID(overlay)
177 | return 0
178 | end
179 |
180 | local function ABPGetActionInfo(overlay)
181 | local button = overlay:GetParent()
182 | local type = button:GetAttribute("type")
183 | if type == 'spell' then
184 | local spell = button:GetAttribute('spell')
185 | local info = C_Spell.GetSpellInfo(spell)
186 | if info then return type, info.spellID end
187 | elseif type == 'macro' then
188 | local id = button:GetAttribute('macro')
189 | if id then return type, id end
190 | elseif type == 'item' then
191 | local item = button:GetAttribute('item')
192 | local id = C_Item.GetItemInfoInstant(item)
193 | if id then return type, id end
194 | end
195 | end
196 |
197 | local function ABPHasAction(overlay)
198 | local button = overlay:GetParent()
199 | return not button.widget:IsEmpty()
200 | end
201 |
202 | local function ABPInitButton(actionButton)
203 | local overlay = LiteButtonAurasController:CreateOverlay(actionButton)
204 | overlay:SetFrameLevel(actionButton.widget.cooldown():GetFrameLevel() + 1)
205 |
206 | overlay.GetActionID = ABPGetActionID
207 | overlay.GetActionInfo = ABPGetActionInfo
208 | overlay.HasAction = ABPHasAction
209 |
210 | if not overlay.isHooked then
211 | actionButton:HookScript('OnAttributeChanged', function () overlay:Update() end)
212 | hooksecurefunc(actionButton.widget, 'UpdateMacroState', function () overlay:Update() end)
213 | overlay.isHooked = true
214 | end
215 | end
216 |
217 | local function ABPInitFrameWidget(actionBar)
218 | for _, actionButton in ipairs(actionBar.buttonFrames) do
219 | ABPInitButton(actionButton)
220 | end
221 | end
222 |
223 | function LBA.BarIntegrations:ActionbarPlusInit()
224 | if ABP_NS then
225 | for _, actionBar in ipairs(ABP_NS.O.ButtonFactory.FRAMES) do
226 | ABPInitFrameWidget(actionBar)
227 | end
228 | hooksecurefunc(ABP_NS.O.ButtonFactory, 'CreateButtons',
229 | function (self, fw, rowSize, colSize)
230 | ABPInitFrameWidget(fw)
231 | end)
232 | end
233 | end
234 |
235 |
236 | -- LibActionButton-1.0 and derivatives -----------------------------------------
237 |
238 | -- Covers ElvUI, Bartender. TukUI reuses the Blizzard buttons
239 |
240 | local function LABGetActionID(overlay)
241 | local actionType, action = overlay:GetParent():GetAction()
242 | if actionType == "action" then
243 | return action
244 | end
245 | end
246 |
247 | local function LABGetActionInfo(overlay)
248 | local actionType, action = overlay:GetParent():GetAction()
249 | if actionType == "action" then
250 | return GetActionInfo(action)
251 | else
252 | return actionType, action
253 | end
254 | end
255 |
256 | local function LABHasAction(overlay)
257 | local actionType, action = overlay:GetParent():GetAction()
258 | if actionType == "action" then
259 | return HasAction(action)
260 | end
261 | end
262 |
263 | local function LABInitButton(event, actionButton)
264 | local overlay = LiteButtonAurasController:CreateOverlay(actionButton)
265 | overlay.GetActionID = LABGetActionID
266 | overlay.GetActionInfo = LABGetActionInfo
267 | overlay.HasAction = LABHasAction
268 | overlay:Update()
269 | end
270 |
271 | -- LAB doesn't fire OnButtonCreated until the end of CreateButton but
272 | -- fires OnButtonUpdate in the middle, so we get Update before Create,
273 | -- hence the "if".
274 |
275 | local function LABButtonUpdate(event, actionButton)
276 | local overlay = LiteButtonAurasController:GetOverlay(actionButton)
277 | if overlay then overlay:Update() end
278 | end
279 |
280 | -- As far as I can tell there aren't any buttons at load time but just
281 | -- in case.
282 |
283 | local function LABInitAllButtons(lib)
284 | for actionButton in pairs(lib:GetAllButtons()) do
285 | LABInitButton(nil, actionButton)
286 | end
287 | end
288 |
289 | -- The %- here is a literal - instead of "zero or more repetitions". A
290 | -- few addons (most noteably ElvUI) use their own private version of
291 | -- LibActionButton with a suffix added to the name.
292 |
293 | function LBA.BarIntegrations:LABInit()
294 | for name, lib in LibStub:IterateLibraries() do
295 | if name:match('^LibActionButton%-1.0') then
296 | LABInitAllButtons(lib)
297 | lib.RegisterCallback(self, 'OnButtonCreated', LABInitButton)
298 | lib.RegisterCallback(self, 'OnButtonUpdate', LABButtonUpdate)
299 | end
300 | end
301 | end
302 |
303 | -- Init ------------------------------------------------------------------------
304 |
305 | function LBA.BarIntegrations:Initialize()
306 | self:RetailInit()
307 | self:ClassicInit()
308 | self:DominosInit()
309 | self:ButtonForgeInit()
310 | self:LABInit()
311 | self:ActionbarPlusInit()
312 | end
313 |
--------------------------------------------------------------------------------
/ClassicCompat.lua:
--------------------------------------------------------------------------------
1 | --[[----------------------------------------------------------------------------
2 |
3 | LiteButtonAuras
4 | Copyright 2021 Mike "Xodiv" Battersby
5 |
6 | For better or worse, try to back-port a minimal amount of compatibility
7 | for the 11.0 rework into classic, on the assumption that it will eventually
8 | go in there properly and this is the right approach rather than making the
9 | new way look like the old.
10 |
11 | ----------------------------------------------------------------------------]]--
12 |
13 | local _, LBA = ...
14 |
15 |
16 | -- C_Spell ---------------------------------------------------------------------
17 |
18 | LBA.C_Spell = CopyTable(C_Spell or {})
19 |
20 | if not LBA.C_Spell.GetSpellInfo then
21 | local GetSpellInfo = _G.GetSpellInfo
22 |
23 | function LBA.C_Spell.GetSpellInfo(spellIdentifier)
24 | local name, _, iconID, castTime, minRange, maxRange, spellID, originalIconID = GetSpellInfo(spellIdentifier)
25 | if name then
26 | return {
27 | name = name,
28 | iconID = iconID,
29 | originalIconID = originalIconID,
30 | castTime = castTime,
31 | minRange = minRange,
32 | maxRange = maxRange,
33 | spellID = spellID,
34 | }
35 | end
36 | end
37 | end
38 |
39 | if not LBA.C_Spell.GetSpellName then
40 | local GetSpellInfo = _G.GetSpellInfo
41 |
42 | function LBA.C_Spell.GetSpellName(spellIdentifier)
43 | local name = GetSpellInfo(spellIdentifier)
44 | return name
45 | end
46 | end
47 |
48 | if not LBA.C_Spell.GetSpellTexture then
49 | local GetSpellInfo = _G.GetSpellInfo
50 |
51 | function LBA.C_Spell.GetSpellTexture(spellIdentifier)
52 | local _, _, iconID = GetSpellInfo(spellIdentifier)
53 | return iconID
54 | end
55 | end
56 |
57 | if not LBA.C_Spell.GetSpellCooldown then
58 | local GetSpellCooldown = _G.GetSpellCooldown
59 |
60 | function LBA.C_Spell.GetSpellCooldown(spellIdentifier)
61 | local startTime, duration, isEnabled, modRate = GetSpellCooldown(spellIdentifier)
62 | if startTime then
63 | return {
64 | startTime = startTime,
65 | duration = duration,
66 | isEnabled = isEnabled,
67 | modRate = modRate,
68 | }
69 | end
70 | end
71 | end
72 |
73 |
74 | -- C_Item ----------------------------------------------------------------------
75 |
76 | LBA.C_Item = CopyTable(C_Item or {})
77 |
78 | if not LBA.C_Item.GetItemInfoInstant then
79 | LBA.C_Item.GetItemInfoInstant = _G.GetItemInfoInstant
80 | end
81 |
82 | if not LBA.C_Item.GetItemSpell then
83 | LBA.C_Item.GetItemSpell = _G.GetItemSpell
84 | end
85 |
86 |
87 | -- AuraUtil --------------------------------------------------------------------
88 |
89 | -- Classic doesn't have ForEachAura even though it has AuraUtil.
90 |
91 | LBA.AuraUtil = CopyTable(AuraUtil or {})
92 |
93 | if not AuraUtil.ForEachAura then
94 |
95 | local UnitAura = _G.UnitAura
96 |
97 | -- Turn the UnitAura returns into a facsimile of the UnitAuraInfo struct
98 | -- returned by C_UnitAuras.GetAuraDataBySlot(unit, slot)
99 |
100 | local auraInstanceID = 0
101 |
102 | local function UnitAuraData(unit, i, filter)
103 | local name, icon, count, dispelType, duration, expirationTime, source, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, castByPlayer, nameplateShowAll, timeMod = UnitAura(unit, i, filter)
104 |
105 | local isHarmful = filter:find('HARMFUL') and true or false
106 | local isHelpful = filter:find('HELPFUL') and true or false
107 |
108 | auraInstanceID = auraInstanceID + 1
109 | return {
110 | applications = count,
111 | auraInstanceID = auraInstanceID,
112 | canApplyAura = canApplyAura,
113 | -- charges = ,
114 | dispelName = dispelType,
115 | duration = duration,
116 | expirationTime = expirationTime,
117 | icon = icon,
118 | isBossAura = isBossDebuff,
119 | isFromPlayerOrPlayerPet = castByPlayer, -- player = me vs player = a player?
120 | isHarmful = isHarmful,
121 | isHelpful = isHelpful,
122 | -- isNameplateOnly =
123 | -- isRaid =
124 | isStealable = isStealable,
125 | -- maxCharges =
126 | name = name,
127 | nameplateShowAll = nameplateShowAll,
128 | nameplateShowPersonal = nameplateShowPersonal,
129 | -- points =
130 | sourceUnit = source,
131 | spellId = spellId,
132 | timeMod = timeMod,
133 | }
134 | end
135 |
136 | function LBA.AuraUtil.ForEachAura(unit, filter, maxCount, func, usePackedAura)
137 | local i = 1
138 | while true do
139 | if maxCount and i > maxCount then
140 | return
141 | elseif UnitAura(unit, i, filter) then
142 | if usePackedAura then
143 | func(UnitAuraData(unit, i, filter))
144 | else
145 | func(UnitAura(unit, i, filter))
146 | end
147 | else
148 | return
149 | end
150 | i = i + 1
151 | end
152 | end
153 |
154 | end
155 |
--------------------------------------------------------------------------------
/ColorGradient.lua:
--------------------------------------------------------------------------------
1 | --[[----------------------------------------------------------------------------
2 |
3 | LiteButtonAuras
4 | Copyright 2021 Mike "Xodiv" Battersby
5 |
6 | I took the idea for the HLS gradients from AdiButtonAuras. The code
7 | is adapated from the python colorsys module but you can find the same
8 | algorithm on StackOverflow.
9 |
10 | Benchmarking this looks like LBA.TimerRGB takes about 0.5ns to run
11 | when the timer is >10s, and 2ns to run when it has to interpolate.
12 | At 100fps this is 200ns per second which seems fine to me.
13 |
14 | That's just the color calcuating though, whether or not its a good idea
15 | to run run SetFormattedText and SetTextColor every frame is different
16 | matter. BuffFrame does it though, so I do too!
17 |
18 | ----------------------------------------------------------------------------]]--
19 |
20 | local _, LBA = ...
21 |
22 | LBA = LBA or {}
23 |
24 | local min, max = math.min, math.max
25 |
26 | local function hueToV(m1, m2, hue)
27 | hue = hue % 1
28 | if hue < 1/6 then
29 | return m1 + (m2-m1)*hue*6
30 | elseif hue < 1/2 then
31 | return m2
32 | elseif hue < 2/3 then
33 | return m1 + (m2-m1)*(2/3-hue)*6
34 | else
35 | return m1
36 | end
37 | end
38 |
39 | local function hlsToRgb(h, l, s)
40 | if s == 0 then
41 | return l, l, l
42 | end
43 | local m2
44 | if l < 0.5 then
45 | m2 = l * (1+s)
46 | else
47 | m2 = (l+s) - (l*s)
48 | end
49 | local m1 = 2*l - m2
50 | return hueToV(m1, m2, h+1/3), hueToV(m1, m2, h), hueToV(m1, m2, h-1/3)
51 | end
52 |
53 | local function rgbToHls(r, g, b)
54 | local minC, maxC = min(r, g, b), max(r, g, b)
55 | local l = (minC + maxC)/2
56 | if minC == maxC then
57 | return 0, l, 0
58 | end
59 | local h, s
60 | if l < 0.5 then
61 | s = (maxC-minC) / (maxC+minC)
62 | else
63 | s = (maxC-minC) / (2-maxC-minC)
64 | end
65 | local rc = (maxC-r) / (maxC-minC)
66 | local gc = (maxC-g) / (maxC-minC)
67 | local bc = (maxC-b) / (maxC-minC)
68 | if r == maxC then
69 | h = bc - gc
70 | elseif g == maxC then
71 | h = 2 + rc - bc
72 | else
73 | h = 4 + gc - rc
74 | end
75 | return (h/6) % 1, l, s
76 | end
77 |
78 | local function interpolateHls(perc, h1, l1, s1, h2, l2, s2)
79 | -- L and S are linear interpolated
80 | local l = l1 + (l2-l1) * perc
81 | local s = s1 + (s2-s1) * perc
82 |
83 | -- Hue is a degree coordinate in radians on a circle that wraps. We want
84 | -- the smallest of the two angles between them.
85 | local dh = h2 - h1
86 | if dh < -0.5 then
87 | dh = dh + 1
88 | elseif dh > 0.5 then
89 | dh = dh - 1
90 | end
91 |
92 | local h = (h1 + dh*perc) % 1
93 | return h, l, s
94 | end
95 |
96 | -- Colors in HLS so we don't have to do the math to convert them every frame.
97 | -- These are brighter than the pure rgb because the 1,0,0 red is too hard to
98 | -- see.
99 |
100 | local Red = { 0, 0.75, 1 }
101 | local Yellow = { 1/6, 0.75, 1 }
102 | local White = { 0, 1, 0 }
103 |
104 | -- In theory this could be memoized for the values < 10s because they are
105 | -- truncated to 0.1 of a second before this is called. But I don't know
106 | -- enough about math.ceil to know if that's safe, and I'm guaranteed to
107 | -- forget that at some point and blow out memory infinitely.
108 |
109 | function LBA.TimerRGB(duration)
110 | if duration <= 3 then
111 | return hlsToRgb(
112 | interpolateHls(
113 | duration/3,
114 | Red[1], Red[2], Red[3],
115 | Yellow[1], Yellow[2], Yellow[3]
116 | )
117 | )
118 | elseif duration <= 10 then
119 | return hlsToRgb(
120 | interpolateHls(
121 | (duration-3)/7,
122 | Yellow[1], Yellow[2], Yellow[3],
123 | White[1], White[2], White[3]
124 | )
125 | )
126 | else
127 | return 1, 1, 1
128 | end
129 | end
130 |
131 | --@debug@
132 | LBA.interpolateHls = interpolateHls
133 | LBA.rgbToHls = rgbToHls
134 | LBA.hlsToRgb = hlsToRgb
135 | --@end-debug@
136 |
--------------------------------------------------------------------------------
/Controller.lua:
--------------------------------------------------------------------------------
1 | --[[----------------------------------------------------------------------------
2 |
3 | LiteButtonAuras
4 | Copyright 2021 Mike "Xodiv" Battersby
5 |
6 | This is the event handler and state updater. Watches for the buffs and
7 | updates LBA.state, then calls overlay:Update() on all actionbutton overlays
8 | when required.
9 |
10 | ----------------------------------------------------------------------------]]--
11 |
12 | local addonName, LBA = ...
13 |
14 | local C_Spell = LBA.C_Spell or C_Spell
15 |
16 | local L = LBA.L
17 |
18 | LBA.state = {
19 | player = {
20 | buffs = {},
21 | debuffs = {},
22 | totems = {},
23 | weaponEnchants = {},
24 | channel = nil,
25 | },
26 | pet = {
27 | buffs = {},
28 | debuffs = {},
29 | },
30 | target = {
31 | buffs = {},
32 | debuffs = {},
33 | interrupt = nil,
34 | },
35 | }
36 |
37 |
38 | --[[------------------------------------------------------------------------]]--
39 |
40 | -- Cache some things to be faster. This is annoying but it's really a lot
41 | -- faster. Only do this for things that are called in the event loop otherwise
42 | -- it's just a pain to maintain.
43 |
44 | local AuraUtil = LBA.AuraUtil or AuraUtil
45 | local GetTotemInfo = GetTotemInfo
46 | local MAX_TOTEMS = MAX_TOTEMS
47 | local UnitCanAttack = UnitCanAttack
48 | local UnitCastingInfo = UnitCastingInfo
49 | local UnitChannelInfo = UnitChannelInfo
50 | local WOW_PROJECT_ID = WOW_PROJECT_ID
51 |
52 | --[[------------------------------------------------------------------------]]--
53 |
54 | -- Load and set up dependencies for Masque support. Because we make our own
55 | -- frame and don't touch the ActionButton itself (avoids a LOT of taint issues)
56 | -- we have to make our own masque group. It's a bit weird because it lets you
57 | -- style LBA differently from the ActionButton, but it's the simplest way.
58 |
59 | local Masque = LibStub('Masque', true)
60 | local MasqueGroup = Masque and Masque:Group(addonName)
61 |
62 |
63 | --[[------------------------------------------------------------------------]]--
64 |
65 | LiteButtonAurasControllerMixin = {}
66 |
67 | function LiteButtonAurasControllerMixin:OnLoad()
68 | self.overlayFrames = {}
69 | self:RegisterEvent('PLAYER_LOGIN')
70 | end
71 |
72 | function LiteButtonAurasControllerMixin:Initialize()
73 |
74 | -- At init time C_Item.GetItemSpell might not work because they are not
75 | -- in the cache. I think the actionbar will keep them in the cache the rest
76 | -- of the time. Relies on ITEM_DATA_LOAD_RESULT.
77 | LBA.buttonItemIDs = {}
78 |
79 | LBA.InitializeOptions()
80 | LBA.InitializeGUIOptions()
81 | LBA.SetupSlashCommand()
82 | LBA.UpdateAuraMap()
83 |
84 | -- Now this is be delayed until PLAYER_LOGIN do we still need to list
85 | -- list all possible LibActionButton derivatives in the TOC dependencies?
86 | LBA.BarIntegrations:Initialize()
87 |
88 | self:RegisterEvent('UNIT_AURA')
89 | self:RegisterEvent('PLAYER_ENTERING_WORLD')
90 | self:RegisterEvent('PLAYER_TARGET_CHANGED')
91 | self:RegisterEvent('PLAYER_TOTEM_UPDATE')
92 | if WOW_PROJECT_ID == 1 then
93 | self:RegisterEvent('WEAPON_ENCHANT_CHANGED')
94 | self:RegisterEvent('WEAPON_SLOT_CHANGED')
95 | end
96 |
97 | -- All of these are for the interrupt and player channel detection
98 | self:RegisterEvent('UNIT_SPELLCAST_START')
99 | self:RegisterEvent('UNIT_SPELLCAST_STOP')
100 | self:RegisterEvent('UNIT_SPELLCAST_DELAYED')
101 | self:RegisterEvent('UNIT_SPELLCAST_FAILED')
102 | self:RegisterEvent('UNIT_SPELLCAST_INTERRUPTED')
103 | self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_START')
104 | self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_STOP')
105 | self:RegisterEvent('UNIT_SPELLCAST_CHANNEL_UPDATE')
106 | self:RegisterEvent('UNIT_SPELLCAST_INTERRUPTIBLE')
107 | self:RegisterEvent('UNIT_SPELLCAST_NOT_INTERRUPTIBLE')
108 | self:RegisterEvent('ITEM_DATA_LOAD_RESULT')
109 |
110 | LBA.db.RegisterCallback(self, 'OnModified', 'StyleAllOverlays')
111 | end
112 |
113 | function LiteButtonAurasControllerMixin:CreateOverlay(actionButton)
114 | if not self.overlayFrames[actionButton] then
115 | local name = actionButton:GetName() .. "LiteButtonAurasOverlay"
116 | local overlay = CreateFrame('Frame', name, actionButton, "LiteButtonAurasOverlayTemplate")
117 | self.overlayFrames[actionButton] = overlay
118 | if MasqueGroup then
119 | MasqueGroup:AddButton(overlay, {
120 | SpellHighlight = overlay.Glow,
121 | Normal = false,
122 | -- Duration = overlay.Timer,
123 | -- Count = overlay.Count,
124 | })
125 | end
126 | end
127 | return self.overlayFrames[actionButton]
128 | end
129 |
130 | function LiteButtonAurasControllerMixin:GetOverlay(actionButton)
131 | return self.overlayFrames[actionButton]
132 | end
133 |
134 | function LiteButtonAurasControllerMixin:UpdateAllOverlays(stateOnly)
135 | for _, overlay in pairs(self.overlayFrames) do
136 | overlay:Update(stateOnly)
137 | end
138 | end
139 |
140 | function LiteButtonAurasControllerMixin:StyleAllOverlays()
141 | for _, overlay in pairs(self.overlayFrames) do
142 | overlay:Style()
143 | overlay:Update()
144 | end
145 | end
146 |
147 | function LiteButtonAurasControllerMixin:DumpAllOverlays()
148 | self:UpdateAllOverlays()
149 | local sortedOverlays = GetValuesArray(self.overlayFrames)
150 | table.sort(sortedOverlays, function (a, b) return a:GetActionID() < b:GetActionID() end)
151 | for _, overlay in pairs(sortedOverlays) do
152 | overlay:Dump()
153 | end
154 | end
155 |
156 | --[[------------------------------------------------------------------------]]--
157 |
158 | -- State updating local functions
159 |
160 | -- This could be made (probably) more efficient by using the 10.0 event
161 | -- argument auraUpdateInfo at the price of losing classic compatibility.
162 | --
163 | -- "Probably" because once you do that you have to do your own "filtering"
164 | -- duplicating the 'HELPFUL PLAYER' etc. and iterate over a bunch of auras
165 | -- that aren't relevant here. It depends on how efficient the filter in
166 | -- UnitAuraSlots is (and by extension AuraUtil.ForEachAura). Would also have
167 | -- to either index them by auraInstanceID + scan for name in overlay, or
168 | -- keep indexing them by name and scan for auraInstanceID when updating.
169 |
170 | -- There's no point guessing at what would be better performance, if you're
171 | -- going to try to improve then measure it. Potentials for performance
172 | -- improvement (but measure!):
173 | --
174 | -- * limit the aura scans by using a dirty/sweep
175 | -- * use the UNIT_AURA push data (as above)
176 | --
177 | -- Overall the 10.0 changes are not that helpful for matching by name.
178 | --
179 | -- It's worth noting that the 10.0 BuffFrame still uses the same mechanism
180 | -- as used here, but both the CompactUnitFrame and the TargetFrame have
181 | -- switched to using the new ways.
182 | --
183 | -- {
184 | -- applications = 0,
185 | -- auraInstanceID = 154047,
186 | -- canApplyAura = true,
187 | -- duration = 3600,
188 | -- expirationTime = 9109.109,
189 | -- icon = 136051,
190 | -- isBossAura = false,
191 | -- isFromPlayerOrPlayerPet = true,
192 | -- isHarmful = false,
193 | -- isHelpful = true,
194 | -- isNameplateOnly = false,
195 | -- isRaid = false,
196 | -- isStealable = false
197 | -- name = "Lightning Shield",
198 | -- nameplateShowAll = false,
199 | -- nameplateShowPersonal = false,
200 | -- points = { },
201 | -- sourceUnit = "player",
202 | -- spellId = 192106,
203 | -- timeMod = 1,
204 | -- }
205 | --
206 | -- https://warcraft.wiki.gg/wiki/API_C_UnitAuras.GetAuraDataBySlot
207 |
208 | -- Also add a duplicate with any override name. This is awkward but there's no
209 | -- inverse of C_Spell.GetOverrideSpell.
210 | --
211 | -- C_Spell.GetOverrideSpell returns the same ID if passed in an ID that's not
212 | -- overridden (seems like no check is done if it's a valid spell or not).
213 | --
214 | -- It will return 0 if given a string that doesn't match to an ID (and not nil
215 | -- like all the other C_Spell.GetX functions).
216 | --
217 | -- We call it with auraData.name because some of our faked up auraData (like
218 | -- for weapon enchants) doesn't have a spellId in it.
219 |
220 | local function UpdateTableAura(t, auraData)
221 | t[auraData.name] = auraData
222 | if C_Spell.GetOverrideSpell then
223 | local overrideID = C_Spell.GetOverrideSpell(auraData.name)
224 | local overrideName = C_Spell.GetSpellName(overrideID)
225 | if overrideName and overrideName ~= auraData.name then
226 | -- Doesn't update the spell name in the auraData only the index name
227 | t[overrideName] = auraData
228 | end
229 | end
230 | end
231 |
232 | -- Fake AuraData for weapon enchants, see BuffFrame.lua for how WoW does it
233 | local function WeaponEnchantAuraData(duration, charges, id)
234 | local name = LBA.WeaponEnchantSpellID[id]
235 | if name then
236 | return {
237 | isTempEnchant = true,
238 | auraType = "TempEnchant",
239 | applications = charges,
240 | duration = 0,
241 | expirationTime = GetTime() + duration/1000,
242 | name = name,
243 | }
244 | end
245 | end
246 |
247 | local function UpdateWeaponEnchants()
248 | -- Classic doesn't have the events to do this efficiently
249 | if WOW_PROJECT_ID ~= 1 then return end
250 |
251 | LBA.state.player.weaponEnchants = {}
252 |
253 | local mhEnchant, mhDuration, mhCharges, mhID,
254 | ohEnchant, ohDuration, ohCharges, ohID = GetWeaponEnchantInfo()
255 |
256 | if mhEnchant then
257 | local auraData = WeaponEnchantAuraData(mhDuration, mhCharges, mhID)
258 | if auraData then
259 | UpdateTableAura(LBA.state.player.weaponEnchants, auraData)
260 | end
261 | end
262 | if ohEnchant then
263 | local auraData = WeaponEnchantAuraData(ohDuration, ohCharges, ohID)
264 | if auraData then
265 | UpdateTableAura(LBA.state.player.weaponEnchants, auraData)
266 | end
267 | end
268 | end
269 |
270 | local function UpdateUnitAuras(unit, auraInfo)
271 |
272 | -- XXX TODO handle auraInfo for efficiency
273 |
274 | LBA.state[unit].buffs = {}
275 | LBA.state[unit].debuffs = {}
276 |
277 | if UnitCanAttack('player', unit) then
278 | -- Hostile target buffs are only for dispels
279 | AuraUtil.ForEachAura(unit, 'HELPFUL', nil,
280 | function (auraData)
281 | UpdateTableAura(LBA.state[unit].buffs, auraData)
282 | end,
283 | true)
284 | AuraUtil.ForEachAura(unit, 'HARMFUL PLAYER', nil,
285 | function (auraData)
286 | UpdateTableAura(LBA.state[unit].debuffs, auraData)
287 | end,
288 | true)
289 | else
290 | AuraUtil.ForEachAura(unit, 'HELPFUL PLAYER', nil,
291 | function (auraData)
292 | UpdateTableAura(LBA.state[unit].buffs, auraData)
293 | end,
294 | true)
295 | -- Inclue long-lasting buffs we can cast even if applied
296 | -- by someone else, since we don't care who cast Battle Shout, etc.
297 | AuraUtil.ForEachAura(unit, 'HELPFUL RAID', nil,
298 | function (auraData)
299 | if auraData.duration >= 10*60 then
300 | UpdateTableAura(LBA.state[unit].buffs, auraData)
301 | end
302 | end,
303 | true)
304 | end
305 | end
306 |
307 | local function UpdatePlayerChannel()
308 | LBA.state.player.channel = UnitChannelInfo('player')
309 | end
310 |
311 | local function UpdatePlayerTotems()
312 | LBA.state.player.totems = {}
313 | for i = 1, MAX_TOTEMS do
314 | local exists, name, startTime, duration, model = GetTotemInfo(i)
315 | if exists and name then
316 | if model then
317 | name = LBA.TotemOrGuardianModels[model] or name
318 | end
319 | LBA.state.player.totems[name] = startTime + duration
320 | end
321 | end
322 | end
323 |
324 | local function UpdateUnitInterupt(unit)
325 | local name, endTime, cantInterrupt, _
326 |
327 | if UnitCanAttack('player', unit) then
328 | name, _, _, _, endTime, _, _, cantInterrupt = UnitCastingInfo(unit)
329 | if name and not cantInterrupt then
330 | LBA.state[unit].interrupt = endTime / 1000
331 | return
332 | end
333 |
334 | name, _, _, _, endTime, _, cantInterrupt = UnitChannelInfo(unit)
335 | if name and not cantInterrupt then
336 | LBA.state[unit].interrupt = endTime / 1000
337 | return
338 | end
339 | end
340 |
341 | LBA.state[unit].interrupt = nil
342 | end
343 |
344 |
345 | --[[------------------------------------------------------------------------]]--
346 |
347 | function LiteButtonAurasControllerMixin:MarkOverlaysDirty(stateOnly)
348 | -- Tri-state encodes stateOnly : nil / true / false
349 | self.isOverlayDirty = ( stateOnly == true and self.isOverlayDirty ~= false )
350 | end
351 |
352 | -- Limit UNIT_AURA and UNIT_SPELLCAST overlay updates to one per frame
353 | function LiteButtonAurasControllerMixin:OnUpdate()
354 | if self.isOverlayDirty ~= nil then
355 | self:UpdateAllOverlays(self.isOverlayDirty)
356 | self.isOverlayDirty = nil
357 | end
358 | end
359 |
360 | function LiteButtonAurasControllerMixin:IsTrackedUnit(unit)
361 | if unit == 'player' or unit == 'pet' or unit == 'target' then
362 | return true
363 | else
364 | return false
365 | end
366 | end
367 |
368 | function LiteButtonAurasControllerMixin:OnEvent(event, ...)
369 | if event == 'PLAYER_LOGIN' then
370 | self:Initialize()
371 | self:UnregisterEvent('PLAYER_LOGIN')
372 | self:MarkOverlaysDirty()
373 | return
374 | elseif event == 'PLAYER_ENTERING_WORLD' then
375 | UpdateUnitAuras('target')
376 | UpdateUnitInterupt('target')
377 | UpdateWeaponEnchants()
378 | UpdateUnitAuras('player')
379 | UpdateUnitAuras('pet')
380 | UpdatePlayerChannel()
381 | UpdatePlayerTotems()
382 | self:MarkOverlaysDirty()
383 | elseif event == 'PLAYER_TARGET_CHANGED' then
384 | UpdateUnitAuras('target')
385 | UpdateUnitInterupt('target')
386 | self:MarkOverlaysDirty(true)
387 | elseif event == 'UNIT_AURA' then
388 | -- This fires a lot. Be careful. In DF, UNIT_AURA seems to tick every
389 | -- second for 'player' with no updates
390 | local unit, unitAuraUpdateInfo = ...
391 | if self:IsTrackedUnit(unit) then
392 | UpdateUnitAuras(unit, unitAuraUpdateInfo)
393 | -- Shouldn't be needed but weapon enchant duration is returned
394 | -- wrongly as 0 at PLAYER_LOGIN. This is how Blizzard works around
395 | -- it too. Their server code must be a nightmare.
396 | if unit == 'player' then UpdateWeaponEnchants() end
397 | self:MarkOverlaysDirty(true)
398 | end
399 | elseif event == 'PLAYER_TOTEM_UPDATE' then
400 | UpdatePlayerTotems()
401 | self:MarkOverlaysDirty(true)
402 | elseif event == 'WEAPON_ENCHANT_CHANGED' or event == 'WEAPON_SLOT_CHANGED' then
403 | UpdateWeaponEnchants()
404 | self:MarkOverlaysDirty(true)
405 | elseif event:sub(1, 14) == 'UNIT_SPELLCAST' then
406 | -- This fires a lot too, same applies as UNIT_AURA.
407 | local unit = ...
408 | if unit == 'player' then
409 | UpdatePlayerChannel()
410 | self:MarkOverlaysDirty(true)
411 | elseif self:IsTrackedUnit(unit) then
412 | UpdateUnitInterupt(unit)
413 | self:MarkOverlaysDirty(true)
414 | end
415 | elseif event == 'ITEM_DATA_LOAD_RESULT' then
416 | local itemID, success = ...
417 | if LBA.buttonItemIDs[itemID] then
418 | self:MarkOverlaysDirty()
419 | end
420 | end
421 | end
422 |
--------------------------------------------------------------------------------
/Controller.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) {year} {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | {project} Copyright (C) {year} {fullname}
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/LiteButtonAuras.toc:
--------------------------------------------------------------------------------
1 | ## Interface: 110105, 40402, 11507
2 | ## Title: LiteButtonAuras
3 | ## IconTexture: Interface\Icons\ability_deathknight_heartstopaura
4 | ## AddonCompartmentFunc: LiteButtonAuras_AddonCompartmentFunc
5 | ## Version: @project-version@
6 | ## Author: Xodiv-Nagrand
7 | ## Email: mib@post.com
8 | ## OptionalDeps: Bartender4, Dominos, ElvUI, Masque
9 | ## SavedVariables: LiteButtonAurasDB
10 | ## X-Category: Interface
11 | ## X-Curse-Project-ID: 526431
12 | ## X-WoWI-ID: 26528
13 | ## X-Wago-ID: QNlq296e
14 | ## Category: Buffs & Debuffs
15 | ## Category-deDE: Buffs & Debuffs
16 | ## Category-esES: Beneficios y Perjuicios
17 | ## Category-esMX: Beneficios y Perjuicios
18 | ## Category-frFR: Améliorations et Affaiblissements
19 | ## Category-itIT: Benefici e penalità
20 | ## Category-koKR: 강화 및 약화 효과
21 | ## Category-ptBR: Bônus e Penalidades
22 | ## Category-ruRU: Баффы и дебаффы
23 | ## Category-zhCN: 增益和减益
24 | ## Category-zhTW: 增益與減益
25 | embeds.xml
26 |
27 | Localization.lua
28 | ClassicCompat.lua
29 | SpellData.lua
30 | ColorGradient.lua
31 | BarIntegrations.lua
32 | SlashCommand.lua
33 | Options.lua
34 | Overlay.xml
35 | Controller.xml
36 |
37 | UI\AceGUIWidgets-LBAAnchorButtons.lua
38 | UI\AceGUIWidgets-LBAInputFocus.lua
39 | UI\AceGUIWidgets-LBAInputSpellID.lua
40 | UI\Options.lua
41 |
--------------------------------------------------------------------------------
/Localization.lua:
--------------------------------------------------------------------------------
1 | --[[----------------------------------------------------------------------------
2 |
3 | LiteButtonAuras
4 | Copyright 2024 Mike "Xodiv" Battersby
5 |
6 | 您好,請幫忙翻譯一下
7 | https://legacy.curseforge.com/wow/addons/litebuttonauras/localization
8 | https://github.com/xod-wow/LiteButtonAuras/issues
9 |
10 | ----------------------------------------------------------------------------]]--
11 |
12 | local _, LBA = ...
13 |
14 | LBA.L = setmetatable({}, { __index = function (_,k) return k end })
15 |
16 | local L = LBA.L
17 |
18 | local locale = GetLocale()
19 |
20 | -- :r! sh fetchlocale.sh -------------------------------------------------------
21 |
22 | -- deDE ------------------------------------------------------------------------
23 |
24 | if locale == "deDE" then
25 | L = L or {}
26 | --[[ L["Add ability"] = ""--]]
27 | --[[ L["Aura list"] = ""--]]
28 | --[[ L["Automatically match auras to abilities by name."] = ""--]]
29 | L["Bottom"] = "Unten"
30 | L["Bottom left"] = "Unten Links"
31 | L["Bottom right"] = "Unten Rechts"
32 | L["Center"] = "Mitte"
33 | L["Color aura duration timers based on remaining time."] = "Timer für die Dauer der Farbaura basierend auf der verbleibenden Zeit."
34 | L["Display aura duration timers."] = "Zeigt Timer für die Dauer der Aura an."
35 | --[[ L["Display buffs cast by you on your pet."] = ""--]]
36 | --[[ L["Error: unknown ability spell: %s"] = ""--]]
37 | --[[ L["Error: unknown aura spell: %s"] = ""--]]
38 | --[[ L["Error: unknown spell: %s"] = ""--]]
39 | L["Extra aura displays"] = "Zusätzliche Aura-Displays"
40 | L["Font name"] = "Schriftartenname"
41 | L["Font size"] = "Schriftgröße"
42 | L["For spells that aren't in your spell book use the spell ID number."] = "Verwenden Sie für Zaubersprüche, die nicht in Ihrem Zauberbuch enthalten sind, die Zauber-ID-Nummer."
43 | L["Highlight buttons for interrupt and soothe."] = "Markieren Sie die Schaltflächen zum Tritt und Besänftigen"
44 | --[[ L["If you disable this option, only auras explicitly configured under \"Extra aura displays\" will be shown."] = ""--]]
45 | L["Ignored abilities"] = "Ignorierte Fähigkeiten"
46 | L["Left"] = "Links"
47 | --[[ L["on"] = ""--]]
48 | L["On ability"] = "bei Fähigkeit"
49 | L["Right"] = "Rechts"
50 | L["Show aura"] = "Zeige Aura"
51 | L["Show aura stacks."] = "Aura-Stapel anzeigen."
52 | L["Show fractions of a second on timers."] = "Zeigen Sie Sekundenbruchteile auf Timern an."
53 | L["Stack text offset"] = "Stapelversatz"
54 | L["Stack text position"] = "Stapelanker"
55 | --[[ L["Text positions"] = ""--]]
56 | L["Timer text offset"] = "Zeitgeberort Offset"
57 | L["Timer text position"] = "Timer-Anker"
58 | L["Top"] = "Oben"
59 | L["Top left"] = "Oben Links"
60 | L["Top right"] = "Oben Rechts"
61 | --[[ L["Wiping aura list."] = ""--]]
62 | end
63 |
64 | -- esES / esMX -----------------------------------------------------------------
65 |
66 | if locale == "esES" or locale == "esMX" then
67 | L = L or {}
68 | --[[ L["Add ability"] = ""--]]
69 | --[[ L["Aura list"] = ""--]]
70 | --[[ L["Automatically match auras to abilities by name."] = ""--]]
71 | L["Bottom"] = "Abajo"
72 | L["Bottom left"] = "Abajo Izquierda"
73 | L["Bottom right"] = "Abajo Derecha"
74 | L["Center"] = "Centro"
75 | --[[ L["Color aura duration timers based on remaining time."] = ""--]]
76 | --[[ L["Display aura duration timers."] = ""--]]
77 | --[[ L["Display buffs cast by you on your pet."] = ""--]]
78 | --[[ L["Error: unknown ability spell: %s"] = ""--]]
79 | --[[ L["Error: unknown aura spell: %s"] = ""--]]
80 | --[[ L["Error: unknown spell: %s"] = ""--]]
81 | --[[ L["Extra aura displays"] = ""--]]
82 | --[[ L["Font name"] = ""--]]
83 | L["Font size"] = "Tamaño de fuente"
84 | --[[ L["For spells that aren't in your spell book use the spell ID number."] = ""--]]
85 | --[[ L["Highlight buttons for interrupt and soothe."] = ""--]]
86 | --[[ L["If you disable this option, only auras explicitly configured under \"Extra aura displays\" will be shown."] = ""--]]
87 | --[[ L["Ignored abilities"] = ""--]]
88 | L["Left"] = "Izquierda"
89 | --[[ L["on"] = ""--]]
90 | --[[ L["On ability"] = ""--]]
91 | L["Right"] = "Derecha"
92 | --[[ L["Show aura"] = ""--]]
93 | --[[ L["Show aura stacks."] = ""--]]
94 | --[[ L["Show fractions of a second on timers."] = ""--]]
95 | --[[ L["Stack text offset"] = ""--]]
96 | --[[ L["Stack text position"] = ""--]]
97 | --[[ L["Text positions"] = ""--]]
98 | --[[ L["Timer text offset"] = ""--]]
99 | --[[ L["Timer text position"] = ""--]]
100 | L["Top"] = "Superior"
101 | L["Top left"] = "Superior izquierda"
102 | L["Top right"] = "Superior derecha"
103 | --[[ L["Wiping aura list."] = ""--]]
104 | end
105 |
106 | -- frFR ------------------------------------------------------------------------
107 |
108 | if locale == "frFR" then
109 | L = L or {}
110 | --[[ L["Add ability"] = ""--]]
111 | --[[ L["Aura list"] = ""--]]
112 | --[[ L["Automatically match auras to abilities by name."] = ""--]]
113 | L["Bottom"] = "Bas"
114 | L["Bottom left"] = "Bas Gauche"
115 | L["Bottom right"] = "Bas Droite"
116 | L["Center"] = "Centre"
117 | --[[ L["Color aura duration timers based on remaining time."] = ""--]]
118 | --[[ L["Display aura duration timers."] = ""--]]
119 | --[[ L["Display buffs cast by you on your pet."] = ""--]]
120 | --[[ L["Error: unknown ability spell: %s"] = ""--]]
121 | --[[ L["Error: unknown aura spell: %s"] = ""--]]
122 | --[[ L["Error: unknown spell: %s"] = ""--]]
123 | --[[ L["Extra aura displays"] = ""--]]
124 | --[[ L["Font name"] = ""--]]
125 | L["Font size"] = "Taille de Police"
126 | --[[ L["For spells that aren't in your spell book use the spell ID number."] = ""--]]
127 | --[[ L["Highlight buttons for interrupt and soothe."] = ""--]]
128 | --[[ L["If you disable this option, only auras explicitly configured under \"Extra aura displays\" will be shown."] = ""--]]
129 | --[[ L["Ignored abilities"] = ""--]]
130 | L["Left"] = "Gauche"
131 | --[[ L["on"] = ""--]]
132 | --[[ L["On ability"] = ""--]]
133 | L["Right"] = "Droite"
134 | --[[ L["Show aura"] = ""--]]
135 | --[[ L["Show aura stacks."] = ""--]]
136 | --[[ L["Show fractions of a second on timers."] = ""--]]
137 | --[[ L["Stack text offset"] = ""--]]
138 | --[[ L["Stack text position"] = ""--]]
139 | --[[ L["Text positions"] = ""--]]
140 | --[[ L["Timer text offset"] = ""--]]
141 | --[[ L["Timer text position"] = ""--]]
142 | L["Top"] = "Haut"
143 | L["Top left"] = "Haut Gauche"
144 | L["Top right"] = "Haut Droite"
145 | --[[ L["Wiping aura list."] = ""--]]
146 | end
147 |
148 | -- itIT ------------------------------------------------------------------------
149 |
150 | if locale == "itIT" then
151 | L = L or {}
152 | --[[ L["Add ability"] = ""--]]
153 | --[[ L["Aura list"] = ""--]]
154 | --[[ L["Automatically match auras to abilities by name."] = ""--]]
155 | L["Bottom"] = "Basso"
156 | L["Bottom left"] = "Basso a sinistra"
157 | L["Bottom right"] = "Basso a destra"
158 | L["Center"] = "Centro"
159 | --[[ L["Color aura duration timers based on remaining time."] = ""--]]
160 | --[[ L["Display aura duration timers."] = ""--]]
161 | --[[ L["Display buffs cast by you on your pet."] = ""--]]
162 | --[[ L["Error: unknown ability spell: %s"] = ""--]]
163 | --[[ L["Error: unknown aura spell: %s"] = ""--]]
164 | --[[ L["Error: unknown spell: %s"] = ""--]]
165 | --[[ L["Extra aura displays"] = ""--]]
166 | --[[ L["Font name"] = ""--]]
167 | --[[ L["Font size"] = ""--]]
168 | --[[ L["For spells that aren't in your spell book use the spell ID number."] = ""--]]
169 | --[[ L["Highlight buttons for interrupt and soothe."] = ""--]]
170 | --[[ L["If you disable this option, only auras explicitly configured under \"Extra aura displays\" will be shown."] = ""--]]
171 | --[[ L["Ignored abilities"] = ""--]]
172 | L["Left"] = "Left"
173 | --[[ L["on"] = ""--]]
174 | --[[ L["On ability"] = ""--]]
175 | L["Right"] = "Right"
176 | --[[ L["Show aura"] = ""--]]
177 | --[[ L["Show aura stacks."] = ""--]]
178 | --[[ L["Show fractions of a second on timers."] = ""--]]
179 | --[[ L["Stack text offset"] = ""--]]
180 | --[[ L["Stack text position"] = ""--]]
181 | --[[ L["Text positions"] = ""--]]
182 | --[[ L["Timer text offset"] = ""--]]
183 | --[[ L["Timer text position"] = ""--]]
184 | L["Top"] = "Top"
185 | L["Top left"] = "Top Left"
186 | L["Top right"] = "Top Right"
187 | --[[ L["Wiping aura list."] = ""--]]
188 | end
189 |
190 | -- koKR ------------------------------------------------------------------------
191 |
192 | if locale == "koKR" then
193 | L = L or {}
194 | --[[ L["Add ability"] = ""--]]
195 | --[[ L["Aura list"] = ""--]]
196 | --[[ L["Automatically match auras to abilities by name."] = ""--]]
197 | L["Bottom"] = "아래"
198 | L["Bottom left"] = "왼쪽 아래"
199 | L["Bottom right"] = "오른쪽 아래"
200 | L["Center"] = "중앙"
201 | L["Color aura duration timers based on remaining time."] = "남은 시간을 기준으로 오라 지속 시간 타이머에 색상을 지정합니다."
202 | L["Display aura duration timers."] = "오라 지속 시간 타이머를 표시합니다."
203 | --[[ L["Display buffs cast by you on your pet."] = ""--]]
204 | --[[ L["Error: unknown ability spell: %s"] = ""--]]
205 | --[[ L["Error: unknown aura spell: %s"] = ""--]]
206 | --[[ L["Error: unknown spell: %s"] = ""--]]
207 | --[[ L["Extra aura displays"] = ""--]]
208 | L["Font name"] = "글꼴"
209 | L["Font size"] = "글꼴 크기"
210 | --[[ L["For spells that aren't in your spell book use the spell ID number."] = ""--]]
211 | --[[ L["Highlight buttons for interrupt and soothe."] = ""--]]
212 | --[[ L["If you disable this option, only auras explicitly configured under \"Extra aura displays\" will be shown."] = ""--]]
213 | --[[ L["Ignored abilities"] = ""--]]
214 | L["Left"] = "왼쪽"
215 | --[[ L["on"] = ""--]]
216 | --[[ L["On ability"] = ""--]]
217 | L["Right"] = "오른쪽"
218 | --[[ L["Show aura"] = ""--]]
219 | --[[ L["Show aura stacks."] = ""--]]
220 | --[[ L["Show fractions of a second on timers."] = ""--]]
221 | --[[ L["Stack text offset"] = ""--]]
222 | --[[ L["Stack text position"] = ""--]]
223 | --[[ L["Text positions"] = ""--]]
224 | --[[ L["Timer text offset"] = ""--]]
225 | --[[ L["Timer text position"] = ""--]]
226 | L["Top"] = "위"
227 | L["Top left"] = "왼쪽 위"
228 | L["Top right"] = "오른쪽 위"
229 | --[[ L["Wiping aura list."] = ""--]]
230 | end
231 |
232 | -- ptBR ------------------------------------------------------------------------
233 |
234 | if locale == "ptBR" then
235 | L = L or {}
236 | --[[ L["Add ability"] = ""--]]
237 | --[[ L["Aura list"] = ""--]]
238 | --[[ L["Automatically match auras to abilities by name."] = ""--]]
239 | L["Bottom"] = "Embaixo"
240 | L["Bottom left"] = "Embaixo à esquerda"
241 | L["Bottom right"] = "Embaixo à direita"
242 | L["Center"] = "Centro"
243 | --[[ L["Color aura duration timers based on remaining time."] = ""--]]
244 | --[[ L["Display aura duration timers."] = ""--]]
245 | --[[ L["Display buffs cast by you on your pet."] = ""--]]
246 | --[[ L["Error: unknown ability spell: %s"] = ""--]]
247 | --[[ L["Error: unknown aura spell: %s"] = ""--]]
248 | --[[ L["Error: unknown spell: %s"] = ""--]]
249 | --[[ L["Extra aura displays"] = ""--]]
250 | --[[ L["Font name"] = ""--]]
251 | --[[ L["Font size"] = ""--]]
252 | --[[ L["For spells that aren't in your spell book use the spell ID number."] = ""--]]
253 | --[[ L["Highlight buttons for interrupt and soothe."] = ""--]]
254 | --[[ L["If you disable this option, only auras explicitly configured under \"Extra aura displays\" will be shown."] = ""--]]
255 | --[[ L["Ignored abilities"] = ""--]]
256 | L["Left"] = "Esquerda"
257 | --[[ L["on"] = ""--]]
258 | --[[ L["On ability"] = ""--]]
259 | L["Right"] = "Direita"
260 | --[[ L["Show aura"] = ""--]]
261 | --[[ L["Show aura stacks."] = ""--]]
262 | --[[ L["Show fractions of a second on timers."] = ""--]]
263 | --[[ L["Stack text offset"] = ""--]]
264 | --[[ L["Stack text position"] = ""--]]
265 | --[[ L["Text positions"] = ""--]]
266 | --[[ L["Timer text offset"] = ""--]]
267 | --[[ L["Timer text position"] = ""--]]
268 | L["Top"] = "Topo"
269 | L["Top left"] = "Topo à esquerda"
270 | L["Top right"] = "Topo à direita"
271 | --[[ L["Wiping aura list."] = ""--]]
272 | end
273 |
274 | -- ruRU ------------------------------------------------------------------------
275 |
276 | if locale == "ruRU" then
277 | L = L or {}
278 | L["Add ability"] = "Добавить способность"
279 | L["Aura list"] = "Список аур"
280 | L["Automatically match auras to abilities by name."] = "Автоматически сопоставлять ауры со способностями по названию."
281 | L["Bottom"] = "Снизу"
282 | L["Bottom left"] = "Снизу слева"
283 | L["Bottom right"] = "Снизу справа"
284 | L["Center"] = "Центр"
285 | L["Color aura duration timers based on remaining time."] = "Таймеры длительности цветной ауры основаны на оставшемся времени."
286 | L["Display aura duration timers."] = "Отображение таймеров длительности ауры."
287 | L["Display buffs cast by you on your pet."] = "Отображение усилений, наложенных вами на вашего питомца."
288 | L["Error: unknown ability spell: %s"] = "Ошибка: неизвестная способность заклинания: %s"
289 | L["Error: unknown aura spell: %s"] = "Ошибка: неизвестное заклинание ауры: %s"
290 | L["Error: unknown spell: %s"] = "Ошибка: неизвестное заклинание: %s"
291 | L["Extra aura displays"] = "Дополнительные дисплеи аур"
292 | L["Font name"] = "Шрифт"
293 | L["Font size"] = "Размер шрифта"
294 | L["For spells that aren't in your spell book use the spell ID number."] = "Для заклинаний, которых нет в вашей книге заклинаний, используйте ID заклинания."
295 | L["Highlight buttons for interrupt and soothe."] = "Выделите кнопки для прерывания и успокоения."
296 | L["If you disable this option, only auras explicitly configured under \"Extra aura displays\" will be shown."] = "Если отключить эту опцию, будут отображаться только ауры, явно настроенные в разделе «Дополнительные отображения аур»."
297 | L["Ignored abilities"] = "Игнорируемые способности"
298 | L["Left"] = "Слева"
299 | L["on"] = "на"
300 | L["On ability"] = "По способности"
301 | L["Right"] = "Справа"
302 | L["Show aura"] = "Показать ауру"
303 | L["Show aura stacks."] = "Показать стаки ауры."
304 | L["Show fractions of a second on timers."] = "Показывать доли секунды на таймерах."
305 | L["Stack text offset"] = "Смещение текста стака"
306 | L["Stack text position"] = "Положение текста в стаке"
307 | L["Text positions"] = "Текстовые позиции"
308 | L["Timer text offset"] = "Смещение текста таймера"
309 | L["Timer text position"] = "Положение текста таймера"
310 | L["Top"] = "Сверху"
311 | L["Top left"] = "Вверху слева"
312 | L["Top right"] = "Сверху справа"
313 | L["Wiping aura list."] = "Очистка списка аур."
314 | end
315 |
316 | -- zhCN ------------------------------------------------------------------------
317 |
318 | if locale == "zhCN" then
319 | L = L or {}
320 | L["Add ability"] = "添加技能"
321 | L["Aura list"] = "光环清单"
322 | L["Automatically match auras to abilities by name."] = "自动将名称相同的光环与技能配对"
323 | L["Bottom"] = "下"
324 | L["Bottom left"] = "左下"
325 | L["Bottom right"] = "右下"
326 | L["Center"] = "中间"
327 | L["Color aura duration timers based on remaining time."] = "依据剩余时间变化文字颜色"
328 | L["Display aura duration timers."] = "显示光环持续时间"
329 | L["Display buffs cast by you on your pet."] = "显示你施放在你的宠物身上的增益"
330 | L["Error: unknown ability spell: %s"] = "错误: 未知的技能法术: %s"
331 | L["Error: unknown aura spell: %s"] = "错误: 未知的光环法术: %s"
332 | L["Error: unknown spell: %s"] = "错误: 未知的法术: %s"
333 | L["Extra aura displays"] = "额外显示光环"
334 | L["Font name"] = "字体"
335 | L["Font size"] = "文字大小"
336 | L["For spells that aren't in your spell book use the spell ID number."] = "不在你的法术书里面的法术请使用法术 ID 数字"
337 | L["Highlight buttons for interrupt and soothe."] = "断法和安抚按钮发光"
338 | L["If you disable this option, only auras explicitly configured under \"Extra aura displays\" will be shown."] = "停用此选项时,只会显示在\\\"额外显示光环\\\" 中有明确设定的光环。"
339 | L["Ignored abilities"] = "忽略技能"
340 | L["Left"] = "左"
341 | L["on"] = "于"
342 | L["On ability"] = "于技能"
343 | L["Right"] = "右"
344 | L["Show aura"] = "显示光环"
345 | L["Show aura stacks."] = "显示光环层数"
346 | L["Show fractions of a second on timers."] = "时间显示小数点"
347 | L["Stack text offset"] = "层数位置偏移"
348 | L["Stack text position"] = "层数位置"
349 | L["Text positions"] = "位置"
350 | L["Timer text offset"] = "时间位置偏移"
351 | L["Timer text position"] = "时间位置"
352 | L["Top"] = "上"
353 | L["Top left"] = "左上"
354 | L["Top right"] = "右上"
355 | L["Wiping aura list."] = "正在清空光环清单。"
356 | end
357 |
358 | -- zhTW ------------------------------------------------------------------------
359 |
360 | if locale == "zhTW" then
361 | L = L or {}
362 | L["Add ability"] = "添加技能"
363 | L["Aura list"] = "光環清單"
364 | L["Automatically match auras to abilities by name."] = "自動將名稱相同的光環與技能配對"
365 | L["Bottom"] = "下"
366 | L["Bottom left"] = "左下"
367 | L["Bottom right"] = "右下"
368 | L["Center"] = "中間"
369 | L["Color aura duration timers based on remaining time."] = "依據剩餘時間變化文字顏色"
370 | L["Display aura duration timers."] = "顯示光環持續時間"
371 | L["Display buffs cast by you on your pet."] = "顯示你施放在你的寵物身上的增益"
372 | L["Error: unknown ability spell: %s"] = "錯誤: 未知的技能法術: %s"
373 | L["Error: unknown aura spell: %s"] = "錯誤: 未知的光環法術: %s"
374 | L["Error: unknown spell: %s"] = "錯誤: 未知的法術: %s"
375 | L["Extra aura displays"] = "額外顯示光環"
376 | L["Font name"] = "字體"
377 | L["Font size"] = "文字大小"
378 | L["For spells that aren't in your spell book use the spell ID number."] = "不在你的法術書裡面的法術請使用法術 ID 數字"
379 | L["Highlight buttons for interrupt and soothe."] = "斷法和安撫按鈕發光"
380 | L["If you disable this option, only auras explicitly configured under \"Extra aura displays\" will be shown."] = "停用此選項時,只會顯示在 \"額外顯示光環\" 中有明確設定的光環。"
381 | L["Ignored abilities"] = "忽略技能"
382 | L["Left"] = "左"
383 | L["on"] = "於"
384 | L["On ability"] = "於技能"
385 | L["Right"] = "右"
386 | L["Show aura"] = "顯示光環"
387 | L["Show aura stacks."] = "顯示光環層數"
388 | L["Show fractions of a second on timers."] = "時間顯示小數點"
389 | L["Stack text offset"] = "層數位置偏移"
390 | L["Stack text position"] = "層數位置"
391 | L["Text positions"] = "位置"
392 | L["Timer text offset"] = "時間位置偏移"
393 | L["Timer text position"] = "時間位置"
394 | L["Top"] = "上"
395 | L["Top left"] = "左上"
396 | L["Top right"] = "右上"
397 | L["Wiping aura list."] = "正在清空光環清單。"
398 | end
399 |
--------------------------------------------------------------------------------
/Options.lua:
--------------------------------------------------------------------------------
1 | --[[----------------------------------------------------------------------------
2 |
3 | LiteButtonAuras
4 | Copyright 2021 Mike "Xodiv" Battersby
5 |
6 | ----------------------------------------------------------------------------]]--
7 |
8 | local addonName, LBA = ...
9 |
10 | local L = LBA.L
11 |
12 | local C_Spell = LBA.C_Spell or C_Spell
13 |
14 | local AceConfigRegistry = LibStub("AceConfigRegistry-3.0")
15 |
16 | local fontPath, fontSize, fontFlags = NumberFontNormal:GetFont()
17 |
18 | local defaultAdjust = ( WOW_PROJECT_ID == 1 and 5 or 2 )
19 |
20 | local defaults = {
21 | global = {
22 | },
23 | profile = {
24 | defaultNameMatching = true,
25 | playerPetBuffs = true,
26 | denySpells = {
27 | [116] = true, -- Frostbolt (Mage)
28 | [152175] = true, -- Whirling Dragon Punch (Monk)
29 | [190356] = true, -- Blizzard (Mage)
30 | [425782] = true, -- Second Wind (Warrior passive / Skyriding)
31 | },
32 | auraMap = { },
33 | color = {
34 | buff = { r=0.00, g=0.70, b=0.00 },
35 | petBuff = { r=0.00, g=0.00, b=0.70 },
36 | debuff = { r=1.00, g=0.00, b=0.00 },
37 | enrage = { r=1.00, g=0.25, b=0.00 }, -- unused
38 | },
39 | glowAlpha = 0.5,
40 | minAuraDuration = 1.5,
41 | showTimers = true,
42 | showStacks = true,
43 | showSuggestions = true,
44 | colorTimers = true,
45 | decimalTimers = true,
46 | timerAnchor = "BOTTOMLEFT",
47 | timerAdjust = defaultAdjust,
48 | stacksAnchor = "TOPLEFT",
49 | stacksAdjust = defaultAdjust,
50 | fontPath = fontPath,
51 | fontSize = math.floor(fontSize + 0.5),
52 | fontFlags = fontFlags,
53 | },
54 | char = {
55 | },
56 | }
57 |
58 | LBA.anchorSettings = {
59 | TOPLEFT = { "TOPLEFT", 1, -1, "LEFT" },
60 | TOP = { "TOP", 0, -1, "CENTER" },
61 | TOPRIGHT = { "TOPRIGHT", -1, -1, "RIGHT" },
62 | LEFT = { "LEFT", 1, 0, "LEFT", },
63 | CENTER = { "CENTER", 0, 0, "CENTER" },
64 | RIGHT = { "RIGHT", -1, 0, "RIGHT" },
65 | BOTTOMLEFT = { "BOTTOMLEFT", 1, 1, "LEFT" },
66 | BOTTOM = { "BOTTOM", 0, 1, "CENTER" },
67 | BOTTOMRIGHT = { "BOTTOMRIGHT", -1, 1, "RIGHT" },
68 | }
69 |
70 | local function IsTrue(x)
71 | if x == nil or x == false or x == "0" or x == "off" or x == "false" then
72 | return false
73 | else
74 | return true
75 | end
76 | end
77 |
78 |
79 | function LBA.InitializeOptions()
80 | LBA.db = LibStub("AceDB-3.0"):New("LiteButtonAurasDB", defaults, true)
81 | -- Migrations
82 | for _, p in pairs(LBA.db.profiles) do
83 | if p.font then
84 | if type(p.font) == 'string' then
85 | if _G[p.font] and _G[p.font].GetFont then
86 | p.fontPath, p.fontSize, p.fontFlags = _G[p.font]:GetFont()
87 | p.fontSize = math.floor(p.fontSize + 0.5)
88 | end
89 | elseif type(p.font) == 'table' then
90 | p.fontPath, p.fontSize, p.fontFlags = unpack(p.font)
91 | p.fontSize = math.floor(p.fontSize + 0.5)
92 | end
93 | p.font = nil
94 | end
95 | end
96 | -- Profile change hooks, would be needed to change profiles outside gui
97 | --[[
98 | local function notify () AceConfigRegistry:NotifyChange(addonName) end
99 | LBA.db.RegisterCallback(LBA, "OnProfileChanged", notify)
100 | LBA.db.RegisterCallback(LBA, "OnProfileCopied", notify)
101 | LBA.db.RegisterCallback(LBA, "OnProfileReset", notify
102 | ]]
103 | end
104 |
105 | function LBA.SetOption(option, value, key)
106 | key = key or "profile"
107 | if not defaults[key] then return end
108 | if value == "default" or value == DEFAULT:lower() or value == nil then
109 | value = defaults[key][option]
110 | end
111 | if type(defaults[key][option]) == 'boolean' then
112 | LBA.db[key][option] = IsTrue(value)
113 | elseif type(defaults[key][option]) == 'number' then
114 | if tonumber(value) then
115 | LBA.db[key][option] = tonumber(value)
116 | end
117 | elseif LBA.anchorSettings[defaults[key][option]] then
118 | if LBA.anchorSettings[value] then
119 | LBA.db[key][option] = value
120 | end
121 | else
122 | LBA.db[key][option] = value
123 | end
124 | LBA.db.callbacks:Fire('OnModified')
125 | end
126 |
127 | function LBA.SetOptionOutsideUI(option, value, key)
128 | LBA.Setoption(option, value, key)
129 | AceConfigRegistry:NotifyChange(addonName)
130 | end
131 |
132 | function LBA.AddAuraMap(auraSpell, abilitySpell)
133 | auraSpell = tonumber(auraSpell) or auraSpell
134 | abilitySpell = tonumber(abilitySpell) or abilitySpell
135 |
136 | if LBA.db.profile.auraMap[auraSpell] then
137 | table.insert(LBA.db.profile.auraMap[auraSpell], abilitySpell)
138 | else
139 | LBA.db.profile.auraMap[auraSpell] = { abilitySpell }
140 | end
141 | LBA.UpdateAuraMap()
142 | AceConfigRegistry:NotifyChange(addonName)
143 | end
144 |
145 | function LBA.RemoveAuraMap(auraSpell, abilitySpell)
146 | auraSpell = tonumber(auraSpell) or auraSpell
147 | abilitySpell = tonumber(abilitySpell) or abilitySpell
148 | if not LBA.db.profile.auraMap[auraSpell] then return end
149 |
150 | tDeleteItem(LBA.db.profile.auraMap[auraSpell], abilitySpell)
151 |
152 | if next(LBA.db.profile.auraMap[auraSpell]) == nil then
153 | if not defaults.profile.auraMap[auraSpell] then
154 | LBA.db.profile.auraMap[auraSpell] = nil
155 | else
156 | LBA.db.profile.auraMap[auraSpell] = { false }
157 | end
158 | end
159 | LBA.UpdateAuraMap()
160 | AceConfigRegistry:NotifyChange(addonName)
161 | end
162 |
163 | function LBA.DefaultAuraMap()
164 | LBA.db.profile.auraMap = CopyTable(defaults.profile.auraMap)
165 | LBA.UpdateAuraMap()
166 | AceConfigRegistry:NotifyChange(addonName)
167 | end
168 |
169 | function LBA.WipeAuraMap()
170 | LBA.db.profile.auraMap = {}
171 | LBA.UpdateAuraMap()
172 | AceConfigRegistry:NotifyChange(addonName)
173 | end
174 |
175 | function LBA.AddIgnoreSpell(auraID)
176 | LBA.db.profile.denySpells[auraID] = true
177 | AceConfigRegistry:NotifyChange(addonName)
178 | end
179 |
180 | function LBA.RemoveIgnoreSpell(auraID)
181 | LBA.db.profile.denySpells[auraID] = nil
182 | AceConfigRegistry:NotifyChange(addonName)
183 | end
184 |
185 | function LBA.DefaultIgnoreSpells()
186 | LBA.db.profile.denySpells = CopyTable(defaults.profile.denySpells)
187 | AceConfigRegistry:NotifyChange(addonName)
188 | end
189 |
190 | function LBA.WipeIgnoreSpells()
191 | table.wipe(LBA.db.profile.denySpells)
192 | AceConfigRegistry:NotifyChange(addonName)
193 | end
194 |
195 | function LBA.SpellString(spellID, spellName)
196 | spellName = NORMAL_FONT_COLOR:WrapTextInColorCode(spellName)
197 | if spellID then
198 | return format("%s (%d)", spellName, spellID)
199 | else
200 | return spellName
201 | end
202 | end
203 |
204 | function LBA.AuraMapString(auraID, auraName, abilityID, abilityName)
205 | return format(
206 | "%s %s %s",
207 | LBA.SpellString(auraID, auraName),
208 | L["on"],
209 | LBA.SpellString(abilityID, abilityName)
210 | )
211 | end
212 |
213 | function LBA.GetAuraMapList()
214 | local out = { }
215 | for showAura, onAbilityTable in pairs(LBA.db.profile.auraMap) do
216 | for _, onAbility in ipairs(onAbilityTable) do
217 | local auraName, auraID, abilityName, abilityID
218 | if type(showAura) == 'number' then
219 | local info = C_Spell.GetSpellInfo(showAura)
220 | if info then
221 | auraName = info.name
222 | auraID = info.spellID
223 | end
224 | else
225 | auraName = showAura
226 | end
227 | if type(onAbility) == 'number' then
228 | local info = C_Spell.GetSpellInfo(onAbility)
229 | if info then
230 | abilityName = info.name
231 | abilityID = info.spellID
232 | end
233 | else
234 | abilityName = onAbility
235 | end
236 | if auraName and abilityName then
237 | table.insert(out, { auraID, auraName, abilityID, abilityName })
238 | end
239 | end
240 | end
241 | sort(out, function (a, b) return a[2]..a[4] < b[2]..b[4] end)
242 | return out
243 | end
244 |
245 | function LBA.ApplyDefaultSettings()
246 | LBA.db:ResetProfile()
247 | AceConfigRegistry:NotifyChange(addonName)
248 | end
249 |
--------------------------------------------------------------------------------
/Overlay.lua:
--------------------------------------------------------------------------------
1 | --[[----------------------------------------------------------------------------
2 |
3 | LiteButtonAuras
4 | Copyright 2021 Mike "Xodiv" Battersby
5 |
6 | Code for one overlay frame on top of a button. Most of this code is the
7 | logic for what to display depending on what auras are in LBA.state, see
8 | LiteButtonAurasOverlayMixin:Update() for the entry point.
9 |
10 | ----------------------------------------------------------------------------]]--
11 |
12 | local _, LBA = ...
13 |
14 | local C_Spell = LBA.C_Spell or C_Spell
15 | local C_Item = LBA.C_Item or C_Item
16 |
17 | local LibBG = LibStub("LibButtonGlow-1.0")
18 |
19 |
20 | --[[------------------------------------------------------------------------]]--
21 |
22 | -- Cache a some things to be faster. This is annoying but it's really a lot
23 | -- faster. Only do this for things that are called in the event loop otherwise
24 | -- it's a pain to maintain.
25 |
26 | local DebuffTypeColor = DebuffTypeColor
27 | local GetMacroItem = GetMacroItem
28 | local GetMacroSpell = GetMacroSpell
29 | local GetTime = GetTime
30 | local IsSpellOverlayed = IsSpellOverlayed
31 | local UnitCanAttack = UnitCanAttack
32 | local WOW_PROJECT_ID = WOW_PROJECT_ID
33 |
34 | --[[------------------------------------------------------------------------]]--
35 |
36 | -- LBA matches auras by name, but the profile auraMap is by ID so that it works
37 | -- in all locales. Translate it into the names at load time and when the player
38 | -- adds more mappings. Also invert so we don't have to loop in overlay update.
39 |
40 | LBA.AuraMap = {}
41 |
42 | function LBA.UpdateAuraMap()
43 | LBA.AuraMap = {}
44 | for showAura, onAbilityTable in pairs(LBA.db.profile.auraMap) do
45 | if type(showAura) == 'number' then
46 | showAura = C_Spell.GetSpellName(showAura)
47 | end
48 | for _, onAbility in ipairs(onAbilityTable) do
49 | if type(onAbility) == 'number' then
50 | onAbility = C_Spell.GetSpellName(onAbility)
51 | end
52 | if showAura and onAbility then
53 | LBA.AuraMap[onAbility] = LBA.AuraMap[onAbility] or {}
54 | table.insert(LBA.AuraMap[onAbility], showAura)
55 | end
56 | end
57 | end
58 | end
59 |
60 |
61 | --[[------------------------------------------------------------------------]]--
62 |
63 | LiteButtonAurasOverlayMixin = {}
64 |
65 | function LiteButtonAurasOverlayMixin:OnLoad()
66 | -- Bump it so it's on top of the cooldown frame, otherwise the individual
67 | -- bar integration will need to adjust the level accordingly
68 | local parent = self:GetParent()
69 | if parent.cooldown then
70 | self:SetFrameLevel(parent.cooldown:GetFrameLevel() + 1)
71 | end
72 | self:Style()
73 | end
74 |
75 | function LiteButtonAurasOverlayMixin:Style()
76 | local p = LBA.db.profile
77 |
78 | local parent = self:GetParent()
79 | self:SetSize(parent:GetSize())
80 |
81 | local point, x, y, justifyH
82 |
83 | self.Timer:SetFont(p.fontPath, p.fontSize, p.fontFlags)
84 | point, x, y, justifyH = unpack(LBA.anchorSettings[p.timerAnchor])
85 | self.Timer:ClearAllPoints()
86 | self.Timer:SetPoint(point, self, x*p.timerAdjust, y*p.timerAdjust)
87 | self.Timer:SetJustifyH(justifyH)
88 |
89 | self.Stacks:SetFont(p.fontPath, p.fontSize, p.fontFlags)
90 | point, x, y, justifyH = unpack(LBA.anchorSettings[p.stacksAnchor])
91 | self.Stacks:ClearAllPoints()
92 | self.Stacks:SetPoint(point, self, x*p.stacksAdjust, y*p.stacksAdjust)
93 | self.Stacks:SetJustifyH(justifyH)
94 | end
95 |
96 | -- This could be optimized (?) slightly be checking if type, id, subType
97 | -- are all the same as before and doing nothing
98 | --
99 | -- In an ideal world GetActionInfo would return the unit as well. Or there
100 | -- would be a GetActionUnit function. If we could find the unit then it
101 | -- would make sense to change LBA.state to be unit-indexed and to collect
102 | -- state for all the units we are interested in rather than a hard coded
103 | -- player and target set. Exactly how to do that efficiently would be a
104 | -- bit of a challenge but I think it's still faster than not keeping the
105 | -- state and each overlay doing its own UnitAura calls.
106 | --
107 | -- Realistically speaking we could scan all the macros for @ and target=
108 | -- and add them to a "wanted units" list. I don't think it would be worth
109 | -- trying to handle auto-self-cast or the new blizzard mouseover cast.
110 |
111 | function LiteButtonAurasOverlayMixin:SetUpAction()
112 |
113 | local type, id, subType = self:GetActionInfo()
114 |
115 | if type == 'spell' then
116 | self.name = C_Spell.GetSpellName(id)
117 | self.spellID = id
118 | self.type = type
119 | return
120 | end
121 |
122 | if type == 'item' then
123 | LBA.buttonItemIDs[id] = true
124 | self.name, self.spellID = C_Item.GetItemSpell(id)
125 | self.type = type
126 | return
127 | end
128 |
129 | if type == 'macro' then
130 | if subType == 'spell' then
131 | self.spellID = id
132 | self.name = C_Spell.GetSpellName(self.spellID)
133 | self.type = subType
134 | return
135 | elseif subType == 'item' then
136 | -- 10.2 GetActionInfo() seems bugged for this case. In an ideal
137 | -- world id would be the itemID but it seemds to be actionID-1.
138 | -- This workaround assumes no two macros have the same name. Maybe
139 | -- there's a better way.
140 | local actionID = self:GetActionID()
141 | if actionID then
142 | local macroName = GetActionText(actionID)
143 | local macroID = GetMacroIndexByName(macroName or "")
144 | if macroID then
145 | local _, itemLink = GetMacroItem(macroID)
146 | if itemLink then
147 | self.name, self.spellID = C_Item.GetItemSpell(itemLink)
148 | end
149 | end
150 | self.type = subType
151 | return
152 | end
153 | elseif not subType then
154 | local itemName = GetMacroItem(id)
155 | if itemName then
156 | local name, spellID = C_Item.GetItemSpell(itemName)
157 | self.spellID = spellID
158 | self.name = name or itemName
159 | self.type = 'item'
160 | return
161 | end
162 | local spellID = GetMacroSpell(id)
163 | if spellID then
164 | self.spellID = spellID
165 | self.name = C_Spell.GetSpellName(spellID)
166 | self.type = 'spell'
167 | return
168 | end
169 | end
170 | end
171 |
172 | self.spellID = nil
173 | self.name = nil
174 | self.type = nil
175 | end
176 |
177 | function LiteButtonAurasOverlayMixin:IsKnown()
178 | if self.type == 'item' then
179 | -- Assume if you have an item on your bars you know it. Could check
180 | -- the owned item count but it would only matter if an item was an
181 | -- interrupt or soothe, which is always false.
182 | return true
183 | elseif not self.spellID then
184 | return false
185 | elseif C_SpellBook and C_SpellBook.FindSpellBookSlotForSpell then
186 | -- This is trying to account for Pet spells as well which don't count
187 | -- as IsPlayerSpell() or IsSpellKnown(). I am very much hoping this is not
188 | -- super slow.
189 | return C_SpellBook.FindSpellBookSlotForSpell(self.spellID) ~= nil
190 | else
191 | return true
192 | end
193 | end
194 |
195 | function LiteButtonAurasOverlayMixin:IsIgnoreSpell()
196 | if self.spellID and LBA.db.profile.denySpells[self.spellID] then
197 | return true
198 | else
199 | return false
200 | end
201 | end
202 |
203 | function LiteButtonAurasOverlayMixin:GetMatchingAura(t)
204 | if LBA.AuraMap[self.name] then
205 | for _, extraAuraName in ipairs(LBA.AuraMap[self.name]) do
206 | if t[extraAuraName] then
207 | return t[extraAuraName]
208 | end
209 | end
210 | elseif self:IsIgnoreSpell() then
211 | return
212 | elseif LBA.db.profile.defaultNameMatching and t[self.name] then
213 | return t[self.name]
214 | end
215 | end
216 |
217 | function LiteButtonAurasOverlayMixin:AlreadyOverlayed()
218 | if WOW_PROJECT_ID == 1 then
219 | return (self.spellID and IsSpellOverlayed(self.spellID))
220 | else
221 | local parent = self:GetParent()
222 | return (parent.overlay and parent.overlay:IsShown())
223 | end
224 | end
225 |
226 | function LiteButtonAurasOverlayMixin:Update(stateOnly)
227 | local show = false
228 |
229 | self.expireTime = nil
230 | self.stackCount = nil
231 | self.displayGlow = nil
232 | self.displaySuggestion = nil
233 |
234 | if self:HasAction() then
235 |
236 | -- Even though the action might be the same, what it contains could have
237 | -- changed due to the dynamic nature of macros and some spells.
238 | if not stateOnly then
239 | self:SetUpAction()
240 | end
241 |
242 | if self:IsKnown() then
243 | if self:TrySetAsSoothe('target') then
244 | show = true
245 | elseif self:TrySetAsInterrupt('target') then
246 | show = true
247 | elseif self:TrySetAsTotem() then
248 | show = true
249 | -- elseif self:TrySetAsTaunt('target') then
250 | -- show = true
251 | elseif self:TrySetAsBuff('player') then
252 | show = true
253 | elseif self:TrySetAsDebuff('target') then
254 | show = true
255 | elseif self:TrySetAsPetBuff('pet') then
256 | show = true
257 | elseif self:TrySetAsWeaponEnchant() then
258 | show = true
259 | elseif self:TrySetAsDispel('target') then
260 | show = true
261 | end
262 | end
263 | end
264 |
265 | self:ShowGlow(self.displayGlow and not self:AlreadyOverlayed())
266 | self:ShowTimer(self.expireTime ~= nil and LBA.db.profile.showTimers)
267 | self:ShowStacks(self.stackCount ~= nil and LBA.db.profile.showStacks)
268 | self:ShowSuggestion(self.displaySuggestion and LBA.db.profile.showSuggestions)
269 | self:SetShown(show)
270 | end
271 |
272 |
273 | -- Aura Config -----------------------------------------------------------------
274 |
275 | -- [ 1] name,
276 | -- [ 2] icon,
277 | -- [ 3] count,
278 | -- [ 4] debuffType,
279 | -- [ 5] duration,
280 | -- [ 6] expirationTime,
281 | -- [ 7] source,
282 | -- [ 8] isStealable,
283 | -- [ 9] nameplateShowPersonal,
284 | -- [10] spellId,
285 | -- [11] canApplyAura,
286 | -- [12] isBossDebuff,
287 | -- [13] castByPlayer,
288 | -- [14] nameplateShowAll,
289 | -- [15] timeMod,
290 | -- ...
291 | -- = UnitAura(unit, index, filter)
292 |
293 | function LiteButtonAurasOverlayMixin:SetAsAura(auraData)
294 | -- Anything that's too short is just annoying
295 | if auraData.duration > 0 and auraData.duration < LBA.db.profile.minAuraDuration then
296 | return
297 | end
298 | self.displayGlow = true
299 | if auraData.expirationTime and auraData.expirationTime ~= 0 then
300 | self.expireTime = auraData.expirationTime
301 | self.timeMod = auraData.timeMod
302 | end
303 | if auraData.applications and auraData.applications > 1 then
304 | self.stackCount = auraData.applications
305 | end
306 | end
307 |
308 | function LiteButtonAurasOverlayMixin:SetAsBuff(auraData)
309 | local color = LBA.db.profile.color.buff
310 | local alpha = LBA.db.profile.glowAlpha
311 | self.Glow:SetVertexColor(color.r, color.g, color.b, alpha)
312 | -- self.Stacks:SetTextColor(color.r, color.g, color.b, 1.0)
313 | self:SetAsAura(auraData)
314 | end
315 |
316 | function LiteButtonAurasOverlayMixin:SetAsPetBuff(auraData)
317 | local color = LBA.db.profile.color.petBuff
318 | local alpha = LBA.db.profile.glowAlpha
319 | self.Glow:SetVertexColor(color.r, color.g, color.b, alpha)
320 | -- self.Stacks:SetTextColor(color.r, color.g, color.b, 1.0)
321 | self:SetAsAura(auraData)
322 | end
323 |
324 | function LiteButtonAurasOverlayMixin:SetAsDebuff(auraData)
325 | local color = LBA.db.profile.color.debuff
326 | local alpha = LBA.db.profile.glowAlpha
327 | self.Glow:SetVertexColor(color.r, color.g, color.b, alpha)
328 | -- self.Stacks:SetTextColor(color.r, color.g, color.b, 1.0)
329 | self:SetAsAura(auraData)
330 | end
331 |
332 | function LiteButtonAurasOverlayMixin:TrySetAsBuff(unit)
333 | local aura = self:GetMatchingAura(LBA.state[unit].buffs)
334 | if aura then
335 | self:SetAsBuff(aura)
336 | return true
337 | end
338 | end
339 |
340 | function LiteButtonAurasOverlayMixin:TrySetAsPetBuff(unit)
341 | if LBA.db.profile.playerPetBuffs then
342 | local aura = self:GetMatchingAura(LBA.state[unit].buffs)
343 | if aura and aura.sourceUnit == 'player' then
344 | self:SetAsPetBuff(aura)
345 | return true
346 | end
347 | end
348 | end
349 |
350 | function LiteButtonAurasOverlayMixin:TrySetAsDebuff(unit)
351 | local aura = self:GetMatchingAura(LBA.state[unit].debuffs)
352 | if aura then
353 | self:SetAsDebuff(aura)
354 | return true
355 | end
356 | end
357 |
358 | function LiteButtonAurasOverlayMixin:TrySetAsWeaponEnchant()
359 | if LBA.state.player.weaponEnchants[self.name] then
360 | self:SetAsBuff(LBA.state.player.weaponEnchants[self.name])
361 | return true
362 | end
363 | end
364 |
365 | -- Totem Config ----------------------------------------------------------------
366 |
367 | function LiteButtonAurasOverlayMixin:SetAsTotem(expireTime)
368 | local color = LBA.db.profile.color.buff
369 | local alpha = LBA.db.profile.glowAlpha
370 | self.Glow:SetVertexColor(color.r, color.g, color.b, alpha)
371 | self.expireTime, self.modTime = expireTime, nil
372 | self.displayGlow = true
373 | end
374 |
375 | function LiteButtonAurasOverlayMixin:TrySetAsTotem()
376 | if self:IsIgnoreSpell() or not LBA.db.profile.defaultNameMatching then
377 | return
378 | elseif LBA.state.player.totems[self.name] then
379 | self:SetAsTotem(LBA.state.player.totems[self.name])
380 | return true
381 | end
382 | end
383 |
384 |
385 | -- Interrupt Config ------------------------------------------------------------
386 |
387 | -- Assuming no interrupt spells are of the "enabled" type
388 | -- https://wowpedia.fandom.com/wiki/API_GetSpellCooldown
389 |
390 | function LiteButtonAurasOverlayMixin:ReadyBefore(endTime)
391 | if endTime == 0 then
392 | -- Indefinite enrage, such as from the Raging M+ affix
393 | return true
394 | else
395 | local info = C_Spell.GetSpellCooldown(self.spellID)
396 | return info and info.startTime + info.duration < endTime
397 | end
398 | end
399 |
400 | function LiteButtonAurasOverlayMixin:TrySetAsInterrupt(unit)
401 | if LBA.state[unit].interrupt then
402 | if self.name and LBA.Interrupts[self.name] then
403 | local castEnds = LBA.state[unit].interrupt
404 | if self:ReadyBefore(castEnds) then
405 | self.expireTime = castEnds
406 | self.displaySuggestion = true
407 | return true
408 | end
409 | end
410 | end
411 | end
412 |
413 | -- Soothe Config ---------------------------------------------------------------
414 |
415 | --[[
416 | function LiteButtonAurasOverlayMixin:SetAsSoothe(auraData)
417 | local color = LBA.db.profile.color.enrage
418 | self.Glow:SetVertexColor(color.r, color.g, color.b, 0.7)
419 | -- self.Stacks:SetTextColor(color.r, color.g, color.b, 1.0)
420 | self:SetAsAura(auraData)
421 | end
422 | ]]
423 |
424 | function LiteButtonAurasOverlayMixin:IsSoothe()
425 | -- Note this is handling self.name == nil case as well
426 | local v = LBA.Soothes[self.name]
427 | if type(v) == 'function' then
428 | return not not v()
429 | else
430 | return not not v
431 | end
432 | end
433 |
434 | function LiteButtonAurasOverlayMixin:TrySetAsSoothe(unit)
435 | if not self:IsSoothe() then return end
436 | if not UnitCanAttack('player', unit) then return end
437 |
438 | for _, auraData in pairs(LBA.state[unit].buffs) do
439 | if auraData.isStealable and auraData.dispelName == "" and self:ReadyBefore(auraData.expirationTime) then
440 | self.expireTime = auraData.expirationTime
441 | self.displaySuggestion = true
442 | return true
443 | end
444 | end
445 | end
446 |
447 | -- Taunt Config ----------------------------------------------------------------
448 |
449 | --[[
450 | -- To work this would require capturing other player debuffs, and would need
451 | -- an different storage for the state auras since at the moment they all assume
452 | -- they are unique by name which is not true once you introduce other units.
453 | function LiteButtonAurasOverlayMixin:TrySetAsTaunt(unit)
454 | if not self.name or not LBA.Taunts[self.name] then return end
455 | if not UnitCanAttack('player', unit) then return end
456 |
457 | for _, auraData in pairs(LBA.state[unit].debuffs) do
458 | if LBA.Taunts[auraData.name] then
459 | if auraData.sourceUnit == 'player' then
460 | self:SetAsBuff(auraData)
461 | else
462 | self:SetAsDebuff(auraData)
463 | end
464 | return true
465 | end
466 | end
467 | end
468 | ]]
469 |
470 | -- Dispel Config ---------------------------------------------------------------
471 |
472 | function LiteButtonAurasOverlayMixin:SetAsDispel(auraData)
473 | local color = DebuffTypeColor[auraData.dispelName or ""]
474 | local alpha = LBA.db.profile.glowAlpha
475 | self.Glow:SetVertexColor(color.r, color.g, color.b, alpha)
476 | -- self.Stacks:SetTextColor(color.r, color.g, color.b, 1.0)
477 | self:SetAsAura(auraData)
478 | end
479 |
480 | function LiteButtonAurasOverlayMixin:TrySetAsDispel(unit)
481 | if not self.name then
482 | return
483 | end
484 |
485 | if not UnitCanAttack('player', unit) then
486 | return
487 | end
488 |
489 | local dispels = LBA.HostileDispels[self.name]
490 | if dispels then
491 | for dispelName in pairs(dispels) do
492 | for _, auraData in pairs(LBA.state[unit].buffs) do
493 | if auraData.dispelName == dispelName then
494 | self:SetAsDispel(auraData)
495 | self.displaySuggestion = true
496 | return true
497 | end
498 | end
499 | end
500 | end
501 | end
502 |
503 | -- Glow Display ----------------------------------------------------------------
504 |
505 | function LiteButtonAurasOverlayMixin:ShowGlow(isShown)
506 | self.Glow:SetShown(isShown)
507 | end
508 |
509 | -- Suggestion Display-----------------------------------------------------------
510 |
511 | if ActionButtonSpellAlertManager then
512 | function LiteButtonAurasOverlayMixin:ShowSuggestion(isShown)
513 | if isShown then
514 | ActionButtonSpellAlertManager:ShowAlert(self)
515 | else
516 | ActionButtonSpellAlertManager:HideAlert(self)
517 | end
518 | end
519 | elseif ActionButton_SetupOverlayGlow then
520 | function LiteButtonAurasOverlayMixin:ShowSuggestion(isShown)
521 | if isShown then
522 | -- Taken from ActionButton_ShowOverlayGlow(self) but we don't want the
523 | -- start animation because it takes 0.7s before the button starts to
524 | -- glow which is awful for time-sensitive things like interrupts (and
525 | -- in my opinion awful in general).
526 | ActionButton_SetupOverlayGlow(self)
527 | self.SpellActivationAlert.ProcStartFlipbook:SetAlpha(0)
528 | self.SpellActivationAlert.ProcLoop:Play()
529 | self.SpellActivationAlert:Show()
530 | else
531 | ActionButton_HideOverlayGlow(self)
532 | end
533 | end
534 | else
535 | function LiteButtonAurasOverlayMixin:ShowSuggestion(isShown)
536 | if isShown then
537 | LibBG.ShowOverlayGlow(self)
538 | else
539 | LibBG.HideOverlayGlow(self)
540 | end
541 | end
542 | end
543 |
544 |
545 | -- Count Display ---------------------------------------------------------------
546 |
547 | function LiteButtonAurasOverlayMixin:ShowStacks(isShown)
548 | if isShown then
549 | self.Stacks:SetText(self.stackCount)
550 | end
551 | self.Stacks:SetShown(isShown)
552 | end
553 |
554 |
555 | -- Timer Display ---------------------------------------------------------------
556 |
557 | local ceil = math.ceil
558 |
559 | local function TimerAbbrev(duration)
560 | if duration >= 86400 then
561 | return "%dd", ceil(duration/86400)
562 | elseif duration >= 3600 then
563 | return "%dh", ceil(duration/3600)
564 | elseif duration >= 60 then
565 | return "%dm", ceil(duration/60)
566 | elseif duration >= 3 or not LBA.db.profile.decimalTimers then
567 | return "%d", ceil(duration)
568 | else
569 | -- printf uses round (not available in lua) so do our own
570 | -- ceil and avoid a discontinuity at the break
571 | duration = ceil(duration*10)/10
572 | return "%.1f", duration
573 | end
574 | end
575 |
576 | -- BuffFrame does it this way, SetFormattedText on every frame. If its
577 | -- good enough for them it's good enough for me.
578 | --
579 | -- /console scriptprofile 1
580 | -- /reload
581 | --
582 | -- UpdateAddOnCPUUsage()
583 | -- t,n = GetFunctionCPUUsage(LiteButtonAurasOverlayMixin.UpdateTimer, true)
584 | -- print(t*1000/n) -> ~14 ns
585 | --
586 |
587 | function LiteButtonAurasOverlayMixin:UpdateTimer()
588 | local duration = self.expireTime - GetTime()
589 | if self.timeMod and self.timeMod > 0 then
590 | duration = duration / self.timeMod
591 | end
592 | if duration >= 0 then
593 | self.Timer:SetFormattedText(TimerAbbrev(duration))
594 | if LBA.db.profile.colorTimers then
595 | self.Timer:SetTextColor(LBA.TimerRGB(duration))
596 | else
597 | self.Timer:SetTextColor(1, 1, 1)
598 | end
599 | else
600 | self.Timer:Hide()
601 | self:SetScript('OnUpdate', nil)
602 | end
603 | end
604 |
605 | function LiteButtonAurasOverlayMixin:ShowTimer(isShown)
606 | if isShown then
607 | self:SetScript('OnUpdate', self.UpdateTimer)
608 | self.Timer:Show()
609 | else
610 | self:SetScript('OnUpdate', nil)
611 | self.Timer:Hide()
612 | end
613 | end
614 |
615 | function LiteButtonAurasOverlayMixin:Dump(force)
616 | if self.name or force then
617 | print(string.format("%d. %s = %s (%d)",
618 | self:GetActionID(),
619 | self:GetParent():GetName(),
620 | self.name or NONE,
621 | self.spellID or 0))
622 | end
623 | end
624 |
--------------------------------------------------------------------------------
/Overlay.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # LiteButtonAuras WoW AddOn
2 |
3 | LiteButtonAuras shows your buffs on you and your debuffs on your target inside your action buttons with a
4 | colored border and timer. It is like AdiButtonAuras, and Inline Aura before it, just much dumber and much
5 | easier to maintain.
6 |
7 | A buff you cast on yourself shows a green highlight in ability button:
8 |
9 | 
10 |
11 | A debuff you cast on your target shows red highlight in ability button:
12 |
13 | 
14 |
15 | For all of your action buttons:
16 |
17 | - Suggest button (border glow/ants) with timer if:
18 | - your target is casting a spell you can interrupt and the button action is an interrupt, or
19 | - your target is enraged and the button action is a soothe
20 | - Show a green highlight and timer if:
21 | - the action name matches a buff on you that you cast, or
22 | - the action is a totem or guardian and it is summoned
23 | - Show a red highlight and timer if:
24 | - the action name matches a debuff that you cast on your target
25 | - Show a debuff-colored border (curse/disease/magic/poison) if:
26 | - your target is an enemy, and
27 | - you can purge the buff, and
28 | - the button action is a purge/spellsteal
29 |
30 | LiteButtonAuras works with the default Blizzard action bars, Dominos, Bartender, ButtonForge, ActionbarPlus, and anything that uses LibActionButton (including ElvUI).
31 |
32 | Supports WoW retail, classic era (Vanilla/SoD) and classic (WotLK).
33 |
34 | ## WoW Classic Era Timers and Interrupts
35 |
36 | Support for interrupts and timers on classic is now baseline in the WoW API. You don't need to install
37 | any other libraries.
38 |
39 | ## Comparison with AdiButtonAuras
40 |
41 | Compared to AdiButtonAuras (which this addon was modeled on), LiteButtonAuras:
42 |
43 | 1. matches buffs/debuffs by name, so it doesn't require manually maintaining spells every expansion.
44 | 1. has less code and hopefully uses less CPU (probably not though).
45 | 1. has limited support for custom rules (only "show aura on ability").
46 | 1. doesn't show buffs/debuffs on abilities that have a different name unless manually configured.
47 | 1. limited support for customizing (timer appearance, location, show stacks or not).
48 | 1. doesn't show hints for using abilities, except for interrupt, purge and soothe.
49 | 1. doesn't show holy power/chi/combo points/soul shards.
50 | 1. doesn't handle macros that change the unit (always assumes target).
51 |
52 | AdiButtonAuras seems to be maintained again, so if you want some extra features give it a look.
53 |
54 | ## Options Panel
55 |
56 | LiteButtonAuras has a configuration panel that you can open from the Blizzard settings or by using the `/lba opt` slash command.
57 |
58 | You can adjust the visual appearance of the ability overlay, as well as add and remove extra aura displays where the name doesn't match.
59 |
60 | 
61 |
62 | 
63 |
64 | 
65 |
66 | ## Slash Command Options
67 |
68 | You can also adjust the options via slash command.
69 |
70 | ### Appearance Options
71 |
72 | ```
73 | /lba - print current settings
74 | /lba help - print help
75 | /lba colortimers on | off | default - turn on/off using colors for timers (default on)
76 | /lba decimaltimers on | off | default - turn on/off showing 10ths of a second on low timers (default on)
77 | /lba stacks on | off | default - turn on/off showing buff/debuff stacks (default off)
78 | /lba font default - set font to default (NumberFontNormal)
79 | /lba font FontName - set font by name (e.g., GameFontNormalOutline)
80 | /lba font FontPath - set font by path (e.g., Fonts\ARIALN.TTF)
81 | /lba font Size - set font size (default 14)
82 | /lba font FontFlag - set font flag (OUTLINE or THICKOUTLINE)
83 | /lba font FontNameOrPath Size FontFlag - set font by name/path, size and flag
84 | ```
85 |
86 | ### Fonts
87 |
88 | If you are changing the font from the default, you will (almost certainly) want to use
89 | fonts with the __OUTLINE__ flag (shows a dark border around) for them to be visible.
90 |
91 | The default LBA font `NumberFontNormal` has an outline, but (for example)
92 | `GameFontNormal` doesn't and you'd need to use `GameFontNormalOutline`
93 | instead or explicitly set the __OUTLINE__ flag.
94 |
95 | Note that setting colored fonts will __not__ use the color, only the font, size,
96 | and flags. There is no difference in LBA between `NumberFontNormal` and `NumberFontNormalYellow`.
97 |
98 | ## Show Highlights for Other Auras
99 |
100 | By default LiteButtonAuras only shows highlights when the name of the buff/debuff and the name of
101 | the action match. (Plus a special case for totems and guardians like monk statues.)
102 |
103 | Using the `/lba aura` command you can add extra auras that will highlight your abilities (for
104 | example, to show a debuff on the ability that triggers it).
105 |
106 | ```
107 | /lba aura list - list current extra aura mappings
108 | /lba aura add on
109 | /lba aura remove on
110 | ```
111 |
112 | If an ability is in your spell book you can use it by name otherwise by spell ID.
113 |
114 | You can only add auras using this, or remove ones you previously added. You can't use "hide" to
115 | change the default behaviour of showing buffs/debuffs that match the ability name.
116 |
117 | ### Never Highlight An Ability
118 |
119 | You can stop an ability from ever getting highlighted due to the default name matching.
120 |
121 | ```
122 | /lba ignore list - list abilities never to highlight
123 | /lba ignore add
124 | /lba ignore remove
125 | ```
126 |
127 | If ability is in your spell book you can use it by name otherwise spell ID.
128 |
129 | ## How to find spell IDs
130 |
131 | Every ability and every buff/debuff has an associated Spell ID, which you need to know to
132 | configure custom highlights (above).
133 |
134 | LiteButtonAuras doesn't include any helpers for finding spell IDs, you'll need to do it
135 | yourself. Here are three ways to do this:
136 |
137 | 1. Look up wowhead.com. The spell ID is the number after spell= in the URL.
138 | 1. Get an addon that adds Spell IDs to the tooltip.
139 | 1. If you have the _Details!_ addon, it keeps a list of spells you can view with `/details spells`
140 |
141 | ## Features I can't or won't support, and why
142 |
143 | 1. __Macro @units__. There's no simple way to figure out what unit an action will target.
144 | It can be done with a lot of complex processing, maybe. If Blizzard ever added a
145 | GetActionUnit() I would do it in a heartbeat so I can have focus interrupt suggesting.
146 | 1. __Non-Auras__. E.g. channeling time, combo/chi/holy power/etc points. A lot of these
147 | could be done, but LBA's focus is on auras only and I personally feel those are better
148 | done in other ways or by other addons.
149 |
150 | In general a lot of not supporting things involves keeping LiteButtonAuras small and
151 | simple enough that when a major WoW release comes out I can update it without causing
152 | myself so much stress I give up.
153 |
154 | ## If This AddOn Seems Abandoned
155 |
156 | If more than two weeks go by after a major patch and this addon isn't updated, I've probably been
157 | hit by a bus. In that case I encourage anyone with the necessary ability to take over maintenance of
158 | the addon. It is released under the terms of the GNU General Public License, which means anyone can
159 | take it and do whatever they want with it, as long as they don't claim they wrote it and they too
160 | release their code under the same terms.
161 |
--------------------------------------------------------------------------------
/SlashCommand.lua:
--------------------------------------------------------------------------------
1 | --[[----------------------------------------------------------------------------
2 |
3 | LiteButtonAuras
4 | Copyright 2021 Mike "Xodiv" Battersby
5 |
6 | Slash command just allows setting and displaying the options since
7 | there is no GUI for it.
8 |
9 | ----------------------------------------------------------------------------]]--
10 |
11 | local addonName, LBA = ...
12 |
13 | local C_Spell = LBA.C_Spell or C_Spell
14 |
15 | local L = LBA.L
16 |
17 | local function TrueStr(x)
18 | return x and "on" or "off"
19 | end
20 |
21 | local header = ORANGE_FONT_COLOR:WrapTextInColorCode(addonName..': ')
22 |
23 | local function printf(...)
24 | local msg = string.format(...)
25 | SELECTED_CHAT_FRAME:AddMessage(header .. msg)
26 | end
27 |
28 | local function PrintUsage()
29 | printf(GAMEMENU_HELP .. ":")
30 | printf(" /lba options")
31 | printf(" /lba stack on|off|default")
32 | printf(" /lba stackposition point [offset]")
33 | printf(" /lba timer on|off|default")
34 | printf(" /lba colortimer on|off|default")
35 | printf(" /lba decimaltimer on|off|default")
36 | printf(" /lba timerposition point [offset]")
37 | printf(" /lba font FontName|default")
38 | printf(" /lba font path [ size [ flags ] ]")
39 | printf(" /lba aura help")
40 | printf(" /lba ignore help")
41 | end
42 |
43 | local function PrintAuraUsage()
44 | printf(GAMEMENU_HELP .. ":")
45 | printf(" /lba aura list")
46 | printf(" /lba aura add on ")
47 | printf(" /lba aura remove on ")
48 | printf(" /lba aura wipe")
49 | end
50 |
51 | local function PrintIgnoreUsage()
52 | printf(GAMEMENU_HELP .. ":")
53 | printf(" /lba ignore list")
54 | printf(" /lba ignore add ")
56 | printf(" /lba ignore default")
57 | printf(" /lba ignore wipe")
58 | end
59 |
60 | local function PrintOptions()
61 | local p = LBA.db.profile
62 | printf(SETTINGS .. ':')
63 | printf(" stack = " .. TrueStr(p.showStacks))
64 | printf(" stackPosition = %s %d", p.stacksAnchor, p.stacksAdjust)
65 | printf(" timer = " .. TrueStr(p.showTimers))
66 | printf(" colorTimer = " .. TrueStr(p.colorTimers))
67 | printf(" decimalTimer = " .. TrueStr(p.decimalTimers))
68 | printf(" timerPosition = %s %d", p.timerAnchor, p.timerAdjust)
69 | printf(" font = [ '%s', %.1f, '%s' ]", p.fontPath, p.fontSize, p.fontFlags)
70 | end
71 |
72 | local function SetFont(args)
73 | local path, size, flags
74 | for _,arg in ipairs(args) do
75 | if arg == 'default' then
76 | path, size, flags = 'default', 'default', 'default'
77 | elseif _G[arg] and _G[arg].GetFont then
78 | path, size, flags = _G[arg]:GetFont()
79 | elseif tonumber(arg) then
80 | size = math.floor(tonumber(arg) + 0.5)
81 | elseif arg:find("\\") then
82 | path = arg
83 | else
84 | flags = arg
85 | end
86 | end
87 | if path then LBA.SetOptionOutsideUI('fontPath', path) end
88 | if size then LBA.SetOptionOutsideUI('fontSize', size) end
89 | if flags then LBA.SetOptionOutsideUI('fontFlags', flags) end
90 | end
91 |
92 | local function ParseAuraMap(cmdarg)
93 | local aura, ability = cmdarg:match('^(.+) on (.+)$')
94 | local auraInfo = C_Spell.GetSpellInfo(aura)
95 | local abilityInfo = C_Spell.GetSpellInfo(ability)
96 | return
97 | auraInfo and auraInfo.spellID,
98 | auraInfo and auraInfo.name or aura,
99 | abilityInfo and abilityInfo.spellID,
100 | abilityInfo and abilityInfo.name or ability
101 | end
102 |
103 | local function PrintAuraMapList()
104 | printf(L["Aura list"] .. ":")
105 | for i, entry in ipairs(LBA.GetAuraMapList()) do
106 | printf("%3d. %s", i, LBA.AuraMapString(unpack(entry)))
107 | end
108 | end
109 |
110 | local function AuraCommand(argstr)
111 | local _, cmd, cmdarg = strsplit(" ", argstr, 3)
112 | if cmd == 'list' then
113 | PrintAuraMapList()
114 | elseif cmd == 'add' and cmdarg then
115 | local aura, auraName, ability, abilityName = ParseAuraMap(cmdarg)
116 | if not aura then
117 | printf(L["Error: unknown aura spell: %s"], NORMAL_FONT_COLOR:WrapTextInColorCode(auraName))
118 | elseif not ability then
119 | printf(L["Error: unknown ability spell: %s"], NORMAL_FONT_COLOR:WrapTextInColorCode(abilityName))
120 | else
121 | printf(ADD.." %s", LBA.AuraMapString(aura, auraName, ability, abilityName))
122 | LBA.AddAuraMap(aura, ability)
123 | end
124 | elseif cmd == 'remove' and cmdarg then
125 | local aura, auraName, ability, abilityName = ParseAuraMap(cmdarg)
126 | if not aura then
127 | printf(L["Error: unknown aura spell: %s"], NORMAL_FONT_COLOR:WrapTextInColorCode(auraName))
128 | elseif not ability then
129 | printf(L["Error: unknown ability spell: %s"], NORMAL_FONT_COLOR:WrapTextInColorCode(abilityName))
130 | else
131 | printf(REMOVE.." %s", LBA.AuraMapString(aura, auraName, ability, abilityName))
132 | LBA.RemoveAuraMap(aura, ability)
133 | end
134 | elseif cmd == 'wipe' then
135 | printf(L["Wiping aura list."])
136 | LBA.WipeAuraMap()
137 | else
138 | PrintAuraUsage()
139 | end
140 |
141 | return true
142 | end
143 |
144 | local function PrintIgnoreList()
145 | local spells = { }
146 | for spellID in pairs(LBA.db.profile.denySpells) do
147 | local spell = Spell:CreateFromSpellID(spellID)
148 | if not spell:IsSpellEmpty() then
149 | spell:ContinueOnSpellLoad(function () table.insert(spells, spell) end)
150 | end
151 | end
152 | table.sort(spells, function (a, b) return a:GetSpellName() < b:GetSpellName() end)
153 | printf(L["Ignored abilities"]..":")
154 | for i, spell in ipairs(spells) do
155 | printf("%3d. %s (%d)", i, spell:GetSpellName() or "?", spell:GetSpellID())
156 | end
157 | end
158 |
159 | local function IgnoreCommand(argstr)
160 | local _, cmd, spell = strsplit(" ", argstr, 3)
161 | if cmd == 'list' then
162 | PrintIgnoreList()
163 | elseif cmd == 'default' then
164 | LBA.DefaultIgnoreSpells()
165 | elseif cmd == 'wipe' then
166 | LBA.WipeIgnoreSpells()
167 | elseif cmd == 'add' and spell then
168 | local info = C_Spell.GetSpellInfo(spell)
169 | if info then
170 | LBA.AddIgnoreSpell(info.spellID)
171 | else
172 | printf(L["Error: unknown spell: %s"], spell)
173 | end
174 | elseif cmd == 'remove' and spell then
175 | local info = C_Spell.GetSpellInfo(spell)
176 | if info then
177 | LBA.RemoveIgnoreSpell(info.spellID)
178 | else
179 | printf(L["Error: unknown spell: %s"], spell)
180 | end
181 | else
182 | PrintIgnoreUsage()
183 | end
184 | return true
185 | end
186 |
187 | local function SlashCommand(argstr)
188 | local args = { strsplit(" ", argstr) }
189 | local cmd = table.remove(args, 1)
190 | local n = cmd:len()
191 |
192 | if cmd == '' then
193 | PrintOptions()
194 | elseif cmd == ('options'):sub(1,n) then
195 | LBA.OpenOptions()
196 | elseif cmd:lower() == 'stack' and #args == 1 then
197 | LBA.SetOptionOutsideUI('showStacks', args[1])
198 | elseif cmd:lower() == 'stackposition' and WithinRange(#args, 1, 2) then
199 | LBA.SetOptionOutsideUI('stacksAnchor', args[1])
200 | if args[2] then LBA.SetOptionOutsideUI('stacksAdjust', args[2]) end
201 | elseif cmd:lower() == 'timer' and #args == 1 then
202 | LBA.SetOptionOutsideUI('showTimers', args[1])
203 | elseif cmd:lower() == 'colortimer' and #args == 1 then
204 | LBA.SetOptionOutsideUI('colorTimers', args[1])
205 | elseif cmd:lower() == 'decimaltimer' and #args == 1 then
206 | LBA.SetOptionOutsideUI('decimalTimers', args[1])
207 | elseif cmd:lower() == 'font' and WithinRange(#args, 1, 3) then
208 | SetFont(args)
209 | elseif cmd:lower() == 'timerposition' and WithinRange(#args, 1, 2) then
210 | LBA.SetOptionOutsideUI('timerAnchor', args[1])
211 | if args[2] then LBA.SetOptionOutsideUI('timerAdjust', args[2]) end
212 | elseif cmd:lower() == 'aura' then
213 | AuraCommand(argstr)
214 | elseif cmd:lower() == 'ignore' then
215 | IgnoreCommand(argstr)
216 | elseif cmd:lower() == 'dump' then
217 | LiteButtonAurasController:DumpAllOverlays()
218 | else
219 | PrintUsage()
220 | end
221 | return true
222 | end
223 |
224 | function LBA.SetupSlashCommand()
225 | SlashCmdList['LiteButtonAuras'] = SlashCommand
226 | _G.SLASH_LiteButtonAuras1 = "/litebuttonauras"
227 | _G.SLASH_LiteButtonAuras1 = "/lba"
228 | end
229 |
--------------------------------------------------------------------------------
/SpellData.lua:
--------------------------------------------------------------------------------
1 | --[[----------------------------------------------------------------------------
2 |
3 | LiteButtonAuras
4 | Copyright 2021 Mike "Xodiv" Battersby
5 |
6 | This is a register of spells that match a few criteria for special
7 | display: interrupts, soothes, dispels. Also a list of model IDs to
8 | match totem/guardians to spells (5th return value of GetTotemInfo)
9 | since the names differ a lot.
10 |
11 | ----------------------------------------------------------------------------]]--
12 |
13 | local _, LBA = ...
14 |
15 | local C_Spell = LBA.C_Spell or C_Spell
16 |
17 | -- Now these are matched by name don't worry about finding all the spell IDs
18 | -- for all the versions. On classic_era this is ranks, but even on live
19 | -- there are multiple Singe Magic (for example).
20 |
21 | LBA.Interrupts = {
22 | [ 47528] = true, -- Mind Freeze (Death Knight)
23 | [183752] = true, -- Disrupt (Demon Hunter)
24 | -- [202137] = true, -- Sigil of Silence (Demon Hunter)
25 | [ 78675] = true, -- Solar Beam (Druid)
26 | [106839] = true, -- Skull Bash (Druid)
27 | [147362] = true, -- Counter Shot (Hunter)
28 | [187707] = true, -- Muzzle (Hunter)
29 | [ 2139] = true, -- Counterspell (Mage)
30 | [116705] = true, -- Spear Hand Strike (Monk)
31 | [ 96231] = true, -- Rebuke (Paladin)
32 | -- [ 31935] = true, -- Avenger's Shield (Paladin)
33 | [ 15487] = true, -- Silence (Priest)
34 | [ 1766] = true, -- Kick (Rogue)
35 | [ 57994] = true, -- Wind Shear (Shaman)
36 | [ 19647] = true, -- Spell Lock (Warlock Felhunter Pet)
37 | [ 89766] = true, -- Axe Toss (Warlock Felguard Pet)
38 | [ 6552] = true, -- Pummel (Warrior)
39 | [351338] = true, -- Quell (Evoker)
40 | }
41 |
42 | LBA.Soothes = {
43 | [ 2908] = true, -- Soothe (Druid)
44 | [ 19801] = true, -- Tranquilizing Shot (Hunter)
45 | [ 5938] = true, -- Shiv (Rogue)
46 | [115078] = function () -- Paralysis (Monk) with Pressure Points
47 | return IsPlayerSpell(450432)
48 | end,
49 | }
50 |
51 | LBA.HostileDispels = {
52 | [278326] = { Magic = true }, -- Consume Magic (Demon Hunter)
53 | [ 19801] = { Magic = true }, -- Tranquilizing Shot (Hunter)
54 | [ 30449] = { Magic = true }, -- Spellsteal (Mage)
55 | [ 528] = { Magic = true }, -- Dispel Magic (Priest)
56 | [ 32375] = { Magic = true }, -- Mass Dispel (Priest)
57 | [ 370] = { Magic = true }, -- Purge (Shaman)
58 | [ 19505] = { Magic = true }, -- Devour Magic (Warlock)
59 | [ 25046] = { Magic = true }, -- Arcane Torrent (Blood Elf Rogue)
60 | -- [ 28730] = { Magic = true }, -- Arcane Torrent (Blood Elf Mage/Warlock)
61 | -- [ 50613] = { Magic = true }, -- Arcane Torrent (Blood Elf Death Knight)
62 | -- [ 69179] = { Magic = true }, -- Arcane Torrent (Blood Elf Warrior)
63 | -- [ 80483] = { Magic = true }, -- Arcane Torrent (Blood Elf Hunter)
64 | -- [129597] = { Magic = true }, -- Arcane Torrent (Blood Elf Monk)
65 | -- [155145] = { Magic = true }, -- Arcane Torrent (Blood Elf Paladin)
66 | -- [202719] = { Magic = true }, -- Arcane Torrent (Blood Elf Demon Hunter)
67 | -- [232633] = { Magic = true }, -- Arcane Torrent (Blood Elf Priest)
68 | }
69 |
70 | LBA.Taunts = {
71 | [ 355] = true, -- Taunt (Warrior)
72 | [ 51399] = true, -- Death Grip (Death Knight)
73 | [ 56222] = true, -- Dark Command (Death Knight)
74 | [116189] = true, -- Provoke (Monk)
75 | [ 62124] = true, -- Hand of Reckoning (Paladin)
76 | [185245] = true, -- Torment (Demon Hunter)
77 | [ 6795] = true, -- Growl (Druid)
78 | [ 17735] = true, -- Suffering (Warlock Voidwalker Pet)
79 | [ 2649] = true, -- Growl (Hunter Pet)
80 | [ 1161] = true, -- Challenging Shout (Warrior)
81 | [386071] = true, -- Disrupting Shout (Warrior)
82 | }
83 |
84 | -- Where the totem name does not match the spell name. There's few enough
85 | -- of these that I think it's possible to maintain it.
86 | --
87 | -- [model] = Summoning Spell Name
88 | --
89 | -- for i = 1, MAX_TOTEMS do
90 | -- local exists, name, startTime, duration, model = GetTotemInfo(i)
91 |
92 | LBA.TotemOrGuardianModels = {
93 | [ 136119] = C_Spell.GetSpellName(46584), -- Raise Dead (DK)
94 | [ 627607] = C_Spell.GetSpellName(115315), -- Black Ox Statue (Monk)
95 | [ 620831] = C_Spell.GetSpellName(115313), -- Jade Serpent Statue (Monk)
96 | [4667418] = C_Spell.GetSpellName(388686), -- White Tiger Statue (Monk)
97 | [ 620832] = C_Spell.GetSpellName(123904), -- Xuen,the White Tiger (Monk)
98 | [ 574571] = C_Spell.GetSpellName(322118), -- Yu'lon, The Jade Serpent (Monk)
99 | -- [ 608951] = C_Spell.GetSpellName(132578), -- Niuzao, the Black Ox (Monk)
100 | [ 877514] = C_Spell.GetSpellName(325197), -- Chi-ji, The Red Crane (Monk)
101 | [ 136024] = C_Spell.GetSpellName(198103), -- Earth Elemental (Shaman)
102 | [ 135790] = C_Spell.GetSpellName(198067), -- Fire Elemental (Shaman)
103 | [1020304] = C_Spell.GetSpellName(192249), -- Storm Elemental (Shaman)
104 | [ 237577] = C_Spell.GetSpellName(51533), -- Feral Spirit (Shaman)
105 | [ 237562] = C_Spell.GetSpellName(111898), -- Grimoire: Felguard (Warlock)
106 | [1378282] = C_Spell.GetSpellName(104316), -- Call Dreadstalkers (Warlock)
107 | [1616211] = C_Spell.GetSpellName(264119), -- Summon Vilefiend (Warlock)
108 | [1709931] = C_Spell.GetSpellName(455476), -- Summon Charhound (Warlock)
109 | [1709932] = C_Spell.GetSpellName(455465), -- Summon Gloomhound (Warlock)
110 | }
111 |
112 | LBA.WeaponEnchantSpellID = {
113 | [ 5400] = C_Spell.GetSpellName(318038), -- Flametongue Weapon
114 | [ 5401] = C_Spell.GetSpellName(33757), -- Windfury Weapon
115 | [ 6498] = C_Spell.GetSpellName(382021), -- Earthliving Weapon
116 | [ 7528] = C_Spell.GetSpellName(457481), -- Tidecaller's Guard
117 | [ 7587] = C_Spell.GetSpellName(462757), -- Thunderstrike Ward
118 | }
119 |
120 | -- The main reason for this is that Classic Era still has spell ranks,
121 | -- each rank has a different spell ID, and the tables above only have the
122 | -- first rank since that's what retail/wotlk use. It is generally more in
123 | -- keeping with our "match by name" anyway.
124 |
125 | -- Note: due to https://github.com/Stanzilla/WoWUIBugs/issues/373 it's not
126 | -- safe to use ContinueOnSpellLoad as it taints the spellbook if we're the
127 | -- first to query the spell. Fingers crossed that C_Spell.GetSpellName always
128 | -- return true for spellbook spells, even at load time. Otherwise I'll have
129 | -- to build my own SpellEventListener.
130 |
131 | do
132 | local function AddSpellNames(t)
133 | local spellIDs = GetKeysArray(t)
134 | for _, spellID in ipairs(spellIDs) do
135 | local name = C_Spell.GetSpellName(spellID)
136 | if name then
137 | t[name] = t[spellID]
138 | --@debug@
139 | else
140 | print('Missing ' .. tostring(spellID))
141 | --@end-debug@
142 | end
143 | end
144 | end
145 |
146 | AddSpellNames(LBA.Interrupts)
147 | AddSpellNames(LBA.Soothes)
148 | AddSpellNames(LBA.HostileDispels)
149 | AddSpellNames(LBA.Taunts)
150 | end
151 |
152 | --@debug@
153 | _G.LBA = LBA
154 | --@end-debug@
155 |
--------------------------------------------------------------------------------
/Textures/Overlay.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xod-wow/LiteButtonAuras/4a25d75a773f966c6c78e14d24bfa6c41912494f/Textures/Overlay.tga
--------------------------------------------------------------------------------
/Textures/Square_FullWhite.tga:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xod-wow/LiteButtonAuras/4a25d75a773f966c6c78e14d24bfa6c41912494f/Textures/Square_FullWhite.tga
--------------------------------------------------------------------------------
/UI/AceGUIWidgets-LBAAnchorButtons.lua:
--------------------------------------------------------------------------------
1 | -- From WeakAuras2
2 |
3 | local Type, Version = "LBAAnchorButtons", 2
4 | local AceGUI = LibStub("AceGUI-3.0")
5 | if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
6 |
7 | local directions = { "TOPLEFT", "TOP", "TOPRIGHT", "LEFT", "CENTER", "RIGHT", "BOTTOMLEFT", "BOTTOM", "BOTTOMRIGHT" }
8 | local buttonSize = 10
9 | local frameWidth = 100
10 | local frameHeight = 50
11 | local titleHeight = 22
12 |
13 | local methods = {
14 | ["OnAcquire"] = function(self)
15 | self:SetWidth(frameWidth + buttonSize)
16 | self:SetHeight(frameHeight + buttonSize + titleHeight + 2)
17 | self:SetDisabled(false)
18 | end,
19 |
20 | ["SetValue"] = function(self, text)
21 | if not tContains(directions, text) then return end
22 | for direction, button in pairs(self.buttons) do
23 | if direction == text then
24 | button.tex:SetVertexColor(0.9, 0.9, 0, 1)
25 | else
26 | button.tex:SetVertexColor(0.3, 0.3, 0.3, 1)
27 | end
28 | button:SetNormalTexture(button.tex)
29 | end
30 | self.value = text
31 | end,
32 |
33 | ["GetValue"] = function(self)
34 | return self.value
35 | end,
36 |
37 | ["SetLabel"] = function(self, text)
38 | if text and text ~= "" then
39 | self.label:SetText(text);
40 | self.label:Show()
41 | else
42 | self.label:SetText("")
43 | self.label:Hide()
44 | end
45 | end,
46 |
47 | ["SetList"] = function() end,
48 |
49 | ["SetDisabled"] = function(self, disabled)
50 | self.disabled = disabled
51 | if disabled then
52 | self.label:SetTextColor(0.5,0.5,0.5)
53 | for _, button in pairs(self.buttons) do
54 | button:EnableMouse(false)
55 | end
56 | else
57 | self.label:SetTextColor(1,.82,0)
58 | for _, button in pairs(self.buttons) do
59 | button:EnableMouse(true)
60 | end
61 | end
62 | end,
63 | }
64 |
65 | local function buttonClicked(self)
66 | AceGUI:ClearFocus()
67 | local frame = self:GetParent()
68 | local widget = frame.obj
69 | widget:SetValue(self.value)
70 | widget:Fire("OnValueChanged", self.value)
71 | end
72 |
73 | local function Constructor()
74 | local name = "LBAAnchorButtons" .. AceGUI:GetNextWidgetNum(Type)
75 | local frame = CreateFrame("Frame", name, UIParent)
76 | frame:SetSize(frameWidth, frameHeight)
77 | frame:SetFrameStrata("FULLSCREEN_DIALOG")
78 |
79 | local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall");
80 | label:SetHeight(titleHeight);
81 | label:SetJustifyH("CENTER");
82 | label:SetPoint("TOP", frame, "TOP");
83 |
84 | local background = CreateFrame("Frame", nil, frame, "BackdropTemplate")
85 | background:SetSize(frameWidth, frameHeight)
86 | background:SetPoint("TOP", frame, "TOP", 0, -(titleHeight + 4))
87 | background:SetBackdrop({
88 | bgFile = "Interface\\AddOns\\LiteButtonAuras\\Textures\\Square_FullWhite.tga",
89 | edgeFile = "Interface\\AddOns\\LiteButtonAuras\\Textures\\Square_FullWhite.tga",
90 | tile = true,
91 | tileEdge = true,
92 | --tileSize = 8,
93 | edgeSize = 2
94 | --insets = { left = 1, right = 1, top = 1, bottom = 1 },
95 | })
96 | background:SetBackdropColor(0.2,0.2,0.2,0.5)
97 | background:SetBackdropBorderColor(1,1,1,0.6)
98 |
99 | local buttons = {}
100 | for _, direction in ipairs(directions) do
101 | local button = CreateFrame("Button", nil, frame)
102 | button:SetSize(buttonSize, buttonSize)
103 | button:SetPoint(
104 | "CENTER",
105 | background,
106 | direction
107 | )
108 |
109 | local buttonTex = button:CreateTexture()
110 | buttonTex:SetAllPoints()
111 | buttonTex:SetTexture("Interface\\AddOns\\LiteButtonAuras\\Textures\\Square_FullWhite.tga")
112 | buttonTex:SetVertexColor(0.3, 0.3, 0.3, 1)
113 | button:SetNormalTexture(buttonTex)
114 | button.tex = buttonTex
115 | button.value = direction
116 |
117 | button:SetScript("OnClick", buttonClicked)
118 | buttons[direction] = button
119 | end
120 |
121 | --- @type table
122 | local widget = {
123 | frame = frame,
124 | type = Type,
125 | buttons = buttons,
126 | label = label
127 | }
128 | for method, func in pairs(methods) do
129 | widget[method] = func
130 | end
131 |
132 | return AceGUI:RegisterAsWidget(widget);
133 | end
134 |
135 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
136 |
--------------------------------------------------------------------------------
/UI/AceGUIWidgets-LBAInputFocus.lua:
--------------------------------------------------------------------------------
1 | --[[-----------------------------------------------------------------------------
2 | From WeakAuras2
3 | Input Widget that allows to show an alternative text when it does not have focus
4 | Uses \0 to separate the without and with focus texts.
5 | -------------------------------------------------------------------------------]]
6 |
7 | local Type, Version = "LBAInputFocus", 1
8 | local AceGUI = LibStub("AceGUI-3.0", true)
9 |
10 | local OnEditFocusGained = function(self)
11 | local textWithFocus = self.obj.textWithFocus
12 | if textWithFocus and self:GetText() == self.obj.textWithoutFocus then
13 | self:SetText(textWithFocus)
14 | end
15 | AceGUI:SetFocus(self.obj)
16 | end
17 |
18 | local function Constructor()
19 | local frame = AceGUI:Create("EditBox")
20 | frame.type = Type
21 |
22 | frame.editbox:SetScript("OnEditFocusGained", OnEditFocusGained)
23 |
24 | local oldSetText = frame.SetText
25 | frame.SetText = function(self, text)
26 | text = text or ""
27 | local pos = string.find(text, "\0", nil, true)
28 | if pos then
29 | self.textWithoutFocus = text:sub(1, pos -1)
30 | self.textWithFocus = text:sub(pos + 1)
31 | oldSetText(self, self.textWithoutFocus)
32 | else
33 | self.textWithFocus = nil
34 | self.textWithoutFocus = nil
35 | oldSetText(self, text)
36 | end
37 | end
38 |
39 | return frame
40 | end
41 |
42 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
43 |
--------------------------------------------------------------------------------
/UI/AceGUIWidgets-LBAInputSpellID.lua:
--------------------------------------------------------------------------------
1 | local _, LBA = ...
2 |
3 | local C_Spell = LBA.C_Spell or C_Spell
4 |
5 | local AceGUI = LibStub("AceGUI-3.0")
6 |
7 | local Type = "LBAInputSpellID"
8 | local Version = 1
9 | local PREDICTION_ROWS = 20
10 |
11 | local function GetSpellText(id)
12 | local info = C_Spell.GetSpellInfo(id or 0)
13 | if info then
14 | local idText = HIGHLIGHT_FONT_COLOR:WrapTextInColorCode(string.format('(%d)', info.spellID))
15 | return string.format("%s %s", info.name, idText)
16 | else
17 | return ''
18 | end
19 | end
20 |
21 | -- [[ SpellCache ]] ------------------------------------------------------------
22 |
23 | local SpellCache = CreateFrame("Frame")
24 |
25 | function SpellCache.BuildCoRoutine()
26 | local id = 0
27 | local misses = 0
28 | while misses < 80000 do
29 | id = id + 1
30 | local info = C_Spell.GetSpellInfo(id)
31 |
32 | if not info then
33 | misses = misses + 1
34 | elseif info.iconID == 136243 then
35 | -- 136243 is the a gear icon, we can ignore those spells
36 | misses = 0;
37 | elseif info.name and info.name ~= "" and info.iconID then
38 | local name = info.name:lower()
39 | SpellCache.spells[name] = SpellCache.spells[name] or {}
40 | table.insert(SpellCache.spells[name], id)
41 | if WOW_PROJECT_ID == WOW_PROJECT_CLASSIC and id == 81748 then
42 | -- jump around big hole with classic SoD
43 | id = 219002
44 | end
45 | misses = 0
46 | else
47 | misses = misses + 1
48 | end
49 | if id % 1000 == 0 then
50 | coroutine.yield()
51 | end
52 | end
53 | for _, cacheLine in pairs(SpellCache.spells) do
54 | table.sort(cacheLine)
55 | end
56 | end
57 |
58 | function SpellCache:Build()
59 |
60 | if self.spells then return end
61 |
62 | self.spells = {}
63 |
64 | local co = coroutine.create(self.BuildCoRoutine)
65 | coroutine.resume(co)
66 |
67 | self:SetScript("OnUpdate",
68 | function (self, elapsed)
69 | if coroutine.status(co) == "dead" then
70 | self:SetScript("OnUpdate", nil)
71 | else
72 | coroutine.resume(co)
73 | end
74 | end)
75 | end
76 |
77 | function SpellCache:Get(name)
78 | if name then
79 | name = name:lower()
80 | return self.spells[name]
81 | end
82 | end
83 |
84 |
85 | -- [[ OkayButton ]] ------------------------------------------------------------
86 |
87 | local OkayButtonMixin = {}
88 |
89 | function OkayButtonMixin:Initialize(obj)
90 | self.obj = obj
91 | self:SetWidth(40)
92 | self:SetHeight(20)
93 | self:SetText(OKAY)
94 | self:SetScript("OnClick", self.OnClick)
95 | self:Hide()
96 | end
97 |
98 | function OkayButtonMixin:OnClick()
99 | local editBox = self.obj.editBox
100 | editBox:OnEnterPressed()
101 | editBox:ClearFocus()
102 | end
103 |
104 |
105 | -- [[ PredictSpellButton ]] ----------------------------------------------------
106 |
107 | local PredictSpellButtonMixin = {}
108 |
109 | function PredictSpellButtonMixin:OnEnter()
110 | GameTooltip:SetOwner(self, "ANCHOR_BOTTOMRIGHT")
111 | GameTooltip:SetHyperlink("spell:" .. self.spellID)
112 | end
113 |
114 | function PredictSpellButtonMixin:OnClick()
115 | self.obj:SetValue(self.spellID)
116 | self.obj:SubmitValue()
117 | self.obj:Update()
118 | end
119 |
120 | function PredictSpellButtonMixin:SetSpell(id)
121 | self.spellID = id
122 | local info = C_Spell.GetSpellInfo(id)
123 | self:SetFormattedText("|T%s:18:18:0:0|t %s", info.iconID, GetSpellText(id))
124 | end
125 |
126 | function PredictSpellButtonMixin:Initialize(obj)
127 | self.obj = obj
128 | self:SetHeight(22)
129 | self:SetScript("OnClick", self.OnClick)
130 | self:SetScript("OnEnter", self.OnEnter)
131 | self:SetScript("OnLeave", GameTooltip_Hide)
132 |
133 | -- Create the actual text
134 | self.text = self:CreateFontString(nil, "ARTWORK", "GameFontNormal")
135 | self.text:SetJustifyH("LEFT")
136 | self.text:SetAllPoints(self)
137 | self:SetFontString(self.text)
138 |
139 | -- Setup the highlighting
140 | self.highlightTexture = self:CreateTexture(nil, "ARTWORK")
141 | self.highlightTexture:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
142 | self.highlightTexture:ClearAllPoints()
143 | self.highlightTexture:SetPoint("TOPLEFT", self, 0, -2)
144 | self.highlightTexture:SetPoint("BOTTOMRIGHT", self, 5, 2)
145 | self.highlightTexture:SetAlpha(0.70)
146 |
147 | self:SetHighlightTexture(self.highlightTexture)
148 | self:SetHighlightFontObject(GameFontHighlight)
149 | self:SetNormalFontObject(GameFontNormal)
150 | end
151 |
152 |
153 | -- [[ PredictFrame ]] ----------------------------------------------------------
154 |
155 | local PredictFrameMixin = {}
156 |
157 | local backdrop = {
158 | bgFile = "Interface/Tooltips/UI-Tooltip-Background",
159 | tile = true,
160 | tileSize = 16,
161 | edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
162 | tileEdge = true,
163 | edgeSize = 16,
164 | insets = { left = 4, right = 4, top = 4, bottom = 4 },
165 | }
166 |
167 | function PredictFrameMixin:Initialize(obj)
168 | self.obj = obj
169 |
170 | self:SetBackdrop(backdrop)
171 | self:SetBackdropColor(0, 0, 0, 0.85)
172 | self:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
173 | self:SetFrameStrata("TOOLTIP")
174 |
175 | self.buttons = {}
176 |
177 | for i = 1, PREDICTION_ROWS do
178 | local button = CreateFrame("Button", self:GetName() .. "Button" .. i, self)
179 | Mixin(button, PredictSpellButtonMixin)
180 | button:Initialize(obj)
181 |
182 | if i > 1 then
183 | button:SetPoint("TOPLEFT", self.buttons[i - 1], "BOTTOMLEFT", 0, 0)
184 | button:SetPoint("TOPRIGHT", self.buttons[i - 1], "BOTTOMRIGHT", 0, 0)
185 | else
186 | -- Total vOff here 8+7 = 15 matches the 15 + for SetHeight
187 | button:SetPoint("TOPLEFT", self, 8, -8)
188 | button:SetPoint("TOPRIGHT", self, -7, 0)
189 | end
190 |
191 | self.buttons[i] = button
192 | end
193 | end
194 |
195 | function PredictFrameMixin:UpdateSearch(name)
196 | for _, button in pairs(self.buttons) do
197 | button:Hide()
198 | end
199 |
200 | local spellIDList = SpellCache:Get(name)
201 | local nShown = 0
202 |
203 | if spellIDList then
204 | for i, spellID in ipairs(spellIDList) do
205 | local button = self.buttons[i]
206 | button:SetSpell(spellID)
207 | button:Show()
208 |
209 | button:UnlockHighlight()
210 | if GameTooltip:IsOwned(button) then
211 | GameTooltip_Hide()
212 | end
213 |
214 | nShown = i
215 |
216 | if i >= PREDICTION_ROWS then
217 | break
218 | end
219 | end
220 | self:SetHeight(15 + nShown * self.buttons[1]:GetHeight())
221 | self:Show()
222 | else
223 | self:Hide()
224 | end
225 | end
226 |
227 |
228 | -- [[ EditBox ]] ---------------------------------------------------------------
229 |
230 | local EditBoxMixin = {}
231 |
232 | function EditBoxMixin:OnTextChanged()
233 | local value = self:GetText()
234 | self.obj:Fire("OnTextChanged", value)
235 | self.obj:Update()
236 | end
237 |
238 | function EditBoxMixin:OnEditFocusLost()
239 | self.obj:Update()
240 | end
241 |
242 | function EditBoxMixin:OnEditFocusGained()
243 | self:SetText(self.obj.value or '')
244 | self.obj:Update()
245 | end
246 |
247 | function EditBoxMixin:OnEscapePressed()
248 | self:ClearFocus()
249 | end
250 |
251 | function EditBoxMixin:OnEnterPressed()
252 | local value = self:GetText()
253 | self.obj:SetValue(value)
254 | local isInvalid = self.obj:SubmitValue()
255 | if isInvalid then self:SetFocus() end
256 | self.obj:Update()
257 | end
258 |
259 | function EditBoxMixin:OnEnter()
260 | self.obj:Fire("OnEnter")
261 | end
262 |
263 | function EditBoxMixin:OnLeave()
264 | self.obj:Fire("OnLeave")
265 | end
266 |
267 | function EditBoxMixin:Initialize(obj)
268 | self.obj = obj
269 | self:SetAutoFocus(false)
270 | self:SetFontObject(ChatFontNormal)
271 | self:SetScript("OnEnter", self.OnEnter)
272 | self:SetScript("OnLeave", self.OnLeave)
273 | self:SetScript("OnEscapePressed", self.OnEscapePressed)
274 | self:SetScript("OnEnterPressed", self.OnEnterPressed)
275 | self:SetScript("OnTextChanged", self.OnTextChanged)
276 | self:SetScript("OnEditFocusGained", self.OnEditFocusGained)
277 | self:SetScript("OnEditFocusLost", self.OnEditFocusLost)
278 | self:SetTextInsets(0, 0, 3, 3)
279 | self:SetMaxLetters(256)
280 | end
281 |
282 |
283 | --[[ Main Widget ]] ------------------------------------------------------------
284 |
285 | local methods = {
286 |
287 | OnAcquire =
288 | function (self)
289 | self:SetHeight(26)
290 | self:SetWidth(200)
291 | self:SetDisabled(false)
292 | self:SetLabel()
293 | end,
294 |
295 | OnRelease =
296 | function (self)
297 | self.frame:ClearAllPoints()
298 | self.frame:Hide()
299 | self.predictFrame:Hide()
300 | self:SetDisabled(false)
301 | end,
302 |
303 | Update =
304 | function (self)
305 | if self.predictFrame:IsMouseOver() and IsMouseButtonDown('LeftButton') then
306 | -- In the middle of a predict spell click, don't mess it up.
307 | return
308 | end
309 | if self.editBox:HasFocus() then
310 | self.predictFrame:UpdateSearch(self.editBox:GetText())
311 | self.okayButton:Show()
312 | else
313 | self.predictFrame:Hide()
314 | self.editBox:SetText(GetSpellText(self.value))
315 | self.okayButton:Hide()
316 | end
317 | end,
318 |
319 | SetDisabled =
320 | function (self, disabled)
321 | self.disabled = disabled
322 | if disabled then
323 | self.editBox:EnableMouse(false)
324 | self.editBox:ClearFocus()
325 | self.editBox:SetTextColor(0.5, 0.5, 0.5)
326 | self.label:SetTextColor(0.5, 0.5, 0.5)
327 | else
328 | self.editBox:EnableMouse(true)
329 | self.editBox:SetTextColor(1, 1, 1)
330 | self.label:SetTextColor(1, 0.82, 0)
331 | end
332 | end,
333 |
334 | SetText =
335 | function (self, text, cursor)
336 | self.editBox:SetText(text)
337 | self.editBox:SetCursorPosition(cursor or 0)
338 | self:Update()
339 | end,
340 |
341 | SetLabel =
342 | function (self, text)
343 | if text and text ~= "" then
344 | self.label:SetText(text)
345 | self.label:Show()
346 | self.editBox:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 7, -18)
347 | self:SetHeight(44)
348 | self.alignoffset = 30
349 | else
350 | self.label:SetText("")
351 | self.label:Hide()
352 | self.editBox:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 7, 0)
353 | self:SetHeight(26)
354 | self.alignoffset = 12
355 | end
356 | end,
357 |
358 | SetValue =
359 | function (self, value)
360 | if tonumber(value) then
361 | self.value = value
362 | else
363 | local info = C_Spell.GetSpellInfo(value)
364 | self.value = info and info.name or ''
365 | end
366 | end,
367 |
368 | SubmitValue =
369 | function (self)
370 | return self:Fire("OnEnterPressed", self.value or '')
371 | end,
372 | }
373 |
374 |
375 | local function Constructor()
376 | SpellCache:Build()
377 |
378 | local self = CreateFromMixins(methods)
379 | self.type = Type
380 | self.num = AceGUI:GetNextWidgetNum(Type)
381 |
382 | self.frame = CreateFrame("Frame", nil, UIParent)
383 | self.frame:SetHeight(44)
384 | self.frame:SetWidth(200)
385 | self.frame.obj = self
386 |
387 | self.editBox = CreateFrame("EditBox", "AceGUI30SpellEditBox" .. self.num, self.frame, "InputBoxTemplate")
388 | Mixin(self.editBox, EditBoxMixin)
389 | self.editBox:Initialize(self)
390 | self.editBox:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", 6, 0)
391 | self.editBox:SetPoint("BOTTOMRIGHT", self.frame, "BOTTOMRIGHT", 0, 0)
392 | self.editBox:SetHeight(19)
393 |
394 | self.predictFrame = CreateFrame("Frame", "AceGUI30SpellEditBox" .. self.num .. "PredictFrame", UIParent, "BackdropTemplate")
395 | Mixin(self.predictFrame, PredictFrameMixin)
396 | self.predictFrame:Initialize(self)
397 | self.predictFrame:SetPoint("TOPLEFT", self.editBox, "BOTTOMLEFT", -6, 0)
398 | self.predictFrame:SetPoint("TOPRIGHT", self.editBox, "BOTTOMRIGHT", 0, 0)
399 |
400 | self.alignoffset = 30
401 |
402 | self.label = self.frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
403 | self.label:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 0, -2)
404 | self.label:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", 0, -2)
405 | self.label:SetJustifyH("LEFT")
406 | self.label:SetHeight(18)
407 |
408 | self.okayButton = CreateFrame("Button", nil, self.editBox, "UIPanelButtonTemplate")
409 | Mixin(self.okayButton, OkayButtonMixin)
410 | self.okayButton:Initialize(self)
411 | self.okayButton:SetPoint("RIGHT", self.editBox, "RIGHT", -2, 0)
412 |
413 | AceGUI:RegisterAsWidget(self)
414 | return self
415 | end
416 |
417 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
418 |
--------------------------------------------------------------------------------
/UI/AceGUIWidgets-LBAInputValidSpell.lua:
--------------------------------------------------------------------------------
1 | local _, LBA = ...
2 |
3 | local AceGUI = LibStub("AceGUI-3.0")
4 |
5 | local C_Spell = LBA.C_Spell or C_Spell
6 |
7 | local Type = "LBAInputValidSpell"
8 | local Version = 1
9 |
10 | -- [[ SpellCache ]] ------------------------------------------------------------
11 |
12 | local SpellCache = CreateFrame("Frame")
13 |
14 | function SpellCache.BuildCoRoutine()
15 | local id = 0
16 | local misses = 0
17 | while misses < 80000 do
18 | id = id + 1
19 | local info = C_Spell.GetSpellInfo(id)
20 |
21 | if not info then
22 | misses = misses + 1
23 | elseif info.iconID == 136243 then
24 | -- 136243 is the a gear icon, we can ignore those spells
25 | misses = 0;
26 | elseif info.name and info.name ~= "" and info.iconID then
27 | local name = info.name:lower()
28 | SpellCache.spells[name] = SpellCache.spells[name] or {}
29 | table.insert(SpellCache.spells[name], id)
30 | if WOW_PROJECT_ID == WOW_PROJECT_CLASSIC and id == 81748 then
31 | -- jump around big hole with classic SoD
32 | id = 219002
33 | end
34 | misses = 0
35 | else
36 | misses = misses + 1
37 | end
38 | if id % 1000 == 0 then
39 | coroutine.yield()
40 | end
41 | end
42 | for _, cacheLine in pairs(SpellCache.spells) do
43 | table.sort(cacheLine)
44 | end
45 | end
46 |
47 | function SpellCache:Build()
48 |
49 | if self.spells then return end
50 |
51 | self.spells = {}
52 |
53 | local co = coroutine.create(self.BuildCoRoutine)
54 | coroutine.resume(co)
55 |
56 | self:SetScript("OnUpdate",
57 | function (self, elapsed)
58 | if coroutine.status(co) == "dead" then
59 | self:SetScript("OnUpdate", nil)
60 | else
61 | coroutine.resume(co)
62 | end
63 | end)
64 | end
65 |
66 | function SpellCache:IsValidSpell(v)
67 | if C_Spell.GetSpellName(v) then
68 | return true
69 | elseif type(v) == 'string' then
70 | v = v:lower()
71 | return self.spells[v] ~= nil
72 | end
73 | end
74 |
75 |
76 | -- [[ OkayButton ]] ------------------------------------------------------------
77 |
78 | local OkayButtonMixin = {}
79 |
80 | function OkayButtonMixin:Initialize(obj)
81 | self.obj = obj
82 | self:SetWidth(40)
83 | self:SetHeight(20)
84 | self:SetText(OKAY)
85 | self:SetScript("OnClick", self.OnClick)
86 | self:SetScript("OnShow", self.OnShow)
87 | self:SetScript("OnHide", self.OnHide)
88 | self:Hide()
89 | end
90 |
91 | function OkayButtonMixin:OnClick()
92 | local editBox = self.obj.editBox
93 | editBox:OnEnterPressed()
94 | end
95 |
96 | function OkayButtonMixin:OnShow()
97 | self.obj.editBox:SetTextInsets(0, 20, 3, 3)
98 | end
99 |
100 | function OkayButtonMixin:OnHide()
101 | self.obj.editBox:SetTextInsets(0, 0, 3, 3)
102 | end
103 |
104 | -- [[ EditBox ]] ---------------------------------------------------------------
105 |
106 | local EditBoxMixin = {}
107 |
108 | function EditBoxMixin:OnTextChanged()
109 | local value = self:GetText()
110 | if value ~= self.lastText then
111 | self.lastText = value
112 | if SpellCache:IsValidSpell(value) then
113 | self.obj.okayButton:Show()
114 | end
115 | self.obj:Fire("OnTextChanged", value)
116 | end
117 | end
118 |
119 | function EditBoxMixin:OnEditFocusGained()
120 | AceGUI:SetFocus(self.obj)
121 | end
122 |
123 | function EditBoxMixin:OnEscapePressed()
124 | self:ClearFocus()
125 | end
126 |
127 | function EditBoxMixin:OnEnterPressed()
128 | local value = self:GetText()
129 | if SpellCache:IsValidSpell(value) then
130 | local isInvalid = self.obj:Fire("OnEnterPressed", value)
131 | if isInvalid then
132 | self:SetFocus()
133 | else
134 | self.obj.okayButton:Hide()
135 | end
136 | end
137 | end
138 |
139 | function EditBoxMixin:OnEnter()
140 | self.obj:Fire("OnEnter")
141 | end
142 |
143 | function EditBoxMixin:OnLeave()
144 | self.obj:Fire("OnLeave")
145 | end
146 |
147 | function EditBoxMixin:Initialize(obj)
148 | self.obj = obj
149 | self:SetAutoFocus(false)
150 | self:SetFontObject(ChatFontNormal)
151 | self:SetScript("OnEnter", self.OnEnter)
152 | self:SetScript("OnLeave", self.OnLeave)
153 | self:SetScript("OnEscapePressed", self.OnEscapePressed)
154 | self:SetScript("OnEnterPressed", self.OnEnterPressed)
155 | self:SetScript("OnTextChanged", self.OnTextChanged)
156 | self:SetScript("OnEditFocusGained", self.OnEditFocusGained)
157 | self:SetTextInsets(0, 0, 3, 3)
158 | self:SetMaxLetters(256)
159 | end
160 |
161 |
162 | --[[ Main Widget ]] ------------------------------------------------------------
163 |
164 | local methods = {
165 |
166 | OnAcquire =
167 | function (self)
168 | self:SetHeight(26)
169 | self:SetWidth(200)
170 | self:SetDisabled(false)
171 | self:SetLabel()
172 | end,
173 |
174 | OnRelease =
175 | function (self)
176 | self.frame:ClearAllPoints()
177 | self.frame:Hide()
178 | self:SetDisabled(false)
179 | end,
180 |
181 | SetDisabled =
182 | function (self, disabled)
183 | self.disabled = disabled
184 | if disabled then
185 | self.editBox:EnableMouse(false)
186 | self.editBox:ClearFocus()
187 | self.editBox:SetTextColor(0.5, 0.5, 0.5)
188 | self.label:SetTextColor(0.5, 0.5, 0.5)
189 | else
190 | self.editBox:EnableMouse(true)
191 | self.editBox:SetTextColor(1, 1, 1)
192 | self.label:SetTextColor(1, 0.82, 0)
193 | end
194 | end,
195 |
196 | SetText =
197 | function (self, text, cursor)
198 | self.editBox:SetText(text)
199 | self.editBox:SetCursorPosition(cursor or 0)
200 | end,
201 |
202 | SetLabel =
203 | function (self, text)
204 | if text and text ~= "" then
205 | self.label:SetText(text)
206 | self.label:Show()
207 | self.editBox:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 7, -18)
208 | self:SetHeight(44)
209 | self.alignoffset = 30
210 | else
211 | self.label:SetText("")
212 | self.label:Hide()
213 | self.editBox:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 7, 0)
214 | self:SetHeight(26)
215 | self.alignoffset = 12
216 | end
217 | end,
218 | }
219 |
220 |
221 | local function Constructor()
222 | SpellCache:Build()
223 |
224 | local self = CreateFromMixins(methods)
225 | self.type = Type
226 | self.num = AceGUI:GetNextWidgetNum(Type)
227 |
228 | self.frame = CreateFrame("Frame", nil, UIParent)
229 | self.frame:SetHeight(44)
230 | self.frame:SetWidth(200)
231 | self.frame.obj = self
232 |
233 | self.editBox = CreateFrame("EditBox", "AceGUI30SpellEditBox" .. self.num, self.frame, "InputBoxTemplate")
234 | Mixin(self.editBox, EditBoxMixin)
235 | self.editBox:Initialize(self)
236 | self.editBox:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", 6, 0)
237 | self.editBox:SetPoint("BOTTOMRIGHT", self.frame, "BOTTOMRIGHT", 0, 0)
238 | self.editBox:SetHeight(19)
239 |
240 | self.label = self.frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
241 | self.label:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 0, -2)
242 | self.label:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", 0, -2)
243 | self.label:SetJustifyH("LEFT")
244 | self.label:SetHeight(18)
245 |
246 | self.okayButton = CreateFrame("Button", nil, self.editBox, "UIPanelButtonTemplate")
247 | Mixin(self.okayButton, OkayButtonMixin)
248 | self.okayButton:Initialize(self)
249 | self.okayButton:SetPoint("RIGHT", self.editBox, "RIGHT", -2, 0)
250 |
251 | self.alignoffset = 30
252 |
253 | AceGUI:RegisterAsWidget(self)
254 | return self
255 | end
256 |
257 | AceGUI:RegisterWidgetType(Type, Constructor, Version)
258 |
--------------------------------------------------------------------------------
/UI/Options.lua:
--------------------------------------------------------------------------------
1 | --[[----------------------------------------------------------------------------
2 |
3 | LiteButtonAuras/Options.lua
4 |
5 | Copyright 2015 Mike Battersby
6 |
7 | ----------------------------------------------------------------------------]]--
8 |
9 | local addonName, LBA = ...
10 |
11 | local L = LBA.L
12 |
13 | local C_Spell = LBA.C_Spell or C_Spell
14 |
15 | local LSM = LibStub('LibSharedMedia-3.0')
16 | local FONT = LSM.MediaType.FONT
17 | local ALL_FONTS = LSM:HashTable(FONT)
18 |
19 | local ANCHOR_SELECT_VALUES = {
20 | BOTTOMLEFT = L["Bottom left"],
21 | BOTTOM = L["Bottom"],
22 | BOTTOMRIGHT = L["Bottom right"],
23 | RIGHT = L["Right"],
24 | TOPRIGHT = L["Top right"],
25 | TOP = L["Top"],
26 | TOPLEFT = L["Top left"],
27 | LEFT = L["Left"],
28 | CENTER = L["Center"]
29 | }
30 |
31 | local function Getter(info)
32 | local k = info[#info]
33 | return LBA.db.profile[k]
34 | end
35 |
36 | local function Setter(info, val ,...)
37 | local k = info[#info]
38 | LBA.SetOption(k, val)
39 | end
40 |
41 | local function FontPathGetter(info)
42 | for name, path in pairs(ALL_FONTS) do
43 | if path == LBA.db.profile.fontPath then
44 | return name
45 | end
46 | end
47 | end
48 |
49 | local function FontPathSetter(info, name)
50 | if ALL_FONTS[name] then
51 | LBA.SetOption('fontPath', ALL_FONTS[name])
52 | end
53 | end
54 |
55 | local function ValidateSpellValue(_, v)
56 | if v == "" then
57 | return true
58 | elseif v and C_Spell.GetSpellInfo(v) ~= nil then
59 | return true
60 | else
61 | return format(
62 | L["Error: unknown spell: %s"] ..
63 | "\n\n" ..
64 | L["For spells that aren't in your spell book use the spell ID number."],
65 | ORANGE_FONT_COLOR:WrapTextInColorCode(v))
66 | end
67 | end
68 |
69 | local order
70 | do
71 | local n = 0
72 | order = function () n = n + 1 return n end
73 | end
74 |
75 | local addAuraMap = { }
76 | local addIgnoreAbility
77 |
78 | local options = {
79 | type = "group",
80 | childGroups = "tab",
81 | args = {
82 | GeneralGroup = {
83 | type = "group",
84 | name = GENERAL,
85 | order = order(),
86 | get = Getter,
87 | set = Setter,
88 | args = {
89 | topGap = {
90 | type = "description",
91 | name = "\n",
92 | width = "full",
93 | order = order(),
94 | },
95 | defaultNameMatching = {
96 | type = "toggle",
97 | name = L["Automatically match auras to abilities by name."],
98 | desc = L['If you disable this option, only auras explicitly configured under "Extra aura displays" will be shown.'],
99 | order = order(),
100 | width = "full",
101 | },
102 | playerPetBuffs = {
103 | type = "toggle",
104 | name = L["Display buffs cast by you on your pet."],
105 | order = order(),
106 | width = "full",
107 | },
108 | showTimers = {
109 | type = "toggle",
110 | name = L["Display aura duration timers."],
111 | order = order(),
112 | width = "full",
113 | },
114 | colorTimers = {
115 | type = "toggle",
116 | name = L["Color aura duration timers based on remaining time."],
117 | order = order(),
118 | width = "full",
119 | },
120 | decimalTimers = {
121 | type = "toggle",
122 | name = L["Show fractions of a second on timers."],
123 | order = order(),
124 | width = "full",
125 | },
126 | showStacks = {
127 | type = "toggle",
128 | name = L["Show aura stacks."],
129 | order = order(),
130 | width = "full",
131 | },
132 | showSuggestions = {
133 | type = "toggle",
134 | name = L["Highlight buttons for interrupt and soothe."],
135 | order = order(),
136 | width = "full",
137 | },
138 | preFontHeaderGap = {
139 | name = "\n",
140 | type = "description",
141 | width = 'full',
142 | order = order(),
143 | },
144 | FontHeader = {
145 | type = "header",
146 | name = L["Font"],
147 | order = order(),
148 | },
149 | postFontHeaderGap = {
150 | name = "",
151 | type = "description",
152 | width = 'full',
153 | order = order(),
154 | },
155 | preFontPathSpacer = {
156 | name = "",
157 | type = "description",
158 | width = 0.05,
159 | order = order(),
160 | },
161 | fontPath = {
162 | type = "select",
163 | name = L["Font name"],
164 | order = order(),
165 | dialogControl = 'LSM30_Font',
166 | values = ALL_FONTS,
167 | get = FontPathGetter,
168 | set = FontPathSetter,
169 | },
170 | fontSizePreGap = {
171 | type = "description",
172 | name = "",
173 | width = 0.1,
174 | order = order(),
175 | },
176 | fontSize = {
177 | type = "range",
178 | name = L["Font size"],
179 | order = order(),
180 | min = 6,
181 | max = 24,
182 | step = 1,
183 | },
184 | preAnchorHeaderGap = {
185 | name = "\n",
186 | type = "description",
187 | width = 'full',
188 | order = order(),
189 | },
190 | AnchorHeader = {
191 | type = "header",
192 | name = L["Text positions"],
193 | order = order(),
194 | },
195 | postAnchorHeaderGap = {
196 | name = "",
197 | type = "description",
198 | width = 'full',
199 | order = order(),
200 | },
201 | preTimerAnchorGap = {
202 | name = "",
203 | type = "description",
204 | width = 0.1,
205 | order = order(),
206 | },
207 | timerAnchor = {
208 | name = L["Timer text position"],
209 | type = "select",
210 | control = 'LBAAnchorButtons',
211 | values = ANCHOR_SELECT_VALUES,
212 | order = order(),
213 | },
214 | preStacksAnchorGap = {
215 | name = "",
216 | type = "description",
217 | width = 0.25,
218 | order = order(),
219 | },
220 | stacksAnchor = {
221 | name = L["Stack text position"],
222 | type = "select",
223 | control = 'LBAAnchorButtons',
224 | values = ANCHOR_SELECT_VALUES,
225 | order = order(),
226 | },
227 | AnchorsGap = {
228 | name = "",
229 | type = "description",
230 | width = 'full',
231 | order = order(),
232 | },
233 | preTimerAdjustGap = {
234 | name = "",
235 | type = "description",
236 | width = 0.1,
237 | order = order(),
238 | },
239 | timerAdjust = {
240 | name = L["Timer text offset"],
241 | type = "range",
242 | order = order(),
243 | min = -16,
244 | max = 16,
245 | step = 1,
246 | },
247 | preStacksAdjustGap = {
248 | name = "",
249 | type = "description",
250 | width = 0.25,
251 | order = order(),
252 | },
253 | stacksAdjust = {
254 | name = L["Stack text offset"],
255 | type = "range",
256 | order = order(),
257 | min = -16,
258 | max = 16,
259 | step = 1,
260 | },
261 | },
262 | },
263 | MappingGroup = {
264 | type = "group",
265 | name = L["Extra aura displays"],
266 | inline = false,
267 | order = order(),
268 | args = {
269 | showAura = {
270 | name = L["Show aura"],
271 | type = "input",
272 | width = 1.4,
273 | order = order(),
274 | get =
275 | function ()
276 | if addAuraMap[1] then
277 | local info = C_Spell.GetSpellInfo(addAuraMap[1])
278 | return ("%s (%s)"):format(info.name, info.spellID) .. "\0" .. addAuraMap[1]
279 | end
280 | end,
281 | set =
282 | function (_, v)
283 | local info = C_Spell.GetSpellInfo(v)
284 | addAuraMap[1] = info and info.spellID or nil
285 | end,
286 | control = 'LBAInputFocus',
287 | validate = ValidateSpellValue,
288 | },
289 | preOnAbilityGap = {
290 | name = "",
291 | type = "description",
292 | width = 0.1,
293 | order = order(),
294 | },
295 | onAbility = {
296 | name = L["On ability"],
297 | type = "input",
298 | width = 1.4,
299 | order = order(),
300 | get =
301 | function ()
302 | if addAuraMap[2] then
303 | local info = C_Spell.GetSpellInfo(addAuraMap[2])
304 | return ("%s (%s)"):format(info.name, info.spellID) .. "\0" .. addAuraMap[2]
305 | end
306 | end,
307 | set =
308 | function (_, v)
309 | local info = C_Spell.GetSpellInfo(v)
310 | addAuraMap[2] = info and info.spellID or nil
311 | end,
312 | control = 'LBAInputFocus',
313 | validate = ValidateSpellValue,
314 | },
315 | preAddButtonGap = {
316 | name = "",
317 | type = "description",
318 | width = 0.1,
319 | order = order(),
320 | },
321 | AddButton = {
322 | name = ADD,
323 | type = "execute",
324 | width = 0.5,
325 | order = order(),
326 | disabled =
327 | function (info, v)
328 | local auraName = addAuraMap[1] and C_Spell.GetSpellName(addAuraMap[1])
329 | local abilityName = addAuraMap[2] and C_Spell.GetSpellName(addAuraMap[2])
330 | if auraName and abilityName and auraName ~= abilityName then
331 | return false
332 | else
333 | return true
334 | end
335 | end,
336 | func =
337 | function ()
338 | local auraInfo = addAuraMap[1] and C_Spell.GetSpellInfo(addAuraMap[1])
339 | local abilityInfo = addAuraMap[2] and C_Spell.GetSpellInfo(addAuraMap[2])
340 | if auraInfo and abilityInfo then
341 | LBA.AddAuraMap(auraInfo.spellID, abilityInfo.spellID)
342 | addAuraMap[1] = nil
343 | addAuraMap[2] = nil
344 | end
345 | end,
346 | },
347 | Mappings = {
348 | name = L["Extra aura displays"],
349 | type = "group",
350 | order = order(),
351 | inline = true,
352 | args = {},
353 | plugins = {},
354 | }
355 | }
356 | },
357 | IgnoreGroup = {
358 | type = "group",
359 | name = L["Ignored abilities"],
360 | order = order(),
361 | inline = false,
362 | args = {
363 | ignoreAbility = {
364 | name = L["Add ability"],
365 | type = "input",
366 | width = 1,
367 | order = order(),
368 | get =
369 | function ()
370 | if addIgnoreAbility then
371 | local info = C_Spell.GetSpellInfo(addIgnoreAbility)
372 | return ("%s (%s)"):format(info.name, info.spellID) .. "\0" .. addIgnoreAbility
373 | end
374 | end,
375 | set =
376 | function (_, v)
377 | local info = C_Spell.GetSpellInfo(v)
378 | addIgnoreAbility = info and info.spellID or nil
379 | end,
380 | control = 'LBAInputFocus',
381 | validate = ValidateSpellValue,
382 | },
383 | AddButton = {
384 | name = ADD,
385 | type = "execute",
386 | width = 1,
387 | order = order(),
388 | disabled =
389 | function ()
390 | if addIgnoreAbility then
391 | return not C_Spell.GetSpellInfo(addIgnoreAbility)
392 | end
393 | end,
394 | func =
395 | function ()
396 | local info = addIgnoreAbility and C_Spell.GetSpellInfo(addIgnoreAbility)
397 | if info then
398 | LBA.AddIgnoreSpell(info.spellID)
399 | addIgnoreAbility = nil
400 | end
401 | end,
402 | },
403 | Abilities = {
404 | name = L["Ignored abilities"],
405 | type = "group",
406 | order = order(),
407 | inline = true,
408 | args = {},
409 | plugins = {},
410 | }
411 | }
412 | },
413 | },
414 | }
415 |
416 | local function GenerateOptions()
417 | local auraMapList = LBA.GetAuraMapList()
418 | local auraMaps = { }
419 | for i, entry in ipairs(auraMapList) do
420 | auraMaps["mapAura"..i] = {
421 | order = 10*i+1,
422 | name = LBA.SpellString(entry[1], entry[2]),
423 | type = "description",
424 | image = C_Spell.GetSpellTexture(entry[1] or entry[2]),
425 | imageWidth = 22,
426 | imageHeight = 22,
427 | width = 1.4,
428 | }
429 | auraMaps["onText"..i] = {
430 | order = 10*i+2,
431 | name = GRAY_FONT_COLOR:WrapTextInColorCode(L["on"]),
432 | type = "description",
433 | width = 0.15,
434 | }
435 | auraMaps["mapAbility"..i] = {
436 | order = 10*i+3,
437 | name = LBA.SpellString(entry[3], entry[4]),
438 | type = "description",
439 | image = C_Spell.GetSpellTexture(entry[3] or entry[4]),
440 | imageWidth = 22,
441 | imageHeight = 22,
442 | width = 1.4,
443 | }
444 | auraMaps["delete"..i] = {
445 | order = 10*i+4,
446 | name = DELETE,
447 | type = "execute",
448 | func = function () LBA.RemoveAuraMap(entry[1], entry[3]) end,
449 | width = 0.45,
450 | }
451 | end
452 | options.args.MappingGroup.args.Mappings.plugins.auraMaps = auraMaps
453 |
454 | local ignoreSpellList = {}
455 | local cc = ContinuableContainer:Create()
456 | for spellID in pairs(LBA.db.profile.denySpells) do
457 | local spell = Spell:CreateFromSpellID(spellID)
458 | if not spell:IsSpellEmpty() then
459 | if WOW_PROJECT_ID ~= 1 then
460 | spell.IsDataEvictable = function () return true end
461 | spell.IsItemDataCached = spell.IsSpellDataCached
462 | spell.ContinueWithCancelOnItemLoad = spell.ContinueWithCancelOnSpellLoad
463 | end
464 | cc:AddContinuable(spell)
465 | table.insert(ignoreSpellList, spell)
466 | end
467 | end
468 |
469 | local ignoreAbilities = {}
470 | cc:ContinueOnLoad(
471 | function ()
472 | table.sort(ignoreSpellList, function (a, b) return a:GetSpellName() < b:GetSpellName() end)
473 | for i, spell in ipairs(ignoreSpellList) do
474 | ignoreAbilities["ability"..i] = {
475 | name = format("%s (%d)",
476 | NORMAL_FONT_COLOR:WrapTextInColorCode(spell:GetSpellName()),
477 | spell:GetSpellID()),
478 | type = "description",
479 | image = C_Spell.GetSpellTexture(spell.spellID),
480 | imageWidth = 22,
481 | imageHeight = 22,
482 | width = 2.5,
483 | order = 10*i+1,
484 | }
485 | ignoreAbilities["delete"..i] = {
486 | name = DELETE,
487 | type = "execute",
488 | func = function () LBA.RemoveIgnoreSpell(spell:GetSpellID()) end,
489 | width = 0.5,
490 | order = 10*i+2,
491 | }
492 | end
493 | options.args.IgnoreGroup.args.Abilities.plugins.ignoreAbilites = ignoreAbilities
494 | end)
495 | return options
496 | end
497 |
498 | -- The sheer amount of crap required here is ridiculous. I bloody well hate
499 | -- frameworks, just give me components I can assemble. Dot-com weenies ruined
500 | -- everything, even WoW.
501 |
502 | local AceConfig = LibStub("AceConfig-3.0")
503 | local AceConfigCmd = LibStub("AceConfigCmd-3.0")
504 | local AceConfigRegistry = LibStub("AceConfigRegistry-3.0")
505 | local AceConfigDialog = LibStub("AceConfigDialog-3.0")
506 | local AceDBOptions = LibStub("AceDBOptions-3.0")
507 |
508 | -- AddOns are listed in the Blizzard panel in the order they are
509 | -- added, not sorted by name. In order to mostly get them to
510 | -- appear in the right order, add the main panel when loaded.
511 |
512 | AceConfig:RegisterOptionsTable(addonName, GenerateOptions, { "litebuttonauras", "lba" })
513 | local optionsPanel, category = AceConfigDialog:AddToBlizOptions(addonName)
514 |
515 | function LBA.InitializeGUIOptions()
516 | local profileOptions = AceDBOptions:GetOptionsTable(LBA.db)
517 | AceConfig:RegisterOptionsTable(addonName.."Profiles", profileOptions)
518 | AceConfigDialog:AddToBlizOptions(addonName.."Profiles", profileOptions.name, addonName)
519 | end
520 |
521 | function LBA.OpenOptions()
522 | Settings.OpenToCategory(category)
523 | end
524 |
525 | LiteButtonAuras_AddonCompartmentFunc = function () LBA.OpenOptions() end
526 |
--------------------------------------------------------------------------------
/embeds.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/fetchlocale.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | DASHES=--------------------------------------------------------------------------------
4 |
5 | header () {
6 | _LINE="-- $1 "
7 | _LEN=$(( 1 + 80 - $(echo "$_LINE" | wc -c) ))
8 | printf "%s%.*s\n" "$_LINE" $_LEN $DASHES
9 | echo
10 | }
11 |
12 | fetch () {
13 | curl \
14 | -s -H "X-Api-Token: $APIKEY" \
15 | "https://wow.curseforge.com/api/projects/526431/localization/export?export-type=TableAdditions&lang=$1&unlocalized=ShowBlankAsComment" \
16 | | grep -v 'Translation missing' \
17 | | sed -e 's/^/ /; s/ *$//;'
18 | }
19 |
20 | for locale in "deDE" "esES" "frFR" "itIT" "koKR" "ptBR" "ruRU" "zhCN" "zhTW"; do
21 |
22 | # As far as I can tell everyone treats esES and esMX as identical
23 | case $locale in
24 | esES)
25 | header "esES / esMX"
26 | echo 'if locale == "esES" or locale == "esMX" then'
27 | ;;
28 | *)
29 | header $locale
30 | echo "if locale == \"$locale\" then"
31 | ;;
32 | esac
33 |
34 | fetch $locale
35 |
36 | echo "end"
37 | if [ "$locale" != "zhTW" ]; then
38 | echo
39 | fi
40 | done
41 |
--------------------------------------------------------------------------------
/get-libs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # I think most devs just get curse updater or something to keep the libs
4 | # globally. I don't know if that's a good idea or not. Honestly I feel
5 | # pretty nervous about packaging "the newest version" all the time.
6 | #
7 |
8 | indent () {
9 | sed -e 's/^/ /'
10 | }
11 |
12 | get_repotype () {
13 | case "$1" in
14 | *libbuttonglow-1-0)
15 | echo git
16 | ;;
17 | *://repos.curseforge.com/*)
18 | echo svn
19 | ;;
20 | *://repos.wowace.com/*)
21 | echo svn
22 | ;;
23 | *://svn*)
24 | echo svn
25 | ;;
26 | svn:*)
27 | echo svn
28 | ;;
29 | *://git*)
30 | echo git
31 | ;;
32 | git:*)
33 | echo git
34 | ;;
35 | *) # I guess
36 | echo git
37 | ;;
38 | esac
39 | }
40 |
41 | get_libs () {
42 | local INLIBS=0
43 | local FILE
44 | if [ -f pkgmeta.yaml ]; then
45 | FILE=pkgmeta.yaml
46 | else
47 | FILE=.pkgmeta
48 | fi
49 |
50 | cat $FILE | while read k v; do
51 | case $k in
52 | externals:)
53 | INLIBS=1
54 | ;;
55 | "")
56 | INLIBS=0
57 | ;;
58 | *)
59 | if [ $INLIBS -eq 1 ]; then
60 | echo ${v} $( get_repotype $v ) ${k/:/}
61 | fi
62 | ;;
63 | esac
64 | done
65 | }
66 |
67 | update_repo () {
68 | local repotype=$1
69 | local dir=$2
70 |
71 | case $repotype in
72 | git)
73 | (cd $dir && git pull && git reset --hard)
74 | ;;
75 | svn)
76 | (cd $dir && svn up)
77 | ;;
78 | esac
79 | }
80 |
81 | fetch_repo () {
82 | local uri=$1
83 | local repotype=$2
84 | local dir=$3
85 |
86 | case $repotype in
87 | git)
88 | git clone $uri $dir
89 | ;;
90 | svn)
91 | svn co $uri $dir
92 | ;;
93 | esac
94 | }
95 |
96 |
97 | get_libs | while read uri repotype dir; do
98 | if [ -d $dir ]; then
99 | echo "Updating $dir"
100 | update_repo $repotype $dir 2>&1 | indent
101 | else
102 | echo "Cloning $uri into $dir"
103 | fetch_repo $uri $repotype $dir 2>&1 | indent
104 | fi
105 | done
106 |
--------------------------------------------------------------------------------
/pkgmeta.yaml:
--------------------------------------------------------------------------------
1 | externals:
2 | Libs/AceConfig-3.0: https://repos.curseforge.com/wow/ace3/trunk/AceConfig-3.0
3 | Libs/AceDB-3.0: https://repos.curseforge.com/wow/ace3/trunk/AceDB-3.0
4 | Libs/AceDBOptions-3.0: https://repos.curseforge.com/wow/ace3/trunk/AceDBOptions-3.0
5 | Libs/AceGUI-3.0: https://repos.curseforge.com/wow/ace3/trunk/AceGUI-3.0
6 | Libs/AceGUI-3.0-SharedMediaWidgets: https://repos.wowace.com/wow/ace-gui-3-0-shared-media-widgets/trunk/AceGUI-3.0-SharedMediaWidgets
7 | Libs/AceConsole-3.0: https://repos.curseforge.com/wow/ace3/trunk/AceConsole-3.0
8 | Libs/CallbackHandler-1.0: https://repos.curseforge.com/wow/callbackhandler/trunk/CallbackHandler-1.0
9 | Libs/LibSharedMedia-3.0: https://repos.curseforge.com/wow/libsharedmedia-3-0/trunk/LibSharedMedia-3.0
10 | Libs/LibStub: https://repos.curseforge.com/wow/libstub/trunk
11 | Libs/LibButtonGlow-1.0: https://repos.curseforge.com/wow/libbuttonglow-1-0
12 |
13 | enable-nolib-creation: no
14 |
--------------------------------------------------------------------------------