emweight

package
v5.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2024 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Types = []Type{
	Original,
	Base,
	FinalBase,
	Final,
}

Types holds all possible values.

Values holds all possible values.

Functions

This section is empty.

Types

type Type

type Type byte

Type describes how an Equipment Modifier's weight is applied.

const (
	Original Type = iota
	Base
	FinalBase
	Final
)

Possible values.

const LastType Type = Final

LastType is the last valid value.

func ExtractType

func ExtractType(str string) Type

ExtractType extracts the value from a string.

func (Type) AltString

func (enum Type) AltString() string

AltString returns the alternate string.

func (Type) DetermineModifierWeightValueTypeFromString

func (enum Type) DetermineModifierWeightValueTypeFromString(s string) Value

DetermineModifierWeightValueTypeFromString examines a string to determine what type it is, but restricts the result to those allowed for this Type.

func (Type) EnsureValid

func (enum Type) EnsureValid() Type

EnsureValid ensures this is of a known value.

func (Type) ExtractFraction

func (enum Type) ExtractFraction(s string) fxp.Fraction

ExtractFraction from the string.

func (Type) Format

func (enum Type) Format(s string, defUnits fxp.WeightUnit) string

Format returns a formatted version of the value.

func (Type) Key

func (enum Type) Key() string

Key returns the key used in serialization.

func (Type) MarshalText

func (enum Type) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface.

func (Type) Permitted

func (enum Type) Permitted() []Value

Permitted returns the permitted values.

func (Type) String

func (enum Type) String() string

String implements fmt.Stringer.

func (Type) StringWithExample

func (enum Type) StringWithExample() string

StringWithExample returns an example along with the normal String() content.

func (*Type) UnmarshalText

func (enum *Type) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type Value

type Value byte

Value describes how an Equipment Modifier's weight value is applied.

const (
	Addition Value = iota
	PercentageAdder
	PercentageMultiplier
	Multiplier
)

Possible values.

const LastValue Value = Multiplier

LastValue is the last valid value.

func ExtractValue

func ExtractValue(str string) Value

ExtractValue extracts the value from a string.

func (Value) EnsureValid

func (enum Value) EnsureValid() Value

EnsureValid ensures this is of a known value.

func (Value) ExtractFraction

func (enum Value) ExtractFraction(s string) fxp.Fraction

ExtractFraction from the string.

func (Value) Format

func (enum Value) Format(fraction fxp.Fraction) string

Format returns a formatted version of the value.

func (Value) FromString

func (enum Value) FromString(s string) Value

FromString examines a string to determine what type it is.

func (Value) Key

func (enum Value) Key() string

Key returns the key used in serialization.

func (Value) MarshalText

func (enum Value) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface.

func (Value) String

func (enum Value) String() string

String implements fmt.Stringer.

func (*Value) UnmarshalText

func (enum *Value) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL