1. #1

    WeakAura LUA Help (Leech trinket estimator)

    Hi guys, I need some LUA help with this WeakAura I found that I'm trying to edit.

    This is a WeakAura that is supposed to watch all Leech healing events and watch all buffs that a player has from the Unstable Felshadow Emulsion trinket, and attribute Leech healing to each healer, then print it out at the end of the fight. However, it looks like right now, it's just an estimate (or maybe unintentionally wrong), and I'm trying to see if it's possible to fix it. Here's the WeakAura import string:

    Code:
    d4eplaGiO0LOuiJcsCkqYQKKcVssQAwsQBbfzxGOFjjLmmiPJbsTmjjpJuOPjv11OuQTbf(gHQghPGZrrADGaMhKI6Ea1bPkwiKspeuMifXffAJuQ0hPuvJKQ0jPuXkLyMuv3ekk7Ku6NsvgkLswkf1tbmvbUkPOTkjfnwjPYzHu4TuQYDPu0Ej5VKQbJomfwmiOhlLMSu5YI2mq(SKy0GQtdXQLKs9AqOMnLCBcz3u53q1WjuwobpxkMorxxqBhs13PuW4bHCEcvwpuu9EqGMpLc19HuK9RwbTkqbisb0Pa6ubkaq4ojacMNkTASkfqhst1o01krqpvOvb0H0iMLH4csisQaSrTkG2WgjUOGeIKkaqHUwjcUdfOUmNZPqkdfCtSyVKUUlxUC5YffG46bcutkv2ftMIkQIh6QWOQ(OwLPyykg9vGWuFXRaeYki4UaXjwQaKjejvaioePElUiXSsz2P0cTcWORdrIG7mS0LcivQKcnQaLubydiDs4k7232OQrmmvdM2xd91GPvbngkqyY2vPaq6uabcgTqmIRY0pZw4kaxOOabKkvsHgLwOvaWtKkWLk7AkQOIH47JQ4Xadt1qvq3VVceMSTgvaqupqGAsPYUycdmGUpg2gdBRbnAQPqRrurvbct97RaSWn6ubkGWMu3LONckiubinSsNufOaefAjrubkPsQa6qabcPn0skovGcquOLerfOKkPcqWOnvbkarHwsevGsQKkabCRufOaefAjrubkPsQacBsDmh3LkiubG54Uub4nTSaHiKtyisJU0sjvasbKkvsbvGcqkoXsfqByJexKci0LONoPcqIik7uaj6PtQaGHlccnKtF8kkGWMup0HivOvb0g2iXfPaaf6ALi4ouY6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AOpgIh6PeE6UmNZ5CoNZ5CoNZPFmcZRoqpnndlcypnDisTgIsuAWdfAtOS5e80kZw4xMZ5CoNZ5CoNZ50pgH5vpOxGh)j4PFmcZREqVap(ZQFALzl8lZ5CoNZ5CoNPR7YCoNZ5CMUUlZ5CoNZjcOPFmcZREqVap(tWGNOoLWt3uiLHcUz66UmNZ5CoNGWfMn4HcTz9SPfxiNiUPygicnO4hJW8Qd0ttZWIaqn7WVmNZ5CoNZ5CIaA6WLt)yeMx71Ghk0M2CkHNUlZ5CoNZ5CoNZ5C6hJW8AVg8qH20MtWtuVmNZ5CoNZ5CMUU5L5CoNZ5CoNt)yeMx71Ghk0M2CcE6hJW8AVg8qH20MZQFIsccu2krqpNvJjknT4c5SAn9JryE1d6f4XhkOUmNZ5CoNPR7YCoNPR7s66UC5YLlxUC5YLlxUC5YLlxUC5YLlxUC5YLlxuaj6Pt2OaG1dZqRNaD)E2xpwnJAd01uRDTJFq0C0K6Owy90uBq0SoqGhZb1rTW6PP2GOz9OwtQTLVh0iAw3C0(rT6MyhapO1pAsTT89GgrZ6MJ2pQvpQ1dA9JMOaAdBK4I0LItSubKONoPcOnSrIlshosxQaKiIYoLujvankGQGeAirfsmuaOR0cD)QGwjvka
    And for your convenience, here's the code in question:

    Code:
    function(e, time, event, ...)
        if not LEECH then LEECH = {} end
        if not LEECH_SOURCES then LEECH_SOURCES = {} end
        if e == "ENCOUNTER_START" or e == "XPLAYER_REGEN_DISABLED" then
            wipe(LEECH)
        elseif e == "ENCOUNTER_END" or e == "XPLAYER_REGEN_ENABLED" then
            SendChatMessage("==Leech trinket healing done==", "RAID")
            print("==Leech trinket healing done==")
            for healer, amount in pairs(LEECH) do
                SendChatMessage(healer .. ": " .. math.floor(amount).." healing", "RAID")
                print(healer, ":", amount)
            end
        elseif event == "SPELL_HEAL" then
            local target, _, _, spell, name, _, amount, overhealing = select(7, ...)
            if spell ~= 143924 then return end
            local effective = amount - overhealing
            if effective < 10  then return end
            wipe(LEECH_SOURCES)
            local LEECH_TOTAL = 0
            for i=1, 40 do
                local name, _, _, _, _, _, _, source, _, _, aura, _, _, _, leech = UnitAura(target, i)
                if not name then
                    break
                end
                if aura == 184671 then
                    LEECH_SOURCES[UnitName(source)] = leech
                    LEECH_TOTAL = LEECH_TOTAL + leech
                end
            end
            if LEECH_TOTAL == 0 then return end
            for source, score in pairs(LEECH_SOURCES) do
                if not LEECH[source] then
                    LEECH[source] = 0
                end 
                LEECH[source] = LEECH[source] + (effective * (score / LEECH_TOTAL))
            end
        end
    end
    The total Leech healing attributed to healers often does not match the total Leech healing done according to logs, so you might think that it's working properly. However, it's not, as you can confirm for yourself by looking at the code:

    -Any Leech events that did less than 10 effective healing are ignored, possibly for performance reasons.
    -When a player has the trinket buff on them, any of their personal Leech is attributed to healers instead.

    The reason why the total Leech accounted for by the trinket is less than the total Leech healing done is

    -Again, any Leech events that did less than 10 effective healing are ignored
    -As long as a player does not have a Leech buff from a healer, their Leech is not attributed to any healers

    However, that does not mean it is correct just because the totals don't match, as you can see. Unfortunately, although I can read LUA, I'm not well-versed in it enough to fix the WeakAura. What would be needed would be to grab everyone's Leech ratings dynamically, and I'm not sure how to do that or if it's even possible or how complicated it may be.

    Someone on the Monk forums had this to offer, but I'm not sure how to dynamically fetch these values in a Lua script:

    Quote Originally Posted by Modulo View Post
    Not sure if it's any use to people working on it but peoples' leech rating can be retrieved from Exorsus Raid Tools' inspect DB.

    Code:
    /dump GExRT.A.InspectViewer.db.inspectDB.Modulo.leech
    Where Modulo is replaced with the characters' name.
    Any ideas?

    - - - Updated - - -

    Oh, also, apparently this WA is a performance hog, so if you have any ideas to reduce the computational load, that would be useful. Is it possible to change the trigger from COMBAT_LOG_EVENT_UNFILTERED to just SPELL_HEAL, for example? I could try that myself and test it, but I figure I could give an example of the kind of stuff I'm looking for.
    Last edited by Geodew; 2015-07-20 at 07:53 AM.
    Legion Mistweaver Stat Weights SPREADSHEET --- Stat weights DISCUSSION THREAD
    Follow @GeodewMW for off-topic funsies and notifications for important MW theorycrafting posts!
    IF WE MISS YOUR QUESTION, please ask again! You're not being annoying, I promise

  2. #2
    I'm not really sure what the issue is? You say you want to see leech healing from the trinket, and then later say you want all leech healing? It's one or the other. I don't really get what it is you want all leech healing for.

    In any case, while I'm not a LUA expert by any means, I will try to help. Removing the cutoff at 10 should be fairly easy. Remove this line:

    if effective < 10 then return end

    Bear in mind that in the line before, as I assume you know, the code makes sure to measure just effective healing, and thus does not measure overhealing. If you do want it to measure overhealing as well, that line needs to be:

    local effective = amount

    To just make it tally up all leech, you would have to retool the code in a way I, since I don't really know how to code LUA effectively and am not going to spend an hour or more figuring it out just for this post, cannot help you with. The slash command from Exorsus Raid Tools certainly must rely on LUA itself, though, so if you want to incorporate it, go find what LUA it relies on and start trying to incorporate that.

  3. #3
    Quote Originally Posted by Sevyvia View Post
    I'm not really sure what the issue is? You say you want to see leech healing from the trinket, and then later say you want all leech healing? It's one or the other. I don't really get what it is you want all leech healing for.
    Hmm, is it not clear? I want it to include just Leech healing caused by a healer's Leech trinket. However, it is sometimes incorrectly attributing Leech from passive Leech Rating on a raid member's gear to healers. The "sometimes" is whenever that player has a Leech buff from a healer.

    For example, player is healing himself for 100.
    0 is attributed to healers.
    Then a healer gives him a Leech buff, so he's healing himself for 110.
    All 110 is attributed to the buffing healer, not 10.

    And yeah, I can already easily see how to remove the "less than 10 HP" thing. I'm just wondering if I should. I'd think the author put that in for a reason. I don't know what reason that could be, though.
    Legion Mistweaver Stat Weights SPREADSHEET --- Stat weights DISCUSSION THREAD
    Follow @GeodewMW for off-topic funsies and notifications for important MW theorycrafting posts!
    IF WE MISS YOUR QUESTION, please ask again! You're not being annoying, I promise

  4. #4
    I think there needs to be a clarification on how this trinket works.
    The trinket gives a buff that adds leech raiting to the player. This would be added to any existing leech they have.
    The combat log shows how much healing was done by leech. But it is unknown how much came from was due to gear and how much was due to the trinket buff.
    The code would need to know the exact leech raiting the buff has at the time of the heal, as well as the leech raiting each player has in the raid.

    You mentioned at some point there is a delay/limitaitons on the inspect funciton. How big of a delay is it, you may be able to populate a table with everyone leech raiting on readycheck or something like that out of combat, or do it once when you join and only update when someone leaves/joins a raid.

  5. #5
    It seems like I'd want to call this command to do an inspect myself: http://wowwiki.wikia.com/API_NotifyInspect

    But I don't know what event is called when the inspect is complete (is it UNIT_INVENTORY_CHANGED, maybe?), what the event is called when a readycheck is performed or a player joins/leaves raid or when you zone into the instance, and I definitely don't know the format of the data structure returned when the inspect is complete, nor where to find any of this information for myself... hence the thread.

    It would be much easier to rely on Exorsus Raid Tools, though, which already does all that for me. Just not sure how to do the Leech look-up.
    Legion Mistweaver Stat Weights SPREADSHEET --- Stat weights DISCUSSION THREAD
    Follow @GeodewMW for off-topic funsies and notifications for important MW theorycrafting posts!
    IF WE MISS YOUR QUESTION, please ask again! You're not being annoying, I promise

  6. #6
    Deleted
    Ok, i stiched a small addon for this using a library for the inspecting: http://wow.curseforge.com/addons/leech-trinket-counter/

    One think I do differently is if the leech event has partial overhealing, it assigns the biggest part it can to static leech, then if theres any healing left its divided between trinkets normaly.

    After combat it prints trinket healing to your chat window, type /ltc to report it to instance/raid/party chat.
    Last edited by mmoc74e1e3d53a; 2015-07-20 at 06:22 PM.

  7. #7
    Quote Originally Posted by Geodew View Post
    It seems like I'd want to call this command to do an inspect myself: http://wowwiki.wikia.com/API_NotifyInspect

    But I don't know what event is called when the inspect is complete (is it UNIT_INVENTORY_CHANGED, maybe?), what the event is called when a readycheck is performed or a player joins/leaves raid or when you zone into the instance, and I definitely don't know the format of the data structure returned when the inspect is complete, nor where to find any of this information for myself... hence the thread.

    It would be much easier to rely on Exorsus Raid Tools, though, which already does all that for me. Just not sure how to do the Leech look-up.
    Just call GetLifesteal() before combat. Simply subtract the healing done by that base leech amount from the healers' leech, and attribute any leech overhealing to the healers.
    Last edited by twackycats; 2015-08-06 at 01:32 AM.

  8. #8
    Quote Originally Posted by twackycats View Post
    Just call GetLifesteal() before combat. Simply subtract the healing done by that base leech amount from the healers' leech, and attribute any leech overhealing to the healers.
    That doesn't just fetch the player's Leech? If not, how do I call it? Google isn't revealing any documentation for it.
    Legion Mistweaver Stat Weights SPREADSHEET --- Stat weights DISCUSSION THREAD
    Follow @GeodewMW for off-topic funsies and notifications for important MW theorycrafting posts!
    IF WE MISS YOUR QUESTION, please ask again! You're not being annoying, I promise

  9. #9
    Quote Originally Posted by Geodew View Post
    That doesn't just fetch the player's Leech? If not, how do I call it? Google isn't revealing any documentation for it.
    It returns your leech as a percentage.

    While wearing 0 leech:

    Code:
    /script print(GetLifesteal())
    prints '0'

    With one piece leech (137 rating in this case):

    prints '1.957142829895'

  10. #10
    That's funny to see my WeakAuras pop up here.

    Quote Originally Posted by Geodew View Post
    I want it to include just Leech healing caused by a healer's Leech trinket. However, it is sometimes incorrectly attributing Leech from passive Leech Rating on a raid member's gear to healers. The "sometimes" is whenever that player has a Leech buff from a healer.
    Like it was mentioned, attributing leech correctly requires knowing the amount of base leech on the player gear. This is quite tricky without using inspect and dealing with the Request/Available mechanism or tracking damage and healing events to know the exact amount that triggered the leech. None of them was as easy to do than simply ignoring base leech amount.

    For the context, this WeakAuras was actually made quite early during beta and back then the leech values were higher. We were also often testing it on all healers at the same time. For simplicity, I decided to ignore base leech since it was going to be a much smaller part of the overall score than it is now.

    The main idea was to have an idea of the trinket performances, more specifically performances by classes, not exact values. The only change I made to it since then was the filtering of the Fixate on Mythic Council. Many more things could be done to make it better.

    For example, I never thought of reading base leech from ExRT inspect functionality.

    Right now, I would say than simply changing the "LEECH_TOTAL = 0" to use base leech score will produce the intended effect. However this would mean that the trinket's leech and base leech will share the effective healing. The Gragagrogog's way (removing all base leech healing and only splitting what's left) is probably better to reflect what's gained from the trinket.

    Quote Originally Posted by Geodew View Post
    And yeah, I can already easily see how to remove the "less than 10 HP" thing. I'm just wondering if I should. I'd think the author put that in for a reason. I don't know what reason that could be, though.
    This is a totally arbitrary limit with no other reason than potential performance concerns. That said, I'm quite surprise to hear that this code is a "performance hog"... I play with it for months and haven't got any issue with it. It can probably be safely removed.

    - - - Updated - - -

    Quote Originally Posted by twackycats View Post
    Just call GetLifesteal() before combat.
    This only returns leech percentage for the player. We need leech for every single raid member.

  11. #11
    Brewmaster Ogait's Avatar
    10+ Year Old Account
    Join Date
    Jul 2009
    Location
    Portugal
    Posts
    1,343
    Greetings,

    Someone from my Guild gave me one link to download a .zip with a small add-on that adds another two options to Skada which gives what you're asking, I guess.
    "Healing From Leech" - Which shows the healing done by healers with that trinket
    "Targets of Leech" - Can't correct the right name, but it'll show who you gave the buff and for how much your healed for.

    When I get home, I can share that plugin, if you guys are interested.

    ~ Ogait
    | Realm First Monk | Dragonflight Beta Tester ( ty Blizzard! ) |

  12. #12
    Quote Originally Posted by Ogait View Post
    Greetings,

    Someone from my Guild gave me one link to download a .zip with a small add-on that adds another two options to Skada which gives what you're asking, I guess.
    "Healing From Leech" - Which shows the healing done by healers with that trinket
    "Targets of Leech" - Can't correct the right name, but it'll show who you gave the buff and for how much your healed for.

    When I get home, I can share that plugin, if you guys are interested.

    ~ Ogait
    I'm not sure if I trust the Skada plugin to filter out Leech from gear correctly, which is why I was trying to go with an open-source WeakAura...

    - - - Updated - - -

    Quote Originally Posted by Blash View Post
    For example, I never thought of reading base leech from ExRT inspect functionality.
    I appreciate the effort I figured it was just meant to be an estimate. Do you know how to do this ^ though?
    Legion Mistweaver Stat Weights SPREADSHEET --- Stat weights DISCUSSION THREAD
    Follow @GeodewMW for off-topic funsies and notifications for important MW theorycrafting posts!
    IF WE MISS YOUR QUESTION, please ask again! You're not being annoying, I promise

  13. #13
    Quote Originally Posted by Geodew View Post
    I'm not sure if I trust the Skada plugin to filter out Leech from gear correctly, which is why I was trying to go with an open-source WeakAura...
    You can totally read the lua code for the plugin...

  14. #14
    http://pastebin.com/kePgyf7F


    Just in case if you didnt get it working, this wa will tell you the healing in raid chat when combat is over how much healing the leech trink did.

  15. #15
    Quote Originally Posted by Rico9240 View Post
    http://pastebin.com/kePgyf7F


    Just in case if you didnt get it working, this wa will tell you the healing in raid chat when combat is over how much healing the leech trink did.
    No, you just linked the exact same WeakAura that I'm working with in the OP. This is an estimate for the same reasons detailed in the OP.

    (Sorry for the slight necro, but don't want anyone finding this thread on Google to use this WeakAura and think it's 100% accurate.)

    - - - Updated - - -

    Quote Originally Posted by Gragagrogog View Post
    Ok, i stiched a small addon for this using a library for the inspecting: http://wow.curseforge.com/addons/leech-trinket-counter/

    One think I do differently is if the leech event has partial overhealing, it assigns the biggest part it can to static leech, then if theres any healing left its divided between trinkets normaly.

    After combat it prints trinket healing to your chat window, type /ltc to report it to instance/raid/party chat.
    I looked at your add-on since everyone seems clueless of how to put this into a WeakAura (more likely the right people just aren't seeing this thread), but the output didn't make any sense to me.
    Legion Mistweaver Stat Weights SPREADSHEET --- Stat weights DISCUSSION THREAD
    Follow @GeodewMW for off-topic funsies and notifications for important MW theorycrafting posts!
    IF WE MISS YOUR QUESTION, please ask again! You're not being annoying, I promise

Posting Permissions

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