Version 3.1.10.

His Dad [01-05-15 - 06:39]
Version 3.1.10.
Cleaned out old comments.
Traits now shows total of traits for that skill.
Filename
AIResearchGrid.lua
AIResearchGrid.txt
Language/en.lua
doc/changelog.txt
diff --git a/AIResearchGrid.lua b/AIResearchGrid.lua
index 67ad045..54ea619 100644
--- a/AIResearchGrid.lua
+++ b/AIResearchGrid.lua
@@ -7,7 +7,7 @@ local _
 AIRG = {}

 AIRG.name = "AIResearchGrid"
-AIRG.version = "3.1.9"
+AIRG.version = "3.1.10"
 AIRG.initialised = false
 AIRG.processing = false
 AIRG.all = " #ALL"  -- Default displayname for Virtual character, overrwritten by Localised version
@@ -26,12 +26,12 @@ AIRG.defaults = {
 function AIRG.PlayerActivated()
         -- somehow somewhere it sometimes happens that the data is not correct completely for whatever reason
         -- so we force a reload of the current character data when we are actually loaded into the world.
-  AIRG.PopulateMatrix()
-  AIRG.PopulateStyleData()
-  AIRG.DisplayStyles()
-  AIRG.PopulateAll()  -- do last
+	AIRG.PopulateMatrix()
+	AIRG.PopulateStyleData()
+	AIRG.DisplayStyles()
+	AIRG.PopulateAll()  -- do last

-end
+end

 function AIRG.ToggleMainWindow()
     if (AIResearchGrid:IsHidden()) then
@@ -50,7 +50,6 @@ end -- AIRG.ToggleMainWindow
 function AIRG.ResearchStarted(eventCode, craftingSkillType, researchLineIndex, traitIndex)
     AIRG.PopulateMatrix()
     AIRG.PopulateAll()
-    -- TO DO: If it's visible, invoke a redisplay
     AIRG.OnCraftSelected()              -- Redisplay data for the current profession
 end -- AIRG.ResearchStarted

@@ -59,7 +58,6 @@ end -- AIRG.ResearchStarted
 function AIRG.ResearchCompleted()
     AIRG.PopulateMatrix()
     AIRG.PopulateAll()
-    -- TO DO: If it's visible, invoke a redisplay
     AIRG.OnCraftSelected()              -- Redisplay data for the current profession
 end -- AIRG.ResearchEnded

@@ -113,7 +111,7 @@ function AIRG.initUI()
     AIRG.UI.btnCloseAddonFrame:SetNormalTexture("/esoui/art/buttons/clearslot_down.dds")
     AIRG.UI.btnCloseAddonFrame:SetMouseOverTexture("/esoui/art/buttons/clearslot_up.dds")
     AIRG.UI.btnCloseAddonFrame:SetHandler("OnClicked", function(self) AIRG.ToggleMainWindow() end)
-
+
     -- CREATE the DROPDOWN BOX for CHARACTER SELECT
     -- Uses code based on example from Seerah
     AIRG.UI.charDropdown = WINDOW_MANAGER:CreateControlFromVirtual("AIResearchGridDropdownCharacter", AIResearchGrid, "ZO_StatsDropdownRow")
@@ -129,7 +127,6 @@ function AIRG.initUI()
         AIRG.UI.charDropdown.dropdown:AddItem(entry)
     end
     -- CREATE BUTTON FOR "Update Other" AT TOP_RIGHT
-    --AIRG.UI.btnUpdateOther = WINDOW_MANAGER:CreateControl("AIResearchGridButtonUpdateOther", AIResearchGrid, CT_BUTTON)
     AIRG.UI.btnUpdateOther = WINDOW_MANAGER:CreateControlFromVirtual("AIResearchGridButtonUpdateOther", AIResearchGrid, "ZO_DefaultButton")
 	--Attempt to adjust button size to content, but units are different. May not be fixable. leave for meantime.
     local textlen = 0
@@ -137,7 +134,7 @@ function AIRG.initUI()
     then textlen = string.len(AIRG.L["btnRelativeOn"])
     else textlen = string.len(AIRG.L["btnRelativeOff"])
     end
-
+
     AIRG.UI.btnUpdateOther:SetDimensions(140+textlen, 30)
     AIRG.UI.btnUpdateOther:SetAnchor(RIGHT, AIRG.UI.charDropdown, LEFT, 0, 0)
     AIRG.UI.btnUpdateOther:SetState(BSTATE_NORMAL)
@@ -151,28 +148,23 @@ function AIRG.initUI()
     AIRG.UI.btnUpdateOther:SetEnabled(false)  -- starts pointing to current character, which can't use this
     AIRG.UI.btnUpdateOther:SetHidden(false)
 -- enabled at end of function
-    AIRG.UI.btnUpdateOther:SetHandler("OnClicked",
-      function(self)
-                       AIRG.ShowRelative = not AIRG.ShowRelative
-                       if AIRG.ShowRelative
+    AIRG.UI.btnUpdateOther:SetHandler("OnClicked",
+      function(self)
+                    AIRG.ShowRelative = not AIRG.ShowRelative
+                    if AIRG.ShowRelative
                        then  self:SetText(AIRG.L["btnRelativeOn"]) -- Lime green
   --                     else  self:SetText(AIRG.btnUpdateOtherText1 )
                         else  self:SetText(AIRG.L["btnRelativeOff"])
-                     end
-                     AIRG.OnCraftSelected() --redisplay
+                    end
+                    AIRG.OnCraftSelected() --redisplay
          end)
   --  The following have caused bugs to be reported, that I can't duplicate. As there is no tooltip text, disable it entirely.
   --  AIRG.UI.btnUpdateOther:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
   --  AIRG.UI.btnUpdateOther:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)
-
-
+
+
     AIRG.UI.btnUpdateOther:SetMouseEnabled(true)
-  --
-    -- PEOPLE ICON NEXT TO THE DROPDOWN BOX.
---    AIRG.UI.PeopleIcon = WINDOW_MANAGER:CreateControl("AIResearchGridPeopleIcon", AIResearchGrid, CT_TEXTURE)
---    AIRG.UI.PeopleIcon:SetDimensions(40, 32)
---    AIRG.UI.PeopleIcon:SetAnchor(TOPRIGHT, AIRG.UI.charDropdown, TOPLEFT, 0, 0)
---    AIRG.UI.PeopleIcon:SetTexture("/esoui/art/contacts/tabicon_friends_down.dds")
+
     -- CREATE BUTTON FOR PROFESSION: BLACKSMITHING
     AIRG.UI.btnBlacksmithing = WINDOW_MANAGER:CreateControl("AIResearchGridButtonBlacksmithing", AIResearchGrid, CT_BUTTON)
     AIRG.UI.btnBlacksmithing:SetDimensions(48, 48)
@@ -311,7 +303,7 @@ function AIRG.initUI()
     AIRG.UI.columnFooterTitle:SetVerticalAlignment(TEXT_ALIGN_CENTER)
     AIRG.UI.columnFooterTitle:SetColor(1, 1, 0.4, 1);       -- faded yellow
 --    AIRG.UI.columnFooterTitle:SetText(GetString(SI_SMITHING_RESEARCH_LINE_HEADER))
-    AIRG.UI.columnFooterTitle:SetText(GetString(SI_CRAFTING_COMPONENT_TOOLTIP_TRAITS))
+    AIRG.UI.columnFooterTitle:SetText(GetString(SI_CRAFTING_COMPONENT_TOOLTIP_TRAITS))   -- "Traits"

     -- BUILD THE MOTIF ICONS ACROSS THE BOTTOM
     -- Note that for now, we're just setting up 15 icons and stuff is configured manually
@@ -346,7 +338,8 @@ function AIRG.initUI()
     AIRG.UI.StyleLabel:SetDimensions(150, 24)
     AIRG.UI.StyleLabel:SetFont("ZoFontGame")
     AIRG.UI.StyleLabel:SetHorizontalAlignment(TEXT_ALIGN_RIGHT)
-
+
+
 end -- AIRG.initUI

 -- User has clicked on one of the profession buttons
@@ -361,13 +354,15 @@ function AIRG.OnCraftSelected(_,thisCraft)
     end


-
+
     AIRG.UI.WindowSubTitle:SetText(AIRG.craftNames[thisCraft])
     local i,j,busy
-
-    local tType,tDesc,tKnown,tRemain,rowNum,traitCount
+
+    local tType,tDesc,tKnown,tRemain,rowNum,traitCount,alltraits
     local maxLines = GetNumSmithingResearchLines(thisCraft) -- the number of columns for this profession
     AIRG.curCraft = thisCraft
+	alltraits = 0
+
     for i = 1, AIRG.maxColumns do
         busy = false
         -- "blank" the grid
@@ -392,11 +387,11 @@ function AIRG.OnCraftSelected(_,thisCraft)
                 AIRG.vars.data[AIRG.curCharacter][thisCraft][i][rowNum] = -1  -- Change to known
               end
             end
-
-
+
+
             if  AIRG.ShowRelative
             then
-              -- Great! relative mode! we need to address a matter of practical usage.
+              -- Great! relative mode! we need to address a matter of practical usage.
               --  We need to see that we actually can research that now, because we can't research more than one item type at a time.
               --  So we need to pre-check for item research and set the colours (of the texture) appropriately
               for rowNum,tKnown in pairs(AIRG.vars.data[AIRG.curCharacter][thisCraft][i]) do
@@ -404,11 +399,11 @@ function AIRG.OnCraftSelected(_,thisCraft)
                       busy = true
                   end
               end
-
+
               for rowNum,tKnown in pairs(AIRG.relative[AIRG.curCharacter][thisCraft][i]) do
                   AIRG.UI.gridButtons[i][rowNum].tooltipText = tKnown
                   if (tKnown == -1) then       -- Trait is known
-                    if (busy) then
+                    if (busy) then
                         AIRG.UI.gridButtons[i][rowNum]:SetColor(0.7, 0.6, 0.6, .8)   -- Dull Reddish
                     else
                         AIRG.UI.gridButtons[i][rowNum]:SetColor(0.2, 1, 0.2, 1)   -- Green
@@ -418,7 +413,7 @@ function AIRG.OnCraftSelected(_,thisCraft)
                   end
               end

-
+
             else -- not relative
               for rowNum,tKnown in pairs(AIRG.vars.data[AIRG.curCharacter][thisCraft][i]) do
                 AIRG.UI.gridButtons[i][rowNum].tooltipText = tKnown
@@ -434,30 +429,32 @@ function AIRG.OnCraftSelected(_,thisCraft)
                     AIRG.UI.gridButtons[i][rowNum]:SetColor(1, 0.2, 0.2, 1)   -- Red
                     AIRG.UI.gridButtons[i][rowNum]:SetTexture("ESOUI/art/buttons/decline_up.dds")  --  an   "X".
                 end
-              end
+              end
             end  --Relative
-
+
             AIRG.UI.columnFooters[i]:SetText(traitCount)
+			alltraits = alltraits + traitCount
         end
     end
+	AIRG.UI.columnFooterTitle:SetText(GetString(SI_CRAFTING_COMPONENT_TOOLTIP_TRAITS) .. "(" .. tostring(alltraits) .. ")")   -- "Traits"
 end -- AIRG:OnCraftSelected

 -- Invoked when the user selected a character from the dropdown box
 function AIRG.OnCharacterSelect(charName)

-    if (charName == nil) then
+    if (charName == nil) then
         return
     end
     AIRG.curCharacter = charName
-
+
       -- The Relative Button doesn't make sense if selecting these
     if charName == AIRG.all or charName == AIRG.playerName then
       AIRG.UI.btnUpdateOther:SetEnabled(false)
       AIRG.ShowRelative = false
-    else
+    else
       AIRG.UI.btnUpdateOther:SetEnabled(true)
     end
-
+
     AIRG.DisplayStyles()
     AIRG.OnCraftSelected()

@@ -476,6 +473,7 @@ function AIRG.DeleteCharacter(charName)
         if (AIRG.vars.styles[charName] ~= nil) then
             AIRG.vars.styles[charName] = nil
         end
+		ReloadUI(AIRG.name)   -- Doesn't do anything??  Need to reloadui manually
         AIRG.PopulateAll()
     end
 end -- AIRG.DeleteCharacter
@@ -504,7 +502,7 @@ function AIRG.PopulateMatrix()
         end
       AIRG.CreateDataMatrixRelative(CRAFTING_TYPE_BLACKSMITHING)
       AIRG.CreateDataMatrixRelative(CRAFTING_TYPE_WOODWORKING)
-     AIRG.CreateDataMatrixRelative(CRAFTING_TYPE_CLOTHIER)
+      AIRG.CreateDataMatrixRelative(CRAFTING_TYPE_CLOTHIER)
 end -- AIRG.PopulateMatrix

 -- Lookup the style data for the current character and send it to saved vars.
@@ -540,10 +538,10 @@ function AIRG.PopulateAll()
           end
        end
       end
-    end
+    end
  end  -- AIRG.PopulateAll
-
-
+
+
 -- Set the icon highlights for the currently selected character
 function AIRG.DisplayStyles()
     local i
@@ -617,13 +615,13 @@ function AIRG.CreateDataMatrixRelative(thisCraft)  -- for the current selected
                 if AIRG.vars.data[AIRG.playerName][craft][item][trait] ==  -1  ---PLayer Does
                 then AIRG.relative[thisname][craft][item][trait] = -1
                 else AIRG.relative[thisname][craft][item][trait] = nil
-                end
+                end
               end
             end
           end
         end
       end
-    end
+    end
 end -- AIRG.CreateDataMatrix


@@ -686,7 +684,7 @@ function AIRG.AssignStyleLookups()
     AIRG.styleLookupValue[13] = ITEMSTYLE_ENEMY_DAEDRIC
     AIRG.styleLookupValue[14] = ITEMSTYLE_ENEMY_PRIMITIVE
     AIRG.styleLookupValue[15] = ITEMSTYLE_AREA_DWEMER
-
+
     -- This is a bit of a hack, but only because of the way ESO uses Style Items with different index to styles.
     AIRG.styleLookupItem = {}
     AIRG.styleLookupItem[1] = 8     -- Altmer       = Adamantite
@@ -712,13 +710,13 @@ function AIRG.Initialise(eventCode, addOnName)
 	if (AIRG.name ~= addOnName) then return end
     -- Language text
     AIRG.InitialiseLanguage()
-
+
     -- Load the saved variables
     AIRG.vars = ZO_SavedVars:NewAccountWide("AIRG_SavedVariables", 2, nil, AIRG.defaults)
     AIRG.all = AIRG.L["ALL"]		-- replace Default with localise string
-
+
     -- Register Keybinding
-    ZO_CreateStringId("SI_BINDING_NAME_TOGGLE_AIRG", "Toggle AI Research Grid")
+    ZO_CreateStringId("SI_BINDING_NAME_TOGGLE_AIRG", "Toggle AI Research Grid")

 	-- Set-up some variables we'll want to refer to.
     AIRG.craftNames = {}
@@ -732,81 +730,81 @@ function AIRG.Initialise(eventCode, addOnName)
     AIRG.AssignGridTraits()
     AIRG.AssignStyleLookups()
     AIRG.vars.styles[AIRG.all] = {}           -- and our virtual character
-
+
     -- Create these here so the UI dropdown will have them first time around.
     AIRG.vars.data[AIRG.playerName] = {}    -- create a table for this character's matrix
-    AIRG.vars.data[AIRG.all] = {}    -- and our virtual character
-
+    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] = {}
+    AIRG.vars.data[AIRG.all][CRAFTING_TYPE_BLACKSMITHING] = {}
     -- Cycle through items for this profession
     for i = 1, 7 do   -- Weapons
-        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_BLACKSMITHING][i] = {}
+        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_BLACKSMITHING][i] = {}
         -- Cycle through the traits for this item
         for j = 1, 9 do
                        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_BLACKSMITHING][i][j] = 0   -- set to not known
         end
     end
     for i = 8, 14 do  -- Armour
-        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_BLACKSMITHING][i] = {}
+        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_BLACKSMITHING][i] = {}
         -- Cycle through the traits for this item
         for j = 10, 18 do
                        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_BLACKSMITHING][i][j] = 0   -- set to not known
         end
     end
-
-    AIRG.vars.data[AIRG.all][CRAFTING_TYPE_CLOTHIER] = {}
+
+    AIRG.vars.data[AIRG.all][CRAFTING_TYPE_CLOTHIER] = {}
     -- Cycle through items for this profession
     for i = 1, 14 do
-        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_CLOTHIER][i] = {}
+        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_CLOTHIER][i] = {}
         -- Cycle through the traits for this item
         for j = 10, 18  do
                        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_CLOTHIER][i][j] = 0   -- set to not known
         end
     end
-
-     AIRG.vars.data[AIRG.all][CRAFTING_TYPE_WOODWORKING] = {}
+
+     AIRG.vars.data[AIRG.all][CRAFTING_TYPE_WOODWORKING] = {}
     -- Cycle through items for this profession
     for i = 1, 5 do
-        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_WOODWORKING][i] = {}
+        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_WOODWORKING][i] = {}
         -- Cycle through the traits for this item
         for j = 1, 9 do
                        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_WOODWORKING][i][j] = 0   -- set to not known
         end
     end
     for i = 6, 6 do  --Shields
-        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_WOODWORKING][i] = {}
+        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_WOODWORKING][i] = {}
         -- Cycle through the traits for this item
         for j = 10, 18 do
                        AIRG.vars.data[AIRG.all][CRAFTING_TYPE_WOODWORKING][i][j] = 0   -- set to not known
         end
     end
-
+
     --Create Empty Style Table
     for i = 1, 14 do
         AIRG.vars.styles[AIRG.all][i] = false
     end

  -- AIRG.CreateDataMatrix
-
+
     -- Following replaced with PlayerActivate
     -- Query data for THIS character and populate the data matrix with fresh data.
     --AIRG.PopulateMatrix()
-
+
     -- Query data for THIS character for STYLES
     --AIRG.PopulateStyleData()

     -- UI set-up. Create frames, position labels & buttons etc.
     AIRG.initUI()
-
+
     -- REGISTER for events that aren't initialise.
     EVENT_MANAGER:RegisterForEvent("AIRG", EVENT_SMITHING_TRAIT_RESEARCH_STARTED, AIRG.ResearchStarted)
     EVENT_MANAGER:RegisterForEvent("AIRG", EVENT_SMITHING_TRAIT_RESEARCH_COMPLETED, AIRG.ResearchCompleted)

     EVENT_MANAGER:RegisterForEvent("AIRG", EVENT_STYLE_LEARNED, AIRG.StyleLearned)
-
+
     EVENT_MANAGER:RegisterForEvent("AIRG", EVENT_PLAYER_ACTIVATED, AIRG.PlayerActivated)

     -- Create the configuration/settings menu.
@@ -821,6 +819,6 @@ function AIRGslash(extra)
     AIRG.ToggleMainWindow()
 end -- AIRGslash

-
+
 SLASH_COMMANDS["/airg"] = AIRGslash
 -- EOF
diff --git a/AIResearchGrid.txt b/AIResearchGrid.txt
index 3a4ef84..1f68d0d 100644
--- a/AIResearchGrid.txt
+++ b/AIResearchGrid.txt
@@ -1,6 +1,6 @@
-## Title: |cFFFFB0Research Grid|r v3.1.9
+## Title: |cFFFFB0Research Grid|r v3.1.10
 ## APIVersion: 100010
-## Version: 3.1.9
+## Version: 3.1.10
 ## Author: Stormknight and Team
 ## OptionalDependsOn: LibAddonMenu-2.0
 ## SavedVariables: AIRG_SavedVariables
diff --git a/Language/en.lua b/Language/en.lua
index 84d670a..69fe6fd 100644
--- a/Language/en.lua
+++ b/Language/en.lua
@@ -29,7 +29,7 @@ function AIRG.InitialiseLanguage()

 	-- Page Titles
 	AIRG.L["Clothing"]						= "CLOTHING"
-	AIRG.L["BS"]									= "BLACKSMITHING"
+	AIRG.L["BS"]							= "BLACKSMITHING"
 	AIRG.L["Woodwork"]						= "WOODWORKING"

 end
diff --git a/doc/changelog.txt b/doc/changelog.txt
index 7a8bf6a..be33d95 100644
--- a/doc/changelog.txt
+++ b/doc/changelog.txt
@@ -1,9 +1,16 @@
+2015-01-05  V3.1.10
+    New Feature
+	Traits now also show the total for that skill.
+	Bug Fixed
+	Nil: Attempt to get it to ReloadUI() automatically after deleting a character's data, doesn't work for reasons unknown.
+	Updated Version String.
+
 2014-12-18  V3.1.9
 	New Feature
 	None
 	Bugs Fixed
 	Updated version string.
-
+
 2014-12-18  V3.1.8
 	New Feature
 	None
@@ -12,13 +19,13 @@

 2014-12-14  Not released
 	Cleanup. #ALL and current player name removed from the delete character dropdown (Addon Menu), rather than being there but giving an error.
-
+
 2014-12-12 V3.1.7
 	New Feature
 	None
 	Bugs Fixed
 	Styles not showing highlighted on first load. Disabled tooltips causing error. Updated LibAddonMenu to 2.0.r16
-
+
 2014-12-12 V3.1.6
 	New Feature
 	None
@@ -26,13 +33,13 @@
 	None
 	Other
 	doc folder added, prepared for better localisation, set up for git on esoui
-
+
 2014-12-09 V3.1.5
 	New Feature
 	Show Dwemer Motifs (not tested, the author doesn't have any)  by rkuhnjr
 	Bugs Fixed
 	None
-
+
 2014-12-05 V3.1.4
 	New Feature
 	Localization files now used for relative button, but translations not provided
@@ -47,7 +54,7 @@
 	Deleting charater data for selected char caused crash
 	In relative mode, scrolling through chars would not update for completed research.

-2014-12-05 V3.1
+2014-12-05 V3.1
 	New features
 	If using the relative mode but the destination character is already researching that item, the icon will be a dull red tick.
 	Characters can only research 1 trait in a item at at time, no matter how many research slots might be available.
@@ -59,20 +66,20 @@
 	New Feature
 	Add a button to put it in relative mode.
 		Provided you have one other char in there (it is disabled for #all and the current player), it will show the traits that the current player can make (or will be able to make if still in research) that the selected char doesn't have. This is for when you are trying to consolidate traits on to your main crafting chars, to get that magical "8" traits known. If you are like me, you might get alts to learn traits because you don't have the bank space to hold the item.
-
-
+
+

 2014-12-01  V3.0.0  Sent to Stormknight and CDG
 	New Feature
 		Added #ALL
-
+
 2.3
 - Attempt to fix bug where some items show up as unresearched while they are ...

 2.2
 - API 100009, merged fixes made by Garkin. (Will reset saved variables)

-2.1
+2.1
 - API 100008

 2.0