Add keep name formatting for FR and DE

Sasky [06-08-14 - 23:24]
Add keep name formatting for FR and DE
Filename
CyrHUD.lua
classes/Battle.lua
diff --git a/CyrHUD.lua b/CyrHUD.lua
index 08866cb..ad55cb4 100644
--- a/CyrHUD.lua
+++ b/CyrHUD.lua
@@ -225,7 +225,7 @@ function CyrHUD.init()
     CyrHUD_UI:SetAnchor(pt, relTo, relPt, CyrHUD.cfg.xoff, CyrHUD.cfg.yoff)

     --Init UI
-    if WYK_QuestTracker_MQT then WYK_QuestTracker_MQT:SetAlpha(0) end
+    --if WYK_QuestTracker_MQT then WYK_QuestTracker_MQT:SetAlpha(0) end
     CyrHUD_UI:SetHidden(false)


@@ -246,7 +246,7 @@ function CyrHUD.init()
 end

 function CyrHUD.deinit()
-    if WYK_QuestTracker_MQT then WYK_QuestTracker_MQT:SetAlpha(1) end
+    --if WYK_QuestTracker_MQT then WYK_QuestTracker_MQT:SetAlpha(1) end
     EVENT_MANAGER:UnregisterForUpdate("CyrHUDKeepCheck")
     EVENT_MANAGER:UnregisterForUpdate("CyrHUDUIUpdate")
     EVENT_MANAGER:UnregisterForUpdate("CyrHUDUpdateAPCount")
diff --git a/classes/Battle.lua b/classes/Battle.lua
index c0644eb..3d6f8c5 100644
--- a/classes/Battle.lua
+++ b/classes/Battle.lua
@@ -19,11 +19,24 @@ setmetatable(CyrHUD.Battle, {
 })

 local shortenResourceName = function(str)
-    return str
+    return str:gsub("%^.d$", "")
         :gsub("Castle ","")
-        :gsub("Fort ","")
+        :gsub("[fF]ort ","")
         :gsub("Keep ","")
         :gsub("Lumber ","")
+        :gsub("Feste ","")
+        :gsub("Kastell ","")
+        :gsub("Burg ","")
+        :gsub("Holz.+lager", "")
+
+end
+
+local shortenKeepName = function(str)
+    return str:gsub(",..$", ""):gsub("%^.d$", "")
+    --FR
+        :gsub("avant.poste d[eu] ", "")
+        :gsub("bastille d[eu]s? ", "")
+        :gsub("fort de la ", "")
 end


@@ -35,7 +48,7 @@ CyrHUD.Battle.new = function(keepID)
     self.startBattle = GetTimeStamp()
     self.endBattle = nil
     self.keepID = keepID
-    self.keepName = GetKeepName(keepID):gsub("%^.d$", "")
+    self.keepName = shortenKeepName(GetKeepName(keepID))
     self.keepType = GetKeepType(keepID)
     if self.keepType == KEEPTYPE_RESOURCE then
         self.keepType = 10 + GetKeepResourceType(keepID)
@@ -138,7 +151,13 @@ function CyrHUD.Battle:getAttSiege()
     if faction and faction ~= 0 then
         color = CyrHUD.info[faction].color
     end
-    if count == 0 then count = "" end
+    if count == 0 then
+        if not self.keepUA and self.siege[self.defender] > 0 then
+            count = "?"
+        else
+            count = ""
+        end
+    end
     return count, color
 end