diff --git a/api/hunterbook-tab-beastlore.lua b/api/hunterbook-tab-beastlore.lua index b682392..3a1f54a 100644 --- a/api/hunterbook-tab-beastlore.lua +++ b/api/hunterbook-tab-beastlore.lua @@ -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 "-" diff --git a/api/hunterbook.lua b/api/hunterbook.lua index ec98403..ee8d709 100644 --- a/api/hunterbook.lua +++ b/api/hunterbook.lua @@ -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 diff --git a/api/hunterbook.xml b/api/hunterbook.xml index 4865778..039d73e 100644 --- a/api/hunterbook.xml +++ b/api/hunterbook.xml @@ -291,18 +291,18 @@ - +