Skip to content

Commit

Permalink
Apply CombatLockDown restrictions only on Retail
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbuds authored and Stanzilla committed Nov 17, 2023
1 parent 6283a86 commit ea6a31c
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions LibRangeCheck-3.0/LibRangeCheck-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ end
local isRetail = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
local isWrath = WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC

local InCombatLockdownRestriction
if isRetail then
InCombatLockdownRestriction = InCombatLockdown
else
InCombatLockdownRestriction = function() return false end
end

local _G = _G
local next = next
local sort = sort
Expand Down Expand Up @@ -555,7 +562,7 @@ end
local checkers_Item = setmetatable({}, {
__index = function(t, item)
local func = function(unit)
if InCombatLockdown() then
if InCombatLockdownRestriction() then
return nil
else
return IsItemInRange(item, unit) or nil
Expand All @@ -568,7 +575,7 @@ local checkers_Item = setmetatable({}, {
local checkers_Interact = setmetatable({}, {
__index = function(t, index)
local func = function(unit)
if InCombatLockdown() then
if InCombatLockdownRestriction() then
return nil
else
return CheckInteractDistance(unit, index) and true or false
Expand Down Expand Up @@ -750,20 +757,20 @@ local function getRange(unit, noItems)
local canAssist = UnitCanAssist("player", unit)
if UnitIsDeadOrGhost(unit) then
if canAssist then
return getRangeWithCheckerList(unit, InCombatLockdown() and lib.resRCInCombat or lib.resRC)
return getRangeWithCheckerList(unit, InCombatLockdownRestriction() and lib.resRCInCombat or lib.resRC)
else
return getRangeWithCheckerList(unit, InCombatLockdown() and lib.miscRCInCombat or lib.miscRC)
return getRangeWithCheckerList(unit, InCombatLockdownRestriction() and lib.miscRCInCombat or lib.miscRC)
end
end

if UnitCanAttack("player", unit) then
if InCombatLockdown() then
if InCombatLockdownRestriction() then
return getRangeWithCheckerList(unit, noItems and lib.harmNoItemsRCInCombat or lib.harmRCInCombat)
else
return getRangeWithCheckerList(unit, noItems and lib.harmNoItemsRC or lib.harmRC)
end
elseif UnitIsUnit("pet", unit) then
if InCombatLockdown() then
if InCombatLockdownRestriction() then
local minRange, maxRange = getRangeWithCheckerList(unit, noItems and lib.friendNoItemsRCInCombat or lib.friendRCInCombat)
if minRange or maxRange then
return minRange, maxRange
Expand All @@ -779,13 +786,13 @@ local function getRange(unit, noItems)
end
end
elseif canAssist then
if InCombatLockdown() then
if InCombatLockdownRestriction() then
return getRangeWithCheckerList(unit, noItems and lib.friendNoItemsRCInCombat or lib.friendRCInCombat)
else
return getRangeWithCheckerList(unit, noItems and lib.friendNoItemsRC or lib.friendRC)
end
else
return getRangeWithCheckerList(unit, InCombatLockdown() and lib.miscRC or lib.miscRCInCombat)
return getRangeWithCheckerList(unit, InCombatLockdownRestriction() and lib.miscRC or lib.miscRCInCombat)
end
end

Expand Down Expand Up @@ -1594,7 +1601,7 @@ function lib:updateMeasurements()
self.lastMeasurements[key] = curr
end
end
if not InCombatLockdown() then
if not InCombatLockdownRestriction() then
for i, v in pairs(DefaultInteractList) do
local key = "interact: " .. i
local last = self.lastMeasurements[key]
Expand Down

0 comments on commit ea6a31c

Please sign in to comment.