Skip to content

feat: add CLI legacy DAT/SPR export profiles#90

Open
dudantas wants to merge 13 commits into
Arch-Mina:mainfrom
dudantas:dudantas/add-extended-exporter-for-old-protocols
Open

feat: add CLI legacy DAT/SPR export profiles#90
dudantas wants to merge 13 commits into
Arch-Mina:mainfrom
dudantas:dudantas/add-extended-exporter-for-old-protocols

Conversation

@dudantas

@dudantas dudantas commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a CLI export-legacy command and --list-profiles entry point for generating legacy .dat/.spr pairs from modern assets.
  • Adds legacy export profiles for cip860-extended and client11-15x, including DAT layout/signature settings, extended sprite IDs, outfit frame handling, and Market name limits.
  • Adds modern asset loading, sprite slicing/remapping, backup/overwrite handling, and README documentation for the supported profiles and compatibility notes.

Validation

  • Not run (not requested).

Copilot AI review requested due to automatic review settings June 12, 2026 20:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a command-line legacy exporter that converts modern Tibia asset packs into legacy .dat/.spr pairs with selectable export profiles.

Changes:

  • Introduces CLI entrypoint (export-legacy) plus profile listing/help, integrated into WPF app startup.
  • Adds modern asset loading/sprite-sheet slicing and a legacy export pipeline (sprite compilation + appearance table rewrite).
  • Documents legacy export profiles and usage in the README.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
README.md Documents CLI usage and explains legacy export profiles/constraints.
Assets Editor/App.xaml.cs Routes execution to CLI mode on startup when CLI args are detected.
Assets Editor/CliExportCommand.cs Implements CLI parsing, help/profile listing, and runs the legacy exporter.
Assets Editor/ModernAssetSet.cs Loads modern assets catalog + appearances and provides sprite extraction/caching.
Assets Editor/LegacyAssetExporter.cs Orchestrates export: slices sprites, remaps appearances, writes .dat and compiles .spr.
Assets Editor/LegacyAssetExportProfile.cs Defines export profiles and lookup/aliases.
Assets Editor/LegacyAppearance.cs Adds profile-driven .dat writing and legacy layout/flag serialization helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Assets Editor/LegacyAssetExporter.cs Outdated
Comment thread Assets Editor/LegacyAssetExporter.cs
Comment thread Assets Editor/LegacyAppearance.cs Outdated
Comment thread Assets Editor/ModernAssetSet.cs
Comment thread Assets Editor/ModernAssetSet.cs
Comment thread Assets Editor/LegacyAppearance.cs Outdated
Comment thread Assets Editor/LegacyAppearance.cs
Comment thread Assets Editor/LegacyAppearance.cs Outdated
Comment thread Assets Editor/LegacyAppearance.cs Outdated
Comment thread README.md Outdated
@dudantas dudantas changed the title feat: add extended exporter for old protocols Add CLI legacy DAT/SPR export profiles Jun 12, 2026
@ericcobblepot

ericcobblepot commented Jun 13, 2026

Copy link
Copy Markdown

This might be an interesting idea.

What do you think about exporting custom item flags(proto) to the legacy(.dat/.spr) format through .otml?

This would avoid potential packet errors caused by missing or unregistered flags:
https://github.com/opentibiabr/otclient/blob/99d43bd6559841ee684e35082da3ea9a360d0e16/src/client/protocolgameparse.cpp#L4297-L4453

Goal: allow using .dat and .spr assets on version 13.00+ (with g_game.enableFeature(GameLoadSprInsteadProtobuf) true) together with a flagItem.otml file.

example OTC:

  1. Export itemFlag.otml from the Assets Editor.
  2. Load itemFlag.otml in OTClient game_things with g_things.loadOtml("things/{version}/itemFlag.otml")
  3. Extend ThingType::unserializeOtml() to parse and apply custom item flags from the OTML file.

example:
https://github.com/opentibiabr/otclient/blob/99d43bd6559841ee684e35082da3ea9a360d0e16/src/client/thingtype.cpp#L731-L745

void ThingType::unserializeOtml(const OTMLNodePtr& node)
{
    for (const auto& node2 : node->children()) {
         if (node2->tag() == "classification")
            m_upgradeClassification = node2->value<uint16_t>();
        else if (node2->tag() == "charges") {
            if (node2->value<bool>())
                m_flags |= ThingFlagAttrWearOut;
            else
                m_flags &= ThingFlagAttrWearOut;
        } else if (node2->tag() == "duration") {
            if (node2->value<bool>())
                m_flags |= ThingFlagAttrClockExpire;
            else
                m_flags &= ThingFlagAttrClockExpire;
        } else if (node2->tag() == "cloth") {
            std::string slotName = node2->value();
            stdext::tolower(slotName);
            uint8_t slotValue = 0;
            if (slotName == "head" || slotName == "helmet")
                slotValue = Otc::InventorySlotHead;
            else if (slotName == "necklace" || slotName == "neck" || slotName == "amulet")
                slotValue = Otc::InventorySlotNecklace;

Proposed structure for itemFlag.otml [Auto-generated during .dat / .spr export.]

items
  3046
    duration: true

  3047
    classification: 1

  3051
    duration: true
    cloth: ring

  3051
    decoKit: true

  2222
    proficiency: true

@dudantas dudantas marked this pull request as draft June 15, 2026 13:06
@dudantas dudantas changed the title Add CLI legacy DAT/SPR export profiles feat: add CLI legacy DAT/SPR export profiles Jun 15, 2026
@dudantas dudantas marked this pull request as ready for review June 15, 2026 14:40
@dudantas

dudantas commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@ericcobblepot I agree this is a good direction. I implemented the Assets Editor side in this PR.

Legacy export now writes an itemFlag.otml sidecar next to Tibia.dat and Tibia.spr by default. The sidecar preserves protobuf item flags that the selected legacy .dat contract cannot represent, including tags such as charges, duration, classification, decoKit, proficiency, skillWheelGem, imbueSlots, dualWielding, minimumLevel, weaponType, and restrictVocation. For the 8.60 profile it can also carry modern tags intentionally omitted from the 8.60 DAT layout, such as cloth, defaultAction, wrap, unwrap, and topEffect.

A compatible client still needs to load itemFlag.otml after the legacy things files and extend ThingType::unserializeOtml() to apply these tags, as you described. The file name is normalized to itemFlag.otml, and the format/usage is documented in docs/legacy-export.md.

There is also a CLI escape hatch, --no-item-flag-otml, for exports that should produce only the legacy DAT/SPR pair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants