Table of Contents

Struct PortalWorldState

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

A portal's world-wide opening: for good, or until a moment.

public readonly struct PortalWorldState : IEquatable<PortalWorldState>
Implements
Inherited Members

Remarks

Merged rather than replaced (Merge(PortalWorldState, PortalWorldState)): permanent ORs and the deadline takes the later moment, which is exactly what the world_portal_state upsert does, so the memory copy and the row converge whichever write lands first.

Constructors

PortalWorldState(bool, long)

public PortalWorldState(bool permanent, long activeUntilUnixMs)

Parameters

permanent bool
activeUntilUnixMs long

Fields

ActiveUntilUnixMs

Unix milliseconds a timed opening ends at; 0 when never timed.

public readonly long ActiveUntilUnixMs

Field Value

long

Permanent

Open for good.

public readonly bool Permanent

Field Value

bool

Methods

Covers(PortalWorldState)

Whether other says nothing this state does not already say.

public bool Covers(PortalWorldState other)

Parameters

other PortalWorldState

Returns

bool

Equals(PortalWorldState)

public bool Equals(PortalWorldState other)

Parameters

other PortalWorldState

Returns

bool

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

IsActive(long)

Whether the portal is open at nowUnixMs.

public bool IsActive(long nowUnixMs)

Parameters

nowUnixMs long

Returns

bool

Merge(PortalWorldState, PortalWorldState)

The union of two openings: permanent if either is, open until the later deadline.

public static PortalWorldState Merge(PortalWorldState a, PortalWorldState b)

Parameters

a PortalWorldState
b PortalWorldState

Returns

PortalWorldState

RemainingSeconds(long)

Whole seconds the opening has left at nowUnixMs, rounded up; NoExpiry when permanent, 0 when closed.

public int RemainingSeconds(long nowUnixMs)

Parameters

nowUnixMs long

Returns

int

ToString()

public override string ToString()

Returns

string