Thread Tools Display Modes
11-14-17, 04:40 PM   #1
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
LibBabble-Spell substitute?

Hello,

I'm looking at reviving an old addon (I haven't contacted the former developpers yet, need to see whether I can actually hold up with the work needed). This addon used LibBabbleSpell, well, sort of. The latest version of the addon is considerably more recent than the last version of LibBabbleSpell, and thus there was a half-done replacement to the library included in the addon itself. It seems to work, but needs the whole list of class spells updated.
So I was thinking whether there is such an up to date library, one that would allow an addon to look up a spell by its English name and get its spellID (meaning you could then get the localized version of it by its ID).

Does such an up to date library exist?
  Reply With Quote
11-14-17, 07:19 PM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Just use GetSpellInfo().
  Reply With Quote
11-15-17, 06:21 AM   #3
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
I did try this on the console, in a non-English client:
Code:
/run print(GetSpellInfo("Lightning Bolt"))
Doesn't work. Does of course work fine with the localized name of "Lightning Bolt" in its place.

FYI: The addon I'm working on reviving is a rotation helper, with some default lists included. I could include them as spellIDs (and given as I'll likely be doing the search to make the [englishSpellName] = spellID lists, the amount of work for one or the other will basically be the same), but it would make it easier to use the spell names, to maintain the default lists in the future.

Is my logic missing something?
  Reply With Quote
11-15-17, 10:43 AM   #4
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
But why don't you use spell IDs instead? o_O
__________________
  Reply With Quote
11-15-17, 02:22 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
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. }
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
11-15-17, 03:11 PM   #6
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
Originally Posted by lightspark View Post
But why don't you use spell IDs instead? o_O
Because using spell names would make it easier to update lists of priority-based spells, as their requirements, impacts and whatnot change over time.
It's not the most important feature of the addon to me. The users can still choose their own preferred spells and respective priorities and conditions to build the lists; but some might not want to bother and it's nice to have a starting base anyway.

The current lists pf priorities (in the addon) are very outdated, so I'll pretty much have to rebuild them all from the start. GetSpellInfo() doesn't give enough information to construct a list of priorities, thus I'll have to construct it manually.
  Reply With Quote
11-15-17, 03:23 PM   #7
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
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. }
Yes, Seerah, that is exactly what it's for. Only, given as I'll have to do that, I might as well link the name to the ID in the table, and then use the spell name for the ordering.

Ok, I should probably have talked to the former authors before asking this question here, but the addon I'm looking at is ReadySpells, which is available here on WoWI (two versions here, I'm referring to the most recent one, by benots4 ). If you look at that code, you'll notice they made a LibBabbleSpellStub to work around the lack of an up to date LibBabbleSpell. So, I can just work on that, which will be very similar to adding comments to the list of spells, as you kindly examplified - but had someone already done that, then...

Again, I don't know whether I can actually bring the whole thing up to date. So far, on my own PC only, I've updated the libraries (except for the one mentined in this thread, of course) and been more or less randomly browsing the code, changing a line here or there. The code was rather inconsistent (several different people doing what I plan to do, but on a small scale); I really want to try and make it all consistent before I ask the authors permission to release an update.

EDIT: By the way, the old MoP version of the addon still works in Legion (albeit needing you to edit the lists), even with the old libraries! The new librarires don't break it either. I've noticed a couple small glitches but other than outdated spells and, in a way, types of conditions, it still pretty much works fine. And it's the closest I've seen to what I want from a rotation helper.
EDIT #2: Fixed a couple typos.

Last edited by aallkkaa : 11-16-17 at 08:15 AM.
  Reply With Quote
11-20-17, 06:26 PM   #8
benots4
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 20
seems like a lot of maintenance to keep spell IDs. Readyspells gets the spell names from the spell book. Which would already be localized. without maint. The next expac the spell ID list needs to be rebuilt. If/When Vanilla comes back the what, keep two spell id lists? or just use the spell book.

Also using the spell book means the user is only presented with the spells they have. As spells are learned they can be added to the rotation without ever leaving the game.

If I were going to spend my time I would change readyspells to use the button bars. That way trinkets, Macros, flasks, etc could be used as well as spells.
  Reply With Quote
11-21-17, 07:14 PM   #9
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
Originally Posted by benots4 View Post
seems like a lot of maintenance to keep spell IDs. Readyspells gets the spell names from the spell book. Which would already be localized.
Yes, it does and they are, but only to build the list of "Available spells". From the standpoint of configuring ReadySpells from scratch, what I'm talking about is unnecessary, indeed.
BUT that's not what I'm talking about. I'm talking about the default lists that ReadySpells loads if there is none configured by the user yet. I'm talking about lines 1176 through 1498 in Core.lua, in your latest public release.
Those lists aren't even consistently built from class to class (though they seem to all work, for the spells whose names have been kept since MoP). Amongst other differences, some use the BabbleSpellStub twobits created and some others don't.

Originally Posted by benots4 View Post
without maint. The next expac the spell ID list needs to be rebuilt. If/When Vanilla comes back the what, keep two spell id lists? or just use the spell book.

Also using the spell book means the user is only presented with the spells they have. As spells are learned they can be added to the rotation without ever leaving the game.
Again, that is the preferred way (actually the only way) to present the player with the list of spells they can copy-paste to their watchlists/slots. That will still be in the addon.
What I'm talking about is that little push that is putting some of those spells in minimally organised watch lists by default, if and only if the player themselves haven't configured anything yet.
It's a nice and common feature, and ReadySpells has it already. I'm only trying to work on making this feature (not the generic way of acquiring spells) a little easier to maintain in the future.
I'm also working on a little tool to populate the library ( Lib: SpellName2ID ). By the weekend, I should have a new version of the library (and the populating tool) working and integrated into ReadySpells (in the SVN).

Originally Posted by benots4 View Post
If I were going to spend my time I would change readyspells to use the button bars. That way trinkets, Macros, flasks, etc could be used as well as spells.
That's a very good idea. I'll have a look at that as soon as I can.
  Reply With Quote
11-22-17, 07:40 AM   #10
benots4
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 20
Localization is good so have at it.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » LibBabble-Spell substitute?

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