1. #1

    Pulling DoT/HoT tick speed information from the aura tooltips. I've got a question

    So in one of my addons I need access to information on how often a DoT/HoT ticks on a unit.

    One of the ways I'm experimenting with is pulling the hasted tick time from the tooltip itself on UNIT_AURA event.

    My code:

    Code:
    addEvent(function(self, event, unit)
    	for i=1, 40 do
    		for _, spellbar in ipairs(ns.spellbars.active) do
    			if spellbar.spellConfig.debuff[1] > 0 then -- We have a debuff to look at
    				if unit == (type(spellbar.spellConfig.debuff[2]) == "string" and spellbar.spellConfig.debuff[2] or "target") then
    					local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, shouldConsolidate, spellID, canApplyAura, isBossDebuff, value1, value2, value3 = UnitDebuff(unit, i)
    					if caster == "player" then
    						if spellbar.spellConfig.debuff[1] == spellID then -- Ooh, we found it on this spellbar.
    							ns.tooltip:SetUnitDebuff(unit, i)
    							local scanText = _G["EventHorizonScanTooltipTextLeft2"]:GetText()
    							local tickSpeed = tonumber(string.sub(scanText, string.find(scanText, "every ")+6, string.find(scanText, " sec")-1))
    								--tonumber returns nil if it can't be converted to a number
    							ns:addDebuff(spellbar, duration, tickSpeed)
    							
    						end
    					end	
    				end
    			end
    		end
    	end
    end,
    "UNIT_AURA")
    A cursory inspection of wowhead seems to show that all DoTs/HoTs tooltips say "every x.xx sec".
    I'm not versed in Lua pattern matching at all and I managed to get the x.xx information using what I have below, but on a non-matching string it returns garbage information. tonumber() luckily returns nil if the number can't be converted, but I'm sure that there's more efficient/robust ways of doing it using pattern matching.

    Does anyone know of a pattern which would match only the x.xx portion of the string to make it more efficient? (Or any other changes to my above code to make it more efficient)

    Thanks
    -Brusalk
    Code:
    tonumber(string.sub(scanText, string.find(scanText, "every ")+6, string.find(scanText, " sec")-1))

  2. #2
    Deleted
    Code:
    scanText:match("every ([0-9]+%.?[0-9]*)")
    That should do the trick. Will obviously only work for english locales, though.

    Why don't you use the max duration of the debuff (from UnitAura) to calculate tick speed?

  3. #3
    Isn't durration just the time the buff 'lives' on the target? If you gain 1 or 2 ticks (plus a bit to account for the way extra ticks are added) then wouldn't the durration in all three cases (+0 at no haste, +1 with excess haste, +2 with excess haste) be the same in all cases? I hope I'm missing something obvoius because I don't see a way this could be used to calculate the periodicity of ticks for buffs/debuffs. Can you elaborate?

  4. #4
    I kind of want to avoid requiring the user to tell me the unhasted tick time which is why I was experimenting with this method.

    ---------- Post added 2012-09-10 at 07:50 AM ----------

    Quote Originally Posted by evn View Post
    Isn't durration just the time the buff 'lives' on the target? If you gain 1 or 2 ticks (plus a bit to account for the way extra ticks are added) then wouldn't the durration in all three cases (+0 at no haste, +1 with excess haste, +2 with excess haste) be the same in all cases? I hope I'm missing something obvoius because I don't see a way this could be used to calculate the periodicity of ticks for buffs/debuffs. Can you elaborate?
    Yeah duration is. The idea is that I create a GameToolTip and use GameToolTip:SetUnitAura(unit, index) to set it to the buff/debuff I'm currently looking at and using a string.sub on the second lefttext.

  5. #5
    Deleted
    Yeah, I forgot about ticks being added. In that case, my pattern from above should work.

  6. #6
    Do you think there'd be a way to pull it independent of the players game's localization?

  7. #7

    Thumbs up

    Quote Originally Posted by Brusalk View Post
    Do you think there'd be a way to pull it independent of the players game's localization?
    There are what, maybe 20 localizations? Assuming they follow a similar pattern you could just tweak the regex he posted to scan for /(every|chinese for every| German for ever|...)/ instead of just /every/. I'm not sure that it is the case that they follow the same format but it's probably a good place to start. You can deal with edge cases as people report them.

  8. #8
    Deleted
    Best way would be to keep a pattern for every locale and use the appropriate one, I suppose. (Unless the tick speed is returned in the value1-3 return values of UnitAura. Have you checked that?)

  9. #9
    Quote Originally Posted by Treeston View Post
    Best way would be to keep a pattern for every locale and use the appropriate one, I suppose. (Unless the tick speed is returned in the value1-3 return values of UnitAura. Have you checked that?)
    I don't believe it is.

    I tested it with SWP and VT and VT gave me something like 6, 626, true while SWP gave me something like 1022, true, nil

    I frankly have no clue what the return values are. Nothing's readily apparent from the testing I did.

    ---------- Post added 2012-09-10 at 11:40 AM ----------

    Quote Originally Posted by evn View Post
    There are what, maybe 20 localizations? Assuming they follow a similar pattern you could just tweak the regex he posted to scan for /(every|chinese for every| German for ever|...)/ instead of just /every/. I'm not sure that it is the case that they follow the same format but it's probably a good place to start. You can deal with edge cases as people report them.
    Yeah. I guess I'll try and get some from the different language versions of wowhead. No real way for me to test it unfortunately

  10. #10
    Deleted
    Damage per tick, possibly? Though that seems like a pretty low value.
    It's usually something that somehow affects the tooltips - I know it's absorb value remaining for shields, for example.

  11. #11
    Quote Originally Posted by Treeston View Post
    Damage per tick, possibly? Though that seems like a pretty low value.
    It's usually something that somehow affects the tooltips - I know it's absorb value remaining for shields, for example.
    Alright. For VT it's

    value1 = percent mana returned per tick
    value2 = base tick damage
    value3 = true (maybe this is casted by you?)

    For SWP it's just

    value1 = base tick damage
    value2 = true
    value3 = nil


    So it looks like it tells you the base tick damage (though I'm not sure why you'd ever want to know that when getting the aura information as an addon)

Posting Permissions

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