Table of Contents

Class Achievement

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Represents a player's progress toward a specific achievement, including current tier, value, and template reference.

public class Achievement
Inheritance
Achievement
Inherited Members

Constructors

Achievement(int)

Creates a new achievement with the given template ID, starting at tier 0 and value 0.

public Achievement(int templateID)

Parameters

templateID int

The template ID for the achievement.

Achievement(int, byte, uint)

Creates a new achievement with the given template ID, tier, and value.

public Achievement(int templateID, byte tier, uint value)

Parameters

templateID int

The template ID for the achievement.

tier byte

The current tier (0-based index).

value uint

The current value/progress.

Fields

CurrentTier

The current tier of the achievement (0-based index).

public byte CurrentTier

Field Value

byte

CurrentValue

The current value/progress for the achievement (e.g., kills, points).

public uint CurrentValue

Field Value

uint

Version

Persistence version. Advanced by every mutation (MarkChanged()) and again by the save snapshot, and compared by MarkPersisted(long) so a change made while a write was in flight keeps the row dirty. Loaded from the database row on login.

public long Version

Field Value

long

Remarks

The mutation-side bump is load-bearing. A version advanced only by the snapshot cannot guard an in-flight change — the value that moved still carries the exact version the write is confirming — which is the trap the attribute and ability tables fell into.

Properties

NextTierValue

The value required to reach the next tier, or 0 if at max tier.

public uint NextTierValue { get; }

Property Value

uint

Remarks

Returns 0 if there are no tiers or if the current tier is the last one.

PersistenceDirty

Whether this achievement has changed since the database last confirmed it. The save path skips clean rows.

public bool PersistenceDirty { get; }

Property Value

bool

Template

The template that defines this achievement's structure, tiers, and rewards.

public AchievementTemplate Template { get; }

Property Value

AchievementTemplate

Methods

MarkChanged()

Records a mutation: dirty, and a new version so a confirmation for the previous state cannot clear it.

public void MarkChanged()

MarkPersisted(long)

Records that the database holds the state stamped with persistedVersion. Clears the dirty mark only if nothing has changed since that snapshot was taken.

public void MarkPersisted(long persistedVersion)

Parameters

persistedVersion long

The version the confirmed write carried.