mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Resolve item sets via ClassicAPI; drop Reliquary dependency
Item-set membership and set info now read ItemSet.dbc directly through ClassicAPI instead of the nampower/Reliquary glue, so set features no longer require the Reliquary DLL to be installed. - ClassicAPI.lua: add GetItemSetIDByID and GetItemSetInfo wrappers. - Utility.lua: repoint ResolveSetItems, CountEquippedSetItemsBySetId, GetEquippedItemSetInfo, and GetEquippedSetPieceCount at the ClassicAPI accessors. Set-name matching now uses the DBC name (localized; identical to the old enUS path on English clients). - NampowerAPI.lua: remove the now-unused GetItemSet/GetItemSetId/ GetItemSetItems/GetItemSetBonuses, the dead GetSpellEffectRadius (no callers, only radius source was Reliquary), and the orphaned RQ_SafeCall. - Init.lua: drop hasReliquary detection and its startup feature line. - Conditionals.lua: update the [set:] comment (no longer Reliquary-gated).
This commit is contained in:
-112
@@ -3531,117 +3531,5 @@ function API.GetUnitMaxPower(unitToken, powerType)
|
||||
return UnitManaMax(unitToken)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- RELIQUARY DBC FUNCTIONS (optional DLL)
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- Safe Reliquary call wrapper — returns nil on missing DLL or lookup failure
|
||||
local function RQ_SafeCall(func, ...)
|
||||
if not func then return nil end
|
||||
local ok, result = pcall(func, unpack(arg))
|
||||
if ok then return result end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Get item set data from DBC by set ID
|
||||
-- Returns: { name, itemId_1..17, setSpellId_1..8, setThreshold_1..8 } or nil
|
||||
function API.GetItemSet(setId)
|
||||
if not setId or not _G.RQ_GetItemSet then return nil end
|
||||
return RQ_SafeCall(_G.RQ_GetItemSet, setId)
|
||||
end
|
||||
|
||||
-- Get the set ID for an item (via Nampower's GetItemStatsField)
|
||||
-- Returns: setId (number) or nil if item has no set
|
||||
function API.GetItemSetId(itemId)
|
||||
if not itemId then return nil end
|
||||
local setId = API.GetItemField(itemId, "itemSet")
|
||||
if setId and setId ~= 0 then return setId end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Get all item IDs belonging to a set (from Reliquary DBC)
|
||||
-- Returns: { itemId1, itemId2, ... } or nil
|
||||
function API.GetItemSetItems(setId)
|
||||
local setData = API.GetItemSet(setId)
|
||||
if not setData then return nil end
|
||||
|
||||
local items = {}
|
||||
for i = 1, 17 do
|
||||
local id = setData["itemId_" .. i]
|
||||
if id then
|
||||
id = tonumber(id)
|
||||
if id and id ~= 0 then
|
||||
table.insert(items, id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if table.getn(items) > 0 then return items end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Get set bonus spell/threshold pairs from DBC
|
||||
-- Returns: { { spellId = N, threshold = N }, ... } or nil
|
||||
function API.GetItemSetBonuses(setId)
|
||||
local setData = API.GetItemSet(setId)
|
||||
if not setData then return nil end
|
||||
|
||||
local bonuses = {}
|
||||
for i = 1, 8 do
|
||||
local spellId = setData["setSpellId_" .. i]
|
||||
local threshold = setData["setThreshold_" .. i]
|
||||
if spellId and threshold then
|
||||
spellId = tonumber(spellId)
|
||||
threshold = tonumber(threshold)
|
||||
if spellId and spellId ~= 0 and threshold and threshold > 0 then
|
||||
table.insert(bonuses, { spellId = spellId, threshold = threshold })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if table.getn(bonuses) > 0 then return bonuses end
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Get spell effect radius in yards from DBC
|
||||
-- spellId: the spell to look up
|
||||
-- effectIndex: 1, 2, or 3 (which effect slot, default 1)
|
||||
-- Returns: radius (number) or nil
|
||||
function API.GetSpellEffectRadius(spellId, effectIndex)
|
||||
effectIndex = effectIndex or 1
|
||||
if not spellId then return nil end
|
||||
|
||||
-- Get the radius index from the spell's effect via Nampower
|
||||
local radiusField = "effectRadiusIndex"
|
||||
local rec = API.GetSpellRecord(spellId)
|
||||
if not rec then return nil end
|
||||
|
||||
-- effectRadiusIndex is an array field — access by effect index
|
||||
local radiusIndex = nil
|
||||
if rec.effectRadiusIndex then
|
||||
if type(rec.effectRadiusIndex) == "table" then
|
||||
radiusIndex = rec.effectRadiusIndex[effectIndex]
|
||||
else
|
||||
-- Single value (effect 1 only)
|
||||
if effectIndex == 1 then
|
||||
radiusIndex = rec.effectRadiusIndex
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if not radiusIndex or radiusIndex == 0 then return nil end
|
||||
|
||||
-- Try Reliquary for the SpellRadius DBC lookup
|
||||
if _G.RQ_GetSpellRadius then
|
||||
local radiusData = RQ_SafeCall(_G.RQ_GetSpellRadius, radiusIndex)
|
||||
if radiusData and radiusData.radius then
|
||||
local radius = tonumber(radiusData.radius)
|
||||
if radius and radius > 0 then return radius end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
-- Expose API globally for other addons
|
||||
_G.CleveRoidsNampowerAPI = API
|
||||
|
||||
Reference in New Issue
Block a user