From d8180a0f91e0422bd4cedbb8bdd88bc997c53c95 Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Tue, 29 Apr 2025 03:42:18 +0200 Subject: [PATCH 01/12] feat: product quality --- S1API/Products/ProductInstance.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index 00e61924..bb8f38ce 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -4,8 +4,9 @@ using S1Product = ScheduleOne.Product; #endif +using Il2CppScheduleOne.ItemFramework; using S1API.Internal.Utils; -using S1API.Items; +using ItemInstance = S1API.Items.ItemInstance; namespace S1API.Products { @@ -37,5 +38,11 @@ internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(p /// public PackagingDefinition AppliedPackaging => new PackagingDefinition(S1ProductInstance.AppliedPackaging); + /// + /// The quality of this product instance. + /// + public EQuality Quality => S1ProductInstance.Quality; + } + } From adf3cca240d4be5d3177073c81526648d1a2acbb Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Tue, 29 Apr 2025 03:43:28 +0200 Subject: [PATCH 02/12] fix: usings --- S1API/Products/ProductInstance.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index bb8f38ce..b4b4f0f8 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -1,10 +1,12 @@ #if (IL2CPPMELON || IL2CPPBEPINEX) using S1Product = Il2CppScheduleOne.Product; +using Il2CppScheduleOne.ItemFramework; + #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Product = ScheduleOne.Product; +using ScheduleOne.ItemFramework; #endif -using Il2CppScheduleOne.ItemFramework; using S1API.Internal.Utils; using ItemInstance = S1API.Items.ItemInstance; From 2051d7f8610b96955fec268bd08279ef16ee8bb0 Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Tue, 29 Apr 2025 14:04:16 +0200 Subject: [PATCH 03/12] fix: abstract quality --- S1API/Products/ProductInstance.cs | 3 +- S1API/Products/Quality.cs | 86 +++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 S1API/Products/Quality.cs diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index b4b4f0f8..25043ba1 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -43,7 +43,8 @@ internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(p /// /// The quality of this product instance. /// - public EQuality Quality => S1ProductInstance.Quality; + public Quality Quality => S1ProductInstance.Quality.ToAPI(); + } diff --git a/S1API/Products/Quality.cs b/S1API/Products/Quality.cs new file mode 100644 index 00000000..702923e1 --- /dev/null +++ b/S1API/Products/Quality.cs @@ -0,0 +1,86 @@ +#if IL2CPPBEPINEX || IL2CPPMELON +using InternalQuality = Il2CppScheduleOne.ItemFramework.EQuality; +#else +using InternalQuality = ScheduleOne.ItemFramework.EQuality; +#endif +namespace S1API.Products +{ + /// + /// Represents the quality levels for items. + /// + /// + /// This enumeration defines various quality tiers that items can belong to. Each tier represents a specific + /// standard or grade, ranging from the lowest to the highest. + /// + public enum Quality + { + /// + /// Represents the lowest quality level, indicating an item of no value or unusable condition. + /// + Trash = 0, + + /// + /// Represents a quality level that is below standard but better than trash-quality. + /// + Poor = 1, + + /// + /// Represents a standard level of quality in the predefined quality enumeration. + /// Typically used to indicate an average or commonly acceptable quality level. + /// + Standard = 2, + + /// + /// Represents a higher-tier quality level compared to lower + Premium = 3, + + /// + /// Represents the highest level of quality, denoted as "Heavenly". + Heavenly = 4 + } + + /// + /// Provides extension methods for converting between and + /// enumerations. + /// + internal static class QualityExtensions + { + /// + /// Converts an instance of to its corresponding + /// representation. + /// + /// The instance to convert. + /// A value that represents the converted quality. + internal static Quality ToAPI(this InternalQuality quality) + { + return quality switch + { + InternalQuality.Trash => Quality.Trash, + InternalQuality.Poor => Quality.Poor, + InternalQuality.Standard => Quality.Standard, + InternalQuality.Premium => Quality.Premium, + InternalQuality.Heavenly => Quality.Heavenly, + _ => Quality.Trash, + }; + } + + /// + /// Converts an instance of the enum to its corresponding + /// enum representation. + /// + /// The enum value to convert. + /// The corresponding enum value. + internal static InternalQuality ToInternal(this Quality quality) + { + return quality switch + { + Quality.Trash => InternalQuality.Trash, + Quality.Poor => InternalQuality.Poor, + Quality.Standard => InternalQuality.Standard, + Quality.Premium => InternalQuality.Premium, + Quality.Heavenly => InternalQuality.Heavenly, + _ => InternalQuality.Trash, + }; + } + } +} From f134b624e2f7e34b72fe223c22cac775aa3e449e Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Wed, 30 Apr 2025 00:16:57 +0200 Subject: [PATCH 04/12] feat: get product properties --- S1API/Products/CocaineDefinition.cs | 35 ++++++++++++--- S1API/Products/MethDefinition.cs | 38 +++++++++++++--- S1API/Products/ProductDefinition.cs | 9 +++- S1API/Products/ProductDefinitionWrapper.cs | 15 +++++-- S1API/Products/ProductInstance.cs | 11 ++++- S1API/Products/WeedDefinition.cs | 50 +++++++++++++++++++--- 6 files changed, 132 insertions(+), 26 deletions(-) diff --git a/S1API/Products/CocaineDefinition.cs b/S1API/Products/CocaineDefinition.cs index 04b3b346..a27a2098 100644 --- a/S1API/Products/CocaineDefinition.cs +++ b/S1API/Products/CocaineDefinition.cs @@ -6,34 +6,57 @@ using S1CocaineDefinition = ScheduleOne.Product.CocaineDefinition; #endif +using System.Collections.Generic; using S1API.Internal.Utils; using S1API.Items; namespace S1API.Products { /// - /// Represents the definition of a Cocaine product. + /// Represents the definition of a cocaine product within the system. /// public class CocaineDefinition : ProductDefinition { /// - /// INTERNAL: Strongly typed access to the CocaineDefinition. + /// INTERNAL: Strongly typed access to the CocaineDefinition within the Schedule One framework. /// internal S1CocaineDefinition S1CocaineDefinition => CrossType.As(S1ItemDefinition); /// - /// Creates a new cocaine product definition. + /// Represents the definition of a Cocaine product. /// - /// The original in-game cocaine definition. internal CocaineDefinition(S1CocaineDefinition definition) - : base(definition) { } + : base(definition) + { + } /// - /// Creates an instance of this cocaine product. + /// Creates an instance of this cocaine product with the specified quantity. /// + /// The quantity of the product to create. Defaults to 1. + /// An instance of the cocaine product with the specified quantity. public override ItemInstance CreateInstance(int quantity = 1) => new ProductInstance(CrossType.As( S1CocaineDefinition.GetDefaultInstance(quantity))); + + /// + /// Retrieves a list of properties associated with the current cocaine product definition. + /// + /// A list of properties specific to the cocaine product definition. + public List GetProperties() + { + var result = new List(); + var list = S1CocaineDefinition?.Properties; + if (list != null) + { + for (int i = 0; i < list.Count; i++) + { + result.Add(list[i]); + } + } + return result; + } } + } diff --git a/S1API/Products/MethDefinition.cs b/S1API/Products/MethDefinition.cs index 4d11a0c1..ddd335ea 100644 --- a/S1API/Products/MethDefinition.cs +++ b/S1API/Products/MethDefinition.cs @@ -6,34 +6,60 @@ using S1MethDefinition = ScheduleOne.Product.MethDefinition; #endif +using System.Collections.Generic; using S1API.Internal.Utils; using S1API.Items; namespace S1API.Products { /// - /// Represents the definition of a Meth product. + /// Represents the definition of a Meth product in the product framework. /// + /// + /// Provides methods for retrieving properties and creating instances of meth products. This class extends the base functionality provided by . + /// public class MethDefinition : ProductDefinition { /// - /// INTERNAL: Strongly typed access to the MethDefinition. + /// INTERNAL: Strongly typed access to S1MethDefinition, representing the Il2CppScheduleOne.Product.MethDefinition entity. /// internal S1MethDefinition S1MethDefinition => CrossType.As(S1ItemDefinition); /// - /// Creates a new meth product definition. + /// Represents the definition of a Meth product. /// - /// The original in-game meth definition. internal MethDefinition(S1MethDefinition definition) - : base(definition) { } + : base(definition) + { + } /// - /// Creates an instance of this meth product. + /// Creates an instance of this meth product with a specified quantity. /// + /// The quantity of the meth product to instantiate. Defaults to 1 if not provided. + /// An instance of the meth product as a . public override ItemInstance CreateInstance(int quantity = 1) => new ProductInstance(CrossType.As( S1MethDefinition.GetDefaultInstance(quantity))); + + /// + /// Retrieves the list of properties associated with the meth product definition. + /// + /// A list of properties that belong to the meth product definition. + public List GetProperties() + { + var result = new List(); + var list = S1MethDefinition?.Properties; + if (list != null) + { + for (int i = 0; i < list.Count; i++) + { + result.Add(list[i]); + } + } + + return result; + } } } diff --git a/S1API/Products/ProductDefinition.cs b/S1API/Products/ProductDefinition.cs index 91ea8591..fbda17e1 100644 --- a/S1API/Products/ProductDefinition.cs +++ b/S1API/Products/ProductDefinition.cs @@ -5,6 +5,7 @@ using S1Product = ScheduleOne.Product; #endif +using System.Collections.Generic; using S1API.Internal.Utils; using S1API.Items; using UnityEngine; @@ -26,7 +27,7 @@ public class ProductDefinition : ItemDefinition /// INTERNAL: Creates a product definition from the in-game product definition. /// /// - internal ProductDefinition(S1Product.ProductDefinition productDefinition) : base(productDefinition) { } + internal ProductDefinition(Il2CppScheduleOne.ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } /// /// The price associated with this product. @@ -50,5 +51,9 @@ public Sprite Icon get { return S1ProductDefinition.Icon; } } - } + private List properties; // or however properties are stored + + // Add this public property if it doesn't exist yet + public IReadOnlyList Properties => properties.AsReadOnly(); +} } diff --git a/S1API/Products/ProductDefinitionWrapper.cs b/S1API/Products/ProductDefinitionWrapper.cs index e6bb70ad..b3078fbd 100644 --- a/S1API/Products/ProductDefinitionWrapper.cs +++ b/S1API/Products/ProductDefinitionWrapper.cs @@ -2,6 +2,7 @@ #if (IL2CPPMELON || IL2CPPBEPINEX) using S1Product = Il2CppScheduleOne.Product; + #else using S1Product = ScheduleOne.Product; #endif @@ -9,19 +10,27 @@ namespace S1API.Products { /// - /// INTERNAL: A wrapper class for converting a product definition to its proper dedicated class. + /// Provides functionality to wrap and convert generic product definitions into their specific type-derived definitions. /// - internal static class ProductDefinitionWrapper + public static class ProductDefinitionWrapper { - internal static ProductDefinition Wrap(ProductDefinition def) + /// + /// Converts a generic into its corresponding typed wrapper. + /// + /// The raw product definition to be processed and converted. + /// A wrapped instance of with type-specific methods and properties, or the input definition if no specific wrapper applies. + public static ProductDefinition Wrap(ProductDefinition def) { var item = def.S1ItemDefinition; if (CrossType.Is(item, out var weed)) return new WeedDefinition(weed); + if (CrossType.Is(item, out var meth)) return new MethDefinition(meth); + if (CrossType.Is(item, out var coke)) return new CocaineDefinition(coke); + return def; } } diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index 25043ba1..7b1aa868 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -7,6 +7,7 @@ using ScheduleOne.ItemFramework; #endif +using System.Collections.Generic; using S1API.Internal.Utils; using ItemInstance = S1API.Items.ItemInstance; @@ -27,7 +28,9 @@ public class ProductInstance : ItemInstance /// INTERNAL: Creates a product instance from the in-game product instance. /// /// - internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(productInstance) { } + internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(productInstance) + { + } /// /// Whether this product is currently packaged or not. @@ -40,12 +43,16 @@ internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(p /// public PackagingDefinition AppliedPackaging => new PackagingDefinition(S1ProductInstance.AppliedPackaging); + /// /// The quality of this product instance. /// public Quality Quality => S1ProductInstance.Quality.ToAPI(); + // Expose the underlying definition's properties (if S1ProductInstance.Definition is available) + public IReadOnlyList Properties => Definition.Properties; + // Add Definition property if you don't have one yet + public ProductDefinition Definition => new ProductDefinition(S1ProductInstance.Definition); } - } diff --git a/S1API/Products/WeedDefinition.cs b/S1API/Products/WeedDefinition.cs index a57f6dfe..0ef7c2d7 100644 --- a/S1API/Products/WeedDefinition.cs +++ b/S1API/Products/WeedDefinition.cs @@ -8,33 +8,69 @@ using S1API.Internal.Utils; using S1API.Items; +using System.Collections.Generic; namespace S1API.Products { /// - /// Represents the definition of a Weed product. + /// Represents a specific type of weed product definition. This class extends the functionality of + /// to include details specific to weed products. /// + /// + /// This class provides methods and properties to work with weed-related product definitions, + /// including creating product instances and accessing weed-specific properties. + /// public class WeedDefinition : ProductDefinition { /// - /// INTERNAL: Strongly typed access to the WeedDefinition. + /// Represents the definition of a weed product in the ScheduleOne API. + /// Provides access to underlying data and functionalities specific to weed products. /// internal S1WeedDefinition S1WeedDefinition => CrossType.As(S1ItemDefinition); - /// - /// Creates a new weed product definition. + /// Represents a specific type of product definition for weed products in the API. /// - /// The original in-game weed definition. + /// + /// This class acts as a wrapper for `Il2CppScheduleOne.Product.WeedDefinition`, + /// providing additional functionality and a specific type for handling weed items. + /// internal WeedDefinition(S1WeedDefinition definition) - : base(definition) { } + : base(definition) + { + } /// - /// Creates an instance of this weed product. + /// Creates an instance of the product with the specified quantity. /// + /// The quantity of the product to create. Defaults to 1 if not specified. + /// An instance of representing the created product. public override ItemInstance CreateInstance(int quantity = 1) => new ProductInstance(CrossType.As( S1WeedDefinition.GetDefaultInstance(quantity))); + + /// + /// Gets a list of properties associated with the current weed definition. + /// + /// + /// A list of properties of type Il2CppScheduleOne.Properties.Property + /// associated with the weed definition. If no properties are found, + /// an empty list is returned. + /// + public List GetProperties() + { + var result = new List(); + var list = S1WeedDefinition?.Properties; + if (list != null) + { + for (int i = 0; i < list.Count; i++) + { + result.Add(list[i]); + } + } + + return result; + } } } From 492a4baeaa8fdd640e6c1b21b9890afb1f3b6b39 Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Wed, 30 Apr 2025 00:24:12 +0200 Subject: [PATCH 05/12] fix: references --- S1API/Products/CocaineDefinition.cs | 8 ++++++++ S1API/Products/MethDefinition.cs | 8 ++++++++ S1API/Products/ProductDefinition.cs | 5 ++++- S1API/Products/WeedDefinition.cs | 8 ++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/S1API/Products/CocaineDefinition.cs b/S1API/Products/CocaineDefinition.cs index a27a2098..43c0543d 100644 --- a/S1API/Products/CocaineDefinition.cs +++ b/S1API/Products/CocaineDefinition.cs @@ -44,9 +44,17 @@ public override ItemInstance CreateInstance(int quantity = 1) => /// Retrieves a list of properties associated with the current cocaine product definition. /// /// A list of properties specific to the cocaine product definition. +#if IL2CPPBEPINEX || IL2CPPMELON public List GetProperties() +#else + public List GetProperties() +#endif { +#if IL2CPPBEPINEX || IL2CPPMELON var result = new List(); +#else + var result = new List(); +#endif var list = S1CocaineDefinition?.Properties; if (list != null) { diff --git a/S1API/Products/MethDefinition.cs b/S1API/Products/MethDefinition.cs index ddd335ea..4635b0c9 100644 --- a/S1API/Products/MethDefinition.cs +++ b/S1API/Products/MethDefinition.cs @@ -47,9 +47,17 @@ public override ItemInstance CreateInstance(int quantity = 1) => /// Retrieves the list of properties associated with the meth product definition. /// /// A list of properties that belong to the meth product definition. +#if IL2CPPBEPINEX || IL2CPPMELON public List GetProperties() +#else + public List GetProperties() +#endif { +#if IL2CPPBEPINEX || IL2CPPMELON var result = new List(); +#else + var result = new List(); +#endif var list = S1MethDefinition?.Properties; if (list != null) { diff --git a/S1API/Products/ProductDefinition.cs b/S1API/Products/ProductDefinition.cs index fbda17e1..78f02545 100644 --- a/S1API/Products/ProductDefinition.cs +++ b/S1API/Products/ProductDefinition.cs @@ -27,8 +27,11 @@ public class ProductDefinition : ItemDefinition /// INTERNAL: Creates a product definition from the in-game product definition. /// /// + #if IL2CPPBEPINEX || IL2CPPMELON internal ProductDefinition(Il2CppScheduleOne.ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } - +#else + internal ProductDefinition(ScheduleOne.ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } + #endif /// /// The price associated with this product. /// diff --git a/S1API/Products/WeedDefinition.cs b/S1API/Products/WeedDefinition.cs index 0ef7c2d7..956999e5 100644 --- a/S1API/Products/WeedDefinition.cs +++ b/S1API/Products/WeedDefinition.cs @@ -58,9 +58,17 @@ public override ItemInstance CreateInstance(int quantity = 1) => /// associated with the weed definition. If no properties are found, /// an empty list is returned. /// +#if IL2CPPBEPINEX || IL2CPPMELON public List GetProperties() +#else +public List GetProperties() +#endif { +#if IL2CPPBEPINEX || IL2CPPMELON var result = new List(); +#else + var result = new List(); + #endif var list = S1WeedDefinition?.Properties; if (list != null) { From 0a3c70c0bedc72e74f2a60ae7ee1e0a5ca8f9ccd Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Wed, 30 Apr 2025 00:30:06 +0200 Subject: [PATCH 06/12] more fixes --- S1API/Products/ProductDefinition.cs | 10 +++++++--- S1API/Products/ProductInstance.cs | 10 +++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/S1API/Products/ProductDefinition.cs b/S1API/Products/ProductDefinition.cs index 78f02545..69ff9b61 100644 --- a/S1API/Products/ProductDefinition.cs +++ b/S1API/Products/ProductDefinition.cs @@ -53,10 +53,14 @@ public Sprite Icon { get { return S1ProductDefinition.Icon; } } +#if IL2CPPBEPINEX || IL2CPPMELON + private List properties; // or however properties are stored + public List Properties; // or however properties are stored +#else + private List properties; // or however properties are stored + public IReadOnlyList Properties => properties.AsReadOnly(); +#endif - private List properties; // or however properties are stored - // Add this public property if it doesn't exist yet - public IReadOnlyList Properties => properties.AsReadOnly(); } } diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index 7b1aa868..9a479e34 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -50,9 +50,17 @@ internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(p public Quality Quality => S1ProductInstance.Quality.ToAPI(); // Expose the underlying definition's properties (if S1ProductInstance.Definition is available) - public IReadOnlyList Properties => Definition.Properties; // Add Definition property if you don't have one yet + +#if IL2CPPBEPINEX || IL2CPPMELON + public IReadOnlyList Properties => Definition.Properties; + public ProductDefinition Definition => new ProductDefinition(S1ProductInstance.Definition); +#else + public IReadOnlyList Properties => Definition.Properties; public ProductDefinition Definition => new ProductDefinition(S1ProductInstance.Definition); + +#endif + } } From 36e845cceca587017a97885389dbd90ae23f8956 Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Sat, 10 May 2025 13:14:21 +0200 Subject: [PATCH 07/12] changes for max --- S1API/Products/ProductDefinition.cs | 4 ++-- S1API/Products/ProductDefinitionWrapper.cs | 6 ++---- S1API/Products/ProductInstance.cs | 1 - S1API/Products/Quality.cs | 15 ++++++++------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/S1API/Products/ProductDefinition.cs b/S1API/Products/ProductDefinition.cs index 69ff9b61..3abd4efe 100644 --- a/S1API/Products/ProductDefinition.cs +++ b/S1API/Products/ProductDefinition.cs @@ -27,11 +27,11 @@ public class ProductDefinition : ItemDefinition /// INTERNAL: Creates a product definition from the in-game product definition. /// /// - #if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPBEPINEX || IL2CPPMELON internal ProductDefinition(Il2CppScheduleOne.ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } #else internal ProductDefinition(ScheduleOne.ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } - #endif +#endif /// /// The price associated with this product. /// diff --git a/S1API/Products/ProductDefinitionWrapper.cs b/S1API/Products/ProductDefinitionWrapper.cs index b3078fbd..923744cc 100644 --- a/S1API/Products/ProductDefinitionWrapper.cs +++ b/S1API/Products/ProductDefinitionWrapper.cs @@ -1,9 +1,7 @@ using S1API.Internal.Utils; - -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Product = Il2CppScheduleOne.Product; - -#else +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Product = ScheduleOne.Product; #endif diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index 9a479e34..610096c1 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -1,7 +1,6 @@ #if (IL2CPPMELON || IL2CPPBEPINEX) using S1Product = Il2CppScheduleOne.Product; using Il2CppScheduleOne.ItemFramework; - #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Product = ScheduleOne.Product; using ScheduleOne.ItemFramework; diff --git a/S1API/Products/Quality.cs b/S1API/Products/Quality.cs index 702923e1..2f21bd24 100644 --- a/S1API/Products/Quality.cs +++ b/S1API/Products/Quality.cs @@ -1,6 +1,6 @@ #if IL2CPPBEPINEX || IL2CPPMELON using InternalQuality = Il2CppScheduleOne.ItemFramework.EQuality; -#else +#elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using InternalQuality = ScheduleOne.ItemFramework.EQuality; #endif namespace S1API.Products @@ -15,27 +15,28 @@ namespace S1API.Products public enum Quality { /// - /// Represents the lowest quality level, indicating an item of no value or unusable condition. + /// Represents "Trash" Quality /// Trash = 0, /// - /// Represents a quality level that is below standard but better than trash-quality. + /// Represents "Poor" Quality /// Poor = 1, /// - /// Represents a standard level of quality in the predefined quality enumeration. - /// Typically used to indicate an average or commonly acceptable quality level. + /// Represents "Standard" Quality /// Standard = 2, /// - /// Represents a higher-tier quality level compared to lower + /// Represents "Premium" quality + /// Premium = 3, /// - /// Represents the highest level of quality, denoted as "Heavenly". + /// Represents "Heavenly" quality + /// Heavenly = 4 } From f0cbcd7b11277bdff1097c8dcc00d86e7c61c540 Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Sat, 10 May 2025 13:37:04 +0200 Subject: [PATCH 08/12] fixes --- S1API/Products/CocaineDefinition.cs | 2 +- S1API/Products/MethDefinition.cs | 2 +- S1API/Products/PackagingDefinition.cs | 2 +- S1API/Products/ProductDefinition.cs | 2 +- S1API/Products/ProductInstance.cs | 2 +- S1API/Products/ProductManager.cs | 2 +- S1API/Products/Quality.cs | 2 +- S1API/Products/WeedDefinition.cs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/S1API/Products/CocaineDefinition.cs b/S1API/Products/CocaineDefinition.cs index 43c0543d..6475d23b 100644 --- a/S1API/Products/CocaineDefinition.cs +++ b/S1API/Products/CocaineDefinition.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1CocaineDefinition = Il2CppScheduleOne.Product.CocaineDefinition; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) diff --git a/S1API/Products/MethDefinition.cs b/S1API/Products/MethDefinition.cs index 4635b0c9..1f0248c0 100644 --- a/S1API/Products/MethDefinition.cs +++ b/S1API/Products/MethDefinition.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1MethDefinition = Il2CppScheduleOne.Product.MethDefinition; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) diff --git a/S1API/Products/PackagingDefinition.cs b/S1API/Products/PackagingDefinition.cs index 8c1bb9d1..81d6aa84 100644 --- a/S1API/Products/PackagingDefinition.cs +++ b/S1API/Products/PackagingDefinition.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Packaging = Il2CppScheduleOne.Product.Packaging; using S1ItemFramework = Il2CppScheduleOne.ItemFramework; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) diff --git a/S1API/Products/ProductDefinition.cs b/S1API/Products/ProductDefinition.cs index 3abd4efe..778f9ac9 100644 --- a/S1API/Products/ProductDefinition.cs +++ b/S1API/Products/ProductDefinition.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppInterop.Runtime.InteropTypes; using S1Product = Il2CppScheduleOne.Product; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index 610096c1..f19f43c5 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON ) using S1Product = Il2CppScheduleOne.Product; using Il2CppScheduleOne.ItemFramework; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) diff --git a/S1API/Products/ProductManager.cs b/S1API/Products/ProductManager.cs index 811a28a3..c317d8f4 100644 --- a/S1API/Products/ProductManager.cs +++ b/S1API/Products/ProductManager.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using S1Product = Il2CppScheduleOne.Product; using Il2CppSystem.Collections.Generic; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) diff --git a/S1API/Products/Quality.cs b/S1API/Products/Quality.cs index 2f21bd24..d95d2313 100644 --- a/S1API/Products/Quality.cs +++ b/S1API/Products/Quality.cs @@ -1,4 +1,4 @@ -#if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPMELON using InternalQuality = Il2CppScheduleOne.ItemFramework.EQuality; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using InternalQuality = ScheduleOne.ItemFramework.EQuality; diff --git a/S1API/Products/WeedDefinition.cs b/S1API/Products/WeedDefinition.cs index 956999e5..be86ced9 100644 --- a/S1API/Products/WeedDefinition.cs +++ b/S1API/Products/WeedDefinition.cs @@ -1,4 +1,4 @@ -#if (IL2CPPMELON || IL2CPPBEPINEX) +#if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1WeedDefinition = Il2CppScheduleOne.Product.WeedDefinition; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) From 373744da1b7d0c414a47ad1474854e17085c4198 Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Mon, 12 May 2025 00:04:26 +0200 Subject: [PATCH 09/12] should work --- S1API/Products/CocaineDefinition.cs | 4 ++-- S1API/Products/MethDefinition.cs | 4 ++-- S1API/Products/ProductDefinition.cs | 4 ++-- S1API/Products/ProductInstance.cs | 2 +- S1API/Products/WeedDefinition.cs | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/S1API/Products/CocaineDefinition.cs b/S1API/Products/CocaineDefinition.cs index 6475d23b..6b66dd5e 100644 --- a/S1API/Products/CocaineDefinition.cs +++ b/S1API/Products/CocaineDefinition.cs @@ -44,13 +44,13 @@ public override ItemInstance CreateInstance(int quantity = 1) => /// Retrieves a list of properties associated with the current cocaine product definition. /// /// A list of properties specific to the cocaine product definition. -#if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPMELON public List GetProperties() #else public List GetProperties() #endif { -#if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPMELON var result = new List(); #else var result = new List(); diff --git a/S1API/Products/MethDefinition.cs b/S1API/Products/MethDefinition.cs index 1f0248c0..4faa7823 100644 --- a/S1API/Products/MethDefinition.cs +++ b/S1API/Products/MethDefinition.cs @@ -47,13 +47,13 @@ public override ItemInstance CreateInstance(int quantity = 1) => /// Retrieves the list of properties associated with the meth product definition. /// /// A list of properties that belong to the meth product definition. -#if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPMELON public List GetProperties() #else public List GetProperties() #endif { -#if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPMELON var result = new List(); #else var result = new List(); diff --git a/S1API/Products/ProductDefinition.cs b/S1API/Products/ProductDefinition.cs index 778f9ac9..11b9d551 100644 --- a/S1API/Products/ProductDefinition.cs +++ b/S1API/Products/ProductDefinition.cs @@ -27,7 +27,7 @@ public class ProductDefinition : ItemDefinition /// INTERNAL: Creates a product definition from the in-game product definition. /// /// -#if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPMELON internal ProductDefinition(Il2CppScheduleOne.ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } #else internal ProductDefinition(ScheduleOne.ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } @@ -53,7 +53,7 @@ public Sprite Icon { get { return S1ProductDefinition.Icon; } } -#if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPMELON private List properties; // or however properties are stored public List Properties; // or however properties are stored #else diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index 3593a5bd..0ef67164 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -52,7 +52,7 @@ internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(p // Add Definition property if you don't have one yet -#if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPMELON public IReadOnlyList Properties => Definition.Properties; public ProductDefinition Definition => new ProductDefinition(S1ProductInstance.Definition); #else diff --git a/S1API/Products/WeedDefinition.cs b/S1API/Products/WeedDefinition.cs index be86ced9..cb7ca0e0 100644 --- a/S1API/Products/WeedDefinition.cs +++ b/S1API/Products/WeedDefinition.cs @@ -58,13 +58,13 @@ public override ItemInstance CreateInstance(int quantity = 1) => /// associated with the weed definition. If no properties are found, /// an empty list is returned. /// -#if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPMELON public List GetProperties() #else public List GetProperties() #endif { -#if IL2CPPBEPINEX || IL2CPPMELON +#if IL2CPPMELON var result = new List(); #else var result = new List(); From 7a2328ec29098028e13ef638b11815c7675abad8 Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Sat, 17 May 2025 01:03:00 +0200 Subject: [PATCH 10/12] fix: codestyling --- S1API/Internal/Patches/QuestPatches.cs | 20 ----------------- S1API/Products/CocaineDefinition.cs | 10 +++++---- S1API/Products/MethDefinition.cs | 10 +++++---- S1API/Products/ProductDefinition.cs | 16 ++++++++------ S1API/Products/ProductInstance.cs | 30 ++++++++++++++++---------- S1API/Products/WeedDefinition.cs | 10 +++++---- 6 files changed, 47 insertions(+), 49 deletions(-) diff --git a/S1API/Internal/Patches/QuestPatches.cs b/S1API/Internal/Patches/QuestPatches.cs index b5e062dc..dc0dd12a 100644 --- a/S1API/Internal/Patches/QuestPatches.cs +++ b/S1API/Internal/Patches/QuestPatches.cs @@ -93,26 +93,6 @@ private static void QuestsLoaderLoad(S1Loaders.QuestsLoader __instance, string m } } - /// - /// Patching performed for when stale files are deleted. - /// - /// Instance of the quest manager. - /// Path to the base Quest folder. - [HarmonyPatch(typeof(S1Quests.QuestManager), "DeleteUnapprovedFiles")] - [HarmonyPostfix] - private static void QuestManagerDeleteUnapprovedFiles(S1Quests.QuestManager __instance, string parentFolderPath) - { - string questFolder = Path.Combine(parentFolderPath, "Quests"); - string?[] existingQuests = QuestManager.Quests.Select(quest => quest.SaveFolder).ToArray(); - - string[] unapprovedQuestDirectories = Directory.GetDirectories(questFolder) - .Where(directory => directory.StartsWith("Quest_") && !existingQuests.Contains(directory)) - .ToArray(); - - foreach (string unapprovedQuestDirectory in unapprovedQuestDirectories) - Directory.Delete(unapprovedQuestDirectory, true); - } - [HarmonyPatch(typeof(S1Quests.Quest), "Start")] [HarmonyPrefix] private static void QuestStart(S1Quests.Quest __instance) => diff --git a/S1API/Products/CocaineDefinition.cs b/S1API/Products/CocaineDefinition.cs index 6b66dd5e..31fd27ef 100644 --- a/S1API/Products/CocaineDefinition.cs +++ b/S1API/Products/CocaineDefinition.cs @@ -1,9 +1,11 @@ #if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1CocaineDefinition = Il2CppScheduleOne.Product.CocaineDefinition; +using Properties = Il2CppScheduleOne.Properties; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using ScheduleOne.Product; using S1CocaineDefinition = ScheduleOne.Product.CocaineDefinition; +using Properties = ScheduleOne.Properties; #endif using System.Collections.Generic; @@ -45,15 +47,15 @@ public override ItemInstance CreateInstance(int quantity = 1) => /// /// A list of properties specific to the cocaine product definition. #if IL2CPPMELON - public List GetProperties() + public List GetProperties() #else - public List GetProperties() + public List GetProperties() #endif { #if IL2CPPMELON - var result = new List(); + var result = new List(); #else - var result = new List(); + var result = new List(); #endif var list = S1CocaineDefinition?.Properties; if (list != null) diff --git a/S1API/Products/MethDefinition.cs b/S1API/Products/MethDefinition.cs index 4faa7823..b1de7c00 100644 --- a/S1API/Products/MethDefinition.cs +++ b/S1API/Products/MethDefinition.cs @@ -1,9 +1,11 @@ #if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1MethDefinition = Il2CppScheduleOne.Product.MethDefinition; + using Properties = Il2CppScheduleOne.Properties; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using ScheduleOne.Product; using S1MethDefinition = ScheduleOne.Product.MethDefinition; +using Properties = ScheduleOne.Properties; #endif using System.Collections.Generic; @@ -48,15 +50,15 @@ public override ItemInstance CreateInstance(int quantity = 1) => /// /// A list of properties that belong to the meth product definition. #if IL2CPPMELON - public List GetProperties() + public List GetProperties() #else - public List GetProperties() + public List GetProperties() #endif { #if IL2CPPMELON - var result = new List(); + var result = new List(); #else - var result = new List(); + var result = new List(); #endif var list = S1MethDefinition?.Properties; if (list != null) diff --git a/S1API/Products/ProductDefinition.cs b/S1API/Products/ProductDefinition.cs index 11b9d551..7ba72fb6 100644 --- a/S1API/Products/ProductDefinition.cs +++ b/S1API/Products/ProductDefinition.cs @@ -1,8 +1,12 @@ #if (IL2CPPMELON) using Il2CppInterop.Runtime.InteropTypes; using S1Product = Il2CppScheduleOne.Product; +using ItemFramework = Il2CppScheduleOne.ItemFramework; +using Properties = Il2CppScheduleOne.Properties; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Product = ScheduleOne.Product; +using ItemFramework = ScheduleOne.ItemFramework; +using Properties = ScheduleOne.Properties; #endif using System.Collections.Generic; @@ -28,9 +32,9 @@ public class ProductDefinition : ItemDefinition /// /// #if IL2CPPMELON - internal ProductDefinition(Il2CppScheduleOne.ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } + internal ProductDefinition(ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } #else - internal ProductDefinition(ScheduleOne.ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } + internal ProductDefinition(ItemFramework.ItemDefinition productDefinition) : base(productDefinition) { } #endif /// /// The price associated with this product. @@ -54,11 +58,11 @@ public Sprite Icon get { return S1ProductDefinition.Icon; } } #if IL2CPPMELON - private List properties; // or however properties are stored - public List Properties; // or however properties are stored + private List properties; // or however properties are stored + public List Properties; // or however properties are stored #else - private List properties; // or however properties are stored - public IReadOnlyList Properties => properties.AsReadOnly(); + private List properties; // or however properties are stored + public IReadOnlyList Properties => properties.AsReadOnly(); #endif diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index 0ef67164..bd15181f 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -1,11 +1,10 @@ #if (IL2CPPMELON ) using S1Product = Il2CppScheduleOne.Product; -using Il2CppScheduleOne.ItemFramework; +using Properties = Il2CppScheduleOne.Properties; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Product = ScheduleOne.Product; -using ScheduleOne.ItemFramework; +using Properties = ScheduleOne.Properties; #endif - using System.Collections.Generic; using S1API.Internal.Utils; using ItemInstance = S1API.Items.ItemInstance; @@ -18,34 +17,36 @@ namespace S1API.Products public class ProductInstance : ItemInstance { /// - /// INTERNAL: The stored reference to the in-game product instance. + /// INTERNAL: Reference to the in-game product item instance. /// internal S1Product.ProductItemInstance S1ProductInstance => CrossType.As(S1ItemInstance); /// - /// INTERNAL: Creates a product instance from the in-game product instance. + /// Represents an instance of a product derived from an in-game product item instance. /// - /// internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(productInstance) { } /// - /// Whether this product is currently packaged or not. + /// Indicates whether the product instance has applied packaging. /// public bool IsPackaged => S1ProductInstance.AppliedPackaging; /// - /// The type of packaging applied to this product. + /// Represents the packaging details currently applied to the product instance, if any. /// public PackagingDefinition AppliedPackaging => new PackagingDefinition(S1ProductInstance.AppliedPackaging); /// - /// The quality of this product instance. + /// Represents the quality tier of the product instance. /// + /// + /// The quality indicates the standard or grade of the product, ranging through predefined levels such as Trash, Poor, Standard, Premium, and Heavenly. + /// public Quality Quality => S1ProductInstance.Quality.ToAPI(); // Expose the underlying definition's properties (if S1ProductInstance.Definition is available) @@ -53,10 +54,17 @@ internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(p // Add Definition property if you don't have one yet #if IL2CPPMELON - public IReadOnlyList Properties => Definition.Properties; + public IReadOnlyList Properties => Definition.Properties; public ProductDefinition Definition => new ProductDefinition(S1ProductInstance.Definition); #else - public IReadOnlyList Properties => Definition.Properties; + /// + /// Represents the collection of properties associated with the product. + /// + public IReadOnlyList Properties => Definition.Properties; + + /// + /// Represents the definition of a product in the game, including its core properties. + /// public ProductDefinition Definition => new ProductDefinition(S1ProductInstance.Definition); #endif diff --git a/S1API/Products/WeedDefinition.cs b/S1API/Products/WeedDefinition.cs index cb7ca0e0..395d82cf 100644 --- a/S1API/Products/WeedDefinition.cs +++ b/S1API/Products/WeedDefinition.cs @@ -1,9 +1,11 @@ #if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1WeedDefinition = Il2CppScheduleOne.Product.WeedDefinition; +using Properties = Il2CppScheduleOne.Properties; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using ScheduleOne.Product; using S1WeedDefinition = ScheduleOne.Product.WeedDefinition; +using Properties = ScheduleOne.Properties; #endif using S1API.Internal.Utils; @@ -59,15 +61,15 @@ public override ItemInstance CreateInstance(int quantity = 1) => /// an empty list is returned. /// #if IL2CPPMELON - public List GetProperties() + public List GetProperties() #else -public List GetProperties() + public List GetProperties() #endif { #if IL2CPPMELON - var result = new List(); + var result = new List(); #else - var result = new List(); + var result = new List(); #endif var list = S1WeedDefinition?.Properties; if (list != null) From d0f02d9c7320fa756babc86884b53750f3d7aa55 Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Sat, 17 May 2025 01:16:46 +0200 Subject: [PATCH 11/12] Get rid of the preprocessord, prefix s1 namespaces with S1 --- S1API/Products/CocaineDefinition.cs | 35 +++++++------------ S1API/Products/MethDefinition.cs | 37 ++++++-------------- S1API/Products/ProductInstance.cs | 53 ++++++++++++++--------------- S1API/Products/WeedDefinition.cs | 45 ++++++------------------ 4 files changed, 60 insertions(+), 110 deletions(-) diff --git a/S1API/Products/CocaineDefinition.cs b/S1API/Products/CocaineDefinition.cs index 31fd27ef..0ee5e2f5 100644 --- a/S1API/Products/CocaineDefinition.cs +++ b/S1API/Products/CocaineDefinition.cs @@ -1,11 +1,11 @@ #if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1CocaineDefinition = Il2CppScheduleOne.Product.CocaineDefinition; -using Properties = Il2CppScheduleOne.Properties; +using S1Properties = Il2CppScheduleOne.Properties; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using ScheduleOne.Product; using S1CocaineDefinition = ScheduleOne.Product.CocaineDefinition; -using Properties = ScheduleOne.Properties; +using S1Properties = ScheduleOne.Properties; #endif using System.Collections.Generic; @@ -15,18 +15,18 @@ namespace S1API.Products { /// - /// Represents the definition of a cocaine product within the system. + /// Defines the characteristics and behaviors of a cocaine product within the system. /// public class CocaineDefinition : ProductDefinition { /// - /// INTERNAL: Strongly typed access to the CocaineDefinition within the Schedule One framework. + /// Provides internal access to the CocaineDefinition type within the Schedule One system. /// internal S1CocaineDefinition S1CocaineDefinition => CrossType.As(S1ItemDefinition); /// - /// Represents the definition of a Cocaine product. + /// Represents the definition of a cocaine product within the system. /// internal CocaineDefinition(S1CocaineDefinition definition) : base(definition) @@ -34,39 +34,28 @@ internal CocaineDefinition(S1CocaineDefinition definition) } /// - /// Creates an instance of this cocaine product with the specified quantity. + /// Creates an instance of this product definition with the specified quantity. /// - /// The quantity of the product to create. Defaults to 1. - /// An instance of the cocaine product with the specified quantity. + /// The quantity of the product to instantiate. Defaults to 1 if not specified. + /// An representing the instantiated product with the specified quantity. public override ItemInstance CreateInstance(int quantity = 1) => new ProductInstance(CrossType.As( S1CocaineDefinition.GetDefaultInstance(quantity))); /// - /// Retrieves a list of properties associated with the current cocaine product definition. + /// Retrieves a list of properties associated with this product definition. /// - /// A list of properties specific to the cocaine product definition. -#if IL2CPPMELON - public List GetProperties() -#else - public List GetProperties() -#endif + /// A list of properties for the product. + public List GetProperties() { -#if IL2CPPMELON - var result = new List(); -#else - var result = new List(); -#endif + var result = new List(); var list = S1CocaineDefinition?.Properties; if (list != null) { for (int i = 0; i < list.Count; i++) - { result.Add(list[i]); - } } return result; } } - } diff --git a/S1API/Products/MethDefinition.cs b/S1API/Products/MethDefinition.cs index b1de7c00..87689244 100644 --- a/S1API/Products/MethDefinition.cs +++ b/S1API/Products/MethDefinition.cs @@ -1,35 +1,31 @@ #if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1MethDefinition = Il2CppScheduleOne.Product.MethDefinition; - using Properties = Il2CppScheduleOne.Properties; +using S1Properties = Il2CppScheduleOne.Properties; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using ScheduleOne.Product; using S1MethDefinition = ScheduleOne.Product.MethDefinition; -using Properties = ScheduleOne.Properties; +using S1Properties = ScheduleOne.Properties; #endif using System.Collections.Generic; using S1API.Internal.Utils; using S1API.Items; - namespace S1API.Products { /// - /// Represents the definition of a Meth product in the product framework. + /// Represents the definition of a meth product within the ScheduleOne product framework. /// - /// - /// Provides methods for retrieving properties and creating instances of meth products. This class extends the base functionality provided by . - /// public class MethDefinition : ProductDefinition { /// - /// INTERNAL: Strongly typed access to S1MethDefinition, representing the Il2CppScheduleOne.Product.MethDefinition entity. + /// INTERNAL: Strongly typed access to S1MethDefinition. /// internal S1MethDefinition S1MethDefinition => CrossType.As(S1ItemDefinition); /// - /// Represents the definition of a Meth product. + /// Represents the definition of a Meth product in the product framework. /// internal MethDefinition(S1MethDefinition definition) : base(definition) @@ -37,10 +33,10 @@ internal MethDefinition(S1MethDefinition definition) } /// - /// Creates an instance of this meth product with a specified quantity. + /// Creates an instance of this meth product with the specified quantity. /// - /// The quantity of the meth product to instantiate. Defaults to 1 if not provided. - /// An instance of the meth product as a . + /// The quantity of the product instance to create. Defaults to 1 if not specified. + /// An instance of representing the created meth product. public override ItemInstance CreateInstance(int quantity = 1) => new ProductInstance(CrossType.As( S1MethDefinition.GetDefaultInstance(quantity))); @@ -48,27 +44,16 @@ public override ItemInstance CreateInstance(int quantity = 1) => /// /// Retrieves the list of properties associated with the meth product definition. /// - /// A list of properties that belong to the meth product definition. -#if IL2CPPMELON - public List GetProperties() -#else - public List GetProperties() -#endif + /// A list of properties defined for the meth product. + public List GetProperties() { -#if IL2CPPMELON - var result = new List(); -#else - var result = new List(); -#endif + var result = new List(); var list = S1MethDefinition?.Properties; if (list != null) { for (int i = 0; i < list.Count; i++) - { result.Add(list[i]); - } } - return result; } } diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index bd15181f..ee3a45bf 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -1,73 +1,72 @@ #if (IL2CPPMELON ) using S1Product = Il2CppScheduleOne.Product; -using Properties = Il2CppScheduleOne.Properties; +using S1Properties = Il2CppScheduleOne.Properties; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Product = ScheduleOne.Product; using Properties = ScheduleOne.Properties; #endif using System.Collections.Generic; using S1API.Internal.Utils; -using ItemInstance = S1API.Items.ItemInstance; - +using S1ItemInstance = S1API.Items.ItemInstance; namespace S1API.Products { /// /// Represents an instance of a product in the game. /// - public class ProductInstance : ItemInstance + /// + /// This class defines specific properties and behaviors for a product instance, + /// such as quality, packaging, and definition, derived from the S1API's item instance structure. + /// + public class ProductInstance : S1ItemInstance { /// - /// INTERNAL: Reference to the in-game product item instance. + /// INTERNAL: Provides access to the underlying in-game product item instance. /// internal S1Product.ProductItemInstance S1ProductInstance => CrossType.As(S1ItemInstance); /// - /// Represents an instance of a product derived from an in-game product item instance. + /// Represents an instance of a product, derived from a specific in-game product item instance, + /// with additional properties for packaging, quality, and product definition. /// - internal ProductInstance(S1Product.ProductItemInstance productInstance) : base(productInstance) + internal ProductInstance(S1Product.ProductItemInstance productInstance) + : base(productInstance) { } /// /// Indicates whether the product instance has applied packaging. /// - public bool IsPackaged => - S1ProductInstance.AppliedPackaging; + public bool IsPackaged => S1ProductInstance.AppliedPackaging; /// - /// Represents the packaging details currently applied to the product instance, if any. + /// Provides access to the packaging information applied to the product, + /// represented as a specific packaging definition instance. /// public PackagingDefinition AppliedPackaging => new PackagingDefinition(S1ProductInstance.AppliedPackaging); /// - /// Represents the quality tier of the product instance. + /// Represents the quality level of the product instance. /// /// - /// The quality indicates the standard or grade of the product, ranging through predefined levels such as Trash, Poor, Standard, Premium, and Heavenly. + /// Quality levels provide a measure of the product's grading, ranging from "Trash" to "Heavenly". /// public Quality Quality => S1ProductInstance.Quality.ToAPI(); - // Expose the underlying definition's properties (if S1ProductInstance.Definition is available) - - // Add Definition property if you don't have one yet - -#if IL2CPPMELON - public IReadOnlyList Properties => Definition.Properties; - public ProductDefinition Definition => new ProductDefinition(S1ProductInstance.Definition); -#else /// - /// Represents the collection of properties associated with the product. + /// Gets the definition of the product associated with this instance. /// - public IReadOnlyList Properties => Definition.Properties; + public ProductDefinition Definition => new ProductDefinition(S1ProductInstance.Definition); /// - /// Represents the definition of a product in the game, including its core properties. + /// Gets the list of properties associated with the product definition. /// - public ProductDefinition Definition => new ProductDefinition(S1ProductInstance.Definition); - -#endif - + /// + /// This property provides an unmodifiable list of properties associated + /// with the underlying product definition. Each property represents + /// a specific characteristic or behavior of the corresponding product. + /// + public IReadOnlyList Properties => Definition.Properties; } } diff --git a/S1API/Products/WeedDefinition.cs b/S1API/Products/WeedDefinition.cs index 395d82cf..fb4c0164 100644 --- a/S1API/Products/WeedDefinition.cs +++ b/S1API/Products/WeedDefinition.cs @@ -1,11 +1,11 @@ #if (IL2CPPMELON) using Il2CppScheduleOne.Product; using S1WeedDefinition = Il2CppScheduleOne.Product.WeedDefinition; -using Properties = Il2CppScheduleOne.Properties; +using S1Properties = Il2CppScheduleOne.Properties; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using ScheduleOne.Product; using S1WeedDefinition = ScheduleOne.Product.WeedDefinition; -using Properties = ScheduleOne.Properties; +using S1Properties = ScheduleOne.Properties; #endif using S1API.Internal.Utils; @@ -15,29 +15,19 @@ namespace S1API.Products { /// - /// Represents a specific type of weed product definition. This class extends the functionality of - /// to include details specific to weed products. + /// Represents a specific type of weed product definition. /// - /// - /// This class provides methods and properties to work with weed-related product definitions, - /// including creating product instances and accessing weed-specific properties. - /// public class WeedDefinition : ProductDefinition { /// - /// Represents the definition of a weed product in the ScheduleOne API. - /// Provides access to underlying data and functionalities specific to weed products. + /// INTERNAL: Strongly typed reference to Schedule One's WeedDefinition. /// internal S1WeedDefinition S1WeedDefinition => CrossType.As(S1ItemDefinition); /// - /// Represents a specific type of product definition for weed products in the API. + /// Represents a specific type of weed product definition. /// - /// - /// This class acts as a wrapper for `Il2CppScheduleOne.Product.WeedDefinition`, - /// providing additional functionality and a specific type for handling weed items. - /// internal WeedDefinition(S1WeedDefinition definition) : base(definition) { @@ -47,37 +37,24 @@ internal WeedDefinition(S1WeedDefinition definition) /// Creates an instance of the product with the specified quantity. /// /// The quantity of the product to create. Defaults to 1 if not specified. - /// An instance of representing the created product. + /// An representing the created product instance with the specified quantity. public override ItemInstance CreateInstance(int quantity = 1) => new ProductInstance(CrossType.As( S1WeedDefinition.GetDefaultInstance(quantity))); /// - /// Gets a list of properties associated with the current weed definition. + /// Retrieves a list of properties associated with this weed definition. /// - /// - /// A list of properties of type Il2CppScheduleOne.Properties.Property - /// associated with the weed definition. If no properties are found, - /// an empty list is returned. - /// -#if IL2CPPMELON - public List GetProperties() -#else - public List GetProperties() -#endif + /// A list of properties of type S1Properties.Property that are linked with the current weed definition, or an empty list if none are found. + public List GetProperties() { -#if IL2CPPMELON - var result = new List(); -#else - var result = new List(); - #endif + var result = new List(); var list = S1WeedDefinition?.Properties; + if (list != null) { for (int i = 0; i < list.Count; i++) - { result.Add(list[i]); - } } return result; From 641f48fa8b0d4f675011d39ecd6ab5eaf25a379f Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Sat, 17 May 2025 01:18:55 +0200 Subject: [PATCH 12/12] fix: build for melon --- S1API/Products/ProductInstance.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/S1API/Products/ProductInstance.cs b/S1API/Products/ProductInstance.cs index ee3a45bf..150c6e72 100644 --- a/S1API/Products/ProductInstance.cs +++ b/S1API/Products/ProductInstance.cs @@ -3,7 +3,7 @@ using S1Properties = Il2CppScheduleOne.Properties; #elif (MONOMELON || MONOBEPINEX || IL2CPPBEPINEX) using S1Product = ScheduleOne.Product; -using Properties = ScheduleOne.Properties; +using S1Properties = ScheduleOne.Properties; #endif using System.Collections.Generic; using S1API.Internal.Utils;