WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   LibBabble-Spell substitute? (https://www.wowinterface.com/forums/showthread.php?t=55847)

aallkkaa 11-14-17 04:40 PM

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?

myrroddin 11-14-17 07:19 PM

Just use GetSpellInfo().

aallkkaa 11-15-17 06:21 AM

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?

lightspark 11-15-17 10:43 AM

But why don't you use spell IDs instead? o_O

Seerah 11-15-17 02:22 PM

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. }

aallkkaa 11-15-17 03:11 PM

Quote:

Originally Posted by lightspark (Post 325814)
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.

aallkkaa 11-15-17 03:23 PM

Quote:

Originally Posted by Seerah (Post 325817)
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... :cool:

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.

benots4 11-20-17 06:26 PM

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.

aallkkaa 11-21-17 07:14 PM

Quote:

Originally Posted by benots4 (Post 325883)
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.

Quote:

Originally Posted by benots4 (Post 325883)
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).

Quote:

Originally Posted by benots4 (Post 325883)
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.

benots4 11-22-17 07:40 AM

Localization is good so have at it. :)


All times are GMT -6. The time now is 05:05 AM.

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