Tracking player's spell usage
Hi all,
Yeah... it's me again :p For this time, I am trying to make an addon that tracks player's spell usage and here is what I have got so far. Lua Code:
There are basically two main problems that I am concerned: 1. The first spell fired before the combat won't be tracked and I know that is because of this line: Code:
if type == "SPELL_CAST_SUCCESS" and not self.regenEnabled then 2. Also tracks for spells fired via ExtraActionButton and so on. Since I am expecting to track player's spell only, I would like these kind of spells to be ignored. In my personal opinion, COMBAT_LOG_EVENT (not COMBAT_LOG_EVENT_UNFILTERED) would do some job here, but I can't find further references regarding this. (COMBAT_LOG_EVENT info page on wowwiki doesn't seem to cover this as well :() Any suggestions, please? Thank you! |
1. I don't understand. You say it won't track "before combat" due to the condition, and when you remove that, it does track out of combat. Isn't this working as intended?
2. COMBAT_LOG_EVENT is the same event, really. The difference is this one only fires for events that honors the filters set in your combat log frame. You can try a few things here, but neither are perfect, I think. GetSpellInfo(spellName) should theoretically only return stuff for spells in your spellbook. I don't know how reliable that is, and there could be other spells with the same name as one of your own. IsPlayerSpell(spellID), IsSpellKnown(spellID) or IsSpellKnownOrOverridesKnown(spellID) were not very reliable last time I tried. Incorrectly returned false for a bunch of spells. Could try. Something that might work better is going through all your spell book spells and collecting their spell IDs. |
You don't go into combat (regen disabled) until after your first spell fires.
|
Hi Lombra,
Quote:
What I actually meant was a spell that is fired before a combat, but that actually initiates a combat. I know it still sounds weird :D Let's take some example. Say that you are a mage and cast a "Fireball" on a target. Once it hits a target, your health regen will be disabled (calls PLAYER_REGEN_DISABLED) and finally, you are in a combat :banana: But, what if you cast a "Blink"? Casting a "Blink" won't directly initiate a combat unless you are in a range of mob or something (but still, that isn't considered as "direct"), and this is a case that I am trying to avoid tracking. TL;DR - I'm trying to track a spell cast done 1) before a combat, but that initiates a combat and 2) during a combat. + the current code is conceptually wrong. Quote:
Thanks a lot :D |
Quote:
And this is why my code is conceptually wrong at the moment. PLAYER_REGEN_DISABLED event is fired after COMBAT_LOG_EVENT_UNFILTERED event with SPELL_CAST_SUCCESS :( |
Perhaps have the destination target checked to see if it's attackable/hostile with the initial spell cast?
|
Quote:
Code:
if subEvent == "SPELL_CAST_SUCCESS" and (UnitCanAttack("player", "target") or UnitAffectingCombat("player")) then 1. Still tracks any spell casts as long as unit is attackable. 2. Only "target" is considered. Even if you have a target exists, but is not attackable and you cast a spell on "focus", "targettarget" then this won't work. 3. AOE is not considered as well. |
Knowing the last relevant spell before entering combat is not so easy. One thought on how to implement it.
During non-combat, store in local to the lua file variable with the last casted spell and timestamp. When entering combat, verify that it is relevant by checking that there's small time difference between timestamp and current time. This way you would also be able to collect statistics about spells with which you initiate combat. The other thing is whether you want to track only one spell preceding combat, or, for example, on use trinkets, racials (e.g, berserking), potion usage, etc. as well. Does not solve extra action bar spell issue. |
Here is a sample of how it might be done, I threw it together real quick so it is without guarantee.
It will wait 1.5 seconds, global cooldown, after a spell cast waiting to see if you had entered combat. Lua Code:
|
All times are GMT -6. The time now is 04:34 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI