using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("AichoGuardian")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AichoGuardian")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("D28110A9-E229-4700-AD4D-DCD37486A82B")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace AichoCreatures; [BepInPlugin("aicho.AichoCreatures", "AichoCreatures", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class AichoCreaturesPlugin : BaseUnityPlugin { public const string PluginGUID = "aicho.AichoCreatures"; public const string PluginName = "AichoCreatures"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log; private AssetBundle _assets; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; LoadBundle(); AddUniversalPrefabs(); AddWendigoPrefabs(); AddWendigoMonsters(); AddWerebearPrefabs(); AddWerebearMonsters(); AddYetiPrefabs(); AddYetiMonsters(); AddWerewolvesPrefabs(); AddWerewolvesMonsters(); PrefabManager.OnVanillaPrefabsAvailable += FixSFX; PrefabManager.OnVanillaPrefabsAvailable += FixMusic; } private void LoadBundle() { try { _assets = AssetUtils.LoadAssetBundleFromResources("lycanthrope", Assembly.GetExecutingAssembly()); Log.LogInfo((object)"Bundle 'lycanthrope' cargado correctamente."); } catch (Exception arg) { Log.LogError((object)$"Error cargando el bundle: {arg}"); } } private void UnloadBundle() { try { AssetBundle assets = _assets; if (assets != null) { assets.Unload(false); } } catch (Exception arg) { Log.LogWarning((object)$"Error descargando bundle: {arg}"); } } private void AddPrefab(string name, bool fixRef = true) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown GameObject val = _assets.LoadAsset(name); if ((Object)(object)val == (Object)null) { Log.LogWarning((object)("Prefab no encontrado en bundle: " + name)); return; } PrefabManager.Instance.AddPrefab(new CustomPrefab(val, fixRef)); Log.LogDebug((object)("Prefab registrado: " + name)); } private void AddItem(string name) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown GameObject val = _assets.LoadAsset(name); if ((Object)(object)val == (Object)null) { Log.LogWarning((object)("Item no encontrado en bundle: " + name)); return; } ItemManager.Instance.AddItem(new CustomItem(val, true)); Log.LogDebug((object)("Item registrado: " + name)); } private void AddCreature(string name, DropConfig[] drops) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown GameObject val = _assets.LoadAsset(name); if ((Object)(object)val == (Object)null) { Log.LogWarning((object)("Criatura no encontrada en bundle: " + name)); return; } CreatureManager.Instance.AddCreature(new CustomCreature(val, true, new CreatureConfig { DropConfigs = drops })); Log.LogInfo((object)("Criatura registrada: " + name)); } private static DropConfig[] BoneBlood() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown return (DropConfig[])(object)new DropConfig[2] { new DropConfig { Item = "BoneFragments", Chance = 50f, MinAmount = 1, MaxAmount = 2, OnePerPlayer = false, LevelMultiplier = false }, new DropConfig { Item = "Bloodbag", Chance = 50f, MinAmount = 2, MaxAmount = 3, OnePerPlayer = false, LevelMultiplier = false } }; } private static DropConfig[] BoneOnly() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown return (DropConfig[])(object)new DropConfig[1] { new DropConfig { Item = "BoneFragments", Chance = 50f, MinAmount = 1, MaxAmount = 2, OnePerPlayer = false, LevelMultiplier = false } }; } private static DropConfig[] YetiDrops() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown return (DropConfig[])(object)new DropConfig[3] { new DropConfig { Item = "BoneFragments", Chance = 50f, MinAmount = 1, MaxAmount = 2, OnePerPlayer = false, LevelMultiplier = false }, new DropConfig { Item = "FreezeGland", Chance = 50f, MinAmount = 1, MaxAmount = 2, OnePerPlayer = false, LevelMultiplier = false }, new DropConfig { Item = "Bloodbag", Chance = 50f, MinAmount = 2, MaxAmount = 3, OnePerPlayer = false, LevelMultiplier = false } }; } private void AddUniversalPrefabs() { try { AddPrefab("VFX_Spawn_Small_LM"); AddPrefab("Music_WereCastle_LM"); } catch (Exception arg) { Log.LogError((object)$"AddUniversalPrefabs: {arg}"); } } private void AddWendigoPrefabs() { try { AddItem("Attack_WendigoRight_LM"); AddItem("Attack_WendigoLeft_LM"); AddItem("Attack_WendigoSwampLeft_LM"); AddItem("Attack_WendigoSwampRight_LM"); AddItem("Attack_WendigoStench_LM"); AddPrefab("AoE_WendigoStench_LM"); AddPrefab("Ragdoll_Wendigo_LM"); AddPrefab("Ragdoll_WendigoSwamp_LM"); AddPrefab("SFX_WendigoAlert_LM", fixRef: false); AddPrefab("SFX_WendigoIdle_LM", fixRef: false); AddPrefab("SFX_WendigoDeath_LM", fixRef: false); AddPrefab("SFX_WendigoHit_LM", fixRef: false); AddPrefab("SFX_WendigoAttack_LM", fixRef: false); AddPrefab("SFX_WendigoAttackHit_LM", fixRef: false); AddPrefab("SFX_WendigoSwing_LM", fixRef: false); } catch (Exception arg) { Log.LogError((object)$"AddWendigoPrefabs: {arg}"); } } private void AddWendigoMonsters() { try { AddCreature("Wendigo_LM", BoneOnly()); AddCreature("WendigoSwamp_LM", BoneOnly()); } catch (Exception arg) { Log.LogError((object)$"AddWendigoMonsters: {arg}"); } } private void AddWerebearPrefabs() { try { AddItem("Attack_WerebearLeftDouble_LM"); AddItem("Attack_WerebearRight_LM"); AddItem("Attack_WerebearLycanCurse_LM"); AddItem("Attack_WerebearGrayLeftDouble_LM"); AddItem("Attack_WerebearGrayRight_LM"); AddItem("Attack_WerebearRedLeftDouble_LM"); AddItem("Attack_WerebearRedRight_LM"); AddPrefab("Ragdoll_Werebear_LM"); AddPrefab("Ragdoll_WerebearGray_LM"); AddPrefab("Ragdoll_WerebearRed_LM"); AddPrefab("SFX_WerebearAlert_LM", fixRef: false); AddPrefab("SFX_WerebearIdle_LM", fixRef: false); AddPrefab("SFX_WerebearDeath_LM", fixRef: false); AddPrefab("SFX_WerebearHit_LM", fixRef: false); AddPrefab("SFX_WerebearAttack_LM", fixRef: false); AddPrefab("SFX_WerebearAttackHit_LM", fixRef: false); AddPrefab("SFX_WerebearSwing_LM", fixRef: false); } catch (Exception arg) { Log.LogError((object)$"AddWerebearPrefabs: {arg}"); } } private void AddWerebearMonsters() { try { AddCreature("Werebear_LM", BoneBlood()); AddCreature("WerebearGray_LM", BoneBlood()); AddCreature("WerebearRed_LM", BoneBlood()); } catch (Exception arg) { Log.LogError((object)$"AddWerebearMonsters: {arg}"); } } private void AddYetiPrefabs() { try { AddItem("Attack_YetiRight_LM"); AddItem("Attack_YetiLeft_LM"); AddPrefab("Ragdoll_Yeti_LM"); AddPrefab("SFX_YetiAlert_LM", fixRef: false); AddPrefab("SFX_YetiIdle_LM", fixRef: false); AddPrefab("SFX_YetiDeath_LM", fixRef: false); AddPrefab("SFX_YetiHit_LM", fixRef: false); AddPrefab("SFX_YetiAttack_LM", fixRef: false); AddPrefab("SFX_YetiAttackHit_LM", fixRef: false); AddPrefab("SFX_YetiSwing_LM", fixRef: false); } catch (Exception arg) { Log.LogError((object)$"AddYetiPrefabs: {arg}"); } } private void AddYetiMonsters() { try { AddCreature("Yeti_LM", YetiDrops()); } catch (Exception arg) { Log.LogError((object)$"AddYetiMonsters: {arg}"); } } private void AddWerewolvesPrefabs() { try { AddItem("Attack_WerewolfGrayRight_LM"); AddItem("Attack_WerewolfGrayLeft_LM"); AddItem("Attack_WerewolfGraySmash_LM"); AddItem("Attack_WerewolfRight_LM"); AddItem("Attack_WerewolfLeft_LM"); AddItem("Attack_WerewolfSmash_LM"); AddItem("Attack_WerewolfRedRight_LM"); AddItem("Attack_WerewolfRedLeft_LM"); AddItem("Attack_WerewolfRedSmash_LM"); AddItem("Attack_WerewolfWhiteRight_LM"); AddItem("Attack_WerewolfWhiteLeft_LM"); AddItem("Attack_WerewolfWhiteSmash_LM"); AddPrefab("Ragdoll_WerewolfGray_LM"); AddPrefab("Ragdoll_WerewolfGrayArmoured_LM"); AddPrefab("Ragdoll_Werewolf_LM"); AddPrefab("Ragdoll_WerewolfArmoured_LM"); AddPrefab("Ragdoll_WerewolfRed_LM"); AddPrefab("Ragdoll_WerewolfRedArmoured_LM"); AddPrefab("Ragdoll_WerewolfWhite_LM"); AddPrefab("Ragdoll_WerewolfWhiteArmoured_LM"); AddPrefab("VFX_WerewolfSmash_LM"); AddPrefab("SFX_WerewolfAlert_LM", fixRef: false); AddPrefab("SFX_WerewolfAttack_LM", fixRef: false); AddPrefab("SFX_WerewolfAttackHit_LM", fixRef: false); AddPrefab("SFX_WerewolfDeath_LM", fixRef: false); AddPrefab("SFX_WerewolfHit_LM", fixRef: false); AddPrefab("SFX_WerewolfIdle_LM", fixRef: false); AddPrefab("SFX_WerewolfSwing_LM", fixRef: false); } catch (Exception arg) { Log.LogError((object)$"AddWerewolvesPrefabs: {arg}"); } } private void AddWerewolvesMonsters() { try { AddCreature("WerewolfGray_LM", BoneBlood()); AddCreature("WerewolfGrayArmoured_LM", BoneBlood()); AddCreature("Werewolf_LM", BoneBlood()); AddCreature("WerewolfArmoured_LM", BoneBlood()); AddCreature("WerewolfRed_LM", BoneBlood()); AddCreature("WerewolfRedArmoured_LM", BoneBlood()); AddCreature("WerewolfWhite_LM", BoneBlood()); AddCreature("WerewolfWhiteArmoured_LM", BoneBlood()); } catch (Exception arg) { Log.LogError((object)$"AddWerewolvesMonsters: {arg}"); } } private void FixSFX() { try { AudioSource prefab = Cache.GetPrefab("sfx_greydwarf_attack"); if ((Object)(object)prefab == (Object)null) { return; } string[] array = new string[28] { "SFX_WendigoAlert_LM", "SFX_WendigoIdle_LM", "SFX_WendigoDeath_LM", "SFX_WendigoHit_LM", "SFX_WendigoAttack_LM", "SFX_WendigoAttackHit_LM", "SFX_WendigoSwing_LM", "SFX_WerebearAlert_LM", "SFX_WerebearIdle_LM", "SFX_WerebearDeath_LM", "SFX_WerebearHit_LM", "SFX_WerebearAttack_LM", "SFX_WerebearAttackHit_LM", "SFX_WerebearSwing_LM", "SFX_YetiAlert_LM", "SFX_YetiIdle_LM", "SFX_YetiDeath_LM", "SFX_YetiHit_LM", "SFX_YetiAttack_LM", "SFX_YetiAttackHit_LM", "SFX_YetiSwing_LM", "SFX_WerewolfAlert_LM", "SFX_WerewolfAttack_LM", "SFX_WerewolfAttackHit_LM", "SFX_WerewolfDeath_LM", "SFX_WerewolfHit_LM", "SFX_WerewolfIdle_LM", "SFX_WerewolfSwing_LM" }; string[] array2 = array; foreach (string text in array2) { AudioSource prefab2 = Cache.GetPrefab(text); if ((Object)(object)prefab2 != (Object)null) { prefab2.outputAudioMixerGroup = prefab.outputAudioMixerGroup; } } } catch (Exception arg) { Log.LogWarning((object)$"FixSFX: {arg}"); } finally { PrefabManager.OnVanillaPrefabsAvailable -= FixSFX; } } private void FixMusic() { try { AudioSource prefab = Cache.GetPrefab("Music_FulingCamp"); GameObject prefab2 = Cache.GetPrefab("Music_WereCastle_LM"); if ((Object)(object)prefab != (Object)null && (Object)(object)prefab2 != (Object)null) { prefab2.GetComponent().outputAudioMixerGroup = prefab.outputAudioMixerGroup; } } catch (Exception arg) { Log.LogWarning((object)$"FixMusic: {arg}"); } finally { PrefabManager.OnVanillaPrefabsAvailable -= FixMusic; } } }