Skip to content

Commit

Permalink
Lib/LibRangeCheck: remove bad items, add Range # harmful spells
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew6180 committed Sep 7, 2023
1 parent f8b349d commit ebf71cb
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions WeakAuras/Libs/LibRangeCheck-2.0/LibRangeCheck-2.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,6 @@ local FriendItems = {
32825, -- Soul Cannon
37887, -- Seeds of Nature's Wrath
},
[80] = {
35278, -- Reinforced Net
},
}

local HarmItems = {
Expand Down Expand Up @@ -301,19 +298,26 @@ local HarmItems = {
32825, -- Soul Cannon
37887, -- Seeds of Nature's Wrath
},
[80] = {
35278, -- Reinforced Net
},
}

local _, class = UnitClass("player")
if not FriendSpells[class] then
FriendSpells[class] = {}
end
-- This could've been done by checking player race as well and creating tables for those, but it's easier like this
for k, v in pairs(FriendSpells) do
tinsert(v, 28880) -- ["Gift of the Naaru"]
end

if not HarmSpells[class] then
HarmSpells[class] = {}
end
for k, v in pairs(HarmSpells) do
tinsert(v, 28734) -- ["Mana Tap"]
for range = 12, 60 do
local sid = 200100 + range
tinsert(v, sid)
end
end

-- >> END OF STATIC CONFIG

-- cache
Expand Down Expand Up @@ -491,9 +495,10 @@ local function createCheckerList(spellList, itemList, interactList)
if GetItemInfoInstant(items[i]) then
local itemObj = Item:CreateFromID(items[1])
itemObj:ContinueOnLoad(function(itemID)
addChecker(res, range, nil, checkers_Item[itemID])
if GetItemInfo(items[i]) then
addChecker(res, range, nil, checkers_Item[itemID])
end
end)
break
end
end
end
Expand All @@ -510,7 +515,7 @@ end

-- returns minRange, maxRange or nil
local function getRange(unit, checkerList)
local min, max = 0, nil
local min, max = 1, nil
for i = 1, #checkerList do
local rc = checkerList[i]
if not max or max > rc.range then
Expand All @@ -529,6 +534,8 @@ local function getRange(unit, checkerList)
max = rc.range
elseif min > rc.range then
return min, max
else
return rc.range, max
end
end
end
Expand Down

0 comments on commit ebf71cb

Please sign in to comment.