Fix variable issues

This commit is contained in:
Florian Brinker 2019-10-24 18:06:26 +02:00
parent 2a42d242aa
commit bbfec84081
2 changed files with 4 additions and 8 deletions

View File

@ -50,7 +50,6 @@ function AchievementInfo.onAchievementUpdated(eventCode, achId)
local percentageStepSize = AchievementInfo.settingGet("genShowUpdateSteps") local percentageStepSize = AchievementInfo.settingGet("genShowUpdateSteps")
local link = GetAchievementLink(achId, LINK_STYLE_BRACKET) local link = GetAchievementLink(achId, LINK_STYLE_BRACKET)
local name, description = GetAchievementInfo(achId)
local catName = "/" local catName = "/"
if categoryId ~= false then if categoryId ~= false then
@ -61,14 +60,14 @@ function AchievementInfo.onAchievementUpdated(eventCode, achId)
local numCriteria = GetAchievementNumCriteria(achId) local numCriteria = GetAchievementNumCriteria(achId)
for i = 1, numCriteria, 1 do for i = 1, numCriteria, 1 do
local name, numCompleted, numRequired = GetAchievementCriterion(achId, i) local description, numCompleted, numRequired = GetAchievementCriterion(achId, i)
local tmpOutput = "" local tmpOutput = ""
if i > 1 and AchievementInfo.settingGet("genOnePerLine") == false then if i > 1 and AchievementInfo.settingGet("genOnePerLine") == false then
tmpOutput = tmpOutput .. ", " tmpOutput = tmpOutput .. ", "
end end
tmpOutput = tmpOutput .. name .. " " tmpOutput = tmpOutput .. description .. " "
tmpOutput = tmpOutput .. AchievementInfo.calcCriteriaColor(numCompleted, numRequired) .. numCompleted .. "|r" tmpOutput = tmpOutput .. AchievementInfo.calcCriteriaColor(numCompleted, numRequired) .. numCompleted .. "|r"
tmpOutput = tmpOutput .. AchievementInfo.clrDefault .. "/" .. "|r" tmpOutput = tmpOutput .. AchievementInfo.clrDefault .. "/" .. "|r"
tmpOutput = tmpOutput .. AchievementInfo.clrCriteriaComplete .. numRequired .. "|r" tmpOutput = tmpOutput .. AchievementInfo.clrCriteriaComplete .. numRequired .. "|r"
@ -163,13 +162,11 @@ end
-- Get the correct achievement category -- Get the correct achievement category
function AchievementInfo.getCorrectAchievementCategoryId(achId) function AchievementInfo.getCorrectAchievementCategoryId(achId)
local previousAchievementId = GetPreviousAchievementInLine(achId) local previousAchievementId = GetPreviousAchievementInLine(achId)
local categoryId = 0
if AchievementInfo.checkForValidCategory(achId) == false and previousAchievementId ~= 0 then if AchievementInfo.checkForValidCategory(achId) == false and previousAchievementId ~= 0 then
return AchievementInfo.getCorrectAchievementCategoryId(previousAchievementId) return AchievementInfo.getCorrectAchievementCategoryId(previousAchievementId)
elseif AchievementInfo.checkForValidCategory(achId) then elseif AchievementInfo.checkForValidCategory(achId) then
categoryId = GetCategoryInfoFromAchievementId(achId) return GetCategoryInfoFromAchievementId(achId)
return categoryId
else else
return false return false
end end

View File

@ -122,10 +122,9 @@ function AchievementInfo.createSettingsPanel()
-- Add categories dynamically -- Add categories dynamically
local numCats = GetNumAchievementCategories() local numCats = GetNumAchievementCategories()
local catCount = 1
for i = 1, numCats, 1 do for i = 1, numCats, 1 do
catName, numSubCats = GetAchievementCategoryInfo(i) catName = GetAchievementCategoryInfo(i)
table.insert(optionsTable, { table.insert(optionsTable, {
type = "checkbox", type = "checkbox",