Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LootLogger v0.1.1
LootLogger.dll
Decompiled 4 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using GlobalSettings; using HarmonyLib; using LootLogger.Helpers; using Microsoft.CodeAnalysis; using TeamCherry.SharedUtils; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LootLogger")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1+8185ba7bd048f165c4c8ae2752c976cc3f40ec33")] [assembly: AssemblyProduct("LootLogger")] [assembly: AssemblyTitle("LootLogger")] [assembly: NeutralResourcesLanguage("EN")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Microsoft.CodeAnalysis.Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace LootLogger { [BepInPlugin("io.github.danielstegink.lootlogger", "LootLogger", "0.1.1")] public class LootLogger : BaseUnityPlugin { internal static LootLogger instance; public const string Id = "io.github.danielstegink.lootlogger"; public static string Name => "LootLogger"; public static string Version => "0.1.1"; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) instance = this; new Harmony("io.github.danielstegink.lootlogger").PatchAll(); SceneManager.sceneLoaded += OnSceneLoaded; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.danielstegink.lootlogger) has loaded!")); } private void OnSceneLoaded(Scene arg0, LoadSceneMode arg1) { Log("New scene: " + ((Scene)(ref arg0)).name); Log("Breakables"); LogBreakables.Log(); Log("Enemies"); } internal void Log(string message) { ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } } } namespace LootLogger.Helpers { [HarmonyPatch(typeof(HealthManager), "Awake")] public static class HealthManager_Awake { [HarmonyPostfix] public static void Postfix(HealthManager __instance) { List<string> list = new List<string>(); if (__instance.smallGeoDrops > 0) { list.Add($"{__instance.smallGeoDrops} Rosaries"); } if (__instance.mediumGeoDrops > 0) { list.Add($"{__instance.mediumGeoDrops} Shell Rosaries"); } if (__instance.largeGeoDrops > 0) { list.Add($"{__instance.largeGeoDrops} Pearl Rosaries"); } if (__instance.shellShardDrops > 0) { list.Add($"{__instance.shellShardDrops} Shell Shards"); } Shared.LogLootable(((Component)__instance).gameObject, list); } } public static class LogBreakables { public static void Log() { Breakables(); BreakableHolders(); RosaryStrings(); RosaryCaches(); } private static void Breakables() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) Breakable[] objects = Shared.GetObjects<Breakable>(); foreach (Breakable obj in objects) { MinMaxInt smallGeoDrops = obj.smallGeoDrops; MinMaxInt mediumGeoDrops = obj.mediumGeoDrops; MinMaxInt largeGeoDrops = obj.largeGeoDrops; MinMaxInt shellShardDrops = obj.shellShardDrops; List<string> list = new List<string>(); if (smallGeoDrops.End > 0) { list.Add($"{smallGeoDrops.Start}-{smallGeoDrops.End} Rosaries"); } if (mediumGeoDrops.End > 0) { list.Add($"{mediumGeoDrops.Start}-{mediumGeoDrops.End} Shell Rosaries"); } if (largeGeoDrops.End > 0) { list.Add($"{largeGeoDrops.Start}-{largeGeoDrops.End} Pearl Rosaries"); } if (shellShardDrops.End > 0) { list.Add($"{shellShardDrops.Start}-{shellShardDrops.End} Shell Shards"); } Shared.LogLootable(((Component)obj).gameObject, list); } } private static void BreakableHolders() { BreakableHolder[] objects = Shared.GetObjects<BreakableHolder>(); foreach (BreakableHolder val in objects) { int totalHits = val.totalHits; int payoutPerHit = val.payoutPerHit; int num = totalHits * payoutPerHit + val.finalPayout; string lootType = Shared.GetLootType(Probability.GetRandomGameObjectByProbability(val.holdingGameObjects)); List<string> lootDrops = new List<string> { $"{num} {lootType}" }; Shared.LogLootable(((Component)val).gameObject, lootDrops); } } private static void RosaryStrings() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) RosaryCacheString[] objects = Shared.GetObjects<RosaryCacheString>(); foreach (RosaryCacheString val in objects) { List<FlintObject> flingObjects = val.flingObjects; Dictionary<string, int> dictionary = new Dictionary<string, int>(); foreach (FlintObject item in flingObjects) { string lootType = Shared.GetLootType(item.Obj); if (!dictionary.ContainsKey(lootType)) { dictionary.Add(lootType, 0); } dictionary[lootType]++; } List<string> list = new List<string>(); foreach (string key in dictionary.Keys) { int num = dictionary[key]; list.Add($"{num} {key}"); } Shared.LogLootable(((Component)val).gameObject, list); } } private static void RosaryCaches() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) RosaryCache[] array = (from x in Shared.GetObjects<RosaryCache>() where ((object)x).GetType() != typeof(RosaryCacheString) select x).ToArray(); foreach (RosaryCache val in array) { _ = val.hitStates.Count; Config[] flingOnStateChange = val.flingOnStateChange; Dictionary<string, List<Tuple<int, int>>> dictionary = new Dictionary<string, List<Tuple<int, int>>>(); Config[] array2 = flingOnStateChange; foreach (Config val2 in array2) { string lootType = Shared.GetLootType(val2.Prefab); if (!dictionary.ContainsKey(lootType)) { dictionary.Add(lootType, new List<Tuple<int, int>>()); } dictionary[lootType].Add(new Tuple<int, int>(val2.AmountMin, val2.AmountMax)); } List<string> list = new List<string>(); foreach (string key in dictionary.Keys) { int num = 0; int num2 = 0; foreach (Tuple<int, int> item in dictionary[key]) { num += item.Item1; num2 += item.Item2; } list.Add($"{num}-{num2} {key}"); } Shared.LogLootable(((Component)val).gameObject, list); } } } public static class Shared { public static T[] GetObjects<T>() where T : Object { return Object.FindObjectsByType<T>((FindObjectsSortMode)1).ToArray(); } public static void LogLootable(GameObject gameObject, List<string> lootDrops) { string objectPath = GetObjectPath(gameObject); if (lootDrops.Count > 0) { LootLogger.instance.Log(objectPath + ": " + string.Join(", ", lootDrops)); } } internal static string GetObjectPath(GameObject gameObject) { string text = ((Object)gameObject).name; Transform val = gameObject.transform.parent; while ((Object)(object)val != (Object)null) { if ((Object)(object)((Component)val).gameObject == (Object)null) { val = null; continue; } text = ((Object)val).name + "\\" + text; val = val.parent; } return text; } internal static string GetLootType(GameObject gameObject) { GameObject gameObject2 = gameObject; List<string> source = new List<string> { "rosary bead large" }; if ((Object)(object)gameObject2 == (Object)(object)Gameplay.LargeGeoPrefab || source.Any((string x) => ((Object)gameObject2).name.Contains(x))) { return "Pearl Rosaries"; } List<string> source2 = new List<string> { "rosary bead medium" }; if ((Object)(object)gameObject2 == (Object)(object)Gameplay.MediumGeoPrefab || source2.Any((string x) => ((Object)gameObject2).name.Contains(x))) { return "Shell Rosaries"; } List<string> source3 = new List<string> { "rosary bead" }; if ((Object)(object)gameObject2 == (Object)(object)Gameplay.SmallGeoPrefab || source3.Any((string x) => ((Object)gameObject2).name.Contains(x))) { return "Rosaries"; } if (Gameplay.IsShellShardPrefab(gameObject2)) { return "Shell Shards"; } LootLogger.instance.Log("Loot type " + ((Object)gameObject2).name + " not recognized"); return "Unknown"; } } }