Quantcast
Download
(20 Kb)
Download
Updated: 04-24-18 07:23 AM
Compatibility:
Shadows of Argus (7.3.0)
Updated:04-24-18 07:23 AM
Created:11-19-17 09:00 PM
Downloads:667
Favorites:1
MD5:
7.3.0

LibSpellName2SID

Version: 1.0.09b
by: aallkkaa, benots4

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 NOT intend to replace other Blizzard API functions that retrieve information about spells

- 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

Foreword on the Databases
LibSpellName2SID (this addon) includes the database for player-castable spells;
LibSpellName2SID-Passives ( http://www.wowinterface.com/downloads/info24583-LibSpellName2SID-Passives.html ) includes the database for passive spells;

Enable in your addon
local Lib = LibStub:GetLibrary("LibSpellName2SID");

Available API
Lib.ID - DEPRECATED, replaced by Lib.SID
Lib.SID["EnglishSpellName"(string) or SpellID(number) -- Returns the Spell ID of English Spell Name
Lib.LSN["EnglishSpellName"(string) or SpellID(number) -- Returns the Localized Spell Name of English Spell Name
Lib.GetNumSpells() -- Returns the number of spells in the database Temporarily unavailable
Lib.Cleanup() -- Clean up the database (remove from RAM) DEPRECATED


Bug reports and Feature requests

Bug reports: http://www.wowinterface.com/portal.php?uid=335646&a=listbugs

Feature requests: http://www.wowinterface.com/portal.php?uid=335646&a=listfeatures


Latest Release
Click on the "Change Log" tab on the top of this page for the full list.

1.0.09b (SVN r84):
- PVP Talents added for all classes (and Populator fetches them automatically);
- General Tab (Actively cast spells' DB): Added 'Garrison Ability' and 'Vindicaar Matrix Crystal' spells.
TODO:
- Add Flyout spells (e.g. Mage 'Polymorph' variants or Warlock 'Summon Demon');
- Add Artifact weapon spells (currently only Shaman and Demon Hunter are included);
- Check whether two races with the same passive spell (e.g. "Shadow Resistance") actually have the same spell ID (presumed so in the current version);
- Complete the API.

SVN:
svn://svn.wowinterface.com/LibSpellName2SID-1146

1.0.09b -r84--
- PVP Talents added for all classes (and Populator fetches them automatically);
- General Tab (Actively cast spells' DB): Added 'Garrison Ability' and 'Vindicaar Matrix Crystal' spells.

1.0.08b -r73--
- The database is no longer a straight list of "[spellName] = spellID" pairs, but is structured into subtables: Class->Spec+SpecTalents+Pets and GeneralTab->Spells. Main table's name changed from Lib.ID to Lib.DB;
- Lib.SID and Lib.LSN metatables will now take, as lookup-key, either a string (presumably the English Spell Name) or (NEW) a number (presumably the Spell ID), returning its spell ID or localized spell name respectively;
- If the lookup-key can't be found in the database, Lib.SID and Lib.LSN will fall back to returning the result of GetSpellInfo(lookup-key);
- Shaman's Spellbook: Added 'Bloodlust' to the database (previously only 'Heroism' was listed);
- Spellbook's General Tab: Added 'Revive Battle Pet' to the database;
- NEW variant of this addon: LibSpellName2SID-Passives ( http://www.wowinterface.com/downloads/info24583-LibSpellName2SID-Passives.html ) created, with the same version number as LibSpellName2SID. The Passives counterpart's database is made up of the Passive spells. The API is the same;
- A good part of LibSpellName2SID-Populator (developer tool, only available through the SVN) has been rewritten.

1.0.07 -r43--
- Now uses LibStub;
- Fixed an issue where a Lua error would be thrown if Lib:LSN were to be fed an invalid spell name.

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 (4)
File Name
Version
Size
Author
Date
1.0.08b
18kB
aallkkaa
03-19-18 06:45 AM
1.0.07
13kB
aallkkaa
01-19-18 07:07 AM
1.0.05
11kB
aallkkaa
12-20-17 09:24 AM
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 Wyrmkin Dreamwalker
 
aallkkaa's Avatar
AddOn Author - Click to view AddOns

Forum posts: 58
File comments: 13
Uploads: 2
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: 1642
File comments: 1220
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 Wyrmkin Dreamwalker
 
aallkkaa's Avatar
AddOn Author - Click to view AddOns

Forum posts: 58
File comments: 13
Uploads: 2
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: 1642
File comments: 1220
Uploads: 30
Why not use the 7th return from GetSpellInfo?
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: