Quantcast WoWInterface - View Single Post - [Classic] GetNumFactions() not getting past index 1
View Single Post
10-14-19, 10:40 PM   #9
Vrul
A Rage Talon Dragon Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 330
See what you get with:
lua Code:
  1. function RepByZone:SetWatchedFactionByFactionID(id)
  2.     if type(id) == "table" then id = tonumber(id) end
  3.     if type(id) ~= "number" then return end
  4.  
  5.     self:OpenAllFactionHeaders()
  6.     for i = 1, GetNumFactions() do
  7.         local name, _, standingID, _, _, _, _, _, isHeader, _, _, isWatched, _, factionID = GetFactionInfo(i)
  8.         self:Print("DEBUG: SetWatchedFactionByFactionID name:", name)
  9.         self:Print("DEBUG: SetWatchedFactionByFactionID index:", i)
  10.         if id == factionID then
  11.             if not isWatched then
  12.                 SetWatchedFactionIndex(i)
  13.             end
  14.             self:CloseAllFactionHeaders()
  15.             return name, id
  16.         end
  17.     end
  18.     self:CloseAllFactionHeaders()
  19. end
  Reply With Quote