From 9e755a3cd2c27eee62b7b2c2e9b8ca68c29d008d Mon Sep 17 00:00:00 2001 From: Sattva <74269253+Sattva-108@users.noreply.github.com> Date: Tue, 31 Dec 2024 23:05:28 +0300 Subject: [PATCH] Minimap - Show Who Pinged - fix Adjusted position, fixed hiding frame --- Leatrix_Plus.lua | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Leatrix_Plus.lua b/Leatrix_Plus.lua index 4e87d73..8aa9278 100644 --- a/Leatrix_Plus.lua +++ b/Leatrix_Plus.lua @@ -4758,9 +4758,9 @@ function LeaPlusLC:Player() -- Set position if LeaPlusLC["SquareMinimap"] == "On" then - pFrame:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", 0, -3) + pFrame:SetPoint("BOTTOMLEFT", Minimap, "BOTTOMLEFT", 0, -3) -- Move to the left else - pFrame:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, 2) + pFrame:SetPoint("BOTTOM", Minimap, "BOTTOM", -50, 2) -- Slightly offset to the left end -- Set backdrop @@ -4786,37 +4786,34 @@ function LeaPlusLC:Player() local lastUnit, lastX, lastY = "player", 0, 0 -- Show who pinged - pFrame:SetScript("OnEvent", function(void, void, unit, x, y) - - -- Do nothing if unit has not changed - if UnitIsUnit(unit, "player") or UnitIsUnit(unit, lastUnit) and x == lastX and y == lastY then + pFrame:SetScript("OnEvent", function(_, _, unit, x, y) + -- Ignore if the ping is from the player or the same unit at the same location + if UnitIsUnit(unit, "player") or (UnitIsUnit(unit, lastUnit) and x == lastX and y == lastY) then return end - -- if UnitIsUnit(unit, lastUnit) and x == lastX and y == lastY then print("end") return end lastUnit, lastX, lastY = unit, x, y -- Show name in class color - local void, class = UnitClass(unit) + local _, class = UnitClass(unit) if class then local color = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class] if color then - -- Set frame details pFrame.f:SetFormattedText("|cff%02x%02x%02x%s|r", color.r * 255, color.g * 255, color.b * 255, UnitName(unit)) pFrame:SetSize(pFrame.f:GetStringWidth() + 12, 20) - -- Hide frame after 5 seconds + -- Show frame pFrame:Show() - pingTime = GetTime() - LibCompat.After(5, function() - if GetTime() - pingTime >= 5 then + + -- Hide frame after 3 second + LibCompat.After(3, function() + -- Only hide if the last ping matches the current state + if UnitIsUnit(unit, lastUnit) and x == lastX and y == lastY then pFrame:Hide() end end) - end end - end) -- Set event when option is clicked and on startup