File choir.lua changed (mode: 100644) (index f526d66..5c0ea52) |
... |
... |
local function getDefaultUnitButtonBarColor() |
6 |
6 |
return 0, 1, 0 |
return 0, 1, 0 |
7 |
7 |
end |
end |
8 |
8 |
|
|
|
9 |
|
local function createClearcastingSection(unitButton) |
|
10 |
|
assert (unitButton ~= nil) |
|
11 |
|
|
|
12 |
|
if not ClearcastingFrame then |
|
13 |
|
trace('could not access Clearcasting module') |
|
14 |
|
return |
|
15 |
|
end |
|
16 |
|
|
|
17 |
|
local locale = GetLocale() |
|
18 |
|
assert (locale == 'enGB' or locale == 'enUS', 'requires English localization') |
|
19 |
|
|
|
20 |
|
local columnQuantity = 5 |
|
21 |
|
local rowQuantity = 2 |
|
22 |
|
|
|
23 |
|
local x = 0 |
|
24 |
|
local y = 0 |
|
25 |
|
|
|
26 |
|
local createIndicator = ClearcastingFrame.createIndicator |
|
27 |
|
assert (createIndicator ~= nil) |
|
28 |
|
|
|
29 |
|
local padding = 2 |
|
30 |
|
|
|
31 |
|
--[[ FIXME Update indicator unit designation when unit button attribute changes at runtime. ]]-- |
|
32 |
|
local unitDesignation = unitButton:GetAttribute('unit') |
|
33 |
|
assert (unitDesignation ~= nil) |
|
34 |
|
|
|
35 |
|
local section = CreateFrame('FRAME', unitButton:GetName() .. 'ClearcastingSection', unitButton) |
|
36 |
|
section:SetPoint('BOTTOMLEFT', 0, 0) |
|
37 |
|
section:SetPoint('TOPRIGHT', 0, (36 * rowQuantity + padding * (rowQuantity + 1)) - unitButton:GetHeight()) |
|
38 |
|
|
|
39 |
|
local d |
|
40 |
|
local harmfulSpellCategoryList = { |
|
41 |
|
'Magic', 'Poison', 'Disease', 'Curse', 'HARMFUL', |
|
42 |
|
} |
|
43 |
|
|
|
44 |
|
local i = 0 |
|
45 |
|
while (i < #harmfulSpellCategoryList) do |
|
46 |
|
i = i + 1 |
|
47 |
|
local category = harmfulSpellCategoryList[i] |
|
48 |
|
d = createIndicator(section, category, unitDesignation, 'HARMFUL') |
|
49 |
|
d:SetPoint('BOTTOMLEFT', d:GetWidth() * x + padding * (x + 1), 12 + (d:GetHeight() + 12) * y + padding * (y + 1)) |
|
50 |
|
x = x + 1 |
|
51 |
|
end |
|
52 |
|
|
|
53 |
|
local helpfulSpellMap = { |
|
54 |
|
--[[PALADIN]]-- |
|
55 |
|
{'Hand of Freedom', 'Hand of Protection', 'Sacred Shield', 'Beacon of Light'}, |
|
56 |
|
--[[PRIEST]]-- |
|
57 |
|
{'Power Word: Shield', 'Renew', 'Grace', 'Power Infusion', 'Pain Suppression'}, |
|
58 |
|
--[[DRUID]]-- |
|
59 |
|
{'Rejuvenation', 'Regrowth', 'Wild Growth'}, |
|
60 |
|
--[[SHAMAN]]-- |
|
61 |
|
{'Earth Shield'}, |
|
62 |
|
} |
|
63 |
|
|
|
64 |
|
y = y + 1 |
|
65 |
|
local p = 0 |
|
66 |
|
while (p < #helpfulSpellMap) do |
|
67 |
|
p = p + 1 |
|
68 |
|
local list = helpfulSpellMap[p] |
|
69 |
|
local q = 0 |
|
70 |
|
x = 0 |
|
71 |
|
assert (#list <= columnQuantity) |
|
72 |
|
while (q < #list) do |
|
73 |
|
q = q + 1 |
|
74 |
|
local spellName = list[q] |
|
75 |
|
d = createIndicator(section, spellName, unitDesignation, 'PLAYER HELPFUL') |
|
76 |
|
d:SetPoint('BOTTOMLEFT', d:GetWidth() * x + padding * (x + 1), 12 + (d:GetHeight() + 12) * y + padding * (y + 1)) |
|
77 |
|
x = x + 1 |
|
78 |
|
end |
|
79 |
|
end |
|
80 |
|
|
|
81 |
|
return section |
|
82 |
|
end |
|
83 |
|
|
9 |
84 |
local function createLabel(ownerFrame, fontObject) |
local function createLabel(ownerFrame, fontObject) |
10 |
85 |
assert (ownerFrame ~= nil) |
assert (ownerFrame ~= nil) |
11 |
86 |
|
|
|
... |
... |
local function createUnitButtonBar(unitButton) |
146 |
221 |
assert (unitButton ~= nil) |
assert (unitButton ~= nil) |
147 |
222 |
|
|
148 |
223 |
local n = unitButton:GetName() or '' |
local n = unitButton:GetName() or '' |
|
224 |
|
local padding = 4 |
|
225 |
|
local marginTop = 24 |
|
226 |
|
local marginBottom = 36 * 2 + (2 * 3) |
149 |
227 |
local bar = CreateFrame('FRAME', n .. 'Bar', unitButton) |
local bar = CreateFrame('FRAME', n .. 'Bar', unitButton) |
150 |
|
bar:SetPoint('BOTTOMLEFT', unitButton, 'BOTTOMLEFT', 4, 4) |
|
151 |
|
bar:SetPoint('TOPRIGHT', unitButton, 'TOPRIGHT', -4, 12 - unitButton:GetHeight()) |
|
|
228 |
|
bar:SetPoint('BOTTOMLEFT', unitButton, 'BOTTOMLEFT', padding, padding + marginBottom) |
|
229 |
|
bar:SetPoint('TOPRIGHT', unitButton, 'TOPRIGHT', -padding, -padding - marginTop) |
152 |
230 |
|
|
153 |
231 |
local b = bar:CreateTexture(bar:GetName() .. 'Overlay', 'OVERLAY') |
local b = bar:CreateTexture(bar:GetName() .. 'Overlay', 'OVERLAY') |
154 |
232 |
b:SetAllPoints() |
b:SetAllPoints() |
|
... |
... |
local function createUnitButton(parentFrame, frameName, unit) |
205 |
283 |
assert (frameName ~= nil) |
assert (frameName ~= nil) |
206 |
284 |
assert (unit ~= nil) |
assert (unit ~= nil) |
207 |
285 |
|
|
208 |
|
--[[ TODO Add debuff indicator, at least the presence of a debuff of a category not the exact effect ]]-- |
|
209 |
|
--[[ TODO Add ability to cleanse without targeting ]]-- |
|
|
286 |
|
--[[ TODO Add children buttons that are secure spell buttons on the same target as the unit button. |
|
287 |
|
-- Set override bindings to those buttons as ALT-A, CTRL-A, SHIFT-A, where A is the unit button key. |
|
288 |
|
-- The spells assigned to the buttons let be something like Cleanse, Dispel Magic or Flash Heal. |
|
289 |
|
-- That way, user may cast something without targeting or hiding the selection spoiler. |
|
290 |
|
-- The problem is that it is class dependant.]]-- |
210 |
291 |
local u = CreateFrame('BUTTON', frameName, parentFrame, 'SecureUnitButtonTemplate') |
local u = CreateFrame('BUTTON', frameName, parentFrame, 'SecureUnitButtonTemplate') |
211 |
292 |
u:SetAttribute('type', 'target') |
u:SetAttribute('type', 'target') |
212 |
293 |
u:SetAttribute('unit', unit) |
u:SetAttribute('unit', unit) |
213 |
294 |
|
|
214 |
|
u:SetSize(12 * 8, 12 * 3) |
|
|
295 |
|
u:SetSize(24 * 5 + 2 * 6, 36 * 2 + 2 * 3 + 24 * 2) |
215 |
296 |
|
|
216 |
297 |
local t = createLabel(u) |
local t = createLabel(u) |
217 |
298 |
t:SetPoint('BOTTOMLEFT', u, 'BOTTOMLEFT', 4, u:GetHeight() - 24 - 4) |
t:SetPoint('BOTTOMLEFT', u, 'BOTTOMLEFT', 4, u:GetHeight() - 24 - 4) |
|
... |
... |
local function createUnitButton(parentFrame, frameName, unit) |
224 |
305 |
local bar = createUnitButtonBar(u) |
local bar = createUnitButtonBar(u) |
225 |
306 |
u.bar = bar |
u.bar = bar |
226 |
307 |
|
|
|
308 |
|
local clearcasting = createClearcastingSection(u) |
|
309 |
|
u.clearcasting = clearcasting |
|
310 |
|
|
227 |
311 |
u:SetScript('OnEvent', unitButtonEventProcessor) |
u:SetScript('OnEvent', unitButtonEventProcessor) |
228 |
312 |
u:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
u:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
229 |
313 |
u:RegisterEvent('PARTY_MEMBERS_CHANGED') |
u:RegisterEvent('PARTY_MEMBERS_CHANGED') |
|
... |
... |
local function createGroup(rootFrame, groupNumber, unitTable) |
344 |
428 |
assert (#u == groupSize) |
assert (#u == groupSize) |
345 |
429 |
|
|
346 |
430 |
local spoiler = createSpoiler(rootFrame, 'ChoirSpoiler' .. tostring(groupNumber)) |
local spoiler = createSpoiler(rootFrame, 'ChoirSpoiler' .. tostring(groupNumber)) |
347 |
|
spoiler:SetSize(12 * 6, 12 * 4) |
|
348 |
|
spoiler:SetPoint('CENTER', 12 * 6 * 6 / -2, 144) |
|
349 |
431 |
|
|
350 |
432 |
local i = 0 |
local i = 0 |
351 |
433 |
local marginLeft = 0 |
local marginLeft = 0 |
|
... |
... |
local function createGroup(rootFrame, groupNumber, unitTable) |
375 |
457 |
|
|
376 |
458 |
_G['BINDING_NAME_CLICK ' .. b:GetName() .. ':LeftButton'] = 'Unit ' .. tostring(i) |
_G['BINDING_NAME_CLICK ' .. b:GetName() .. ':LeftButton'] = 'Unit ' .. tostring(i) |
377 |
459 |
end |
end |
|
460 |
|
spoiler:SetSize(marginLeft, 144) |
|
461 |
|
spoiler:SetPoint('CENTER', 0, 12 * 6) |
378 |
462 |
|
|
379 |
463 |
_G['BINDING_NAME_CLICK ' .. spoiler:GetName() .. ':LeftButton'] = 'Group ' .. tostring(groupNumber) |
_G['BINDING_NAME_CLICK ' .. spoiler:GetName() .. ':LeftButton'] = 'Group ' .. tostring(groupNumber) |
380 |
464 |
|
|