Fix Beast Lore ability coloring (color chips) and filter-row layout

This commit is contained in:
DuvelCorp
2026-10-02 21:46:11 +02:00
parent 60171b559e
commit af1a01ac2e
3 changed files with 14 additions and 31 deletions
-27
View File
@@ -24,33 +24,6 @@ function MTH_BOOK_GetBeastAbilitiesSummary(beast)
return tostring(beast.abilities)
end
-- Like the summary, but colours each ability green when the hunter already knows
-- that exact rank and red when it is still unlearned, to spot tameable upgrades.
function MTH_BOOK_GetBeastAbilitiesColored(beast)
if not beast or not beast.abilities or beast.abilities == "" or beast.abilities == "None" then
return "-"
end
local tokens = MTH_BOOK_SplitAbilities(beast.abilities)
if table.getn(tokens) == 0 then
return "-"
end
local canCheck = type(MTH_IsPetAbilityKnownByHunter) == "function"
local parts = {}
for i = 1, table.getn(tokens) do
local text = tostring(tokens[i])
if canCheck then
local _, label, rank = MTH_BOOK_ParseAbilityToken(tokens[i])
if MTH_IsPetAbilityKnownByHunter(label, rank) then
text = "|cff40ff40" .. text .. "|r"
else
text = "|cffff4040" .. text .. "|r"
end
end
table.insert(parts, text)
end
return table.concat(parts, ", ")
end
function MTH_BOOK_GetBeastZoneSummary(beast)
if not beast or not beast.coords or table.getn(beast.coords) == 0 then
return "-"
+11 -1
View File
@@ -4292,7 +4292,7 @@ local function MTH_BOOK_GetRowValues(entry)
if not beast then return { "", "", "", "", "", "", "", "", "", "" } end
local beastDisplayName = (MTH and MTH.GetLocalizedBeastName and MTH:GetLocalizedBeastName(entry, beast.name)) or beast.name
local traits = MTH_BOOK_ParseBeastTraits(beast)
local abilities = MTH_BOOK_GetBeastAbilitiesColored(beast)
local abilities = MTH_BOOK_GetBeastAbilitiesSummary(beast)
local zone = MTH_BOOK_GetBeastZoneSummary(beast)
return {
"|cFF33CCFF" .. tostring(entry) .. "|r",
@@ -4786,6 +4786,16 @@ MTH_BOOK_UpdateResults = function()
label = label .. ","
end
chip.text:SetText(label)
-- Colour by whether the hunter already knows this exact ability rank.
if MTH_BOOK_STATE.mode == "pets" and type(MTH_IsPetAbilityKnownByHunter) == "function" then
if MTH_IsPetAbilityKnownByHunter(ability.tooltipName or ability.name, ability.requestedRank) then
chip.text:SetTextColor(0.30, 1.00, 0.30)
else
chip.text:SetTextColor(1.00, 0.35, 0.35)
end
else
chip.text:SetTextColor(1, 1, 1)
end
local textWidth = chip.text:GetStringWidth() or 24
if textWidth < 16 then textWidth = 16 end
local chipWidth = ((MTH_BOOK_STATE.mode == "families") and 15 or 14) + textWidth
+3 -3
View File
@@ -291,18 +291,18 @@
</Frame>
<Frame name="$parentKnownFilterDropdown" inherits="UIDropDownMenuTemplate" hidden="true">
<Anchors>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="505" y="-108"/></Offset></Anchor>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="520" y="-108"/></Offset></Anchor>
</Anchors>
</Frame>
<CheckButton name="$parentPetInZoneOnly" inherits="UICheckButtonTemplate" hidden="true">
<Anchors>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="700" y="-106"/></Offset></Anchor>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="618" y="-82"/></Offset></Anchor>
</Anchors>
</CheckButton>
<Button name="$parentShowAllOnMapButton" inherits="UIPanelButtonTemplate" text="Show all on map" hidden="true">
<Size><AbsDimension x="122" y="20"/></Size>
<Anchors>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="740" y="-136"/></Offset></Anchor>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="700" y="-110"/></Offset></Anchor>
</Anchors>
</Button>
<Frame name="$parentNPCFunctionDropdown" inherits="UIDropDownMenuTemplate" hidden="true">