List of commits:
Subject Hash Author Date (UTC)
feat(choir)!: Employ Clearcasting subset feat 733c81538c3c965f07993fd7ddc482e724121b75 Vladyslav Bondarenko 2021-11-04 22:40:48
fix(choir): Improve shortcut binding keys eb636de6e3f7bada9f0064ffe4db1db3f6433f6c Vladyslav Bondarenko 2021-10-31 18:55:10
fix(choir): Improve choirBindingKey attribute handling 6c5c2214cc1809e5e5e59cd3672da3cca3f2701f Vladyslav Bondarenko 2021-10-31 13:23:24
feat(choir)!: Add spell shortcut prototype d34f22a6983ffc41122acb40d22e3cb29c208a3c Vladyslav Bondarenko 2021-10-31 12:39:39
feat(choir)!: Add spell effects on unit d581df9fce342709267a3221dead4d00b9d14319 Vladyslav Bondarenko 2021-10-31 10:49:19
feat(choir)!: Close spoiler by pressing Esc 22d7370011ac45d25a410a3f569183d0cc9fb232 Vladyslav Bondarenko 2021-10-29 16:10:08
feat(choir)!: Range indicator 931a0510b562986ec76dc22f329f4af4ed723cdf Vladyslav Bondarenko 2021-10-29 10:40:46
fix(choir)!: Health bar in combat a6622578dd5a1b4e4babf699a4cf1e4eb6bb70d6 Vladyslav Bondarenko 2021-10-28 07:42:57
feat(choir)!: Decorate unit buttons 4dc5ed44a9519b275f4256cfe4281110b7a94c9a Vladyslav Bondarenko 2021-10-25 21:20:56
feat(choir)!: Copy action bar binding 70ce056ffda7f12d913ce9a42b128ea257bdd0dc Vladyslav Bondarenko 2021-10-23 23:34:56
feat!: Initial commit 45c4e781e5ff0a69f8b0bea3a869e2384c7ca454 Vladyslav Bondarenko 2021-10-23 06:03:14
Commit 733c81538c3c965f07993fd7ddc482e724121b75 - feat(choir)!: Employ Clearcasting subset feat
Change the way unit aura tracking to improve code maintainability.
Author: Vladyslav Bondarenko
Author date (UTC): 2021-11-04 22:40
Committer name: Vladyslav Bondarenko
Committer date (UTC): 2021-11-04 22:40
Parent(s): 09839e2eddfc54046b8b37a5a0048eeb95e0f335
Signer:
Signing key:
Signing status: N
Tree: ca7f294b1b1acc04e7ba125e4bc0454952543e0e
File Lines added Lines deleted
choir.lua 20 64
File choir.lua changed (mode: 100644) (index a28775e..8aae38b)
... ... local function getDefaultUnitButtonBarColor()
6 6 return 0, 1, 0 return 0, 1, 0
7 7 end end
8 8
9 local function createClearcastingSection(unitButton)
9 local function createClearcastingSubset(unitButton)
10 10 assert (unitButton ~= nil) assert (unitButton ~= nil)
11 11
12 12 if not ClearcastingFrame then if not ClearcastingFrame then
 
... ... local function createClearcastingSection(unitButton)
14 14 return return
15 15 end end
16 16
17 local locale = GetLocale()
18 assert (locale == 'enGB' or locale == 'enUS', 'requires English localization')
19
20 local columnQuantity = 5
21 local rowQuantity = 2
22
23 local x = 0
24 local y = 0
25
26 local createIndicator = ClearcastingFrame.createIndicator
27 assert (createIndicator ~= nil)
17 local createSubset = ClearcastingFrame.createSubset
18 assert (createSubset ~= nil)
28 19
29 local padding = 2
30
31 --[[ FIXME Update indicator unit designation when unit button attribute changes at runtime. ]]--
20 --[[ FIXME Update indicator unit designation when unit button attribute changes at runtime.
21 -- This is not an expected use-case. Rather it is a matter of robustness. ]]--
32 22 local unitDesignation = unitButton:GetAttribute('unit') local unitDesignation = unitButton:GetAttribute('unit')
33 23 assert (unitDesignation ~= nil) assert (unitDesignation ~= nil)
34 24
35 local section = CreateFrame('FRAME', unitButton:GetName() .. 'ClearcastingSection', unitButton)
36 section:SetPoint('BOTTOMLEFT', 0, 0)
37 section:SetPoint('TOPRIGHT', 0, (36 * rowQuantity + padding * (rowQuantity + 1)) - unitButton:GetHeight())
38
39 local d
40 local harmfulSpellCategoryList = {
41 'Magic', 'Poison', 'Disease', 'Curse', 'HARMFUL',
42 }
43
44 local i = 0
45 while (i < #harmfulSpellCategoryList) do
46 i = i + 1
47 local category = harmfulSpellCategoryList[i]
48 d = createIndicator(section, category, unitDesignation, 'HARMFUL')
49 d:SetPoint('BOTTOMLEFT', d:GetWidth() * x + padding * (x + 1), 12 + (d:GetHeight() + 12) * y + padding * (y + 1))
50 x = x + 1
51 end
52
53 local helpfulSpellMap = {
54 --[[PALADIN]]--
55 {'Hand of Freedom', 'Hand of Protection', 'Sacred Shield', 'Beacon of Light'},
56 --[[PRIEST]]--
57 {'Power Word: Shield', 'Renew', 'Grace', 'Power Infusion', 'Pain Suppression'},
58 --[[DRUID]]--
59 {'Rejuvenation', 'Regrowth', 'Wild Growth'},
60 --[[SHAMAN]]--
61 {'Earth Shield'},
62 }
25 local harmSubset = createSubset(unitButton, unitButton:GetName() .. 'HarmfulSubsetFrame',
26 unitDesignation, 'HARMFUL',
27 5, 1)
28 harmSubset:SetPoint('BOTTOMLEFT', 0, 0)
63 29
64 y = y + 1
65 local p = 0
66 while (p < #helpfulSpellMap) do
67 p = p + 1
68 local list = helpfulSpellMap[p]
69 local q = 0
70 x = 0
71 assert (#list <= columnQuantity)
72 while (q < #list) do
73 q = q + 1
74 local spellName = list[q]
75 d = createIndicator(section, spellName, unitDesignation, 'PLAYER HELPFUL')
76 d:SetPoint('BOTTOMLEFT', d:GetWidth() * x + padding * (x + 1), 12 + (d:GetHeight() + 12) * y + padding * (y + 1))
77 x = x + 1
78 end
79 end
30 --[[ TODO Track tank defensives in addition to player (healer) buffs. ]]--
31 local helpSubset = createSubset(unitButton, unitButton:GetName() .. 'HelpfulSubsetFrame',
32 unitDesignation, 'PLAYER HELPFUL',
33 5, 1)
34 helpSubset:SetPoint('BOTTOMLEFT', 0, harmSubset:GetHeight())
80 35
81 return section
36 return harmSubset, helpSubset
82 37 end end
83 38
84 39 local function createBindingKeyHandler(button) local function createBindingKeyHandler(button)
 
... ... local function createUnitButtonBar(unitButton)
272 227 local n = unitButton:GetName() or '' local n = unitButton:GetName() or ''
273 228 local padding = 4 local padding = 4
274 229 local marginTop = 24 local marginTop = 24
275 local marginBottom = 36 * 2 + (2 * 3)
230 local marginBottom = 40 * 2 + (3 * 3)
276 231 local bar = CreateFrame('FRAME', n .. 'Bar', unitButton) local bar = CreateFrame('FRAME', n .. 'Bar', unitButton)
277 232 bar:SetPoint('BOTTOMLEFT', unitButton, 'BOTTOMLEFT', padding, padding + marginBottom) bar:SetPoint('BOTTOMLEFT', unitButton, 'BOTTOMLEFT', padding, padding + marginBottom)
278 233 bar:SetPoint('TOPRIGHT', unitButton, 'TOPRIGHT', -padding, -padding - marginTop) bar:SetPoint('TOPRIGHT', unitButton, 'TOPRIGHT', -padding, -padding - marginTop)
 
... ... local function createUnitButtonBar(unitButton)
300 255 bar:RegisterEvent('PLAYER_FOCUS_CHANGED') bar:RegisterEvent('PLAYER_FOCUS_CHANGED')
301 256 bar:RegisterEvent('PLAYER_TARGET_CHANGED') bar:RegisterEvent('PLAYER_TARGET_CHANGED')
302 257 bar:RegisterEvent('UNIT_HEALTH') bar:RegisterEvent('UNIT_HEALTH')
258 --[[ NOTE UNIT_SPELLCAST_* family of events are relied on to render range indicator correctly,
259 -- instead of the more expensive update hook. ]]--
303 260 bar:RegisterEvent('UNIT_SPELLCAST_FAILED') bar:RegisterEvent('UNIT_SPELLCAST_FAILED')
304 261 bar:RegisterEvent('UNIT_SPELLCAST_FAILED_QUIET') bar:RegisterEvent('UNIT_SPELLCAST_FAILED_QUIET')
305 262 bar:RegisterEvent('UNIT_SPELLCAST_SENT') bar:RegisterEvent('UNIT_SPELLCAST_SENT')
 
... ... local function createUnitButton(parentFrame, frameName, unit)
374 331 createBindingKeyHandler(u) createBindingKeyHandler(u)
375 332 createInheritanceHandler(u) createInheritanceHandler(u)
376 333
377 u:SetSize(24 * 5 + 2 * 6, 36 * 2 + 2 * 3 + 24 * 2)
334 u:SetSize(24 * 5 + 3 * 6, 40 * 2 + 3 * 3 + 24 * 2)
378 335
379 336 local t = createLabel(u) local t = createLabel(u)
380 337 t:SetPoint('BOTTOMLEFT', u, 'BOTTOMLEFT', 4, u:GetHeight() - 24 - 4) t:SetPoint('BOTTOMLEFT', u, 'BOTTOMLEFT', 4, u:GetHeight() - 24 - 4)
 
... ... local function createUnitButton(parentFrame, frameName, unit)
387 344 local bar = createUnitButtonBar(u) local bar = createUnitButtonBar(u)
388 345 u.bar = bar u.bar = bar
389 346
390 local clearcasting = createClearcastingSection(u)
391 u.clearcasting = clearcasting
347 createClearcastingSubset(u)
392 348
393 349 u:SetScript('OnEvent', unitButtonEventProcessor) u:SetScript('OnEvent', unitButtonEventProcessor)
394 350 u:RegisterEvent('PARTY_CONVERTED_TO_RAID') u:RegisterEvent('PARTY_CONVERTED_TO_RAID')
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/vrtc/choir

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/vrtc/choir

Clone this repository using git:
git clone git://git.rocketgit.com/user/vrtc/choir

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main