Table of Contents

Class AchievementPersistence

Namespace
FishMMO.Server.Implementation.World.SceneServer
Assembly
FishMMO.Server.dll

Achievement progress in a character's save and load: one row per achievement, written when its progress changes and versioned so a stale write cannot overwrite a newer one.

public sealed class AchievementPersistence : CharacterPersistenceParticipant
Inheritance
AchievementPersistence
Inherited Members

Remarks

Achievements were once fetched on login and never written back, so progress reset to the loaded values every session. The save leg is shaped like the ability one: MarkChanged() advances the version on mutation, Capture(ICharacter, CharacterRows) advances it again, and the confirmed write clears the mark only when the version still matches.

Properties

Name

The feature's name, for the log ("achievements").

public override string Name { get; }

Property Value

string

Methods

Apply(ICharacter, object)

Puts what FetchAsync(ICharacterPersistenceHost, long) returned on the character, restored as persisted (nothing dirty). Main thread, after the character's Core entity exists and before it spawns.

public override void Apply(ICharacter character, object fetched)

Parameters

character ICharacter
fetched object

Capture(ICharacter, CharacterRows)

Captures the character's dirty rows into rows, bumping their versions. Main thread.

public override void Capture(ICharacter character, CharacterRows rows)

Parameters

character ICharacter
rows CharacterRows

CreateRows()

An empty set of this participant's rows.

public override CharacterRows CreateRows()

Returns

CharacterRows

FetchAsync(ICharacterPersistenceHost, long)

Fetches the character's saved state. Worker thread, during the load.

public override Task<CharacterFetch> FetchAsync(ICharacterPersistenceHost host, long characterID)

Parameters

host ICharacterPersistenceHost
characterID long

Returns

Task<CharacterFetch>

SaveAsync(ICharacterPersistenceHost, CharacterRows, IReadOnlyCollection<CharacterSessionLeaseData>)

Writes rows, quoting claims, and clears the written rows' dirty marks on the main thread once the write is confirmed. Worker thread.

public override Task<bool> SaveAsync(ICharacterPersistenceHost host, CharacterRows rows, IReadOnlyCollection<CharacterSessionLeaseData> claims)

Parameters

host ICharacterPersistenceHost
rows CharacterRows
claims IReadOnlyCollection<CharacterSessionLeaseData>

Returns

Task<bool>

False only when the write failed in a way worth another attempt.