Table of Contents

Class CustomerDataBuilder

Namespace
S1API.Entities.Customer
Assembly
S1API.dll

Builder for composing CustomerData at runtime without asset bundles. Public surface uses strings/primitives only.

public sealed class CustomerDataBuilder
Inheritance
CustomerDataBuilder
Inherited Members
Extension Methods

Methods

AllowDirectApproach(bool)

Controls whether the player can attempt to introduce themselves through a direct sample offer.

public CustomerDataBuilder AllowDirectApproach(bool allow)

Parameters

allow bool

True to allow direct approach attempts; otherwise false.

Returns

CustomerDataBuilder

The current builder for chaining.

GuaranteeFirstSample(bool)

Forces the first sample attempt to succeed, bypassing the normal mutual-relation chance check.

public CustomerDataBuilder GuaranteeFirstSample(bool guarantee)

Parameters

guarantee bool

True to guarantee first-sample success.

Returns

CustomerDataBuilder

The current builder for chaining.

WithAffinities(IEnumerable<(DrugType drugType, float affinity)>)

Sets product type affinities using the enum. Replaces any existing default affinity data. Ensures all drug types are initialized (unspecified ones default to neutral affinity).

public CustomerDataBuilder WithAffinities(IEnumerable<(DrugType drugType, float affinity)> entries)

Parameters

entries IEnumerable<(DrugType drugType, float affinity)>

Drug-type values and affinity values to apply.

Returns

CustomerDataBuilder

The current builder for chaining.

WithAffinities(IEnumerable<(string drugType, float affinity)>)

Sets product type affinities by drug-type name. e.g., ("Weed", 0.3f), ("Cocaine", -0.5f). Ensures all drug types are initialized (unspecified ones default to neutral affinity).

public CustomerDataBuilder WithAffinities(IEnumerable<(string drugType, float affinity)> entries)

Parameters

entries IEnumerable<(string drugType, float affinity)>

Drug-type names and affinity values to apply.

Returns

CustomerDataBuilder

The current builder for chaining.

WithAffinity(DrugType, float)

Adds or overrides a single product type affinity entry.

public CustomerDataBuilder WithAffinity(DrugType drugType, float affinity)

Parameters

drugType DrugType

Drug type to add or update.

affinity float

Affinity value in the -1..1 range.

Returns

CustomerDataBuilder

The current builder for chaining.

WithCallPoliceChance(float)

Sets the chance that the customer calls the police after rejecting a direct approach.

public CustomerDataBuilder WithCallPoliceChance(float chance)

Parameters

chance float

Chance from 0 to 1.

Returns

CustomerDataBuilder

The current builder for chaining.

WithDependence(float, float)

Sets the customer's starting addiction level and how quickly dependence builds over time.

public CustomerDataBuilder WithDependence(float baseAddiction, float dependenceMultiplier = 1)

Parameters

baseAddiction float

Starting addiction level in the 0..1 range.

dependenceMultiplier float

Dependence growth multiplier in the 0..2 range.

Returns

CustomerDataBuilder

The current builder for chaining.

WithMutualRelationRequirement(float, float)

Sets the mutual-relationship thresholds used when a customer is approached directly for the first time. The game checks the NPC's average relationship with mutual contacts and converts that value into a success chance. Values at or below minAt50 behave as the low end of the chance curve, and values at or above maxAt100 guarantee success. Values between them scale linearly.

public CustomerDataBuilder WithMutualRelationRequirement(float minAt50, float maxAt100)

Parameters

minAt50 float

Lower bound of the mutual-relationship success curve. Despite the historical name, this is better thought of as the point where the curve starts rather than a literal 50% threshold.

maxAt100 float

Mutual-relationship value that guarantees success.

Returns

CustomerDataBuilder

The current builder for chaining.

WithOrderTime(int)

Sets the order time in 24h integer format (e.g., 930 for 9:30AM, 1745 for 5:45PM).

public CustomerDataBuilder WithOrderTime(int hhmm)

Parameters

hhmm int

24-hour time in HHMM form.

Returns

CustomerDataBuilder

The current builder for chaining.

WithOrdersPerWeek(int, int)

Sets how many orders this customer may place per week. Both values are clamped to the game's 0..7 range, and the maximum cannot be lower than the minimum.

public CustomerDataBuilder WithOrdersPerWeek(int min, int max)

Parameters

min int

Minimum orders per week.

max int

Maximum orders per week.

Returns

CustomerDataBuilder

The current builder for chaining.

WithPreferredOrderDay(Day)

Sets the preferred order day using the API Day enum.

public CustomerDataBuilder WithPreferredOrderDay(Day day)

Parameters

day Day

Preferred order day.

Returns

CustomerDataBuilder

The current builder for chaining.

WithPreferredOrderDay(string)

Sets the preferred order day using names like "Monday", "Tuesday", and so on. Invalid values are ignored.

public CustomerDataBuilder WithPreferredOrderDay(string day)

Parameters

day string

Day name to parse.

Returns

CustomerDataBuilder

The current builder for chaining.

WithPreferredProperties(params PropertyBase[])

Assigns preferred properties from API property abstractions (tokens or wrappers). Does not expose game types to mod developers.

public CustomerDataBuilder WithPreferredProperties(params PropertyBase[] properties)

Parameters

properties PropertyBase[]

Property abstractions to resolve and assign.

Returns

CustomerDataBuilder

The current builder for chaining.

WithPreferredProperties(params ProductPropertyWrapper[])

Assigns preferred properties from wrappers.

public CustomerDataBuilder WithPreferredProperties(params ProductPropertyWrapper[] wrappers)

Parameters

wrappers ProductPropertyWrapper[]

Wrapped properties to assign.

Returns

CustomerDataBuilder

The current builder for chaining.

WithPreferredPropertiesById(params string[])

Tries to assign preferred properties by ID using in-game Resources. IDs must match existing property assets.

public CustomerDataBuilder WithPreferredPropertiesById(params string[] propertyIds)

Parameters

propertyIds string[]

Property IDs to resolve.

Returns

CustomerDataBuilder

The current builder for chaining.

WithPreferredPropertiesByName(params string[])

Tries to assign preferred properties by asset name using in-game Resources. Names must match existing property assets.

public CustomerDataBuilder WithPreferredPropertiesByName(params string[] propertyNames)

Parameters

propertyNames string[]

Property asset names to resolve.

Returns

CustomerDataBuilder

The current builder for chaining.

WithSpending(float, float)

Sets the customer's weekly spending range. The minimum is clamped to 0, and the maximum is clamped so it cannot be lower than the minimum.

public CustomerDataBuilder WithSpending(float minWeekly, float maxWeekly)

Parameters

minWeekly float

Minimum weekly spend target.

maxWeekly float

Maximum weekly spend target.

Returns

CustomerDataBuilder

The current builder for chaining.

WithStandards(CustomerStandard)

Sets standards using the strongly-typed enum.

public CustomerDataBuilder WithStandards(CustomerStandard standards)

Parameters

standards CustomerStandard

Customer standards value.

Returns

CustomerDataBuilder

The current builder for chaining.

WithStandards(string)

Sets customer standards from a string such as "VeryLow", "Low", "Moderate", "High", or "VeryHigh". Invalid values are ignored.

public CustomerDataBuilder WithStandards(string standards)

Parameters

standards string

Standards name to parse.

Returns

CustomerDataBuilder

The current builder for chaining.