List of commits:
Subject Hash Author Date (UTC)
Initial commit 447e6a5ac2cc64f0f818663ba08681615327b19a Vladyslav Bondarenko 2021-01-11 20:26:55
Commit 447e6a5ac2cc64f0f818663ba08681615327b19a - Initial commit
Author: Vladyslav Bondarenko
Author date (UTC): 2021-01-11 20:26
Committer name: Vladyslav Bondarenko
Committer date (UTC): 2021-01-11 20:26
Parent(s):
Signer:
Signing key:
Signing status: N
Tree: 22fbcbd20e61baa87aeea4409ac255f3f3e316a5
File Lines added Lines deleted
.gitignore 2 0
daybreak.lua 192 0
daybreak.toc 6 0
daybreak.xml 15 0
unifont.ttf 0 0
File .gitignore added (mode: 100644) (index 0000000..644483f)
1 *swp
2 *~
File daybreak.lua added (mode: 100644) (index 0000000..e99adab)
1 local function getDefaultButtonSize()
2 return 32
3 end
4
5 local function acceptUnitAura(button, eventCategory)
6 assert (button ~= nil)
7 assert (eventCategory ~= nil)
8
9 local auraName = button:GetAttribute('spell')
10 assert (auraName ~= nil)
11
12 local unitDesignation = button:GetAttribute('unit')
13 assert (unitDesignation ~= nil)
14
15 local name, rank, icon, count, debuffType, duration, expirationInstance,
16 unitCaster, isStealable, shouldConsolidate,
17 spellId = UnitBuff(unitDesignation, auraName)
18 if nil == expirationInstance then
19 expirationInstance = 0
20 end
21 local now = GetTime()
22 if not name or not expirationInstance then
23 button:Hide()
24 elseif name and expirationInstance > now then
25 local elapsedDuration = expirationInstance - now
26 local durationRemaining = duration - elapsedDuration
27 button:SetText(durationRemaining)
28 --[[ FIXME Apply graphics only once instead of every aura update ]]--
29 button:SetNormalTexture(icon)
30 button:Show()
31 else
32 button:Hide()
33 end
34 end
35
36 local function applyUpdate(button, updateDuration)
37 assert (button ~= nil)
38
39 local auraName = button:GetAttribute('spell')
40 assert (auraName ~= nil)
41
42 local unitDesignation = button:GetAttribute('unit')
43 assert (unitDesignation ~= nil)
44
45 local name, _, _, _, _, duration, expirationInstance = UnitBuff(unitDesignation, auraName)
46 local now = GetTime()
47 if nil == expirationInstance then
48 return
49 end
50 local remainingDuration = math.ceil(expirationInstance - now)
51 button:SetText(remainingDuration)
52 end
53
54 local function createHolyPowerIndicator(frameName, parentFrame, unitDesignation)
55 assert (parentFrame ~= nil)
56 assert (unitDesignation ~= nil)
57
58
59 local f = CreateFrame('FRAME', frameName, parentFrame)
60 f.unit = unitDesignation
61 f:SetSize(64, 64)
62 local t = {}
63 local q = 0
64 local x = 0
65 local y = 0
66 local margin = 0
67 while (q < 5) do
68 q = q + 1
69 local p = f:CreateTexture(frameName .. tostring(q), 'OVERLAY')
70 p:SetTexture(255 / 255, 204 / 255, 0 / 255, 1)
71 p:SetSize(24, 24)
72 p:SetPoint('BOTTOMLEFT', margin + x * 28, y * 28)
73 p:Hide()
74 x = x + 1
75 if x >= 3 then
76 x = 0
77 y = y + 1
78 margin = margin + 14
79 end
80 t[q] = p
81 end
82 f.children = t
83
84 f:RegisterEvent('UNIT_POWER_FREQUENT')
85 f:SetScript('OnEvent', function(self)
86 local t = self.children
87 local i = 0
88 local hppq = UnitPower(self.unit, SPELL_POWER_HOLY_POWER)
89 while (i < 5) do
90 i = i + 1
91 local p = t[i]
92 if i <= hppq then
93 p:Show()
94 else
95 p:Hide()
96 end
97 end
98 end)
99 return f
100 end
101
102 local function createButton(buttonName, parentFrame, auraName)
103 assert (buttonName ~= nil)
104 assert (parentFrame ~= nil)
105 assert (auraName ~= nil)
106
107 local button = CreateFrame('BUTTON', buttonName, parentFrame, 'SecureActionButtonTemplate')
108 local size = getDefaultButtonSize()
109 button:SetSize(size, size)
110
111 local text = button:CreateFontString(button:GetName() .. 'Text', 'OVERLAY')
112 text:SetFontObject(DaybreakFont)
113 text:SetAllPoints()
114
115 button:SetFontString(text)
116 button:SetText('?')
117
118 button:SetAttribute('type', 'cancelaura')
119 button:SetAttribute('spell', auraName)
120 button:SetAttribute('unit', 'player')
121
122 button:RegisterEvent('UNIT_AURA')
123 button:SetScript('OnEvent', acceptUnitAura)
124 button:SetScript('OnUpdate', applyUpdate)
125
126 button:Hide()
127
128 return button
129 end
130
131 local function init(rootFrame)
132 assert (rootFrame ~= nil)
133
134 rootFrame:SetSize(384, 384)
135 rootFrame:SetPoint('CENTER', UIParent,
136 'CENTER', 0, 0)
137
138 local hpf = createHolyPowerIndicator('DaybreakHolyPowerPlayerFrame', rootFrame, 'player')
139 hpf:SetPoint('CENTER', 0, -128)
140
141 local padding = 8
142 local size = getDefaultButtonSize() + padding
143
144 --[[ General ]]--
145 local wings = createButton('DaybreakButton01', rootFrame, 'Avenging Wrath')
146 wings:SetPoint('BOTTOMLEFT', 0 * size, 2 * size)
147
148 local protection = createButton('DaybreakButton02', rootFrame, 'Divine Protection')
149 protection:SetPoint('BOTTOMLEFT', 0 * size, 2 * size)
150
151 local bubble = createButton('DaybreakButton03', rootFrame, 'Divine Shield')
152 bubble:SetPoint('BOTTOMLEFT', 0 * size, 2 * size)
153
154 local plea = createButton('DaybreakButton04', rootFrame, 'Divine Plea')
155 plea:SetPoint('BOTTOMLEFT', 0 * size, 1 * size)
156
157 local hop = createButton('DaybreakButton05', rootFrame, 'Hand of Protection')
158 hop:SetPoint('BOTTOMLEFT', 0 * size, 0 * size)
159
160 local freedom = createButton('DaybreakButton06', rootFrame, 'Hand of Freedom')
161 freedom:SetPoint('BOTTOMLEFT', 0 * size, 0 * size)
162
163 --[[ Holy ]]--
164 local daybreak = createButton('DaybreakButton07', rootFrame, 'Daybreak')
165 daybreak:SetPoint('BOTTOMLEFT', 1 * size, 1 * size)
166
167 local infusion = createButton('DaybreakButton08', rootFrame, 'Infusion of Light')
168 infusion:SetPoint('BOTTOMLEFT', 1 * size, 2 * size)
169
170 local judgement = createButton('DaybreakButton08', rootFrame, 'Judgements of the Pure')
171 judgement:SetPoint('BOTTOMLEFT', 1 * size, 0 * size)
172
173 --[[ Protection ]]--
174 local grandCrusader = createButton('DaybreakButton09', rootFrame, 'Grand Crusader')
175 grandCrusader:SetPoint('BOTTOMLEFT', 1 * size, 0 * size)
176
177 local shield = createButton('DaybreakButton10', rootFrame, 'Holy Shield')
178 shield:SetPoint('BOTTOMLEFT', 1 * size, 1 * size)
179
180 --[[ Retribution ]]--
181
182 print('[Daybreak]: addon loaded')
183
184 return rootFrame
185 end
186
187 local function main()
188 local rootFrame = CreateFrame('FRAME', 'DaybreakFrame', UIParent)
189 rootFrame:SetScript('OnEvent', init)
190 rootFrame:RegisterEvent('VARIABLES_LOADED')
191 end
192 main()
File daybreak.toc added (mode: 100644) (index 0000000..92522a2)
1 ##Interface: 40300
2 ##Title: Daybreak
3 ##Version: 0.0.0-SNAPSHOT
4 ##Notes: Add paladin player buff indicator
5 daybreak.xml
6 daybreak.lua
File daybreak.xml added (mode: 100644) (index 0000000..2e6fd5d)
1 <?xml version="1.0"?>
2 <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3 <Font name="DaybreakFont" font="Interface\AddOns\daybreak\unifont.ttf" outline="THICK" virtual="true">
4 <FontHeight>
5 <AbsValue val="16"/>
6 </FontHeight>
7 <Shadow>
8 <Offset>
9 <AbsDimension x="1" y="-1"/>
10 </Offset>
11 <Color r="0.84" g="0.84" b="0.84"/>
12 </Shadow>
13 <Color r="1.0" g="1.0" b="1.0" a="1.0"/>
14 </Font>
15 </Ui>
File unifont.ttf added (mode: 100644) (index 0000000..fa0fefa)
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/wowaddons

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

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

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