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 UnitSetRole backport 1eb6a3777cb6361f57386959cdec4066715bb0a6 Vladyslav Bondarenko 2023-08-31 18:07:35
feat(build): Add separation for Cata and Wrath API c1ec823b22648324afb48852149296f6b0612830 Vladyslav Bondarenko 2023-08-31 18:05:42
feat!: Release 0.5 ff0038bc36df311a01b038e192c3e6b495e5c509 Vladyslav Bondarenko 2023-08-30 23:45:43
fix!: Remove old flavour of unit frames 58d82ae1ba66bfc0acf41b97df99746a57a7a7cd Vladyslav Bondarenko 2023-08-30 23:38:49
fix: Update solo tot frames 4204e7a2649b970d28f4b0f38f4dc60e90cd40d0 Vladyslav Bondarenko 2023-08-30 23:37:37
fix!: Update party frame to unprotected strategy 470935eb589f7ab2fa77ae1335a194420e597340 Vladyslav Bondarenko 2023-08-30 22:52:34
fix!: Render solo status bar textures correctly 22d89fffabad69df1e7dcf078805e3ff341c5023 Vladyslav Bondarenko 2023-08-30 19:14:13
fix!: Restore solo frame context menu popup 0cc446f33351c8998d2359a42000f84da19defcd Vladyslav Bondarenko 2023-08-29 22:43:22
feat!: Update unit frame layout framework 1af4c0bd53a474483d60425f2a4e40250367ecf1 Vladyslav Bondarenko 2023-08-29 21:20:40
feat: Classify rare or elite units dd2c1f490c08a75774be085b318ebcd1b2788a2b Vladyslav Bondarenko 2023-08-29 21:18:49
feat(build): Remove cgitrc 1e6b59264abab70e1f2fa9ae494c74d2606c060f Vladyslav Bondarenko 2023-08-29 14:37:03
feat(build): Add cgitrc 7288f0336e36010fb92bf60479fdca3a0082ecd1 Vladyslav Bondarenko 2023-08-29 14:14:24
feat(build): Add cgitrc ea45afc0375774c2fe6bb0a3237cfd1817529ff0 Vladyslav Bondarenko 2023-08-29 14:14:24
feat(test)!: Toggle debug mode at runtime 23c37e3ab2eaf924f41fe51adc1e54f525222a8b Vladyslav Bondarenko 2023-08-29 03:41:55
fix: Aura tooltip is always opaque 1f7ba009c71796093b8cfa63cb38d918b9696c79 Vladyslav Bondarenko 2023-08-29 01:31:40
fix: Adjust aura tooltip toggle button layout fc72d10b09f44ef9ba6f2f93413a20def40c2d4a Vladyslav Bondarenko 2023-08-29 01:30:27
feat!: Add role widget 0ac8cda6522056c8adb527ba2f144229f251f69e Vladyslav Bondarenko 2023-08-29 00:59:14
fix: Only show power bar when appropriate 5313d1bfbf676c88b5c2a0a56fbea88549633b7b Vladyslav Bondarenko 2023-08-28 22:46:36
feat!: Toggle detailed unit aura tooltip in combat 460c622c04a8b0fa503c2a5d45313b667809b95c Vladyslav Bondarenko 2023-08-28 19:26:25
feat!: Add detailed buff and debuff popup 1ff7bcff470419c7fa40c6b946e441867dda4825 Vladyslav Bondarenko 2023-08-27 20:42:05
Commit 1eb6a3777cb6361f57386959cdec4066715bb0a6 - feat!: Add UnitSetRole backport
Add the ability for the user to set the desired player role in a group,
in addition to the native automatic mechanism of the Looking For
Dungeon module.

Normally in Wrath, the unit group roles for players (tank, healer or
damager) are set automatically by the client when user enters any
dungeon. However, the unit group roles are useful not just in dungeons,
but in every group scenario. Therefore, allow the user to set their role
explicitly.

This feature was first introduced natively since Cataclysm. This commit
backports a simulacrum of this feature to Wrath client.

Usage. For example to set player role as healer.
```lua
UnitSetRole('player', 'HEALER')
```

Alternatively, to set the current target as tank.
```lua
Chorus.UnitSetRole('target', 'TANK')
```

There are is no graphical interface for this feature yet.

The native unit group role system takes prededence.

Additionally, fix role widget, to show all possible unit group roles.
Author: Vladyslav Bondarenko
Author date (UTC): 2023-08-31 18:07
Committer name: Vladyslav Bondarenko
Committer date (UTC): 2023-08-31 18:07
Parent(s): c1ec823b22648324afb48852149296f6b0612830
Signer:
Signing key: EFF9624877D25D02
Signing status: E
Tree: 2f7f02a8f7733d379d5d0f149c90e80b078ec2eb
File Lines added Lines deleted
chorus.toc 1 0
src/ChorusUnitGroupRoleFrameTemplate.lua 124 15
src/ChorusUnitGroupRoleFrameTemplate.xml 5 0
File chorus.toc changed (mode: 100644) (index fb24e91..17c662f)
2 2 ##Notes: Add group frames and replace native solo frames. This is a work in progress. ##Notes: Add group frames and replace native solo frames. This is a work in progress.
3 3 ##Title: Chorus ##Title: Chorus
4 4 ##Version: 0.5 ##Version: 0.5
5 ##SavedVariables: ChorusUnitGroupRoleMap
5 6 src\Chorus.xml src\Chorus.xml
File src/ChorusUnitGroupRoleFrameTemplate.lua changed (mode: 100644) (index f2d3b33..5dd9745)
1 1 local Chorus = Chorus local Chorus = Chorus
2 2
3 local strtrim = strtrim
4
3 5 local UnitExists = Chorus.test.UnitExists or UnitExists local UnitExists = Chorus.test.UnitExists or UnitExists
4 6 local UnitGroupRolesAssigned = Chorus.test.UnitGroupRolesAssigned or UnitGroupRolesAssigned local UnitGroupRolesAssigned = Chorus.test.UnitGroupRolesAssigned or UnitGroupRolesAssigned
5 7 local UnitIsConnected = Chorus.test.UnitIsConnected or UnitIsConnected local UnitIsConnected = Chorus.test.UnitIsConnected or UnitIsConnected
6 8
7 9 local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit
8 10
9 --[[ FIXME Only tank role texture is ever rendered. ]]--
11 local fallbackRoleMap
12
13 local cache = {}
14
15 --[[ TODO Since `function UnitSetRole` is backported, implement mechanism to
16 set it automatically, inferred from talents. ]]--
17
18 local function updateEveryRoleWidget()
19 assert(cache ~= nil)
20 assert('table' == type(cache))
21
22 for _, frame in pairs(cache) do
23 if frame then
24 local callback = frame:GetScript('OnEvent')
25 if callback then
26 callback(frame, 'PARTY_MEMBERS_CHANGED')
27 end
28 end
29 end
30 end
31
32 --[[
33 Set fallback unit group role for given unit.
34
35 When unit role is checked by role widget that this module implements, given
36 role could not be determined by any other means, use the role that was assigned
37 using this function.
38
39 It is expected from the user to call this function manually or at least
40 explicitly with a thin layer of graphical buttons.
41
42 @function Chorus.UnitSetRole
43 ]]
44 function Chorus.UnitSetRole(unitDesignation, roleDesignation)
45 assert(unitDesignation ~= nil)
46 assert('string' == type(unitDesignation))
47 unitDesignation = string.lower(strtrim(unitDesignation))
48 assert(string.len(unitDesignation) >= 1)
49 assert(string.len(unitDesignation) <= 256)
50
51 assert(roleDesignation ~= nil)
52 assert('string' == type(roleDesignation))
53 roleDesignation = string.upper(strtrim(roleDesignation))
54 assert(string.len(roleDesignation) >= 1)
55 assert(string.len(roleDesignation) <= 256)
56
57 assert('TANK' == roleDesignation or 'HEALER' ==
58 roleDesignation or 'DAMAGER' == roleDesignation,
59 'invalid argument: invalid enum: must be valid player ' ..
60 'group role string')
61
62 if not UnitExists(unitDesignation) then
63 return false
64 end
65
66 local i = UnitGUID(unitDesignation)
67 if not i then
68 return false
69 end
70
71 fallbackRoleMap[i] = roleDesignation
72
73 updateEveryRoleWidget()
74
75 return true
76 end
77
78 do
79 --[[ Backport `function UnitSetRole` from Cata back to Wrath. ]]--
80 if not UnitSetRole and 40000 > select(4, GetBuildInfo()) then
81 UnitSetRole = Chorus.UnitSetRole
82 end
83 end
10 84
11 85 local function getUnitGroupRoleDesignation(unitDesignation) local function getUnitGroupRoleDesignation(unitDesignation)
12 local isTank, isHealer, isDamage = UnitGroupRolesAssigned(unitDesignation)
86 assert(unitDesignation ~= nil)
87 assert('string' == type(unitDesignation))
88
89 assert(fallbackRoleMap ~= nil)
90 assert('table' == type(fallbackRoleMap))
13 91
14 92 local roleDesignation local roleDesignation
15 93
16 --[[ Corner case for Interface >= 40000 version of the API. ]]--
17 --[[ TODO Query API version at runtime. There must be a function. ]]--
18 if 'string' == type(isTank) then
19 roleDesignation = isTank
20 elseif isTank then
21 roleDesignation = 'TANK'
22 elseif isHealer then
23 roleDesignation = 'HEALER'
24 elseif isDamage then
25 roleDesignation = 'DAMAGER'
94 local interfaceNumber = select(4, GetBuildInfo())
95 if 40000 > interfaceNumber then
96 --[[ Is Wrath ]]--
97 local isTank, isHealer, isDamage = UnitGroupRolesAssigned(unitDesignation)
98
99 if isTank then
100 roleDesignation = 'TANK'
101 elseif isHealer then
102 roleDesignation = 'HEALER'
103 elseif isDamage then
104 roleDesignation = 'DAMAGER'
105 end
26 106 else else
27 roleDesignation = nil
107 --[[ Is Cata ]]--
108 --[[ TODO Test if the role widget implementation works on both 30300 and 40000. ]]--
109 roleDesignation = UnitGroupRolesAssigned(unitDesignation)
110 end
111
112 if not roleDesignation then
113 local i = UnitGUID(unitDesignation)
114 if i then
115 roleDesignation = fallbackRoleMap[i]
116 else
117 roleDesignation = nil
118 end
28 119 end end
29 120
30 121 return roleDesignation return roleDesignation
 
... ... local function eventProcessor(self)
89 180 local unitDesignation = SecureButton_GetUnit(self) local unitDesignation = SecureButton_GetUnit(self)
90 181
91 182 if not unitDesignation or not UnitExists(unitDesignation) or not if not unitDesignation or not UnitExists(unitDesignation) or not
92 UnitIsConnected(unitDesignation) or not
93 UnitGroupRolesAssigned(unitDesignation) then
183 UnitIsConnected(unitDesignation) then
94 184 self:Hide() self:Hide()
95 185 return return
96 186 end end
 
... ... local function eventProcessor(self)
99 189 applyRole(self, roleDesignation) applyRole(self, roleDesignation)
100 190 end end
101 191
192 local function roleMapFrameMain(self)
193 assert(self ~= nil)
194
195 self:RegisterEvent('VARIABLES_LOADED')
196 self:SetScript('OnEvent', function()
197 if not ChorusUnitGroupRoleMap then
198 ChorusUnitGroupRoleMap = {}
199 end
200 fallbackRoleMap = ChorusUnitGroupRoleMap or {}
201 assert(fallbackRoleMap ~= nil)
202 assert('table' == type(fallbackRoleMap))
203 end)
204 end
205
102 206 local function main(self) local function main(self)
103 207 assert(self ~= nil) assert(self ~= nil)
104 208
 
... ... local function main(self)
112 216 self:RegisterEvent('RAID_ROSTER_UPDATE') self:RegisterEvent('RAID_ROSTER_UPDATE')
113 217
114 218 self:SetScript('OnEvent', eventProcessor) self:SetScript('OnEvent', eventProcessor)
219
220 cache[self:GetName()] = self
115 221 end end
116 222
223 Chorus.unitGroupRoleMapFrameMain = function(...)
224 return roleMapFrameMain(...)
225 end
117 226 Chorus.unitGroupRoleFrameMain = function(...) Chorus.unitGroupRoleFrameMain = function(...)
118 227 return main(...) return main(...)
119 228 end end
File src/ChorusUnitGroupRoleFrameTemplate.xml changed (mode: 100644) (index af21535..f1d8579)
17 17 <Attribute name="useparent-unit" type="boolean" value="true"/> <Attribute name="useparent-unit" type="boolean" value="true"/>
18 18 </Attributes> </Attributes>
19 19 </Frame> </Frame>
20 <Frame name="ChorusUnitGroupRoleMapFrame" virtual="false" hidden="true">
21 <Scripts>
22 <OnLoad>Chorus.unitGroupRoleMapFrameMain(self);</OnLoad>
23 </Scripts>
24 </Frame>
20 25 </Ui> </Ui>
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