WoWInterface SVN PhanxMod

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 51 to Rev 52
    Reverse comparison

Rev 51 → Rev 52

trunk/Garrison.lua
38,6 → 38,8
 
local t = 0
local f = CreateFrame("Frame", "PhanxMod_Garrison", InterfaceOptionsFramePanelContainer)
f.name = "Phanx:Garrison"
InterfaceOptions_AddCategory(f)
 
f:RegisterEvent("PLAYER_LOGIN")
f:RegisterEvent("SHIPMENT_CRAFTER_OPENED")
63,13 → 65,12
end)
 
f:Hide()
f.name = "Phanx:Garrison"
f:SetScript("OnShow", function(self)
f:SetScript("OnShow", nil)
 
f.titleText = f:CreateFontString("$parentTitle", "ARTWORK", "GameFontNormalLarge")
f.titleText:SetPoint("TOPLEFT", 16, -16)
f.titleText:SetText("PhanxMod - Garrison)
f.titleText:SetText("PhanxMod - Garrison")
 
f.notesText = f:CreateFontString("$parentSubText", "ARTWORK", "GameFontHighlightSmall")
f.notesText:SetPoint("TOPLEFT", f.titleText, "BOTTOMLEFT", 0, -8)
83,25 → 84,35
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()