Beta 0.9.2

Scott Yeskie [06-06-14 - 09:25]
Beta 0.9.2
Add outposts to scan list
Have fallback if can't find icon and print debug info
Initial restructure on keep name replacement.
Filename
CyrHUD.lua
CyrHUD.txt
classes/Battle.lua
classes/Info.lua
diff --git a/CyrHUD.lua b/CyrHUD.lua
index dcccc3d..a53d00f 100644
--- a/CyrHUD.lua
+++ b/CyrHUD.lua
@@ -189,6 +189,10 @@ CyrHUD.scanKeeps = function()
     for i=3,20 do
         CyrHUD.checkAdd(i)
     end
+
+    for i=132,134 do
+        CyrHUD.checkAdd(i)
+    end
 end

 ------------------------------------------------------------------------
diff --git a/CyrHUD.txt b/CyrHUD.txt
index 61cd2d1..95cced6 100644
--- a/CyrHUD.txt
+++ b/CyrHUD.txt
@@ -1,6 +1,6 @@
 ## APIVersion: 100004
 ## Title: CyrHUD
-## Version: 0.9.1
+## Version: 0.9.2
 ## Author: Sasky

 classes/Battle.lua
diff --git a/classes/Battle.lua b/classes/Battle.lua
index d06776f..b292447 100644
--- a/classes/Battle.lua
+++ b/classes/Battle.lua
@@ -18,6 +18,15 @@ setmetatable(CyrHUD.Battle, {
     end,
 })

+local shortenResourceName = function(str)
+    return str
+        :gsub("Castle ","")
+        :gsub("Fort ","")
+        :gsub("Keep ","")
+        :gsub("Lumber ","")
+end
+
+
 ----------------------------------------------
 -- Creation
 ----------------------------------------------
@@ -26,15 +35,11 @@ CyrHUD.Battle.new = function(keepID)
     self.startBattle = GetTimeStamp()
     self.endBattle = nil
     self.keepID = keepID
-    self.keepName = GetKeepName(keepID)
+    self.keepName = GetKeepName(keepID):gsub("%^.d$", "")
     self.keepType = GetKeepType(keepID)
     if self.keepType == KEEPTYPE_RESOURCE then
         self.keepType = 10 + GetKeepResourceType(keepID)
-        local name = self.keepName:gsub("Castle ","")
-        name = name:gsub("Fort ","")
-        name = name:gsub("Keep ","")
-        name = name:gsub("Lumber ","")
-        self.keepName = name
+        self.keepName = shortenResourceName(self.keepName)
     end
     self.siege = {}
     self:update()
@@ -154,5 +159,12 @@ end
     @see CyrHUD.info
 ]]
 function CyrHUD.Battle:getIcon()
+    --Debug code
+    if CyrHUD.info[self.defender] == nil or CyrHUD.info[self.defender][self.keepType] == nil then
+        d("|cFF0000ERROR: CyrHUD. Bad icon lookup. Defender: " .. self.defender .. " / KeepType: " .. self.keepType)
+        d("|cFF0000Please file this bug info at esoui.com")
+        return CyrHUD.info.noIcon
+    end
+
     return CyrHUD.info[self.defender][self.keepType]
 end
\ No newline at end of file
diff --git a/classes/Info.lua b/classes/Info.lua
index 09504dc..9d23d2c 100644
--- a/classes/Info.lua
+++ b/classes/Info.lua
@@ -14,6 +14,7 @@ local DC = ALLIANCE_DAGGERFALL_COVENANT
 local EP = ALLIANCE_EBONHEART_PACT

 CyrHUD.info = {}
+CyrHUD.info.noIcon = "/esoui/art/mappins/ava_largekeep_neutral.dds"
 CyrHUD.info[AD] = {}
 CyrHUD.info[AD].color = { hex = "B2B222", r = .698, g = .698, b = .133 }
 CyrHUD.info[AD][KEEPTYPE_KEEP] = "/esoui/art/mappins/ava_largekeep_aldmeri.dds"