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 TameableSeals v1.0.0
TameableSeals.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Jotunn.Managers; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: AssemblyCompany("TameableSeals")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TameableSeals")] [assembly: AssemblyTitle("TameableSeals")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 TameableSeals { [BepInPlugin("pseudopulse.TameableSeals", "TameableSeals", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class TameableSeals : BaseUnityPlugin { public class SealTameController : MonoBehaviour { public ItemDrop rawFish; public float m_consumeRange = 2f; public float m_consumeSearchRange = 5f; public float m_consumeSearchInterval = 10f; private ItemDrop m_consumeTarget; private float m_consumeSearchTimer; private int m_itemMask; private float stopwatch = 3f; private Character followTarget; public AnimalAI ai; public void Start() { ai = ((Component)this).GetComponent<AnimalAI>(); } public void FixedUpdate() { //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) Character character = ((BaseAI)ai).m_character; UpdateConsumeItem((Humanoid)(object)((character is Humanoid) ? character : null), Time.fixedDeltaTime); if ((Object)(object)followTarget != (Object)null) { ((BaseAI)ai).Follow(((Component)followTarget).gameObject, Time.fixedDeltaTime); } if (((BaseAI)ai).m_tamable.IsTamed()) { ai.m_updateTargetTimer = 900f; ai.m_target = null; } stopwatch -= Time.fixedDeltaTime; if (stopwatch >= 0f) { return; } stopwatch = 3f; if (((BaseAI)ai).m_tamable.m_nview.IsValid() && ((BaseAI)ai).m_tamable.m_nview.IsOwner() && !((BaseAI)ai).m_tamable.IsTamed() && !((BaseAI)ai).m_tamable.IsHungry()) { ((BaseAI)ai).m_tamable.DecreaseRemainingTime(3f); if (((BaseAI)ai).m_tamable.GetRemainingTime() <= 0f) { ((BaseAI)ai).m_character.SetTamed(true); ((BaseAI)ai).m_tamable.Tame(); } else { ((BaseAI)ai).m_tamable.m_sootheEffect.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1, default(ZDOID)); } } if (!((BaseAI)ai).m_tamable.IsTamed()) { return; } string text = ((BaseAI)ai).m_nview.GetZDO().GetString(ZDOVars.s_follow, ""); if (string.IsNullOrEmpty(text)) { followTarget = null; return; } foreach (Player allPlayer in Player.GetAllPlayers()) { if (allPlayer.GetPlayerName() == text) { followTarget = (Character)(object)allPlayer; } } } private bool UpdateConsumeItem(Humanoid humanoid, float dt) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) m_consumeSearchTimer += dt; if (m_consumeSearchTimer > m_consumeSearchInterval) { m_consumeSearchTimer = 0f; if (Object.op_Implicit((Object)(object)((BaseAI)ai).m_tamable) && !((BaseAI)ai).m_tamable.IsHungry()) { return false; } m_consumeTarget = FindClosestConsumableItem(m_consumeSearchRange); } if (Object.op_Implicit((Object)(object)m_consumeTarget)) { if (((BaseAI)ai).MoveTo(dt, ((Component)m_consumeTarget).transform.position, m_consumeRange, false)) { ((BaseAI)ai).LookAt(((Component)m_consumeTarget).transform.position); if (((BaseAI)ai).IsLookingAt(((Component)m_consumeTarget).transform.position, 20f, false) && m_consumeTarget.RemoveOne()) { ((BaseAI)ai).m_tamable.OnConsumedItem(m_consumeTarget); humanoid.m_consumeItemEffects.Create(((Component)this).transform.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID)); ((BaseAI)ai).m_animator.SetTrigger("consume"); m_consumeTarget = null; } } return true; } return false; } private bool CanConsume(ItemData item) { if (rawFish.m_itemData.m_shared.m_name == item.m_shared.m_name) { return true; } return false; } private ItemDrop FindClosestConsumableItem(float maxRange) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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) if (m_itemMask == 0) { m_itemMask = LayerMask.GetMask(new string[1] { "item" }); } Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, maxRange, m_itemMask); ItemDrop val = null; float num = 999999f; Collider[] array2 = array; Collider[] array3 = array2; foreach (Collider val2 in array3) { if (!Object.op_Implicit((Object)(object)val2.attachedRigidbody)) { continue; } ItemDrop component = ((Component)val2.attachedRigidbody).GetComponent<ItemDrop>(); if (!((Object)(object)component == (Object)null) && ((Component)component).GetComponent<ZNetView>().IsValid() && CanConsume(component.m_itemData)) { float num2 = Vector3.Distance(((Component)component).transform.position, ((Component)this).transform.position); if ((Object)(object)val == (Object)null || num2 < num) { val = component; num = num2; } } } if (Object.op_Implicit((Object)(object)val) && ((BaseAI)ai).HavePath(((Component)val).transform.position)) { return val; } return null; } } private void Awake() { CreatureManager.OnVanillaCreaturesAvailable += MakeFatassChudTameable; } private void MakeFatassChudTameable() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) GameObject creaturePrefab = CreatureManager.Instance.GetCreaturePrefab("Lox"); Tameable component = creaturePrefab.GetComponent<Tameable>(); if (Object.op_Implicit((Object)(object)component)) { GameObject creaturePrefab2 = CreatureManager.Instance.GetCreaturePrefab("Seal"); Tameable val = creaturePrefab2.AddComponent<Tameable>(); val.m_fedDuration = 300f; val.m_tamingTime = 900f; val.m_startsTamed = false; val.m_tamedEffect = component.m_tamedEffect; val.m_sootheEffect = component.m_sootheEffect; val.m_petEffect = component.m_petEffect; val.m_commandable = true; val.m_unsummonDistance = component.m_unsummonDistance; val.m_unsummonOnOwnerLogoutSeconds = component.m_unsummonOnOwnerLogoutSeconds; val.m_levelUpOwnerSkill = component.m_levelUpOwnerSkill; val.m_levelUpFactor = component.m_levelUpFactor; val.m_dropItemVel = component.m_dropItemVel; val.m_tamingSpeedMultiplierRange = component.m_tamingSpeedMultiplierRange; val.m_tamingBoostMultiplier = component.m_tamingBoostMultiplier; ((BaseAI)creaturePrefab2.GetComponent<AnimalAI>()).m_tamable = val; creaturePrefab2.AddComponent<SealTameController>().rawFish = PrefabManager.Instance.GetPrefab("FishRaw").GetComponent<ItemDrop>(); creaturePrefab2.GetComponent<Character>().m_tameable = val; ((Behaviour)creaturePrefab2.AddComponent<MonsterAI>()).enabled = false; creaturePrefab2.GetComponent<Tameable>().m_monsterAI = creaturePrefab2.GetComponent<MonsterAI>(); } } } public static class PluginInfo { public const string PLUGIN_GUID = "TameableSeals"; public const string PLUGIN_NAME = "TameableSeals"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }