New release

Leandro Silva [11-10-18 - 12:32]
New release
Filename
LeoAltholic.lua
LeoAltholic.txt
LeoAltholic.xml
LeoAltholicInit.lua
LeoAltholic_API.lua
ui/research.lua
ui/toolbar.lua
diff --git a/LeoAltholic.lua b/LeoAltholic.lua
index bf6f8d2..28affbf 100644
--- a/LeoAltholic.lua
+++ b/LeoAltholic.lua
@@ -1309,10 +1309,6 @@ local function onAddOnLoaded(event, addonName)

     if GetDisplayName() == "@LeandroSilva" then
         SLASH_COMMANDS["/rr"] = function(cmd) ReloadUI() end
-        SLASH_COMMANDS["/r1"] = function(cmd)
-            LeoAltholic.globalData = nil
-            ReloadUI()
-        end
     end
     SLASH_COMMANDS["/leoalt"] = function(cmd) LeoAltholic:ToggleUI() end

diff --git a/LeoAltholic.txt b/LeoAltholic.txt
index 1573075..378d424 100644
--- a/LeoAltholic.txt
+++ b/LeoAltholic.txt
@@ -1,7 +1,7 @@
 ## Title: Leo's Altholic
 ## APIVersion: 100024 100025
-## Version: 1.6.8
-## AddOnVersion: 168
+## Version: 1.6.9
+## AddOnVersion: 169
 ## Author: |c39B027@LeandroSilva|r
 ## SavedVariables: LeoAltholicSavedVariables LeoAltholicCharVariables
 ## OptionalDependsOn: LibStub LibFeedback LibAddonMenu-2.0
diff --git a/LeoAltholic.xml b/LeoAltholic.xml
index 7872c60..21d6a5c 100644
--- a/LeoAltholic.xml
+++ b/LeoAltholic.xml
@@ -41,8 +41,6 @@
                 <Button name="$(parent)FeedbackButton" clickSound="Click">
                     <Anchor point="TOPRIGHT" relativePoint="TOPLEFT" relativeTo="$(parent)Close" offsetX="-5"/>
                     <Dimensions x="40" y="40"/>
-                    <OnMouseEnter>ZO_Tooltips_ShowTextTooltip(self, TOP, 'Research')</OnMouseEnter>
-                    <OnMouseExit>ZO_Tooltips_HideTextTooltip()</OnMouseExit>
                     <Controls>
                         <Backdrop name="$(parent)BG" centerColor="101010" edgeColor="202020">
                             <AnchorFill/>
diff --git a/LeoAltholicInit.lua b/LeoAltholicInit.lua
index 179e3d5..3f99f1d 100644
--- a/LeoAltholicInit.lua
+++ b/LeoAltholicInit.lua
@@ -6,7 +6,7 @@ LeoAltholicToolbarUI = LeoAltholicToolbarUI or {}

 LeoAltholic.name = "LeoAltholic"
 LeoAltholic.displayName = "Leo's Altholic"
-LeoAltholic.version = "1.6.8"
+LeoAltholic.version = "1.6.9"
 LeoAltholic.chatPrefix = "|c39B027" .. LeoAltholic.name .. "|r: "

 LeoAltholic.TAB_BIO = "Bio"
diff --git a/LeoAltholic_API.lua b/LeoAltholic_API.lua
index 3911d03..b1389a2 100644
--- a/LeoAltholic_API.lua
+++ b/LeoAltholic_API.lua
@@ -114,6 +114,22 @@ function LeoAltholic.HasStillResearchFor(craft, charName)
     end
 end

+function LeoAltholic.GetNumMissingTraitsFor(craft, charName)
+    if not charName then charName = LeoAltholic.CharName end
+    local char = LeoAltholic.globalData.CharList[charName]
+    if not char then return end
+    local missing = 0
+    for line = 1, GetNumSmithingResearchLines(craft) do
+        local _, _, numTraits = GetSmithingResearchLineInfo(craft, line)
+        for trait = 1, numTraits do
+            if not char.research.done[craft][line][trait] then
+                missing = missing + 1
+            end
+        end
+    end
+    return missing
+end
+
 function LeoAltholic.CharKnowsTrait(craft, line, trait, charName)
     if not charName then charName = LeoAltholic.CharName end
     local char = LeoAltholic.globalData.CharList[charName]
@@ -143,7 +159,7 @@ function LeoAltholic.GetNumTraitKnownPerLine(charName)
 end

 --[[
-Return the number of researching in progress, the total and the time of the first one to be completed (can be 0 or negative,
+Return the number of researches in progress, the total and the time of the first one to be completed (can be 0 or negative,
   indicating it's done)
 ]]
 function LeoAltholic.GetResearchCounters(craft, charName)
diff --git a/ui/research.lua b/ui/research.lua
index 91c1ee1..8327e7f 100644
--- a/ui/research.lua
+++ b/ui/research.lua
@@ -31,8 +31,13 @@ function LeoAltholicResearchList:SetupEntry(control, data)
     local color
     control.craft = {}
     for _,craft in pairs(LeoAltholic.craftResearch) do
-        local researching = #data.research.doing[craft]
         control.craft[craft] = GetControl(control, "Craft" .. craft)
+
+        local researching = #data.research.doing[craft]
+        local missing = LeoAltholic.GetNumMissingTraitsFor(craft, data.name)
+        local output
+        color = '|c'..LeoAltholic.color.hex.green
+
         local first
         local list = {}
         for _, research in pairs(data.research.doing[craft]) do
@@ -62,19 +67,25 @@ function LeoAltholicResearchList:SetupEntry(control, data)
             end
             table.insert(list, d)
         end
-        color = '|c'..LeoAltholic.color.hex.green
-        if researching < data.research.done[craft].max then
-            color = '|c'..LeoAltholic.color.hex.red
-        end
-        if researching > data.research.done[craft].max then researching = data.research.done[craft].max end
-        local output = color .. researching .. '/' .. data.research.done[craft].max .. '|r'
-        color = '|c'..LeoAltholic.color.hex.white
-        if first and first.doneAt ~= nil and first.doneAt - GetTimeStamp() <= 3600 then
-            color = '|c'..LeoAltholic.color.hex.yellow
-        end
-        if first ~= nil then
-            if first.doneAt ~= nil then
-                output = output .. " " .. color..LeoAltholic.FormatTime(first.doneAt - GetTimeStamp(), false, true) .. '|r'
+
+        if researching == 0 and missing == 0 then
+            output = color..ZO_CachedStrFormat(SI_ACHIEVEMENTS_TOOLTIP_COMPLETE).."|r"
+            list = {}
+        else
+            if researching < data.research.done[craft].max and researching < missing then
+                color = '|c'..LeoAltholic.color.hex.red
+            end
+            if researching > data.research.done[craft].max then researching = data.research.done[craft].max end
+
+            output = color .. researching .. '/' .. data.research.done[craft].max .. '|r'
+            color = '|c'..LeoAltholic.color.hex.white
+            if first and first.doneAt ~= nil and first.doneAt - GetTimeStamp() <= 3600 then
+                color = '|c'..LeoAltholic.color.hex.yellow
+            end
+            if first ~= nil then
+                if first.doneAt ~= nil then
+                    output = output .. " " .. color..LeoAltholic.FormatTime(first.doneAt - GetTimeStamp(), false, true) .. '|r'
+                end
             end
         end
         control.craft[craft]:SetText(output)
diff --git a/ui/toolbar.lua b/ui/toolbar.lua
index ad00ecb..31814fd 100644
--- a/ui/toolbar.lua
+++ b/ui/toolbar.lua
@@ -222,8 +222,9 @@ function LeoAltholicToolbarUI.update()
                     firstTexture = texture
                 end
                 local researching, total, lowest = LeoAltholic.GetResearchCounters(craft)
+                local missing = LeoAltholic.GetNumMissingTraitsFor(craft)
                 local color = '|c'..LeoAltholic.color.hex.green
-                if researching < total then
+                if researching < total and researching < missing then
                     color = '|c'..LeoAltholic.color.hex.red
                 end
                 label:SetText(color .. researching .. '/' .. total .. '|r ' .. LeoAltholic.FormatTime(lowest - GetTimeStamp(), true, true))