New release
Leandro Silva [11-03-18 - 09:54]
diff --git a/LeoTrainer.txt b/LeoTrainer.txt
index c9ce42e..e0ee7e2 100644
--- a/LeoTrainer.txt
+++ b/LeoTrainer.txt
@@ -1,6 +1,6 @@
## Title: Leo's Trainer
## APIVersion: 100024 100025
-## Version: 1.1.0
+## Version: 1.1.1
## Author: |c39B027@LeandroSilva|r
## SavedVariables: LeoTrainerSavedVariables
## DependsOn: LeoAltholic
diff --git a/LeoTrainerConst.lua b/LeoTrainerConst.lua
index c7fcfe0..8387b85 100644
--- a/LeoTrainerConst.lua
+++ b/LeoTrainerConst.lua
@@ -3,7 +3,7 @@ LeoTrainer = {}
LeoTrainerUI = {}
LeoTrainer.name = "LeoTrainer"
LeoTrainer.displayName = "Leo's Trainer"
-LeoTrainer.version = "1.1.0"
+LeoTrainer.version = "1.1.1"
LeoTrainer.chatPrefix = "|c39B027" .. LeoTrainer.name .. "|r: "
LeoTrainer.setting = nil
LeoTrainer.hidden = true
diff --git a/LeoTrainerUI.lua b/LeoTrainerUI.lua
index 25ff838..0ca1015 100644
--- a/LeoTrainerUI.lua
+++ b/LeoTrainerUI.lua
@@ -530,16 +530,30 @@ function LeoTrainer.RemoveFromQueue(pos)
LeoTrainer.queueScroll:RefreshData()
end
-local function getTraitData(research, craft, line, trait)
- local traitData = research.done[craft][line][trait] or false
- if traitData == false then
+local function getTraitResearchData(research, craft, line, trait)
+ local isKnown = research.done[craft][line][trait] or false
+ local isResearching = false
+ local doneAt
+ if isKnown == false then
for _, researching in pairs(research.doing[craft]) do
if researching.line == line and researching.trait == trait then
- return researching.doneAt
+ doneAt = researching.doneAt
+ isResearching = true
+ break
end
end
end
- return traitData
+ return isKnown, isResearching, doneAt
+end
+
+local function getNumOngoingResearchs(research, craft)
+ local num = 0
+ for _, researching in pairs(research.doing[craft]) do
+ if researching.doneAt - GetTimeStamp() > 0 then
+ num = num + 1
+ end
+ end
+ return num
end
local function getFirstUnknownTraitCanBeTrained(craft, line, unknownTraits, trainer)
@@ -593,12 +607,12 @@ function LeoTrainer.FillSlots(trainer, trainee)
researchingLines[char.bio.name][craft][line] = false
local lineName, _, numTraits = GetSmithingResearchLineInfo(craft, line)
for trait = 1, numTraits do
- local traitData = getTraitData(char.research, craft, line, trait)
- if type(traitData) == 'number' and GetDiffBetweenTimeStamps(traitData, GetTimeStamp()) > 0 then
+ local isKnown, isResearching, doneAt = getTraitResearchData(char.research, craft, line, trait)
+ if isResearching and doneAt - GetTimeStamp() > 0 then
researchingLines[char.bio.name][craft][line] = true
- elseif (type(traitData) == 'number' and GetDiffBetweenTimeStamps(traitData, GetTimeStamp()) <= 0) or traitData == true then
+ elseif isKnown or (isResearching and doneAt - GetTimeStamp() <= 0) then
knownCount[char.bio.name][craft][line] = knownCount[char.bio.name][craft][line] + 1
- elseif traitData == false then
+ elseif isKnown == false then
table.insert(unknownTraits[char.bio.name][craft][line], trait)
end
end
@@ -613,7 +627,7 @@ function LeoTrainer.FillSlots(trainer, trainee)
return a.count < b.count
end)
local styleId
- local max = char.research.done[craft].max - #char.research.doing[craft]
+ local max = char.research.done[craft].max - getNumOngoingResearchs(char.research, craft)
for i = 1, max do
for j, lineData in ipairs(lineList) do
if not lineData.added then