|
| 1 | +#if IL2CPPBEPINEX || IL2CPPMELON |
| 2 | +using InternalQuality = Il2CppScheduleOne.ItemFramework.EQuality; |
| 3 | +#else |
| 4 | +using InternalQuality = ScheduleOne.ItemFramework.EQuality; |
| 5 | +#endif |
| 6 | +namespace S1API.Products |
| 7 | +{ |
| 8 | + /// <summary> |
| 9 | + /// Represents the quality levels for items. |
| 10 | + /// </summary> |
| 11 | + /// <remarks> |
| 12 | + /// This enumeration defines various quality tiers that items can belong to. Each tier represents a specific |
| 13 | + /// standard or grade, ranging from the lowest to the highest. |
| 14 | + /// </remarks> |
| 15 | + public enum Quality |
| 16 | + { |
| 17 | + /// <summary> |
| 18 | + /// Represents the lowest quality level, indicating an item of no value or unusable condition. |
| 19 | + /// </summary> |
| 20 | + Trash = 0, |
| 21 | + |
| 22 | + /// <summary> |
| 23 | + /// Represents a quality level that is below standard but better than trash-quality. |
| 24 | + /// </summary> |
| 25 | + Poor = 1, |
| 26 | + |
| 27 | + /// <summary> |
| 28 | + /// Represents a standard level of quality in the predefined quality enumeration. |
| 29 | + /// Typically used to indicate an average or commonly acceptable quality level. |
| 30 | + /// </summary> |
| 31 | + Standard = 2, |
| 32 | + |
| 33 | + /// <summary> |
| 34 | + /// Represents a higher-tier quality level compared to lower |
| 35 | + Premium = 3, |
| 36 | + |
| 37 | + /// <summary> |
| 38 | + /// Represents the highest level of quality, denoted as "Heavenly". |
| 39 | + Heavenly = 4 |
| 40 | + } |
| 41 | + |
| 42 | + /// <summary> |
| 43 | + /// Provides extension methods for converting between <see cref="Il2CppScheduleOne.ItemFramework.EQuality"/> and |
| 44 | + /// <see cref="S1API.Products.Quality"/> enumerations. |
| 45 | + /// </summary> |
| 46 | + internal static class QualityExtensions |
| 47 | + { |
| 48 | + /// <summary> |
| 49 | + /// Converts an instance of <see cref="Il2CppScheduleOne.ItemFramework.EQuality"/> to its corresponding |
| 50 | + /// <see cref="S1API.Products.Quality"/> representation. |
| 51 | + /// </summary> |
| 52 | + /// <param name="quality">The <see cref="Il2CppScheduleOne.ItemFramework.EQuality"/> instance to convert.</param> |
| 53 | + /// <returns>A <see cref="S1API.Products.Quality"/> value that represents the converted quality.</returns> |
| 54 | + internal static Quality ToAPI(this InternalQuality quality) |
| 55 | + { |
| 56 | + return quality switch |
| 57 | + { |
| 58 | + InternalQuality.Trash => Quality.Trash, |
| 59 | + InternalQuality.Poor => Quality.Poor, |
| 60 | + InternalQuality.Standard => Quality.Standard, |
| 61 | + InternalQuality.Premium => Quality.Premium, |
| 62 | + InternalQuality.Heavenly => Quality.Heavenly, |
| 63 | + _ => Quality.Trash, |
| 64 | + }; |
| 65 | + } |
| 66 | + |
| 67 | + /// <summary> |
| 68 | + /// Converts an instance of the <see cref="Quality"/> enum to its corresponding |
| 69 | + /// <see cref="InternalQuality"/> enum representation. |
| 70 | + /// </summary> |
| 71 | + /// <param name="quality">The <see cref="Quality"/> enum value to convert.</param> |
| 72 | + /// <returns>The corresponding <see cref="InternalQuality"/> enum value.</returns> |
| 73 | + internal static InternalQuality ToInternal(this Quality quality) |
| 74 | + { |
| 75 | + return quality switch |
| 76 | + { |
| 77 | + Quality.Trash => InternalQuality.Trash, |
| 78 | + Quality.Poor => InternalQuality.Poor, |
| 79 | + Quality.Standard => InternalQuality.Standard, |
| 80 | + Quality.Premium => InternalQuality.Premium, |
| 81 | + Quality.Heavenly => InternalQuality.Heavenly, |
| 82 | + _ => InternalQuality.Trash, |
| 83 | + }; |
| 84 | + } |
| 85 | + } |
| 86 | +} |
0 commit comments