Download
(30Kb)
Download
Updated: 01-28-20 12:50 PM
Compatibility:
Visions of N'Zoth (8.3.0)
Rise of Azshara (8.2.0)
Updated:01-28-20 12:50 PM
Created:11-19-17 09:00 PM
Downloads:3,126
Favorites:3
MD5:
Categories:Libraries, Buff, Debuff, Spell

LibSpellName2SID

Version: 1.1.11b
by: aallkkaa, benots4

A Bit of Background

LibSpellName2SID was created by twobits and benots4 for ReadySpells (a rotation helper addon, originally by Aldmehr - his last release, future ReadySpells updates will be on this page).
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/download...-Passives.html ) includes the database for passive spells;

IMPORTANT: On both LibSpellName2SID and LibSpellName2SID-Passives, the API has changed from that used in 1.0 to the one in current 1.1. Please use the new methods/references as outlined bellow:
Enable in your addon
local Lib = LibStub("LibSpellName2SID-1.1"):NewInstance(YouNameIt (string));
and/or
local LibP = LibStub("LibSpellName2SID-1.1-Passives"):NewInstance(YouNameIt (string));
Remove your addon's instance of the library
Lib:RemoveInstance(YouNameIt (string), DontErrorOnInexistent (optional boolean));
and/or
LibP:RemoveInstance(YouNameIt (string), DontErrorOnInexistent (optional boolean));

Available API
Lib.clients[YouNameIt].SID["EnglishSpellName"(string) or SpellID(number)] -- Returns the Spell ID of English Spell Name
Lib.clients[YouNameIt].LSN["EnglishSpellName"(string) or SpellID(number)] -- Returns the Localized Spell Name of English Spell Name
Lib.SetFaction(faction, YouNameIt) -- Set which faction version of spells that have the same name but different IDs to return via SID[spell] - If this function is not used, the faction will default to the same as the player's.


Bug reports and Feature requests

Bug reports: http://www.wowinterface.com/portal.p...646&a=listbugs

Feature requests: http://www.wowinterface.com/portal.p...a=listfeatures


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

1.1.11b (SVN r192)
- .TOC and Database updated (to 80300, 33115);
- Added Bloodlust and Heroism spell Ids modified by the PvP talent: Shamanism;
- Added Mechagnome and Vulpera racials.
Still TODO:
- Add the Azerite Essences introduced in WoW 8.3.0;
- Check and add for new Hunter Pet Families / Family Spells' changes;
- Add automatic runtime checks for (default) spell ID for active Azerite Essence Ranks, Bloodlust/Heroism spell Id (dependent on presence/absence of Shamanism) etc.

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

1.1.11b (SVN r192)
- .TOC and Database updated (to 80300, 33115);
- Added Bloodlust and Heroism spell Ids modified by the PvP talent: Shamanism;
- Added Mechagnome and Vulpera racials.

1.1.10 (SVN r180)
.TOC and Database updated (to 80205, 32028/32079)

1.1.09 (SVN r177)
- Updated databases to game build 31478 (Live 8.2.0), except Horde Allied Races = 31599 (PTR 8.2.5);
- Draenor Passive ZoneAbility "Silver Dollar Club" added;
- Faction-specific spells that have the same name, but different Ids (namely some Mage Portals and Teleports), are now accessible, not only through SID and LSN (as before), but also directly from the DB as well;
- Actives, Passives and Populator: Now include LICENSE.txt file (MIT).

1.1.08 (SVN r170)
LibSpellName2SID: Database bugfix: Wrong spell name fixed; had "Reality Shift" (Minor power), now corrected to "Ripple in Space";
LibSpellName2SID-Passives: All four ranks of the Azerite Essences' Minor Powers are now in the database.

1.1.07 (SVN r169)
All four ranks of Azerite Essences added to the database of player-castable spells (the Passives database should hopefully be uploaded in a day or two).

1.1.06 (SVN r168)
- All Rank 1 Azerite Essences in the databases (both with and without "(Rank 1)" appended to their base names);
- Hunter Pet-family "Nether Ray" renamed to "Ray", in accordance with the same change in WoW 8.2.0.

1.1.05 (SVN r164)
- Databases now includes the Azerite Essences classified as "Essences Used by All Roles" in https://www.wowhead.com/guides/heart-of-azeroth-essence-overview#list-of-all-essences .

1.1.04 (SVN r162):
- Database and .TOC updated to work with WoW 8.2.0 (but only a couple of the "Azerite Essences" (spells) are on the database - will add the remainder ASAP);
- Database structure slightly changed ("METADATA" is now on a separate subfolder);
- Bugfixes.

1.1.03 (SVN r152):
Now includes the "new" (WoW 8.1) Hunter Pet, "Blood Beast", special ability: "Blood Bolt".
LibSpellName2SID-1.1-Passives remains unchanged at version 1.1.02.

1.1.02 (SVN r150):
- NEW function: Lib:RemoveInstance(instanceName (string), DontErrorOnInexistent (optional boolean));
- New files on both LibSpellName2SID and LibSpellName2SID-Passives, both named test4.lua.

1.1.01 (SVN r146):
- The two libraries are now referenced as LibSpellName2SID-1.1 and LibSpellName2SID-1.1-Passives, leaving, eventually loaded, older 1.0 versions of the libraries, (LibSpellName2SID and LibSpellName2SIDPassives) loaded as they were;
- Added the Death Knight spell, learned from a tome, "Corpse Exploder" = ID:127344.

1.1.00 (SVN r131):
- Database up to date with WoW 8.1.5 (build 29981);
- New API now references each "copy" of the library as an instance registered by the client addon;
- The new API fixed the issues with conflicting versions of this library and the earlier aproaches to that problem;
- Other fixes and improvements.

1.0.14a (SVN -r120-
- Better support for WoW-8.0.1's new spells (Hunter Pets, Mage Portals, Teleports and Polymorph Variants, etc);
- Several miscelaneous bugfixes (please see SVN history for details);
- Maintains the better handling of conflicting versions of the library introduced in 1.0.13b (which solved a problem but brought up a new one for which a fix is not available yet).

1.0.13b -r107-
- Better handling of conflicting versions of the library (when different versions are embeded with different addons);
- The database now dynamcally includes Alliance or Horde spell IDs for some spells with the same name (e.g. "Portal: Tol Barad"). The faction can be set via NEW function library.SetFaction(faction). Faction defaults to the Player's faction if none is selected. Sufixing the spell name with "(Alliance)" or "(Horde)" still works as it did before;
- NB: The list of spells in the DB has NOT been updated since 1.0.12, with the exception of a typo on "Teleport: Vale of Eternal Blossoms(Alliance)".

1.0.12 -r102-
- Fixed the BROKEN database introduced in version 1.0.11b;
- Fixed some issues with LibSpellName2SID-Passives' registration with LibStub (amongst other bugs);
- Cleaned up a couple of old WoW-7.3.5 spells that had been hardcoded into the library and no longer exist in 8.0.1;
- Small improvements to the lookup algorithm.

1.0.11b -r98-- BROKEN! Please update to 1.0.12 or later!
- Database updated with WoW 8.0.1 spells;
- General tab spells categorized as one of either "GuildPerks", "Racials", "ZoneAbilities" or "Others";
- Hardcoded a few more spells;
- Database structure and lookup functions slightly improved (more to do later).

1.0.10 -r91--
- When installed as a standalone library, it is now LoadOnDemand (set on the .toc file);
- Added (all?) Flyout spells (Hunters' 'Pet Utility', Mages' 'Portal', etc);
- Added (all?) Pet spells.

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.
Post A Reply Comment Options
Unread 11-20-17, 02:58 PM  
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view AddOns

Forum posts: 98
File comments: 32
Uploads: 3
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: 1710
File comments: 1222
Uploads: 43
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 Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view AddOns

Forum posts: 98
File comments: 32
Uploads: 3
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: 1710
File comments: 1222
Uploads: 43
Why not use the 7th return from GetSpellInfo?
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: