Table of Contents

Class ProductConsumptionProfileBuilder

Namespace
S1API.Products
Assembly
S1API.dll

Builds an immutable intrinsic consumption profile for custom products.

public sealed class ProductConsumptionProfileBuilder
Inheritance
ProductConsumptionProfileBuilder
Inherited Members
Extension Methods

Constructors

ProductConsumptionProfileBuilder()

public ProductConsumptionProfileBuilder()

Methods

Build()

Builds the configured immutable consumption profile.

public ProductConsumptionProfile Build()

Returns

ProductConsumptionProfile

The immutable consumption profile.

Exceptions

InvalidOperationException

Thrown when provider compatibility or at least one lifecycle callback was not configured.

OnNpcApply(Action<ProductConsumptionContext>)

Sets behavior to run after ordinary effects apply to an NPC consumer.

public ProductConsumptionProfileBuilder OnNpcApply(Action<ProductConsumptionContext> callback)

Parameters

callback Action<ProductConsumptionContext>

The callback to run for the NPC consumer.

Returns

ProductConsumptionProfileBuilder

This builder for method chaining.

OnNpcClear(Action<ProductConsumptionContext>)

Sets behavior to run after ordinary effects clear from an NPC consumer.

public ProductConsumptionProfileBuilder OnNpcClear(Action<ProductConsumptionContext> callback)

Parameters

callback Action<ProductConsumptionContext>

The callback to run for the NPC consumer.

Returns

ProductConsumptionProfileBuilder

This builder for method chaining.

OnPlayerApply(Action<ProductConsumptionContext>)

Sets behavior to run after ordinary effects apply to the local consuming player.

public ProductConsumptionProfileBuilder OnPlayerApply(Action<ProductConsumptionContext> callback)

Parameters

callback Action<ProductConsumptionContext>

The callback to run for the local player.

Returns

ProductConsumptionProfileBuilder

This builder for method chaining.

OnPlayerClear(Action<ProductConsumptionContext>)

Sets behavior to run after ordinary effects clear from the local consuming player.

public ProductConsumptionProfileBuilder OnPlayerClear(Action<ProductConsumptionContext> callback)

Parameters

callback Action<ProductConsumptionContext>

The callback to run for the local player.

Returns

ProductConsumptionProfileBuilder

This builder for method chaining.

WithProviderCompatibility(string, int)

Sets the stable identity and compatibility version for this profile provider.

public ProductConsumptionProfileBuilder WithProviderCompatibility(string providerId, int providerVersion)

Parameters

providerId string

A stable, namespaced provider identifier.

providerVersion int

A positive compatibility version.

Returns

ProductConsumptionProfileBuilder

This builder for method chaining.