List of commits:
Subject Hash Author Date (UTC)
fix: Code base maintainance Add documentation and sanitise some arguments. 52e74dfb3f9fce8617ed4d4c63105966bb388daa Vladyslav Bondarenko 2021-01-12 13:07:49
fix: Typo The error did not affect performance. 216d3738bf4ef2de6be1361b7e2b57a6a7387f71 Vladyslav Bondarenko 2021-01-12 01:28:45
feat!: Show indicators correctly while in combat 0b6bf32b2a6ad2537b8cba766384e2d7f4b053d5 Vladyslav Bondarenko 2021-01-11 23:35:19
Initial commit 447e6a5ac2cc64f0f818663ba08681615327b19a Vladyslav Bondarenko 2021-01-11 20:26:55
Commit 52e74dfb3f9fce8617ed4d4c63105966bb388daa - fix: Code base maintainance Add documentation and sanitise some arguments.
Author: Vladyslav Bondarenko
Author date (UTC): 2021-01-12 13:07
Committer name: Vladyslav Bondarenko
Committer date (UTC): 2021-01-12 13:07
Parent(s): 216d3738bf4ef2de6be1361b7e2b57a6a7387f71
Signer:
Signing key:
Signing status: N
Tree: c8a2cbf7dc376654986e3095ce15d25ff134b3be
File Lines added Lines deleted
.gitignore 1 0
.luacheckrc 86 0
daybreak.lua 92 24
daybreak.toc 2 1
File .gitignore changed (mode: 100644) (index 644483f..15bf550)
1 1 *swp *swp
2 2 *~ *~
3 doc/
File .luacheckrc added (mode: 100644) (index 0000000..fe4b99d)
1 -- http://luacheck.readthedocs.io/en/stable/config.html
2 stds.wow = {
3 globals = {}, -- these globals can be set and accessed.
4 read_globals = {
5 "CreateFrame",
6 "GameFontNormal",
7 "GameMenuFrame",
8 "GetBinding",
9 "GetContainerItemID",
10 "GetContainerItemInfo",
11 "GetContainerNumSlots",
12 "GetInventoryItemCooldown",
13 "GetInventoryItemTexture",
14 "GetInventorySlotInfo",
15 "GetItemCooldown",
16 "GetItemInfo",
17 "GetLocale",
18 "GetLootSlotInfo",
19 "GetMacroInfo",
20 "GetMoney",
21 "GetNumBindings",
22 "GetNumLootItems",
23 "GetNumPartyMembers",
24 "GetNumRaidMembers",
25 "GetNumTalentTabs",
26 "GetNumTalents",
27 "GetPartyMember",
28 "GetRealmName",
29 "GetSpellCooldown",
30 "GetSpellInfo",
31 "GetSpellName",
32 "GetSubZoneText",
33 "GetTalentInfo",
34 "GetTime",
35 "GetZoneText",
36 "HideUIPanel",
37 "IsSpellInRange",
38 "LootSlotIsCoin",
39 "LootSlotIsItem",
40 "MainMenuBar",
41 "MerchantFrame",
42 "OpenAllBags",
43 "QuestLogFrame",
44 "SPELL_POWER_HOLY_POWER",
45 "SendChatMessage",
46 "ShowUIPanel",
47 "StaticPopup_Show",
48 "ToggleAchievementFrame",
49 "ToggleCharacter",
50 "ToggleFrame",
51 "ToggleFriendsFrame",
52 "ToggleHelpFrame",
53 "ToggleLFDParentFrame",
54 "TogglePVPFrame",
55 "ToggleSpellBook",
56 "ToggleTalentFrame",
57 "UIParent",
58 "UnitAura",
59 "UnitBuff",
60 "UnitFactionGroup",
61 "UnitIsDead",
62 "UnitName",
63 "UnitPlayerControlled",
64 "UnitPower",
65 "date",
66 "difftime",
67 "geterrorhandler",
68 "getglobal",
69 "hooksecurefunc",
70 "strtrim",
71 "time",
72 } -- these globals can only be accessed.
73 }
74
75 stds.daybreak = {
76 globals = {
77 },
78 read_globals = {
79 "DaybreakButton01",
80 "DaybreakFont",
81 "DaybreakFrame",
82 "DaybreakHolyPowerPlayerFrame",
83 }
84 }
85
86 std = "min+wow+daybreak"
File daybreak.lua changed (mode: 100644) (index b0c3294..d105517)
1 --[[--
2 Add paladin player aura indicator.
3 @script daybreak
4 ]]
5
6 --[[--
7 Access constant default indicator size pixels.
8 @function getDefaultButtonSize
9 @treturn number positive integer
10 ]]
1 11 local function getDefaultButtonSize() local function getDefaultButtonSize()
2 12 return 32 return 32
3 13 end end
4 14
15 --[[--
16 Access constant maximum quantity of holy power points.
17 @function getMaxHolyPower
18 @treturn number positive integer
19 ]]
20 local function getMaxHolyPower()
21 return 3
22 end
23
24 --[[--
25 Process reaction to UNIT_AURA event for aura indicator.
26 When aura disappears from the unit associated with this button,
27 hide the button. Show it otherwise.
28 @function acceptUnitAura
29 @tparam button frame this button frame to update
30 @tparam string eventCategory given event category designation
31 @return nothing
32 ]]
5 33 local function acceptUnitAura(button, eventCategory) local function acceptUnitAura(button, eventCategory)
6 34 assert (button ~= nil) assert (button ~= nil)
7 35 assert (eventCategory ~= nil) assert (eventCategory ~= nil)
36 assert ('string' == type(eventCategory))
37 assert (string.len(eventCategory) >= 2)
38 assert (string.len(eventCategory) <= 256)
8 39
9 40 local auraName = button.spell local auraName = button.spell
10 41 assert (auraName ~= nil) assert (auraName ~= nil)
42 assert ('string' == type(auraName))
43 assert (string.len(auraName) >= 2)
44 assert (string.len(auraName) <= 256)
11 45
12 46 local unitDesignation = button.unit local unitDesignation = button.unit
13 47 assert (unitDesignation ~= nil) assert (unitDesignation ~= nil)
48 assert ('string' == type(unitDesignation))
49 assert (string.len(unitDesignation) >= 2)
50 assert (string.len(unitDesignation) <= 256)
14 51
15 52 local name, _, icon = UnitBuff(unitDesignation, auraName) local name, _, icon = UnitBuff(unitDesignation, auraName)
16 53 if name then if name then
 
... ... local function acceptUnitAura(button, eventCategory)
22 59 end end
23 60 end end
24 61
25 local function applyUpdate(button, updateDuration)
62 --[[--
63 Process timer tick to update remaining aura duration.
64 @function applyUpdate
65 @tparam frame button to update
66 @return nothing
67 ]]
68 local function applyUpdate(button)
26 69 assert (button ~= nil) assert (button ~= nil)
27 70
28 71 local auraName = button.spell local auraName = button.spell
29 72 assert (auraName ~= nil) assert (auraName ~= nil)
73 assert ('string' == type(auraName))
74 assert (string.len(auraName) >= 2)
75 assert (string.len(auraName) <= 256)
30 76
31 77 local unitDesignation = button.unit local unitDesignation = button.unit
32 78 assert (unitDesignation ~= nil) assert (unitDesignation ~= nil)
79 assert ('string' == type(unitDesignation))
80 assert (string.len(unitDesignation) >= 2)
81 assert (string.len(unitDesignation) <= 256)
33 82
34 local name, _, _, _, _, duration, expirationInstance = UnitBuff(unitDesignation, auraName)
35 local now = GetTime()
83 local _, _, _, _, _, _, expirationInstance = UnitBuff(unitDesignation, auraName)
36 84 if nil == expirationInstance then if nil == expirationInstance then
37 85 return return
38 86 end end
87 local now = GetTime()
39 88 local remainingDuration = math.ceil(expirationInstance - now) local remainingDuration = math.ceil(expirationInstance - now)
40 89 button:SetText(remainingDuration) button:SetText(remainingDuration)
41 90 end end
42 91
92 --[[--
93 Produce frame that tracks and displays given unit holy power.
94 The new frame possesses custom attribute "unit".
95 @function createHolyPowerIndicator
96 @tparam string frameName conventionally unique frame desgination
97 @tparam frame parentFrame parent frame
98 @tparam string unitDesignation associated unit designation
99 @treturn frame newly allocated frame
100 ]]
43 101 local function createHolyPowerIndicator(frameName, parentFrame, unitDesignation) local function createHolyPowerIndicator(frameName, parentFrame, unitDesignation)
44 102 assert (parentFrame ~= nil) assert (parentFrame ~= nil)
45 assert (unitDesignation ~= nil)
46 103
104 assert (unitDesignation ~= nil)
105 assert ('string' == type(unitDesignation))
106 assert (string.len(unitDesignation) >= 2)
107 assert (string.len(unitDesignation) <= 256)
47 108
48 109 local f = CreateFrame('FRAME', frameName, parentFrame) local f = CreateFrame('FRAME', frameName, parentFrame)
49 110 f.unit = unitDesignation f.unit = unitDesignation
 
... ... local function createHolyPowerIndicator(frameName, parentFrame, unitDesignation)
51 112 local t = {} local t = {}
52 113 local q = 0 local q = 0
53 114 local x = 0 local x = 0
54 local y = 0
55 local margin = 0
56 while (q < 5) do
115 local maxQuantity = getMaxHolyPower()
116 while (q < maxQuantity) do
57 117 q = q + 1 q = q + 1
58 118 local p = f:CreateTexture(frameName .. tostring(q), 'OVERLAY') local p = f:CreateTexture(frameName .. tostring(q), 'OVERLAY')
59 119 p:SetTexture(255 / 255, 204 / 255, 0 / 255, 1) p:SetTexture(255 / 255, 204 / 255, 0 / 255, 1)
60 120 p:SetSize(24, 24) p:SetSize(24, 24)
61 p:SetPoint('BOTTOMLEFT', margin + x * 28, y * 28)
121 p:SetPoint('BOTTOMLEFT', x * 28, 0)
62 122 p:Hide() p:Hide()
63 123 x = x + 1 x = x + 1
64 if x >= 3 then
65 x = 0
66 y = y + 1
67 margin = margin + 14
68 end
69 124 t[q] = p t[q] = p
70 125 end end
71 126 f.children = t f.children = t
72 127
73 128 f:RegisterEvent('UNIT_POWER_FREQUENT') f:RegisterEvent('UNIT_POWER_FREQUENT')
74 f:SetScript('OnEvent', function(self)
75 local t = self.children
129 f:SetScript('OnEvent', function()
76 130 local i = 0 local i = 0
77 local hppq = UnitPower(self.unit, SPELL_POWER_HOLY_POWER)
78 while (i < 5) do
131 local hppq = UnitPower(unitDesignation, SPELL_POWER_HOLY_POWER)
132 while (i < maxQuantity) do
79 133 i = i + 1 i = i + 1
80 134 local p = t[i] local p = t[i]
81 135 if i <= hppq then if i <= hppq then
 
... ... local function createHolyPowerIndicator(frameName, parentFrame, unitDesignation)
89 143 end end
90 144
91 145 --[[-- --[[--
146 Allocate button frame that represents a single aura
147 New button has two custom fields: unit and spell.
148 that is potentially applied to the player character.
92 149 @function createButton @function createButton
93 @param buttonName string
94 @param parentFrame
95 @param localizedSpellName string
96 @return button frame
97 @treturn spell string
98 @treturn unit string
150 @tparam string buttonName
151 @tparam frame parentFrame
152 @tparam string localizedSpellName aura name to track
153 @treturn frame newly allocated button frame instance
99 154 ]] ]]
100 155 local function createButton(buttonName, parentFrame, localizedSpellName) local function createButton(buttonName, parentFrame, localizedSpellName)
101 156 assert (buttonName ~= nil) assert (buttonName ~= nil)
 
... ... local function createButton(buttonName, parentFrame, localizedSpellName)
133 188 return button return button
134 189 end end
135 190
191 --[[--
192 When variables loaded then create and configure all required frames.
193 Must only be executed once per script lifetime.
194 @function init
195 @tparam frame rootFrame
196 @treturn frame updated given root frame
197 ]]
136 198 local function init(rootFrame) local function init(rootFrame)
137 199 assert (rootFrame ~= nil) assert (rootFrame ~= nil)
138 200
 
... ... local function init(rootFrame)
141 203 'CENTER', 0, 0) 'CENTER', 0, 0)
142 204
143 205 local hpf = createHolyPowerIndicator('DaybreakHolyPowerPlayerFrame', rootFrame, 'player') local hpf = createHolyPowerIndicator('DaybreakHolyPowerPlayerFrame', rootFrame, 'player')
144 hpf:SetPoint('CENTER', 0, -128)
206 hpf:SetPoint('CENTER', 0, 0)
207 hpf:SetPoint('BOTTOM', 0, 0)
145 208
146 209 local padding = 8 local padding = 8
147 210 local size = getDefaultButtonSize() + padding local size = getDefaultButtonSize() + padding
 
... ... local function init(rootFrame)
189 252 return rootFrame return rootFrame
190 253 end end
191 254
255 --[[--
256 Daybreak script entry point.
257 Must only be executed once per script life time.
258 @function main
259 ]]
192 260 local function main() local function main()
193 261 local rootFrame = CreateFrame('FRAME', 'DaybreakFrame', UIParent) local rootFrame = CreateFrame('FRAME', 'DaybreakFrame', UIParent)
194 262 rootFrame:SetScript('OnEvent', init) rootFrame:SetScript('OnEvent', init)
File daybreak.toc changed (mode: 100644) (index 0a52553..a1ce14c)
1 1 ##Interface: 40300 ##Interface: 40300
2 2 ##Title: Daybreak ##Title: Daybreak
3 ##Version: 0.0.2-SNAPSHOT
3 ##Version: 0.0.3-SNAPSHOT
4 4 ##Notes: Add paladin player buff indicator ##Notes: Add paladin player buff indicator
5 5 daybreak.xml daybreak.xml
6 6 daybreak.lua daybreak.lua
7 unifont.ttf
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