local ADDON = ...
local playerName = UnitName("player")
local string_format = string.format
local tooltip
local TYPE70 = LE_GARRISON_TYPE_7_0
local TYPE60 = LE_GARRISON_TYPE_6_0
local FOLTYPE70 = LE_FOLLOWER_TYPE_GARRISON_7_0
local FOLTYPE60 = LE_FOLLOWER_TYPE_GARRISON_6_0
local FOLTYPE62 = LE_FOLLOWER_TYPE_SHIPYARD_6_2
local GetAvailableMissions = C_Garrison.GetAvailableMissions
local GetInProgressMissions = C_Garrison.GetInProgressMissions
local GetCompleteMissions = C_Garrison.GetCompleteMissions
local LEGION = {
avl = 0,
pro = 0,
fin = 0,
}
local DRAENOR = {
avl = 0,
pro = 0,
fin = 0,
}
local SHIP = {
avl = 0,
pro = 0,
fin = 0,
}
local frame = CreateFrame("Frame")
frame:SetScript("OnEvent", function(self, event, arg1)
if event == "ADDON_LOADED" and arg1 == "Blizzard_OrderHallUI" then
OrderHallCommandBar:Hide()
OrderHallCommandBar.Show = function() return end
GarrisonLandingPageTutorialBox:SetClampedToScreen(true)
self:UnregisterEvent("ADDON_LOADED")
end
if C_Garrison.GetGarrisonInfo(TYPE70) then
LEGION["avl"] = #GetAvailableMissions(FOLTYPE70)
LEGION["pro"] = #GetInProgressMissions(FOLTYPE70)
LEGION["fin"] = #GetCompleteMissions(FOLTYPE70)
end
if C_Garrison.GetGarrisonInfo(TYPE60) then
DRAENOR["avl"] = #GetAvailableMissions(FOLTYPE60)
DRAENOR["pro"] = #GetInProgressMissions(FOLTYPE60)
DRAENOR["fin"] = #GetCompleteMissions(FOLTYPE60)
if C_Garrison.HasShipyard() then
SHIP["avl"] = #GetAvailableMissions(FOLTYPE62)
SHIP["pro"] = #GetInProgressMissions(FOLTYPE62)
SHIP["fin"] = #GetCompleteMissions(FOLTYPE62)
end
end
end)
frame:RegisterEvent("ADDON_LOADED")
frame:RegisterEvent("GARRISON_UPDATE")
frame:RegisterEvent("GARRISON_MISSION_LIST_UPDATE")
frame:RegisterEvent("GARRISON_MISSION_FINISHED")
local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local dataobj = ldb:NewDataObject(ADDON, {
type = "data source",
icon = "Interface\\Addons\\"..ADDON.."\\icon.tga",
text = "Hall"
})
dataobj.OnClick = function(self, button)
if InCombatLockdown() then
return
end
if button == "LeftButton" then
if C_Garrison.GetGarrisonInfo(TYPE70) then
if (GarrisonLandingPage and GarrisonLandingPage:IsShown()) then
HideUIPanel(GarrisonLandingPage);
else
ShowGarrisonLandingPage(TYPE70);
end
end
elseif button == "RightButton" then
if C_Garrison.GetGarrisonInfo(TYPE60) then
if (GarrisonLandingPage and GarrisonLandingPage:IsShown()) then
HideUIPanel(GarrisonLandingPage);
else
ShowGarrisonLandingPage(TYPE60);
end
end
elseif button == "MiddleButton" then
end
end
function dataobj.OnTooltipShow(tooltip)
tooltip:AddLine(ADDON)
tooltip:AddLine(" ")
tooltip:AddLine("Missions",1,1,1,1)
if C_Garrison.GetGarrisonInfo(TYPE70) then
tooltip:AddDoubleLine("Legion Order Hall",
string_format("|cFFFFFFFF%d|r", LEGION["avl"]) .. " " ..
string_format("|cFFFFFF00%d|r", LEGION["pro"] - LEGION["fin"]) .. " " ..
string_format("|cFF00803F%d|r", LEGION["fin"])
)
end
if C_Garrison.GetGarrisonInfo(TYPE60) then
tooltip:AddDoubleLine("Draenor Garrison",
string_format("|cFFFFFFFF%d|r", DRAENOR["avl"]) .. " " ..
string_format("|cFFFFFF00%d|r", DRAENOR["pro"] - DRAENOR["fin"]) .. " " ..
string_format("|cFF00803F%d|r", DRAENOR["fin"])
)
if C_Garrison.HasShipyard() then
tooltip:AddDoubleLine("Draenor Shipyard",
string_format("|cFFFFFFFF%d|r", SHIP["avl"]) .. " " ..
string_format("|cFFFFFF00%d|r", SHIP["pro"] - SHIP["fin"]) .. " " ..
string_format("|cFF00803F%d|r", SHIP["fin"])
)
end
else
tooltip:AddLine("No Hall or Garrison yet",1,1,0,0)
end
tooltip:AddLine(" ")
tooltip:AddDoubleLine("Left Click", "Class Hall")
tooltip:AddDoubleLine("Right Click", "Garrison")
end