EnemyBuffTimersVanilla

EnemyBuffTimersVanilla

by schaka » Wed Feb 18, 2015 7:20 pm

You can ALWAYS find the latest version here: https://github.com/Schaka/EnemyBuffTimersVanilla - be careful, this one is experimental.


I recently wrote this addon for TBC, which was fairly easy. To challenge myself, I tried to make it work for Vanilla as well.
Unfortunately it is not as smooth as the TBC version, as Vanilla's UNIT_AURA event does not work for anything but the player himself (it seems, at least) and the "combat log" does not get triggered when a spell is refreshed. If someone knows how to work around that, I'd very much welcome their input.

However, here is what it does: If you are using the default UnitFrames as shown in the screenshot, it will put timers over your enemy's debuffs and your friends buffs/debuffs, given you are in range when they are applied. You can target and de-target any enemy within range as often as you want and the timers will always be accurate. But please keep in mind, they are static values and not the ACTUAL timers pulled anywhere from the game. They will NOT always show the correct timer.

Download

Preview:

Image

In combat

To edit spells into the code (current list is very small), open EnemyBuffFrames.lua with Notepad or an editor of your choice and find this list:
Code: Select all
["Ice Block"] = 10,
["Blessing of Freedom"] = 14,
["Power Word: Shield"] = 30,
["Divine Shield"] = 12,

It should be self explanatory that you can add the name of another spell. Keep in mind, the names are case-sensitive, you need to write them EXACTLY like they are spellt in the client.

The addon supplies its OWN timers now.

You can change it to work with other UnitFrames by changing these two lines
Code: Select all
local region=getglobal(firstToUpper(unitID).."FrameBuff"..i)
local region=getglobal(firstToUpper(unitID).."FrameDebuff"..i)

To whatever your frames buffs and debuffs are called. For example for Discord UnitFrames:
Code: Select all
local region = getglobal("DUF_TargetFrame_Buffs_"..i)
local region = getglobal("DUF_TargetFrame_Debuffs_"..i)
schaka
Senior Sergeant
Senior Sergeant
 

Re: EnemyBuffTimersVanilla

by Kill » Wed Feb 18, 2015 11:53 pm

Dear Schaka,

this looks awesome. Sadly I have not enough time right now to fully understand that code and learn from your API usage.

I am working on this right now and I also encountered the problem, that aura event is not proced when buffs are self-casted while still being active (= rebuff before buff times out). However since I'm working a on a base where I actually know when buff timers are reset by just simply checking their remaining duration, I was able to overcome this. This is sadly not applicable for you scenario, as far as I understand.

What I would like is a video, showing how it works (and not works) to get an better impression.
Anyway, impressive job!


Code: Select all
local first, last = string.find(arg1, "([\s\S]*)gains") -- idk what I'm doing

HAHAHAHA ;)

It has something todo with Regular Expressions, I will try to figure it out. Something about getting the casting players name...
Kill
Sergeant
Sergeant
 

Re: EnemyBuffTimersVanilla

by Youfie » Thu Feb 19, 2015 1:29 am

Hey, nice work :).

I'll try to make it work with Nurfed Unit Frames !
User avatar
Youfie
Knight-Lieutenant
Knight-Lieutenant
 

Re: EnemyBuffTimersVanilla

by Noxx » Thu Feb 19, 2015 6:59 am

i love when people are making new addons for patch 1.12.1 :D
Image
User avatar
Noxx
Sergeant Major
Sergeant Major
 

Re: EnemyBuffTimersVanilla

by schaka » Thu Feb 19, 2015 2:42 pm

Kill wrote:Dear Schaka,

this looks awesome. Sadly I have not enough time right now to fully understand that code and learn from your API usage.

I am working on this right now and I also encountered the problem, that aura event is not proced when buffs are self-casted while still being active (= rebuff before buff times out). However since I'm working a on a base where I actually know when buff timers are reset by just simply checking their remaining duration, I was able to overcome this. This is sadly not applicable for you scenario, as far as I understand.

What I would like is a video, showing how it works (and not works) to get an better impression.
Anyway, impressive job!


Code: Select all
local first, last = string.find(arg1, "([\s\S]*)gains") -- idk what I'm doing

HAHAHAHA ;)

It has something todo with Regular Expressions, I will try to figure it out. Something about getting the casting players name...


I was actually trying to read the playername/spellname from combatlog messages. Honestly, back then I had no idea how to deal with regex and Lua 5.0's implementation of it is a little weird anyway. It's not even regular regex.

As for buff duration and the like on yourself, you should look into my backport of LoseControl for Vanilla. It's a bit bugged, so I never bothered releasing it, actually. But it should give you a decent idea on how to handle things. On top of that, if you're looking into how to hook functions to renew spell timers properly (like the push of an action button or CastSpellByName), you should really look into SpellTimer, as it is probably the smartest, most well done Vanilla addon I have ever seen. The English implementation lacks proper combatlog parsing for some classes/spells, but overall it does the trick and you can learn a lot from the code.

I was also wrong in the OP, when I said that UNIT_AURA doesn't fire for target/party/etc - it does. I probably implemented something wrong, when I initially worked on EBFV. It's also worth noting, that I haven't touched the WoW API in almost a year. But if you have any questions, feel free to get back to me.
schaka
Senior Sergeant
Senior Sergeant
 

Re: EnemyBuffTimersVanilla

by Kill » Thu Feb 19, 2015 2:51 pm

schaka wrote:But if you have any questions, feel free to get back to me.


I will check out spell timer for sure! For now I am working with what I got and what's running so far.
I have a quick question. Can you tell me if this is correct: There are 16 Buff slots (0-15), Weapon Buff slots at fixed positions (16 and 17), then 8 Debuffslots (18-25)?
Kill
Sergeant
Sergeant
 

Re: EnemyBuffTimersVanilla

by pharcyde » Thu Feb 19, 2015 2:53 pm

Much love Schaka from Niba <3
Image
User avatar
pharcyde
Tester
 

Re: EnemyBuffTimersVanilla

by Youfie » Thu Feb 19, 2015 3:11 pm

Kill wrote:
schaka wrote:But if you have any questions, feel free to get back to me.


I will check out spell timer for sure! For now I am working with what I got and what's running so far.
I have a quick question. Can you tell me if this is correct: There are 16 Buff slots (0-15), Weapon Buff slots at fixed positions (16 and 17), then 8 Debuffslots (18-25)?

I have no idea what's it's like in programming, but in the game the debuff slots limit is 16 (lowered to 8 for some time) and the buff limit 32 (didn't heard anything about it being lowered).

Sorry if I'm off-topic :)
User avatar
Youfie
Knight-Lieutenant
Knight-Lieutenant
 

Re: EnemyBuffTimersVanilla

by schaka » Thu Feb 19, 2015 4:48 pm

I think he is referring to buffs/debuffs on himself. They are 16/16 (check the functions I used in LoseControl, they were hard to find). On targets, they are 16/16 as well, there's no 32 debuff limits in Vanilla as far as I can remember.

Things like weapon enchantments and the like are probably not accessible through that function and you will have to hook whatever function fills the BuffFrame with icons, then do your thing there.
schaka
Senior Sergeant
Senior Sergeant
 

Re: EnemyBuffTimersVanilla

by Youfie » Thu Feb 19, 2015 5:24 pm

32-buff limit with only 16 being displayed is apparently what it used to be on retail, so yes you're right when saying the display limit is 16/16 :).

http://blue.cardplace.com/cache/wow-dungeons/624230.htm
User avatar
Youfie
Knight-Lieutenant
Knight-Lieutenant
 

Next

Return to Addons & macros