Use this function to get spellid:
function GetSpellID(spellname)
local i,done,name,id,spellrank=1,false;
_,_,spellrank = string.find(spellname,"%((Rank %d+)%)");
spellname = string.gsub(spellname,"%(Rank %d+%)","");
while not done do name,rank = GetSpellName(i,BOOKTYPE_SPELL);
if not name then done=true;
elseif (name==spellname and not spellrank) or (name==spellname and rank==spellrank) then id = i;
end i = i+1;
end
return id
end
--
to use:
id = GetSpellID("Overpower")
id = GetSpellID("Heroic Strike(Rank 2)")
Hmm do warrior skills have ranks? Ranks is optional in the function. If you don't give it one, it will return the highest rank. Or nil if the spell can't be found. (and spell+rank if rank is explicitly declared)
If not sure how to use it, wrap it in a minimal addon. Make the two files with the
bold filenames and stick them in a directory called Startup under AddOns:
Startup.toc
## Interface: 1600
## Title: Startup
## Notes: Executes startup scripts
Startup.xml
Startup.xml
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script>
function GetSpellID(spellname)
local i,done,name,id,spellrank=1,false;
_,_,spellrank = string.find(spellname,"%((Rank %d+)%)");
spellname = string.gsub(spellname,"%(Rank %d+%)","");
while not done do name,rank = GetSpellName(i,BOOKTYPE_SPELL);
if not name then done=true;
elseif (name==spellname and not spellrank) or (name==spellname and rank==spellrank) then id = i;
end i = i+1;
end
return id
end
</Script>
</Ui>
Then you can use GetSpellID within scripts. Tho be aware that the numbers returned won't be the same for everyone. The closest is at 60 when everyone has almost all their spells.