Skip to content

External Character Integration

mewcodex edited this page Sep 2, 2026 · 4 revisions

External Character Integration

English | 简体中文

AutoAnthony does not replace a custom character framework. Your mod continues to register its character, pool, cards, derivatives, relics, and multiplayer model IDs in its normal way.

Register the character host

const string profileId = "my_watcher:autoanthony";

ExternalComponentCharacterApi.Register(
    new ExternalComponentCharacterRegistration(
        ProfileId: profileId,
        BalanceArchetype: GeneratedCharacter.Regent,
        EnergyIconPrefix: "watcher"));

The balance archetype selects existing legality and value conventions; it is not the profile identity. Different custom characters may reuse the same archetype because their profile IDs remain distinct.

Declare fixed card slots

The game ModelDb discovers concrete model types, so declare one concrete class per maximum generated slot:

abstract class WatcherChaosCard : ExternalChaosCardModel
{
    protected sealed override string ComponentProfileId => "my_watcher:autoanthony";
    public sealed override CardPoolModel Pool => ModelDb.CardPool<WatcherCardPool>();
}

sealed class WatcherChaosCard000 : WatcherChaosCard
{
    protected override int Slot => 0;
}

Continue for every stable slot your pool can expose. Do not create model types dynamically after ModelDb startup.

Install run definitions

At new-run creation or save restoration, build complete definitions and install them in contiguous slot order:

ExternalComponentCharacterApi.InstallDefinitions(profileId, definitions);

Every definition must:

  • use slots 0..N-1 without gaps;
  • carry a card whose Character equals the registered balance archetype;
  • contain one validated RuntimeSpec per operation;
  • use stable portrait/effect identifiers that the owning mod can restore.

Call ExternalComponentCharacterApi.ClearDefinitions(profileId) when the run is discarded or fully cleaned up.

Who owns what?

AutoAnthony provides generation, upgrades, rendering, operation interpretation, and generated Power persistence. The character mod owns when generation happens, how many cards each rarity gets, source art/effects, snapshot storage, network authority, and card-pool exposure.

The subscribed Watcher 0.9.25 uses direct CharacterModel, CardPoolModel, and CardModel subclasses plus manual multiplayer ModelId registration. This is why the API accepts normal model types and stable IDs rather than BaseLib or RitsuLib objects. See the repository's WatcherComponentAdapter.cs.txt for a compact adapter skeleton.

Clone this wiki locally