Skip to content

BookOdds

Namespace Nfty.Core.Stats in assembly Nfty.Core.

public sealed class BookOdds

One CookBook, resolved down to what pricing an asset against it needs. Build one with SelectionOdds.Prepare(); see SelectionOdds for the arithmetic.

Remarks

Immutable once built and safe to share: nothing here is written after the constructor, so a front-end may prepare one off the UI thread and price from it on any other.

Methods

Of(SetItem)

public SelectionChance Of(SetItem item);

The chance of rolling the selection one cooked asset carries.

Parameters

  • item (SetItem) - The asset, as its metadata records it.

Returns. Its chance, or SelectionChance.Nothing when the asset cannot be mapped onto this book.

Of(string, IReadOnlyDictionary<string, string>, IReadOnlyCollection<string>)

public SelectionChance Of(string recipeId, IReadOnlyDictionary<string, string> traits, IReadOnlyCollection<string> absentLayers);

The chance of rolling a selection, named the way a Set's metadata names one.

Parameters

  • recipeId (string) - The recipe's id — what nfty/NNNN.json records.
  • traits (IReadOnlyDictionary<string, string>) - Variant NAME per layer NAME, for the layers that are present. Names rather than ids because names are all a Set records; a layer carrying two variants of one name is scored as either of them, which is the event the metadata actually describes.
  • absentLayers (IReadOnlyCollection<string>) - The layer names this selection leaves out entirely.

Returns. Its chance, or SelectionChance.Nothing when the selection cannot be mapped onto this book.