File src/Chorus.xml changed (mode: 100644) (index 4e2e674..572aca4) |
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 |
3 |
<Script file="Chorus.lua"/> |
<Script file="Chorus.lua"/> |
4 |
|
<!-- Exclude ChorusTest.lua script in release stable version. |
|
5 |
|
Only include ChorusTest.lua script for development. --> |
|
6 |
|
<!--<Script file="ChorusTest.lua"/>--> |
|
|
4 |
|
<!-- `ChorusTest.lua` script is executed conditionally. |
|
5 |
|
Decision is made at runtime. |
|
6 |
|
Configuration is done in the snippet itself. --> |
|
7 |
|
<Script file="ChorusTest.lua"/> |
7 |
8 |
<Include file="ChorusFont.xml"/> |
<Include file="ChorusFont.xml"/> |
8 |
9 |
<Include file="ChorusAuraButtonTemplate.xml"/> |
<Include file="ChorusAuraButtonTemplate.xml"/> |
9 |
10 |
<Include file="ChorusAuraFrameTemplate.xml"/> |
<Include file="ChorusAuraFrameTemplate.xml"/> |
File src/ChorusAuraButtonTemplate.lua changed (mode: 100644) (index 460a589..c0ce313) |
1 |
1 |
local Chorus = Chorus |
local Chorus = Chorus |
2 |
2 |
|
|
3 |
|
local DebuffTypeColor = DebuffTypeColor |
|
4 |
|
local GameTooltip = GameTooltip |
|
5 |
3 |
local GetTime = GetTime |
local GetTime = GetTime |
6 |
4 |
local UnitAura = Chorus.test.UnitAura or UnitAura |
local UnitAura = Chorus.test.UnitAura or UnitAura |
7 |
5 |
local UnitExists = Chorus.test.UnitExists or UnitExists |
local UnitExists = Chorus.test.UnitExists or UnitExists |
8 |
6 |
local UnitIsConnected = Chorus.test.UnitIsConnected or UnitIsConnected |
local UnitIsConnected = Chorus.test.UnitIsConnected or UnitIsConnected |
9 |
7 |
|
|
|
8 |
|
local DebuffTypeColor = DebuffTypeColor |
|
9 |
|
local GameTooltip = GameTooltip |
|
10 |
|
local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit |
|
11 |
|
|
10 |
12 |
local function auraButtonValidate(auraButton) |
local function auraButtonValidate(auraButton) |
11 |
13 |
assert(auraButton ~= nil) |
assert(auraButton ~= nil) |
12 |
14 |
|
|
File src/ChorusAuraFrameTemplate.lua changed (mode: 100644) (index a767e5e..1fda74b) |
1 |
1 |
local Chorus = Chorus |
local Chorus = Chorus |
2 |
2 |
|
|
3 |
|
local UnitAura = UnitAura |
|
4 |
|
local UnitExists = UnitExists |
|
5 |
|
local UnitIsConnected = UnitIsConnected |
|
|
3 |
|
local UnitAura = Chorus.test.UnitAura or UnitAura |
|
4 |
|
local UnitExists = Chorus.test.UnitExists or UnitExists |
|
5 |
|
local UnitIsConnected = Chorus.test.UnitIsConnected or UnitIsConnected |
|
6 |
|
|
|
7 |
|
local RegisterUnitWatch = Chorus.test.RegisterUnitWatch or RegisterUnitWatch |
|
8 |
|
local SecureButton_GetUnit = Chorus.test.SecureButton_GetUnit or SecureButton_GetUnit |
6 |
9 |
|
|
7 |
10 |
--[[ See `FrameXML/BuffFrame.lua:BUFF_MAX_DISPLAY`. ]]-- |
--[[ See `FrameXML/BuffFrame.lua:BUFF_MAX_DISPLAY`. ]]-- |
8 |
11 |
local BUFF_MAX_DISPLAY = BUFF_MAX_DISPLAY or 36 |
local BUFF_MAX_DISPLAY = BUFF_MAX_DISPLAY or 36 |
|
... |
... |
local function createEveryAuraButton(auraFrame) |
205 |
208 |
local max = math.max(BUFF_MAX_DISPLAY or 36, DEBUFF_MAX_DISPLAY or 36) or 36 |
local max = math.max(BUFF_MAX_DISPLAY or 36, DEBUFF_MAX_DISPLAY or 36) or 36 |
206 |
209 |
local i = 0 |
local i = 0 |
207 |
210 |
local w = math.max(self:GetWidth(), 30) |
local w = math.max(self:GetWidth(), 30) |
208 |
|
local h = math.max(self:GetHeight(), 30) |
|
209 |
211 |
local bmaxh = 30 |
local bmaxh = 30 |
210 |
212 |
local x = 0 |
local x = 0 |
211 |
213 |
local y = 0 |
local y = 0 |
|
... |
... |
local function createEveryAuraButton(auraFrame) |
217 |
219 |
b:SetPoint('TOPLEFT', x, -y) |
b:SetPoint('TOPLEFT', x, -y) |
218 |
220 |
x = x + b:GetWidth() |
x = x + b:GetWidth() |
219 |
221 |
bmaxh = math.max(bmaxh, b:GetHeight()) |
bmaxh = math.max(bmaxh, b:GetHeight()) |
220 |
|
if x > self:GetWidth() then |
|
|
222 |
|
if x > w then |
221 |
223 |
x = 0 |
x = 0 |
222 |
224 |
y = y + bmaxh |
y = y + bmaxh |
223 |
225 |
end |
end |
File src/ChorusTest.lua changed (mode: 100644) (index 7b7eb41..f1d34a7) |
|
1 |
|
local Chorus = Chorus |
|
2 |
|
|
|
3 |
|
--[[ NOTE SavedVariables do not work for this since they are loaded after all |
|
4 |
|
of the scripts and after all of the API was shadowed. Testing module must be |
|
5 |
|
loaded __before__ shadowing. See each individual script for details. ]]-- |
|
6 |
|
|
|
7 |
|
--[[ To enable testing mode uncomment the following line and `/run ReloadUI()`. ]]-- |
|
8 |
|
|
|
9 |
|
--[[ Chorus.debugFlag = true ]]-- |
|
10 |
|
|
|
11 |
|
if not Chorus.debugFlag then |
|
12 |
|
Chorus.test = {} |
|
13 |
|
return |
|
14 |
|
end |
|
15 |
|
|
|
16 |
|
if DEFAULT_CHAT_FRAME then |
|
17 |
|
DEFAULT_CHAT_FRAME:AddMessage(date('%X') .. ' ChorusTest.lua: mock testing mode enabled') |
|
18 |
|
end |
|
19 |
|
|
1 |
20 |
local t = { |
local t = { |
2 |
21 |
focus = {}, |
focus = {}, |
3 |
22 |
party1 = { |
party1 = { |
|
... |
... |
local function UnitPowerType_Mock(u) |
221 |
240 |
return 0, 'MANA' |
return 0, 'MANA' |
222 |
241 |
end |
end |
223 |
242 |
|
|
224 |
|
local function RegisterUnitWatch_Mock() |
|
225 |
|
--[[ call DoNothing() ]]-- |
|
226 |
|
return |
|
|
243 |
|
local function RegisterUnitWatch_Mock(self) |
|
244 |
|
self:Show() |
227 |
245 |
end |
end |
228 |
246 |
|
|
229 |
247 |
local function SecureButton_GetUnit_Mock(self) |
local function SecureButton_GetUnit_Mock(self) |
230 |
|
local p = self:GetParent() |
|
231 |
|
return self:GetAttribute('unit') or p:GetAttribute('unit') |
|
|
248 |
|
local i = 0 |
|
249 |
|
local f = self |
|
250 |
|
local u = nil |
|
251 |
|
while (i < 8192) do |
|
252 |
|
u = f:GetAttribute('unit') |
|
253 |
|
if u ~= nil and 'string' == type(u) then |
|
254 |
|
break |
|
255 |
|
elseif f:GetAttribute('useparent-unit') or f:GetAttribute('useparent*') then |
|
256 |
|
local p = f:GetParent() |
|
257 |
|
if p then |
|
258 |
|
f = p |
|
259 |
|
else |
|
260 |
|
break |
|
261 |
|
end |
|
262 |
|
else |
|
263 |
|
break |
|
264 |
|
end |
|
265 |
|
i = i + 1 |
|
266 |
|
end |
|
267 |
|
|
|
268 |
|
return u |
232 |
269 |
end |
end |
233 |
270 |
|
|
234 |
271 |
local function UnregisterUnitWatch_Mock() |
local function UnregisterUnitWatch_Mock() |
|
... |
... |
local function UnregisterUnitWatch_Mock() |
236 |
273 |
return |
return |
237 |
274 |
end |
end |
238 |
275 |
|
|
|
276 |
|
local function UnitGroupRolesAssigned_Mock() |
|
277 |
|
return 'DAMAGER' |
|
278 |
|
end |
|
279 |
|
|
239 |
280 |
Chorus.test = { |
Chorus.test = { |
240 |
281 |
GetNumPartyMembers = GetNumPartyMembers_Mock, |
GetNumPartyMembers = GetNumPartyMembers_Mock, |
241 |
282 |
UnitAura = UnitAura_Mock, |
UnitAura = UnitAura_Mock, |
|
... |
... |
Chorus.test = { |
243 |
284 |
UnitChannelInfo = UnitChannelInfo_Mock, |
UnitChannelInfo = UnitChannelInfo_Mock, |
244 |
285 |
UnitClass = UnitClass_Mock, |
UnitClass = UnitClass_Mock, |
245 |
286 |
UnitExists = UnitExists_Mock, |
UnitExists = UnitExists_Mock, |
|
287 |
|
UnitGroupRolesAssigned = UnitGroupRolesAssigned_Mock, |
246 |
288 |
UnitHealth = UnitHealth_Mock, |
UnitHealth = UnitHealth_Mock, |
247 |
289 |
UnitHealthMax = UnitHealthMax_Mock, |
UnitHealthMax = UnitHealthMax_Mock, |
248 |
290 |
UnitInParty = UnitInParty_Mock, |
UnitInParty = UnitInParty_Mock, |