Download
(6Kb)
Download
Updated: 05-31-19 03:52 AM
Compatibility:
Classic (1.13.2)
Updated:05-31-19 03:52 AM
Created:05-30-19 08:50 AM
Downloads:1,611
Favorites:6
MD5:

Classic Spell Ranks

Version: 1.1
by: apollo0510 [More]

Are you using addons that need the api GetSpellInfo function ? Well, it is broken atm, because it does not return spell ranks at all. Which is really a problem for classic addons.
So here comes this api hotfix. It is magically adding spell ranks to the GetSpellInfo function.
As soon as Blizzard is patching the client correctly, this addon is no more needed.


For addon developers : please notice, that this version of GetSpellInfo delivers directly integer numbers as ranks or nil. The original api delivered a localized string , and you had to parse it in order to retrieve the spell rank ... . The easiest way is to have a translation table inbetween, that accepts both , strings and numbers. Something like this :


local rank_names=
{
[ 1]=1,[ 2]= 2,[ 3]= 3,[ 4]= 4,[ 5]= 5,[ 6]= 6,[ 7]= 7,[ 8]=8,
[ 9]=9,[10]=10,[11]=11,[12]=12,[13]=13,[14]=14,[15]=15,[16]=16,

["Rank 1" ]= 1,["Rank 2" ]= 2,["Rank 3" ]= 3,["Rank 4" ]= 4,["Rank 5" ]=5,
["Rank 6" ]= 6,["Rank 7" ]= 7,["Rank 8" ]= 8,["Rank 9" ]= 9,["Rank 11"]=10,
["Rank 12"]=11,["Rank 13"]=12,["Rank 14"]=13,["Rank 15"]=15,["Rank 16"]=16,
};

Version 1.1 is no more crashing when using GetSpellInfo with names thanks for the testing !

Optional Files (0)


Post A Reply Comment Options
Unread 06-25-21, 02:54 AM  
3ICE
A Murloc Raider
 
3ICE's Avatar

Forum posts: 7
File comments: 8
Uploads: 0
Minor issue: The zip file should contain a top level folder with the files inside that, and not just the root level lua and toc files.
Something like this: ClassicSpellRanks_1.2.zip\ClassicSpellRanks\ClassicSpellRanks.lua
instead of current: ClassicSpellRanks_1.1.zip\ClassicSpellRanks.lua

Unzip doesn't automatically create an extra folder by default and even if configured to do so, the folder name is wrong.
__________________
Click here for my full signature (Image limit here is 4)

Report comment to moderator  
Reply With Quote
Unread 07-10-19, 01:06 PM  
waldra
A Kobold Labourer

Forum posts: 0
File comments: 3
Uploads: 0
Still a problem with calling GetSpellInfo

Your implementation of GetSpellInfo has two issues

one - parameters
GetSpellInfo can be called with three different formats
GetSpellInfo(spellID)
GetSpellInfo(spellname)
GetSpellInfo(spellname,spellrank)

Since you only have one parameter, you do not support the third format. Attempting to call your GetSpellInfo with a spellrank has no effect.

two - you do not return all the return parameters
the format of GetSpellInfo() is

name, rank, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(spellId or "spellName"[, "spellRank"])

per https://wow.gamepedia.com/API_GetSpellInfo

your function only returns
name, rank, icon, castTime, minRange, maxRange

not the last parameter, spellId

The returned spellId is the spellId of either the rank requested, or the highest trained rank if no rank is specified. I use this to get the highest trained rank of a spell.

I changed your function to:

function GetSpellInfo(spellID,...)
local name,rank,icon,castTime,minRange,maxRange,spell=OriginalGetSpellInfo( spellID,... )
rank = rank or GetSpellRank(spellID)
return name,rank,icon,castTime,minRange,maxRange,spell
end
Last edited by waldra : 07-10-19 at 08:45 PM.
Report comment to moderator  
Reply With Quote
Unread 05-31-19, 03:55 AM  
apollo0510
A Kobold Labourer
AddOn Author - Click to view AddOns

Forum posts: 0
File comments: 1
Uploads: 2
Thumbs up Thanks for testing !

Please test version 1.1, it should do what you want.
Personally, I never use it that way, because combat log or spellbook deliver spellIds.

But thumbs up for testing !
Report comment to moderator  
Reply With Quote
Unread 05-30-19, 10:42 AM  
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view AddOns

Forum posts: 1026
File comments: 213
Uploads: 52
It fixes the spell ranks
But there is a little problem, GetSpellInfo should also be able to support spell name arguments

Edit: GetSpellSubtext(spellID) seems to return the (localized) rank too, eg "Rank 2"

Last edited by Ketho : 05-30-19 at 11:17 AM.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: