File etc/luacheckrc.lua changed (mode: 100644) (index ca5be7a..1a5738c) |
3 |
3 |
--[[ Functions defined in World of Warcraft client Lua environment. It is |
--[[ Functions defined in World of Warcraft client Lua environment. It is |
4 |
4 |
distinct from default Lua 5.1 environment. For example, `os` package is |
distinct from default Lua 5.1 environment. For example, `os` package is |
5 |
5 |
excluded. Only globals used by this project are included, therefore the list is |
excluded. Only globals used by this project are included, therefore the list is |
6 |
|
only a subset and not extensive. ]]-- |
|
|
6 |
|
only a subset and not exhaustive. ]]-- |
7 |
7 |
|
|
8 |
8 |
stds.wowapi = { |
stds.wowapi = { |
9 |
9 |
read_globals = { |
read_globals = { |
|
... |
... |
stds.wowapi = { |
18 |
18 |
'IsSpellInRange', |
'IsSpellInRange', |
19 |
19 |
'UnitAura', |
'UnitAura', |
20 |
20 |
'UnitClass', |
'UnitClass', |
|
21 |
|
'UnitDetailedThreatSituation', |
21 |
22 |
'UnitExists', |
'UnitExists', |
22 |
23 |
'UnitGUID', |
'UnitGUID', |
23 |
24 |
'UnitHealth', |
'UnitHealth', |
|
... |
... |
stds.framexml = { |
107 |
108 |
}, |
}, |
108 |
109 |
} |
} |
109 |
110 |
|
|
110 |
|
--[[ Functions and globals defined by authors of this add-on. This list is not extensive. ]]-- |
|
|
111 |
|
--[[ Functions and globals defined by authors of this add-on. This list is not exhaustive. ]]-- |
111 |
112 |
|
|
112 |
113 |
stds.chorus = { |
stds.chorus = { |
113 |
114 |
read_globals = { |
read_globals = { |
File src/ChorusThreatFrameTemplate.lua changed (mode: 100644) (index ca8a4f0..75edb4b) |
... |
... |
local function threatFrameEventProcessor(self) |
23 |
23 |
return |
return |
24 |
24 |
end |
end |
25 |
25 |
|
|
26 |
|
local threatStatus |
|
|
26 |
|
local threatStatus, threatPercentage |
27 |
27 |
|
|
28 |
28 |
local owner = 'player' |
local owner = 'player' |
29 |
29 |
if UnitIsFriend(owner, u) then |
if UnitIsFriend(owner, u) then |
30 |
30 |
threatStatus = UnitThreatSituation(u) |
threatStatus = UnitThreatSituation(u) |
31 |
31 |
else |
else |
32 |
|
_, threatStatus = UnitDetailedThreatSituation(owner, u) |
|
|
32 |
|
local _, threatStatus0, threatPercentage0 = UnitDetailedThreatSituation(owner, u) |
|
33 |
|
threatStatus = threatStatus0 |
|
34 |
|
threatPercentage = threatPercentage0 |
33 |
35 |
end |
end |
34 |
36 |
|
|
35 |
37 |
local r = 0 |
local r = 0 |
|
... |
... |
local function threatFrameEventProcessor(self) |
45 |
47 |
local artwork = self.artwork |
local artwork = self.artwork |
46 |
48 |
assert (artwork ~= nil) |
assert (artwork ~= nil) |
47 |
49 |
artwork:SetVertexColor(r, g, b, a) |
artwork:SetVertexColor(r, g, b, a) |
|
50 |
|
|
|
51 |
|
local label = self.label or _G[self:GetName() .. 'Text'] |
|
52 |
|
if label and threatPercentage then |
|
53 |
|
assert('number' == type(threatPercentage)) |
|
54 |
|
|
|
55 |
|
threatPercentage = math.min(math.max(0, math.abs(math.floor(threatPercentage)), 100)) |
|
56 |
|
|
|
57 |
|
assert(threatPercentage >= 0) |
|
58 |
|
assert(threatPercentage <= 100) |
|
59 |
|
|
|
60 |
|
label:SetText(string.format('%d%%', threatPercentage)) |
|
61 |
|
elseif label then |
|
62 |
|
label:SetText(nil) |
|
63 |
|
end |
48 |
64 |
end |
end |
49 |
65 |
|
|
50 |
66 |
local function threatFrameMain(self) |
local function threatFrameMain(self) |
|
... |
... |
local function threatFrameMain(self) |
54 |
70 |
assert(artwork ~= nil) |
assert(artwork ~= nil) |
55 |
71 |
self.artwork = artwork |
self.artwork = artwork |
56 |
72 |
|
|
57 |
|
self:RegisterEvent('UNIT_THREAT_SITUATION_UPDATE') |
|
|
73 |
|
self:RegisterEvent('PARTY_MEMBERS_CHANGED') |
|
74 |
|
self:RegisterEvent('PLAYER_ALIVE') |
58 |
75 |
self:RegisterEvent('PLAYER_ENTERING_WORLD') |
self:RegisterEvent('PLAYER_ENTERING_WORLD') |
|
76 |
|
self:RegisterEvent('PLAYER_FOCUS_CHANGED') |
|
77 |
|
self:RegisterEvent('PLAYER_TARGET_CHANGED') |
|
78 |
|
self:RegisterEvent('RAID_ROSTER_UPDATE') |
|
79 |
|
self:RegisterEvent('UNIT_THREAT_SITUATION_UPDATE') |
59 |
80 |
self:SetScript('OnEvent', threatFrameEventProcessor) |
self:SetScript('OnEvent', threatFrameEventProcessor) |
60 |
81 |
end |
end |
61 |
82 |
|
|
File src/ChorusThreatFrameTemplate.xml changed (mode: 100644) (index d55b8c4..f518ae7) |
3 |
3 |
<Script file="ChorusThreatFrameTemplate.lua"/> |
<Script file="ChorusThreatFrameTemplate.lua"/> |
4 |
4 |
<Frame name="ChorusThreatFrameTemplate" virtual="true"> |
<Frame name="ChorusThreatFrameTemplate" virtual="true"> |
5 |
5 |
<Size> |
<Size> |
6 |
|
<AbsDimension x="16" y="16" /> |
|
|
6 |
|
<AbsDimension x="48" y="16" /> |
7 |
7 |
</Size> |
</Size> |
8 |
8 |
<Layers> |
<Layers> |
9 |
9 |
<Layer level="ARTWORK"> |
<Layer level="ARTWORK"> |
10 |
|
<Texture name="$parentArtwork" file="Interface\RaidFrame\UI-RaidFrame-Threat" setAllPoints="true"/> |
|
|
10 |
|
<Texture name="$parentArtwork" file="Interface\RaidFrame\UI-RaidFrame-Threat"> |
|
11 |
|
<Size> |
|
12 |
|
<AbsDimension x="16" y="16" /> |
|
13 |
|
</Size> |
|
14 |
|
<Anchors> |
|
15 |
|
<Anchor point="BOTTOMLEFT"> |
|
16 |
|
<Offset x="0" y="0"/> |
|
17 |
|
</Anchor> |
|
18 |
|
</Anchors> |
|
19 |
|
</Texture> |
|
20 |
|
</Layer> |
|
21 |
|
<Layer level="OVERLAY"> |
|
22 |
|
<FontString name="$parentText" inherits="ChorusFont12Mono" setAllPoints="true" justifyH="RIGHT" justifyV="MIDDLE"/> |
11 |
23 |
</Layer> |
</Layer> |
12 |
24 |
</Layers> |
</Layers> |
13 |
25 |
<Scripts> |
<Scripts> |