Files
WoW-Hybrid-gateway/patches/recovery-import-transmog-registry.md

30 lines
3.7 KiB
Markdown

# Octo character imports and shared transmog rows
The LOCAL server loads `tw_char.item_transmogs(ID,ItemID,DisplayID,SourceID)` on startup. In Tortoise `ObjectMgr.cpp`, `LoadItemTransmogrifyTemplates` copies the base item prototype and sets its display and source from that row. `GetItemPrototype` checks this registry before ordinary item templates. `TransmogMgr.cpp` also uses `SourceItemId` when reporting collection state.
The old recovery import runs a catalogue-wide inference sweep after applying SQL. That sweep can create an item's base look under the generated serial when appearance evidence is missing. The recovery parity audit counts a matching serial as resolved even when its display differs from Octo. The reported maximum ID in `tw_world.item_transmogrify_template` does not measure the active registry.
## Repository pdump preparer
`ops/octo_character_import.py` now writes `transmog_dependencies` to its private manifest. It considers every nonzero `item_instance.transmogrifyId` in the import, including repeated uses of the same serial. The pdump still contains the instance values and the character's collection. Global registry dependencies appear separately under `insert_rows`.
An optional `--transmog-snapshot FILE` accepts a JSON object with `kind` equal to `octo-import-transmog-snapshot-v1`. The snapshot may carry these collections.
| Field | Evidence |
| --- | --- |
| `source_registry` | Authentic Octo `ID`, `ItemID`, `DisplayID`, `SourceID` rows for the import, if available. An exported `data.item_transmogs` supplies the same evidence. |
| `target_registry` | LOCAL `tw_char.item_transmogs` rows for every referenced serial. An empty list means the lookup found none. |
| `templates` | Current LOCAL `tw_world.item_template` rows with `entry` and `display_id`, covering the serials, base items and source items. |
| `target_instances` | Existing LOCAL `transmogrifyId` and `itemEntry` pairs for those serials. |
| `cache` | Optional `installed-classic-item-cache-prefix` snapshot from `ops/item_template_snapshot.py`. The display for the exact generated serial provides an independent appearance check. |
Only a complete original tuple can supply a new row. The planner reports differences against existing rows and ordinary item definitions. A cached display, the nearest outfit, a matching unlocked look and the base item's display cannot identify the original source item. A matching existing base-look row without source evidence is explicitly reported as unverified.
## Recovery direct importer
The production recovery tool lives outside this repository. `recovery-import-transmog-registry.patch` applies to `claude-lane/scripts/import_octo_character.py` with SHA-256 `c05d9ff21009244a7608f21de37eec0b8adf948e955e03ada11b84c48bb73548`. For integration, install a copy of `ops/import_transmog_registry.py` beside that script and apply the patch there with `patch -p1`. The recovery tool's existing export, account, name and `--apply` arguments are preserved. Its optional `--transmog-evidence FILE` takes the same source/cache evidence. It reads the target registry, templates and carrier pairs itself.
The patched importer records the plan in its usual report and excludes global rows from generic character INSERTs. After a successful requested character import it materialises eligible registry rows and reads back their state. This sequencing matters because the registry is MyISAM. A concurrent registration can occupy a serial without being overwritten. Missing evidence, template conflicts and ambiguous serials are reported for reconciliation. A later mangosd start loads new rows.
The branch was exercised with synthetic exports and mocked database calls. It does not establish the original tuples or current LOCAL state of the five serials in #167.