View Single Post
03-24-24, 04:13 AM   #7
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Originally Posted by SDPhantom View Post
This is how I would implement a fallback list using multiple ors.
Lua Code:
  1. watchedFactionID = watchedFactionID
  2.     or (inInstance and hasDungeonTabard and tabardID)
  3.     or (lookUpSubZones and (citySubZonesAndFactions[subZone] or subZonesAndFactions[subZone]))
  4.     or (inInstance and instancesAndFactions[whichInstanceID])
  5.     or (not lookUpSubZones and isWoDZone and bodyguardRepID)
  6.     or (not inInstance and zonesAndFactions[uiMapID])
  7.     or self.fallbackRepID

Note parenthesis are highly suggested to direct which order you want logic operations to run as mixing and/or operations can lead to unpredictable results.
This solution worked! I tested in Un'Goro Crater, which has no rep assigned and the addon watched my fallback. Then I went into the Stockades dungeon with the Ironforge faction tabard, which worked. And finally, I flew back and forth between the main section of Valdrakken and the Artisan's section and that worked.

Thank you so much!
  Reply With Quote