[CF 1407] Unstable Affliction Stack Number overlay
tmw-issue-import opened this issue ยท 7 comments
I am trying to put the number of UA's that only I have on a target over an icon. I tried to use [NumAura("Unstable Affliction", source="player", unit="target")] but noticed that there doesn't seem to be a 'source' condition for NumAura. I know about making UA a group controller, but have no desire to show up to 5 buttons. I simply want a Number of UA's I have on the target. The aforementioned NumAura line works but it will show stacks from other warlocks as well, granted that i have at least one applied. How can I accomplish this task? I love TMW btw and refuse to use weak auras. haha
Regards, Corrath
Posted by CurseForge user ConnerP | Imported from CurseForge issue #1407 | Raw
I have tried to make something like this myself before, with not a lot of success. The main reason the code above is not working properly, is because the function "NumAura" that counts the number of auras on a target, has no "Source" parameter buildt into it. This means that the function accepts the name of a spell, but not from who.
If this is the case, it should be possible to add a "Source" tag before the counter, in the following manner:
[Source:Name NumAura("Unstable Affliction", target="target")]
I have not tried this code snippet, but I think this should identify you as a player, and then count the number of unstable affliction instances on the target. Let me know how it turns out, or if you find some other way to sort it :)
Posted by CurseForge user Cidolfas86
I had no luck with that. I even tried modifying the Source:Name to [Source:Name("Corrath")...], [Source:Name(unit="Corrath")...], [Source:Name(unit="player")...]. Nothing seems to filter out the other player's UA applications.
Posted by CurseForge user ConnerP
I've also tried making a group controller to display the UA's that is hidden, then tried to count the number of icons passing show in that group. Idk how to do the syntax for that last part though.
Posted by CurseForge user ConnerP
The last option would be to execute some kind of custom snippet, or make your own tag for it.
You could try and make a custom function, that runs a counter on the number of instances of unstable affliction.
It would probably look something like this:
function() (Just the name of the function, and it does not need any extra input)
local count = 0
for i = 1, 30, 1 do
if (UnitAura("target", i, "PLAYER|HARMFUL") == "Unstable Affliction") then (checks the target if it's hostile and aura is UA)
count = count + 1 (increases counter based on the UA counter)
end
end
return count (we constantly return the integer number value of the number of instances)
end
EDIT!: Oh, you will need to make sure that the icon is only tracking you (I assume Tellmewhen has some checkbox for this), to filter out external warlocks that way.
Again, not a code I have tried myself in-game, but something like this should be what you are looking for.
Also I am not that familiar with implementing lua snippets into tellmewhen, but I guess it comes with instructions :)
Edited Jul 3, 2017
Posted by CurseForge user Cidolfas86
^1^T^SBuffOrDebuff^SHARMFUL ^SUnit^Starget ^SOnlyMine^B ^SType^Sbuff ^SName^SUnstable~`Affliction ^SEvents^T ^N1^T ^SType^SCounter ^SCounter^Suacnt ^SCounterAmt^N0 ^SCounterOperation^S= ^SEvent^SWCSP ^SOnConditionConditions^T ^N1^T ^SType^SCOUNTER ^SOperator^S< ^SName^Suacnt ^t^Sn^N1 ^t^SFrequency^N0.1 ^t^N2^T ^SType^SCounter ^SCounter^Suacnt ^SCounterAmt^N0 ^SCounterOperation^S= ^SEvent^SOnEventsRestored ^SOnConditionConditions^T ^N1^T ^SType^SCOUNTER ^SOperator^S< ^SName^Sagonycnt ^t^Sn^N1 ^t^SFrequency^N0.1 ^t^N3^T ^SType^SLua ^SLua^S--~`Unstable~`Affliction~`Counter~J ~J ~J local~`numuas,uamintime,uamaxtime~`=~`UAInfo("target")~J ~J TMW.COUNTERS["uacnt"]~`=~`numuas~J ~J TMW.UAMIN~`=~`uamintime~J TMW.UAMAX~`=~`uamaxtime~J ~J TMW:Fire("TMW_COUNTER_MODIFIED","uacnt") ^SEvent^SWCSP ^SOnConditionConditions^T ^N1^T ^SType^SEXISTS ^SUnit^Starget ^t^Sn^N1 ^t^SFrequency^N0.1 ^t^N4^T ^SType^SLua ^SLua^S--~`Unstable~`Affliction~`Counter~J ~J ~J TMW.COUNTERS["uacnt"]~`=~`0~J ~J TMW.UAMIN~`=~`0~J TMW.UAMAX~`=~`0~J ~J TMW:Fire("TMW_COUNTER_MODIFIED","uacnt") ^SEvent^SOnEventsRestored ^SOnConditionConditions^T ^N1^T ^SType^SEXISTS ^SUnit^Starget ^t^Sn^N1 ^t^SFrequency^N0.1 ^t^Sn^N4 ^t^SEnabled^B ^SSettingsPerView^T ^Sicon^T ^STexts^T ^N1^S[Counter("uacnt")] ^N2^S[Duration:Round]s ^t^t^t^SStates^T ^N1^T ^t^N3^T ^t^N4^T ^t^t^t^N84002^S~`~| ^Sicon^^
^1^T^SName^SUAInfo ^SCode^Sfunction~`UAInfo(UnitDesc)~J ~`~`~`~`local~`filter~`=~`""~J ~`~`~`~`local~`AuraName~`=~`"Unstable~`Affliction"~J ~`~`~`~`local~`n~`=~`0~J ~`~`~`~`local~`mintime~`=~`nil~J ~`~`~`~`local~`maxtime~`=~`0~J ~`~`~`~`~J ~`~`~`~`filter~`=~`"PLAYER"~J ~`~`~`~`~J ~`~`~`~`~J ~`~`~`~`if~`not~`UnitExists(UnitDesc)~`then~J ~`~`~`~`~`~`~`~`return~`0,0,0~J ~`~`~`~`end~J ~`~`~`~`--~`scan~`all~`debuffs~`on~`the~`unit~`looking~`for~`UAs~`we've~`cast~J ~`~`~`~`for~`z~`=~`1,~`256~`do~`~J ~`~`~`~`~`~`~`~`local~`debuffname,~`_,~`_,~`_,~`_,~`_,~`expiration,~`_,~`_,~`_,~`id~`=~`UnitDebuff(UnitDesc,z,filter)~J ~`~`~`~`~`~`~`~`if~`not~`debuffname~`then~J ~`~`~`~`~`~`~`~`~`~`~`~`return~`n,~`(mintime~|=nil~`and~`mintime~`or~`0),~`maxtime~J ~`~`~`~`~`~`~`~`end~J ~`~`~`~`~`~`~`~`~J ~`~`~`~`~`~`~`~`if~`debuffname~`==~`AuraName~`then~J ~`~`~`~`~`~`~`~`~`~`~`~`n~`=~`n+1~J ~`~`~`~`~`~`~`~`end~J ~`~`~`~`~`~`~`~`~J ~`~`~`~`~`~`~`~`--~`find~`least~`time~`remaining~J ~`~`~`~`~`~`~`~`if~`mintime~`==~`nil~`or~`mintime~`>~`(expiration-GetTime())~`then~J ~`~`~`~`~`~`~`~`~`~`~`~`mintime~`=~`(expiration-GetTime())~J ~`~`~`~`~`~`~`~`end~J ~`~`~`~`~`~`~`~`~J ~`~`~`~`~`~`~`~`--~`find~`max~`time~`remaining~J ~`~`~`~`~`~`~`~`if~`maxtime~`<~`(expiration-GetTime())~`then~J ~`~`~`~`~`~`~`~`~`~`~`~`maxtime~`=~`(expiration-GetTime())~J ~`~`~`~`~`~`~`~`end~J ~`~`~`~`~`~`~`~`~J ~`~`~`~`end~J ~`~`~`~`~J ~`~`~`~`return~`n,~`(mintime~|=nil~`and~`mintime~`or~`0),~`maxtime~J end~J ~J ~J ^t^N84002^S~`~| ^Scodesnippet^^
Above are two import strings: the first is an icon for displaying the count of Unstable Affliction on a target (with remaining duration by however TMW decides which duration to use, experimentally seems the minimum one). The second is a code snippet that is needed for the icon to work. You will need to import them both. In addition to the icon itself, I have it maintain a TMW counter "uacnt" that can be used in counter conditions in other icons.
Posted by CurseForge user canofbutter