WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Need a table SpellName = SpellID (https://www.wowinterface.com/forums/showthread.php?t=51819)

Basil2 02-02-15 08:28 AM

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?

Rilgamon 02-02-15 09:01 AM

With GetSpellInfo you get the localized name.
http://wow.gamepedia.com/API_GetSpellInfo

sirann 02-02-15 10:34 AM

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?

Duugu 02-02-15 12:14 PM

http://www.wowace.com/addons/libplayerspells-1-0/ could be worth a look.

Phanx 02-02-15 02:12 PM

Quote:

Originally Posted by Basil2 (Post 305950)
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. :p

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?

TOM_RUS 02-02-15 04:12 PM

Quote:

Originally Posted by Basil2 (Post 305950)
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?

Quote:

Originally Posted by Basil2 (Post 305950)
So I can't write GetSpellCooldown("Riptide") but
GetSpellCooldown(61295). However this is not informative at all.

Put a comment...

Basil2 02-03-15 01:26 AM

Quote:

Originally Posted by Phanx (Post 305969)
There are some 200,000 spells in the game. I seriously doubt you need all of them. :p

Ouch. Yes I don't need them all :)

Quote:

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

Choonstertwo 02-03-15 03:10 AM

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

Resike 02-03-15 06:40 AM

Quote:

Originally Posted by Basil2 (Post 305998)
Addon plays arena as resto shaman.

Saaaay what?

Phanx 02-03-15 11:30 PM

Quote:

Originally Posted by Choonstertwo (Post 306004)
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:

Quote:

Originally Posted by Basil2 (Post 305998)
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.

Basil2 02-04-15 01:02 AM

Quote:

Originally Posted by Phanx (Post 306042)
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.

Basil2 02-04-15 01:37 AM

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?

coree 02-04-15 01:51 AM

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.

Phanx 02-04-15 03:27 AM

Quote:

Originally Posted by Basil2 (Post 306052)
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 :p). 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).

SDPhantom 02-05-15 01:15 PM

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 times are GMT -6. The time now is 08:12 PM.

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