diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index ad60134..fe436d4 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -34,6 +34,9 @@ using System.Diagnostics; namespace ShiftOS.Engine { + /// + /// Backend class for the Shiftorium. + /// public static class Shiftorium { /// @@ -62,11 +65,19 @@ namespace ShiftOS.Engine return cats.ToArray(); } + /// + /// Causes the engine to alert the frontend of a new Shiftorium upgrade install. + /// public static void InvokeUpgradeInstalled() { Installed?.Invoke(); } + /// + /// Gets the category of an upgrade. + /// + /// The upgrade ID to check + /// "Other" if the upgrade is not found, else, the upgrade category. public static string GetCategory(string id) { var upg = GetDefaults().FirstOrDefault(x => x.ID == id); @@ -75,16 +86,32 @@ namespace ShiftOS.Engine return (upg.Category == null) ? "Other" : upg.Category; } + /// + /// Gets all upgrades in a given category. + /// + /// The category name to search + /// The upgrades in the category. public static IEnumerable GetAllInCategory(string cat) { return GetDefaults().Where(x => x.Category == cat); } + /// + /// Gets whether or not the user has installed all upgrades in a category. + /// + /// The category to search. + /// Boolean value representing whether the user has installed all upgrades in the category. public static bool IsCategoryEmptied(string cat) { return GetDefaults().Where(x => x.Category == cat).FirstOrDefault(x => x.Installed == false) == null; } + /// + /// Buy an upgrade, deducting the specified amount of Codepoints. + /// + /// The upgrade ID to buy + /// The amount of Codepoints to deduct + /// True if the upgrade was installed successfully, false if the user didn't have enough Codepoints or the upgrade wasn' found. public static bool Buy(string id, long cost) { if(SaveSystem.CurrentSave.Codepoints >= cost) @@ -105,6 +132,11 @@ namespace ShiftOS.Engine } } + /// + /// Determines whether all Shiftorium upgrade attributes for this type have been installed. + /// + /// The type to scan + /// Boolean value representing the result of this function. public static bool UpgradeAttributesUnlocked(Type type) { foreach(var attr in type.GetCustomAttributes(true)) @@ -119,6 +151,11 @@ namespace ShiftOS.Engine return true; } + /// + /// Determines whether all Shiftorium upgrade attributes for this method have been installed. + /// + /// The method to scan + /// Boolean value representing the result of this function. public static bool UpgradeAttributesUnlocked(MethodInfo type) { foreach (var attr in type.GetCustomAttributes(true)) @@ -133,6 +170,11 @@ namespace ShiftOS.Engine return true; } + /// + /// Determines whether all Shiftorium upgrade attributes for this property have been installed. + /// + /// The property to scan + /// Boolean value representing the result of this function. public static bool UpgradeAttributesUnlocked(PropertyInfo type) { foreach (var attr in type.GetCustomAttributes(true)) @@ -147,6 +189,11 @@ namespace ShiftOS.Engine return true; } + /// + /// Determines whether all Shiftorium upgrade attributes for this field have been installed. + /// + /// The field to scan + /// Boolean value representing the result of this function. public static bool UpgradeAttributesUnlocked(FieldInfo type) { foreach (var attr in type.GetCustomAttributes(true)) @@ -161,8 +208,16 @@ namespace ShiftOS.Engine return true; } + + /// + /// Gets or sets whether the Shiftorium has been initiated. + /// public static bool IsInitiated { get; private set; } + + /// + /// Initiates the Shiftorium. + /// public static void Init() { if (IsInitiated == false) @@ -188,6 +243,11 @@ namespace ShiftOS.Engine } + /// + /// Get the codepoint value for an upgrade. + /// + /// The upgrade ID to search + /// The codepoint value. public static long GetCPValue(string id) { foreach(var upg in GetDefaults()) @@ -198,6 +258,10 @@ namespace ShiftOS.Engine return 0; } + /// + /// Gets all available upgrades. + /// + /// public static ShiftoriumUpgrade[] GetAvailable() { List available = new List(); @@ -209,6 +273,11 @@ namespace ShiftOS.Engine return available.ToArray(); } + /// + /// Determines whether all dependencies of a given upgrade have been installed. + /// + /// The upgrade to scan + /// Boolean representing the result of this function. public static bool DependenciesInstalled(ShiftoriumUpgrade upg) { if (string.IsNullOrEmpty(upg.Dependencies)) @@ -231,8 +300,16 @@ namespace ShiftOS.Engine } } + /// + /// Fired when an upgrade is installed. + /// public static event EmptyEventHandler Installed; + /// + /// Determines if an upgrade is installed. + /// + /// The upgrade ID to scan. + /// Whether the upgrade is installed. public static bool UpgradeInstalled(string id) { if (SaveSystem.CurrentSave != null) @@ -286,7 +363,10 @@ namespace ShiftOS.Engine _provider = p; } - //Bless the newer NEWER engine. + /// + /// Gets every upgrade inside the frontend and all mods. + /// + /// Every single found Shiftorium upgrade. public static List GetDefaults() { List list = new List(); @@ -405,6 +485,10 @@ namespace ShiftOS.Engine public interface IShiftoriumProvider { + /// + /// Retrieves all frontend upgrades. + /// + /// List GetDefaults(); }