Skip to content

Commit

Permalink
Minimap Icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Urtgard committed Aug 9, 2020
1 parent 0348422 commit f5472dc
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pkgmeta
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ externals:
Libs/LibDataBroker-1.1: https://repos.wowace.com/wow/libdatabroker-1-1
Libs/LibQTip-1.0: svn://svn.wowace.com/wow/libqtip-1-0/mainline/trunk
Libs/LibStub: https://repos.wowace.com/wow/libstub/trunk

Libs/LibDBIcon-1.0: https://repos.wowace.com/wow/libdbicon-1-0/trunk
14 changes: 14 additions & 0 deletions Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,20 @@ function WQA:UpdateOptions()
end,
order = newOrder()
},
LibDBIcon = {
type = "toggle",
name = "Show Minimap Icon",
width = "double",
set = function(info, val)
WQA.db.profile.options.LibDBIcon.hide = not val
WQA:UpdateMinimapIcon()
end,
descStyle = "inline",
get = function()
return not WQA.db.profile.options.LibDBIcon.hide
end,
order = newOrder()
},
}
}
},
Expand Down
28 changes: 21 additions & 7 deletions WQAchievements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ WQA.data.custom = {wqID = "", rewardID = "", rewardType = "none", questType = "W
WQA.data.custom.mission = {missionID = "", rewardID = "", rewardType = "none"}
--WQA.data.customReward = 0

local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local dataobj = ldb:NewDataObject("WQAchievements", {
type = "data source",
text = "WQA",
icon = "Interface\\Icons\\INV_Misc_Map06",
})

local icon = LibStub("LibDBIcon-1.0")

function WQA:OnInitialize()
-- Remove data for the other faction
local faction = UnitFactionGroup("player")
Expand Down Expand Up @@ -320,6 +329,7 @@ function WQA:OnInitialize()
},
},
delay = 5,
LibDBIcon = { hide = false}
},
["achievements"] = {exclusive = {}, ['*'] = "default"},
["mounts"] = {exclusive = {}, ['*'] = "default"},
Expand Down Expand Up @@ -354,6 +364,9 @@ function WQA:OnInitialize()
end
self.db.global.customReward = nil
end

-- Minimap Icon
icon:Register("WQAchievements", dataobj, self.db.profile.options.LibDBIcon)
end

function WQA:OnEnable()
Expand Down Expand Up @@ -2300,13 +2313,6 @@ function WQA:Special()
end
end

local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local dataobj = ldb:NewDataObject("WQAchievements", {
type = "data source",
text = "WQA",
icon = "Interface\\Icons\\INV_Misc_Map06",
})

local anchor
function dataobj:OnEnter()
anchor = self
Expand Down Expand Up @@ -2510,4 +2516,12 @@ function WQA:IsQuestFlaggedCompleted(questID)
else
return false
end
end

function WQA:UpdateMinimapIcon()
if self.db.profile.options.LibDBIcon.hide then
icon:Hide("WQAchievements")
else
icon:Show("WQAchievements")
end
end
1 change: 1 addition & 0 deletions embeds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
<Include file="Libs\AceDBOptions-3.0\AceDBOptions-3.0.xml"/>
<Include file="Libs\AceTimer-3.0\AceTimer-3.0.xml"/>
<Include file="Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua"/>
<Include file="Libs\LibDBIcon-1.0\LibDBIcon-1.0\lib.xml"/>
</Ui>

0 comments on commit f5472dc

Please sign in to comment.