Quantcast Need a table SpellName = SpellID - WoWInterface
Thread Tools Display Modes
02-02-15, 08:28 AM   #1
Basil2
A Murloc Raider
Join Date: Feb 2015
Posts: 8
Need a table SpellName = SpellID

I need my addon to work with any language client. So I can't write GetSpellCooldown("Riptide") but
GetSpellCooldown(61295). However this is not informative at all.

The best IMHO solution is:
Code:
RiptideId = 61295
GetSpellCooldown(RiptideId)
So I am looking for a list like 'RiptideId = 61295' with all spells with their IDs. I guess somebody already did the job by exploring wowhead and preparing such table.

Could you please tell where is such table?
  Reply With Quote
02-02-15, 09:01 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 660
With GetSpellInfo you get the localized name.
http://wow.gamepedia.com/API_GetSpellInfo
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
02-02-15, 10:34 AM   #3
sirann
A Flamescale Wyrmkin
Join Date: Mar 2007
Posts: 142
Could you do some asinine method of making a:

Code:
local spelltable = {}
local checker
for i = 1, 200000 do
     checker = (GetSpellInfo(i))
     if checker then
          spelltable.i = checker
     end
end
and then having ## SavedVariables: spelltable in the wtf?

Load in, exit game, and copy and paste the spelltable read out from the wtf file into excel for readability?
  Reply With Quote
02-02-15, 12:14 PM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
http://www.wowace.com/addons/libplayerspells-1-0/ could be worth a look.
  Reply With Quote
02-02-15, 02:12 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,567
Originally Posted by Basil2 View Post
So I am looking for a list like 'RiptideId = 61295' with all spells with their IDs. I guess somebody already did the job by exploring wowhead and preparing such table.
There are some 200,000 spells in the game. I seriously doubt you need all of them.

There is no "One Best Solution" for all purposes -- what exactly does your addon do, and what does it need a list of spell IDs for?
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
02-02-15, 04:12 PM   #6
TOM_RUS
A Black Drake
Join Date: Sep 2008
Posts: 86
Originally Posted by Basil2 View Post
I need my addon to work with any language client. So I can't write GetSpellCooldown("Riptide") but
GetSpellCooldown(61295). However this is not informative at all.

The best IMHO solution is:
Code:
RiptideId = 61295
GetSpellCooldown(RiptideId)
So I am looking for a list like 'RiptideId = 61295' with all spells with their IDs. I guess somebody already did the job by exploring wowhead and preparing such table.

Could you please tell where is such table?
If your addon needs such table, you are doing something wrong. Spell ID should be enough for ALL cases. Also, what you gonna do with spells that have same name but different id?

Originally Posted by Basil2 View Post
So I can't write GetSpellCooldown("Riptide") but
GetSpellCooldown(61295). However this is not informative at all.
Put a comment...
  Reply With Quote
02-03-15, 01:26 AM   #7
Basil2
A Murloc Raider
Join Date: Feb 2015
Posts: 8
Originally Posted by Phanx View Post
There are some 200,000 spells in the game. I seriously doubt you need all of them.
Ouch. Yes I don't need them all

There is no "One Best Solution" for all purposes -- what exactly does your addon do, and what does it need a list of spell IDs for?
Addon plays arena as resto shaman. So I need to implement very complicated logic with spells collaboration - source with names looks MUCH better with numbers. Having 15 year C++ background I prefer constants to comments
  Reply With Quote
02-03-15, 03:10 AM   #8
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Even though Lua doesn't have constants, there's nothing stopping you from using a normal local variable like a constant:
lua Code:
  1. local RIPTIDE_ID = 61295
  2.  
  3. -- ...
  4.  
  5. if GetSpellCooldown(RIPTIDE_ID) == 0 then
  6.     DoStuff()
  7. end
  Reply With Quote
02-03-15, 06:40 AM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,222
Originally Posted by Basil2 View Post
Addon plays arena as resto shaman.
Saaaay what?
  Reply With Quote
02-03-15, 11:30 PM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,567
Originally Posted by Choonstertwo View Post
Even though Lua doesn't have constants, there's nothing stopping you from using a normal local variable like a constant:
And if you're working with a large number of spells and want to avoid creating 50 variables, you could just use a table:

Code:
local id = {
    EARTH_SHIELD = 974,
    PURIFY_SPIRIT = 77130,
    RIPTIDE = 61295,
}

if GetSpellCooldown(id.RIPTIDE) == 0 then
    -- do stuff
end
But:

Originally Posted by Basil2 View Post
Addon plays arena as resto shaman.
You should probably clarify that comment. If you're writing a bot, that's against the TOS and the rules of this site, and you will not get any further help here.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
02-04-15, 01:02 AM   #11
Basil2
A Murloc Raider
Join Date: Feb 2015
Posts: 8
Originally Posted by Phanx View Post
You should probably clarify that comment. If you're writing a bot, that's against the TOS and the rules of this site, and you will not get any further help here.
Addons cannot cast so it can't be a bot My addon will advise the best spell in the situation by showing it's name and icon. It's like "SpellFlash" addon but for arena.
  Reply With Quote
02-04-15, 01:37 AM   #12
Basil2
A Murloc Raider
Join Date: Feb 2015
Posts: 8
1. I tried to gather spell names, the code above did the job.

However, i got 9 spells named "Riptide", and only second (!) spell had correct number. I can understand 2 spells: spell itself and the buff. But 9 - I dunno what to do.

2. How to reveal buff ID's?
I use UnitBuff to check riptide's buff, now by name. UnitBuff can return spell_id, but what number it is? WowHead tells me about riptide spell id , not buff (it only shows buff info, not id). What to do in that case?

Last edited by Basil2 : 02-04-15 at 01:54 AM.
  Reply With Quote
02-04-15, 01:51 AM   #13
coree
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 28
You can try idTip to get the right spellid for the spells you want to use. Mouseover them and write a table like mentioned before.
  Reply With Quote
02-04-15, 03:27 AM   #14
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,567
Originally Posted by Basil2 View Post
However, i got 9 spells named "Riptide", and only second (!) spell had correct number. I can understand 2 spells: spell itself and the buff. But 9 - I dunno what to do.
There are a number of reasons there can be multiple spells with the same name (and other spells, eg. Mortal Strike, have a lot more than 9). There might be different versions of it for different specs. If it existed before Cataclysm there are probably different ranks of it. Different NPCs might have the same spell with some differences, or no differences at all (because Blizzard Logic doesn't always correlate with normal logic ). At some point the spell might have changed, and Blizzard just created a new ID instead of changing the properties associated with the existing ID.

If you're on Wowhead, the ID you want will usually be obvious based on what category the spell is in. For example, when you search for Riptide you'll see:

- 1 Riptide in "Specialization"
- 5 Riptides in "Uncategorized Spells"
- 5 Riptides in "NPC Abilities"

You can immediately rule out the NPC Abilities, and 3 of the Uncategorized Spells (wrong icon). For player spells the ID you want will usually be the one under Abilities, Specialization, or Talent (depending on what kind of ability it is) but if you're going to use the ID to match buffs or debuffs, it could also be one of the uncategorized versions, since some spells apply an aura with a different ID. In this case, you can rule out the other 2 uncategorized Riptides because their tooltip text is wrong (one heals for a % of max health, one is missing the Chain Heal bonus).
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
02-05-15, 01:15 PM   #15
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,726
The reason mostly for duplicate spells is either unused test versions or spells specifically tuned for different mobs to cast. Remember, the spell database contains everything any entity can do in addition to quest/area triggers. They don't purge the database often. I've only observed this happen once in the 10 years I've been here. Blizzard has only done this when they reorganized it after removing the spell ranks.
__________________
"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 » Developer Discussions » General Authoring Discussion » Need a table SpellName = SpellID

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