forked from WeakAuras/WeakAuras2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the atlas files from wago.tools automatically
Code heavly based on code/ideas provided by Nightwarden24 in WeakAuras#4776 Just ported to lua for hopefully easier maintability Fixes: WeakAuras#4776
- Loading branch information
1 parent
21eb8eb
commit e3f7448
Showing
11 changed files
with
120 additions
and
22 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
local version = ... | ||
|
||
print("Creating atlas file for", version) | ||
|
||
local versionMap = { | ||
wow = "_Retail", | ||
wow_classic = "_Wrath", | ||
wow_classic_era = "_Vanilla" | ||
} | ||
|
||
if not versionMap[version] then | ||
print("Unknown version", version) | ||
return 1 | ||
end | ||
|
||
local outputFileName = "Atlas" .. versionMap[version] .. ".lua" | ||
|
||
local ftcsv = require('ftcsv') | ||
|
||
local validAtlasIds = {} | ||
local validAtlasElementIds = {} | ||
local validNames = {} | ||
|
||
for lineNr, atlas in ftcsv.parseLine("UiTextureAtlas.csv", ",") do | ||
validAtlasIds[atlas.ID] = true | ||
end | ||
|
||
for lineNr, member in ftcsv.parseLine("UiTextureAtlasMember.csv", ",") do | ||
local uiTextureAtlasID = member.UiTextureAtlasID | ||
local uiTextureAtlasElementId = member.UiTextureAtlasElementID | ||
|
||
if validAtlasIds[uiTextureAtlasID] and not validAtlasElementIds[uiTextureAtlasElementId] then | ||
validAtlasElementIds[uiTextureAtlasElementId] = true | ||
end | ||
end | ||
|
||
for lineNr, element in ftcsv.parseLine("UiTextureAtlasElement.csv", ",") do | ||
local name = element.Name | ||
local id = element.ID | ||
if validAtlasElementIds[id] and name:lower():sub(1, 5) ~= "cguy_" then | ||
validNames[name] = true | ||
end | ||
end | ||
|
||
--for name in pairs(validNames) do | ||
-- print("Found +", name) | ||
--end | ||
|
||
local output = io.open(outputFileName, "w+") | ||
output:write("if not WeakAuras.IsLibsOK() then return end\n") | ||
output:write("--- @type string, Private\n") | ||
output:write("local AddonName, Private = ...\n") | ||
output:write("Private.AtlasList = {") | ||
for name in pairs(validNames) do | ||
output:write('"') | ||
output:write(name) | ||
output:write('",') | ||
end | ||
output:write("}\n") | ||
io.close(output) | ||
|
||
print("Created output file", outputFileName) | ||
return 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
for version in wow wow_classic wow_classic_era | ||
do | ||
wget -O "UiTextureAtlas.csv" "https://wago.tools/db2/UiTextureAtlas/csv?branch=${version}" | ||
wget -O "UiTextureAtlasMember.csv" "https://wago.tools/db2/UiTextureAtlasMember/csv?branch=${version}" | ||
wget -O "UiTextureAtlasElement.csv" "https://wago.tools/db2/UiTextureAtlasElement/csv?branch=${version}" | ||
|
||
lua ./atlas_update.lua ${version} | ||
done | ||
|
||
mv Atlas_Retail.lua ../../WeakAuras/ | ||
mv Atlas_Wrath.lua ../../WeakAuras/ | ||
mv Atlas_Vanilla.lua ../../WeakAuras/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Create Atlas file list update pull request | ||
|
||
on: | ||
schedule: | ||
- cron: '0 10 * * 1' | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
atlasUpdate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: leafo/gh-actions-lua@v10 | ||
- uses: leafo/gh-actions-luarocks@v4 | ||
|
||
- name: Lua rocks | ||
run: | | ||
luarocks install --server=https://luarocks.org/manifests/fouriertransformer ftcsv | ||
shell: bash | ||
|
||
- name: Update Atlas files from wago.tools | ||
run: | | ||
cd .github/scripts/ | ||
./wagotools-atlas.sh | ||
shell: bash | ||
|
||
- name: Cleanup luarocks | ||
run: | | ||
rm -rf .luarocks | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
branch: update-atlasfiles | ||
commit-message: Update atlas file list from wago.tools | ||
title: Update atlas file list from wago.tools | ||
delete-branch: true |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters