Class ProductManager
Provides management over all products in the game.
public static class ProductManager
- Inheritance
-
ProductManager
- Inherited Members
Fields
MaxPrice
Maximum price for any product (999).
public const int MaxPrice = 999
Field Value
MinPrice
Minimum price for any product (1).
public const int MinPrice = 1
Field Value
Properties
CocaineDiscovered
Gets whether cocaine has been discovered.
public static bool CocaineDiscovered { get; }
Property Value
DiscoveredProducts
A list of product definitions discovered on this save.
public static ProductDefinition[] DiscoveredProducts { get; }
Property Value
FavouritedProducts
A list of favourited products.
public static ProductDefinition[] FavouritedProducts { get; }
Property Value
IsAcceptingOrders
Gets whether the player is currently accepting orders.
public static bool IsAcceptingOrders { get; }
Property Value
ListedProducts
A list of products currently listed for sale.
public static ProductDefinition[] ListedProducts { get; }
Property Value
MethDiscovered
Gets whether meth has been discovered.
public static bool MethDiscovered { get; }
Property Value
ShroomsDiscovered
Gets whether shrooms have been discovered.
public static bool ShroomsDiscovered { get; }
Property Value
Methods
CalculateProductValue(ProductDefinition, float)
Calculates the value of a product based on its properties.
public static float CalculateProductValue(ProductDefinition product, float baseValue)
Parameters
productProductDefinitionThe product definition.
baseValuefloatThe base value to calculate from.
Returns
- float
The calculated value.
ClearEffectCallbacks()
Removes all registered product effect callbacks.
public static void ClearEffectCallbacks()
ClearNpcEffectCallbacks()
Removes all registered NPC product effect callbacks.
public static void ClearNpcEffectCallbacks()
GetPrice(ProductDefinition)
Gets the current price of a product.
public static float GetPrice(ProductDefinition product)
Parameters
productProductDefinitionThe product definition.
Returns
- float
The price of the product.
RemoveEffectCallback(PropertyBase)
Removes an effect callback by property.
public static bool RemoveEffectCallback(PropertyBase property)
Parameters
propertyPropertyBaseThe product effect/property to remove.
Returns
- bool
trueif a callback was removed; otherwisefalse.
RemoveEffectCallback(string)
Removes an effect callback by effect ID.
public static bool RemoveEffectCallback(string effectId)
Parameters
effectIdstringThe product effect ID.
Returns
- bool
trueif a callback was removed; otherwisefalse.
RemoveNpcEffectCallback(PropertyBase)
Removes an NPC effect callback by property.
public static bool RemoveNpcEffectCallback(PropertyBase property)
Parameters
propertyPropertyBaseThe product effect/property to remove.
Returns
- bool
trueif a callback was removed; otherwisefalse.
RemoveNpcEffectCallback(string)
Removes an NPC effect callback by effect ID.
public static bool RemoveNpcEffectCallback(string effectId)
Parameters
effectIdstringThe product effect ID.
Returns
- bool
trueif a callback was removed; otherwisefalse.
SetEffectCallback(PropertyBase, Action<Player>, bool)
Registers or replaces a callback for a product effect. When this effect triggers on the local player, the callback is invoked and can optionally allow base behavior.
public static void SetEffectCallback(PropertyBase property, Action<Player> callback, bool allowDefaultEffect = false)
Parameters
propertyPropertyBaseThe product effect/property to override.
callbackAction<Player>The callback to invoke with the local player.
allowDefaultEffectboolIf
true, the base game effect is also applied. Iffalse, only the callback runs for this effect.
SetEffectCallback(string, Action<Player>, bool)
Registers or replaces a callback for a product effect ID. When this effect triggers on the local player, the callback is invoked and can optionally allow base behavior.
public static void SetEffectCallback(string effectId, Action<Player> callback, bool allowDefaultEffect = false)
Parameters
effectIdstringThe product effect ID.
callbackAction<Player>The callback to invoke with the local player.
allowDefaultEffectboolIf
true, the base game effect is also applied. Iffalse, only the callback runs for this effect.
SetNpcEffectCallback(PropertyBase, Action<NPC>, bool)
Registers or replaces an NPC callback for a product effect. When this effect triggers on an NPC, the callback is invoked and can optionally allow base behavior.
public static void SetNpcEffectCallback(PropertyBase property, Action<NPC> callback, bool allowDefaultEffect = false)
Parameters
propertyPropertyBaseThe product effect/property to override.
callbackAction<NPC>The callback to invoke with the target NPC.
allowDefaultEffectboolIf
true, the base game effect is also applied. Iffalse, only the callback runs for this effect.
SetNpcEffectCallback(string, Action<NPC>, bool)
Registers or replaces an NPC callback for a product effect ID. When this effect triggers on an NPC, the callback is invoked and can optionally allow base behavior.
public static void SetNpcEffectCallback(string effectId, Action<NPC> callback, bool allowDefaultEffect = false)