Quantcast WoWInterface - View Single Post - [Classic] GetNumFactions() not getting past index 1
View Single Post
10-14-19, 10:04 PM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,089
Vrul, yes, that's probably a bug, though upon testing walking from Stormwind City to Elwynn Forest, the UIMapIDs sync, but the watched rep is now printing nothing. Hm, progress?
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.         if id == factionID then
  9.             self:Print("DEBUG: SetWatchedFactionByFactionID name:", name) --doesn't print now
  10.             self:Print("DEBUG: SetWatchedFactionByFactionID index:", i) -- doesn't print now
  11.             if not isWatched then
  12.                 SetWatchedFactionIndex(i)
  13.             end
  14.             self:CloseAllFactionHeaders()
  15.             return name, id
  16.         else
  17.             break
  18.         end
  19.     end
  20.     self:CloseAllFactionHeaders()
  21. end
  Reply With Quote