Glass/Xivkyn by scinutz

His Dad [09-29-15 - 05:30]
Glass/Xivkyn by scinutz
V3.3.1
Filename
AIResearchGrid.lua
AIResearchGrid.txt
AIResearchGrid.xml
doc/changelog.txt
doc/description.txt
diff --git a/AIResearchGrid.lua b/AIResearchGrid.lua
index 5f5d084..a3b22e6 100644
--- a/AIResearchGrid.lua
+++ b/AIResearchGrid.lua
@@ -6,12 +6,13 @@
 -- French Translation by Motsah
 -- Fixes by mpavlinsky
 -- Close on Esc code by Wandamey
+-- Glass and Xivkyn added in by Scinutz

 local _
 AIRG = {}

 AIRG.name = "AIResearchGrid"
-AIRG.version = "3.2.16"
+AIRG.version = "3.3.1"
 AIRG.initialised = false
 AIRG.processing = false
 AIRG.all = " #ALL"  -- Default displayname for Virtual character, overrwritten by Localised version
@@ -90,12 +91,12 @@ function AIRG.initUI()
     -- Nice little line under the main title
     -- ## Check is htis showing right?
     AIRG.UI.TopDivider = WINDOW_MANAGER:CreateControl("AIResearchGridTopDivider", AIResearchGrid, CT_TEXTURE)
-    AIRG.UI.TopDivider:SetDimensions(760, 5)
+    AIRG.UI.TopDivider:SetDimensions(770, 5)
     AIRG.UI.TopDivider:SetAnchor(TOPLEFT, AIResearchGrid, TOPLEFT, 0, 32)
     AIRG.UI.TopDivider:SetTexture("/esoui/art/quest/questjournal_divider.dds")
     -- Nice little line under the grid
     AIRG.UI.BottomDivider = WINDOW_MANAGER:CreateControl("AIResearchGridBottomDivider", AIResearchGrid, CT_TEXTURE)
-    AIRG.UI.BottomDivider:SetDimensions(760, 5)
+    AIRG.UI.BottomDivider:SetDimensions(770, 5)
     AIRG.UI.BottomDivider:SetAnchor(TOPLEFT, AIResearchGrid, TOPLEFT, 0, 636)
     AIRG.UI.BottomDivider:SetTexture("/esoui/art/quest/questjournal_divider.dds")
     AIRG.UI.BottomDivider:SetHidden(not AIRG.vars.showMotifs)
@@ -313,12 +314,12 @@ function AIRG.initUI()
     -- but we can fix it later. It's not like it's going to have an overhead on processing. :)
     -- 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(760, 50)
-    AIRG.UI.motifSection:SetAnchor(BOTTOMLEFT, AIResearchGrid, BOTTOMLEFT, -40, 0)
+    AIRG.UI.motifSection:SetDimensions(770, 50)
+    AIRG.UI.motifSection:SetAnchor(BOTTOMLEFT, AIResearchGrid, BOTTOMLEFT, -110, 0)
     AIRG.UI.motifSection:SetHidden(not AIRG.vars.showMotifs)
     AIResearchGrid:SetHeight(AIRG.vars.showMotifs and 706 or 636)
     AIRG.UI.motifButtons = {}
-    for i = 1, 15 do
+    for i = 1, 17 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, 42*i +124, 0)
@@ -535,6 +536,7 @@ function AIRG.PopulateStyleData()
         known = IsSmithingStyleKnown(j, 1) --patternIndex set to 1, temporary workaround for changes introduced in Update 4
         AIRG.vars.styles[thisname][i] = known
       end
+
       --Dwemer style chapters
       AIRG.vars.styles[thisname][15] = {}
       local itemStyle = AIRG.styleLookupItem[15]
@@ -543,6 +545,22 @@ function AIRG.PopulateStyleData()
         local _, numCompleted = GetAchievementCriterion(1144, i)
         AIRG.vars.styles[thisname][15][AIRG.styleChaptersLookup[i]] = numCompleted == 1
       end
+
+      --Glass style chapters
+      AIRG.vars.styles[thisname][16] = {}
+      local itemStyle = AIRG.styleLookupItem[16]
+      for i = 1, 14 do
+        --local known = IsSmithingStyleKnown(itemStyle, i)
+        local _, numCompleted = GetAchievementCriterion(1319, i)
+        AIRG.vars.styles[thisname][16][AIRG.styleChaptersLookup[i]] = numCompleted == 1
+      end
+      --Xiv Style chapters
+      AIRG.vars.styles[thisname][17] = {}
+      local itemStyle = AIRG.styleLookupItem[17]
+      for i = 1, 14 do
+        local _, numCompleted = GetAchievementCriterion(1181, i)
+        AIRG.vars.styles[thisname][17][AIRG.styleChaptersLookup[i]] = numCompleted == 1
+      end
     end
   end
 end -- AIRG.PopulateStyleData
@@ -570,6 +588,7 @@ function AIRG.PopulateAll()
 		for i = 1, 14 do	--iterate over all non-dwemer styles
 			if  AIRG.vars.styles[thisname][i] then
 				AIRG.vars.styles[AIRG.all][i] = true
+			end
 		end
 		--Update Dwemer styles
 		for i = 1, 14 do	--iterate over all dwemer items
@@ -577,22 +596,35 @@ function AIRG.PopulateAll()
 				AIRG.vars.styles[AIRG.all][15][i] = true
 			end
 		end
-       end
+		--Update Glass styles
+		for i = 1, 14 do	--iterate over all Glass items
+			if  AIRG.vars.styles[thisname][16][i] then
+				AIRG.vars.styles[AIRG.all][16][i] = true
+			end
+		end
+		--Update Xivkyn styles
+		for i = 1, 14 do	--iterate over all Xiv items
+			if  AIRG.vars.styles[thisname][17][i] then
+				AIRG.vars.styles[AIRG.all][17][i] = true
+			end
+		end
+
+
       end
     end
- end  -- AIRG.PopulateAll
+end  -- AIRG.PopulateAll


 -- Set the icon highlights for the currently selected character
 function AIRG.DisplayStyles()
     local i
     if (AIRG.vars.styles[AIRG.curCharacter] == nil) then
-        for i = 1, 15 do
+        for i = 1, 17 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, 14 do
+        for i = 1, 17 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
@@ -604,11 +636,11 @@ function AIRG.DisplayStyles()
     end
 	--Dwemer Motif, special case
 	--update old saved variables, if exists
---	AIRG.vars.styles[AIRG.curCharacter][15] = AIRG.vars.styles[AIRG.curCharacter][15] or {}
+	--AIRG.vars.styles[AIRG.curCharacter][15] = AIRG.vars.styles[AIRG.curCharacter][15] or {}

 	--making styleIndex as variable, so it will be easier to make a loop if there will be any new styles
 	local styleIndex = 15
-	--for styleIndex = 15, maxStyleIndex do  --start of the future loop
+        -- start of loop if its ever written
 	local tooltipText = ""
 	local knownCount = 0
 	for i = 1, 14 do
@@ -634,6 +666,73 @@ function AIRG.DisplayStyles()
 	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)
+
+
+	--Glass Motif, special case
+
+	--making styleIndex as variable
+	local styleIndex = 16
+	--
+	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)
+
+	--Xiv Motif, special case
+
+	local styleIndex = 17
+	--
+	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)
+
+
+
+
+
 	--end --end of the future loop
 end -- AIRG.DisplayStyles()

@@ -741,10 +840,12 @@ function AIRG.AssignStyleLookups()
     AIRG.styleLookupIcons[13] = "ESOUI/art/progression/progression_indexicon_weapons_"
     AIRG.styleLookupIcons[14] = "ESOUI/art/progression/progression_indexicon_weapons_"
     AIRG.styleLookupIcons[15] = "ESOUI/art/progression/progression_indexicon_weapons_"
+    AIRG.styleLookupIcons[16] = "ESOUI/art/progression/progression_indexicon_weapons_"
+    AIRG.styleLookupIcons[17] = "ESOUI/art/progression/progression_indexicon_weapons_"

     -- Translate the icon position to the in-game type. Used for text look-up
     AIRG.styleLookupValue = {}
-	AIRG.styleLookupValue[1] = ITEMSTYLE_RACIAL_HIGH_ELF
+    AIRG.styleLookupValue[1] = ITEMSTYLE_RACIAL_HIGH_ELF
     AIRG.styleLookupValue[2] = ITEMSTYLE_RACIAL_DARK_ELF
     AIRG.styleLookupValue[3] = ITEMSTYLE_RACIAL_WOOD_ELF
     AIRG.styleLookupValue[4] = ITEMSTYLE_RACIAL_NORD
@@ -759,6 +860,8 @@ function AIRG.AssignStyleLookups()
     AIRG.styleLookupValue[13] = ITEMSTYLE_ENEMY_DAEDRIC
     AIRG.styleLookupValue[14] = ITEMSTYLE_ENEMY_PRIMITIVE
     AIRG.styleLookupValue[15] = ITEMSTYLE_AREA_DWEMER
+    AIRG.styleLookupValue[16] = ITEMSTYLE_GLASS
+    AIRG.styleLookupValue[17] = ITEMSTYLE_AREA_XIVKYN

     -- This is a bit of a hack, but only because of the way ESO uses Style Items with different index to styles.
     AIRG.styleLookupItem = {}
@@ -777,8 +880,10 @@ function AIRG.AssignStyleLookups()
     AIRG.styleLookupItem[13] = 21   -- Daedric      = Daedra Heart
     AIRG.styleLookupItem[14] = 20   -- Primal       = Argentum
     AIRG.styleLookupItem[15] = 15   -- Dwemer       = Dwemer Frame
+    AIRG.styleLookupItem[16] = 29   -- Glass        = Malachite Shard
+    AIRG.styleLookupItem[17] = 30   -- Xivkyn       = ??

-	AIRG.styleChaptersLookup = {}
+    AIRG.styleChaptersLookup = {}
     AIRG.styleChaptersLookup[1] = 10   --Axe
     AIRG.styleChaptersLookup[2] = 6    --Belt
     AIRG.styleChaptersLookup[3] = 3    --Boots
@@ -794,6 +899,23 @@ function AIRG.AssignStyleLookups()
     AIRG.styleChaptersLookup[13] = 12  --Staves
     AIRG.styleChaptersLookup[14] = 8   --Swords

+    AIRG.styleChaptersLookupGlass = {}
+    AIRG.styleChaptersLookupGlass[1] = 10   --Axe
+    AIRG.styleChaptersLookupGlass[2] = 6    --Belt
+    AIRG.styleChaptersLookupGlass[3] = 3    --Boots
+    AIRG.styleChaptersLookupGlass[4] = 14   --Bows
+    AIRG.styleChaptersLookupGlass[5] = 5    --Chests
+    AIRG.styleChaptersLookupGlass[6] = 11   --Daggers
+    AIRG.styleChaptersLookupGlass[7] = 2    --Gloves
+    AIRG.styleChaptersLookupGlass[8] = 1    --Helmets
+    AIRG.styleChaptersLookupGlass[9] = 4    --Legs
+    AIRG.styleChaptersLookupGlass[10] = 9   --Maces
+    AIRG.styleChaptersLookupGlass[11] = 13  --Shields
+    AIRG.styleChaptersLookupGlass[12] = 7   --Shoulders
+    AIRG.styleChaptersLookupGlass[13] = 12  --Staves
+    AIRG.styleChaptersLookupGlass[14] = 8   --Swords
+
+
 end -- AIRG.AssignStyleLookups


@@ -892,6 +1014,16 @@ function AIRG.Initialise(eventCode, addOnName)
     for i = 1, 14 do
         AIRG.vars.styles[AIRG.all][15][i] = false
     end
+	AIRG.vars.styles[AIRG.all][16]= {}	--Glass
+    for i = 1, 14 do
+        AIRG.vars.styles[AIRG.all][16][i] = false
+    end
+	AIRG.vars.styles[AIRG.all][17]= {}	--Xiv
+    for i = 1, 14 do
+        AIRG.vars.styles[AIRG.all][17][i] = false
+    end
+
+

  -- AIRG.CreateDataMatrix

diff --git a/AIResearchGrid.txt b/AIResearchGrid.txt
index b36a506..4fe51bc 100644
--- a/AIResearchGrid.txt
+++ b/AIResearchGrid.txt
@@ -1,6 +1,6 @@
-## Title: |cFFFFB0Research Grid|r v3.2.16
+## Title: |cFFFFB0Research Grid|r v3.3.1
 ## APIVersion: 100012
-## Version: 3.2.16
+## Version: 3.3.1
 ## Author: Stormknight and Team
 ## OptionalDependsOn: LibAddonMenu-2.0
 ## SavedVariables: AIRG_SavedVariables
diff --git a/AIResearchGrid.xml b/AIResearchGrid.xml
index 0b0952f..e7835b1 100644
--- a/AIResearchGrid.xml
+++ b/AIResearchGrid.xml
@@ -1,7 +1,7 @@
 <GuiXml>
     <Controls>
         <TopLevelControl name="AIResearchGrid" mouseEnabled="true" movable="true" clampedToScreen="true" hidden="true">
-            <Dimensions x="760" y="706" />
+            <Dimensions x="770" y="706" />
             <Anchor point="CENTER" />
             <Controls>

diff --git a/doc/changelog.txt b/doc/changelog.txt
index 509c624..a83ab45 100644
--- a/doc/changelog.txt
+++ b/doc/changelog.txt
@@ -1,3 +1,10 @@
+2015-09-29  v3.3.1
+	New Feature
+	Glass and Xivkyn by scinutz
+	Bump the version in his/her honour!
+	Bug Fix
+	Nil
+
 2015-09-02  v3.2.16
 	New Feature
 	Nil
diff --git a/doc/description.txt b/doc/description.txt
index 0a9084d..bde4173 100644
--- a/doc/description.txt
+++ b/doc/description.txt
@@ -4,7 +4,7 @@

 [B]Known Bug. On rare occaisions "relative to" leads you to  make an item to update another character. However when you try to research it, you find that char already know that trait.
 I don't know if it is a bug in AIRG or ESo. I can't reproduce it or analyse it. I haven't had this happen to me since patch 1.6. If it happens to you please post a comment.
-Just to make things worse, it is quite easy to skip a line or column when running your eye across it. I'm considering options on that.[/B]
+[/B]

 I hope that you find this addon useful even with this issue. --Dad