WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Browse GetSpellInfo ? (https://www.wowinterface.com/forums/showthread.php?t=34347)

Taudier 08-06-10 11:04 AM

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 ?

Jabar 08-06-10 12:37 PM

I may have misunderstood but I don't really see the point of looping through every spells.
What are you precisely trying to do ?

Xrystal 08-06-10 01:07 PM

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.

Taudier 08-06-10 02:06 PM

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

Xrystal 08-06-10 02:42 PM

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.

SDPhantom 08-06-10 03:31 PM

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.

Taudier 08-06-10 04:49 PM

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 :)

SDPhantom 08-06-10 11:20 PM

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.


All times are GMT -6. The time now is 08:27 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI