Mercurial > wow > whistle-master
comparison WhistleMaster_LDB.lua @ 6:73d6c2ccdd91
First commit of LDB support.
| author | Vynn <mischivin@gmail.com> |
|---|---|
| date | Sat, 05 Nov 2016 23:45:12 -0400 |
| parents | |
| children | e7f7baf8475f |
comparison
equal
deleted
inserted
replaced
| 5:090b3be6489d | 6:73d6c2ccdd91 |
|---|---|
| 1 local dataobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("WhistleMaster", { | |
| 2 type = "data source", | |
| 3 label = "Whistle Master", | |
| 4 text = "N/A", | |
| 5 icon = "Interface\\Icons\\Ability_Hunter_Beastcall", | |
| 6 OnClick = function(clickedframe, button) | |
| 7 ToggleFrame(WorldMapFrame) | |
| 8 end, | |
| 9 }) | |
| 10 | |
| 11 local f = CreateFrame("frame") | |
| 12 local UPDATEPERIOD, elapsed = 5, 0 | |
| 13 | |
| 14 f:SetScript("OnUpdate", function(self, elap) | |
| 15 elapsed = elapsed + elap | |
| 16 if elapsed < UPDATEPERIOD then return end | |
| 17 elapsed = 0 | |
| 18 | |
| 19 dataobj.text = WM_ClosestNode.name | |
| 20 | |
| 21 end) | |
| 22 | |
| 23 function dataobj:OnTooltipShow() | |
| 24 self:AddLine("Click to open the World Map") | |
| 25 end | |
| 26 | |
| 27 function dataobj:OnEnter() | |
| 28 GameTooltip:SetOwner(self, "ANCHOR_NONE") | |
| 29 GameTooltip:SetPoint("TOP", self, "BOTTOM") | |
| 30 GameTooltip:ClearLines() | |
| 31 dataobj.OnTooltipShow(GameTooltip) | |
| 32 GameTooltip:Show() | |
| 33 end | |
| 34 | |
| 35 function dataobj:OnLeave() | |
| 36 GameTooltip:Hide() | |
| 37 end |
