Mercurial > wow > inventory
view Modules/MinimapIcon.lua @ 240:24e71ed0a422
Added a default for when no addon was selected.
Scanner is now disabled when the item count addon returns an error code.
author | Zerotorescue |
---|---|
date | Sat, 12 Feb 2011 20:15:31 +0100 |
parents | 1959e2b3dfe1 |
children |
line wrap: on
line source
local addon = select(2, ...); local mod = addon:NewModule("MinimapIcon"); local icon; function mod:OnEnable() if addon.db.profile.defaults.minimapIcon then self:MakeIcon(); end end function mod:MakeIcon() icon = LibStub("LibDBIcon-1.0"); local ldb = LibStub("LibDataBroker-1.1"); local dataobject = ldb:GetDataObjectByName("Inventorium") or ldb:NewDataObject("Inventorium", { ["type"] = "launcher", ["label"] = "Inventorium", ["icon"] = [[Interface\Icons\INV_Misc_Bag_15]], ["OnClick"] = function(frame, button) if button == "RightButton" then -- Open up the config InventoriumCommandHandler("config"); elseif button == "LeftButton" then if IsControlKeyDown() then -- Queue InventoriumCommandHandler("queue"); else -- Open the summary InventoriumCommandHandler("summary"); end elseif button == "MiddleButton" then -- Check stock and provide the alert if needed InventoriumCommandHandler("alert"); end end, ["OnTooltipShow"] = function(tooltip) tooltip:AddLine("Inventorium"); tooltip:AddLine(" "); tooltip:AddLine("|cfffed000Left-click|r to open the summary window.", 0, 1, 0); tooltip:AddLine("|cfffed000Middle-click|r to generate a stock alert.", 0, 1, 0); tooltip:AddLine("|cfffed000Right-click|r to open the config window.", 0, 1, 0); tooltip:AddLine("|cfffed000Control left-click|r to try to queue tracked items.", 0, 1, 0); end, }); if icon and not icon:IsRegistered("Inventorium") then icon:Register("Inventorium", dataobject); end end function mod:ShowIcon() if not icon then self:MakeIcon(); else icon:Show("Inventorium"); end end function mod:HideIcon() if icon then icon:Hide("Inventorium"); end end