img



img

Absorb Events


By: _ForgeUser22024782
Addon | img 232




Description

___________________________________________________________________________________________________________________________

Trion's API doesn't offer a similar event to the damage one when shields are hit, which makes adding shielding to meters etc quite hard. So I wrote this some time ago to attempt to pull this information out of the game engine and wrap custom events like the normal damaged one, letting you associate buffs and abilities with damage packets. Using this you can tie shielding back to the person who provided it a fair proportion of the time, which is probably more helpful than having no information at all.

The whole thing is a painful mess: I didn't check to see what was available so completely overlooked Event.Unit.Detail.Absorb, and also wrote it without researching or planning anything. It's inaccurate and fails in many situations, in particular it has to guess what abilities actually provide shielding based on looking at the changes when buffs are added to people. This will be less accurate if the game langage is not English, because I'm using a bit of text matching to do so. Also it'll have trouble when multiple buffs are applied at once, such as Inundate's shielding (its tooltip doesn't get recognised sadly).

Anyway, if you're a bit technically inclined, you might find that you can integrate this with a meter addon of your choice. I don't believe it's up to me to provide details of how one might go about doing this as I haven't contacted anyone who maintains such addons about it or looked into this possibility. If anyone would like to do this, then I have nothing against refinements, improvements or future developments of this being posted here; but honestly it could do with rewriting from scratch.

I haven't touched the code of this version in nearly a year, and it's been so long that I don't want to risk breaking anything. It does produce a lot of output, which you might want to tidy up. I don't intend to maintain this as I no longer play but if anyone wants to do anything with it then please go ahead. It's so horrendously written that I'm actually slightly embarrassed about posting this, but I think some people could find it useful or interesting...?

I documented this (see script comments) when I wrote it, so here's a copy/paste:

-- Event.AbsorbEvents.Add

-- Triggers when absorb is applied to a target. Shielding due to refreshed buffs is counted in its entirety.
-- Parameter: info
	-- ability: Ability ID of the ability used.
	-- abilityNew: Same as ability.
	-- abilityName: Name of the ability used, or if there was no ability, the name of the buff causing the shield is used instead.
	-- absorb: The amount of absorb applied.
	-- buff: The buff ID of whatever buff is responsible for the shielding.
	-- caster: UID of whoever applied the absorb, if existing.
	-- casterName: Name of the caster, if available.
	-- crit: Always false. It isn't possible to determine whether shields crit, but omitting this field will break functions that handle multiple builtin event types.
	-- estimatedAmount: true if multiple shield buffs were applied at once, which will cause the absorb amount to be inaccurate. Otherwise nil.
	-- remaining: the amount of shielding left in the shield. Exists, but is useless in this event as it is identical to absorb when the shield is newly applied.
	-- target: UID of whatever received the absorb
	-- targetName: Name of the target, if available.
	
-- Event.AbsorbEvents.Remove

-- Triggers when an absorb shield expires.
-- Parameter: info
	-- ability: Ability ID of the ability used.
	-- abilityNew: Same as ability.
	-- abilityName: Name of the ability used, or if there was no ability, the name of the buff causing the shield is used instead.
	-- absorb: The total amount of absorb added when the ability was applied.
	-- buff: The buff ID of whatever buff was responsible for the shielding, that just fell off.
	-- caster: UID of whoever applied the absorb, if existing.
	-- casterName: Name of the caster, if available.
	-- crit: Always false. It isn't possible to detect whether shields crit, but omitting this field will break functions that handle multiple builtin event types.
	-- duration: The length of time the shield lasted on the target.
	-- estimatedAmount: true if multiple shield buffs were applied at once, which will cause the absorb amount to be inaccurate. Otherwise nil.
	-- premature: True if the shield was broken. Prematurely ending shields also fire a Damaged event with the remaining shielding.
	-- remaining: The amount of shielding that was left over from this buff when the shield expired. nil if it cannot be determined as there are other shields still on the target, or the target had shielding before becoming available. May well be wrong or negative.
	-- target: UID of whatever received the absorb
	-- targetName: Name of the target, if available.
	
-- Event.AbsorbEvents.Damaged

-- Triggers when an absorb shield takes damage. Note that this can potentially be inaccurate when multiple shields were applied at once, or multiple shields are on the target!
-- If AbsorbEventsContainer.ShowUnknownDamage, absorbed damage to unknown shields will be displayed.
-- Parameter: info
	-- ability: Ability ID of the ability used to shield. nil if the shield's identity was unknown.
	-- abilityNew: Same as ability.
	-- abilityName: Name of the ability used to shield, or if there was no ability, the name of the buff causing the shield is used instead. "[Unknown]" if the shield's identity was unknown.
	-- absorb: The total amount of absorb added when the ability was applied. nil if the shield's identity was unknown.
	-- buff: The buff ID of whatever buff was responsible for the shielding. nil if the shield's identity was unknown.
	-- caster: UID of whoever applied the absorb, if existing. The damage target if the shield's identity was unknown.
	-- casterName: Name of caster, if available.
	-- crit: Always false. It isn't possible to detect whether shields crit, but omitting this field will break functions that handle multiple builtin event types.
	-- damage: The amount of damage (as a negative value) this library thinks was done to the shield.
	-- damageinfo: The table of parameters from the Event.Combat.Damage event which caused this shield to be damaged.
	-- estimatedAmount: true if multiple shield buffs were applied at once, which will cause the absorb amount to be inaccurate. Otherwise nil.
	-- --premature - true if the event is caused by the buff ending early, usually indicating that it's broken. May also happen if the shield is purged.
	-- remaining: The amount of shielding that this library thinks is remaining in the shield. May not be accurate if multiple shields were applied simultaneously, or the same shield was refreshed before expiring, or in other undefined circumstances. May be negative in such cases - this continues to track until the buff falls off. nil if the shield's identity was unknown.
	-- target: UID of whatever received the absorb.
	-- targetName: Name of the target, if available.
	-- unknown: True if the shield's identity was unknown, otherwise false.



About Project

Created: September 22nd 2023

Updated: September 22nd 2023

Project ID: 31919

License: All Rights Reserved

__________________________________________

Game Versions:

1.01.03

1.01.03

1.01.03

1.01.03

1.01.03

__________________________________________

Flavors:

WoW Retail

__________________________________________

Categories

Companions

Battle

__________________________________________

Main File

_ForgeUser22024782_Absorb Events.zip
  • Release
  • September 22nd 2023

    __________________________________________

    Recent File

    _ForgeUser22024782_Absorb Events.zip
  • Release
  • September 22nd 2023

    __________________________________________

    Members

    img
    _ForgeUser22024782
    Owner

    __________________________________________

    Report