Go implementation of PolUtils and ResourceExtractor
  • Lua 77.5%
  • Go 22.3%
  • Shell 0.2%
Find a file
Meliora b9b6b97fba
All checks were successful
Sync validated game data to Go backend / sync (push) Successful in 2m8s
Updated game-data
2026-11-27 16:39:21 +00:00
.forgejo/workflows Updated ci 2026-11-27 16:27:25 +00:00
abilities Rewritten go client 2026-06-13 12:30:16 +02:00
cmd Clean up folders 2026-06-15 22:54:04 +02:00
dat feat: Updated polextract 2026-11-27 12:55:44 +01:00
encoding Rewritten go client 2026-06-13 12:30:16 +02:00
exports Updated game-data 2026-11-27 16:39:21 +00:00
flyway Added flyway for vanaportal 2026-06-13 22:56:31 +02:00
image Rewritten go client 2026-06-13 12:30:16 +02:00
items feat: Updated polextract 2026-11-27 12:55:44 +01:00
lsb Feat: Added more currency sources 2026-06-16 01:02:37 +02:00
maps Rewritten go client 2026-06-13 12:30:16 +02:00
migrations Feat: Added synth recipes 2026-06-16 01:29:37 +02:00
render Rewritten go client 2026-06-13 12:30:16 +02:00
scripts feat: Updated polextract 2026-11-27 12:55:44 +01:00
spells Rewritten go client 2026-06-13 12:30:16 +02:00
types Rewritten go client 2026-06-13 12:30:16 +02:00
.gitignore feat: update ci task 2026-11-27 16:26:07 +00:00
currencyshops.go feat: Updated polextract 2026-11-27 12:55:44 +01:00
extraction_test.go feat: Updated polextract 2026-11-27 12:55:44 +01:00
go.mod feat: Updated polextract 2026-11-27 12:55:44 +01:00
go.sum Rewritten go client 2026-06-13 12:30:16 +02:00
guildshops.go feat: Updated polextract 2026-11-27 12:55:44 +01:00
init.sql Rewritten go client 2026-06-13 12:30:16 +02:00
landsandboat.go feat: Updated polextract 2026-11-27 12:55:44 +01:00
landsandboat_test.go feat: Updated polextract 2026-11-27 12:55:44 +01:00
main.go feat: Updated polextract 2026-11-27 12:55:44 +01:00
npcshops.go feat: Updated polextract 2026-11-27 12:55:44 +01:00
README.md feat: Updated polextract 2026-11-27 12:55:44 +01:00
serializers.go Rewritten go client 2026-06-13 12:30:16 +02:00
serializers_test.go Rewritten go client 2026-06-13 12:30:16 +02:00
upstream_test.go feat: Updated polextract 2026-11-27 12:55:44 +01:00
yamldrops.go feat: Updated polextract 2026-11-27 12:55:44 +01:00

PolExtract

Build

go build ./...

Extract

go run . \
  -ffxi "/path/to/ffxi" \
  -out output \
  -maps

The default extraction writes:

  • output/resources/json/*.json
  • output/resources/lua/*.lua
  • output/resources/xml/*.xml
  • output/resources/manifest.json
  • output/resources/manifest.xml
  • output/icons/*.png

Useful options:

-icons=false              Skip icon output
-items=false              Skip item DATs
-spells=false             Skip spell data
-abilities=false          Skip ability data
-strings=false            Skip DAT string tables
-maps                     Extract maps

Item Cards

Verdana font is required. Point the renderer at installed Verdana TTF:

go run ./cmd/card \
  -items output/resources/json/items.json \
  -icons output/icons \
  -font "/path/to/verdana.ttf" \
  -id 23734 \
  -out output/malignance_gloves.png

Render all Weapon and Armor cards:


go run ./cmd/card \
  -items output/resources/json/items.json \
  -icons output/icons \
  -font "/path/to/verdana.ttf" \
  -all \
  -out-dir output/cards

Use -all -out-dir output/cards to render every non-placeholder Weapon and Armor item. Other item categories are skipped.

PostgreSQL Import

Import all JSON resources:

go run ./cmd/postgres

The importer reads output/resources/json/*.json, records existing icons from output/icons, and records existing cards from output/cards. It upserts all records and removes records that are no longer present by default. Database asset paths are stored relative to the published asset root, such as icons/10253.png and cards/10253.png.

The schema has:

  • game_resources: every extracted resource record, stored as jsonb
  • game_items: searchable item columns, the merged English description, detected weapon type, decoded job/race/flag/slot text, relative icon/card paths, and the complete untouched item record as jsonb
  • resource_imports: one summary row for each successful import

Override it for another PostgreSQL server:

DATABASE_URL="postgres://user:password@host:5432/database" \
  go run ./cmd/postgres

References & Inspiration

  • ResourceExtractor: extraction, parsing, fixes, filtering, post-processing, manifests, and resource serialization.
  • Vanalytics: item-card content, layout, styling, icons, and wrapping.

Item DAT layout compatibility

The item parser supports both legacy 0xC00 (3,072-byte) and current 0x1400 (5,120-byte) records. It checks decoded icon wrappers at record boundaries when file size alone is ambiguous. The larger layout uses a wider flag field and additional equipment-field padding. String tables are validated separately for English and Japanese, while the icon wrapper remains at offset 0x284.

Missing, truncated, or unsupported item DATs now stop extraction with a nonzero exit status instead of exporting an incomplete catalogue. Output should be staged and checked before generating migrations or importing it into a database.

Updating and publishing game data for the Go backend

Run scripts/export-game-data.sh "/path/to/FINAL FANTASY XI". Set FONT_PATH to Verdana TTF if it is not installed under the default Wine prefix, and VANAPORTAL_GO_DIR if the sibling Go backend is elsewhere. The script updates an ignored shallow/sparse LandSandBoat checkout using git pull --ff-only, runs tests, extracts the game, renders all equipment cards, and validates the bundle with the Go backend's cmd/game-data tool. Failures keep the previous bundle.

The prepared archive is exports/game-data.tar.gz; expanded output is retained under exports/data-<content-version>/ locally. Commit the archive to publish an update. Forgejo validates it and syncs only the archive to vanaportal-backend-go/extracted/game-data.tar.gz using GITOPS_TOKEN. It no longer pushes repeatable SQL migrations to the Java backend. The workflow does not run extraction: the runner currently has no FFXI installation. For future full automation, give the runner a read-only game installation and Verdana, then invoke the same export script before the sync step.

Current upstream supports item constants under scripts/enum/item.lua, Lua guild shop definitions with shared-stock aliases, and monster loot from data/zones/*/mobs.yaml in addition to the remaining SQL sources. YAML loot is preserved in the mob_loot dataset; normalized mob_drops includes ordinary, weighted-group, steal and despoil items. Unknown probabilities remain null rather than being invented. Guild shop rows from Lua are keyed by NPC and zone, not a fabricated legacy guild ID; min/max asking prices follow the upstream stock-price curve rather than representing current live stock.