/
## Name: Broker_GarrisonReport |
## Notes: An LDB plugin to replace the Garrison Report button on your minimap. |
## Author: Seerah |
## Version: 1.0.2 |
## Version: 1.0.3 |
LibStub\LibStub.lua |
CallBackHandler-1.0\CallbackHandler-1.0.xml |
local strformat = string.format |
local strgsub = string.gsub |
local tinsert = table.insert |
local garType = C_Garrison.GetLandingPageGarrisonType() --new API as of 7.0 - required for some functions now |
local hasGarrison = C_Garrison.GetGarrisonInfo(garType) |
local NEW_IN_PROGRESS = "%d "..strgsub(GARRISON_LANDING_IN_PROGRESS, " %- %%d", "") |
local NEW_AVAILABLE = "%d "..strgsub(GARRISON_LANDING_AVAILABLE, " %- %%d", "") |
local NEW_WORK_COMPLETE = " "..CAPACITANCE_WORK_COMPLETE_TOOLTIP_TITLE |
local workOrderBuildings = {} |
local missionData = {} |
local underConstruction = {} |
local _ |
local _, garType, hasGarrison |
local GR = LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("Broker_GarrisonReport", { |
type = "data source", |
GarrisonLandingPageMinimapButton:Hide() |
hooksecurefunc(GarrisonLandingPageMinimapButton, "Show", GarrisonLandingPageMinimapButton.Hide) |
elseif event == "GARRISON_UPDATE" then |
if not garType then --new API as of 7.0 - required for some functions now |
garType = C_Garrison.GetLandingPageGarrisonType() |
C_Garrison.GetGarrisonInfo(garType) |
end |
hasGarrison = C_Garrison.GetGarrisonInfo(garType) |
GetMissions() |
ScanBuildings() |
elseif event == "GARRISON_MISSION_FINISHED" or event == "GARRISON_MISSION_LIST_UPDATE" or event == "GARRISON_MISSION_NPC_OPENED" then |
GetMissions() |
else |
ScanBuildings() |
if garType then |
ScanBuildings() |
end |
end |
end) |