Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of FreeCostFix v1.0.1
plugins/FreeCostFix/FreeCostFix.dll
Decompiled 10 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using R2API.Utils; using RoR2; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FreeCostFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+05603ef96eb3351cf2bb47deed55419e134b6d22")] [assembly: AssemblyProduct("FreeCostFix")] [assembly: AssemblyTitle("FreeCostFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FreeCostFix { [BepInPlugin("Gorakh.FreeCostFix", "FreeCostFix", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class FreeCostFixPlugin : BaseUnityPlugin { public const string PluginGUID = "Gorakh.FreeCostFix"; public const string PluginAuthor = "Gorakh"; public const string PluginName = "FreeCostFix"; public const string PluginVersion = "1.0.1"; internal static FreeCostFixPlugin Instance { get; private set; } private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Stopwatch stopwatch = Stopwatch.StartNew(); Instance = SingletonHelper.Assign<FreeCostFixPlugin>(Instance, this); Log.Init(((BaseUnityPlugin)this).Logger); AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/CostHologramContent.prefab"); val.Completed += delegate(AsyncOperationHandle<GameObject> handle) { CostHologramContent val2 = default(CostHologramContent); if (!Object.op_Implicit((Object)(object)handle.Result)) { Log.Error("Failed to load CostHologramContent prefab", "D:\\Git\\RoR2\\FreeCostFix\\FreeCostFix\\FreeCostFixPlugin.cs", "Awake", 34); } else if (handle.Result.TryGetComponent<CostHologramContent>(ref val2)) { if (Object.op_Implicit((Object)(object)val2.targetTextMesh)) { ((TMP_Text)val2.targetTextMesh).text = string.Empty; } ((Component)val2).gameObject.AddComponent<RefreshDisplayOnAwake>().HologramContent = val2; } else { Log.Error("CostHologramContent is missing component", "D:\\Git\\RoR2\\FreeCostFix\\FreeCostFix\\FreeCostFixPlugin.cs", "Awake", 50); } }; stopwatch.Stop(); Log.Message_NoCallerPrefix($"Initialized in {stopwatch.Elapsed.TotalMilliseconds:F0}ms"); } private void OnDestroy() { Instance = SingletonHelper.Unassign<FreeCostFixPlugin>(Instance, this); } } internal static class Log { private static readonly StringBuilder _sharedStringBuilder; private static readonly int _cachedCallerPathPrefixLength; private static ManualLogSource _logSource; static Log() { _sharedStringBuilder = new StringBuilder(256); _cachedCallerPathPrefixLength = getCallerPathPrefixLength("D:\\Git\\RoR2\\FreeCostFix\\FreeCostFix\\Log.cs"); static int getCallerPathPrefixLength([CallerFilePath] string callerPath = null) { int num = callerPath.LastIndexOf("FreeCostFix\\"); if (num >= 0) { return num + "FreeCostFix\\".Length; } Debug.LogError((object)"[FreeCostFix] Logger failed to determine caller path prefix length"); return 0; } } internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static StringBuilder AppendCallerPrefix(this StringBuilder stringBuilder, string callerPath, string callerMemberName, int callerLineNumber) { return stringBuilder.Append(callerPath, _cachedCallerPathPrefixLength, callerPath.Length - _cachedCallerPathPrefixLength).Append(':').Append(callerLineNumber) .Append(" (") .Append(callerMemberName) .Append("):"); } private static StringBuilder buildCallerLogString(string callerPath, string callerMemberName, int callerLineNumber, object data) { return _sharedStringBuilder.Clear().AppendCallerPrefix(callerPath, callerMemberName, callerLineNumber).Append(' ') .Append(data); } internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogError((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Error_NoCallerPrefix(object data) { _logSource.LogError(data); } internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogFatal((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Fatal_NoCallerPrefix(object data) { _logSource.LogFatal(data); } internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogInfo((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Info_NoCallerPrefix(object data) { _logSource.LogInfo(data); } internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogMessage((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Message_NoCallerPrefix(object data) { _logSource.LogMessage(data); } internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1) { _logSource.LogWarning((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void Warning_NoCallerPrefix(object data) { _logSource.LogWarning(data); } } public class RefreshDisplayOnAwake : MonoBehaviour { public CostHologramContent HologramContent; private void Awake() { if (!Object.op_Implicit((Object)(object)HologramContent)) { HologramContent = ((Component)this).GetComponent<CostHologramContent>(); } if (Object.op_Implicit((Object)(object)HologramContent)) { HologramContent.oldDisplayValue = -346893567; } } } }