TellMeWhen

TellMeWhen

24M Downloads

Support new UNIT_AURA stuff

ascott18 opened this issue ยท 8 comments

commented

UNIT_AURA has been reworked again. Now with mandatory memory allocations on every event for every frame!

Probably need to develop a central UNIT_AURA handler to avoid allocations for every single icon. Also obviously need to support the new payload.

commented

I already finished everything, but its in a branch because i've been playing with it for a while because its been pretty buggy (UNIT_AURA payload has really annoying bugs, like firing updates of auras that were removed, or firing removals of auras that never existed)

commented

I've done some initial work here:
https://github.com/arieh/TellMeWhen_Script_Tools/blob/master/modules/AuraTracker.lua

Probably missing a lot of stuff since this is basically a very early proof of concept, but the idea is to maintain a store of known auras. I think it will probably provide a good performance boost for anything that does a lot of aura checks.

The main thing I'm not sure of is what are the cases where a unit will have auras added without a UNIT_AURA event (eg - what is the range of UNIT_AURA, does it differ for group members vs npcs etc).

Tried to solve this by doing updates on ROSTER_CHANGE and nameplate added/removed while also doing cache clears on intervals.

commented

that's super nice!

Obviously much cleaner than mine, but at least I was close with my idea. Seems like TMW_UNITSET_UPDATED takes care of all the edge cases I was worried about.

Any idea on when this is planned to land?

commented

I'll try to get to it (and your PR) this weekend. Been trying to knock down the flood of recent bug reports tonight.

commented

Looking a bit into the code - do you think it will be possible to have a simpler utility on top of it that is more closely related to the old GetAura?
Would like doing something like:

function tmwGetUnitAura(unit, spell, onlyMine)
	local name, rank, icon, castTime, minRange, maxRange, spellID = GetSpellInfo(spell)

	local config = GetAuras(unit)
	local instances = config.instances
	local lookup = config.lookup

	local spellLookup =  lookup[spell] or lookup[spellID]

	for instanceId,_ in spellLookup do 
		if (instances[instanceId]) then
			return instances[instanceId]
		end
	end
	return nil
end

However from reading the code, unit is something tricky in this case since it's unclear to me how to normalize it (since it's not always guid in the units table).

I think what the code implies is that whatever I use, if it doesnt exist TMW will just create a new cache entry for it, and then the instance ids will be updated regardless of the unit string I use in the future?
(eg - target is a changing value)

commented

The unit parameter to GetAuras is only valid if TMW.COMMON.Auras:RequestUnits(TMW.UNITS:GetUnitSet(unit)) returns true. Otherwise, it'll still create a set of tables for that unit, but those tables will never again be updated. For performance reasons, GetAuras doesn't do that validation every time you call it - that part is always done ahead of time.

commented

This is now in master.