Cleanup

His Dad [02-05-16 - 04:30]
Cleanup
Filename
AIResearchGrid.lua
AIResearchGrid.txt
diff --git a/AIResearchGrid.lua b/AIResearchGrid.lua
index 0c22602..fab5dcc 100644
--- a/AIResearchGrid.lua
+++ b/AIResearchGrid.lua
@@ -71,8 +71,7 @@ end -- AIRG.StyleLearned
 -- Invoked from AIRG.Initialise but lengthy so in it's own function to not clutter Initialise
 function AIRG.initUI()
     -- Some local variable declaration
-    local i, j, zz, yy      -- used in for loops
-    local thisTrait, tType, tDesc, rowNum, charName
+    local  tType, tDesc, rowNum
     -- Initialise a table to hold all the lua generated components
     AIRG.UI = {}
     -- Set the main window title
@@ -322,7 +321,7 @@ function AIRG.initUI()

     AIRG.UI.motifButtons = {}
 	local yoffset = 0
-	local xoffset
+	local xoffset,j
     for i = 1, 20 do

 		if i > 14 then	--split normal from chapter
@@ -336,7 +335,7 @@ function AIRG.initUI()
         AIRG.UI.motifButtons[i]:SetAnchor(TOPLEFT, AIRG.UI.motifSection, TOPLEFT, 40*xoffset + 40, yoffset)
         AIRG.UI.motifButtons[i]:SetTexture(AIRG.styleLookupIcons[i] .. "up.dds")
         AIRG.UI.motifButtons[i]:SetMouseEnabled(true)
-        j = AIRG.styleLookupValue[i]
+         j = AIRG.styleLookupValue[i]
         tDesc ,_,_,_,_ = GetSmithingStyleItemInfo( AIRG.styleLookupItem[i] )
         AIRG.UI.motifButtons[i].tooltipText = zo_strformat("<<t:1>>\n<<t:2>>", GetString("SI_ITEMSTYLE",j), tDesc)
         AIRG.UI.motifButtons[i]:SetHandler("OnMouseEnter", function (self)
@@ -371,9 +370,9 @@ function AIRG.OnCraftSelected(_,thisCraft)


     AIRG.UI.WindowSubTitle:SetText(AIRG.craftNames[thisCraft])
-    local i,j,busy
+    local busy

-    local tType,tDesc,tKnown,tRemain,rowNum,traitCount,alltraits, tooltiptext
+    local traitCount,alltraits, tooltiptext
     local maxLines = GetNumSmithingResearchLines(thisCraft) -- the number of columns for this profession
     AIRG.curCraft = thisCraft
 	alltraits = 0
@@ -484,7 +483,6 @@ end -- AIRG.OnCharacterSelect

 -- Deletes data for the named character from the saved data and removes them from the dropdown box.
 function AIRG.DeleteCharacter(charName)
-	local i,item
     -- Can't delete the current character
     if (charName == AIRG.curCharacter) then
         d(AIRG.L["DeleteFalse"])
@@ -556,7 +554,7 @@ function AIRG.PopulateStyleData()

       --Glass style chapters
       AIRG.vars.styles[AIRG.curCharacter][16] = {}
-      local itemStyle = AIRG.styleLookupItem[16]
+      itemStyle = AIRG.styleLookupItem[16]
       for i = 1, 14 do
         --local known = IsSmithingStyleKnown(itemStyle, i)
         local _, numCompleted = GetAchievementCriterion(1319, i)
@@ -565,7 +563,7 @@ function AIRG.PopulateStyleData()

       --Xiv Style chapters
       AIRG.vars.styles[AIRG.curCharacter][17] = {}
-      local itemStyle = AIRG.styleLookupItem[17]
+      itemStyle = AIRG.styleLookupItem[17]
       for i = 1, 14 do
         local _, numCompleted = GetAchievementCriterion(1181, i)
         AIRG.vars.styles[AIRG.curCharacter][17][AIRG.styleChaptersLookup[i]] = numCompleted == 1
@@ -573,7 +571,7 @@ function AIRG.PopulateStyleData()

       --Ancient Orc Style chapters
       AIRG.vars.styles[AIRG.curCharacter][18] = {}
-      local itemStyle = AIRG.styleLookupItem[18]
+      itemStyle = AIRG.styleLookupItem[18]
       for i = 1, 14 do
         local _, numCompleted = GetAchievementCriterion(1341, i)
         AIRG.vars.styles[AIRG.curCharacter][18][AIRG.styleChaptersLookup[i]] = numCompleted == 1
@@ -581,7 +579,7 @@ function AIRG.PopulateStyleData()

       --Akaviri Style chapters
       AIRG.vars.styles[AIRG.curCharacter][19] = {}
-      local itemStyle = AIRG.styleLookupItem[19]
+      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
@@ -589,7 +587,7 @@ function AIRG.PopulateStyleData()

       --Mercenary Akaviri Style chapters
       AIRG.vars.styles[AIRG.curCharacter][20] = {}
-      local itemStyle = AIRG.styleLookupItem[20]
+      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
@@ -602,7 +600,7 @@ end -- AIRG.PopulateStyleData
 -- its simplified by not having to reset to unknown as traits can't be forgotton.
 -- The ALL char data was erased at startup
 function AIRG.PopulateAll()
-    local craft, item, trait, thisname, style, known
+    local craft, item, trait, thisname
     for thisname, _ in pairs(AIRG.vars.data) do   --iterate over all characters
       if thisname ~= AIRG.all then                --skip our virtual
         for craft, _ in pairs(AIRG.vars.data[thisname]) do   --iterate over all crafts
@@ -702,6 +700,7 @@ function AIRG.DisplayStyles()
 	local styleIndex = 15
         -- start of loop if its ever written
 	local tooltipText = ""
+  local itemStyle,tDesc
 	local knownCount = 0
 	for i = 1, 14 do
 		--check how many chapters are known and build tooltip
@@ -723,18 +722,18 @@ function AIRG.DisplayStyles()
 			AIRG.UI.motifButtons[styleIndex]:SetColor(1, 1, 0.6, 1)    -- yellow
 		end
 	end
-	local itemStyle = AIRG.styleLookupValue[styleIndex]
-	local tDesc = GetSmithingStyleItemLink(AIRG.styleLookupItem[styleIndex])
+	itemStyle = AIRG.styleLookupValue[styleIndex]
+	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
+	styleIndex = 16
 	--
-	local tooltipText = ""
-	local knownCount = 0
+	tooltipText = ""
+	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
@@ -755,16 +754,16 @@ function AIRG.DisplayStyles()
 			AIRG.UI.motifButtons[styleIndex]:SetColor(1, 1, 0.6, 1)    -- yellow
 		end
 	end
-	local itemStyle = AIRG.styleLookupValue[styleIndex]
-	local tDesc = GetSmithingStyleItemLink(AIRG.styleLookupItem[styleIndex])
+	itemStyle = AIRG.styleLookupValue[styleIndex]
+	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)

 	--Xivkyn Motif, special case

-	local styleIndex = 17
+	styleIndex = 17
 	--
-	local tooltipText = ""
-	local knownCount = 0
+	tooltipText = ""
+	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
@@ -785,16 +784,16 @@ function AIRG.DisplayStyles()
 			AIRG.UI.motifButtons[styleIndex]:SetColor(1, 1, 0.6, 1)    -- yellow
 		end
 	end
-	local itemStyle = AIRG.styleLookupValue[styleIndex]
-	local tDesc = GetSmithingStyleItemLink(AIRG.styleLookupItem[styleIndex])
+	itemStyle = AIRG.styleLookupValue[styleIndex]
+	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)

 	--Ancient Orc Motif, special case

-	local styleIndex = 18
+	styleIndex = 18
 	--
-	local tooltipText = ""
-	local knownCount = 0
+	tooltipText = ""
+	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
@@ -815,16 +814,16 @@ function AIRG.DisplayStyles()
 			AIRG.UI.motifButtons[styleIndex]:SetColor(1, 1, 0.6, 1)    -- yellow
 		end
 	end
-	local itemStyle = AIRG.styleLookupValue[styleIndex]
-	local tDesc = GetSmithingStyleItemLink(AIRG.styleLookupItem[styleIndex])
+	itemStyle = AIRG.styleLookupValue[styleIndex]
+	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
+	styleIndex = 19
 	--
-	local tooltipText = ""
-	local knownCount = 0
+	tooltipText = ""
+	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
@@ -845,16 +844,16 @@ function AIRG.DisplayStyles()
 			AIRG.UI.motifButtons[styleIndex]:SetColor(1, 1, 0.6, 1)    -- yellow
 		end
 	end
-	local itemStyle = AIRG.styleLookupValue[styleIndex]
-	local tDesc = GetSmithingStyleItemLink(AIRG.styleLookupItem[styleIndex])
+	itemStyle = AIRG.styleLookupValue[styleIndex]
+	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
+	styleIndex = 20
 	--
-	local tooltipText = ""
-	local knownCount = 0
+	tooltipText = ""
+	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
@@ -875,8 +874,8 @@ function AIRG.DisplayStyles()
 			AIRG.UI.motifButtons[styleIndex]:SetColor(1, 1, 0.6, 1)    -- yellow
 		end
 	end
-	local itemStyle = AIRG.styleLookupValue[styleIndex]
-	local tDesc = GetSmithingStyleItemLink(AIRG.styleLookupItem[styleIndex])
+	itemStyle = AIRG.styleLookupValue[styleIndex]
+	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)


@@ -888,7 +887,6 @@ end -- AIRG.DisplayStyles()

 -- Look up all the data on this profession and commit to saved variables for this character.
 function AIRG.CreateDataMatrix(thisCraft)  -- for current  player, not the selected
-  local i, j
     local tType, tKnown, tRemain, rowNum, tTargetStamp
     local rCount = 0
     local maxLines = GetNumSmithingResearchLines(thisCraft)     -- the number of columns for this profession
@@ -923,8 +921,6 @@ function AIRG.CreateDataMatrix(thisCraft)  -- for current  player, not the selec
 end -- AIRG.CreateDataMatrix

 function AIRG.CreateDataMatrixRelative(thisCraft)  -- for the current selected  player, relative to the real player
-    local craft, item, trait, thisname, style, known
-
     for thisname, _ in pairs(AIRG.vars.data) do   --iterate over all characters
       if thisname ~= AIRG.all then                --skip our virtual
         AIRG.relative[thisname] = {}
@@ -1102,7 +1098,6 @@ function AIRG.Initialise(eventCode, addOnName)
 	AIRG.vars.data[" #ALL"] = nil
     AIRG.vars.data[AIRG.all] = {}    -- and our virtual character
   -- Create Empty data for Virtual Char set to 0, (Not known)
-    local i, j

     AIRG.vars.data[AIRG.all][CRAFTING_TYPE_BLACKSMITHING] = {}
     -- Cycle through items for this profession
diff --git a/AIResearchGrid.txt b/AIResearchGrid.txt
index 14a855f..e434722 100644
--- a/AIResearchGrid.txt
+++ b/AIResearchGrid.txt
@@ -1,6 +1,6 @@
 ## Title: |cFFFFB0Research Grid|r v3.3.10
 ## APIVersion: 100013
-## Version: 3.3.109
+## Version: 3.3.10
 ## Author: Stormknight and Team
 ## OptionalDependsOn: LibAddonMenu-2.0
 ## SavedVariables: AIRG_SavedVariables