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 Claw v1.0.0
Pince.dll
Decompiled 37 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using REPOLib.Modules; using REPOLib.Objects.Sdk; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Localization; using UnityEngine.Localization.Settings; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public string AssemblyName { get; } public IgnoresAccessChecksToAttribute(string assemblyName) { AssemblyName = assemblyName; } } } namespace Pince { internal static class Lang { internal static readonly string[] Codes = new string[21] { "en", "fr", "de", "es", "es-419", "it", "pt", "pt-BR", "ru", "uk", "pl", "tr", "ja", "ko", "zh-Hans", "zh-Hant", "ar", "da", "fi", "sv", "th" }; internal static ConfigEntry<string> Cfg; private static string code = "en"; private static float codeAt = -99f; private static float nextTick; internal static readonly Dictionary<string, string> NameTable = new Dictionary<string, string> { { "en", "Claw" }, { "fr", "Pince" }, { "de", "Greifarm" }, { "es", "Garra" }, { "es-419", "Garra" }, { "it", "Artiglio" }, { "pt", "Garra" }, { "pt-BR", "Garra" }, { "ru", "Клешня" }, { "uk", "Клішня" }, { "pl", "Chwytak" }, { "tr", "Kıskaç" }, { "ja", "クレーン" }, { "ko", "집게" }, { "zh-Hans", "铁爪" }, { "zh-Hant", "鐵爪" }, { "ar", "المخلب" }, { "da", "Griber" }, { "fi", "Kahmari" }, { "sv", "Gripklo" }, { "th", "ก\u0e49ามค\u0e35บ" } }; internal const bool HasMessages = false; internal static string Code { get { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (Time.unscaledTime - codeAt < 1f) { return code; } codeAt = Time.unscaledTime; string text = ((Cfg != null) ? Cfg.Value : "Auto"); if (string.IsNullOrEmpty(text) || text.Trim().Equals("Auto", StringComparison.OrdinalIgnoreCase)) { text = "en"; try { Locale selectedLocale = LocalizationSettings.SelectedLocale; if ((Object)(object)selectedLocale != (Object)null) { LocaleIdentifier identifier = selectedLocale.Identifier; text = ((LocaleIdentifier)(ref identifier)).Code; } } catch (Exception) { } } code = Normalize(text); return code; } } internal static string Name => Pick(NameTable); internal static void Bind(ConfigFile config) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown List<string> list = new List<string> { "Auto" }; list.AddRange(Codes); Cfg = config.Bind<string>("Language", "Language", "Auto", new ConfigDescription("Language of this monster's in-game texts (its name when grabbed). Auto = the game's language (English if the game's language is not one of these).", (AcceptableValueBase)(object)new AcceptableValueList<string>(list.ToArray()), Array.Empty<object>())); } internal static void Tick() { if (Time.unscaledTime < nextTick) { return; } nextTick = Time.unscaledTime + 1f; try { string name = Name; if (Object.op_Implicit((Object)(object)Plugin.Prefab)) { EnemyParent componentInChildren = Plugin.Prefab.GetComponentInChildren<EnemyParent>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.enemyName = name; } } foreach (PinceAI item in PinceAI.All) { if (Object.op_Implicit((Object)(object)item)) { EnemyParent componentInParent = ((Component)item).GetComponentInParent<EnemyParent>(true); if (Object.op_Implicit((Object)(object)componentInParent) && componentInParent.enemyName != name) { componentInParent.enemyName = name; } } } } catch (Exception) { } } internal static string Normalize(string c) { c = (c ?? "en").Trim().Replace('_', '-').ToLowerInvariant(); if (c.StartsWith("zh")) { if (!c.Contains("hant") && !c.Contains("tw") && !c.Contains("hk") && !c.Contains("mo")) { return "zh-Hans"; } return "zh-Hant"; } if (c.StartsWith("es")) { if (!(c == "es") && !(c == "es-es")) { return "es-419"; } return "es"; } if (c.StartsWith("pt")) { if (!(c == "pt-br")) { return "pt"; } return "pt-BR"; } string text = ((c.Length >= 2) ? c.Substring(0, 2) : c); if (Array.IndexOf(Codes, text) < 0) { return "en"; } return text; } internal static string Pick(Dictionary<string, string> t) { if (!t.TryGetValue(Code, out var value) || string.IsNullOrEmpty(value)) { return t["en"]; } return value; } } internal static class ModelLayout { public static readonly string[] Parts = new string[8] { "carriage", "cable", "head", "prong0", "prong1", "prong2", "rail", "chute" }; public static readonly string[] Parents = new string[8] { "", "carriage", "carriage", "head", "head", "head", "", "" }; public static readonly Vector3[] Pivots = (Vector3[])(object)new Vector3[8] { new Vector3(0f, 0f, 0f), new Vector3(0f, -0.14f, 0f), new Vector3(0f, -0.49f, 0f), new Vector3(0f, -0.61f, 0.074f), new Vector3(0.06409f, -0.61f, -0.037f), new Vector3(-0.06409f, -0.61f, -0.037f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f) }; public static readonly string[] Detached = new string[2] { "rail", "chute" }; public const float RailY = 0.445f; public const float CeilingY = 0.535f; public const float CableTopY = -0.14f; public const float HeadRestY = -0.49f; public const float ProngY = -0.61f; } public class PinceAI : MonoBehaviour { public enum State { Spawn, Patrol, Approach, Lock, Descend, Lift, Carry, Return, Disabled, Stunned } private const float RestCable = 0.35f; private const float GrabOffset = 0.42f; private const float MinHeight = 1.6f; private const float MaxHeight = 6f; private const float NoCeiling = 2.9f; private Enemy enemy; private PhotonView photonView; private EnemyHealth health; private EnemyRigidbody erb; private Transform follow; private Transform visuals; private Transform model; private Transform carriage; private Transform cable; private Transform head; private Transform particles; private readonly Transform[] prongs = (Transform[])(object)new Transform[3]; private readonly List<(Renderer r, int sub, int mat)> glow = new List<(Renderer, int, int)>(); private MaterialPropertyBlock mpb; private Light spot; private AudioSource musicSrc; private Sound music; private int ceilMask; private int losMask; private bool ready; public State state; private bool stateImpulse = true; private float stateTimer; private float stateTime; private PlayerAvatar victim; private PhysGrabObject prize; private Vector3 descendPoint; private float descendDepth = 1f; private float heightGate = 1f; private float rescueTimer; private float embeddedTime; private float height = 2.2f; private float cooldownUntil; private float scanTimer; private float pathTimer; private float tug; private float grabY; private float slipLift; private float losLostTime; private bool fakeGrab; private bool holding; private Vector3 dest; private Vector3 patrolPoint; private PlayerAvatar dropped; private float droppedTime; private int droppedDamage; private static Vector3 chutePos; private static bool hasChute; private static LevelGenerator chuteLevel; private float cableLen = 0.35f; private float openDeg = 18f; private float bodySpeed; private float flash; private int beeps; private Vector3 lastPos; private Vector3 swing; private GameObject chuteGo; private Transform railRoot; private Vector3 railLast; private bool railStarted; private int railCount; private readonly HashSet<Vector3Int> railCells = new HashSet<Vector3Int>(); internal static float SkipTeleportUntil; internal static readonly List<PinceAI> All = new List<PinceAI>(); private static bool MP => GameManager.Multiplayer(); private static bool Master => SemiFunc.IsMasterClientOrSingleplayer(); internal static PinceAI Existing() { All.RemoveAll((PinceAI a) => (Object)(object)a == (Object)null); if (All.Count <= 0) { return null; } return All[0]; } private void Awake() { //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Expected O, but got Unknown //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Expected O, but got Unknown //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Expected O, but got Unknown enemy = ((Component)this).GetComponent<Enemy>(); photonView = ((Component)this).GetComponent<PhotonView>(); health = ((Component)this).GetComponent<EnemyHealth>(); Transform parent = ((Component)this).transform.parent; erb = ((Component)parent.Find("Rigidbody")).GetComponent<EnemyRigidbody>(); follow = (Object.op_Implicit((Object)(object)erb) ? erb.followTarget : null); visuals = parent.Find("Visuals"); model = (Object.op_Implicit((Object)(object)visuals) ? visuals.Find("PinceModel") : null); particles = parent.parent.Find("Particles"); if (Object.op_Implicit((Object)(object)model)) { carriage = model.Find("carriage"); cable = (Object.op_Implicit((Object)(object)carriage) ? carriage.Find("cable") : null); head = (Object.op_Implicit((Object)(object)carriage) ? carriage.Find("head") : null); for (int i = 0; i < 3; i++) { prongs[i] = (Object.op_Implicit((Object)(object)head) ? head.Find("prong" + i) : null); } spot = ((Component)model).GetComponentInChildren<Light>(true); Transform val = model.Find("Pince Music"); musicSrc = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<AudioSource>() : null); MeshRenderer[] componentsInChildren = ((Component)model).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val2 in componentsInChildren) { Material[] sharedMaterials = ((Renderer)val2).sharedMaterials; for (int k = 0; k < sharedMaterials.Length; k++) { int num = Array.IndexOf(PrefabBuilder.Materials, sharedMaterials[k]); if (num == 2 || num == 3 || num == 4) { glow.Add(((Renderer)(object)val2, k, num)); } } } } mpb = new MaterialPropertyBlock(); EnemyStateSpawn component = ((Component)this).GetComponent<EnemyStateSpawn>(); if (Object.op_Implicit((Object)(object)component)) { component.OnSpawn.AddListener(new UnityAction(OnSpawn)); } if (Object.op_Implicit((Object)(object)health)) { health.onHurt.AddListener(new UnityAction(OnHurt)); health.onDeath.AddListener(new UnityAction(OnDeath)); } int num2 = 1 << ((Component)erb).gameObject.layer; Collider[] componentsInChildren2 = ((Component)erb).GetComponentsInChildren<Collider>(true); foreach (Collider val3 in componentsInChildren2) { num2 |= 1 << ((Component)val3).gameObject.layer; } int mask = LayerMask.GetMask(new string[7] { "Player", "PhysGrabObject", "PhysGrabObjectCart", "PhysGrabObjectHinge", "Enemy", "Ragdoll", "Triggers" }); ceilMask = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) & ~num2 & ~mask; losMask = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) & ~num2 & ~LayerMask.GetMask(new string[3] { "Player", "PhysGrabObject", "Enemy" }); ready = Object.op_Implicit((Object)(object)follow) && Object.op_Implicit((Object)(object)model) && Object.op_Implicit((Object)(object)carriage) && Object.op_Implicit((Object)(object)cable) && Object.op_Implicit((Object)(object)head) && Object.op_Implicit((Object)(object)prongs[2]); if (!ready) { Plugin.Log.LogError((object)"PinceAI: hierarchy incomplete, behaviour disabled."); } if (Sounds.Music != null && Object.op_Implicit((Object)(object)musicSrc)) { music = new Sound { Sounds = Sounds.Music.Sounds, Type = (AudioType)0, Volume = 0.45f, VolumeRandom = 0f, Pitch = 1f, PitchRandom = 0f, SpatialBlend = 1f, Doppler = 0f, ReverbMix = 1f, FalloffMultiplier = 1f, OffscreenVolume = 1f, OffscreenFalloff = 1f, LowPassIgnoreColliders = new List<Collider>(), Source = musicSrc }; } All.Add(this); } private void Start() { if (Object.op_Implicit((Object)(object)musicSrc) && Object.op_Implicit((Object)(object)AudioManager.instance)) { musicSrc.outputAudioMixerGroup = AudioManager.instance.SoundMasterGroup; } } private void OnDestroy() { All.Remove(this); if (Object.op_Implicit((Object)(object)chuteGo)) { Object.Destroy((Object)(object)chuteGo); } if (Object.op_Implicit((Object)(object)railRoot)) { Object.Destroy((Object)(object)((Component)railRoot).gameObject); } } private void OnEnable() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)erb)) { lastPos = ((Component)erb).transform.position; } railStarted = false; } private void Update() { if (ready) { if (Master) { MasterLogic(Time.deltaTime); } if (Object.op_Implicit((Object)(object)victim) && victim.isLocal && (state == State.Lift || state == State.Carry) && Object.op_Implicit((Object)(object)victim.physGrabber)) { victim.physGrabber.OverrideDisableSpecialGrabPowers(1f); } MusicTick(); } } private void LateUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (ready) { visuals.position = ((Component)erb).transform.position; visuals.rotation = Quaternion.Euler(0f, ((Component)erb).transform.eulerAngles.y, 0f); Animate(Time.deltaTime); Rails(); } } private void FixedUpdate() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) if (!ready || !Master || !holding) { return; } Vector3 val = HeadTarget() + Vector3.down * 0.42f; if (Object.op_Implicit((Object)(object)victim)) { PlayerTumble tumble = victim.tumble; if (Object.op_Implicit((Object)(object)tumble)) { if (!tumble.isTumbling) { tumble.TumbleRequest(true, false); } tumble.TumbleOverrideTime(1f); victim.FallDamageResetSet(0.1f); tumble.physGrabObject.OverrideMass(1f, 0.1f); tumble.physGrabObject.OverrideAngularDrag(2f, 0.1f); tumble.physGrabObject.OverrideDrag(1f, 0.1f); tumble.OverrideEnemyHurt(0.1f); float num = ((tumble.physGrabObject.playerGrabbing.Count > 0) ? 0.5f : 1f); Vector3 val2 = SemiFunc.PhysFollowPosition(((Component)tumble).transform.position, val, tumble.rb.linearVelocity, 10f * num); tumble.rb.AddForce(val2 * (10f * Time.fixedDeltaTime * num), (ForceMode)1); } } else if (Object.op_Implicit((Object)(object)prize) && Object.op_Implicit((Object)(object)prize.rb)) { prize.OverrideZeroGravity(0.1f); prize.OverrideDrag(1f, 0.1f); prize.OverrideAngularDrag(2f, 0.1f); float num2 = ((prize.playerGrabbing.Count > 0) ? 0.5f : 1f); Vector3 val3 = SemiFunc.PhysFollowPosition(prize.midPoint, val, prize.rb.linearVelocity, 10f * num2); prize.rb.AddForce(val3 * (10f * Time.fixedDeltaTime * num2), (ForceMode)2); } } private void MasterLogic(float dt) { //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) stateTime += dt; HeightTick(dt); LandingTick(); if (enemy.IsStunned() && state != State.Stunned && state != State.Disabled) { Release(allowDamage: true); SetState(State.Stunned); } if (holding && !HeldValid()) { Release(allowDamage: false); SetState(State.Return); } Face(dt); Vector3 val; switch (state) { case State.Spawn: if (stateImpulse) { stateImpulse = false; stateTimer = 1.2f; } Halt(); if ((stateTimer -= dt) <= 0f) { SetState(State.Patrol); } break; case State.Patrol: if (stateImpulse) { stateImpulse = false; stateTimer = 25f; patrolPoint = PickPatrolPoint(); } GoTo(patrolPoint, dt, 1f); if (!((stateTimer -= dt) <= 0f)) { val = Flat(patrolPoint - ((Component)this).transform.position); if (!(((Vector3)(ref val)).magnitude < 1.5f)) { goto IL_0179; } } stateTimer = 25f; patrolPoint = PickPatrolPoint(); goto IL_0179; case State.Approach: if (stateImpulse) { stateImpulse = false; stateTimer = 12f; losLostTime = 0f; } if (TargetValid() && !((stateTimer -= dt) <= 0f)) { val = Flat(TargetCenter() - ((Component)erb).transform.position); if (!(((Vector3)(ref val)).magnitude > Plugin.CfgTargetRange.Value * 1.6f)) { if (!Visible(TargetCenter())) { if ((losLostTime += dt) > 3f) { ClearTarget(); cooldownUntil = Time.time + 2f; SetState(State.Patrol); break; } } else { losLostTime = 0f; } GoTo(TargetCenter(), dt, 1f); val = Flat(TargetCenter() - ((Component)erb).transform.position); if (((Vector3)(ref val)).magnitude < 0.6f) { SetState(State.Lock); } break; } } ClearTarget(); cooldownUntil = Time.time + 2f; SetState(State.Patrol); break; case State.Lock: if (stateImpulse) { stateImpulse = false; stateTimer = Plugin.CfgLockTime.Value; } if (!TargetValid()) { ClearTarget(); SetState(State.Patrol); break; } GoTo(TargetCenter(), dt, 1f); if ((stateTimer -= dt) <= 0f) { descendPoint = TargetCenter(); float num2 = FloorY(descendPoint, 3f); float num3 = Mathf.Max(descendPoint.y, num2 + 0.55f); descendDepth = Mathf.Clamp(CableTop().y - (num3 + 0.42f), 0.35f, 14f); Halt(); SetState(State.Descend); } break; case State.Descend: if (stateImpulse) { stateImpulse = false; stateTimer = descendDepth / Plugin.CfgDescendSpeed.Value + 0.6f; } Halt(); if (cableLen >= descendDepth - 0.03f || (stateTimer -= dt) <= 0f) { TryGrab(); } break; case State.Lift: if (stateImpulse) { stateImpulse = false; stateTimer = 8f; } Halt(); if (fakeGrab && HeldCenter().y > grabY + slipLift) { Plugin.Log.LogInfo((object)"[Pince] The catch slips out (arcade miss)."); Release(allowDamage: true); Event(1); cooldownUntil = Time.time + Plugin.CfgCooldown.Value * 0.5f; SetState(State.Return); } else if (!TugTick(dt) && (cableLen <= CarryDepth() + 0.05f || (stateTimer -= dt) <= 0f)) { SetState(State.Carry); } break; case State.Carry: if (stateImpulse) { stateImpulse = false; stateTimer = 18f; } if (!TugTick(dt)) { int num = Grabbers(); GoTo(dest, dt, Mathf.Max(0.15f, 1f - Plugin.CfgTugSlowdown.Value * (float)num)); val = Flat(dest - ((Component)erb).transform.position); if (((Vector3)(ref val)).magnitude < 1f || (stateTimer -= dt) <= 0f) { Plugin.Log.LogInfo((object)"[Pince] Prize delivered."); Release(allowDamage: true); Event(2); SetState(State.Return); } } break; case State.Return: if (stateImpulse) { stateImpulse = false; stateTimer = 1.5f; } Halt(); if ((stateTimer -= dt) <= 0f && cableLen <= 0.4f) { SetState(State.Patrol); } break; case State.Disabled: if (stateImpulse) { stateImpulse = false; stateTimer = Plugin.CfgDisableTime.Value; } Halt(); if ((stateTimer -= dt) <= 0f) { cooldownUntil = Time.time + 2f; SetState(State.Return); } break; case State.Stunned: { if (stateImpulse) { stateImpulse = false; } Halt(); if (!enemy.IsStunned()) { SetState(State.Return); } break; } IL_0179: if (Time.time >= cooldownUntil && (scanTimer -= dt) <= 0f) { scanTimer = 0.4f; if (PickTarget()) { SetState(State.Approach); } } break; } } private void HeightTick(float dt) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0051: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0152: 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) //IL_0080: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; float num = CeilingAt(position); float num2 = num; Vector3 agentVelocity = enemy.NavMeshAgent.AgentVelocity; agentVelocity.y = 0f; if (((Vector3)(ref agentVelocity)).sqrMagnitude > 0.01f) { Vector3 normalized = ((Vector3)(ref agentVelocity)).normalized; float num3 = 2.4f; NavMeshHit val = default(NavMeshHit); if (NavMesh.Raycast(position, position + normalized * num3, ref val, -1)) { num3 = ((NavMeshHit)(ref val)).distance; } for (float num4 = 0.6f; num4 <= num3 + 0.01f; num4 += 0.6f) { num2 = Mathf.Min(num2, CeilingAt(position + normalized * num4)); } } float num5 = Mathf.Clamp(num - 0.535f - 0.04f, 1.6f, 6f); float num6 = Mathf.Clamp(num2 - 0.535f - 0.04f, 1.6f, 6f); float num7 = Mathf.Min(num5, num6); height = Mathf.MoveTowards(height, num7, ((num7 < height) ? 6f : 1.5f) * dt); follow.localPosition = new Vector3(0f, height, 0f); float num8 = ((Component)erb).transform.position.y - position.y; heightGate = ((num8 > num6 + 0.3f) ? 0.05f : 1f); if ((rescueTimer -= dt) > 0f) { return; } rescueTimer = 0.2f; Vector3 val2 = ((Component)erb).transform.position + Vector3.up * 0.535f; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(val2.x, position.y + 0.3f, val2.z); bool flag = false; float num9 = height; bool queriesHitBackfaces = Physics.queriesHitBackfaces; Physics.queriesHitBackfaces = true; try { RaycastHit val4 = default(RaycastHit); if (val2.y > val3.y && Physics.Linecast(val3, val2, ref val4, ceilMask, (QueryTriggerInteraction)1)) { flag = true; num9 = ((RaycastHit)(ref val4)).point.y - position.y - 0.535f - 0.1f; } } finally { Physics.queriesHitBackfaces = queriesHitBackfaces; } if (!flag && Physics.CheckSphere(((Component)erb).transform.position, 0.14f, ceilMask, (QueryTriggerInteraction)1)) { if ((embeddedTime += 0.2f) >= 0.6f) { flag = true; num9 = Mathf.Min(height, num8) - 0.4f; } } else { embeddedTime = 0f; } if (flag) { embeddedTime = 0f; num9 = Mathf.Clamp(num9, 1.6f, 6f); if (!(num8 - num9 < 0.2f)) { height = num9; follow.localPosition = new Vector3(0f, height, 0f); erb.Teleport(); Plugin.Log.LogWarning((object)$"[Pince] Body was inside/above a ceiling: put back at {height:0.00} m above its floor."); } } } private float CeilingAt(Vector3 p) { //IL_000c: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) bool queriesHitBackfaces = Physics.queriesHitBackfaces; Physics.queriesHitBackfaces = true; try { RaycastHit val = default(RaycastHit); if (Physics.Raycast(p + Vector3.up * 0.6f, Vector3.up, ref val, 10f, ceilMask, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point.y - p.y; } } finally { Physics.queriesHitBackfaces = queriesHitBackfaces; } return 2.9f; } private float FloorY(Vector3 p, float max) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(p + Vector3.up * 0.1f, Vector3.down, ref val, max + 20f, ceilMask, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point.y; } return p.y - max; } private void GoTo(Vector3 p, float dt, float speedFactor) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if ((pathTimer -= dt) <= 0f) { pathTimer = 0.3f; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(new Vector3(p.x, ((Component)this).transform.position.y, p.z), ref val, 2.5f, -1)) { p = ((NavMeshHit)(ref val)).position; } enemy.NavMeshAgent.SetDestination(p); } float num = Plugin.CfgRailSpeed.Value * speedFactor * heightGate; enemy.NavMeshAgent.OverrideAgent(num, Plugin.CfgRailSpeed.Value * 3f, 0.4f); } private void Halt() { enemy.NavMeshAgent.Stop(0.2f); } private void Face(float dt) { //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_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_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_0085: Unknown result type (might be due to invalid IL or missing references) if (state != State.Disabled && state != State.Stunned && state != State.Descend && state != State.Spawn) { Vector3 agentVelocity = enemy.NavMeshAgent.AgentVelocity; agentVelocity.y = 0f; if (!(((Vector3)(ref agentVelocity)).sqrMagnitude < 0.04f)) { ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(((Vector3)(ref agentVelocity)).normalized, Vector3.up), 1f - Mathf.Exp(-4f * dt)); } } } private Vector3 PickPatrolPoint() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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) //IL_0086: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) List<LevelPoint> list = (Object.op_Implicit((Object)(object)LevelGenerator.Instance) ? LevelGenerator.Instance.LevelPathPoints : null); if (list == null || list.Count == 0) { return ((Component)this).transform.position; } Vector3 result = ((Component)this).transform.position; float num = float.MinValue; for (int i = 0; i < 10; i++) { LevelPoint val = list[Random.Range(0, list.Count)]; if (!Object.op_Implicit((Object)(object)val) || val.Truck) { continue; } Vector3 position = ((Component)val).transform.position; float num2 = Vector3.Distance(position, ((Component)this).transform.position); if (!(num2 < 6f)) { float num3 = Mathf.Min(CeilingAt(position), 6f) + Random.Range(0f, 1.5f) - ((num2 > 45f) ? 3f : 0f); if (num3 > num) { num = num3; result = position; } } } return result; } private bool PickTarget() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_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_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)erb).transform.position; float value = Plugin.CfgTargetRange.Value; PlayerAvatar val = null; float num = float.MaxValue; Vector3 val3; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (ValidPlayer(item)) { Vector3 val2 = ((Component)item).transform.position + Vector3.up * 0.9f; val3 = Flat(val2 - position); float magnitude = ((Vector3)(ref val3)).magnitude; if (!(magnitude > value) && !(val2.y > position.y - 0.3f) && !(magnitude >= num) && Visible(val2)) { num = magnitude; val = item; } } } PhysGrabObject val4 = null; float num2 = 0f; if (Object.op_Implicit((Object)(object)ValuableDirector.instance) && ValuableDirector.instance.valuableList != null) { foreach (ValuableObject valuable in ValuableDirector.instance.valuableList) { if (!Object.op_Implicit((Object)(object)valuable) || !((Component)valuable).gameObject.activeInHierarchy || !Object.op_Implicit((Object)(object)valuable.physGrabObject) || !Object.op_Implicit((Object)(object)valuable.physGrabObject.rb)) { continue; } PhysGrabObject physGrabObject = valuable.physGrabObject; Vector3 midPoint = physGrabObject.midPoint; val3 = Flat(midPoint - position); if (!(((Vector3)(ref val3)).magnitude > value) && !(midPoint.y > position.y - 0.5f)) { float mass = physGrabObject.rb.mass; if (!(mass <= num2) && Visible(midPoint)) { num2 = mass; val4 = physGrabObject; } } } } if (!Object.op_Implicit((Object)(object)val) && !Object.op_Implicit((Object)(object)val4)) { return false; } bool flag = Object.op_Implicit((Object)(object)val) && (!Object.op_Implicit((Object)(object)val4) || Random.Range(0, 100) < Plugin.CfgPlayerPreference.Value); victim = (flag ? val : null); prize = (flag ? null : val4); Plugin.Log.LogInfo((object)("[Pince] Target: " + (Object.op_Implicit((Object)(object)victim) ? ("player " + victim.playerName) : ("valuable " + ((Object)prize).name + $" ({num2:0.0} kg)")))); return true; } private static bool ClearLine(Vector3 a, Vector3 b, int mask) { //IL_000c: 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) bool queriesHitBackfaces = Physics.queriesHitBackfaces; Physics.queriesHitBackfaces = true; try { return !Physics.Linecast(a, b, mask, (QueryTriggerInteraction)1); } finally { Physics.queriesHitBackfaces = queriesHitBackfaces; } } private bool Visible(Vector3 p) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) return ClearLine(((Component)erb).transform.position + Vector3.down * 0.25f, p, losMask); } private bool TargetValid() { if (!Object.op_Implicit((Object)(object)victim)) { if ((Object)(object)prize != (Object)null) { return ((Component)prize).gameObject.activeInHierarchy; } return false; } return ValidPlayer(victim); } private Vector3 TargetCenter() { //IL_0090: 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_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_004b: 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_0066: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)victim)) { if (!Object.op_Implicit((Object)(object)victim.tumble) || !victim.tumble.isTumbling) { return ((Component)victim).transform.position + Vector3.up * 0.9f; } return ((Component)victim.tumble).transform.position; } if (!Object.op_Implicit((Object)(object)prize)) { return ((Component)erb).transform.position; } return prize.midPoint; } private Vector3 HeldCenter() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return TargetCenter(); } private void ClearTarget() { victim = null; prize = null; holding = false; SyncState(); } private bool HeldValid() { if (!Object.op_Implicit((Object)(object)victim)) { if ((Object)(object)prize != (Object)null) { return ((Component)prize).gameObject.activeInHierarchy; } return false; } if (ValidPlayer(victim)) { return Object.op_Implicit((Object)(object)victim.tumble); } return false; } private int Grabbers() { if (Object.op_Implicit((Object)(object)victim) && Object.op_Implicit((Object)(object)victim.tumble)) { return victim.tumble.physGrabObject.playerGrabbing.Count; } if (!Object.op_Implicit((Object)(object)prize)) { return 0; } return prize.playerGrabbing.Count; } private void TryGrab() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0025: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) Vector3 val = HeadTarget() + Vector3.down * 0.42f; if (!TargetValid() || !(Vector3.Distance(val, TargetCenter()) < (Object.op_Implicit((Object)(object)victim) ? 0.9f : 0.8f))) { Plugin.Log.LogInfo((object)"[Pince] Whiff: the target moved away."); ClearTarget(); Event(1); cooldownUntil = Time.time + 3f; SetState(State.Return); } else { holding = true; tug = 0f; fakeGrab = Random.Range(0, 100) < Plugin.CfgMissChance.Value; grabY = TargetCenter().y; slipLift = Random.Range(1f, 1.5f); dest = PickDestination(); Plugin.Log.LogInfo((object)string.Format("[Pince] Caught {0}{1}, destination {2}.", Object.op_Implicit((Object)(object)victim) ? victim.playerName : ((Object)prize).name, fakeGrab ? " (will slip)" : "", dest)); SetState(State.Lift); } } private Vector3 PickDestination() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)erb).transform.position; float num = Plugin.CfgMonsterRange.Value; Enemy val = null; Vector3 val2; if ((Object)(object)EnemyDirector.instance != (Object)null) { foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned) { if (Object.op_Implicit((Object)(object)item) && item.Spawned && Object.op_Implicit((Object)(object)item.Enemy) && !((Object)(object)item.Enemy == (Object)(object)enemy) && !Object.op_Implicit((Object)(object)((Component)item).GetComponentInChildren<PinceAI>()) && (!Object.op_Implicit((Object)(object)item.Enemy.Health) || !item.Enemy.Health.dead)) { val2 = Flat((Object.op_Implicit((Object)(object)item.Enemy.CenterTransform) ? item.Enemy.CenterTransform : ((Component)item.Enemy).transform).position - position); float magnitude = ((Vector3)(ref val2)).magnitude; if (!(magnitude < 3f) && !(magnitude >= num)) { num = magnitude; val = item.Enemy; } } } } if (Object.op_Implicit((Object)(object)val)) { Vector3 val3 = (Object.op_Implicit((Object)(object)val.CenterTransform) ? val.CenterTransform.position : ((Component)val).transform.position); val2 = Flat(position - val3); Vector3 val4 = val3 + ((Vector3)(ref val2)).normalized * 1.5f; Plugin.Log.LogInfo((object)("[Pince] Taking it to " + val.EnemyParent.enemyName)); NavMeshHit val5 = default(NavMeshHit); if (!NavMesh.SamplePosition(val4, ref val5, 3f, -1)) { return val3; } return ((NavMeshHit)(ref val5)).position; } if (!hasChute) { return ((Component)this).transform.position; } return chutePos; } private bool TugTick(float dt) { if (Grabbers() >= Plugin.CfgTugPlayers.Value) { tug += dt; } else { tug = Mathf.Max(0f, tug - dt * 0.5f); } if (tug < Plugin.CfgTugTime.Value) { return false; } Plugin.Log.LogInfo((object)"[Pince] Tug of war won by the team: it lets go."); Release(allowDamage: true); Event(1); cooldownUntil = Time.time + Plugin.CfgCooldown.Value; SetState(State.Return); return true; } private void Release(bool allowDamage) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)victim) && holding && Object.op_Implicit((Object)(object)victim.tumble)) { PlayerTumble tumble = victim.tumble; float num = ((Component)tumble).transform.position.y - 0.9f - FloorY(((Component)tumble).transform.position, 20f); tumble.TumbleOverrideTime(1.5f); if (allowDamage && tumble.physGrabObject.playerGrabbing.Count == 0 && num >= 2f) { victim.FallDamageResetSet(3f); dropped = victim; droppedTime = Time.time; droppedDamage = Mathf.Clamp(Mathf.RoundToInt(num * Plugin.CfgFallDmgPerMeter.Value), Plugin.CfgFallDmgMin.Value, Plugin.CfgFallDmgMax.Value); Plugin.Log.LogInfo((object)$"[Pince] Dropped {victim.playerName} from {num:0.0} m: {droppedDamage} damage on landing."); } } if (holding) { cooldownUntil = Mathf.Max(cooldownUntil, Time.time + Plugin.CfgCooldown.Value); } victim = null; prize = null; holding = false; tug = 0f; SyncState(); } private void LandingTick() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)dropped)) { return; } float num = Time.time - droppedTime; if ((num > 0.3f && Object.op_Implicit((Object)(object)dropped.tumble) && Object.op_Implicit((Object)(object)dropped.tumble.rb) && dropped.tumble.rb.linearVelocity.y > -0.6f) || !(num < 4f)) { if (ValidPlayer(dropped)) { dropped.playerHealth.HurtOther(droppedDamage, ((Component)dropped).transform.position, false, SemiFunc.EnemyGetIndex(enemy), false); } dropped = null; } } private float CarryDepth() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = CableTop(); float num = FloorY(((Component)this).transform.position + Vector3.up * 0.2f, 2f) + Plugin.CfgCarryHeight.Value + 0.42f; return Mathf.Max(Object.op_Implicit((Object)(object)prize) ? 0.9f : 0.35f, val.y - num); } private void SetState(State s) { if (s != state) { ApplyState(s); SyncState(); } } private void SyncState() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) int num = (Object.op_Implicit((Object)(object)victim) ? victim.photonView.ViewID : (-1)); int num2 = ((Object.op_Implicit((Object)(object)prize) && Object.op_Implicit((Object)(object)prize.photonView)) ? prize.photonView.ViewID : (-1)); if (MP) { photonView.RPC("PinceStateRPC", (RpcTarget)1, new object[6] { (int)state, num, num2, holding, descendPoint, descendDepth }); } } [PunRPC] private void PinceStateRPC(int s, int victimId, int prizeId, bool hold, Vector3 point, float depth, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MasterOnlyRPC(info)) { return; } victim = null; prize = null; if (victimId >= 0) { PhotonView val = PhotonView.Find(victimId); if (Object.op_Implicit((Object)(object)val)) { victim = ((Component)val).GetComponent<PlayerAvatar>(); } } if (prizeId >= 0) { PhotonView val2 = PhotonView.Find(prizeId); if (Object.op_Implicit((Object)(object)val2)) { prize = ((Component)val2).GetComponent<PhysGrabObject>(); } } holding = hold; descendPoint = point; descendDepth = depth; if (s != (int)state) { ApplyState((State)s); } } private void ApplyState(State s) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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) State state = this.state; this.state = s; stateImpulse = true; stateTimer = 0f; stateTime = 0f; beeps = 0; if (Master && s != State.Approach) { Plugin.Log.LogInfo((object)$"[Pince] {state} -> {s}"); } Vector3 pos = (Object.op_Implicit((Object)(object)erb) ? ((Component)erb).transform.position : ((Component)this).transform.position); switch (s) { case State.Descend: Sounds.Play(Sounds.Drop, pos, 0.9f); break; case State.Lift: Sounds.Play(Sounds.Grab, HeadWorld()); Sounds.Play(Sounds.Lift, pos, 0.8f); break; case State.Disabled: Sounds.Play(Sounds.PowerDown, pos); break; case State.Stunned: Sounds.Play(Sounds.Stun, pos, 0.8f); break; case State.Return: if (state == State.Disabled) { Sounds.Play(Sounds.PowerUp, pos, 0.9f); } if (state == State.Stunned) { Sounds.Play(Sounds.StunOutro, pos, 0.7f); } break; case State.Carry: break; } } private void Event(int ev) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (MP) { photonView.RPC("PinceEventRPC", (RpcTarget)0, new object[1] { ev }); } else { PinceEventRPC(ev); } } [PunRPC] private void PinceEventRPC(int ev, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: 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) if (SemiFunc.MasterOnlyRPC(info)) { Sounds.Play((ev == 2) ? Sounds.Win : Sounds.Miss, ((Component)erb).transform.position); } } [PunRPC] private void PinceChuteRPC(Vector3 pos, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { MakeChute(pos); } } private void OnSpawn() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)erb)) { lastPos = ((Component)erb).transform.position; } cableLen = 0.35f; railStarted = false; if (!Master) { return; } bool flag = Time.time < SkipTeleportUntil; if (flag) { SkipTeleportUntil = 0f; } if (!flag && Plugin.TryQuietPoint(Vector3.zero, 0f, 999f, out var pos)) { enemy.EnemyTeleported(pos); flag = true; } if (!flag) { flag = SemiFunc.EnemySpawn(enemy); } if (flag) { height = 2.2f; victim = null; prize = null; holding = false; SetupChute(); Plugin.Log.LogInfo((object)("[Pince] Spawned at " + ((object)((Component)this).transform.position/*cast due to .constrained prefix*/).ToString())); if (state == State.Spawn) { stateImpulse = true; stateTimer = 0f; stateTime = 0f; SyncState(); } else { SetState(State.Spawn); } } } private void SetupChute() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) if (hasChute && (Object)(object)chuteLevel == (Object)(object)LevelGenerator.Instance) { SendChute(); return; } LevelGenerator instance = LevelGenerator.Instance; List<LevelPoint> list = (Object.op_Implicit((Object)(object)instance) ? instance.LevelPathPoints : null); if (list == null || list.Count == 0) { return; } Vector3 val = (Object.op_Implicit((Object)(object)instance.LevelPathTruck) ? ((Component)instance.LevelPathTruck).transform.position : ((Component)this).transform.position); Vector3 val2 = Vector3.zero; float num = float.MinValue; for (int i = 0; i < 40; i++) { LevelPoint val3 = list[Random.Range(0, list.Count)]; if (Object.op_Implicit((Object)(object)val3) && !val3.Truck) { Vector3 position = ((Component)val3).transform.position; float num2 = Mathf.Min(Vector3.Distance(position, val), 60f) + Mathf.Min(CeilingAt(position), 5f) * 3f + Random.Range(0f, 10f); if (num2 > num) { num = num2; val2 = position; } } } if (num != float.MinValue) { val2.y = FloorY(val2 + Vector3.up * 0.5f, 2f); chutePos = val2; hasChute = true; chuteLevel = instance; Plugin.Log.LogInfo((object)("[Pince] Prize chute at " + ((object)Unsafe.As<Vector3, Vector3>(ref chutePos)/*cast due to .constrained prefix*/).ToString())); SendChute(); } } private void SendChute() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (MP) { photonView.RPC("PinceChuteRPC", (RpcTarget)0, new object[1] { chutePos }); } else { MakeChute(chutePos); } } private void MakeChute(Vector3 pos) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0041: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)chuteGo)) { Object.Destroy((Object)(object)chuteGo); } if (!((Object)(object)PrefabBuilder.ChuteMesh == (Object)null)) { chuteGo = new GameObject("Pince Prize Chute"); chuteGo.transform.SetPositionAndRotation(pos, Quaternion.Euler(0f, Mathf.Abs(pos.x * 7.3f + pos.z * 3.1f) % 360f, 0f)); chuteGo.AddComponent<MeshFilter>().sharedMesh = PrefabBuilder.ChuteMesh; ((Renderer)chuteGo.AddComponent<MeshRenderer>()).sharedMaterials = PrefabBuilder.MatsFor(PrefabBuilder.ChuteMats); } } internal void DebugBring(Vector3 pos) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) EnemyParent enemyParent = enemy.EnemyParent; if (Object.op_Implicit((Object)(object)enemyParent) && !enemyParent.Spawned) { SkipTeleportUntil = Time.time + 5f; enemyParent.Spawn(); } enemy.EnemyTeleported(pos); Release(allowDamage: false); SetState(State.Spawn); } private void OnHurt() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) flash = 1f; Sounds.Play(Sounds.Zap, ((Component)erb).transform.position, 0.9f); if (Master && !health.dead) { Plugin.Log.LogInfo((object)$"[Pince] Motor hit: shut down for {Plugin.CfgDisableTime.Value:0} s."); Release(allowDamage: true); if (state == State.Disabled) { stateTimer = Mathf.Max(stateTimer, Plugin.CfgDisableTime.Value * 0.5f); } else { SetState(State.Disabled); } } } private void OnDeath() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)erb).transform.position; if (Sounds.Death != null) { Sounds.Play(Sounds.Death, position, 0.9f); } Sounds.Play(Sounds.PowerDown, position, 1f, 0.8f); Sounds.Play(Sounds.DeathSpark, position, 0.8f); if (Object.op_Implicit((Object)(object)particles)) { particles.position = position; ParticleSystem[] componentsInChildren = ((Component)particles).GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].Play(true); } } if (Master) { Release(allowDamage: true); enemy.EnemyParent.Despawn(); } } private static Vector3 Flat(Vector3 v) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) v.y = 0f; return v; } private static bool ValidPlayer(PlayerAvatar p) { if ((Object)(object)p != (Object)null && !p.isDisabled) { return !p.deadSet; } return false; } private static float Damp(float c, float t, float s, float dt) { return Mathf.Lerp(c, t, 1f - Mathf.Exp((0f - s) * dt)); } private Vector3 CableTop() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) return ((Component)erb).transform.position + Vector3.up * -0.14f; } private Vector3 HeadTarget() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) return CableTop() + Vector3.down * cableLen + swing; } private Vector3 HeadWorld() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)head)) { return HeadTarget(); } return head.position; } private void Animate(float dt) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0036: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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_0420: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_049c: 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_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_078b: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_0774: Unknown result type (might be due to invalid IL or missing references) //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_0754: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_0861: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07c0: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) if (dt <= 0f) { return; } if (!Master) { stateTime += dt; } Vector3 position = ((Component)erb).transform.position; Vector3 v = (position - lastPos) / dt; lastPos = position; if (((Vector3)(ref v)).magnitude > 20f) { v = Vector3.zero; } float c = bodySpeed; Vector3 val = Flat(v); bodySpeed = Damp(c, ((Vector3)(ref val)).magnitude, 6f, dt); float num = 18f; bool flag = holding && (Object.op_Implicit((Object)(object)victim) || Object.op_Implicit((Object)(object)prize)); switch (state) { case State.Descend: cableLen = Mathf.MoveTowards(cableLen, descendDepth, Plugin.CfgDescendSpeed.Value * dt); num = 58f; swing = Vector3.Lerp(swing, Vector3.ClampMagnitude(Flat(descendPoint - position), 1.5f), 1f - Mathf.Exp(-5f * dt)); break; case State.Lift: case State.Carry: if (Master) { cableLen = Mathf.MoveTowards(cableLen, CarryDepth(), 3f * dt); } else { cableLen = Mathf.MoveTowards(cableLen, Mathf.Max(0.35f, CableTop().y - (FloorY(position, 12f) + Plugin.CfgCarryHeight.Value + 0.42f)), 3f * dt); } swing = Vector3.Lerp(swing, Vector3.ClampMagnitude(-Flat(v) * 0.18f, 0.7f), 1f - Mathf.Exp(-2f * dt)); num = ((!flag) ? 40f : (Object.op_Implicit((Object)(object)victim) ? 12f : 6f)); break; case State.Lock: num = 32f; cableLen = Mathf.MoveTowards(cableLen, 0.35f, 4f * dt); swing = Vector3.Lerp(swing, Vector3.zero, dt * 3f); break; case State.Disabled: num = 50f; cableLen = Mathf.MoveTowards(cableLen, Mathf.Max(cableLen, 0.65f), 0.4f * dt); swing = Vector3.Lerp(swing, Vector3.zero, dt); break; case State.Stunned: num = 42f; swing = Vector3.Lerp(swing, Vector3.zero, dt); break; default: cableLen = Mathf.MoveTowards(cableLen, 0.35f, 4f * dt); num = ((state == State.Return) ? 26f : 18f); swing = Vector3.Lerp(swing, Vector3.ClampMagnitude(-Flat(v) * 0.08f, 0.3f), 1f - Mathf.Exp(-3f * dt)); break; } openDeg = Damp(openDeg, num, 9f, dt); Vector3 val2 = CableTop(); Vector3 val3 = HeadTarget(); if (flag && (state == State.Lift || state == State.Carry)) { val3 = ((!Object.op_Implicit((Object)(object)victim)) ? prize.midPoint : ((Object.op_Implicit((Object)(object)victim.tumble) && victim.tumble.isTumbling) ? ((Component)victim.tumble).transform.position : (((Component)victim).transform.position + Vector3.up * 0.9f))) + Vector3.up * 0.42f; } Vector3 val4 = val3 - val2; float magnitude = ((Vector3)(ref val4)).magnitude; Quaternion val5 = Quaternion.Euler(0f, visuals.eulerAngles.y, 0f); Quaternion val6 = ((magnitude > 0.001f) ? Quaternion.FromToRotation(Vector3.down, val4 / magnitude) : Quaternion.identity); head.SetPositionAndRotation(val3, val6 * val5); cable.SetPositionAndRotation(val2, val6 * val5); cable.localScale = new Vector3(1f, Mathf.Max(0.01f, magnitude + 0.02f), 1f); for (int i = 0; i < 3; i++) { prongs[i].localRotation = Quaternion.Euler(0f, 120f * (float)i, 0f) * Quaternion.Euler(0f - openDeg, 0f, 0f); } carriage.localRotation = Quaternion.Euler(Mathf.Clamp(bodySpeed * 1.4f, 0f, 5f), 0f, 0f); if (state == State.Lock && beeps < 3 && stateTime >= (float)beeps * Plugin.CfgLockTime.Value / 3f) { beeps++; Sounds.Play(Sounds.Beep, position, 1f, 1f + 0.08f * (float)beeps); } flash = Mathf.Max(0f, flash - dt * 3f); bool flag2 = state == State.Disabled || state == State.Stunned; float num2 = ((!flag2 || !(stateTime < 0.8f)) ? (flag2 ? 0f : 1f) : ((Mathf.Sin(stateTime * 70f) > 0f) ? 0.7f : 0f)); bool flag3 = state == State.Lock || state == State.Descend; Color val7 = (Color)(flag3 ? new Color(3f, 0.25f, 0.3f) : (flag ? Color.Lerp(new Color(2.2f, 2.2f, 2.2f), new Color(3f, 1f, 2.4f), 0.5f + 0.5f * Mathf.Sin(Time.time * 8f)) : new Color(2.2f, 2.2f, 2.2f))); float num3 = (((int)(Time.time * (flag3 ? 8f : 3f)) % 2 == 0) ? 1.6f : 0.35f); float num4 = 2.2f + 0.8f * Mathf.Sin(Time.time * 6f); foreach (var item in glow) { Color val8 = ((item.mat == 2) ? (val7 * num2) : ((item.mat == 3) ? (Color.white * num3 * num2) : (new Color(1f, 0.55f, 0.2f) * (flag2 ? 0.25f : num4)))); if (item.mat == 4 && flash > 0f) { val8 = Color.Lerp(val8, new Color(4f, 4f, 4f), flash); } item.r.GetPropertyBlock(mpb, item.sub); mpb.SetColor("_EmissionColor", val8); item.r.SetPropertyBlock(mpb, item.sub); } if (Object.op_Implicit((Object)(object)spot)) { ((Behaviour)spot).enabled = num2 > 0f; spot.color = (flag3 ? new Color(1f, 0.15f, 0.15f) : new Color(1f, 0.35f, 0.85f)); spot.intensity = (flag3 ? 2.2f : 1.6f); } } private void MusicTick() { if (music == null || !Object.op_Implicit((Object)(object)musicSrc)) { return; } bool flag = state != State.Disabled && state != State.Stunned && state != State.Spawn && (bodySpeed > 0.25f || state == State.Lock || state == State.Lift || state == State.Carry || state == State.Descend); float num = ((state == State.Lock || state == State.Descend) ? 1.22f : ((state == State.Lift || state == State.Carry) ? 1.12f : 1f)); try { music.PlayLoop(flag, 2f, 1.5f, num, 1f); } catch (Exception) { } } private void Rails() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_003a: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0068: 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_0079: 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) //IL_0083: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)PrefabBuilder.RailMesh == (Object)null || state == State.Spawn) { return; } Vector3 val = ((Component)erb).transform.position + Vector3.up * 0.445f; if (!railStarted) { railLast = val; railStarted = true; return; } float num = Vector3.Distance(val, railLast); if (num > 4f) { railLast = val; } else { if (num < 0.9f) { return; } Vector3Int item = Cell(railLast); Vector3Int item2 = Cell(val); if ((!railCells.Contains(item) || !railCells.Contains(item2)) && railCount < 600) { if (!Object.op_Implicit((Object)(object)railRoot)) { railRoot = new GameObject("Pince Rails").transform; } GameObject val2 = new GameObject("Rail"); val2.transform.SetParent(railRoot, false); val2.transform.SetPositionAndRotation(railLast, Quaternion.LookRotation(val - railLast, Vector3.up)); val2.transform.localScale = new Vector3(1f, 1f, num + 0.04f); val2.AddComponent<MeshFilter>().sharedMesh = PrefabBuilder.RailMesh; MeshRenderer obj = val2.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterials = PrefabBuilder.MatsFor(PrefabBuilder.RailMats); ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; railCount++; } railCells.Add(item); railCells.Add(item2); railLast = val; } } private static Vector3Int Cell(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) return new Vector3Int(Mathf.RoundToInt(p.x / 0.7f), Mathf.RoundToInt(p.y / 0.7f), Mathf.RoundToInt(p.z / 0.7f)); } } internal static class Sounds { public static Sound Music; public static Sound Beep; public static Sound Drop; public static Sound Lift; public static Sound Grab; public static Sound Miss; public static Sound Win; public static Sound PowerDown; public static Sound PowerUp; public static Sound Zap; public static Sound Death; public static Sound DeathSpark; public static Sound Stun; public static Sound StunOutro; public static void Play(Sound s, Vector3 pos, float volume = 1f, float pitch = 1f) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (s == null || s.Sounds == null || s.Sounds.Length == 0) { return; } float pitch2 = s.Pitch; try { s.Pitch = pitch2 * pitch; s.Play(pos, volume, 1f, 1f, 1f); } catch (Exception ex) { Plugin.Log.LogDebug((object)("Sound play failed: " + ex.Message)); } finally { s.Pitch = pitch2; } } internal static Sound Make(string name, AudioType type, float volume, float spatial, float pitchRandom, params string[] wavs) { //IL_0064: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown List<AudioClip> list = new List<AudioClip>(); foreach (string text in wavs) { try { list.Add(Wav.Load("Pince." + text, name + " " + text)); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Sound " + text + ": " + ex.Message)); } } return new Sound { Sounds = list.ToArray(), Type = type, Volume = volume, VolumeRandom = 0.05f, Pitch = 1f, PitchRandom = pitchRandom, SpatialBlend = spatial, Doppler = 0f, ReverbMix = 1f, FalloffMultiplier = 1f, OffscreenVolume = 1f, OffscreenFalloff = 1f, LowPassIgnoreColliders = new List<Collider>() }; } } internal static class Wav { public static AudioClip Load(string resource, string clipName) { byte[] array = Resource.Embedded(resource); int num = BitConverter.ToInt16(array, 22); int num2 = BitConverter.ToInt32(array, 24); if (BitConverter.ToInt16(array, 34) != 16) { throw new Exception("only 16-bit PCM"); } int i = 12; int num3 = -1; int num4 = 0; int num5; for (; i + 8 <= array.Length; i += 8 + num5 + (num5 & 1)) { string text = Encoding.ASCII.GetString(array, i, 4); num5 = BitConverter.ToInt32(array, i + 4); if (text == "data") { num3 = i + 8; num4 = num5; break; } } if (num3 < 0) { throw new Exception("no data chunk"); } int num6 = num4 / 2; float[] array2 = new float[num6]; for (int j = 0; j < num6; j++) { array2[j] = (float)BitConverter.ToInt16(array, num3 + j * 2) / 32768f; } AudioClip obj = AudioClip.Create(clipName, num6 / num, num, num2, false); obj.SetData(array2, 0); ((Object)obj).hideFlags = (HideFlags)32; return obj; } } [BepInPlugin("maxime.repo.pince", "Pince", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string GUID = "maxime.repo.pince"; public const string NAME = "Pince"; public const string VERSION = "1.0.0"; internal static Plugin Instance; internal static ManualLogSource Log; internal static ConfigEntry<int> CfgPoolWeight; internal static ConfigEntry<int> CfgSpawnChance; internal static ConfigEntry<int> CfgDifficulty; internal static ConfigEntry<int> CfgHealth; internal static ConfigEntry<int> CfgMissChance; internal static ConfigEntry<int> CfgPlayerPreference; internal static ConfigEntry<int> CfgTugPlayers; internal static ConfigEntry<int> CfgFallDmgMin; internal static ConfigEntry<int> CfgFallDmgMax; internal static ConfigEntry<float> CfgRailSpeed; internal static ConfigEntry<float> CfgCarryHeight; internal static ConfigEntry<float> CfgDescendSpeed; internal static ConfigEntry<float> CfgTargetRange; internal static ConfigEntry<float> CfgCooldown; internal static ConfigEntry<float> CfgLockTime; internal static ConfigEntry<float> CfgTugTime; internal static ConfigEntry<float> CfgTugSlowdown; internal static ConfigEntry<float> CfgDisableTime; internal static ConfigEntry<float> CfgFallDmgPerMeter; internal static ConfigEntry<float> CfgMonsterRange; internal static ConfigEntry<bool> CfgDebugSpawn; internal static ConfigEntry<KeyCode> CfgDebugSpawnKey; internal const float MinPlayerDistance = 15f; internal static EnemySetup Setup; internal static GameObject Prefab; private static GameObject holder; private Harmony harmony; private float lastDebugSpawn = -10f; private LevelGenerator handledLevel; private float levelReadyTime = -1f; private float nextSpawnTry; private bool rolled; internal static GameObject Holder { get { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)holder == (Object)null) { holder = new GameObject("PincePrefabHolder"); holder.SetActive(false); ((Object)holder).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)holder); } return holder; } } private void Awake() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; BindConfig(); harmony = new Harmony("maxime.repo.pince"); harmony.PatchAll(typeof(Plugin).Assembly); try { Prefab = PrefabBuilder.Build(); Register(); Log.LogInfo((object)"Pince v1.0.0 loaded: enemy prefab built and registered with REPOLib."); } catch (Exception ex) { Log.LogError((object)("Failed to build/register the Pince: " + ex)); } } private void BindConfig() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Expected O, but got Unknown //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Expected O, but got Unknown //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Expected O, but got Unknown //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Expected O, but got Unknown //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Expected O, but got Unknown //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Expected O, but got Unknown //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Expected O, but got Unknown CfgSpawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "BonusChance", 0, new ConfigDescription("Optional extra copy ON TOP of the level's monsters: chance (%) per level, only if the normal draw did not pick it. 0 = off.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); CfgPoolWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "PoolWeight", 100, new ConfigDescription("Weight in the game's normal monster draw: it takes the place of a vanilla pick, never adds one. 100 = as likely as a standard vanilla monster, 0 = never drawn. Needs a restart.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 300), Array.Empty<object>())); CfgDifficulty = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "DifficultyTier", 2, new ConfigDescription("Enemy tier (1-3): size of the orb it drops. Needs a restart.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 3), Array.Empty<object>())); CfgHealth = ((BaseUnityPlugin)this).Config.Bind<int>("Pince", "Health", 150, new ConfigDescription("Hit points. Only the glowing motor can be hit (it is the only hitbox).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 3000), Array.Empty<object>())); CfgRailSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Pince", "RailSpeed", 3f, new ConfigDescription("Speed along its ceiling rails (m/s).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 10f), Array.Empty<object>())); CfgCarryHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Pince", "CarryHeight", 6f, new ConfigDescription("Lifts its catch this high above the floor (m), less under a lower ceiling.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>())); CfgDescendSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Pince", "DescendSpeed", 6f, new ConfigDescription("Speed of the claw going down (m/s).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>())); CfgMissChance = ((BaseUnityPlugin)thi