Skip to content

Commit ff91849

Browse files
committed
Preparation for popular spectre list, and some small fixes
1 parent a754b7a commit ff91849

File tree

3 files changed

+30
-23
lines changed

3 files changed

+30
-23
lines changed

src/Classes/MinionListControl.lua

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,27 @@ local t_remove = table.remove
99
local s_format = string.format
1010
local m_max = math.max
1111

12-
local MinionListClass = newClass("MinionListControl", "ListControl", function(self, anchor, rect, data, list, dest)
12+
local MinionListClass = newClass("MinionListControl", "ListControl", function(self, anchor, rect, data, list, dest, label)
1313
self.ListControl(anchor, rect, 16, "VERTICAL", not dest, list)
1414
self.data = data
1515
self.dest = dest
1616
if dest then
17-
self.dragTargetList = { dest }
18-
self.label = "^7Available Spectres:"
19-
self.controls.add = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, {0, -2, 60, 18}, "Add", function()
20-
self:AddSel()
21-
end)
22-
self.controls.add.enabled = function()
23-
return self.selValue ~= nil and not isValueInArray(dest.list, self.selValue)
24-
end
17+
self.dragTargetList = { dest }
18+
self.label = label or "^7Available Spectres:"
19+
self.controls.add = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, {0, -2, 60, 18}, "Add", function()
20+
self:AddSel()
21+
end)
22+
self.controls.add.enabled = function()
23+
return self.selValue ~= nil and not isValueInArray(dest.list, self.selValue)
24+
end
2525
else
26-
self.label = "^7Spectres in Build:"
27-
self.controls.delete = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, {0, -2, 60, 18}, "Remove", function()
28-
self:OnSelDelete(self.selIndex, self.selValue)
29-
end)
30-
self.controls.delete.enabled = function()
31-
return self.selValue ~= nil
32-
end
26+
self.label = label or "^7Spectres in Build:"
27+
self.controls.delete = new("ButtonControl", {"BOTTOMRIGHT",self,"TOPRIGHT"}, {0, -2, 60, 18}, "Remove", function()
28+
self:OnSelDelete(self.selIndex, self.selValue)
29+
end)
30+
self.controls.delete.enabled = function()
31+
return self.selValue ~= nil
32+
end
3333
end
3434
end)
3535

src/Classes/MinionSearchListControl.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ local t_insert = table.insert
88
local t_remove = table.remove
99
local s_format = string.format
1010

11-
local MinionSearchListClass = newClass("MinionSearchListControl", "MinionListControl", function(self, anchor, rect, data, list, dest)
12-
self.MinionListControl(anchor, rect, data, list, dest)
11+
local MinionSearchListClass = newClass("MinionSearchListControl", "MinionListControl", function(self, anchor, rect, data, list, dest, label)
12+
self.MinionListControl(anchor, rect, data, list, dest, label)
1313
self.unfilteredList = copyTable(list)
1414
self.isMutable = false
1515

src/Modules/Build.lua

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,10 +1341,15 @@ end
13411341
-- Open the spectre library popup
13421342
function buildMode:OpenSpectreLibrary(library)
13431343
local destList = { }
1344+
local popularBeastList = { }
1345+
local popularSpectreList = { }
1346+
local popularList = { }
13441347
if library == "beast" then
13451348
destList = copyTable(self.beastList)
1349+
popularList = popularBeastList
13461350
else
13471351
destList = copyTable(self.spectreList)
1352+
popularList = popularSpectreList
13481353
end
13491354
local monsterTypeSort = {
13501355
Beast = true,
@@ -1460,8 +1465,10 @@ function buildMode:OpenSpectreLibrary(library)
14601465
end
14611466

14621467
sortSourceList()
1463-
controls.list = new("MinionListControl", nil, {-230, 40, 210, 250}, self.data, destList)
1464-
controls.source = new("MinionSearchListControl", nil, {0, 60, 210, 230}, self.data, sourceList, controls.list)
1468+
local label = (library == "beast" and "Beasts" or "Spectres")
1469+
controls.list = new("MinionListControl", nil, {-230, 40, 210, 175}, self.data, destList, nil, label.." in Build:")
1470+
controls.popularList = new("MinionListControl", {"TOP",controls.list,"BOTTOM"}, {0, 25, 210, 175}, self.data, popularList, nil,"^7Popular "..label..":")
1471+
controls.source = new("MinionSearchListControl", nil, {0, 60, 210, 230}, self.data, sourceList, controls.list, "^7Available "..label..":")
14651472
local function monsterTypeCheckboxChange(name)
14661473
monsterTypeSort[name] = true
14671474
return function(state)
@@ -1644,10 +1651,10 @@ function buildMode:OpenSpectreLibrary(library)
16441651
end
16451652
end
16461653
controls.minionNameLabel = new("LabelControl", {"TOP",controls.source,"TOPRIGHT"}, {130, -25, 0, 18}, minion.name)
1647-
controls.lifeLabelNum = new("LabelControl", {"TOP",controls.lifeLabel,"BOTTOM"}, {0, 6, 0, 16}, round(totalLife))
1648-
controls.energyshieldLabelNum = new("LabelControl", {"TOP",controls.energyshieldLabel,"BOTTOM"}, {0, 6, 0, 16}, (totalES))
1654+
controls.lifeLabelNum = new("LabelControl", {"TOP",controls.lifeLabel,"BOTTOM"}, {0, 6, 0, 16}, "^7"..round(totalLife))
1655+
controls.energyshieldLabelNum = new("LabelControl", {"TOP",controls.energyshieldLabel,"BOTTOM"}, {0, 6, 0, 16}, round(totalES))
16491656
controls.blockLabelNum = new("LabelControl", {"TOP",controls.blockLabel,"BOTTOM"}, {6, 6, 0, 16}, blockChance.."%")
1650-
controls.armourLabelNum = new("LabelControl", {"TOP",controls.armourLabel,"BOTTOM"}, {0, 6, 0, 16}, (totalArmour))
1657+
controls.armourLabelNum = new("LabelControl", {"TOP",controls.armourLabel,"BOTTOM"}, {0, 6, 0, 16}, round(totalArmour))
16511658
controls.evasionLabelNum = new("LabelControl", {"TOP",controls.evasionLabel,"BOTTOM"}, {0, 6, 0, 16}, round(totalEvasion))
16521659
controls.resistsLabelNum = new("LabelControl", {"TOP",controls.resistsLabel,"BOTTOM"}, {0, 6, 0, 16},
16531660
colorCodes.FIRE..minion.fireResist.."^7/"..

0 commit comments

Comments
 (0)