DopingControl v0.6.4
This commit is contained in:
+36
-13
@@ -19,6 +19,12 @@
|
||||
-- resolved via SuperWoW SpellInfo(id) (return 3 = icon) when the function
|
||||
-- exists. textures is OPTIONAL/partial by design -- every consumer
|
||||
-- nil-guards, nothing downstream may require it.
|
||||
-- Buff EFFECT lines: auras.effects[name] = the tooltip's line 2 text
|
||||
-- (same hidden-tooltip read as the name, TextLeft2) for every path-A buff
|
||||
-- that yielded both a name and a non-empty line 2. This feeds the item
|
||||
-- identification ladder for generic buff names ("Well Fed" -> which food,
|
||||
-- via DC.ResolveItem's discrim patterns). effects is OPTIONAL/partial
|
||||
-- exactly like textures -- every consumer nil-guards.
|
||||
-- Disagreements between the two ID sets are counted (symmetric difference,
|
||||
-- only when BOTH paths yielded at least one ID -- an absent path is missing
|
||||
-- data, not a disagreement) and accumulated by the engine into
|
||||
@@ -68,8 +74,9 @@ local A = DC_Aura
|
||||
|
||||
-- Assemble(rawA, rawB, idNames) -> auras, aurasRead, disagreements, unknown
|
||||
-- rawA : array of { name = string|nil, id = number|nil,
|
||||
-- texture = string|nil } (path A; texture is the 1st
|
||||
-- UnitBuff return, optional)
|
||||
-- texture = string|nil, effect = string|nil }
|
||||
-- (path A; texture is the 1st UnitBuff return,
|
||||
-- effect the tooltip's line 2 -- both optional)
|
||||
-- rawB : array of spell ids (numbers, path B)
|
||||
-- idNames : OPTIONAL { [spellId] = "Buff Name" } for path-B ids,
|
||||
-- filled by the WoW-side caller (SuperWoW SpellInfo lookup --
|
||||
@@ -78,9 +85,10 @@ local A = DC_Aura
|
||||
-- as before (no behavior change without it).
|
||||
-- Returns:
|
||||
-- auras : { names = { [name]=true }, ids = { [id]=true },
|
||||
-- textures = { [name]=iconPath } }
|
||||
-- (store shape; textures may be empty/partial --
|
||||
-- consumers nil-guard)
|
||||
-- textures = { [name]=iconPath },
|
||||
-- effects = { [name]=effectLine } }
|
||||
-- (store shape; textures AND effects may be empty/
|
||||
-- partial -- consumers nil-guard)
|
||||
-- aurasRead : bool -- true iff at least one USABLE aura arrived: a
|
||||
-- path-A entry carrying a name or an id, or a path-B id.
|
||||
-- Entries with NEITHER (UnitBuff texture present but the
|
||||
@@ -131,6 +139,7 @@ function A.Assemble(rawA, rawB, idNames)
|
||||
local idsA = {}
|
||||
local idsB = {}
|
||||
local textures = {} -- [buffName] = icon path
|
||||
local effects = {} -- [buffName] = tooltip effect line (line 2)
|
||||
local namedIds = {} -- ids that arrived WITH a name (path A rows)
|
||||
local usable = 0 -- entries that carry actual evidence (see header)
|
||||
|
||||
@@ -144,6 +153,9 @@ function A.Assemble(rawA, rawB, idNames)
|
||||
if e.texture then
|
||||
textures[e.name] = e.texture
|
||||
end
|
||||
if type(e.effect) == "string" and e.effect ~= "" then
|
||||
effects[e.name] = e.effect
|
||||
end
|
||||
end
|
||||
if type(e.id) == "number" and e.id > 0 then
|
||||
idsA[e.id] = true
|
||||
@@ -259,7 +271,8 @@ function A.Assemble(rawA, rawB, idNames)
|
||||
end
|
||||
end
|
||||
|
||||
return { names = names, ids = ids, textures = textures },
|
||||
return { names = names, ids = ids, textures = textures,
|
||||
effects = effects },
|
||||
aurasRead, disagreements, unknown
|
||||
end
|
||||
|
||||
@@ -376,15 +389,22 @@ function A.GetScanTip()
|
||||
return ensureTip()
|
||||
end
|
||||
|
||||
-- Returns name (tooltip line 1) AND effect (tooltip line 2 -- the buff's
|
||||
-- effect text, feeds the item identification ladder for generic names).
|
||||
-- raises an error on bad units -> always called through pcall
|
||||
local function tipBuffName(unit, buffIndex)
|
||||
scanTip:ClearLines()
|
||||
scanTip:SetUnitBuff(unit, buffIndex)
|
||||
local name, effect = nil, nil
|
||||
local textObj = getglobal("DopingControlScanTipTextLeft1")
|
||||
if textObj then
|
||||
return textObj:GetText()
|
||||
name = textObj:GetText()
|
||||
end
|
||||
return nil
|
||||
local effObj = getglobal("DopingControlScanTipTextLeft2")
|
||||
if effObj then
|
||||
effect = effObj:GetText()
|
||||
end
|
||||
return name, effect
|
||||
end
|
||||
|
||||
-- debuff twin of tipBuffName (same hidden tooltip, SetUnitDebuff);
|
||||
@@ -420,20 +440,23 @@ function A.ReadUnit(unit, guid)
|
||||
if not ok or not texture then
|
||||
break
|
||||
end
|
||||
local name = nil
|
||||
local name, effect = nil, nil
|
||||
if tip then
|
||||
local ok2, nm = pcall(tipBuffName, unit, i)
|
||||
local ok2, nm, eff = pcall(tipBuffName, unit, i)
|
||||
if ok2 then
|
||||
name = nm
|
||||
effect = eff
|
||||
end
|
||||
end
|
||||
local id = nil
|
||||
if type(auraID) == "number" and auraID > 0 then
|
||||
id = auraID
|
||||
end
|
||||
-- texture (UnitBuff return 1) rides along so Assemble can key
|
||||
-- it under the tooltip name (auras.textures)
|
||||
table.insert(rawA, { name = name, id = id, texture = texture })
|
||||
-- texture (UnitBuff return 1) and the tooltip effect line ride
|
||||
-- along so Assemble can key them under the tooltip name
|
||||
-- (auras.textures / auras.effects)
|
||||
table.insert(rawA, { name = name, id = id, texture = texture,
|
||||
effect = effect })
|
||||
end
|
||||
end
|
||||
if UnitDebuff then
|
||||
|
||||
Reference in New Issue
Block a user