local function boxOnClick(box) |
exclude[box.key] = box:GetChecked() |
end |
for _, data in next, C_Garrison.GetBuildings() do |
local key = BuildingFromPlotID[data.plotID] |
if key and not chex[key] then |
local _, name = C_Garrison.GetBuildingInfo(data.buildingID) |
local box = CreateFrame("CheckButton", "$parentToggle"..key, f, "InterfaceOptionsCheckButtonTemplate") |
box:SetHitRectInsets(0, -200, 0, 0) |
box:SetScript("OnClick", boxOnClick) |
box.Text:SetFormattedText(L_EXCLUDE, name) |
box.name = name |
box.key = key |
tinsert(chex, box) |
chex[key] = true |
for size = 1, 3 do |
local buildings = C_Garrison.GetBuildingsForSize(size) |
for i = 1, #buildings do |
local info = buildings[i] |
local name, plotID = info.name, info.plotID |
if not plotID then |
plotID = C_Garrison.GetBuildingInfo(info.buildingID) |
end |
local key = BuildingFromPlotID[plotID] |
if key and not chex[key] then |
local box = CreateFrame("CheckButton", "$parentExclude"..key, f, "InterfaceOptionsCheckButtonTemplate") |
box:SetHitRectInsets(0, -200, 0, 0) |
box:SetScript("OnClick", boxOnClick) |
box.Text:SetFormattedText(L_EXCLUDE, name) |
box.building = info.buildingID |
box.plot = plotID |
box.name = name |
box.key = key |
tinsert(chex, box) |
chex[key] = true |
end |
end |
end |
table.sort(chex, function(a, b) |
return a.name < b.name |
end) |
for i = 1, #chex do |
chex[i]:SetPoint("TOPLEFT", i > 1 and chex[i-1] or f.notes, "BOTTOMLEFT", i > 1 and 0 or -2, -8) |
print(i, chex[i].key, chex[i].name) |
chex[i]:SetPoint("TOPLEFT", i > 1 and chex[i-1] or f.notesText, "BOTTOMLEFT", i > 1 and 0 or -2, -8) |
end |
|
f.refresh = function() |