More debugging.
watchedFactionID is nil with the following code, at least for WoD zones and now subzones too, as "Dwarven District" in Stormwind stopped working. It is supposed to be 47 for Ironforge. It is 72 when I'm in other parts of Stormwind and 2510 in Valdrakken, so the major zones are working.
I also tested the addon settings and disabled Lunarfall (the Alliance Garrison) checking for a bodyguard, and suddenly the bar went from blank to Stormwind. This tells me something about i
sWoDZone and/or
bodyguardRepID, and that I'm not handling one or both correctly. I'm not seeing the logic bomb.
As fast as I am getting answers, I am getting more confused about WoD and subzones. Besides anyone being helpful with debugging, I would love to learn why it isn't working, not just a fix.
Lua Code:
-- Process subzones
if db.watchSubZones then
-- Battlegrounds and warfronts are the only instances with subzones
if inInstance and instanceType ~= "pvp" then return end
-- Don't loop through subzones if the player is watching a bodyguard rep
if isWoDZone and bodyguardRepID then
watchedFactionID = bodyguardRepID
else
-- Get our subzone data
watchedFactionID = CitySubZonesAndFactions[subZone] or subZonesAndFactions[subZone]
end
end
-- Get world zone data or the character's default watched faction
watchedFactionID = (watchedFactionID == nil and zonesAndFactions[uiMapID]) or db.defaultRepID
self:Print("DEBUG: watchedFactionID:", watchedFactionID)