Release 4.6.2: native smoothing, split history, pet attribution and UI recolor
This commit is contained in:
+14
-11
@@ -77,20 +77,21 @@ end
|
||||
-- every hit. Entries expire so group changes are picked up.
|
||||
local cache, cache_size, cache_trackall = {}, 0, nil
|
||||
|
||||
local function CacheGet(guid)
|
||||
local function CacheGet(guid, flags)
|
||||
-- toggling "track all units" changes what is tracked
|
||||
if cache_trackall ~= config.track_all_units then
|
||||
cache, cache_size, cache_trackall = {}, 0, config.track_all_units
|
||||
end
|
||||
|
||||
local entry = cache[guid]
|
||||
if entry and entry.expire > GetTime() then return true, entry.name end
|
||||
if entry and entry.expire > GetTime() and (not flags or entry.flags == flags) then return true, entry.name end
|
||||
end
|
||||
|
||||
local function CacheSet(guid, name, lifetime)
|
||||
local function CacheSet(guid, name, lifetime, flags)
|
||||
if cache_size > 2000 then cache, cache_size = {}, 0 end
|
||||
if not cache[guid] then cache_size = cache_size + 1 end
|
||||
cache[guid] = cache[guid] or {}
|
||||
cache[guid].flags = flags
|
||||
cache[guid].name = name
|
||||
cache[guid].expire = GetTime() + lifetime
|
||||
return name
|
||||
@@ -122,31 +123,33 @@ local TYPE_PLAYER, TYPE_PET, TYPE_GUARDIAN = 1024, 4096, 8192
|
||||
local function CLEUSource(guid, name, flags)
|
||||
if not guid or not name or not flags or flags < 0 then return nil end
|
||||
|
||||
local found, label = CacheGet(guid)
|
||||
-- Event flags are current even when the GUID's cached owner is not. A
|
||||
-- control/reaction/type change must invalidate both positive and negative hits.
|
||||
local found, label = CacheGet(guid, flags)
|
||||
if found then return label end
|
||||
|
||||
local grouped = hasbit(flags, 1) or hasbit(flags, 2) or hasbit(flags, 4)
|
||||
|
||||
if hasbit(flags, TYPE_PLAYER) then
|
||||
if grouped and Tracked(name) then
|
||||
return CacheSet(guid, name, 60)
|
||||
return CacheSet(guid, name, 60, flags)
|
||||
elseif config.track_all_units == 1 then
|
||||
return CacheSet(guid, name, 60)
|
||||
return CacheSet(guid, name, 60, flags)
|
||||
end
|
||||
return CacheSet(guid, false, 10)
|
||||
return CacheSet(guid, false, 10, flags)
|
||||
end
|
||||
|
||||
if hasbit(flags, TYPE_PET) or hasbit(flags, TYPE_GUARDIAN) then
|
||||
if (hasbit(flags, TYPE_PET) or hasbit(flags, TYPE_GUARDIAN)) and not hasbit(flags, 64) then
|
||||
local owner = hasbit(flags, 1) and UnitName("player") or nil
|
||||
local label = PetLabel(guid, name, owner)
|
||||
if label then return CacheSet(guid, label, 30) end
|
||||
if label then return CacheSet(guid, label, 30, flags) end
|
||||
end
|
||||
|
||||
if config.track_all_units == 1 and name ~= UNKNOWNOBJECT then
|
||||
return CacheSet(guid, name, 30)
|
||||
return CacheSet(guid, name, 30, flags)
|
||||
end
|
||||
|
||||
return CacheSet(guid, false, 10)
|
||||
return CacheSet(guid, false, 10, flags)
|
||||
end
|
||||
|
||||
-- arg12 onward depend on the subevent (see the ClassicAPI documentation)
|
||||
|
||||
Reference in New Issue
Block a user