Table of Contents

Class PlotStateExtensions

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Convenience tests over PlotState.

public static class PlotStateExtensions
Inheritance
PlotStateExtensions
Inherited Members

Methods

FromStored(int)

Reads a stored state column back into the enum.

public static PlotState FromStored(int stored)

Parameters

stored int

The integer held in the plot row.

Returns

PlotState

Remarks

A plain cast is not safe here. The column is an integer, and a row written by a newer build can hold a value this one has no name for — cast blindly, that produces a PlotState matching none of the branches that decide access, and the resulting plot answers "no" to every question including the ones that should be yes.

Unrecognised values become Empty, which is the reading that grants the least: an unclaimed lot people may walk over and nothing more. The alternative — trusting the number — is how a state nobody in this build understands ends up admitting strangers to a house.

IsClaimable(PlotState)

True when a plot in this state may be claimed by somebody.

public static bool IsClaimable(this PlotState state)

Parameters

state PlotState

Returns

bool

Remarks

Both of the unowned states, not just Empty. An abandoned plot that could not be claimed would be land permanently removed from the world by one player having stopped paying for it.

IsHeld(PlotState)

True when this state describes land somebody holds.

public static bool IsHeld(this PlotState state)

Parameters

state PlotState

Returns

bool

OnClaimed()

The state a plot enters when it is claimed.

public static PlotState OnClaimed()

Returns

PlotState

OnReleased()

The state a plot returns to when its owner gives it up deliberately.

public static PlotState OnReleased()

Returns

PlotState

Remarks

Empty rather than Abandoned. Abandoned is what unpaid land becomes, and it carries the visuals of a house somebody lost; a player who tidied up and handed the deed back should leave a bare lot behind them.