Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion .github/workflows/addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -101,13 +102,49 @@ 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).
files: |
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
Expand Down
17 changes: 17 additions & 0 deletions addons/GUIA.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 13 additions & 1 deletion addons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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 |
Expand Down
39 changes: 39 additions & 0 deletions addons/tools/addons_zip.en.txt
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions addons/tools/addons_zip.pt.txt
Original file line number Diff line number Diff line change
@@ -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
60 changes: 60 additions & 0 deletions addons/tools/addons_zip.py
Original file line number Diff line number Diff line change
@@ -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 picture<TAB>place 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)
8 changes: 8 additions & 0 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ <h2>Download Core Rules</h2>
<li><span class="system">Community Add-ons, for any of the above</span><span class="kind">Installer</span>
<a class="file" href="https://github.com/brahm/corerules/releases/download/addons/CoreRules-Community-Addons-x86_64.AppImage">CoreRules-Community-Addons-x86_64.AppImage</a>
<code>chmod +x CoreRules-Community-Addons-x86_64.AppImage</code></li>
<li><span class="system">Community Add-ons, for Linux, Windows and macOS</span><span class="kind">.zip</span>
<a class="file" href="https://github.com/brahm/corerules/releases/download/addons/CoreRules-Community-Addons.zip">CoreRules-Community-Addons.zip</a>
<span class="file-note">In Core Rules, choose Import Add-ons… and pick the folder that holds the zip.</span></li>
<li><span class="system">Windows 11</span><span class="kind">Microsoft Store</span>
<a class="file" href="https://apps.microsoft.com/detail/9nr2cgp649jm">Core Rules on the Microsoft Store</a>
<span class="file-note">Free; the Store installs it with the Windows App Runtime it needs and brings every update.</span></li>
Expand Down Expand Up @@ -300,8 +303,13 @@ <h2>Community Add-ons Collection</h2>
the Core Rules community.</p>
<div class="actions left">
<a class="btn primary" href="https://github.com/brahm/corerules/releases/download/addons/CoreRules-Community-Addons-x86_64.AppImage">Download the add-ons installer</a>
<a class="btn" href="https://github.com/brahm/corerules/releases/download/addons/CoreRules-Community-Addons.zip">Download the add-ons as a .zip</a>
<a class="btn" href="https://github.com/brahm/corerules/tree/main/addons">What's inside</a>
</div>
<p class="small">On Windows, macOS or any Linux, the <a href="https://github.com/brahm/corerules/releases/download/addons/CoreRules-Community-Addons.zip">.zip</a>
holds the same validated add-ons, pictures and texts: in Core Rules, choose
<strong>Import Add-ons…</strong> and pick the folder that holds the zip, with no need to extract it.
The original Expansion program imports its <code>Comunidade.xpx</code> too.</p>
<p class="small">The link always gives the newest build. The same file, version by version:
<a href="https://github.com/brahm/corerules/releases/download/addons/CoreRules-Community-Addons-1.0.0-x86_64.AppImage">CoreRules-Community-Addons-1.0.0-x86_64.AppImage</a>
on the <a href="https://github.com/brahm/corerules/releases/tag/addons">addons release</a>, and on
Expand Down
Loading