feat: import and group AlbionBB battle history
This commit is contained in:
180 files changed
+69005
-26
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,94 @@
|
||||
# Battle archive importer
|
||||
|
||||
The battle archive is maintained with a repeatable importer. It scans the full
|
||||
available OneUP battle history on AlbionBB Europe, with no season boundary or
|
||||
calendar cutoff.
|
||||
|
||||
## Commands
|
||||
|
||||
```bash
|
||||
npm run import:battles
|
||||
npm run sync:battles
|
||||
npm run build
|
||||
```
|
||||
|
||||
The first command scans and imports reports; the second downloads their preview
|
||||
images; the third builds the English and Persian site. Importing is an explicit
|
||||
maintenance command. The deployment workflow refreshes images and builds the
|
||||
saved archive without initiating a history scan.
|
||||
|
||||
To rebuild the archive from saved data without network access:
|
||||
|
||||
```bash
|
||||
npm run import:battles -- --offline
|
||||
```
|
||||
|
||||
## Configuration and selection
|
||||
|
||||
[Import configuration](../content/battle-import.json) contains the guild ID,
|
||||
server endpoints, and listing filters. The default listing filters require
|
||||
10 total participants and 5 OneUP participants, focusing on group fights.
|
||||
|
||||
The importer exhausts pagination rather than stopping at a particular battle
|
||||
date. It fetches missing battle details, refreshes the first page of recent
|
||||
reports, and reuses cached details for older reports. Cached history and every
|
||||
already published battle ID are retained, including reports no longer returned
|
||||
by the listing or below its participation filters.
|
||||
|
||||
Sessions are selected when at least 8 OneUP members participated in one
|
||||
engagement and the session has either 5 OneUP kills plus deaths or 1 million
|
||||
OneUP kill fame. Previously published battle IDs are preserved even below those
|
||||
thresholds. Selection does not favor positive K/D.
|
||||
|
||||
## Combining reports
|
||||
|
||||
An automatic merge requires all of the following:
|
||||
|
||||
1. At most 20 minutes from the previous engagement's finish to the next start.
|
||||
2. A combined start-to-finish duration of at most 90 minutes.
|
||||
3. At least 3 shared OneUP players, covering 50% of the smaller roster.
|
||||
4. At least 3 shared participant slots outside OneUP's alliance, covering 50% of
|
||||
the smaller outside-team composition. Guilds in the same alliance form one
|
||||
team; independent guilds retain their own identity.
|
||||
5. Both the previous engagement and the session's first engagement must match,
|
||||
preventing chains from gradually drifting to unrelated teams.
|
||||
|
||||
OneUP's allied guilds cannot create a match by themselves. Team identity uses
|
||||
alliance and guild membership; it does not prove a fight's location or objective.
|
||||
Ambiguous cases stay separate. Titles list the largest guilds outside OneUP's
|
||||
alliance and the engagement's start time in UTC.
|
||||
|
||||
These short time intervals identify related fights. They do not restrict how
|
||||
far back the history scan reaches. Grouping and selection rules live in
|
||||
[the importer](../scripts/import-battles.mjs).
|
||||
|
||||
## Verification and saved data
|
||||
|
||||
Individual detail responses must contain OneUP's exact guild ID. Kills and deaths
|
||||
come from the OneUP guild row, never the entire battle. New combined reports are
|
||||
checked against AlbionBB's actual multi endpoint before publication. Previously
|
||||
verified combinations are reused only when their IDs and totals still match.
|
||||
Outcomes remain `recorded`: K/D alone cannot establish a confirmed winner.
|
||||
|
||||
- [Source data](battle-source.json) stores cached battle details, guild compositions,
|
||||
OneUP rosters, preserved IDs, and verified combined totals.
|
||||
- [Import audit](battle-import-audit.json) records included and excluded sessions,
|
||||
selection reasons, and calculated guild statistics.
|
||||
- [Published content](../content/site.json) contains the reports used by the site.
|
||||
|
||||
Source and audit metadata record when data was fetched for traceability; those
|
||||
values do not limit imports. Battle timestamps remain part of the actual report
|
||||
data for ordering and grouping. Source and audit files are not shipped with the
|
||||
site. Network, grouping, or verification errors stop the import before saved
|
||||
files change. Reports outside the fetched and cached history remain untouched;
|
||||
a partially overlapping report stops the import for review.
|
||||
|
||||
## Presentation and checks
|
||||
|
||||
The first 12 cards are visible immediately. Remaining reports appear in a native,
|
||||
keyboard-accessible disclosure in both languages. The detailed table contains
|
||||
all reports. Each combined report uses its own combined scoreboard image.
|
||||
|
||||
`npm test` checks pagination, unrestricted history, grouping boundaries, unrelated
|
||||
teams, roster continuity, duplicate IDs, source totals, preservation, and both
|
||||
languages. `npm run build` also works offline with the saved content and images.
|
||||
+54855
File diff suppressed because it is too large.
Load diff
+8
-4
@@ -40,19 +40,19 @@ Put additional local images under `public/assets/` and reference them as `assets
|
||||
|
||||
## Battle reports and AlbionBB preview images
|
||||
|
||||
Add each battle manually to `battles` after the fight:
|
||||
Use `npm run import:battles` to scan the available guild history, or add a report
|
||||
manually to `battles`:
|
||||
|
||||
```json
|
||||
{
|
||||
"title": { "en": "Your battle title", "fa": "عنوان نبرد شما" },
|
||||
"date": "2026-10-18",
|
||||
"url": "https://europe.albionbb.com/battles/448776222"
|
||||
}
|
||||
```
|
||||
|
||||
The sample title and date are illustrative. Omit the date or results when unknown.
|
||||
The sample title is illustrative. Omit the date or results when unknown.
|
||||
|
||||
Optional fields: `"date": "2026-10-18"`, `"outcome": "victory"` (also `defeat`, `draw`, or `recorded`), `"kills": 0`, and `"deaths": 0`. Enter verified guild-specific numbers. Omit unknown dates and figures; they display as dashes. Reports sort by date, newest first, with undated reports following in JSON order. Combined `/battles/multi?ids=...` links are supported and receive distinct preview cache filenames.
|
||||
Optional fields: `date` in `YYYY-MM-DD` format, `"outcome": "victory"` (also `defeat`, `draw`, or `recorded`), `"kills": 0`, and `"deaths": 0`. Enter verified guild-specific numbers. Omit unknown dates and figures; they display as dashes. Reports sort by date, newest first, with undated reports following in JSON order. Combined `/battles/multi?ids=...` links are supported and receive distinct preview cache filenames.
|
||||
|
||||
Only the report URL is needed to discover its preview; no `preview` field is required. The GitHub deployment automatically runs `npm run sync:battles`, which reads each report's `twitter:image` or `og:image`, including combined reports. If the report page cannot be read or has no image metadata, Europe reports fall back to endpoints derived from the report URL: `https://api.albionbb.com/eu/preview/BATTLE_ID` for a single battle, or `https://api.albionbb.com/eu/preview/multi?ids=ID1,ID2,...` for combined battles. An optional explicit `preview` field overrides discovery.
|
||||
|
||||
@@ -60,6 +60,10 @@ PNG/JPEG/WebP images are downloaded to `public/assets/battles/` and included in
|
||||
|
||||
Every report renders a visual card with local decorative terrain artwork, guild branding, report IDs, and single/combined report labels. Report images display in full without cropping; missing or failed images retain the local artwork. Combined reports use the combined scoreboard image; a single engagement's image is not substituted for the combined results. The map is decorative, not a reconstruction of the battle. Archive counts use report entries and unique battle IDs from their URLs. Only supplied dates and results are shown. The full table is available in the expandable detailed log.
|
||||
|
||||
For archives larger than 12 reports, the first 12 cards appear immediately and
|
||||
the remainder are available through “Explore more reports.” See the
|
||||
[battle importer documentation](battle-import.md) for ongoing imports and grouping.
|
||||
|
||||
To download previews locally, run:
|
||||
|
||||
```bash
|
||||
|
||||
Reference in new issue
Block a user