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 SusVoreModFundedByTheMan v0.1.0
TheSusVoreModFundedByTheMan.dll
Decompiled 11 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using UnityEngine; using UnityEngine.Rendering; [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: AssemblyCompany("TheSusVoreModFundedByTheMan")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+839c39b4f3c608370945bef93fd15f8e60b2d3e0")] [assembly: AssemblyProduct("TheSusVoreModFundedByTheMan")] [assembly: AssemblyTitle("TheSusVoreModFundedByTheMan")] [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; } } } public static class DisplayUtils { public static void EnsureCockMasterDisplay(GameObject prefab) { if (!Object.op_Implicit((Object)(object)prefab)) { return; } ItemDisplay val = prefab.GetComponent<ItemDisplay>(); if (!Object.op_Implicit((Object)(object)val)) { val = prefab.AddComponent<ItemDisplay>(); Debug.LogWarning((object)("[Mutator] Added ItemDisplay component to " + ((Object)prefab).name)); } Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); if (componentsInChildren != null && componentsInChildren.Length != 0) { val.rendererInfos = componentsInChildren.Select(delegate(Renderer renderer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) RendererInfo result = default(RendererInfo); result.renderer = renderer; result.defaultMaterial = renderer.sharedMaterial; result.ignoreOverlays = false; result.defaultShadowCastingMode = (ShadowCastingMode)1; return result; }).ToArray(); } else { Debug.LogWarning((object)("[Mutator] No renderers found on " + ((Object)prefab).name + ", display may be invisible!")); val.rendererInfos = (RendererInfo[])(object)new RendererInfo[0]; } } } namespace MutatorEquipmentMod { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("YourName.MutatorEquipmentMod", "MutatorEquipmentMod", "1.0.0")] public class MutatorEquipmentPlugin : BaseUnityPlugin { public class ItemAnimationTrigger : MonoBehaviour { public void TriggerVore(GameObject itemObject) { Animator[] componentsInChildren = itemObject.GetComponentsInChildren<Animator>(); Animator[] array = componentsInChildren; foreach (Animator val in array) { val.SetTrigger("vore"); } } } public static class Log { private static ManualLogSource _log; public static void Init(ManualLogSource l) { _log = l; } public static void Info(object o) { ManualLogSource log = _log; if (log != null) { log.LogInfo(o); } } public static void Error(object o) { ManualLogSource log = _log; if (log != null) { log.LogError(o); } } } public class MutatorTargetingController : MonoBehaviour { private CharacterBody body; private EquipmentSlot slot; private Indicator indicator; private static GameObject indicatorPrefab; private void Awake() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown body = ((Component)this).GetComponent<CharacterBody>(); slot = ((Component)this).GetComponent<EquipmentSlot>(); if (!Object.op_Implicit((Object)(object)indicatorPrefab)) { indicatorPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/LightningIndicator"); if (!Object.op_Implicit((Object)(object)indicatorPrefab)) { indicatorPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/HuntressTrackingIndicator"); } } indicator = new Indicator(((Component)this).gameObject, indicatorPrefab); indicator.active = false; } private void OnDestroy() { Indicator obj = indicator; if (obj != null) { obj.DestroyVisualizer(); } } private void Update() { //IL_00be: 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_0030: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)292)) { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterBody val = ((firstLocalUser != null) ? firstLocalUser.cachedBody : null); if (Object.op_Implicit((Object)(object)val)) { Vector3 corePosition = val.corePosition; PickupDropletController.CreatePickupDroplet(new PickupIndex(equipDef.equipmentIndex), corePosition, Vector3.zero); Log.Info("Spawned Mutator equipment at player position."); } } if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)slot)) { indicator.active = false; return; } bool flag = false; try { flag = slot.equipmentIndex == equipDef.equipmentIndex; } catch { try { flag = slot.equipmentIndex == equipDef.equipmentIndex; } catch { flag = false; } } if (!flag) { indicator.active = false; return; } if (!IsEquipmentReady(slot)) { indicator.active = false; return; } HurtBox val2 = FindTarget(body, 80f, 30f); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.healthComponent) && val2.healthComponent.alive) { indicator.targetTransform = ((Component)val2).transform; indicator.active = true; } else { indicator.active = false; } } private static bool IsEquipmentReady(EquipmentSlot s) { if (!Object.op_Implicit((Object)(object)s)) { return false; } try { if (s.equipmentDisabled) { return false; } } catch { } try { if (s.subcooldownTimer > 0f) { return false; } } catch { } try { if (s.cooldownTimer > 0f) { return false; } } catch { } return true; } public static HurtBox FindTarget(CharacterBody source, float maxDist, float maxAngle) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)source) || !Object.op_Implicit((Object)(object)source.inputBank) || !Object.op_Implicit((Object)(object)source.teamComponent)) { return null; } BullseyeSearch val = new BullseyeSearch { teamMaskFilter = TeamMask.GetEnemyTeams(source.teamComponent.teamIndex), filterByLoS = true, searchOrigin = source.inputBank.aimOrigin, searchDirection = source.inputBank.aimDirection, maxDistanceFilter = maxDist, maxAngleFilter = maxAngle, sortMode = (SortMode)1 }; val.RefreshCandidates(); return val.GetResults().FirstOrDefault(); } } [CompilerGenerated] private sealed class <DigestionEndedAfter>d__24 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CharacterBody body; public float seconds; public MutatorEquipmentPlugin <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DigestionEndedAfter>d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(seconds); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.SpawnCndm(body); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PullAndKill>d__23 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EquipmentSlot slot; public CharacterBody user; public CharacterBody victim; public MutatorEquipmentPlugin <>4__this; private CharacterMotor <motor>5__1; private Rigidbody <rb>5__2; private float <v>5__3; private Vector3 <originalScale>5__4; private float <shrinkStartDistance>5__5; private Vector3 <playerPelvisPosition>5__6; private List<Animator> <targetAnimators>5__7; private ItemDisplay[] <allDisplays>5__8; private Animator[] <victimAnimators>5__9; private int <frameCount>5__10; private ItemDisplay[] <>s__11; private int <>s__12; private ItemDisplay <display>5__13; private Animator[] <animators>5__14; private Animator[] <>s__15; private int <>s__16; private Animator <anim>5__17; private string <objName>5__18; private AudioSource <source>5__19; private Animator[] <>s__20; private int <>s__21; private Animator <anim>5__22; private string <objName>5__23; private Vector3 <userPos>5__24; private Vector3 <vicPos>5__25; private Vector3 <toUser>5__26; private float <dist>5__27; private Vector3 <dir>5__28; private float <t>5__29; private List<Animator>.Enumerator <>s__30; private Animator <anim>5__31; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PullAndKill>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <motor>5__1 = null; <rb>5__2 = null; <targetAnimators>5__7 = null; <allDisplays>5__8 = null; <victimAnimators>5__9 = null; <>s__11 = null; <display>5__13 = null; <animators>5__14 = null; <>s__15 = null; <anim>5__17 = null; <objName>5__18 = null; <source>5__19 = null; <>s__20 = null; <anim>5__22 = null; <objName>5__23 = null; <>s__30 = default(List<Animator>.Enumerator); <anim>5__31 = null; <>1__state = -2; } private bool MoveNext() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06af: Expected O, but got Unknown //IL_0802: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!Object.op_Implicit((Object)(object)victim)) { Debug.LogWarning((object)"[Mutator] No victim provided!"); return false; } <motor>5__1 = victim.characterMotor; <rb>5__2 = victim.rigidbody; <v>5__3 = 18f; Debug.Log((object)("[Mutator] Starting PullAndKill for victim: " + ((Object)victim).name)); <originalScale>5__4 = victim.transform.localScale; <shrinkStartDistance>5__5 = 10f; <playerPelvisPosition>5__6 = user.transform.position + new Vector3(0f, 0.5f, 0f); <targetAnimators>5__7 = new List<Animator>(); <allDisplays>5__8 = Object.FindObjectsOfType<ItemDisplay>(true); Debug.Log((object)("[Mutator] Found " + <allDisplays>5__8.Length + " ItemDisplays in the scene")); <>s__11 = <allDisplays>5__8; for (<>s__12 = 0; <>s__12 < <>s__11.Length; <>s__12++) { <display>5__13 = <>s__11[<>s__12]; <animators>5__14 = ((Component)<display>5__13).GetComponentsInChildren<Animator>(true); <>s__15 = <animators>5__14; for (<>s__16 = 0; <>s__16 < <>s__15.Length; <>s__16++) { <anim>5__17 = <>s__15[<>s__16]; if (!((Object)(object)<anim>5__17 == (Object)null)) { <objName>5__18 = ((Object)((Component)<anim>5__17).gameObject).name; if (<objName>5__18.Contains("Cock") || <objName>5__18.Contains("Condom")) { Debug.Log((object)("[Mutator] Found animator on " + <objName>5__18)); <anim>5__17.SetTrigger("Vore"); <targetAnimators>5__7.Add(<anim>5__17); <source>5__19 = ((Component)<anim>5__17).GetComponent<AudioSource>(); if ((Object)(object)<source>5__19 == (Object)null) { <source>5__19 = ((Component)<anim>5__17).GetComponentInChildren<AudioSource>(true); } if ((Object)(object)<source>5__19 == (Object)null) { <source>5__19 = ((Component)<display>5__13).GetComponentInChildren<AudioSource>(true); } if ((Object)(object)<source>5__19 != (Object)null) { Debug.Log((object)("[Mutator] Playing" + ((object)<source>5__19.clip).ToString() + "from " + ((Object)((Component)<source>5__19).gameObject).name)); <source>5__19.Play(); } else { Debug.LogWarning((object)("[Mutator] No AudioSource found near " + <objName>5__18)); } <source>5__19 = null; } <objName>5__18 = null; <anim>5__17 = null; } } <>s__15 = null; <animators>5__14 = null; <display>5__13 = null; } <>s__11 = null; <victimAnimators>5__9 = ((Component)victim).GetComponentsInChildren<Animator>(true); <>s__20 = <victimAnimators>5__9; for (<>s__21 = 0; <>s__21 < <>s__20.Length; <>s__21++) { <anim>5__22 = <>s__20[<>s__21]; if (!((Object)(object)<anim>5__22 == (Object)null)) { <objName>5__23 = ((Object)((Component)<anim>5__22).gameObject).name; if ((<objName>5__23.Contains("Cock") || <objName>5__23.Contains("Condom")) && !<targetAnimators>5__7.Contains(<anim>5__22)) { Debug.Log((object)("[Mutator] Found victim animator on " + <objName>5__23)); <anim>5__22.SetTrigger("Vore"); <targetAnimators>5__7.Add(<anim>5__22); } <objName>5__23 = null; <anim>5__22 = null; } } <>s__20 = null; <frameCount>5__10 = 0; break; case 1: <>1__state = -1; break; } if (Object.op_Implicit((Object)(object)victim) && Object.op_Implicit((Object)(object)victim.healthComponent) && victim.healthComponent.alive) { <frameCount>5__10++; <userPos>5__24 = user.corePosition; <vicPos>5__25 = victim.corePosition; <toUser>5__26 = <userPos>5__24 - <vicPos>5__25; <dist>5__27 = ((Vector3)(ref <toUser>5__26)).magnitude; Debug.Log((object)$"[Mutator] Frame {<frameCount>5__10}: Distance to player = {<dist>5__27:F2}"); if (<dist>5__27 <= <shrinkStartDistance>5__5) { <t>5__29 = Mathf.Clamp01(<dist>5__27 / <shrinkStartDistance>5__5); victim.transform.localScale = <originalScale>5__4 * <t>5__29; Debug.Log((object)$"[Mutator] Shrinking victim: scale = {victim.transform.localScale}"); } else { victim.transform.localScale = <originalScale>5__4; } <dir>5__28 = ((Vector3)(ref <toUser>5__26)).normalized; <v>5__3 = Mathf.Min(60f, <v>5__3 + 40f * Time.fixedDeltaTime); if ((Object)(object)<motor>5__1 != (Object)null) { CharacterMotor obj = <motor>5__1; obj.rootMotion += <dir>5__28 * <v>5__3 * Time.fixedDeltaTime; } else if ((Object)(object)<rb>5__2 != (Object)null) { <rb>5__2.MovePosition(Vector3.MoveTowards(<vicPos>5__25, <userPos>5__24, <v>5__3 * Time.fixedDeltaTime)); } else { victim.transform.position = Vector3.MoveTowards(<vicPos>5__25, <userPos>5__24, <v>5__3 * Time.fixedDeltaTime); } if (!(<dist>5__27 <= 4f)) { <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } Debug.Log((object)"[Mutator] Victim is very close to player, breaking pull loop"); } <>s__30 = <targetAnimators>5__7.GetEnumerator(); try { while (<>s__30.MoveNext()) { <anim>5__31 = <>s__30.Current; if ((Object)(object)<anim>5__31 != (Object)null) { <anim>5__31.ResetTrigger("Vore"); Debug.Log((object)("[Mutator] Reset Vore trigger on " + ((Object)((Component)<anim>5__31).gameObject).name)); } <anim>5__31 = null; } } finally { ((IDisposable)<>s__30).Dispose(); } <>s__30 = default(List<Animator>.Enumerator); if (Object.op_Implicit((Object)(object)victim) && Object.op_Implicit((Object)(object)victim.healthComponent) && victim.healthComponent.alive) { Debug.Log((object)"[Mutator] Killing victim"); victim.healthComponent.Suicide(((Component)user).gameObject, ((Component)user).gameObject, DamageTypeCombo.op_Implicit((DamageType)0)); } if (Object.op_Implicit((Object)(object)user) && Object.op_Implicit((Object)(object)user.healthComponent) && user.healthComponent.alive) { Debug.Log((object)"[Mutator] Applying digest buff to user"); user.AddTimedBuff(digestBuff, 17.25f); ((MonoBehaviour)slot).StartCoroutine(<>4__this.DigestionEndedAfter(user, 17.25f)); } Debug.Log((object)"[Mutator] PullAndKill finished"); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PluginAuthor = "YourName"; public const string PluginName = "MutatorEquipmentMod"; public const string PluginVersion = "1.0.0"; public const string PluginGUID = "YourName.MutatorEquipmentMod"; private static GameObject cockmasterPrefab; private static GameObject condomPrefab; private static Sprite cockicon; private static EquipmentDef equipDef; private static BuffDef digestBuff; private const float EquipCooldown = 30f; private const float DigestDuration = 17.25f; private const float PullSpeedBase = 18f; private const float PullSpeedMax = 60f; private const float TargetMaxDist = 80f; private const float TargetMaxAngle = 30f; private void Awake() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown LoadAllBundles(); Log.Init(((BaseUnityPlugin)this).Logger); CreateEquipment(); CreateBuff(); LanguageAPI.Add("MUTATOR_EQUIP_NAME", "Vorator"); LanguageAPI.Add("MUTATOR_EQUIP_PICKUP", "Force a foe down your urethra, and digest them in your balls for a strong buff"); LanguageAPI.Add("MUTATOR_EQUIP_DESC", "Aim at an enemy closeby, use the equipment and vore them into your cock. Then gain <style=cIsDamage>3× damage</style>, <style=cIsUtility>-30% move speed</style>, and <style=cIsHealing>75% damage reduction</style> for 15s."); LanguageAPI.Add("MUTATOR_EQUIP_LORE", "The throbbing parasite attaches to your crotch, rewriting your reproductive purpose to only consume and digest living organism, boosting your own"); LanguageAPI.Add("MUTATOR_DIGEST_NAME", "Digestion"); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(OnEquipUse); CharacterBody.RecalculateStats += new hook_RecalculateStats(OnRecalculateStats); HealthComponent.TakeDamage += new hook_TakeDamage(OnTakeDamage); CharacterBody.Start += new hook_Start(OnBodyStart); } private void LoadAllBundles() { try { string directoryName = Path.GetDirectoryName(typeof(MutatorEquipmentPlugin).Assembly.Location); string text = Path.Combine(directoryName, "assets"); if (!Directory.Exists(text)) { Debug.LogError((object)("[MutatorEquipment] Assets folder not found: " + text)); return; } string[] files = Directory.GetFiles(text, "*", SearchOption.AllDirectories); string[] array = files; foreach (string text2 in array) { Debug.LogWarning((object)("[MutatorEquipment] Attempting to load bundle: " + text2)); AssetBundle val = AssetBundle.LoadFromFile(text2); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("[MutatorEquipment] Failed to load AssetBundle at: " + text2)); continue; } string[] allAssetNames = val.GetAllAssetNames(); foreach (string text3 in allAssetNames) { Debug.LogWarning((object)("[MutatorEquipment] Asset found in " + Path.GetFileName(text2) + ": " + text3)); if (text3.EndsWith("cockmaster.prefab", StringComparison.OrdinalIgnoreCase)) { cockmasterPrefab = val.LoadAsset<GameObject>(text3); Debug.LogWarning((object)("[MutatorEquipment] Loaded cockmaster prefab from: " + text3)); EnsureItemDisplay(cockmasterPrefab); } if (text3.EndsWith("condomprop.prefab", StringComparison.OrdinalIgnoreCase)) { condomPrefab = val.LoadAsset<GameObject>(text3); Debug.LogWarning((object)"[MutatorEquipment] Loaded condomprop prefab!"); } if (text3.EndsWith("cockicon.png", StringComparison.OrdinalIgnoreCase)) { cockicon = val.LoadAsset<Sprite>(text3); Debug.LogWarning((object)"[MutatorEquipment] Loaded cockicon prefab!"); } } } if ((Object)(object)cockmasterPrefab == (Object)null) { Debug.LogError((object)"[MutatorEquipment] cockmaster prefab not found in any bundle! Falling back to crowbar."); cockmasterPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/PickupModels/PickupCrowbar"); EnsureItemDisplay(cockmasterPrefab); } } catch (Exception arg) { Debug.LogError((object)$"[MutatorEquipment] Error loading bundles: {arg}"); } } private void CreateEquipment() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown equipDef = ScriptableObject.CreateInstance<EquipmentDef>(); ((Object)equipDef).name = "MUTATOR_EQUIP"; equipDef.nameToken = "MUTATOR_EQUIP_NAME"; equipDef.pickupToken = "MUTATOR_EQUIP_PICKUP"; equipDef.descriptionToken = "MUTATOR_EQUIP_DESC"; equipDef.loreToken = "MUTATOR_EQUIP_LORE"; equipDef.cooldown = 30f; equipDef.appearsInSinglePlayer = true; equipDef.appearsInMultiPlayer = true; equipDef.canDrop = true; equipDef.enigmaCompatible = true; GameObject val = cockmasterPrefab; Sprite pickupIconSprite = cockicon; equipDef.pickupModelPrefab = val; equipDef.pickupIconSprite = pickupIconSprite; GameObject val2 = (Object.op_Implicit((Object)(object)cockmasterPrefab) ? cockmasterPrefab : val); DisplayUtils.EnsureCockMasterDisplay(val2); ItemDisplayRuleDict val3 = new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>()); string[] array = new string[14] { "mdlCommandoDualies", "mdlHuntress", "mdlToolbot", "mdlEngi", "mdlMage", "mdlMerc", "mdlTreebot", "mdlLoader", "mdlCroco", "mdlCaptain", "mdlBandit2", "mdlRailGunner", "mdlVoidSurvivor", "mdlHeretic" }; Vector3 zero = Vector3.zero; Vector3 zero2 = Vector3.zero; Vector3 one = Vector3.one; string[] array2 = array; foreach (string text in array2) { val3.Add(text, (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, followerPrefab = val2, childName = "Pelvis", localPos = zero, localAngles = zero2, localScale = one } }); } ItemAPI.Add(new CustomEquipment(equipDef, val3)); } private static void EnsureItemDisplay(GameObject prefab) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)prefab)) { ItemDisplay val = prefab.GetComponent<ItemDisplay>(); if (!Object.op_Implicit((Object)(object)val)) { val = prefab.AddComponent<ItemDisplay>(); } Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(); RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = new RendererInfo { renderer = componentsInChildren[i], defaultMaterial = componentsInChildren[i].sharedMaterial, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; } val.rendererInfos = array; } } private void CreateBuff() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) digestBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)digestBuff).name = "MUTATOR_DIGEST"; digestBuff.buffColor = Color.green; digestBuff.canStack = false; digestBuff.isDebuff = false; digestBuff.isCooldown = false; digestBuff.isHidden = false; digestBuff.iconSprite = LegacyResourcesAPI.Load<Sprite>("Textures/BuffIcons/texBuffGenericShield"); ContentAddition.AddBuffDef(digestBuff); } private void OnBodyStart(orig_Start orig, CharacterBody self) { orig.Invoke(self); if (self.isPlayerControlled && !Object.op_Implicit((Object)(object)((Component)self).GetComponent<MutatorTargetingController>())) { ((Component)self).gameObject.AddComponent<MutatorTargetingController>(); } } private bool OnEquipUse(orig_PerformEquipmentAction orig, EquipmentSlot slot, EquipmentDef usedDef) { if ((Object)(object)usedDef != (Object)(object)equipDef) { return orig.Invoke(slot, usedDef); } CharacterBody characterBody = slot.characterBody; if (!Object.op_Implicit((Object)(object)characterBody) || !Object.op_Implicit((Object)(object)characterBody.healthComponent) || !characterBody.healthComponent.alive) { return false; } HurtBox val = MutatorTargetingController.FindTarget(characterBody, 80f, 30f); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.healthComponent) || !val.healthComponent.alive) { Log.Info("Mutator: no valid target."); return false; } ((MonoBehaviour)slot).StartCoroutine(PullAndKill(slot, characterBody, val.healthComponent.body)); return true; } [IteratorStateMachine(typeof(<PullAndKill>d__23))] private IEnumerator PullAndKill(EquipmentSlot slot, CharacterBody user, CharacterBody victim) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PullAndKill>d__23(0) { <>4__this = this, slot = slot, user = user, victim = victim }; } [IteratorStateMachine(typeof(<DigestionEndedAfter>d__24))] private IEnumerator DigestionEndedAfter(CharacterBody body, float seconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DigestionEndedAfter>d__24(0) { <>4__this = this, body = body, seconds = seconds }; } private void SpawnCndm(CharacterBody body) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { Log.Error("[MutatorEquipment] Tried to spawn condom but body was null!"); return; } if ((Object)(object)condomPrefab == (Object)null) { Debug.LogError((object)"[MutatorEquipment] condomprop prefab not loaded!"); return; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(body.footPosition.x, body.footPosition.y + 1f, body.footPosition.z); GameObject val2 = Object.Instantiate<GameObject>(condomPrefab, val, Quaternion.Euler(-90f, 0f, 0f)); Log.Info("[MutatorEquipment] Spawned condom object at player feet."); Object.Destroy((Object)(object)val2, 25f); } private void OnRecalculateStats(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (self.HasBuff(digestBuff)) { self.damage *= 3f; self.moveSpeed *= 0.7f; self.regen += 25f; } } private void OnTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo info) { try { if (Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(digestBuff)) { info.damage *= 0.25f; } } catch { } orig.Invoke(self, info); } public static HurtBox FindTarget(CharacterBody source, float maxDist, float maxAngle) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)source) || !Object.op_Implicit((Object)(object)source.inputBank) || !Object.op_Implicit((Object)(object)source.teamComponent)) { return null; } BullseyeSearch val = new BullseyeSearch { teamMaskFilter = TeamMask.GetEnemyTeams(source.teamComponent.teamIndex), filterByLoS = true, searchOrigin = source.inputBank.aimOrigin, searchDirection = source.inputBank.aimDirection, maxDistanceFilter = maxDist, maxAngleFilter = maxAngle, sortMode = (SortMode)1 }; val.RefreshCandidates(); return val.GetResults().FirstOrDefault(); } } } namespace ExamplePlugin { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } }