This repository has been archived by the owner on Jan 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OSD.lua
46 lines (34 loc) · 1.51 KB
/
OSD.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
-- Author : Lyrael
-- Create Date : 2012/12/15 08:31 AM
-- Working functionality:
--
-- Pending Functionality:
local addon = Lyranthe;
-- ========================================================================================================================================================================
-- OSD Related stuff here.
-- ========================================================================================================================================================================
local function AssignOSDStateHandler(osd)
for _, fTarget in ipairs({"mouseover", "focus", "target", "targettarget"}) do
RegisterStateDriver(osd, fTarget, "[@" .. fTarget .. ", exists, dead, help]rez;[@" .. fTarget .. ", help, nodead]help;[@" .. fTarget .. ", harm, nodead]default;[@" .. fTarget .. ",dead]dead;default");
local stateHandler = [[
self:ChildUpdate(stateid, newstate);
]]
osd:SetAttribute("_onstate-" .. fTarget, stateHandler);
osd:SetAttribute("state-" .. fTarget, "default");
end
end
function addon:SetupOSD(osd)
AssignOSDStateHandler(osd);
osd:HookScript("OnAttributeChanged",
function(self,name,value)
if(name == "state-mouseover") then
osd.mStateText:SetText("m:" .. value);
elseif(name == "state-focus") then
osd.fStateText:SetText("f:" .. value);
elseif(name == "state-target") then
osd.tStateText:SetText("t:" .. value);
elseif(name == "state-targettarget") then
osd.ttStateText:SetText("tt:" .. value);
end
end);
end