Table of Contents

Class ProductPopulator

Namespace
S1API.Products
Assembly
S1API.dll

Utility methods for populating storage with product instances.

public static class ProductPopulator
Inheritance
ProductPopulator
Inherited Members

Methods

CreatePackagedProduct(ProductDefinition, PackagingDefinition, int)

Creates a packaged product instance.

public static ProductInstance? CreatePackagedProduct(ProductDefinition productDef, PackagingDefinition packaging, int quantity)

Parameters

productDef ProductDefinition

The product definition.

packaging PackagingDefinition

The packaging definition.

quantity int

The quantity of the product.

Returns

ProductInstance

The created product instance, or null if failed.

GetAllProductDefinitions()

Gets all available product definitions from the game registry.

public static List<ProductDefinition> GetAllProductDefinitions()

Returns

List<ProductDefinition>

A list of product definitions.

GetCocaineDefinitions()

Gets cocaine product definitions from the game registry.

public static List<CocaineDefinition> GetCocaineDefinitions()

Returns

List<CocaineDefinition>

A list of cocaine product definitions.

GetMethDefinitions()

Gets meth product definitions from the game registry.

public static List<MethDefinition> GetMethDefinitions()

Returns

List<MethDefinition>

A list of meth product definitions.

GetPackaging(string)

Gets a packaging definition by its ID.

public static PackagingDefinition? GetPackaging(string packagingId)

Parameters

packagingId string

The ID of the packaging (e.g., "baggie", "jar", "brick").

Returns

PackagingDefinition

The packaging definition, or null if not found.

GetShroomDefinitions()

Gets shroom product definitions from the game registry.

public static List<ShroomDefinition> GetShroomDefinitions()

Returns

List<ShroomDefinition>

A list of shroom product definitions.

GetWeedDefinitions()

Gets weed product definitions from the game registry.

public static List<WeedDefinition> GetWeedDefinitions()

Returns

List<WeedDefinition>

A list of weed product definitions.

PopulateFromGameObject(GameObject, string, int)

Populates a storage container by finding it from a GameObject. Fills all slots with packaged products in the specified packaging.

public static int PopulateFromGameObject(GameObject gameObject, string packagingId, int quantityPerItem = 1)

Parameters

gameObject GameObject

The GameObject with a StorageEntity component.

packagingId string

The ID of the packaging to use (e.g., "baggie", "jar", "brick").

quantityPerItem int

The quantity of each product item.

Returns

int

The number of items successfully added, or -1 if storage not found.

PopulateWithPackagedProducts(StorageInstance, string, int)

Populates a storage container with packaged products.

public static int PopulateWithPackagedProducts(StorageInstance storage, string packagingId, int quantityPerItem = 1)

Parameters

storage StorageInstance

The storage instance to populate.

packagingId string

The ID of the packaging to use (e.g., "baggie", "jar", "brick").

quantityPerItem int

The quantity of each product item.

Returns

int

The number of items successfully added.

PopulateWithSpecificPackagedProducts(StorageInstance, List<string>, string, int)

Populates a storage container with specific packaged products by ID.

public static int PopulateWithSpecificPackagedProducts(StorageInstance storage, List<string> productIds, string packagingId, int quantityPerProduct = 1)

Parameters

storage StorageInstance

The storage instance to populate.

productIds List<string>

List of product IDs to add.

packagingId string

The ID of the packaging to use (e.g., "baggie", "jar", "brick").

quantityPerProduct int

Quantity of each product to add (default 1).

Returns

int

The number of items successfully added.

PopulateWithSpecificProducts(StorageInstance, List<string>, int)

Populates a storage container with specific non-packaged products by ID.

public static int PopulateWithSpecificProducts(StorageInstance storage, List<string> productIds, int quantityPerProduct = 1)

Parameters

storage StorageInstance

The storage instance to populate.

productIds List<string>

List of product IDs to add.

quantityPerProduct int

Quantity of each product to add (default 1).

Returns

int

The number of items successfully added.

PopulateWithUnpackagedProducts(StorageInstance, int)

Populates a storage container with non-packaged products.

public static int PopulateWithUnpackagedProducts(StorageInstance storage, int quantityPerItem = 1)

Parameters

storage StorageInstance

The storage instance to populate.

quantityPerItem int

The quantity of each product item.

Returns

int

The number of items successfully added.

PopulateWithWeedProducts(StorageInstance)

Populates a storage container with packaged weed products in jars. Fills all available slots with 20 units (4 jars) of each product.

public static int PopulateWithWeedProducts(StorageInstance storage)

Parameters

storage StorageInstance

The storage instance to populate.

Returns

int

The number of items successfully added.