69 lines
2.3 KiB
Lua
Executable File
69 lines
2.3 KiB
Lua
Executable File
local addonName, addon = ...
|
|
local childName = addon['childName']
|
|
local child = addon[childName]
|
|
local zzLDB = LibStub:GetLibrary("zzLDB")
|
|
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
|
|
local ldbicon = LibStub:GetLibrary("LibDBIcon-1.0")
|
|
local folder = addonName ~= childName and format("Interface\\AddOns\\%s\\%s", addonName, childName) or format("Interface\\AddOns\\%s", childName)
|
|
local function OnClick(self, button)
|
|
if(button == 'RightButton') then
|
|
if(IsShiftKeyDown()) then
|
|
-- zzCoords_MinimapToggle()
|
|
else
|
|
if(not InCombatLockdown()) then
|
|
if(SettingsPanel) then
|
|
if(SettingsPanel:IsVisible()) then
|
|
SettingsPanel:Hide()
|
|
else
|
|
Settings.OpenToCategory(childName)
|
|
end
|
|
elseif(InterfaceOptionsFrame) then
|
|
if(InterfaceOptionsFrame:IsVisible()) then
|
|
InterfaceOptionsFrame:Hide()
|
|
else
|
|
InterfaceOptionsFrame_OpenToCategory(childName)
|
|
InterfaceOptionsFrame_OpenToCategory(childName) -- Twice because of a bug in InterfaceOptionsFrame_OpenToCategory
|
|
end
|
|
end
|
|
end
|
|
end
|
|
elseif(button == "LeftButton") then
|
|
if(IsShiftKeyDown()) then
|
|
local db = addon['db']['global']['ldbicons']
|
|
db[childName]['hide'] = not db[childName]['hide']
|
|
if(ldbicon) then
|
|
if(db[childName]['hide']) then
|
|
ldbicon:Hide(childName)
|
|
else
|
|
ldbicon:Show(childName)
|
|
end
|
|
end
|
|
else
|
|
ToggleFrame(WorldMapFrame)
|
|
end
|
|
end
|
|
end
|
|
local function OnTooltipShow(tip)
|
|
tip:AddLine(childName)
|
|
tip:AddLine(GetRealZoneText())
|
|
tip:AddLine(GetSubZoneText())
|
|
tip:AddLine(format("%s: %s",childName, child['playerCoords']))
|
|
tip:AddLine(L['HINT'])
|
|
tip:AddLine(L['HINT2'])
|
|
-- tip:AddLine(L['HINT3'])
|
|
-- tip:AddLine(L['HINT4'])
|
|
end
|
|
child['ldb'] = { -- https://github.com/tekkub/libdatabroker-1-1/wiki/Data-Specifications
|
|
['type'] = 'data source', -- required: 'data source' or 'launcher'
|
|
['text'] = childName, -- required/optional for launcher
|
|
['icon'] = format("%s\\icon2.tga", folder), -- optional/required for launcher
|
|
['OnClick'] = OnClick, -- optional/required for launcher
|
|
['OnTooltipShow'] = OnTooltipShow, -- optional
|
|
}
|
|
child.OnText = zzLDB.DefaultOnText
|
|
local init = {
|
|
Setup = function(self, childName, event)
|
|
child.OnText = zzLDB.DefaultOnText
|
|
end
|
|
}
|
|
addon.RegisterCallback(init, format("Init%s", childName), 'Setup', childName) |