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 target range indicator 83b3fae1f675042b7d9e89c09aedc864e8fcaa27 Vladyslav Bondarenko 2023-08-17 22:41:08
feat: Add class color code to target frame 990cdf1d9f44c9916948697e74f86d6490d83304 Vladyslav Bondarenko 2023-08-17 20:59:28
feat: Add solo unit buttons 4658af2b5142ff2ca86c2c4b48577879117a9ecc Vladyslav Bondarenko 2023-08-17 20:38:10
feat: Add power bar to raid unit button b25bd8d28c30cb003bf8cfe2886e2cfd8442d32f Vladyslav Bondarenko 2023-08-17 18:48:29
feat!: Add basic raid frame stub 66e27810a396b564cf7cd737e1f402f4f433b879 Vladyslav Bondarenko 2023-08-17 17:40:08
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 83b3fae1f675042b7d9e89c09aedc864e8fcaa27 - feat!: Add target range indicator
Author: Vladyslav Bondarenko
Author date (UTC): 2023-08-17 22:41
Committer name: Vladyslav Bondarenko
Committer date (UTC): 2023-08-17 22:54
Parent(s): 990cdf1d9f44c9916948697e74f86d6490d83304
Signer:
Signing key: EFF9624877D25D02
Signing status: E
Tree: 002e30352494b45ffd9946718eb084080b9ee0d3
File Lines added Lines deleted
chorus.toc 1 0
src/ChorusProgressFrameTemplate.lua 1 0
src/ChorusRaidUnitButtonTemplate.lua 3 0
src/ChorusRangeFrameTemplate.lua 114 0
src/ChorusRangeFrameTemplate.xml 29 0
File chorus.toc changed (mode: 100644) (index ea5b4d2..13d425e)
... ... src\ChorusHealthFrameTemplate.xml
10 10 src\ChorusPowerFrameTemplate.xml src\ChorusPowerFrameTemplate.xml
11 11 src\ChorusUnitNameFrameTemplate.xml src\ChorusUnitNameFrameTemplate.xml
12 12 src\ChorusRaidUnitButtonTemplate.xml src\ChorusRaidUnitButtonTemplate.xml
13 src\ChorusRangeFrameTemplate.xml
13 14 src\ChorusTestFrame.xml src\ChorusTestFrame.xml
File src/ChorusProgressFrameTemplate.lua changed (mode: 100644) (index 65c17c2..6218371)
... ... local function getRatio(a, b)
95 95
96 96 assert(b ~= nil) assert(b ~= nil)
97 97 assert('number' == type(b)) assert('number' == type(b))
98 --[[ FIXME Power frame fails when relevant player is disconnected ]]--
98 99 assert(b > 0) assert(b > 0)
99 100
100 101 assert(a <= b) assert(a <= b)
File src/ChorusRaidUnitButtonTemplate.lua changed (mode: 100644) (index 08a5a40..0755351)
... ... function Chorus.raidUnitButtonMain(self)
52 52
53 53 Chorus.raidUnitButtonAttributeChangedProcessor(self, 'unit', self:GetAttribute('unit')) Chorus.raidUnitButtonAttributeChangedProcessor(self, 'unit', self:GetAttribute('unit'))
54 54 --[[ TODO Add menu popup for unit frames ]]-- --[[ TODO Add menu popup for unit frames ]]--
55 --[[ TODO Add range indicator ]]--
56 --[[ TODO Add threat indicator ]]--
57 --[[ TODO Add role indicator ]]--
55 58 end end
File src/ChorusRangeFrameTemplate.lua added (mode: 100644) (index 0000000..40f6327)
1 local IsSpellInRange = IsSpellInRange
2
3 local Chorus = Chorus
4
5 --[[ Populate range spell map at runtime initialization. ]]--
6 local spellMap = {
7 --[[ Paladin ]]--
8 ['Cleanse'] = 40,
9 ['Purify'] = 40,
10 ['Hammer of Justice'] = 10,
11 ['Judgement of Light'] = 10,
12 ['Blessing of Might'] = 30,
13 --[[ Priest ]]--
14 ['Lesser Heal'] = 40,
15 ['Smite'] = 30,
16 ['Power Word: Fortitude'] = 30,
17 ['Resurrection'] = 30,
18 ['Mind Control'] = 20,
19 --[[ Any ]]--
20 ['Shoot'] = 30,
21 }
22
23 --[[ Duplicate getUnit logic to make sure it cannot be overriden at runtime. ]]--
24
25 local function getUnit(f)
26 local p = f:GetParent()
27 local u = f.unit or f:GetAttribute('unit')
28 if not u and p then
29 u = p.unit or p:GetAttribute('unit')
30 end
31 return u
32 end
33
34 local function rangeFrameUpdate(self)
35 assert(self ~= nil)
36
37 local unitDesignation = getUnit(self) or 'none'
38
39 assert(unitDesignation ~= nil)
40 assert('string' == type(unitDesignation))
41 unitDesignation = string.lower(strtrim(unitDesignation))
42 assert(string.len(unitDesignation) >= 1)
43 assert(string.len(unitDesignation) <= 256)
44
45 local label = self.label or _G[self:GetName() .. 'Text']
46 assert(label ~= nil)
47
48 --[[ Frame must be always shown to keep update processor running. ]]--
49 if not UnitExists(unitDesignation) then
50 label:SetText(nil)
51 return
52 end
53
54 local rangeFlag = nil
55 local distanceYards = nil
56 local maxRangeYards = 0
57 for spellName, rangeYards in pairs(spellMap) do
58 local flag = IsSpellInRange(spellName, unitDesignation)
59 --[[ 1 == flag: in range; ]]--
60 --[[ 0 == flag: out of range; ]]--
61 --[[ nil == flag: not applicable or cannot be cast on given target. ]]--
62 if not rangeFlag and flag then
63 rangeFlag = flag
64 end
65 maxRangeYards = math.max(rangeYards, maxRangeYards)
66 if 1 == flag then
67 rangeFlag = 1
68 if not distanceYards then
69 distanceYards = rangeYards
70 end
71 distanceYards = math.min(distanceYards, rangeYards)
72 end
73 end
74
75 local t
76 if 1 == rangeFlag then
77 t = string.format('<%d yd', distanceYards)
78 label:SetTextColor(1, 1, 1)
79 elseif 0 == rangeFlag then
80 t = string.format('>%d yd', maxRangeYards)
81 label:SetTextColor(1, 0, 0)
82 else
83 t = nil
84 end
85 label:SetText(t)
86 end
87
88 local function rangeFrameUpdateProcessor(self)
89 assert(self ~= nil)
90
91 --[[ Reduce update frequency to roughly 6 frames per second. ]]--
92 if self.lastUpdateInstance and 'number' == type(self.lastUpdateInstance) then
93 local now = GetTime()
94 if now - self.lastUpdateInstance > 0.1667 then
95 self.lastUpdateInstance = now
96 else
97 return
98 end
99 end
100
101 rangeFrameUpdate(self)
102 end
103
104 local function rangeFrameMain(self)
105 assert(self ~= nil)
106
107 self.label = _G[self:GetName() .. 'Text']
108 self:SetScript('OnUpdate', rangeFrameUpdateProcessor)
109 end
110
111 --[[ Hide reference to the internal function, for some reason. ]]--
112 Chorus.rangeFrameMain = function(...)
113 return rangeFrameMain(...)
114 end
File src/ChorusRangeFrameTemplate.xml added (mode: 100644) (index 0000000..172aff8)
1 <?xml version="1.0" encoding="UTF-8"?>
2 <Ui xmlns="http://www.blizzard.com/wow/ui/">
3 <Script file="ChorusRangeFrameTemplate.lua"/>
4 <Frame name="ChorusRangeFrameTemplate" virtual="true">
5 <Size>
6 <AbsDimension x="48" y="24" />
7 </Size>
8 <Layers>
9 <Layer level="OVERLAY">
10 <FontString name="$parentText" inherits="SystemFont_Shadow_Med1" setAllPoints="true"/>
11 </Layer>
12 </Layers>
13 <Scripts>
14 <OnLoad>
15 Chorus.rangeFrameMain(self);
16 </OnLoad>
17 </Scripts>
18 </Frame>
19 <Frame name="ChorusTargetRangeFrame" inherits="ChorusRangeFrameTemplate">
20 <Anchors>
21 <Anchor point="CENTER">
22 <AbsDimension x="128" y="32"/>
23 </Anchor>
24 </Anchors>
25 <Attributes>
26 <Attribute name="unit" type="string" value="target"/>
27 </Attributes>
28 </Frame>
29 </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