annotate WhistleMaster_LDB.lua @ 10:9d94f50f8221
Added tag v0.7.1.1-Beta for changeset 148e87d347f5
author |
Vynn <mischivin@gmail.com> |
date |
Sun, 06 Nov 2016 01:13:25 -0400 |
parents |
e7f7baf8475f |
children |
237c9958b251 |
rev |
line source |
mischivin@6
|
1 local dataobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("WhistleMaster", {
|
mischivin@6
|
2 type = "data source",
|
mischivin@6
|
3 label = "Whistle Master",
|
mischivin@6
|
4 text = "N/A",
|
mischivin@6
|
5 icon = "Interface\\Icons\\Ability_Hunter_Beastcall",
|
mischivin@6
|
6 OnClick = function(clickedframe, button)
|
mischivin@6
|
7 ToggleFrame(WorldMapFrame)
|
mischivin@6
|
8 end,
|
mischivin@6
|
9 })
|
mischivin@6
|
10
|
mischivin@6
|
11 local f = CreateFrame("frame")
|
mischivin@6
|
12 local UPDATEPERIOD, elapsed = 5, 0
|
mischivin@6
|
13
|
mischivin@6
|
14 f:SetScript("OnUpdate", function(self, elap)
|
mischivin@6
|
15 elapsed = elapsed + elap
|
mischivin@6
|
16 if elapsed < UPDATEPERIOD then return end
|
mischivin@6
|
17 elapsed = 0
|
mischivin@8
|
18 if UpdateWhistleMaster() then
|
mischivin@8
|
19 dataobj.text = WM_ClosestNode.name
|
mischivin@8
|
20 else
|
mischivin@8
|
21 dataobj.txt = "N/A"
|
mischivin@8
|
22 end
|
mischivin@6
|
23
|
mischivin@6
|
24 end)
|
mischivin@6
|
25
|
mischivin@6
|
26 function dataobj:OnTooltipShow()
|
mischivin@6
|
27 self:AddLine("Click to open the World Map")
|
mischivin@6
|
28 end
|
mischivin@6
|
29
|
mischivin@6
|
30 function dataobj:OnEnter()
|
mischivin@6
|
31 GameTooltip:SetOwner(self, "ANCHOR_NONE")
|
mischivin@6
|
32 GameTooltip:SetPoint("TOP", self, "BOTTOM")
|
mischivin@6
|
33 GameTooltip:ClearLines()
|
mischivin@6
|
34 dataobj.OnTooltipShow(GameTooltip)
|
mischivin@6
|
35 GameTooltip:Show()
|
mischivin@6
|
36 end
|
mischivin@6
|
37
|
mischivin@6
|
38 function dataobj:OnLeave()
|
mischivin@6
|
39 GameTooltip:Hide()
|
mischivin@6
|
40 end |