WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Wish List (https://www.wowinterface.com/forums/forumdisplay.php?f=15)
-   -   UnitCastingInfo API and spellID (https://www.wowinterface.com/forums/showthread.php?t=46577)

shurshik 05-29-13 01:50 AM

UnitCastingInfo API and spellID
 
I am missing spell id from the UnitCastingInfo, I don't understand why they didn't included it, maybe I am missing something :)

Vlad 05-29-13 02:41 AM

I would refer you to use the CLEU, but then again it depends on what you try to achieve. :)

But you are right that UnitCastingInfo and UnitChannelInfo don't return a spellID, so you can always try match the spell name instead. Like "if text == GetSpellInfo(12345) then" you get the idea.

Phanx 05-29-13 02:50 AM

If there's a predetermined list of spells you care about (eg. you want to know when your arena opponent is casting a crowd-control spell) then you should just generate a table at runtime mapping the localized name from GetSpellInfo(id) to whatever data you actually want (spellID, true, table of data, function to run when it's seen, etc.) and refer to that table to identify the spell based on the name you got from UnitCastingInfo.

shurshik 05-29-13 02:54 AM

I tried to match spellid by name, but there are spells with the same name and different icon (I need an icon).
I was also trying GetSpellInfo by name, it works only for spells that I can cast :/
I saved all combatlogs Spell_cast_start events to the table and then parse it to get spell id by name, and got some spells that are not present in combat logs (about 1%), and it's difficult to parse it :/

Phanx 05-29-13 02:55 AM

Well, without more specifics about what you're actually doing, it's pretty hard to suggest a more specific solution...

shurshik 05-29-13 03:02 AM

I am tracking all UnitCastingInfo but don't want to waste memory saving all icons and spellnames, just spellid. To get than Spellname, spellid, icon.

I wondered, maybe I can get spellid from the icon url or it doesn't have an id in it, don't remember

Phanx 05-29-13 05:01 AM

It doesn't, and multiple spells can use the same icon. "Tracking all UnitCastingInfo" is still pretty vague, but if you want to keep your project all Top Secret National Security, go for it.

humfras 05-29-13 06:31 AM

For unitIDs, it should be possible to check against the Spell LineID registered via UNIT_SPELLCAST_START.
(arg8 of UnitCastingInfo and arg4 of UNIT_SPELLCAST_START)
e.g. store it like this: spellLineTable[lineID] = spellID

You really should consider posting your code so we can have a closer look.
Since you have Phanx' attention, you should use it for your benefit because she's one of the most skilled/experienced and helpfull members here.

shurshik 05-29-13 06:47 AM

The project is CombatReplay, I save information about players every 0.5 sec, info about their casts I get from UnitCastingInfo, and after the combat I want to show "spell casing" as on video: http://www.youtube.com/watch?v=m3EV36y4SNU

Currently I am tracking also combatlog to temporary save all spells and after fight to change spellnames into spellids, but not all spells are in combatlog :/

There is no code to paste as it's a big project :)

semlar 05-29-13 07:51 AM

What exactly can you not use the combat log to get information about for this project?

Seerah 05-29-13 10:24 AM

Quote:

Originally Posted by semlar (Post 278922)
What exactly can you not use the combat log to get information about for this project?

Yeah, this ^^

Phanx 05-29-13 08:41 PM

Rather than wasting CPU on polling UnitCastingInfo every 0.5 seconds, why not use the events that fire specifically to tell you when someone in your group starts and stops casting a spell? When UNIT_SPELLCAST_START fires for a unit in your group, record the spellID in a table. During your poll, just look at the table to see which (if any) spell the unit is casting. When UNIT_SPELLCAST_SUCCEEDED/STOP/INTERRUPTED fires for a unit in your group, remove the table entry. There's no need for repeated function calls or combat log handling here.


All times are GMT -6. The time now is 07:43 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI