Mercurial > wow > whistle-master
annotate WhistleMaster_LDB.lua @ 30:7ec25417d275 tip
Added tag v1.7.2.1 for changeset a5da45da16c7
author | Vynn <mischivin@gmail.com> |
---|---|
date | Fri, 31 Mar 2017 00:26:34 -0400 |
parents | 237c9958b251 |
children |
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@13 | 21 dataobj.text = "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 |