Add option to disable Imperial City notifications

Scott Yeskie [06-20-16 - 16:18]
Add option to disable Imperial City notifications
Filename
CyrHUD.lua
CyrHUD.txt
menu.lua
diff --git a/CyrHUD.lua b/CyrHUD.lua
index 83628be..a8571f8 100644
--- a/CyrHUD.lua
+++ b/CyrHUD.lua
@@ -54,6 +54,14 @@ end
 ----------------------------------------------
 function CyrHUD.eventAttackChange(_, keepID, battlegroundContext, underAttack)
     local self = CyrHUD
+
+    --Optionally hide IC district battles
+    if GetKeepType(keepID) == KEEPTYPE_IMPERIAL_CITY_DISTRICT then
+        if CyrHUD.cfg.hideImpBattles then
+            return;
+        end
+    end
+
     if underAttack then
         self:add(keepID)
     elseif self.battles[keepID] ~= nil then
@@ -155,13 +163,18 @@ function CyrHUD:updateAll()
 end

 function CyrHUD:scanKeeps()
+    --Main keeps
     for i=3,20 do
         self:checkAdd(i)
     end

+    --Outposts
     for i=132,134 do
         self:checkAdd(i)
     end
+
+    --Note: Resources and Imperial Disatricts are not included in scan
+    --Those would add a lots of checks for something with fast turnover.
 end

 ------------------------------------------------------------------------
diff --git a/CyrHUD.txt b/CyrHUD.txt
index fe6e04b..b2d1ba1 100644
--- a/CyrHUD.txt
+++ b/CyrHUD.txt
@@ -1,6 +1,6 @@
 ## APIVersion: 100015
 ## Title: CyrHUD
-## Version: 1.3.0
+## Version: 1.3.1
 ## Author: Sasky
 ## SavedVariables: CyrHUD_SavedVars
 ## OptionalDependsOn: LibAddonMenu-2.0
diff --git a/menu.lua b/menu.lua
index 1507b99..cefb79a 100644
--- a/menu.lua
+++ b/menu.lua
@@ -23,7 +23,8 @@ CyrHUD.menuPanel = {
     version = "1.1.0",
 }

-local c1 = "|cC5C29E" -- ZOS standard text color
+local CZ = "|cC5C29E" -- ZOS standard text color
+local CR = "|cFFFFFF" -- Reset color

 CyrHUD.menuOptions = {
     {
@@ -48,12 +49,19 @@ CyrHUD.menuOptions = {
         setFunc = function(v) CyrHUD.cfg.showPopBars = v; CyrHUD:reconfigureLabels() end,
     },
     {
+        type = "checkbox",
+        name = "Hide Imperial District Battles",
+        tooltip = "Hides Imperial District battles from CyrHUD notifications",
+        getFunc = function() return CyrHUD.cfg.hideImpBattles or false end,
+        setFunc = function(v) CyrHUD.cfg.hideImpBattles = v; CyrHUD:reconfigureLabels() end
+    },
+    {
         type = "description",
         title = "Keybind",
-        text = c1 .. "See the controls game menu for setting a keybind for the |cFFFFFF/cyrhud" .. c1 .. " command.\n"
+        text = CZ .. "See the controls game menu for setting a keybind for the" .. CR .. "/cyrhud" .. CZ .. " command.\n"
             .."This toggles the addon on or off."
     }
 }

 --TODO: Move this and other strings to proper translator format
-ZO_CreateStringId("SI_BINDING_NAME_CYRHUD_TOGGLE", "Enable/disable CyrHUD")
\ No newline at end of file
+ZO_CreateStringId("SI_BINDING_NAME_CYRHUD_TOGGLE", "Enable/disable CyrHUD")