Mercurial > wow > whistle-master
changeset 6:73d6c2ccdd91
First commit of LDB support.
author | Vynn <mischivin@gmail.com> |
---|---|
date | Sat, 05 Nov 2016 23:45:12 -0400 |
parents | 090b3be6489d |
children | bfd040e221bb |
files | WhistleMaster_LDB.lua |
diffstat | 1 files changed, 37 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WhistleMaster_LDB.lua Sat Nov 05 23:45:12 2016 -0400 @@ -0,0 +1,37 @@ +local dataobj = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("WhistleMaster", { + type = "data source", + label = "Whistle Master", + text = "N/A", + icon = "Interface\\Icons\\Ability_Hunter_Beastcall", + OnClick = function(clickedframe, button) + ToggleFrame(WorldMapFrame) + end, +}) + +local f = CreateFrame("frame") +local UPDATEPERIOD, elapsed = 5, 0 + +f:SetScript("OnUpdate", function(self, elap) + elapsed = elapsed + elap + if elapsed < UPDATEPERIOD then return end + elapsed = 0 + + dataobj.text = WM_ClosestNode.name + +end) + +function dataobj:OnTooltipShow() + self:AddLine("Click to open the World Map") +end + +function dataobj:OnEnter() + GameTooltip:SetOwner(self, "ANCHOR_NONE") + GameTooltip:SetPoint("TOP", self, "BOTTOM") + GameTooltip:ClearLines() + dataobj.OnTooltipShow(GameTooltip) + GameTooltip:Show() +end + +function dataobj:OnLeave() + GameTooltip:Hide() +end \ No newline at end of file