Quantcast
Browse GetSpellInfo ? - WoWInterface
Thread Tools Display Modes
08-06-10, 11:04 AM   #1
Taudier
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 24
Browse GetSpellInfo ?

Hello, i need to browse every spell with the function (for a buff/debuff filter addon) :
name, rank, icon... = GetSpellInfo(SpellID)

my question is : what is the SpellID max ? when i increment my SpellID one par one, the GetSpellInfo function return a lot of nil value

how should i proceed ?
  Reply With Quote
08-06-10, 12:37 PM   #2
Jabar
Premium Member
 
Jabar's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2008
Posts: 8
I may have misunderstood but I don't really see the point of looping through every spells.
What are you precisely trying to do ?
  Reply With Quote
08-06-10, 01:07 PM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,460
I am sure there will be numbers in the vast sequence of spellIDs that do not exist.

You either read through the buff/debuffs that the player/target/focus/pet etc has and get the SpellInfo from that spellID. I can't see any reason why you would need to cycle through 1 to 999999 to see IF there is a spell there. And remember some spells aren't buffs, so again, your best bet when dealing with buffs/debuffs is to work with the buff/debuff functions before dealing with the respective spell functions.
__________________
  Reply With Quote
08-06-10, 02:06 PM   #4
Taudier
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 24
My goal is to help the user to configure my addon :

the user enters a part of the buff/debuff name and a list of complete names who match this part is returned. it avoids typos problmes
  Reply With Quote
08-06-10, 02:42 PM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,460
Ah, I gotcha.

Some addons either get the user to enter the spellID themselves or the name in complete. The former allows for auto localisation and the latter means it will always be in the users language. They can look up unknown spells from wowhead etc.

The only other thing I can think of is to *learn* the buffs/debuffs as they happen and add them to a database and allow the user to black/whitelist them. Another option that some addons use.

All of these options will be less time consuming/intensive than cycling through 1 million numbers to see if there is a spell attached which may or may not have a buff/debuff linked to it.

However, having not built an addon as in depth as the one it seems you are trying to make I can't think of what else you can do.

But in answer to your question. I would hazard a guess that the max spell ID at present ( I am sure it will change with each expansion ) is 99,999. This is based on Gift of the Naaru being under 60,000 ID. However, seeing as that is a BC spell the numbers may have jumped up even higher.

for spellid = 1,99999 do
local spellName = GetSpellInfo(spellid)
if ( spellName ) then
AddSpellToDB(spellid,spellName)
end
end

The higher the max number the longer the delay in that addon being loaded and others after it. It will mean that users will be at the loading screen longer while your addon generates its database. So bear that in mind and see if one of the other options I mentioned will be more beneficial for your users.
__________________
  Reply With Quote
08-06-10, 03:31 PM   #6
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,924
SpellList does practically the same thing with its spell detection algorithm.

It has 2 modes hard coded in, one scans to the last known SpellID, and the other is for me to find the max SpellID for a given client build. The addon is released using the first mode.

As far as scanning and filtering, it uses a throttling method I developed that makes sure it only uses so much CPU time between frames to ensure the user has a somewhat decent FPS rate while it's working.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
08-06-10, 04:49 PM   #7
Taudier
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 24
Hi !

Thank you for all your replys and ideas,

after runing some test, i found that the last valid SpellID is 80864. it doesn't take so much time to query all SpellID and i don't have any perfomance conditions (only for config purpose) so i think i take this heavy easy way


since the first release of the game, the data base containing the Spell Info have been modified, some spell deleted and that's why so much SpellID returns nil value with the GetSpellInfo(SpellID) function. I guess
  Reply With Quote
08-06-10, 11:20 PM   #8
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,924
I'm not going to speculate about the structure of the spell database, but there are a bunch of them. More than half of them aren't even used by the game anymore. There are a few that were put in as a joke between developers and remain in the database, like Spell ID 897, which points to Summon Angry Programmer.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Browse GetSpellInfo ?

Thread Tools
Display Modes

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