From a2150ba25018342f93c6d67fe3cf63a347f1ccae Mon Sep 17 00:00:00 2001
From: Claude
Date: Thu, 29 Oct 2026 23:57:50 +0000
Subject: [PATCH] Add-ons as a .zip for Import Add-ons, on the addons release
and the site
addons/tools/addons_zip.py unpacks the installer's Comunidade.xpx.xz and
Comunidade-extras.xz into CoreRules-Community-Addons-VERSION.zip: the
consolidated package, the pictures with pictures.tsv (where each one
goes), the texts and a README in English and Portuguese. The zip is the
same bytes for the same input. A new job in the Addons package workflow
builds and checks it and, on main, attaches it to the addons release as
CoreRules-Community-Addons.zip and with its version. The site, the
add-ons README and GUIA link it.
Co-Authored-By: Claude Opus 5.5
Claude-Session: https://claude.ai/code/session_01NiPLVQ35xkzt2yvTEn4XKU
---
.github/workflows/addons.yml | 39 +++++++++++++++++++++-
addons/GUIA.md | 17 ++++++++++
addons/README.md | 14 +++++++-
addons/tools/addons_zip.en.txt | 39 ++++++++++++++++++++++
addons/tools/addons_zip.pt.txt | 40 +++++++++++++++++++++++
addons/tools/addons_zip.py | 60 ++++++++++++++++++++++++++++++++++
site/index.html | 8 +++++
7 files changed, 215 insertions(+), 2 deletions(-)
create mode 100644 addons/tools/addons_zip.en.txt
create mode 100644 addons/tools/addons_zip.pt.txt
create mode 100644 addons/tools/addons_zip.py
diff --git a/.github/workflows/addons.yml b/.github/workflows/addons.yml
index 8137994..04bf4e7 100644
--- a/.github/workflows/addons.yml
+++ b/.github/workflows/addons.yml
@@ -7,7 +7,8 @@ name: Addons package
# and latest, and as the file itself in the Maven registry of GitHub
# Packages, and on the release "addons", whose tag follows main: there
# CoreRules-Community-Addons-x86_64.AppImage is always the newest, for a
-# download link that does not change.
+# download link that does not change. The zip job puts the same add-ons
+# there as CoreRules-Community-Addons.zip, for Import Add-ons… in the app.
on:
push:
branches: [main]
@@ -101,6 +102,8 @@ jobs:
./CoreRules-Community-Addons-x86_64.AppImage
```
+ On Windows, macOS or any Linux, download **CoreRules-Community-Addons.zip**, the same add-ons with their pictures and texts. In Core Rules, choose **Import Add-ons…** and pick the folder that holds the zip; there is no need to extract it. The original Expansion program can import its `Comunidade.xpx` too.
+
Direct link: https://github.com/${{ github.repository }}/releases/download/addons/CoreRules-Community-Addons-x86_64.AppImage
The same file is on GitHub Packages twice: as a file, `corerules-community-addons-${{ steps.v.outputs.version }}-x86_64.AppImage`, in the Maven package `io.github.brahm.corerules-community-addons` ([the project's packages](https://github.com/${{ github.repository_owner }}?tab=packages&repo_name=${{ github.event.repository.name }})), and in the OCI package [`corerules-community-addons`](https://github.com/${{ github.repository }}/pkgs/container/corerules-community-addons): `oras pull ghcr.io/${{ github.repository_owner }}/corerules-community-addons:latest`. The app itself is on the [Core Rules releases](https://github.com/${{ github.repository }}/releases).
@@ -108,6 +111,40 @@ jobs:
dist/CoreRules-Community-Addons-x86_64.AppImage
dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}-x86_64.AppImage
+ # The same add-ons as one .zip for Import Add-ons… in the app, on Linux,
+ # Windows and macOS: Comunidade.xpx with the pictures, pictures.tsv and
+ # the texts (addons/tools/addons_zip.py). On the addons release,
+ # CoreRules-Community-Addons.zip is always the newest.
+ zip:
+ needs: package
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ - id: v
+ run: echo "version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)" >> "$GITHUB_OUTPUT"
+ - run: python3 -I addons/tools/addons_zip.py ${{ steps.v.outputs.version }} dist
+ - name: Check the zip
+ run: |
+ zip=dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}.zip
+ unzip -tq "$zip"
+ unzip -l "$zip" | grep -q 'Comunidade.xpx$'
+ test "$(unzip -l "$zip" | grep -ci '\.bmp$')" -ge 600
+ cp "$zip" dist/CoreRules-Community-Addons.zip
+ (cd dist && sha256sum *.zip)
+ - uses: actions/upload-artifact@v4
+ with:
+ name: addons-zip
+ path: dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}.zip
+ - if: github.event_name != 'pull_request'
+ name: Publish on the addons release
+ uses: softprops/action-gh-release@v2
+ with:
+ tag_name: addons
+ make_latest: false
+ files: |
+ dist/CoreRules-Community-Addons.zip
+ dist/CoreRules-Community-Addons-${{ steps.v.outputs.version }}.zip
+
# GitHub Packages has no registry for plain files, and its container
# registry shows the AppImage as an OCI artifact. Its Maven registry keeps
# any file as it is, with its name and extension, and the package page
diff --git a/addons/GUIA.md b/addons/GUIA.md
index 03dd00a..5cd8f6a 100644
--- a/addons/GUIA.md
+++ b/addons/GUIA.md
@@ -42,6 +42,23 @@ curl -L -H "Authorization: Bearer $token" -o CoreRules-Community-Addons-x86_64.A
Além de `latest`, cada versão do app tem a sua tag, como `1.0.0`.
+## O pacote .zip, para Windows, macOS e qualquer Linux
+
+Os mesmos addons validados também saem num zip, **[CoreRules-Community-Addons.zip](https://github.com/brahm/corerules/releases/download/addons/CoreRules-Community-Addons.zip)**, na mesma [release addons](https://github.com/brahm/corerules/releases/tag/addons), com uma cópia de nome `CoreRules-Community-Addons-VERSÃO.zip` para cada versão. Ele serve para o comando **Importar add-ons…** do app, no Linux, no Windows e no macOS: escolha no menu a pasta onde está o zip, sem precisar extraí-lo, e o app lê todos os arquivos de uma vez, valida, importa os itens e copia as imagens para onde os registros as procuram, sem sobrescrever nenhum arquivo.
+
+Dentro dele há uma pasta, `CoreRules-Community-Addons-VERSÃO`, com:
+
+| Arquivo | Conteúdo |
+| --- | --- |
+| `Comunidade.xpx` | Os addons consolidados, no formato de exportação da Expansion; o Import do programa original também o lê |
+| `pictures/` | As 668 imagens (BMP de 8 bits), nas pastas dos seus addons |
+| `pictures.tsv` | Onde cada imagem vai na pasta de dados: a imagem, uma tabulação e o lugar |
+| `texts/` | Os 309 textos dos autores, em texto simples |
+| `addons.tsv` | O que cada pasta de addon trouxe para a coleção |
+| `README.txt`, `LEIA-ME.txt` | Como instalar, em inglês e em português |
+
+O zip é gerado a partir dos mesmos `Comunidade.xpx.xz` e `Comunidade-extras.xz` que vão dentro do instalador, por `tools/addons_zip.py VERSÃO PASTA`, no job `zip` do workflow `Addons package`.
+
## Instalação
1. Torne o arquivo executável e abra-o:
diff --git a/addons/README.md b/addons/README.md
index 70b2845..b44281e 100644
--- a/addons/README.md
+++ b/addons/README.md
@@ -70,6 +70,18 @@ app and in the original program.
## Installing
+On Windows, macOS or any Linux, download
+[`CoreRules-Community-Addons.zip`](https://github.com/brahm/corerules/releases/download/addons/CoreRules-Community-Addons.zip)
+from the [addons release](https://github.com/brahm/corerules/releases/tag/addons).
+It holds the same validated add-ons, as `Comunidade.xpx`, with the pictures,
+`pictures.tsv` (where each picture goes) and the texts. In Core Rules,
+choose **Import Add-ons…** and pick the folder that holds the zip; there is
+no need to extract it. The original Expansion program imports
+`Comunidade.xpx` too. `tools/addons_zip.py VERSION DIR` builds the zip from
+the files below.
+
+On Linux there is also the installer.
+
The collection is a single AppImage, `CoreRules-Community-Addons-VERSION-x86_64.AppImage`,
that carries the add-ons inside and installs them itself. It needs:
@@ -195,7 +207,7 @@ change to `main`.
| --- | --- |
| `Comunidade.xpx.xz` | The consolidated add-ons, as built into the installer |
| `Comunidade-extras.xz` | The add-ons' pictures and texts, and where each picture goes |
-| `tools/` | The scripts that chose each picture's place and built `Comunidade-extras.xz` |
+| `tools/` | The scripts that chose each picture's place, built `Comunidade-extras.xz` and build the add-ons' zip |
| [`relatorio.md`](relatorio.md) | The report, in Portuguese: what was converted, repaired or left out |
| [`compatibilidade.csv`](compatibilidade.csv) | One line per add-on package, with its status and item count |
| [`conflitos.csv`](conflitos.csv) | The names found in more than one package, and which version stayed |
diff --git a/addons/tools/addons_zip.en.txt b/addons/tools/addons_zip.en.txt
new file mode 100644
index 0000000..f64de81
--- /dev/null
+++ b/addons/tools/addons_zip.en.txt
@@ -0,0 +1,39 @@
+Core Rules Community Add-ons Collection VERSION
+===============================================
+
+The add-ons that the AD&D Core Rules community made for AD&D Core Rules 2.0
+and its Expansion, tested one by one and consolidated into one package:
+672 add-on packages, 36,525 items (races, classes, kits, spells, monsters,
+equipment, encounters, the characters of the published modules and the
+AD&D Core Rules User Database), with their 668 pictures and their authors'
+texts.
+
+Installing
+----------
+
+1. Open Core Rules (https://github.com/brahm/corerules) with your Expansion
+ data. If it is not there yet, use Extract Data from CD... first.
+2. Choose Import Add-ons... in the menu and pick the folder that holds
+ this zip; there is no need to extract it. Core Rules reads every file
+ in the folder and in the zip at once, checks each add-on, imports them
+ and copies the pictures where the records look for them, never over a
+ file that is already there. The extracted folder,
+ CoreRules-Community-Addons-VERSION, works the same way.
+
+The original Expansion program can import Comunidade.xpx too, with its
+own Import command.
+
+What's in the folder
+--------------------
+
+Comunidade.xpx The consolidated add-ons, in the Expansion's export format
+pictures/ The pictures (8-bit BMP), in their add-on folders
+pictures.tsv Where each picture goes in the data folder, one per line:
+ the picture, a tab, its place (Bitmaps/Monsters/...,
+ Bitmaps/Portrait/..., UserBMP/...)
+texts/ The texts the authors wrote, as plain text
+addons.tsv What each add-on folder brought into the collection
+
+The add-ons belong to their authors in the Core Rules community. Where a
+name appeared in more than one add-on, the newest version stayed; the full
+report is at https://github.com/brahm/corerules/tree/main/addons
diff --git a/addons/tools/addons_zip.pt.txt b/addons/tools/addons_zip.pt.txt
new file mode 100644
index 0000000..645b0ea
--- /dev/null
+++ b/addons/tools/addons_zip.pt.txt
@@ -0,0 +1,40 @@
+Coleção de Add-ons da Comunidade do Core Rules VERSION
+=====================================================
+
+Os add-ons que a comunidade do AD&D Core Rules fez para o AD&D Core Rules
+2.0 e seu Expansion, testados um a um e consolidados em um só pacote: 672
+pacotes de add-ons, 36.525 itens (raças, classes, kits, magias, monstros,
+equipamento, encontros, os personagens dos módulos publicados e o AD&D
+Core Rules User Database), com as 668 figuras e os textos dos autores.
+
+Como instalar
+-------------
+
+1. Abra o Core Rules (https://github.com/brahm/corerules) com os dados do
+ seu Expansion. Se ainda não estiverem lá, use antes Extrair dados do
+ CD...
+2. Escolha Importar add-ons... no menu e aponte a pasta onde está este
+ zip; não é preciso extraí-lo. O Core Rules lê todos os arquivos da
+ pasta e do zip de uma vez, valida cada add-on, importa e copia as
+ figuras para onde os registros as procuram, sem sobrescrever nenhum
+ arquivo. A pasta extraída, CoreRules-Community-Addons-VERSION, também
+ serve.
+
+O programa original do Expansion também importa o Comunidade.xpx, com o
+seu próprio comando Import.
+
+O que há na pasta
+-----------------
+
+Comunidade.xpx Os add-ons consolidados, no formato de exportação do
+ Expansion
+pictures/ As figuras (BMP de 8 bits), nas pastas dos seus add-ons
+pictures.tsv Onde cada figura vai na pasta de dados, uma por linha: a
+ figura, uma tabulação e o lugar (Bitmaps/Monsters/...,
+ Bitmaps/Portrait/..., UserBMP/...)
+texts/ Os textos que os autores escreveram, em texto simples
+addons.tsv O que cada pasta de add-on trouxe para a coleção
+
+Os add-ons pertencem aos seus autores na comunidade do Core Rules. Onde
+um nome aparecia em mais de um add-on, ficou a versão mais nova; o
+relatório completo está em https://github.com/brahm/corerules/tree/main/addons
diff --git a/addons/tools/addons_zip.py b/addons/tools/addons_zip.py
new file mode 100644
index 0000000..93d8500
--- /dev/null
+++ b/addons/tools/addons_zip.py
@@ -0,0 +1,60 @@
+"""Builds the add-ons' zip, CoreRules-Community-Addons-VERSION.zip: the
+same validated add-ons the installer carries, as files that Core Rules'
+Import Add-ons reads from a folder.
+
+usage: addons_zip.py VERSION OUT_DIR
+
+Reads addons/Comunidade.xpx.xz and addons/Comunidade-extras.xz (see
+crates/cr-addons/src/extras.rs for the extras' format) and writes, under
+one folder, CoreRules-Community-Addons-VERSION/:
+ Comunidade.xpx the consolidated add-ons, in the Expansion's format
+ pictures/... the pictures, in their add-on folders
+ pictures.tsv pictureplace in the installation, one per line
+ texts/... the authors' texts, as plain text
+ addons.tsv what each add-on folder brought (extras.rs)
+ README.txt, LEIA-ME.txt
+"""
+import lzma, os, sys, zipfile
+
+here = os.path.dirname(os.path.abspath(__file__))
+addons = os.path.dirname(here)
+version, out_dir = sys.argv[1:3]
+name = f'CoreRules-Community-Addons-{version}'
+
+data = lzma.open(os.path.join(addons, 'Comunidade-extras.xz')).read()
+end = data.index(b'\n\n')
+lines = data[:end].decode('utf-8').split('\n')
+if lines[0] != 'CRX1':
+ sys.exit('Comunidade-extras.xz: not a CRX1 bundle')
+at, files, placements = end + 2, [], []
+for line in lines[1:]:
+ kind, a, b = line.split('\t')
+ if kind == 'F':
+ files.append((b, data[at:at + int(a)]))
+ at += int(a)
+ elif kind == 'P':
+ placements.append(f'{a}\t{b}\n')
+if at > len(data):
+ sys.exit('Comunidade-extras.xz: truncated')
+
+def readme(lang):
+ with open(os.path.join(here, f'addons_zip.{lang}.txt'), encoding='utf-8') as f:
+ return f.read().replace('VERSION', version).replace('\n', '\r\n').encode('utf-8')
+
+# Fixed dates and order, so the same input gives the same zip.
+def put(z, path, raw, compress=zipfile.ZIP_DEFLATED):
+ info = zipfile.ZipInfo(f'{name}/{path}', date_time=(2000, 1, 1, 0, 0, 0))
+ info.external_attr = 0o644 << 16
+ z.writestr(info, raw, compress_type=compress, compresslevel=9)
+
+os.makedirs(out_dir, exist_ok=True)
+out = os.path.join(out_dir, f'{name}.zip')
+with zipfile.ZipFile(out + '.part', 'w') as z:
+ put(z, 'README.txt', readme('en'))
+ put(z, 'LEIA-ME.txt', readme('pt'))
+ put(z, 'Comunidade.xpx', lzma.open(os.path.join(addons, 'Comunidade.xpx.xz')).read())
+ put(z, 'pictures.tsv', ''.join(placements).encode('utf-8'))
+ for path, raw in files:
+ put(z, path, raw)
+os.replace(out + '.part', out)
+print(out)
diff --git a/site/index.html b/site/index.html
index ca653f4..4ff3551 100644
--- a/site/index.html
+++ b/site/index.html
@@ -204,6 +204,9 @@ Download Core Rules
Community Add-ons, for any of the aboveInstaller
CoreRules-Community-Addons-x86_64.AppImage
chmod +x CoreRules-Community-Addons-x86_64.AppImage
+ Community Add-ons, for Linux, Windows and macOS.zip
+ CoreRules-Community-Addons.zip
+ In Core Rules, choose Import Add-ons… and pick the folder that holds the zip.
Windows 11Microsoft Store
Core Rules on the Microsoft Store
Free; the Store installs it with the Windows App Runtime it needs and brings every update.
@@ -300,8 +303,13 @@ Community Add-ons Collection
the Core Rules community.
+ On Windows, macOS or any Linux, the .zip
+ holds the same validated add-ons, pictures and texts: in Core Rules, choose
+ Import Add-ons… and pick the folder that holds the zip, with no need to extract it.
+ The original Expansion program imports its Comunidade.xpx too.
The link always gives the newest build. The same file, version by version:
CoreRules-Community-Addons-1.0.0-x86_64.AppImage
on the addons release, and on