Skip to content

Commit

Permalink
First copy from WoWAce
Browse files Browse the repository at this point in the history
  • Loading branch information
AllInOneMighty committed Feb 2, 2020
0 parents commit c8b4406
Show file tree
Hide file tree
Showing 23 changed files with 4,916 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .pkgmeta
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package-as: Elephant

externals:
Libs/AceAddon-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceAddon-3.0
Libs/AceConfig-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConfig-3.0
Libs/AceConsole-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConsole-3.0
Libs/AceDB-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0
Libs/AceEvent-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0
Libs/AceGUI-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceGUI-3.0
Libs/AceLocale-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceLocale-3.0
Libs/CallbackHandler-1.0: svn://svn.wowace.com/wow/callbackhandler/mainline/trunk/CallbackHandler-1.0
Libs/LibDataBroker-1.1: git://git.wowace.com/wow/libdatabroker-1-1/mainline.git
Libs/LibDBIcon-1.0: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0
Libs/LibStub: svn://svn.wowace.com/wow/libstub/mainline/trunk
5 changes: 5 additions & 0 deletions Bindings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Bindings>
<Binding name="ELEPHANT_TOGGLE" header="ELEPHANT">
LibStub("AceAddon-3.0"):GetAddon("Elephant"):Toggle()
</Binding>
</Bindings>
73 changes: 73 additions & 0 deletions Broker.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
--[[
Called when displaying tooltip on Broker source.
]]
local function OnBrokerTooltipShow(tt)
tt:AddLine(Elephant.L['maxlogwords'] .. ": |c" .. Elephant:MakeTextHexColor(1.0, 1.0, 1.0) .. Elephant.db.profile.maxlog .. "|r")

if Elephant.db.profile.filters and #Elephant.db.profile.filters > 0 then
tt:AddLine(" ")
tt:AddLine(Elephant.L['activefilters'])

local filter
for _,filter in pairs(Elephant.db.profile.filters) do
tt:AddLine(" " .. filter, 1.0, 1.0, 1.0, 1.0)
end

end

tt:AddLine(" ")
tt:AddLine(format(Elephant.L['toggletooltiphint1'], Elephant:MakeTextHexColor(0.93, 0.65, 0.37)) .. ", "
.. format(Elephant.L['toggletooltiphint2'], Elephant:MakeTextHexColor(0.93, 0.65, 0.37)) .. ".",
0.2, 1.0, 0.2, 1.0)
end

--[[ Broker source ]]
local LDB = LibStub:GetLibrary("LibDataBroker-1.1")
local LDBDataObject
if LDB then
LDBDataObject = LDB:NewDataObject("Elephant", {
type = "data source",
icon = "Interface\\AddOns\\Elephant\\icon.tga",
OnClick = function(self, button)
if button == "RightButton" then
InterfaceOptionsFrame_OpenToCategory("Elephant")
else
Elephant:Toggle()
end
end,
OnTooltipShow = OnBrokerTooltipShow
})
end

--[[ Broker icon ]]
local LibDBIcon = LibStub("LibDBIcon-1.0")

function Elephant:RegisterLDBIcon()
-- A data object must exist and LibDBIcon must be enabled
if not Elephant:IsLDBIconAvailable() then
return
end

LibDBIcon:Register("Elephant", LDBDataObject, Elephant.db.profile.minimap)
end

function Elephant:ToggleLDBIcon()
if not Elephant:IsLDBIconAvailable() then return end

Elephant.db.profile.minimap.hide = not Elephant.db.profile.minimap.hide
Elephant:RefreshLDBIcon()
end

function Elephant:RefreshLDBIcon()
if not Elephant:IsLDBIconAvailable() then return end

if Elephant.db.profile.minimap.hide then
LibDBIcon:Hide("Elephant")
else
LibDBIcon:Show("Elephant")
end
end

function Elephant:IsLDBIconAvailable()
return LDBDataObject and LibDBIcon
end
Loading

0 comments on commit c8b4406

Please sign in to comment.