Quantcast
Download
(11 Kb)
Download
Updated: 12-20-17 09:24 AM
Compatibility:
Shadows of Argus (7.3.0)
Updated:12-20-17 09:24 AM
Created:11-19-17 09:00 PM
Downloads:74
Favorites:1
MD5:
7.3.0

Lib: SpellName2SID

Version: 1.0.05
by: aallkkaa [More]

A Bit of Background

LibSpellName2SID was created by twobits and benots4 for ReadySpells (a rotation helper addon, originally by Aldmehr).
Back then, LibSpellName2SID was a dropin replacement to the defunct LibBabbleSpell. I believe there is a place for such an addon still nowadays. As I plan on reviving ReadySpells, I am starting by bringing this library up to date.
The first version of LibSpellName2SID uploaded to WoWInterface was simply twobits / benots4's original version, packaged into itself.


What It Does and What It Does Not

- LibSpellName2SID does NOT intend to replace GetSpellInfo()
- LibSpellName2SID does NOT intend to replace GetSpellBookItemInfo()

- LibSpellName2SID does intend to replace this:

Lua Code:
  1. local spells = {
  2.         345679 = true,     --spell name
  3.         906723 = true,     --other spell name
  4. }
with this:
Lua Code:
  1. LibspellName2SID.ID = {
  2.         ["spell name"] = 345679 ,
  3.         ["other spell name"] = 906723 ,
  4. }


API:
Enable in your addon:
local Lib = LibSpellName2SID;
Available API:
Lib.ID["EnglishSpellName"] -- Spell ID of English Spell Name
Lib.LSN["EnglishSpellName"] -- Localized Spell Name
Lib.GetNumSpells() -- Get the number of spells in the database
Lib.Cleanup() -- Clean up the database (remove from RAM)


Latest Releases

1.0.05: First public release as an usable standalone library (albeit still betaish-quality).

1.0.02: First WoW-7.x usable version.
Includes:
- All Classes' baseline spells (excl. Passives);
- All Classes' (PVE) talent spells (excl. Passives);
- All Racial Abilities and other spells found on a character's General tab (excl. Passives);
- All (?) Classes' Combat Pet abilities (Standard Pet abilities (Assist, Attack, etc) excluded;
Hunter pets' Passives included;
Other classes pets' Passives (?) excluded.).
Still missing:
- Almost all Artifact Weapon Abilities (Shaman and Demon Hunter included);
- All PVP Honor Talent Abilities.
In paralel WIP:
- LibSpellName2SID-Populator: A development-helper addon whose purpose is to populate LibSpellName2SID with the lists mentioned above. It's still in Alpha state, but will eventually be published, sp. if I can't
figure out how to retrieve the missing spells if they aren't active on a given character - will need your help!

1.0.00: twobits/benots4's WoW 3.x-5.x version that was included in ReadySpells.

1.0.05 -r39-- First public release as an usable standalone library (albeit still betaish-quality).

1.0.02a -r29-- First (alpha) version usable with WoW-7.x.
*Includes*:
- All Classes' baseline spells (excl. Passives);
- All Classes' (PVE) talent spells (excl. Passives);
- All Racial Abilities and other spells found on a character's General tab (excl. Passives);
- All (?) Classes' Combat Pet abilities (Standard Pet abilities (Assist, Attack, etc) excluded; Hunter pets' Passives included; Other classes pets' Passives (?) excluded.).
*Still missing*:
- Almost all Artifact Weapon Abilities (Shaman and Demon Hunter included);
- All PVP Honor Talent Abilities.
*In paralel WIP*:
- LibSpellName2ID-Populator: A development-helper addon whose purpose is to populate LibSpellName2ID with the lists mentioned above. It's still in Alpha state, but will eventually be published, sp. if I can't figure out how to retrieve the missing spells if they aren't active on a given character - will need your help! ;)

1.0.00 -r7--- twobits/benots4's WoW 3.x-5.x version that was included in ReadySpells.
Archived Files (1)
File Name
Version
Size
Author
Date
1.0.00
2kB
aallkkaa
11-19-17 09:00 PM


Post A Reply Comment Options
Unread 11-20-17, 02:58 PM  
aallkkaa
A Cyclonian
 
aallkkaa's Avatar
AddOn Author - Click to view AddOns

Forum posts: 44
File comments: 10
Uploads: 1
Originally Posted by p3lim
I meant like using the 7th return from GetSpellInfo to get the spellID, like so:

Lua Code:
  1. local spells = {
  2.     'Hurricane',
  3.     'Entangling Roots',
  4. }
  5.  
  6. for _, spellName in next, spells do
  7.     print(select(7, GetSpellInfo(spellName))) -- prints the spellID
  8. end

As a replacement for the lib.
On a non-English client (I installed a language pack for the effect), I tried
Code:
/run print(GetSpellInfo("Lightning Bolt"))
and got nothing. Using the localized name of "Lightning Bolt" did work, as expected.
So yeah, that's the problem. For what I can tell, using the English spell name in a non-English client will return no info on the hard-coded English spellname.

What you posted is however how I intend to get the IDs to populate this library.
Last edited by aallkkaa : 11-20-17 at 03:00 PM.
Report comment to moderator  
Reply With Quote
Unread 11-20-17, 12:10 PM  
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1626
File comments: 1219
Uploads: 30
I meant like using the 7th return from GetSpellInfo to get the spellID, like so:

Lua Code:
  1. local spells = {
  2.     'Hurricane',
  3.     'Entangling Roots',
  4. }
  5.  
  6. for _, spellName in next, spells do
  7.     print(select(7, GetSpellInfo(spellName))) -- prints the spellID
  8. end

As a replacement for the lib.
Report comment to moderator  
Reply With Quote
Unread 11-20-17, 11:00 AM  
aallkkaa
A Cyclonian
 
aallkkaa's Avatar
AddOn Author - Click to view AddOns

Forum posts: 44
File comments: 10
Uploads: 1
The addon this is primarily meant for, ReadySpells, has two possible sources for spell lists: User-created priority lists and Addon-default priority lists. The later are hard-coded into the addon as English spell names.

It's true said default lists could be used with spell IDs instead. And because, as it seems to me, as far as updating ReadySpells goes, the main work will be on updating those lists anyway, it would be the perfect time to do that change.
But, for maintainng these lists in the future, the spell names are easier to edit and reorder. For this purpose, we could use what Seerah suggested in the forum thread I linked in the addon's description:
Originally Posted by Seerah View Post
SpellIDs > spall names

If you're talking about keeping track of which ID is for which spell when you look at your code later, then make a note of it in your code.

Lua Code:
  1. local spells = {
  2.      345679 = true,     --spell name
  3.      906723 = true,     --other spell name
  4. }
I presume this is how people are implementing this.
But the above example by Seerah looks a lot like this, from the (old) LibspellName2SID:
Lua Code:
  1. LibspellName2SID.ID = {
  2.     -- Druid
  3.     ["Entangling Roots"] = 339,
  4.     ["Hurricane"] = 16914,
  5. -- snip
  6. }
So, it seems to me, the amount of work in making the "reference" list of spells in Seerah's example is similar to the amount of work in making the "reference" list in LibspellName2SID. But the later allows for the direct use of English spell names in the code, with no need to go looking up what spell corresponds to a given spell ID.
It's just a lazyer way of doing it, I guess.
Last edited by aallkkaa : 11-20-17 at 11:00 AM.
Report comment to moderator  
Reply With Quote
Unread 11-20-17, 09:13 AM  
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1626
File comments: 1219
Uploads: 30
Why not use the 7th return from GetSpellInfo?
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: