Akaviri Bu scuntz

His Dad [10-25-15 - 03:00]
Akaviri Bu scuntz
Filename
AIResearchGrid.lua
diff --git a/AIResearchGrid.lua b/AIResearchGrid.lua
index 3945a95..410be72 100644
--- a/AIResearchGrid.lua
+++ b/AIResearchGrid.lua
@@ -6,13 +6,13 @@
 -- French Translation by Motsah
 -- Fixes by mpavlinsky
 -- Close on Esc code by Wandamey
--- Glass, Xivkyn, and Ancient Orc added in by Scinutz
+-- Glass, Xivkyn, Ancient Orc, and Mercenary Akaviri added in by Scinutz

 local _
 AIRG = {}

 AIRG.name = "AIResearchGrid"
-AIRG.version = "3.3.6"
+AIRG.version = "3.3.7"
 AIRG.initialised = false
 AIRG.processing = false
 AIRG.all = " #ALL"  -- Default displayname for Virtual character, overrwritten by Localised version
@@ -315,15 +315,15 @@ function AIRG.initUI()
     -- It's set-up inside a container frame to make hiding or showing the whole lot simpler.
     AIRG.UI.motifSection = WINDOW_MANAGER:CreateControl("AIResearchMotifSection", AIResearchGrid, CT_CONTROL)
     AIRG.UI.motifSection:SetDimensions(790, 50)
-    AIRG.UI.motifSection:SetAnchor(BOTTOMLEFT, AIResearchGrid, BOTTOMLEFT, -110, 0)
+    AIRG.UI.motifSection:SetAnchor(BOTTOMLEFT, AIResearchGrid, BOTTOMLEFT, -166, 0)
     AIRG.UI.motifSection:SetHidden(not AIRG.vars.showMotifs)
     AIResearchGrid:SetHeight(AIRG.vars.showMotifs and 706 or 636)
     AIRG.UI.motifButtons = {}
-    for i = 1, 18 do
+    for i = 1, 20 do

         AIRG.UI.motifButtons[i] = WINDOW_MANAGER:CreateControl("AIResearchGridMotifButton" .. tostring(i), AIRG.UI.motifSection, CT_TEXTURE)
         AIRG.UI.motifButtons[i]:SetDimensions(40, 40)
-        AIRG.UI.motifButtons[i]:SetAnchor(TOPLEFT, AIRG.UI.motifSection, TOPLEFT, 41*i + 124, 0)
+        AIRG.UI.motifButtons[i]:SetAnchor(TOPLEFT, AIRG.UI.motifSection, TOPLEFT, 40*i + 120, 0)
         AIRG.UI.motifButtons[i]:SetTexture(AIRG.styleLookupIcons[i] .. "up.dds")
         AIRG.UI.motifButtons[i]:SetMouseEnabled(true)
         j = AIRG.styleLookupValue[i]
@@ -339,7 +339,7 @@ function AIRG.initUI()
     -- BUILD LABEL FOR STYLES
     AIRG.UI.StyleLabel = WINDOW_MANAGER:CreateControl("AIResearchStylelabel", AIRG.UI.motifSection, CT_LABEL)
     AIRG.UI.StyleLabel:SetAnchor(TOPLEFT, AIRG.UI.motifSection, TOPLEFT, 5, 6)
-    AIRG.UI.StyleLabel:SetText(GetString(SI_SMITHING_HEADER_STYLE))
+    AIRG.UI.StyleLabel:SetText("")-- AIRG.UI.StyleLabel:SetText(GetString(SI_SMITHING_HEADER_STYLE))
     AIRG.UI.StyleLabel:SetDimensions(150, 24)
     AIRG.UI.StyleLabel:SetFont("ZoFontGame")
     AIRG.UI.StyleLabel:SetHorizontalAlignment(TEXT_ALIGN_RIGHT)
@@ -568,6 +568,24 @@ function AIRG.PopulateStyleData()
         local _, numCompleted = GetAchievementCriterion(1341, i)
         AIRG.vars.styles[AIRG.curCharacter][18][AIRG.styleChaptersLookup[i]] = numCompleted == 1
       end
+
+      --Akaviri Style chapters
+      AIRG.vars.styles[AIRG.curCharacter][19] = {}
+      local itemStyle = AIRG.styleLookupItem[19]
+      for i = 1, 14 do
+        local _, numCompleted = GetAchievementCriterion(1318, i)
+        AIRG.vars.styles[AIRG.curCharacter][19][AIRG.styleChaptersLookup[i]] = numCompleted == 1
+      end
+
+      --Mercenary Akaviri Style chapters
+      AIRG.vars.styles[AIRG.curCharacter][20] = {}
+      local itemStyle = AIRG.styleLookupItem[20]
+      for i = 1, 14 do
+        local _, numCompleted = GetAchievementCriterion(1348, i)
+        AIRG.vars.styles[AIRG.curCharacter][20][AIRG.styleChaptersLookup[i]] = numCompleted == 1
+      end
+
+
 end -- AIRG.PopulateStyleData

 -- When any character data changes we have to go through and create our virtual "All" from the beginning.
@@ -615,11 +633,23 @@ function AIRG.PopulateAll()
 			end
 		end
 		--Update Ancient Orc styles
-		for i = 1, 14 do	--iterate over all Xiv items
+		for i = 1, 14 do	--iterate over all Ancient Orc items
 			if  AIRG.vars.styles[thisname][18][i] then
 				AIRG.vars.styles[AIRG.all][18][i] = true
 			end
 		end
+		--Update Akaviri styles
+		for i = 1, 14 do	--iterate over all Mercenary Akaviri items
+			if  AIRG.vars.styles[thisname][19][i] then
+				AIRG.vars.styles[AIRG.all][19][i] = true
+			end
+		end
+		--Update Mercenary styles
+		for i = 1, 14 do	--iterate over all Mercenary Akaviri items
+			if  AIRG.vars.styles[thisname][20][i] then
+				AIRG.vars.styles[AIRG.all][20][i] = true
+			end
+		end


       end
@@ -630,12 +660,12 @@ end  -- AIRG.PopulateAll
 -- Set the icon highlights for the currently selected character
 function AIRG.DisplayStyles()
     if (AIRG.vars.styles[AIRG.curCharacter] == nil) then
-        for i = 1, 18 do
+        for i = 1, 20 do
             AIRG.UI.motifButtons[i]:SetTexture(AIRG.styleLookupIcons[i] .. "up.dds")
             AIRG.UI.motifButtons[i]:SetColor(1, 1, 1, 0.7)   -- grey
         end
     else
-        for i = 1, 18 do
+        for i = 1, 20 do
             if (AIRG.vars.styles[AIRG.curCharacter][i]) then
                 AIRG.UI.motifButtons[i]:SetTexture(AIRG.styleLookupIcons[i] .. "down.dds")
                 AIRG.UI.motifButtons[i]:SetColor(0.7, 1, 0.7, 1)   -- Green
@@ -769,6 +799,66 @@ function AIRG.DisplayStyles()
 	local tDesc = GetSmithingStyleItemLink(AIRG.styleLookupItem[styleIndex])
 	AIRG.UI.motifButtons[styleIndex].tooltipText = zo_strjoin(nil, zo_strformat("<<t:1>> (<<2>>/14)\n<<t:3>>\n", GetString("SI_ITEMSTYLE", itemStyle), knownCount, tDesc), tooltipText)

+	--  Akaviri Motif, special case
+
+	local styleIndex = 19
+	--
+	local tooltipText = ""
+	local knownCount = 0
+	for i = 1, 14 do
+		-- check how many chapters are known and build tooltip
+		if (AIRG.vars.styles[AIRG.curCharacter][styleIndex][i]) then
+		   tooltipText = zo_strjoin(nil, tooltipText, "\n|cFFFFFF", GetString("SI_ITEMSTYLECHAPTER", i), "|r")
+		   knownCount = knownCount + 1
+		else
+		   tooltipText = zo_strjoin(nil, tooltipText, "\n|c808080", GetString("SI_ITEMSTYLECHAPTER", i), "|r")
+		end
+	end
+	if knownCount == 0 then
+		AIRG.UI.motifButtons[styleIndex]:SetTexture(AIRG.styleLookupIcons[styleIndex] .. "up.dds")
+		AIRG.UI.motifButtons[styleIndex]:SetColor(1, 1, 1, 0.7)   -- grey
+	else
+		AIRG.UI.motifButtons[styleIndex]:SetTexture(AIRG.styleLookupIcons[styleIndex] .. "down.dds")
+		if knownCount == 14 then
+			AIRG.UI.motifButtons[styleIndex]:SetColor(0.7, 1, 0.7, 1)  -- Green
+		else
+			AIRG.UI.motifButtons[styleIndex]:SetColor(1, 1, 0.7, 1)    -- yellow
+		end
+	end
+	local itemStyle = AIRG.styleLookupValue[styleIndex]
+	local tDesc = GetSmithingStyleItemLink(AIRG.styleLookupItem[styleIndex])
+	AIRG.UI.motifButtons[styleIndex].tooltipText = zo_strjoin(nil, zo_strformat("<<t:1>> (<<2>>/14)\n<<t:3>>\n", GetString("SI_ITEMSTYLE", itemStyle), knownCount, tDesc), tooltipText)
+
+	--  Mercenary Motif, special case
+
+	local styleIndex = 20
+	--
+	local tooltipText = ""
+	local knownCount = 0
+	for i = 1, 14 do
+		-- check how many chapters are known and build tooltip
+		if (AIRG.vars.styles[AIRG.curCharacter][styleIndex][i]) then
+		   tooltipText = zo_strjoin(nil, tooltipText, "\n|cFFFFFF", GetString("SI_ITEMSTYLECHAPTER", i), "|r")
+		   knownCount = knownCount + 1
+		else
+		   tooltipText = zo_strjoin(nil, tooltipText, "\n|c808080", GetString("SI_ITEMSTYLECHAPTER", i), "|r")
+		end
+	end
+	if knownCount == 0 then
+		AIRG.UI.motifButtons[styleIndex]:SetTexture(AIRG.styleLookupIcons[styleIndex] .. "up.dds")
+		AIRG.UI.motifButtons[styleIndex]:SetColor(1, 1, 1, 0.7)   -- grey
+	else
+		AIRG.UI.motifButtons[styleIndex]:SetTexture(AIRG.styleLookupIcons[styleIndex] .. "down.dds")
+		if knownCount == 14 then
+			AIRG.UI.motifButtons[styleIndex]:SetColor(0.7, 1, 0.7, 1)  -- Green
+		else
+			AIRG.UI.motifButtons[styleIndex]:SetColor(1, 1, 0.7, 1)    -- yellow
+		end
+	end
+	local itemStyle = AIRG.styleLookupValue[styleIndex]
+	local tDesc = GetSmithingStyleItemLink(AIRG.styleLookupItem[styleIndex])
+	AIRG.UI.motifButtons[styleIndex].tooltipText = zo_strjoin(nil, zo_strformat("<<t:1>> (<<2>>/14)\n<<t:3>>\n", GetString("SI_ITEMSTYLE", itemStyle), knownCount, tDesc), tooltipText)
+



@@ -883,6 +973,8 @@ function AIRG.AssignStyleLookups()
     AIRG.styleLookupIcons[16] = "ESOUI/art/progression/progression_indexicon_weapons_"
     AIRG.styleLookupIcons[17] = "ESOUI/art/progression/progression_indexicon_weapons_"
     AIRG.styleLookupIcons[18] = "ESOUI/art/progression/progression_indexicon_weapons_"
+    AIRG.styleLookupIcons[19] = "ESOUI/art/progression/progression_indexicon_weapons_"
+    AIRG.styleLookupIcons[20] = "ESOUI/art/progression/progression_indexicon_weapons_"


     -- Translate the icon position to the in-game type. Used for text look-up
@@ -905,6 +997,8 @@ function AIRG.AssignStyleLookups()
     AIRG.styleLookupValue[16] = ITEMSTYLE_GLASS
     AIRG.styleLookupValue[17] = ITEMSTYLE_AREA_XIVKYN
     AIRG.styleLookupValue[18] = ITEMSTYLE_AREA_ANCIENT_ORC
+    AIRG.styleLookupValue[19] = ITEMSTYLE_AREA_AKAVIRI
+    AIRG.styleLookupValue[20] = ITEMSTYLE_UNDAUNTED

     -- This is a bit of a hack, but only because of the way ESO uses Style Items with different index to styles.
     AIRG.styleLookupItem = {}
@@ -926,6 +1020,8 @@ function AIRG.AssignStyleLookups()
     AIRG.styleLookupItem[16] = 29   -- Glass        = Malachite Shard
     AIRG.styleLookupItem[17] = 30   -- Xivkyn       = ??
     AIRG.styleLookupItem[18] = 23   -- Ancient Orc  = ??
+    AIRG.styleLookupItem[19] = 34   -- Akaviri    = ??
+    AIRG.styleLookupItem[20] = 27   -- Mercenary    = ??

     AIRG.styleChaptersLookup = {}
     AIRG.styleChaptersLookup[1] = 10   --Axe
@@ -1055,6 +1151,17 @@ function AIRG.Initialise(eventCode, addOnName)
         AIRG.vars.styles[AIRG.all][18][i] = false
     end

+	AIRG.vars.styles[AIRG.all][19]= {}	-- Akaviri
+    for i = 1, 14 do
+        AIRG.vars.styles[AIRG.all][19][i] = false
+    end
+
+	AIRG.vars.styles[AIRG.all][20]= {}	--Mercenary Akaviri
+    for i = 1, 14 do
+        AIRG.vars.styles[AIRG.all][20][i] = false
+    end
+
+

  -- AIRG.CreateDataMatrix