Quantcast
Is C_AlliedRaces.GetAllRacialAbilitiesFromID bugged? - WoWInterface
Thread Tools Display Modes
10-05-20, 05:01 AM   #1
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 790
Is C_AlliedRaces.GetAllRacialAbilitiesFromID bugged?

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:
  1. local racialSpells = {} -- Beta returns the old names with C_AlliedRaces.GetAllRacialAbilitiesFromID(raceID)
  2. local function isRacialSpell(spellIcon) -- Replace spellIcon with spellName once the bug is fixed
  3. --  local name, rank, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(spellName)
  4. --  print('start',spellIcon)
  5.     for k, v in pairs(racialSpells) do
  6. --      local nameR, rankR, iconR, castTimeR, minRangeR, maxRangeR, spellIdR = GetSpellInfo(v)
  7. --      print(' check',v)
  8.         if(v == spellIcon) then
  9.             return true
  10.         end
  11.     end
  12. end
  13. local function buildRacialSpells()
  14.     local raceName, raceFile, raceID = UnitRace('player')
  15.     local res = C_AlliedRaces.GetAllRacialAbilitiesFromID(raceID)
  16.     if(res) then
  17.         for k, v in pairs(C_AlliedRaces.GetAllRacialAbilitiesFromID(raceID)) do
  18.             if(type(v)=='table') then
  19.                 if(not IsPassiveSpell(v['name']) and not isRacialSpell(v['icon'])) then -- Replace icon with name once the bug is fixed
  20.                     racialSpells[#racialSpells+1] = v['icon'] -- Replace icon with name once the bug is fixed
  21.                 end
  22.             end
  23.         end
  24.     end
  25. end
  26. local function buildSpells(self)
  27.     if(InCombatLockdown()) then
  28.         self:RegisterEvent("PLAYER_REGEN_ENABLED")
  29.         return
  30.     end
  31.     local currentSpec = GetSpecialization()
  32.     if currentSpec then
  33.         local classInfo = C_CreatureInfo.GetClassInfo(select(3,UnitClass('player')))
  34.         buildRacialSpells()
  35.         local _, currentSpecName = GetSpecializationInfo(currentSpec)
  36.         db['spells'] = {}
  37.         for tabIndex = 1, GetNumSpellTabs() do
  38.             local name, texture, offset, numEntries, isGuild, offspecID = GetSpellTabInfo(tabIndex)
  39.             if(name == currentSpecName or name == classInfo['className'] or tabIndex==1) then
  40.                 if(offspecID==0) then
  41.                     for spellIndex = offset + 1, offset + numEntries do
  42.                         local skillType, special = GetSpellBookItemInfo(spellIndex, BOOKTYPE_SPELL)
  43.                         if(skillType=="SPELL" and not IsPassiveSpell(spellIndex, BOOKTYPE_SPELL)) then
  44.                             local spellName, spellSubName = GetSpellBookItemName(spellIndex, BOOKTYPE_SPELL)
  45. --                          print(spellName,spellSubName,IsPassiveSpell(spellIndex, BOOKTYPE_SPELL), raceSpell)
  46.                             local _, _, icon = GetSpellInfo(spellName)
  47.                             if(not IsAttackSpell(spellName)) then
  48.                                 if(spellSubName and spellSubName ~= "" and not isRacialSpell(icon)) then
  49. --                                  db['spells'][special] = format("%s (%s)",spellName, spellSubName)
  50.                                     db['spells'][special] = spellName -- Fix when C_AlliedRaces.GetAllRacialAbilitiesFromID(raceID) returns a value
  51.                                 else
  52.                                     db['spells'][special] = spellName
  53.                                 end
  54.                             end
  55.                         end
  56.                     end
  57.                 end
  58.             end
  59.         end
  60.     end
  61. end
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Is C_AlliedRaces.GetAllRacialAbilitiesFromID bugged?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off