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)
feat: Add raid frame stub 5fd737cef8e3fc700bab1e6a89ceb68c21495eea Vladyslav Bondarenko 2023-08-16 02:35:08
fix: Show auras correctly at startup 54136c9cedf83fa2a8559b879ab8410a6e28646c Vladyslav Bondarenko 2023-08-15 19:15:48
fix!: Shadowing correct functions 53991b2f7093e765993f8423377602ca22e234da Vladyslav Bondarenko 2023-08-15 18:22:56
fix: Add UnitClass shadowing local e87c61c3cae4cdb945714c67259a6304201968d0 Vladyslav Bondarenko 2023-08-15 18:21:32
feat!: Add unit name b8358f834b4a9c25a6d057d91ed56e3b4d7dc320 Vladyslav Bondarenko 2023-08-15 18:21:12
feat!: Add power bar 654fe43cb55a0e440bdead43d86e3d49bf331c3a Vladyslav Bondarenko 2023-08-15 17:43:59
feat!: Add health bar 16bcad2d2169a7caa2a0f17513202673d178fa98 Vladyslav Bondarenko 2023-08-14 21:59:43
feat!: Add target aura tracker 96105088fc793845cde21639e0221b82de897262 Vladyslav Bondarenko 2023-08-12 21:49:26
Commit 5fd737cef8e3fc700bab1e6a89ceb68c21495eea - feat: Add raid frame stub
Author: Vladyslav Bondarenko
Author date (UTC): 2023-08-16 02:35
Committer name: Vladyslav Bondarenko
Committer date (UTC): 2023-08-16 02:35
Parent(s): 54136c9cedf83fa2a8559b879ab8410a6e28646c
Signer:
Signing key: EFF9624877D25D02
Signing status: E
Tree: 5ee672428a7b1744c165cddfea9486ca35fb76d1
File Lines added Lines deleted
chorus.toc 1 0
src/ChorusAuraButtonTemplate.lua 46 0
src/ChorusProgressFrameTemplate.lua 5 1
src/ChorusRaidUnitButtonTemplate.lua 48 0
src/ChorusRaidUnitButtonTemplate.xml 76 0
src/ChorusTestFrame.xml 28 62
src/ChorusUnitNameFrameTemplate.lua 11 1
src/ChorusUnitNameFrameTemplate.xml 1 1
File chorus.toc changed (mode: 100644) (index 2d0e2e9..ea5b4d2)
... ... src\ChorusProgressFrameTemplate.xml
9 9 src\ChorusHealthFrameTemplate.xml src\ChorusHealthFrameTemplate.xml
10 10 src\ChorusPowerFrameTemplate.xml src\ChorusPowerFrameTemplate.xml
11 11 src\ChorusUnitNameFrameTemplate.xml src\ChorusUnitNameFrameTemplate.xml
12 src\ChorusRaidUnitButtonTemplate.xml
12 13 src\ChorusTestFrame.xml src\ChorusTestFrame.xml
File src/ChorusAuraButtonTemplate.lua changed (mode: 100644) (index d463caf..b760491)
... ... local function applyOverlay(auraButton, category)
62 62 g = colorTuple.g g = colorTuple.g
63 63 b = colorTuple.b b = colorTuple.b
64 64 end end
65
65 66 local overlay = auraButton.overlay local overlay = auraButton.overlay
66 67 assert(overlay ~= nil) assert(overlay ~= nil)
68
67 69 overlay:SetVertexColor(r, g, b) overlay:SetVertexColor(r, g, b)
70
68 71 end end
69 72
70 73 local function applyDuration(auraButton, now, durationSec, expirationInstance) local function applyDuration(auraButton, now, durationSec, expirationInstance)
 
... ... local function applyDuration(auraButton, now, durationSec, expirationInstance)
100 103 end end
101 104
102 105 label:SetText(t) label:SetText(t)
106
107 if auraButton:GetHeight() >= 24 then
108 label:SetJustifyV('BOTTOM')
109 else
110 label:SetJustifyV('CENTER')
111 end
103 112 end end
104 113
105 114 local function auraButtonUpdateProcessor(self) local function auraButtonUpdateProcessor(self)
 
... ... local function auraButtonUpdateProcessor(self)
113 122 applyDuration(self, GetTime(), durationSec, expirationInstance) applyDuration(self, GetTime(), durationSec, expirationInstance)
114 123 end end
115 124
125 local function applySize(auraButton)
126 assert(auraButton ~= nil)
127
128 local p = auraButton:GetParent()
129 if not p then
130 auraButton:SetSize(36, 36)
131 return
132 end
133
134 local minSize = 12
135 local maxSize = 64
136
137 local a = auraButton:GetWidth()
138 a = math.min(a, p:GetWidth())
139 a = math.min(math.max(minSize, a), maxSize)
140
141 local b = auraButton:GetWidth()
142 b = math.min(b, p:GetHeight())
143 b = math.min(math.max(minSize, b), maxSize)
144
145 local c = math.min(a, b)
146 auraButton:SetSize(c, c)
147
148 local t = {auraButton.artwork, auraButton.overlay}
149 local i = 0
150 while (i < #t) do
151 i = i + 1
152 local e = t[i]
153 assert(e ~= nil)
154 local d = math.min(e:GetWidth(), e:GetHeight())
155 d = math.min(math.max(minSize, d), maxSize)
156 e:SetSize(d, d)
157 e:SetPoint('BOTTOMLEFT', (auraButton:GetWidth() - d) / 2, 0)
158 end
159 end
160
116 161 local function apply(auraButton, unitDesignation, auraIndex, filter) local function apply(auraButton, unitDesignation, auraIndex, filter)
117 162 auraButtonValidate(auraButton) auraButtonValidate(auraButton)
118 163
 
... ... local function apply(auraButton, unitDesignation, auraIndex, filter)
149 194 return return
150 195 end end
151 196
197 applySize(auraButton)
152 198 applyArtwork(auraButton, artworkFile, owner) applyArtwork(auraButton, artworkFile, owner)
153 199 applyOverlay(auraButton, category) applyOverlay(auraButton, category)
154 200 applyDuration(auraButton, GetTime(), durationSec, expirationInstance) applyDuration(auraButton, GetTime(), durationSec, expirationInstance)
File src/ChorusProgressFrameTemplate.lua changed (mode: 100644) (index 06053c7..98e309b)
... ... local function validateProgressFrame(self)
36 36 assert(string.len(strategy) >= 1) assert(string.len(strategy) >= 1)
37 37 assert(string.len(strategy) <= 8192) assert(string.len(strategy) <= 8192)
38 38
39 local unitDesignation = self.unit
39 local unitDesignation = self.unit or 'none'
40 40 assert('string' == type(unitDesignation)) assert('string' == type(unitDesignation))
41 41 unitDesignation = string.lower(strtrim(unitDesignation)) unitDesignation = string.lower(strtrim(unitDesignation))
42 42 assert(string.len(unitDesignation) >= 1) assert(string.len(unitDesignation) >= 1)
 
... ... local function healthFrameEventProcessor(self)
262 262 unitDesignation = unitDesignation or p.unit unitDesignation = unitDesignation or p.unit
263 263 end end
264 264
265 unitDesignation = unitDesignation or 'none'
266
265 267 assert(unitDesignation ~= nil) assert(unitDesignation ~= nil)
266 268 assert('string' == type(unitDesignation)) assert('string' == type(unitDesignation))
267 269 unitDesignation = string.lower(strtrim(unitDesignation)) unitDesignation = string.lower(strtrim(unitDesignation))
 
... ... end
416 418 function Chorus.healthFrameMain(self, ...) function Chorus.healthFrameMain(self, ...)
417 419 Chorus.progressFrameMain(self, ...) Chorus.progressFrameMain(self, ...)
418 420 self.strategy = 'UnitIsFriend' self.strategy = 'UnitIsFriend'
421 self.unit = 'none'
419 422 self:SetScript('OnEvent', healthFrameEventProcessor) self:SetScript('OnEvent', healthFrameEventProcessor)
420 423
421 424 self:RegisterEvent('UNIT_HEALTH') self:RegisterEvent('UNIT_HEALTH')
 
... ... end
424 427 function Chorus.powerFrameMain(self, ...) function Chorus.powerFrameMain(self, ...)
425 428 Chorus.progressFrameMain(self, ...) Chorus.progressFrameMain(self, ...)
426 429 self.strategy = 'UnitPowerType' self.strategy = 'UnitPowerType'
430 self.unit = 'none'
427 431 self:SetScript('OnEvent', powerFrameEventProcessor) self:SetScript('OnEvent', powerFrameEventProcessor)
428 432
429 433 self:RegisterEvent('UNIT_ENERGY') self:RegisterEvent('UNIT_ENERGY')
File src/ChorusRaidUnitButtonTemplate.lua added (mode: 100644) (index 0000000..d7812c2)
1 local Chorus = Chorus
2
3 function Chorus.raidUnitButtonAttributeChangedProcessor(self, name, value)
4 assert(self ~= nil)
5
6 assert(name ~= nil)
7 assert('string' == type(name))
8 name = strtrim(name)
9 assert(string.len(name) >= 1)
10 assert(string.len(name) <= 256)
11
12 if not tContains({'unit'}, name) then
13 return
14 end
15
16 self[name] = value
17
18 local t = {self:GetChildren()}
19 local i = 0
20 while (i < #t) do
21 i = i + 1
22 local e = t[i]
23 if nil == e then
24 break
25 end
26 e[name] = value
27 e:SetAttribute(name, value)
28 end
29 end
30
31 function Chorus.raidUnitButtonMain(self)
32 local buffFrame = _G[self:GetName() .. 'BuffFrame']
33 assert(buffFrame ~= nil)
34 buffFrame.filter = 'HELPFUL RAID'
35
36 local debuffFrame = _G[self:GetName() .. 'DebuffFrame']
37 assert(debuffFrame ~= nil)
38 debuffFrame.filter = 'HARMFUL RAID'
39
40 local healthFrame = _G[self:GetName() .. 'HealthFrame']
41 assert(healthFrame ~= nil)
42 healthFrame.strategy = 'UnitClass'
43
44 self:RegisterForClicks('AnyUp')
45 self:SetAttribute('unit', 'none')
46 self:SetAttribute('type1', 'target')
47 --[[ TODO Add menu popup for unit frames ]]--
48 end
File src/ChorusRaidUnitButtonTemplate.xml added (mode: 100644) (index 0000000..6f7a673)
1 <?xml version="1.0" encoding="UTF-8"?>
2 <Ui xmlns="http://www.blizzard.com/wow/ui/">
3 <Script file="ChorusRaidUnitButtonTemplate.lua"/>
4 <Button name="ChorusRaidUnitButtonTemplate" toplevel="true" inherits="SecureUnitButtonTemplate" virtual="true">
5 <Size>
6 <AbsDimension x="144" y="84"/>
7 </Size>
8 <Layers>
9 <Layer level="BACKGROUND">
10 <Texture name="$parentBackground">
11 <Color r="0" g="0" b="0"/>
12 </Texture>
13 </Layer>
14 </Layers>
15 <Frames>
16 <Frame name="$parentUnitNameFrame" inherits="ChorusUnitNameFrameTemplate">
17 <Size>
18 <AbsDimension x="72" y="24"/>
19 </Size>
20 <Anchors>
21 <Anchor point="TOPLEFT">
22 <Offset>
23 <AbsDimension x="0" y="0"/>
24 </Offset>
25 </Anchor>
26 </Anchors>
27 </Frame>
28 <Frame name="$parentHealthFrame" inherits="ChorusHealthFrameTemplate" setAllPoints="true">
29 <Size>
30 <AbsDimension x="144" y="36"/>
31 </Size>
32 <Anchors>
33 <Anchor point="TOPLEFT">
34 <Offset>
35 <AbsDimension x="0" y="0"/>
36 </Offset>
37 </Anchor>
38 </Anchors>
39 </Frame>
40 <Frame name="$parentBuffFrame" inherits="ChorusAuraFrameTemplate">
41 <Size>
42 <AbsDimension x="144" y="24"/>
43 </Size>
44 <Anchors>
45 <Anchor point="TOPLEFT">
46 <Offset>
47 <AbsDimension x="0" y="-36"/>
48 </Offset>
49 </Anchor>
50 </Anchors>
51 </Frame>
52 <Frame name="$parentDebuffFrame" inherits="ChorusAuraFrameTemplate">
53 <Size>
54 <AbsDimension x="144" y="24"/>
55 </Size>
56 <Anchors>
57 <Anchor point="TOPLEFT" relativeTo="$parentBuffFrame" relativePoint="BOTTOMLEFT">
58 <Offset>
59 <AbsDimension x="0" y="0"/>
60 </Offset>
61 </Anchor>
62 </Anchors>
63 </Frame>
64 </Frames>
65 <Scripts>
66 <OnAttributeChanged>
67 Chorus.raidUnitButtonAttributeChangedProcessor(self, name, value);
68 </OnAttributeChanged>
69 <OnLoad>
70 Chorus.raidUnitButtonMain(self);
71 </OnLoad>
72 <OnEnter function="UnitFrame_OnEnter"/>
73 <OnLeave function="UnitFrame_OnLeave"/>
74 </Scripts>
75 </Button>
76 </Ui>
File src/ChorusTestFrame.xml changed (mode: 100644) (index df2ca1f..9c0b77f)
1 1 <?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
2 2 <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Ui xmlns="http://www.blizzard.com/wow/ui/">
3 <Frame name="ChorusTestFrame">
3 <Frame name="ChorusPartyFrame" inherits="SecurePartyHeaderTemplate">
4 <Size>
5 <AbsDimension x="800" y="600"/>
6 </Size>
7 <Anchors>
8 <Anchor point="TOPLEFT">
9 <Offset>
10 <AbsDimension x="0" y="0"/>
11 </Offset>
12 </Anchor>
13 </Anchors>
14 </Frame>
15 <Frame name="ChorusRaidFrame" inherits="SecureRaidGroupHeaderTemplate">
4 16 <Size> <Size>
5 <AbsDimension x="216" y="144"/>
17 <AbsDimension x="800" y="600"/>
6 18 </Size> </Size>
7 19 <Anchors> <Anchors>
8 20 <Anchor point="TOPLEFT"> <Anchor point="TOPLEFT">
9 21 <Offset> <Offset>
10 <AbsDimension x="512" y="0"/>
22 <AbsDimension x="0" y="0"/>
11 23 </Offset> </Offset>
12 24 </Anchor> </Anchor>
25 </Anchors>
26 </Frame>
27 <Frame name="ChorusTestFrame">
28 <Size>
29 <AbsDimension x="800" y="600"/>
30 </Size>
31 <Anchors>
13 32 <Anchor point="CENTER"> <Anchor point="CENTER">
14 33 <Offset> <Offset>
15 34 <AbsDimension x="0" y="0"/> <AbsDimension x="0" y="0"/>
16 35 </Offset> </Offset>
17 36 </Anchor> </Anchor>
18 37 </Anchors> </Anchors>
19 <Frames>
20 <Frame name="ChorusTestTargetUnitNameFrame" inherits="ChorusUnitNameFrameTemplate">
21 <Anchors>
22 <Anchor point="BOTTOMLEFT">
23 <Offset>
24 <AbsDimension x="0" y="110"/>
25 </Offset>
26 </Anchor>
27 </Anchors>
28 </Frame>
29 <Frame name="ChorusTestTargetHealthFrame" inherits="ChorusHealthFrameTemplate">
30 <Anchors>
31 <Anchor point="BOTTOMLEFT">
32 <Offset>
33 <AbsDimension x="0" y="86"/>
34 </Offset>
35 </Anchor>
36 </Anchors>
37 </Frame>
38 <Frame name="ChorusTestTargetPowerFrame" inherits="ChorusPowerFrameTemplate">
39 <Size>
40 <AbsDimension x="144" y="12"/>
41 </Size>
42 <Anchors>
43 <Anchor point="BOTTOMLEFT">
44 <Offset>
45 <AbsDimension x="0" y="72"/>
46 </Offset>
47 </Anchor>
48 </Anchors>
49 </Frame>
50 <Frame name="ChorusTestTargetBuffFrame" inherits="ChorusAuraFrameTemplate">
51 <Anchors>
52 <Anchor point="BOTTOMLEFT">
53 <Offset>
54 <AbsDimension x="0" y="36"/>
55 </Offset>
56 </Anchor>
57 </Anchors>
58 </Frame>
59 <Frame name="ChorusTestTargetDebuffFrame" inherits="ChorusAuraFrameTemplate">
60 <Anchors>
61 <Anchor point="BOTTOMLEFT">
62 <Offset>
63 <AbsDimension x="0" y="0"/>
64 </Offset>
65 </Anchor>
66 </Anchors>
67 </Frame>
68 </Frames>
69 38 <Scripts> <Scripts>
70 39 <OnLoad> <OnLoad>
71 ChorusTestTargetBuffFrame.filter = 'HELPFUL';
72 ChorusTestTargetBuffFrame.unit = 'target';
73 ChorusTestTargetDebuffFrame.filter = 'HARMFUL';
74 ChorusTestTargetDebuffFrame.unit = 'target';
75 ChorusTestTargetHealthFrame.strategy = 'UnitIsFriend';
76 ChorusTestTargetHealthFrame.unit = 'target';
77 ChorusTestTargetPowerFrame.unit = 'target';
78 ChorusTestTargetUnitNameFrame.unit = 'target';
79 ChorusTestTargetPowerFrame.strategy = 'UnitPowerType';
40 ChorusPartyFrame:SetAttribute('template', 'ChorusRaidUnitButtonTemplate');
41 ChorusPartyFrame:SetAttribute('maxColumns', 5);
42 ChorusRaidFrame:SetAttribute('template', 'ChorusRaidUnitButtonTemplate');
43 ChorusRaidFrame:SetAttribute('maxColumns', 5);
44 self:RegisterEvent('PARTY_MEMBERS_CHANGED');
45 self:RegisterEvent('PARTY_CONVERTED_TO_RAID');
80 46 </OnLoad> </OnLoad>
81 47 </Scripts> </Scripts>
82 48 </Frame> </Frame>
File src/ChorusUnitNameFrameTemplate.lua changed (mode: 100644) (index 97bcf88..890bf97)
... ... local function unitNameEventProcessor(self)
11 11 local label = self.label local label = self.label
12 12 assert(label ~= nil) assert(label ~= nil)
13 13
14 local unitDesignation = self.unit
14 local unitDesignation = self.unit or 'none'
15 assert(unitDesignation ~= nil)
15 16 assert('string' == type(unitDesignation)) assert('string' == type(unitDesignation))
16 17 unitDesignation = string.lower(strtrim(unitDesignation)) unitDesignation = string.lower(strtrim(unitDesignation))
17 18 assert(string.len(unitDesignation) >= 1) assert(string.len(unitDesignation) >= 1)
 
... ... local function unitNameEventProcessor(self)
20 21 local name = UnitName(unitDesignation) local name = UnitName(unitDesignation)
21 22 label:SetText(name) label:SetText(name)
22 23
24 if not self.strategy then
25 return
26 elseif 'UnitClass' ~= self.strategy then
27 return
28 end
29
23 30 local _, classDesignation = UnitClass(unitDesignation) local _, classDesignation = UnitClass(unitDesignation)
24 31 if not classDesignation or not UnitIsPlayer(unitDesignation) then if not classDesignation or not UnitIsPlayer(unitDesignation) then
25 32 label:SetTextColor(1, 1, 1) label:SetTextColor(1, 1, 1)
 
... ... function Chorus.unitNameFrameMain(self)
51 58 assert(label ~= nil) assert(label ~= nil)
52 59 self.label = label self.label = label
53 60
61 self.unit = 'none'
62
54 63 self:SetScript('OnEvent', unitNameEventProcessor) self:SetScript('OnEvent', unitNameEventProcessor)
55 64
56 65 self:RegisterEvent('PARTY_CONVERTED_TO_RAID') self:RegisterEvent('PARTY_CONVERTED_TO_RAID')
 
... ... function Chorus.unitNameFrameMain(self)
62 71 self:RegisterEvent('PLAYER_LOGIN') self:RegisterEvent('PLAYER_LOGIN')
63 72 self:RegisterEvent('PLAYER_TARGET_CHANGED') self:RegisterEvent('PLAYER_TARGET_CHANGED')
64 73 self:RegisterEvent('RAID_ROSTER_UPDATE') self:RegisterEvent('RAID_ROSTER_UPDATE')
74 self:RegisterEvent('UNIT_NAME_UPDATE')
65 75 end end
File src/ChorusUnitNameFrameTemplate.xml changed (mode: 100644) (index 90a0a7c..7570c1f)
7 7 </Size> </Size>
8 8 <Layers> <Layers>
9 9 <Layer level="OVERLAY"> <Layer level="OVERLAY">
10 <FontString name="$parentText" inherits="SystemFont_Shadow_Med1" setAllPoints="true"/>
10 <FontString name="$parentText" inherits="SystemFont_Shadow_Med1" setAllPoints="true" justifyH="LEFT"/>
11 11 </Layer> </Layer>
12 12 </Layers> </Layers>
13 13 <Scripts> <Scripts>
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