Thread Tools Display Modes
08-20-08, 07:22 PM   #1
lieandswell
A Cyclonian
 
lieandswell's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 45
How to get textures for any buff by name?

Is there a way to get the icon texture for any buff or debuff, by name, before it's actually present? So, for example, a way to get the icon texture for the Lust for Battle buff from the Bloodlust Brooch trinket, whether or not you have the item, and whether or not you've used it. Or the texture for the Well Fed buff, before you eat the food.

GetSpellTexture() and GetSpellInfo() only work for buffs from spells you can actually cast, if you use spellName. Maybe there's a database that allows you to translate spellName -> spellID?
  Reply With Quote
08-20-08, 07:32 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
If you look it up on a site like WoWHead, the id numbers at the end of the url are the spell id (same with items/item ids).
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-21-08, 07:48 AM   #3
lieandswell
A Cyclonian
 
lieandswell's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 45
Well, I need to be able to do it in-game, based on user input. I'm making a buff notification addon, so (for example) a warrior could type in "Battle Shout" and the addon would have a big battle shout icon appear when the buff expires and needs to be refreshed. It doesn't seem like I should have to code in every single buff by hand.
  Reply With Quote
08-21-08, 07:57 AM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
It's not possible to get buff textures before the buff applies ingame.

You'll have to add all relevant buff names and texture path to your mod manually. :/

[Edit]
Why not use the buff names instead of buff textures?

Last edited by Duugu : 08-21-08 at 08:03 AM.
  Reply With Quote
08-21-08, 03:41 PM   #5
Freki
A Deviate Faerie Dragon
 
Freki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
You can do this: create a table with the raw spell names, and then every time a COMBAT_LOG_EVENT fires for some kind of spell event, get the spell name from that using GetSpellInfo(spellId).. if it matches anything in your spell name table, you have the spell ID you need.
  Reply With Quote
08-21-08, 08:51 PM   #6
arkayenro
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 12
Originally Posted by Freki View Post
You can do this: create a table with the raw spell names, and then every time a COMBAT_LOG_EVENT fires for some kind of spell event, get the spell name from that using GetSpellInfo(spellId).. if it matches anything in your spell name table, you have the spell ID you need.
i think they want to present the user a list of buffs to watch for with their icons next to them, which they wont know at that point.

you could start out with just displaying the names and as you "learn" the textures (as per the above) add them to your saved variables and then display those that you know. might look a bit weird at first though with only some stuff having icons, depends how you code the ui.

and you can always pre-populate the table if required. or ask the users to submit their saved variables to you so that you can merge them all back into your default, thats pretty easy to code.
  Reply With Quote
08-22-08, 09:38 AM   #7
Freki
A Deviate Faerie Dragon
 
Freki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 18
Originally Posted by arkayenro View Post
i think they want to present the user a list of buffs to watch for with their icons next to them, which they wont know at that point.

you could start out with just displaying the names and as you "learn" the textures (as per the above) add them to your saved variables and then display those that you know. might look a bit weird at first though with only some stuff having icons, depends how you code the ui.

and you can always pre-populate the table if required. or ask the users to submit their saved variables to you so that you can merge them all back into your default, thats pretty easy to code.
That's how you have to do it I think. Just use a placeholder texture (question mark) until you find the spell ID you need. This is what PowerAuras does, and probably other mods too.
  Reply With Quote
08-23-08, 07:23 AM   #8
lieandswell
A Cyclonian
 
lieandswell's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 45
Another solution i've been considering is to write a separate mod that goes through all the thousands of spellIDs and gets their names using GetSpellInfo(). Then I'd store that in a big table and use it as a database in the other mod to get the spellID when a user types in a spellName. That table might be too big, though.

Otherwise, I think I'll go with the PowerAuras solution and just use the placeholder question mark until the player omes across the buff and the mod learns the texture.

Thanks for your help, btw.
  Reply With Quote
08-23-08, 11:53 AM   #9
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Well ... there are exactly 28.315 spells available. Query them all will take ~3 seconds and store id, icon path, and name per spell will take ~ 6 MB memory.

3 seconds at onload shouldn't be a problem. But 6 MB?
If you ignore all spells with rank > 1 (should be same as rank 1) you'll need 4 MB only.
You could narrow down the amount of spells. eg. every spell with "(OLD)", or "TEST" in it's name is dispensable. Same should be true with all spells where the icon path is "Interface\\Icons\\Temp". But I guess you'll need at least 3 MB memory to store all relevant spells.

[edit]
Why not starting with an empty table? If the player types in a spell name query all spells (will take ~ 3 seconds) and search for the spell name. Of course there will be a delay of app. 3 seconds every time the player adds a new spell. But who cares?

Last edited by Duugu : 08-23-08 at 12:05 PM.
  Reply With Quote
08-25-08, 07:43 AM   #10
kerrang
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 109
Originally Posted by lieandswell View Post
Well, I need to be able to do it in-game, based on user input. I'm making a buff notification addon, so (for example) a warrior could type in "Battle Shout" and the addon would have a big battle shout icon appear when the buff expires and needs to be refreshed. It doesn't seem like I should have to code in every single buff by hand.
Reading your original question - and then that statement - why would any player ever want notification of a buff/item cooldown expiry for a buff/item they DON'T have???

Your original question - how to get icons for items/spells a player does not have - it's basically impossible or VERY VERY difficult (e.g. you hardcode it all) - but why would you need this?

GetSpellInfo will always return the icon for a spell a player actually HAS - and always for spellids (but not spellnames)

GetItemInfo is more of a problem because items a player OWNS may not actually be in the itemcache the first time you ask - but simply check it and if you get no result, check it again on the next ON_UPDATE event and it should be there (not a noticeable delay to the user anyway).

or am I missing something - why do you need icons for spells/items you don't have?

p.s. things like 'Well Fed' you can get icons for - you just need to refer to them by spellid (which always works) and not spellname...

For non-rank-dependant stuff you should always use spellids anyway - spellnames need translation/localisation - spellids don't...

Last edited by kerrang : 08-25-08 at 07:47 AM.
  Reply With Quote
09-05-08, 10:20 AM   #11
Garstiger
A Kobold Labourer
 
Garstiger's Avatar
Join Date: Sep 2008
Posts: 1
Install http://us.blizzard.com/support/artic...rticleId=21466

Get the Interface Arts. Then u have a folder:

C:\World of Warcraft\Blizzard Interface Art (enGB)

In this folder are all Graphics that u need.
u can call then
Texture:SetTexture(texture or "texture" or nil)
and use the correct icon before u must use GetTexture()

or i didn't understand ur question.
__________________

Last edited by Garstiger : 09-05-08 at 10:42 AM.
  Reply With Quote
09-06-08, 07:33 AM   #12
lieandswell
A Cyclonian
 
lieandswell's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 45
Your original question - how to get icons for items/spells a player does not have - it's basically impossible or VERY VERY difficult (e.g. you hardcode it all) - but why would you need this?
Well, some example situations where I can imagine it being useful:

- Displaying the cheese icon for Well Fed when you don't have it, to remind you to eat your raid buff food

- Displaying an icon for Sunder Armor, when the mob you're targeting doesn't have it on it, to remind you to wait to dps until your warrior tank has aggro

- A tank having a sheep/shackle icon come up when the mob they've set to focus breaks loose, so that they can know if they need to pick it up.

- Displaying an icon when you're the "bomb", aka Baron Geddon or Murmur. You can get the texture when you actually have the debuff, but not when you're setting up before the pull.

- Displaying the buff icon when you get a clearcasting-type proc, or a buff proc from an enchant/item/metagem, so you can adjust your spell/ability casts to make maximum use of the proc. Again, you can get the texture when you actually have the buff, but not beforehand.

I'm sure there are a bunch more uses. It will depend on each player's situation -- I'm sure they can think of more uses than I can. I'm trying to make the mod to be as user-configurable as possible, so they can use it in new and creative ways I haven't thought of yet.

Things like 'Well Fed' you can get icons for - you just need to refer to them by spellid (which always works) and not spellname...
But players don't know spellIDs. And user text input is way more flexible than a (giant) list of options.

For non-rank-dependant stuff you should always use spellids anyway - spellnames need translation/localisation - spellids don't...
If a player types in the name of the spell/buff/item/whatever, they're effectively localizing it themselves. (As long as they can spell ).

I don't know about you, but I'm very a visual person. Icons and graphics are much easier for me to pay attention to during fights than a bunch of text popping up on my screen. Especially when a raid leader's bossmod is always spamming information that's not important for my class.

In any case, I've got it working now using the "learning" solution (thanks, arkayenro). When you first set up the icon, it has a placeholder texture (the question mark). But then once you see the buff/debuff the icon has the right texture.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How to get textures for any buff by name?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off