Table of Contents

Interface ICharacterDialogueChoiceService

Namespace
FishMMO.Database.Npgsql.Services.Interfaces
Assembly
FishMMO-DB.dll

Service interface for per-character dialogue choice bitmasks.

public interface ICharacterDialogueChoiceService : IFetchCollectionByKeyAction<long, CharacterDialogueChoiceData>
Inherited Members

Remarks

Implements the shared fetch-collection contract, but not IPersistManyAction/IDeleteByKeyVersionedAction. Those describe a row written under an optimistic Version where the newest writer wins; this row is a monotonically growing bitmask that is merged, never replaced, so there is no stale write to reject and no version for the contract to gate on. See CharacterDialogueChoiceData for why the state is stored as a mask.

Methods

MergeAsync(IEnumerable<CharacterDialogueChoiceData>, CancellationToken)

Merges choice bits into the stored masks, creating rows that do not exist yet.

Task<DatabaseResult> MergeAsync(IEnumerable<CharacterDialogueChoiceData> choices, CancellationToken cancellationToken = default)

Parameters

choices IEnumerable<CharacterDialogueChoiceData>

The masks to merge. Bits already stored are retained.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<DatabaseResult>

A DatabaseResult indicating success or failure.

Remarks

Bits are OR-ed into whatever is already there, so this is idempotent: a retry after an ambiguous failure, or two scene servers writing during a transfer, converge on the union rather than one silently discarding the other's bits. It follows that a bit can never be cleared through this call — that is the point, since a cleared bit is a one-time dialogue reward the character can claim a second time.

ResetTemplateAsync(int, CancellationToken)

Deletes every stored mask for one dialogue template, across all characters.

Task<DatabaseResult<int>> ResetTemplateAsync(int templateId, CancellationToken cancellationToken = default)

Parameters

templateId int

The dialogue template to reset.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<DatabaseResult<int>>

The number of rows removed.

Remarks

Bit positions are assigned positionally by DialogueTemplate.GetChoiceBitIndex, so inserting or removing a choice anywhere but the end re-points every later bit at a different choice. Nothing at runtime can detect that the asset was re-cut — the mask is just a number — so this is the deliberate operator action that goes with such an edit. Administrative only; nothing on the gameplay path calls it.