Table of Contents

Class PartyVitalsQuantiser

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Converts party vitals between the values the game holds and the quantised wire form.

public static class PartyVitalsQuantiser
Inheritance
PartyVitalsQuantiser
Inherited Members

Remarks

Pure functions, unit tested for round-trip error. A fraction survives the byte with at most half a step (1/510) of error, which is below a pixel on any party bar; a rate is rounded to the unit and clamped, which is exactly what the meter readout does anyway.

Methods

ByteToFraction(byte)

Restores a fraction from its byte form.

public static float ByteToFraction(byte value)

Parameters

value byte

Returns

float

FractionToByte(float)

Quantises a 0..1 fraction to 0..255. Out-of-range input is clamped.

public static byte FractionToByte(float fraction)

Parameters

fraction float

Returns

byte

RateToUInt16(float)

Rounds a per-second rate to the unit and clamps it to what a ushort holds.

public static ushort RateToUInt16(float rate)

Parameters

rate float

Returns

ushort