C_AlliedRaces.GetAllRacialAbilitiesFromID(raceID)
Is it just me or does this function return nil on live and wrong/old spellname (racial name for humans was changed) on beta? I dont have a allied race yet to test. Perhaps on live it works only for allied races?
For Clickzz I try to build a spell list you can bind your clicks to. Since some spells from general tab in spellbook are usefull in combat, too I thought to use this function to identify the racial spell with this.
As a temporary fix I use the icon to check. But thats a little bit too hacky
Lua Code:
local racialSpells = {} -- Beta returns the old names with C_AlliedRaces.GetAllRacialAbilitiesFromID(raceID)
local function isRacialSpell(spellIcon) -- Replace spellIcon with spellName once the bug is fixed
-- local name, rank, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(spellName)
-- print('start',spellIcon)
for k, v in pairs(racialSpells) do
-- local nameR, rankR, iconR, castTimeR, minRangeR, maxRangeR, spellIdR = GetSpellInfo(v)
-- print(' check',v)
if(v == spellIcon) then
return true
end
end
end
local function buildRacialSpells()
local raceName, raceFile, raceID = UnitRace('player')
local res = C_AlliedRaces.GetAllRacialAbilitiesFromID(raceID)
if(res) then
for k, v in pairs(C_AlliedRaces.GetAllRacialAbilitiesFromID(raceID)) do
if(type(v)=='table') then
if(not IsPassiveSpell(v['name']) and not isRacialSpell(v['icon'])) then -- Replace icon with name once the bug is fixed
racialSpells[#racialSpells+1] = v['icon'] -- Replace icon with name once the bug is fixed
end
end
end
end
end
local function buildSpells(self)
if(InCombatLockdown()) then
self:RegisterEvent("PLAYER_REGEN_ENABLED")
return
end
local currentSpec = GetSpecialization()
if currentSpec then
local classInfo = C_CreatureInfo.GetClassInfo(select(3,UnitClass('player')))
buildRacialSpells()
local _, currentSpecName = GetSpecializationInfo(currentSpec)
db['spells'] = {}
for tabIndex = 1, GetNumSpellTabs() do
local name, texture, offset, numEntries, isGuild, offspecID = GetSpellTabInfo(tabIndex)
if(name == currentSpecName or name == classInfo['className'] or tabIndex==1) then
if(offspecID==0) then
for spellIndex = offset + 1, offset + numEntries do
local skillType, special = GetSpellBookItemInfo(spellIndex, BOOKTYPE_SPELL)
if(skillType=="SPELL" and not IsPassiveSpell(spellIndex, BOOKTYPE_SPELL)) then
local spellName, spellSubName = GetSpellBookItemName(spellIndex, BOOKTYPE_SPELL)
-- print(spellName,spellSubName,IsPassiveSpell(spellIndex, BOOKTYPE_SPELL), raceSpell)
local _, _, icon = GetSpellInfo(spellName)
if(not IsAttackSpell(spellName)) then
if(spellSubName and spellSubName ~= "" and not isRacialSpell(icon)) then
-- db['spells'][special] = format("%s (%s)",spellName, spellSubName)
db['spells'][special] = spellName -- Fix when C_AlliedRaces.GetAllRacialAbilitiesFromID(raceID) returns a value
else
db['spells'][special] = spellName
end
end
end
end
end
end
end
end
end