Skip to content

Commit 467e157

Browse files
committed
Show Monster Images on checkboxes in Spectre Library
1 parent b65084c commit 467e157

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

src/Modules/Build.lua

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,7 +1417,8 @@ function buildMode:OpenSpectreLibrary(library)
14171417
[7] = { field = "fireResist", asc = false },
14181418
[8] = { field = "coldResist", asc = false },
14191419
[9] = { field = "lightningResist", asc = false },
1420-
[10] = { field = "totalResist", asc = false },
1420+
[10] = { field = "chaosResist", asc = false },
1421+
[11] = { field = "totalResist", asc = false },
14211422
}
14221423
local sortModeIndex = controls.sortModeDropDown and controls.sortModeDropDown.selIndex or 1
14231424
local sortOption = sortFields[sortModeIndex]
@@ -1470,20 +1471,34 @@ function buildMode:OpenSpectreLibrary(library)
14701471
sortSourceList()
14711472
end
14721473
end
1473-
controls.sortMonsterCheckboxBeast = new("CheckBoxControl", {"TOPLEFT", controls.source, "BOTTOMLEFT"}, {0, 24, 26, 26}, "", monsterTypeCheckboxChange("Beast"), "Beast", true)
1474-
controls.sortMonsterCheckboxBeast.shown = library ~= "beast"
1475-
controls.sortMonsterCheckboxHumanoid = new("CheckBoxControl", {"TOPLEFT", controls.source, "BOTTOMLEFT"}, {37, 24, 26, 26}, "", monsterTypeCheckboxChange("Humanoid"), "Humanoid", true)
1476-
controls.sortMonsterCheckboxHumanoid.shown = library ~= "beast"
1477-
controls.sortMonsterCheckboxEldritch = new("CheckBoxControl", {"TOPLEFT", controls.source, "BOTTOMLEFT"}, {74, 24, 26, 26}, "", monsterTypeCheckboxChange("Eldritch"), "Eldritch", true)
1478-
controls.sortMonsterCheckboxEldritch.shown = library ~= "beast"
1479-
controls.sortMonsterCheckboxConstruct = new("CheckBoxControl", {"TOPLEFT", controls.source, "BOTTOMLEFT"}, {111, 24, 26, 26}, "", monsterTypeCheckboxChange("Construct"), "Construct", true)
1480-
controls.sortMonsterCheckboxConstruct.shown = library ~= "beast"
1481-
controls.sortMonsterCheckboxDemon = new("CheckBoxControl", {"TOPLEFT", controls.source, "BOTTOMLEFT"}, {148, 24, 26, 26}, "", monsterTypeCheckboxChange("Demon"), "Demon", true)
1482-
controls.sortMonsterCheckboxDemon.shown = library ~= "beast"
1483-
controls.sortMonsterCheckboxUndead = new("CheckBoxControl", {"TOPLEFT", controls.source, "BOTTOMLEFT"}, {185, 24, 26, 26}, "", monsterTypeCheckboxChange("Undead"), "Undead", true)
1484-
controls.sortMonsterCheckboxUndead.shown = library ~= "beast"
1474+
local function getMonsterTypeImages()
1475+
local tree = main:LoadTree(latestTreeVersion)
1476+
local images = {}
1477+
for name, value in pairs(monsterTypeSort) do
1478+
images[name] = tree:GetAssetByName(name)
1479+
end
1480+
return images
1481+
end
1482+
self.monsterImages = getMonsterTypeImages()
1483+
1484+
local monsterTypeCheckbox = {
1485+
{ name = "Beast", x = 0 },
1486+
{ name = "Humanoid", x = 37 },
1487+
{ name = "Eldritch", x = 74 },
1488+
{ name = "Construct", x = 111 },
1489+
{ name = "Demon", x = 148 },
1490+
{ name = "Undead", x = 185 },
1491+
}
1492+
for _, monster in ipairs(monsterTypeCheckbox) do
1493+
local controlName = "sortMonsterCheckbox" .. monster.name
1494+
local checkbox = new("CheckBoxControl", {"TOPLEFT", controls.source, "BOTTOMLEFT"}, {monster.x, 24, 26, 26}, "", monsterTypeCheckboxChange(monster.name), monster.name, true)
1495+
checkbox:SetCheckImage(self.monsterImages[monster.name])
1496+
checkbox.shown = library ~= "beast"
1497+
controls[controlName] = checkbox
1498+
end
1499+
14851500
controls.sortLabel = new("LabelControl", {"TOPLEFT",controls.source,"BOTTOMLEFT"}, {2, 2, 0, 16}, "Sort by:")
1486-
controls.sortModeDropDown = new("DropDownControl", {"TOPRIGHT",controls.source,"BOTTOMRIGHT"}, {0, 2, 155, 18}, { "Names", "Life", "Energy Shield", "Attack Speed", "Companion Reservation", "Spectre Reservation", "Fire Resistance", "Cold Resistance", "Lightning Resistance", "Total Resistance"}, function(index, value)
1501+
controls.sortModeDropDown = new("DropDownControl", {"TOPRIGHT",controls.source,"BOTTOMRIGHT"}, {0, 2, 155, 18}, { "Names", "Life", "Energy Shield", "Attack Speed", "Companion Reservation", "Spectre Reservation", "Fire Resistance", "Cold Resistance", "Lightning Resistance", "Chaos Resistance", "Total Resistance"}, function(index, value)
14871502
sortSourceList()
14881503
end)
14891504
controls.save = new("ButtonControl", nil, {-45, 390, 80, 20}, "Save", function()
@@ -1527,7 +1542,6 @@ function buildMode:OpenSpectreLibrary(library)
15271542
controls.source.OnSelect = function()
15281543
local selected = controls.source.selValue
15291544
local minion = self.data.minions[selected]
1530-
-- Get the gem level from the control, default to 20 if not set
15311545
local gemLevel = controls.minionGemLevel.buf
15321546
local baseLife = self.data.monsterAllyLifeTable[m_min(gemLevel * 2, 100)]
15331547
local totalLife = baseLife * minion.life

0 commit comments

Comments
 (0)