From b7fdf68d2d3b5d73fa4495c38b6db3d7f86ea61e Mon Sep 17 00:00:00 2001 From: FoxCD <52389560+FoxCD@users.noreply.github.com> Date: Sun, 23 Mar 2025 10:35:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=AC=A1=E5=A4=A9=E8=B5=8B?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 3.4.4测试通过 --- InspectUnitSpecialization.lua | 42 ++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/InspectUnitSpecialization.lua b/InspectUnitSpecialization.lua index 54a0f7e..c92a186 100644 --- a/InspectUnitSpecialization.lua +++ b/InspectUnitSpecialization.lua @@ -1,4 +1,3 @@ - --------------------------------------- -- 顯示職業圖標和天赋 -- @Author: M @@ -10,11 +9,19 @@ local LibEvent = LibStub:GetLibrary("LibEvent.7000") local cache = {} -local function GetInspectTalentInfo(unit) +local function GetInspectTalentInfo(unit, isActiveTalent) if (not GetTalentTabInfo) then return end local isInspect = (unit ~= "player") local talentGroup = GetActiveTalentGroup(isInspect) + if not isActiveTalent then + if talentGroup == 1 then + talentGroup = 2 + elseif talentGroup == 2 then + talentGroup = 1 + end + end + local index local higher = 0 for i = 1, 3 do @@ -56,17 +63,40 @@ hooksecurefunc("ShowInspectItemListFrame", function(unit, parent, itemLevel, max --frame.spectext:SetAlpha(0.9) end - local index, talentCache = GetInspectTalentInfo(unit) + local index, talentCache = GetInspectTalentInfo(unit, true) local specIcon = index and talentCache[index].icon - frame.spectext:SetText(index and format("|CFFFFD200%s|r\n\n%s/%s/%s", talentCache[index].name, talentCache[1].point, talentCache[2].point, talentCache[3].point) or format("%s/%s/%s", 0, 0, 0)) - frame.specicon:SetShown(not not specIcon) - frame.classicon:SetShown(not specIcon) if specIcon then + frame.spectext:SetText(index and format("|CFFFFD200%s|r\n\n%s/%s/%s", talentCache[index].name, talentCache[1].point, talentCache[2].point, talentCache[3].point) or format("%s/%s/%s", 0, 0, 0)) + frame.specicon:SetShown(not not specIcon) + frame.classicon:SetShown(not specIcon) frame.specicon:SetTexture(specIcon) else local class = select(2, UnitClass(unit)) local x1, x2, y1, y2 = unpack(CLASS_ICON_TCOORDS[strupper(class)]) frame.classicon:SetTexCoord(x1, x2, y1, y2) end + + + if (not frame.subspecicon) then + frame.subspecicon = frame:CreateTexture(nil, "BORDER") + frame.subspecicon:SetSize(21, 21) + frame.subspecicon:SetPoint("TOPRIGHT", -72, -21) + frame.subspecicon:SetAlpha(0.5) + frame.subspecicon:SetMask("Interface\\Minimap\\UI-Minimap-Background") + + frame.subspectext = frame:CreateFontString(nil, "BORDER") + frame.subspectext:SetFont(UNIT_NAME_FONT, 10, "THINOUTLINE") + frame.subspectext:SetPoint("BOTTOM", frame.subspecicon, "BOTTOM", 0, -7) + frame.subspectext:SetJustifyH("CENTER") + end + + local index, talentCache = GetInspectTalentInfo(unit, false) + local specIcon = index and talentCache[index].icon + --如果有次天赋,显示次天赋名称和图标 + if specIcon then + frame.subspectext:SetText(format("|CFF1EFF00次:%s|r", talentCache[index].name)) + frame.subspecicon:SetShown(specIcon) + frame.subspecicon:SetTexture(specIcon) + end end)