Quantcast
Download
(6 Kb)
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,461
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)


Archived Files (1)
File Name
Version
Size
Author
Date
1.0
6kB
apollo0510
05-30-19 08:50 AM


Post A Reply Comment Options
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 Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view AddOns

Forum posts: 975
File comments: 212
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: