Merge branch 'linting' of fbrinker/elderscrolls-addon-achievementInfo into master
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
f0e4ed5837
15
.drone.yml
15
.drone.yml
@ -11,9 +11,16 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- git clone https://git.f-brinker.de/fbrinker/elderscrolls-addon-achievementInfo.git sources
|
- git clone https://git.f-brinker.de/fbrinker/elderscrolls-addon-achievementInfo.git sources
|
||||||
- cd sources && git checkout $DRONE_COMMIT
|
- cd sources && git checkout $DRONE_COMMIT
|
||||||
when:
|
|
||||||
event:
|
- name: lint
|
||||||
- tag
|
image: alpine
|
||||||
|
commands:
|
||||||
|
- apk update
|
||||||
|
- apk add --no-cache build-base curl unzip
|
||||||
|
- apk add --no-cache lua5.1 lua5.1-dev luarocks5.1
|
||||||
|
- luarocks-5.1 install luacheck
|
||||||
|
- cd sources
|
||||||
|
- luacheck ./*.lua
|
||||||
|
|
||||||
- name: build
|
- name: build
|
||||||
image: alpine
|
image: alpine
|
||||||
@ -25,7 +32,7 @@ steps:
|
|||||||
# Set Version and AddonVersion
|
# Set Version and AddonVersion
|
||||||
- export VERSION=$DRONE_TAG
|
- export VERSION=$DRONE_TAG
|
||||||
- export ADDON_VERSION=$(echo $DRONE_TAG | sed -E 's/(0|)\.//g')
|
- export ADDON_VERSION=$(echo $DRONE_TAG | sed -E 's/(0|)\.//g')
|
||||||
- sed -i "s/%VERSION%/$VERSION/g" sources/AchievementInfoCommon.lua
|
- sed -i "s/\"%VERSION%\"/$VERSION/g" sources/AchievementInfoCommon.lua
|
||||||
- sed -i "s/%VERSION%/$VERSION/g" sources/AchievementInfo.txt
|
- sed -i "s/%VERSION%/$VERSION/g" sources/AchievementInfo.txt
|
||||||
- sed -i "s/%ADDON_VERSION%/$ADDON_VERSION/g" sources/AchievementInfo.txt
|
- sed -i "s/%ADDON_VERSION%/$ADDON_VERSION/g" sources/AchievementInfo.txt
|
||||||
# Rename and zip
|
# Rename and zip
|
||||||
|
23
.luacheckrc
Normal file
23
.luacheckrc
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
compat = true
|
||||||
|
allow_defined = true
|
||||||
|
max_line_length = false
|
||||||
|
|
||||||
|
read_globals = {
|
||||||
|
"GetAchievementId",
|
||||||
|
"GetAchievementCategoryInfo",
|
||||||
|
"GetAchievementCriterion",
|
||||||
|
"GetAchievementLink",
|
||||||
|
"GetAchievementNumCriteria",
|
||||||
|
"GetCategoryInfoFromAchievementId",
|
||||||
|
"GetCVar",
|
||||||
|
"GetNumAchievementCategories",
|
||||||
|
"GetPreviousAchievementInLine",
|
||||||
|
"CHAT_SYSTEM",
|
||||||
|
"EVENT_ACHIEVEMENT_UPDATED",
|
||||||
|
"EVENT_ADD_ON_LOADED",
|
||||||
|
"EVENT_MANAGER",
|
||||||
|
"LibStub",
|
||||||
|
"LINK_STYLE_BRACKET",
|
||||||
|
"zo_callLater",
|
||||||
|
"ZO_SavedVars",
|
||||||
|
}
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
-- Init
|
-- Init
|
||||||
AchievementInfo.hijackedFirstLoad = false
|
AchievementInfo.hijackedFirstLoad = false
|
||||||
function AchievementInfo.initialize(eventCode, addOnName)
|
function AchievementInfo.initialize(_, addOnName)
|
||||||
if (addOnName ~= AchievementInfo.name) then return end
|
if (addOnName ~= AchievementInfo.name) then return end
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -26,7 +26,7 @@ function AchievementInfo.initialize(eventCode, addOnName)
|
|||||||
-- Register Events
|
-- Register Events
|
||||||
AchievementInfo.registerEvent(EVENT_ACHIEVEMENT_UPDATED, AchievementInfo.onAchievementUpdated)
|
AchievementInfo.registerEvent(EVENT_ACHIEVEMENT_UPDATED, AchievementInfo.onAchievementUpdated)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Status Output (debug mode only)
|
-- Status Output (debug mode only)
|
||||||
if AchievementInfo.settingGet("devDebug") then
|
if AchievementInfo.settingGet("devDebug") then
|
||||||
zo_callLater(function()
|
zo_callLater(function()
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
|
|
||||||
-- Do the magic
|
-- Do the magic
|
||||||
function AchievementInfo.onAchievementUpdated(eventCode, achId)
|
function AchievementInfo.onAchievementUpdated(_, achId)
|
||||||
local output = ""
|
local output = ""
|
||||||
|
|
||||||
-- addOn enabled?
|
-- addOn enabled?
|
||||||
@ -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,19 +60,19 @@ 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"
|
||||||
tmpOutput = tmpOutput .. AchievementInfo.clrDefault
|
tmpOutput = tmpOutput .. AchievementInfo.clrDefault
|
||||||
|
|
||||||
if AchievementInfo.settingGet("genShowOpenDetailsOnly") == true and numCompleted ~= numRequired then
|
if AchievementInfo.settingGet("genShowOpenDetailsOnly") == true and numCompleted ~= numRequired then
|
||||||
detailOutput[detailOutputCount] = tmpOutput
|
detailOutput[detailOutputCount] = tmpOutput
|
||||||
detailOutputCount = detailOutputCount + 1
|
detailOutputCount = detailOutputCount + 1
|
||||||
@ -103,14 +102,14 @@ function AchievementInfo.onAchievementUpdated(eventCode, achId)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- show details?
|
-- show details?
|
||||||
local detailsCount = AchievementInfo.tableLength(detailOutput)
|
local detailsCount = AchievementInfo.tableLength(detailOutput)
|
||||||
if AchievementInfo.settingGet("genShowDetails") == true and detailsCount > 0 and AchievementInfo.settingGet("genOnePerLine") == false then
|
if AchievementInfo.settingGet("genShowDetails") == true and detailsCount > 0 and AchievementInfo.settingGet("genOnePerLine") == false then
|
||||||
output = output .. " - "
|
output = output .. " - "
|
||||||
|
|
||||||
for i = 1, detailsCount, 1 do
|
for i = 1, detailsCount, 1 do
|
||||||
output = output .. detailOutput[i]
|
output = output .. detailOutput[i]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
output = output .. "."
|
output = output .. "."
|
||||||
end
|
end
|
||||||
@ -135,12 +134,12 @@ function AchievementInfo.onAchievementUpdated(eventCode, achId)
|
|||||||
--
|
--
|
||||||
|
|
||||||
AchievementInfo.echo(output)
|
AchievementInfo.echo(output)
|
||||||
|
|
||||||
-- output the details line by line - start @2 because the normal output happend before (achievement name)
|
-- output the details line by line - start @2 because the normal output happend before (achievement name)
|
||||||
if AchievementInfo.settingGet("genShowDetails") == true and AchievementInfo.settingGet("genOnePerLine") == true then
|
if AchievementInfo.settingGet("genShowDetails") == true and AchievementInfo.settingGet("genOnePerLine") == true then
|
||||||
for i = 1, AchievementInfo.tableLength(detailOutput), 1 do
|
for i = 1, AchievementInfo.tableLength(detailOutput), 1 do
|
||||||
AchievementInfo.echo(detailOutput[i])
|
AchievementInfo.echo(detailOutput[i])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -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
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
AchievementInfo = {}
|
AchievementInfo = {}
|
||||||
AchievementInfo.name = "AchievementInfo"
|
AchievementInfo.name = "AchievementInfo"
|
||||||
AchievementInfo.author = "Asto, @Astarax"
|
AchievementInfo.author = "Asto, @Astarax"
|
||||||
AchievementInfo.version = %VERSION%
|
AchievementInfo.version = "%VERSION%"
|
||||||
AchievementInfo.savedVars = nil
|
AchievementInfo.savedVars = nil
|
||||||
AchievementInfo.LangStore = {}
|
AchievementInfo.LangStore = {}
|
||||||
|
|
||||||
|
@ -122,43 +122,43 @@ LANG_STORE.DE.SettingsOption.DebugModeWarning = "In den meißten Fällen muss di
|
|||||||
-- AddOn Output
|
-- AddOn Output
|
||||||
LANG_STORE.FR.Updated = "Mis à jour"
|
LANG_STORE.FR.Updated = "Mis à jour"
|
||||||
LANG_STORE.FR.Completed = "Terminé"
|
LANG_STORE.FR.Completed = "Terminé"
|
||||||
|
|
||||||
-- AddOn Settings Header
|
-- AddOn Settings Header
|
||||||
LANG_STORE.FR.SettingsHeader = {}
|
LANG_STORE.FR.SettingsHeader = {}
|
||||||
LANG_STORE.FR.SettingsHeader.General = "Général"
|
LANG_STORE.FR.SettingsHeader.General = "Général"
|
||||||
|
|
||||||
LANG_STORE.FR.SettingsHeader.Categories = "Catégories"
|
LANG_STORE.FR.SettingsHeader.Categories = "Catégories"
|
||||||
LANG_STORE.FR.SettingsHeader.CategoriesDescription = "Ici vous pouvez gérer les notifications par catégories"
|
LANG_STORE.FR.SettingsHeader.CategoriesDescription = "Ici vous pouvez gérer les notifications par catégories"
|
||||||
|
|
||||||
LANG_STORE.FR.SettingsHeader.Development = "Développement"
|
LANG_STORE.FR.SettingsHeader.Development = "Développement"
|
||||||
|
|
||||||
-- AddOn Settings General Options
|
-- AddOn Settings General Options
|
||||||
LANG_STORE.FR.SettingsOption = {}
|
LANG_STORE.FR.SettingsOption = {}
|
||||||
LANG_STORE.FR.SettingsOption.AddOnEnabled = "Extension activée"
|
LANG_STORE.FR.SettingsOption.AddOnEnabled = "Extension activée"
|
||||||
LANG_STORE.FR.SettingsOption.AddOnEnabledTooltip = "Active ou désactive cette extension"
|
LANG_STORE.FR.SettingsOption.AddOnEnabledTooltip = "Active ou désactive cette extension"
|
||||||
LANG_STORE.FR.SettingsOption.AddOnEnabledWarning = "Seul les messages sortants peuvent être désactivés"
|
LANG_STORE.FR.SettingsOption.AddOnEnabledWarning = "Seul les messages sortants peuvent être désactivés"
|
||||||
|
|
||||||
LANG_STORE.FR.SettingsOption.ShowEveryUpdate = "Affichage de chaque mise à jour"
|
LANG_STORE.FR.SettingsOption.ShowEveryUpdate = "Affichage de chaque mise à jour"
|
||||||
LANG_STORE.FR.SettingsOption.ShowEveryUpdateTooltip = "Affiche un message pour chaque mise à jour d'un succès. Le reste du temps les messages n'apparaissent que sous forme de plage de x%"
|
LANG_STORE.FR.SettingsOption.ShowEveryUpdateTooltip = "Affiche un message pour chaque mise à jour d'un succès. Le reste du temps les messages n'apparaissent que sous forme de plage de x%"
|
||||||
|
|
||||||
LANG_STORE.FR.SettingsOption.ShowUpdateSteps = "Etapes de notification (%)"
|
LANG_STORE.FR.SettingsOption.ShowUpdateSteps = "Etapes de notification (%)"
|
||||||
LANG_STORE.FR.SettingsOption.ShowUpdateStepsTooltip = "Définie la plage des notifications, si '" .. LANG_STORE.FR.SettingsOption.ShowEveryUpdate .. "' est désactivé"
|
LANG_STORE.FR.SettingsOption.ShowUpdateStepsTooltip = "Définie la plage des notifications, si '" .. LANG_STORE.FR.SettingsOption.ShowEveryUpdate .. "' est désactivé"
|
||||||
|
|
||||||
LANG_STORE.FR.SettingsOption.ShowDetails = "Affichage des détails"
|
LANG_STORE.FR.SettingsOption.ShowDetails = "Affichage des détails"
|
||||||
LANG_STORE.FR.SettingsOption.ShowDetailsTooltip = "Affiche les détails de progression de chaque message de mise à jour"
|
LANG_STORE.FR.SettingsOption.ShowDetailsTooltip = "Affiche les détails de progression de chaque message de mise à jour"
|
||||||
|
|
||||||
LANG_STORE.FR.SettingsOption.ShowOpenDetailsOnly = "Affichage des détails incomplets"
|
LANG_STORE.FR.SettingsOption.ShowOpenDetailsOnly = "Affichage des détails incomplets"
|
||||||
LANG_STORE.FR.SettingsOption.ShowOpenDetailsOnlyTooltip = "Affiche, dans les détails, uniquement les taches incomplètes d'un succès"
|
LANG_STORE.FR.SettingsOption.ShowOpenDetailsOnlyTooltip = "Affiche, dans les détails, uniquement les taches incomplètes d'un succès"
|
||||||
|
|
||||||
-- pCHat compatibility option
|
-- pCHat compatibility option
|
||||||
LANG_STORE.FR.SettingsOption.OneElementPerLine = "Sortie ligne par ligne"
|
LANG_STORE.FR.SettingsOption.OneElementPerLine = "Sortie ligne par ligne"
|
||||||
LANG_STORE.FR.SettingsOption.OneElementPerLineTooltip = "Affiche chaque partie d'un succès sur une simple ligne"
|
LANG_STORE.FR.SettingsOption.OneElementPerLineTooltip = "Affiche chaque partie d'un succès sur une simple ligne"
|
||||||
LANG_STORE.FR.SettingsOption.OneElementPerLineWarning = "Nécessite la compatibilité avec pChat"
|
LANG_STORE.FR.SettingsOption.OneElementPerLineWarning = "Nécessite la compatibilité avec pChat"
|
||||||
|
|
||||||
-- AddOn Settings Category Options
|
-- AddOn Settings Category Options
|
||||||
-- The categories are taken from the game language files
|
-- The categories are taken from the game language files
|
||||||
LANG_STORE.FR.SettingsOption.CategoryTooltip = "Affiche les messages pour la catégorie"
|
LANG_STORE.FR.SettingsOption.CategoryTooltip = "Affiche les messages pour la catégorie"
|
||||||
|
|
||||||
-- AddOn Settings Development Options
|
-- AddOn Settings Development Options
|
||||||
LANG_STORE.FR.SettingsOption.DebugMode = "Mode de débogage"
|
LANG_STORE.FR.SettingsOption.DebugMode = "Mode de débogage"
|
||||||
LANG_STORE.FR.SettingsOption.DebugModeTooltip = "Affiche les messages cachés pour vérifier s'ils n'ont pas été cachés par erreur"
|
LANG_STORE.FR.SettingsOption.DebugModeTooltip = "Affiche les messages cachés pour vérifier s'ils n'ont pas été cachés par erreur"
|
||||||
|
@ -47,7 +47,7 @@ end
|
|||||||
-- Function to create the settings panel
|
-- Function to create the settings panel
|
||||||
function AchievementInfo.createSettingsPanel()
|
function AchievementInfo.createSettingsPanel()
|
||||||
local LAM = LibStub("LibAddonMenu-2.0")
|
local LAM = LibStub("LibAddonMenu-2.0")
|
||||||
|
|
||||||
local panelData = {
|
local panelData = {
|
||||||
type = "panel",
|
type = "panel",
|
||||||
name = AchievementInfo.name,
|
name = AchievementInfo.name,
|
||||||
@ -119,14 +119,13 @@ function AchievementInfo.createSettingsPanel()
|
|||||||
text = LANG.SettingsHeader.CategoriesDescription .. ":"
|
text = LANG.SettingsHeader.CategoriesDescription .. ":"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- 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",
|
||||||
name = catName,
|
name = catName,
|
||||||
@ -135,13 +134,13 @@ function AchievementInfo.createSettingsPanel()
|
|||||||
setFunc = function() AchievementInfo.settingToogle("cat"..i) end
|
setFunc = function() AchievementInfo.settingToogle("cat"..i) end
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Debug setting at the end
|
-- Debug setting at the end
|
||||||
table.insert(optionsTable, {
|
table.insert(optionsTable, {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = AchievementInfo.clrSettingsHeader .. LANG.SettingsHeader.Development
|
name = AchievementInfo.clrSettingsHeader .. LANG.SettingsHeader.Development
|
||||||
})
|
})
|
||||||
|
|
||||||
table.insert(optionsTable, {
|
table.insert(optionsTable, {
|
||||||
type = "checkbox",
|
type = "checkbox",
|
||||||
name = LANG.SettingsOption.DebugMode,
|
name = LANG.SettingsOption.DebugMode,
|
||||||
@ -150,7 +149,7 @@ function AchievementInfo.createSettingsPanel()
|
|||||||
setFunc = function() AchievementInfo.settingToogle("devDebug") end,
|
setFunc = function() AchievementInfo.settingToogle("devDebug") end,
|
||||||
warning = LANG.SettingsOption.DebugModeWarning
|
warning = LANG.SettingsOption.DebugModeWarning
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Register
|
-- Register
|
||||||
LAM:RegisterAddonPanel(AchievementInfo.name.."SettingsPanel", panelData)
|
LAM:RegisterAddonPanel(AchievementInfo.name.."SettingsPanel", panelData)
|
||||||
LAM:RegisterOptionControls(AchievementInfo.name.."SettingsPanel", optionsTable)
|
LAM:RegisterOptionControls(AchievementInfo.name.."SettingsPanel", optionsTable)
|
||||||
|
@ -17,3 +17,6 @@ I'll still be available here and be able to update the ESOUI page.
|
|||||||
**IMPORTANT: Github is a mirror.** Please contribute at [git.f-brinker.de/elderscrolls-addon-achievementInfo](https://git.f-brinker.de/fbrinker/elderscrolls-addon-achievementInfo) - You can login with your Github or Gitlab account (OAuth2).
|
**IMPORTANT: Github is a mirror.** Please contribute at [git.f-brinker.de/elderscrolls-addon-achievementInfo](https://git.f-brinker.de/fbrinker/elderscrolls-addon-achievementInfo) - You can login with your Github or Gitlab account (OAuth2).
|
||||||
|
|
||||||
Then, create a fork of the repository, do what you have to do and create a pull-request afterwards. Feel free to contact me any time.
|
Then, create a fork of the repository, do what you have to do and create a pull-request afterwards. Feel free to contact me any time.
|
||||||
|
|
||||||
|
#### Linting
|
||||||
|
Luacheck is used to check the LUA code. [Documentation](https://luacheck.readthedocs.io/en/stable/index.html)
|
Loading…
Reference in New Issue
Block a user