vrtc / chorus (public) (License: CC0) (since 2023-08-12) (hash sha1)
World of Warcraft add-on stub. The overall goal is to create a specialized raid frame.
List of commits:
Subject Hash Author Date (UTC)
doc: descript aura button API 7d110e3d397a335d2dc0ffbf699acc487730d0d8 Vladyslav Bondarenko 2024-06-16 13:24:52
feat: add ldoc custom see tag handler d28dc9809939a99694d87cf1d0654eb0e2fcd314 Vladyslav Bondarenko 2024-06-16 13:23:24
feat: add optional xmlstarlet support b2db46335cb4aa461c45915d235c6d8d340a3dea Vladyslav Bondarenko 2024-06-16 09:57:27
fix: indent Chorus.xml with tabs and not spaces bf4091ab69c75aafa9256b0503b5addd316e214f Vladyslav Bondarenko 2024-06-16 09:39:28
fix: format generated XML with tabs and not spaces d0018a28b184add22ea69f86c8b334a72310004e Vladyslav Bondarenko 2024-06-16 09:26:54
doc: raid frame profile generator script 22deb6f002463583ef5fd5c1acfcfb5777329aa8 Vladyslav Bondarenko 2024-06-15 21:55:01
feat: add fallback offline label a621e23fe7dc5668f0525dcc2bc60d916c2a1c14 Vladyslav Bondarenko 2024-06-15 19:08:05
fix: add test mocks for background and backdrop 2b22abbcb266bb02bded0633301e1669ed1b040d Vladyslav Bondarenko 2024-06-15 19:07:40
fix: render raid target icon above health cb950c903e6fe0a8078ea06473ce3a01157e55cc Vladyslav Bondarenko 2024-06-15 19:06:13
fix: shift solo frames left 4ba54a74c54b3bc68411fa8882ebd08a93587a1d Vladyslav Bondarenko 2024-06-15 19:04:37
fix!: render raid frames correctly cdb44a8f8ed5a356651d7119f8fd9441dda2c058 Vladyslav Bondarenko 2024-06-15 19:01:13
fix: disable raid profiles for now 41ed89dc4f78561e90ba999d00e95e0b1dc3f2a8 Vladyslav Bondarenko 2024-06-15 05:52:14
feat!: add raid group profiles 57b4b36b800beaf6843bc3cfc954340d914b71fa Vladyslav Bondarenko 2024-06-14 22:19:47
feat!: prepare nightly release 0.8.0 e11a3bbdfad85e4c4716e4ecfd3e7f5b8f009058 Vladyslav Bondarenko 2024-06-14 15:33:18
fix: globalize string constants cc5893ba83f388c0a58b183321f63867b10248ad Vladyslav Bondarenko 2024-06-14 15:12:35
feat: always show player frame 1eb20501d74ee931691f02abc31a176569a7d299 Vladyslav Bondarenko 2024-06-14 14:34:42
feat: add header background to larger units ef000eebb9ef5a8211f6aff47e2a1c38a3badf4a Vladyslav Bondarenko 2024-06-14 13:54:04
feat: unknown unit level is rendered as red f830dfcf22bf2f8e5c087de8f42a89f6733f5269 Vladyslav Bondarenko 2024-06-14 13:51:34
fix: make unit level text bold 2a4ea6baea2107a3f1ec8ab7bca4edb169a4575b Vladyslav Bondarenko 2024-06-14 13:51:01
feat: narrow backdrop for larger frames 77b080701c68bb8f6e353e15586f0e8063266d5c Vladyslav Bondarenko 2024-06-14 11:24:16
Commit 7d110e3d397a335d2dc0ffbf699acc487730d0d8 - doc: descript aura button API
Author: Vladyslav Bondarenko
Author date (UTC): 2024-06-16 13:24
Committer name: Vladyslav Bondarenko
Committer date (UTC): 2024-06-16 13:24
Parent(s): d28dc9809939a99694d87cf1d0654eb0e2fcd314
Signer:
Signing key: EFF9624877D25D02
Signing status: E
Tree: da16f8ce4d233348fc3d7c41c18e3d34c4232ce1
File Lines added Lines deleted
src/ChorusAuraButtonTemplate.lua 160 8
src/ChorusAuraFrameTemplate.lua 9 0
File src/ChorusAuraButtonTemplate.lua changed (mode: 100644) (index 36d091b..6527d36)
1 --[[--
2 @submodule chorus
3 ]]
4
5 1 --[[-- --[[--
6 2 `ChorusAuraButtonTemplate` handles individual aura pictograms. `ChorusAuraButtonTemplate` handles individual aura pictograms.
7 3
 
... ... Features:
13 9 * show aura category (Magic, Poison, Disease, Curse); * show aura category (Magic, Poison, Disease, Curse);
14 10 * display tooltip on mouseover; * display tooltip on mouseover;
15 11
16 @section ChorusAuraButtonTemplate
12 @submodule chorus
17 13 ]] ]]
18 14
19 15 local Chorus = Chorus local Chorus = Chorus
 
... ... local UnitIsConnected = Chorus.test.UnitIsConnected or UnitIsConnected
25 21 local UnitIsUnit = Chorus.test.UnitIsUnit or UnitIsUnit local UnitIsUnit = Chorus.test.UnitIsUnit or UnitIsUnit
26 22
27 23 local DebuffTypeColor = DebuffTypeColor local DebuffTypeColor = DebuffTypeColor
24
28 25 local GameTooltip = GameTooltip local GameTooltip = GameTooltip
26
29 27 local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit
30 28
29 --[[--
30 Check given aura button is configured as expected by the rest of the template.
31
32 @function auraButtonValidate
33 @raise assertion exception
34 @tparam frame auraButton aura button
35 @return when successful, nothing; when failed, assertion exception;
36 ]]
31 37 local function auraButtonValidate(auraButton) local function auraButtonValidate(auraButton)
32 38 assert(auraButton ~= nil) assert(auraButton ~= nil)
33 39
 
... ... local function auraButtonValidate(auraButton)
36 42 assert(auraButton.overlay ~= nil) assert(auraButton.overlay ~= nil)
37 43 end end
38 44
45 --[[--
46 Render pictogram artwork for this aura button.
47
48 Fallback to a picture of a question mark if the artwork could not be loaded.
49 That is, when `artworkFile` is `nil`.
50
51 @function applyArtwork
52
53 @tparam frame auraButton this aura button
54
55 @tparam string artworkFile pathname in Windows format with escape characters;
56 ]]
39 57 local function applyArtwork(auraButton, artworkFile) local function applyArtwork(auraButton, artworkFile)
40 58 auraButtonValidate(auraButton) auraButtonValidate(auraButton)
41 59
 
... ... local function applyArtwork(auraButton, artworkFile)
53 71 artwork:SetTexture(artworkFile) artwork:SetTexture(artworkFile)
54 72 end end
55 73
74 --[[--
75 Render sanitized and color coded border for this aura button.
76
77 @see FrameXML/BuffFrame.lua:DebuffTypeColor
78
79 @function applyOverlay
80
81 @tparam frame auraButton this aura button
82
83 @tparam string category key of `DebuffTypeColor` table
84
85 @tparam string owner unit designation of caster of the given aura, used for
86 color coding; in reality, either `player` or `nil`
87
88 @return nothing
89 ]]
56 90 local function applyOverlay(auraButton, category, owner) local function applyOverlay(auraButton, category, owner)
57 91 auraButtonValidate(auraButton) auraButtonValidate(auraButton)
58 92
 
... ... local function applyOverlay(auraButton, category, owner)
99 133 end end
100 134 end end
101 135
136 --[[--
137 Format the given amount of seconds into a narrow human readable string.
138
139 This is inteded for aura effects. It may be used for any generic duration.
140
141 @function formatDuration
142
143 @tparam number durationSec positive number and not zero, the remaining seconds
144 of some effect
145
146 @treturn string remaining duration coerced into a string that is human
147 readeable and narrow for convenient rendering
148 ]]
102 149 local function formatDuration(durationSec) local function formatDuration(durationSec)
103 150 assert(durationSec ~= nil) assert(durationSec ~= nil)
104 151 assert('number' == type(durationSec)) assert('number' == type(durationSec))
 
... ... local function formatDuration(durationSec)
117 164 return t return t
118 165 end end
119 166
167 --[[--
168 Compute remaining aura duration for this aura button, given time instances,
169 then sanitize, format and render it.
170
171 @function applyDuration
172
173 @tparam frame auraButton this aura button
174
175 @tparam number now time instance, in the format of `function GetTime`, current
176 real time
177
178 @tparam number totalDurationSec positive number, the total duration in seconds
179 of the aura
180
181 @tparam number expirationInstance time instance, in the format of `function
182 GetTime`, the instance when the aura effect ends
183
184 @return nothing
185 ]]
120 186 local function applyDuration(auraButton, now, totalDurationSec, expirationInstance) local function applyDuration(auraButton, now, totalDurationSec, expirationInstance)
121 187 auraButtonValidate(auraButton) auraButtonValidate(auraButton)
122 188
 
... ... local function applyDuration(auraButton, now, totalDurationSec, expirationInstan
160 226 end end
161 227 end end
162 228
229 --[[--
230 Sanitize, format and render the charge quantity for this aura button.
231
232 @function applyChargeQuantity
233
234 @tparam frame auraButton this aura button
235
236 @tparam integer chargeQuantity positive integer and not zero, the remaining
237 charges (stacks) of the aura
238
239 @return nothing
240 ]]
163 241 local function applyChargeQuantity(auraButton, chargeQuantity) local function applyChargeQuantity(auraButton, chargeQuantity)
164 242 auraButtonValidate(auraButton) auraButtonValidate(auraButton)
165 243
 
... ... local function applyChargeQuantity(auraButton, chargeQuantity)
182 260 label:SetText(t) label:SetText(t)
183 261 end end
184 262
263 --[[--
264 Every frame, update the remaining duration and remaining stack quantity of the
265 aura, of this aura button.
266
267 Update scripts like this should be optimized for performance. Update scripts
268 also rely on the current real time and implicit game state.
269
270 Remaining duration of an aura cannot be queried. It must be computed, given
271 time instances that could be queried. This is the purpose of the update
272 processor function.
273
274 @see FrameXML/SecureTemplates.lua:function SecureButton_GetUnit
275 @function auraButtonUpdateProcessor
276 @tparam frame self aura button
277 @return nothing
278 ]]
185 279 local function auraButtonUpdateProcessor(self) local function auraButtonUpdateProcessor(self)
186 280 local unitDesignation = SecureButton_GetUnit(self) local unitDesignation = SecureButton_GetUnit(self)
187 281 local index = self.index local index = self.index
 
... ... local function auraButtonUpdateProcessor(self)
197 291 applyChargeQuantity(self, chargeQuantity) applyChargeQuantity(self, chargeQuantity)
198 292 end end
199 293
294 --[[--
295 Request relevant aura details, then apply them to the aura button.
296
297 @function apply
298
299 @see auraButtonUpdateProcessor
300
301 @tparam frame auraButton
302
303 @tparam string unitDesignation corresponding unit
304
305 @tparam integer auraIndex positive integer and not zero, sequantial number of a
306 single aura from the list relevant to the unit
307
308 @tparam string filter usually either BUFF or DEBUFF, mutually exclusive
309
310 @return nothing
311 ]]
200 312 local function apply(auraButton, unitDesignation, auraIndex, filter) local function apply(auraButton, unitDesignation, auraIndex, filter)
201 313 auraButtonValidate(auraButton) auraButtonValidate(auraButton)
202 314
 
... ... local function apply(auraButton, unitDesignation, auraIndex, filter)
216 328 assert(string.len(filter) >= 1) assert(string.len(filter) >= 1)
217 329 assert(string.len(filter) <= 256) assert(string.len(filter) <= 256)
218 330
331 --[[ @warning Aura button event processor might fail in restricted
332 environment. ]]--
219 333
220 334 if not UnitExists(unitDesignation) or not UnitIsConnected(unitDesignation) then if not UnitExists(unitDesignation) or not UnitIsConnected(unitDesignation) then
221 335 auraButton:Hide() auraButton:Hide()
 
... ... local function apply(auraButton, unitDesignation, auraIndex, filter)
240 354 applyChargeQuantity(auraButton, chargeQuantity) applyChargeQuantity(auraButton, chargeQuantity)
241 355 end end
242 356
243 local function auraButtonEventProcessor(self, eventCategory, ...)
357 --[[--
358 Process stream of events, filter events only relevant to the aura button.
359
360 When aura is added or removed from a unit, given the aura button is assigned to
361 watch that unit, then apply relevant changes to the aura button.
362
363 @function auraButtonEventProcessor
364 @see FrameXML/SecureTemplates.lua:function SecureButton_GetUnit
365 @see apply
366 @tparam frame self the aura button
367 @tparam string eventCategory event category designation of the given event
368 @param unitDesignation vararg, given `UNIT_AURA`,
369 @return nothing
370 ]]
371 function Chorus.auraButtonEventProcessor(self, eventCategory, ...)
244 372 auraButtonValidate(self) auraButtonValidate(self)
245 373
246 374 local u = SecureButton_GetUnit(self) or 'none' local u = SecureButton_GetUnit(self) or 'none'
 
... ... local function auraButtonEventProcessor(self, eventCategory, ...)
289 417 apply(self, u, i, filter) apply(self, u, i, filter)
290 418 end end
291 419
420 --[[--
421 Process the state of given aura button, then apply the details to the native
422 `GameTooltip`.
423
424 @see FrameXML/GameTooltip.lua:GameTooltip
425 @see FrameXML/SecureTemplates.lua:function SecureButton_GetUnit
426 @function auraButtonGameTooltipShow
427 @tparam frame self the aura button
428 @return nothing
429 ]]
292 430 function Chorus.auraButtonGameTooltipShow(self) function Chorus.auraButtonGameTooltipShow(self)
293 431 GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT"); GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT");
294 432 GameTooltip:SetFrameLevel(self:GetFrameLevel() + 2); GameTooltip:SetFrameLevel(self:GetFrameLevel() + 2);
 
... ... function Chorus.auraButtonGameTooltipShow(self)
304 442 end end
305 443 end end
306 444
445 --[[--
446 Hide the tooltip associated with the aura button, if necessary.
447
448 Effectively, simply hides the native `GameTooltip`.
449
450 @see FrameXML/GameTooltip.lua:GameTooltip
451 @function auraButtonGameTooltipHide
452 @return nothing
453 ]]
307 454 function Chorus.auraButtonGameTooltipHide() function Chorus.auraButtonGameTooltipHide()
308 455 GameTooltip:Hide(); GameTooltip:Hide();
309 456 end end
310 457
458 --[[--
459 Initialize the aura button frame with callbacks and children.
460
461 @function auraButtonMain
462 @tparam frame self
463 @return nothing
464 ]]
311 465 function Chorus.auraButtonMain(self) function Chorus.auraButtonMain(self)
312 466 local n = self:GetName() local n = self:GetName()
313 467 if n then if n then
 
... ... function Chorus.auraButtonMain(self)
321 475 self:RegisterEvent('UNIT_AURA') self:RegisterEvent('UNIT_AURA')
322 476 auraButtonValidate(self) auraButtonValidate(self)
323 477 end end
324
325 Chorus.auraButtonEventProcessor = auraButtonEventProcessor
File src/ChorusAuraFrameTemplate.lua changed (mode: 100644) (index df57155..11fd547)
1 1 --[[-- --[[--
2 2 `ChorusAuraFrameTemplate` handles subsets of unit auras, individual aura `ChorusAuraFrameTemplate` handles subsets of unit auras, individual aura
3 3 buttons are handled by `ChorusAuraButtonTemplate`. buttons are handled by `ChorusAuraButtonTemplate`.
4
4 5 @submodule chorus @submodule chorus
5 6 ]] ]]
6 7
 
... ... local function validateAuraWeightMap(t)
194 195 end end
195 196 end end
196 197
198 --[[--
199 Initialize the aura frame. Given no aura buttons were explicitly decalred in an
200 XML descriptor, then allocate them with a best guess.
201
202 @function auraFrameMain
203 @tparam frame self the aura frame
204 @return nothing
205 ]]
197 206 function Chorus.auraFrameMain(self) function Chorus.auraFrameMain(self)
198 207 assert(self ~= nil) assert(self ~= nil)
199 208
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/chorus

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

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

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