+ Reply to Thread
Results 1 to 2 of 2

Thread: [Absorb Converter] Enjoy!

  1. #1
    Rift Chaser Ferather's Avatar
    Join Date
    Jun 2011
    Posts
    341

    Default [Absorb Converter] Enjoy!

    I have decided to allow anyone to use,copy or edit my absorb converter, If you find a way to improve performance please feel free to contact me.

    Series of events:

    * Unit absorbs damage (Event.Combat.Damage).
    * Parse KEY.damageAbsorbed and the target, or the whole table, to another function for processing.
    * Build the units buffs and Iterate the buffs until an absorb is found (Buff ID's are NOT unique, you will need to use detail for buffs and name check)
    * Get the caster from detail.caster
    * Do your math.

    Code:
    function SuperMeter.Absorb(params, target) ---- Damage event table and the targets table (addon table)
    	if not SuperMeter_enabled then return end
    
    	local buffs = Inspect.Buff.List(params.target) ---- Build the targets buff's table
    	local session = SuperMeter.Session(true) ---- Current running session
    	local absorb = -params.damageAbsorbed ---- Turn the negative number to positive
    	local filters = SuperMeter.Filters ---- Ability filters
    
    	if not SuperMeter.Ignore[params.target] then ---- Build a non-absorb buff ignore list
    		SuperMeter.Ignore[params.target] = {}
    	end
    
    	local ignore = SuperMeter.Ignore[params.target]
    
    	local caster = false
    	local data = false
    
    	if not absorb or absorb < 0 or not buffs or not filters then return end
    
    	for k,v in pairs (buffs) do
    		if not caster and not ignore[k] then
    			local detail = Inspect.Buff.Detail(params.target, k) ---- Detail the buff
    			if detail and detail.caster and filters.absorbs[detail.name] then  ---- Check the buff and caster
    				data = {ability = k, abilityName = detail.name, caster = detail.caster, target = params.target, targetName = target.name, heal = absorb}
    				caster = session.units[detail.caster]
    			end
    			if not detail or not filters.absorbs[detail.name] then
    				ignore[k] = true
    			end
    		end
    	end
    
    	if data and caster and caster.name then ---- Check data and caster and do maths
    		target.healingTakenNonCritical = target.healingTakenNonCritical + 1
    		caster.healingNonCritical = caster.healingNonCritical + 1
    		target.healingTaken = target.healingTaken + data.heal
    		caster.healing = caster.healing + data.heal
    		caster.healingOut = caster.healingOut + 1
    		target.healingIn = target.healingIn + 1
    		data.casterName = caster.name
    		
    		SuperMeter.Ability(data, "absorb", caster, target) ---- Ability data gatherer and event
    	end
    end
    Last edited by Ferather; 09-06-2013 at 08:00 AM. Reason: Code Update

  2. #2
    Rift Chaser Ferather's Avatar
    Join Date
    Jun 2011
    Posts
    341

    Default

    Code Updated: 06/09/2013 (UK Standard)

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts