From d7a7387465038d3f1b6e3e411ed73fd0f1bdc3a5 Mon Sep 17 00:00:00 2001 From: gwetchen Date: Fri, 16 Feb 2024 09:29:00 +0100 Subject: [PATCH] librange: skip rangescan when player has combo points don't perform range checks while the player has combo points to avoid losing them --- libs/librange.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libs/librange.lua b/libs/librange.lua index a8b9d2cd..3e60f5b0 100644 --- a/libs/librange.lua +++ b/libs/librange.lua @@ -105,6 +105,15 @@ wand:SetScript("OnEvent", function() PlayerFrame.wandCombat = event == "START_AUTOREPEAT_SPELL" and true or nil end) +--Players with combo points aren't necessarily auto attacking, meaning we can't use inCombat. +--This allows us to avoid rangechecking when the player has combo points to avoid losing them. +local hascombopoints +local combo = CreateFrame("Frame", "pfComboPointsDetect") +combo:RegisterEvent("PLAYER_COMBO_POINTS") +combo:SetScript("OnEvent", function() + hascombopoints = GetComboPoints() > 0 +end) + librange:Hide() librange:RegisterEvent("ACTIONBAR_SLOT_CHANGED") librange:RegisterEvent("PLAYER_ENTERING_WORLD") @@ -157,6 +166,7 @@ librange:SetScript("OnUpdate", function() if TradeFrame and TradeFrame:IsShown() then return nil end if PlayerFrame and PlayerFrame.inCombat then return nil end if PlayerFrame and PlayerFrame.wandCombat then return nil end + if hascombopoints then return nil end _G.PlaySound = SoundOff pfScanActive = true