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 Bailiff v1.0.0
Huissier.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.Linq; 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 Huissier { public class HuissierAI : MonoBehaviour { public enum State { Spawn, Patrol, Inspect, Stamp, Wait, Confiscate, Carry, Deposit, Riposte, Stunned, Angry } private Enemy enemy; private PhotonView photonView; private EnemyHealth health; private EnemyRigidbody erb; private Transform visuals; private Transform model; private Transform visionT; private Transform particles; private Transform stampTip; private Transform mouth; private readonly Dictionary<string, Transform> J = new Dictionary<string, Transform>(); private Light eyeLight; private Renderer headR; private int eyeMat = -1; private MaterialPropertyBlock eyeMpb; private static readonly int EmissionId = Shader.PropertyToID("_EmissionColor"); private static readonly Color EyeBase = new Color(2.2f, 1.45f, 0.5f); private bool ready; public State state; private bool stateImpulse = true; private float stateTimer; private float stateTime; private State resumeState = State.Patrol; private PlayerAvatar targetPlayer; private PhysGrabObject targetItem; private float retargetTimer; private float pathTimer; private float tick; private float riposteCooldown; private float lastSeenWatched; private bool stampApplied; private bool depositDone; private bool riposteDone; private bool angryHit; private float grabTime; private float angryLose; private float angryEnd; private bool angry; private Vector3 angryLastSeen; private PhysGrabObject carried; private Vector3 archivePos; private bool archiveSet; private readonly HashSet<int> archived = new HashSet<int>(); private readonly Dictionary<int, float> unreachable = new Dictionary<int, float>(); private readonly Dictionary<int, float> gaze = new Dictionary<int, float>(); private readonly Dictionary<int, int> bagValues = new Dictionary<int, int>(); private PlayerAvatar pendingBagOwner; private float pendingBagUntil; private float bagReportTimer; private int lastBagSent = -1; private float t; private float walkPhase; private float bodySpeed; private float eyeGlow; private float lastStepSin; private float flicker; private Vector3 lastVisPos; private float headYaw; private float headPitch; private GameObject archiveMarker; internal static float SkipTeleportUntil; internal static readonly List<HuissierAI> All = new List<HuissierAI>(); private readonly Dictionary<string, Vector3> pose = new Dictionary<string, Vector3>(); private static bool MP => GameManager.Multiplayer(); private static bool Master => SemiFunc.IsMasterClientOrSingleplayer(); internal static HuissierAI Existing() { All.RemoveAll((HuissierAI a) => (Object)(object)a == (Object)null); if (All.Count <= 0) { return null; } return All[0]; } private void Awake() { //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Expected O, but got Unknown //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0270: 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>(); visuals = parent.Find("Visuals"); model = (Object.op_Implicit((Object)(object)visuals) ? visuals.Find("HuissierModel") : null); visionT = (Object.op_Implicit((Object)(object)visuals) ? visuals.Find("Vision Transform") : null); particles = parent.parent.Find("Particles"); if (Object.op_Implicit((Object)(object)model)) { Transform[] componentsInChildren = ((Component)model).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (Array.IndexOf(ModelLayout.Parts, ((Object)val).name) >= 0) { J[((Object)val).name] = val; } if (((Object)val).name == "StampTip") { stampTip = val; } if (((Object)val).name == "BriefcaseMouth") { mouth = val; } if (((Object)val).name == "EyeLight") { eyeLight = ((Component)val).GetComponent<Light>(); } } } if (J.TryGetValue("head", out var value)) { headR = ((Component)value).GetComponent<Renderer>(); Material[] sharedMaterials = headR.sharedMaterials; for (int j = 0; j < sharedMaterials.Length; j++) { if (Object.op_Implicit((Object)(object)sharedMaterials[j]) && ((Object)sharedMaterials[j]).name.StartsWith("Huissier Eye")) { eyeMat = j; } } } eyeMpb = new MaterialPropertyBlock(); HuissierImpact component = ((Component)erb).GetComponent<HuissierImpact>(); if (Object.op_Implicit((Object)(object)component)) { component.ai = this; } EnemyStateSpawn component2 = ((Component)this).GetComponent<EnemyStateSpawn>(); if (Object.op_Implicit((Object)(object)component2)) { component2.OnSpawn.AddListener(new UnityAction(OnSpawn)); } if (Object.op_Implicit((Object)(object)health)) { health.onHurt.AddListener(new UnityAction(OnHurt)); health.onDeath.AddListener(new UnityAction(OnDeath)); } ready = Object.op_Implicit((Object)(object)model) && Object.op_Implicit((Object)(object)erb) && J.Count >= 15 && Object.op_Implicit((Object)(object)stampTip) && Object.op_Implicit((Object)(object)mouth); if (!ready) { Plugin.Log.LogError((object)"HuissierAI: hierarchy incomplete, behaviour disabled."); } All.Add(this); } private void OnDestroy() { All.Remove(this); if (Object.op_Implicit((Object)(object)archiveMarker)) { Object.Destroy((Object)(object)archiveMarker); } } private void OnEnable() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)visuals) && Object.op_Implicit((Object)(object)erb)) { lastVisPos = ((Component)erb).transform.position; } } private void OnDisable() { //IL_003a: 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_0044: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_006d: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00af: Unknown result type (might be due to invalid IL or missing references) if (Master && Object.op_Implicit((Object)(object)carried) && Object.op_Implicit((Object)(object)carried.rb)) { Vector3 val = Flat(((Component)erb).transform.forward); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 position = ((Component)erb).transform.position + normalized * 0.5f + Vector3.up * 0.7f; carried.rb.position = position; ((Component)carried).transform.position = position; carried.rb.linearVelocity = Vector3.zero; carried.OverrideIndestructible(2f); } carried = null; Stash.ShowAllHostedBy((MonoBehaviour)(object)this); } private void Update() { if (ready) { float deltaTime = Time.deltaTime; t += deltaTime; if ((int)(t * 2f) != (int)((t - deltaTime) * 2f)) { Sounds.TryLevelSounds(); } if (Master) { MasterLogic(deltaTime); } else { BagReportTick(deltaTime); } } } private void LateUpdate() { //IL_001a: 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) if (ready) { visuals.position = ((Component)erb).transform.position; visuals.rotation = ((Component)erb).transform.rotation; Animate(Time.deltaTime); } } private void FixedUpdate() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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) //IL_00af: 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) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_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_011c: 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_012f: 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_013e: Unknown result type (might be due to invalid IL or missing references) if (!ready || !Master) { return; } float fixedDeltaTime = Time.fixedDeltaTime; Rigidbody rb = erb.rb; if (Object.op_Implicit((Object)(object)carried)) { Rigidbody rb2 = carried.rb; if (Object.op_Implicit((Object)(object)rb2)) { carried.OverrideZeroGravity(0.25f); carried.OverrideIndestructible(0.5f); carried.OverrideBreakEffects(0.5f); Vector3 val = mouth.position - rb2.position; rb2.linearVelocity = Vector3.ClampMagnitude(val / fixedDeltaTime * 0.6f, 25f); rb2.angularVelocity = Vector3.zero; } } if (Object.op_Implicit((Object)(object)rb) && !rb.isKinematic && !enemy.IsStunned() && erb.physGrabObject.playerGrabbing.Count == 0) { Vector3 val2 = Vector3.Cross(((Component)rb).transform.up, Vector3.up); Vector3 angularVelocity = rb.angularVelocity; rb.AddTorque(val2 * 60f - new Vector3(angularVelocity.x, 0f, angularVelocity.z) * 10f, (ForceMode)5); } Seals.TearTick(this, fixedDeltaTime); } private void MasterLogic(float dt) { //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0687: 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_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0493: 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_01e8: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) if (riposteCooldown > 0f) { riposteCooldown -= dt; } stateTime += dt; if (enemy.IsStunned() && state != State.Stunned) { SetState(State.Stunned); } GrabTick(dt); AngerTick(dt); FaceLogic(dt); tick -= dt; bool flag = tick <= 0f; if (flag) { tick = 0.1f; } Vector3 val; switch (state) { case State.Spawn: if (stateImpulse) { stateImpulse = false; stateTimer = 1.6f; ChooseArchive(); } Halt(); stateTimer -= dt; if (stateTimer <= 0f) { SetState(State.Patrol); } break; case State.Patrol: if (stateImpulse) { stateImpulse = false; retargetTimer = 0f; } if (flag) { TouchTick(); if (state != State.Patrol) { break; } GazeTick(0.1f); if (state != State.Patrol) { break; } } retargetTimer -= dt; if (retargetTimer <= 0f) { retargetTimer = 1f; PickTarget(); } PatrolMove(dt); break; case State.Inspect: if (stateImpulse) { stateImpulse = false; lastSeenWatched = Time.time; } if (flag) { TouchTick(); if (state != State.Inspect) { break; } GazeTick(0.1f); if (state != State.Inspect) { break; } } if (ValidPlayer(targetPlayer)) { val = Flat(((Component)targetPlayer).transform.position - ((Component)erb).transform.position); if (((Vector3)(ref val)).magnitude > 1.3f) { GoTo(((Component)targetPlayer).transform.position, dt); } else { Halt(); } } if (Time.time - lastSeenWatched > 1.2f || !ValidPlayer(targetPlayer)) { SetState(State.Patrol); } break; case State.Stamp: if (stateImpulse) { stateImpulse = false; stateTimer = 1f; stampApplied = false; Sounds.Play(Sounds.StampClick, ((Component)erb).transform.position, 0.6f); } Halt(); stateTimer -= dt; if (!stampApplied && stateTimer <= 0.45f) { stampApplied = true; if (Object.op_Implicit((Object)(object)targetItem) && Vector3.Distance(targetItem.midPoint, ((Component)erb).transform.position) < Plugin.CfgGazeRange.Value + 0.6f) { ApplySeal(targetItem); } RpcStamp(stampTip.position); } if (stateTimer <= 0f) { bool flag2 = Object.op_Implicit((Object)(object)targetItem) && targetItem.playerGrabbing.Count == 0; SetState((!flag2) ? State.Patrol : State.Wait); } break; case State.Wait: if (stateImpulse) { stateImpulse = false; stateTimer = 1.6f; } Halt(); stateTimer -= dt; if (stateTimer <= 0f) { if (Object.op_Implicit((Object)(object)targetItem) && Seals.IsSealed(targetItem) && InReach(targetItem, 1.7f)) { StartConfiscate(targetItem); } else { SetState(State.Patrol); } } break; case State.Confiscate: if (stateImpulse) { stateImpulse = false; stateTimer = 0.8f; } Halt(); stateTimer -= dt; if (stateTimer <= 0f) { SetState((!Object.op_Implicit((Object)(object)carried)) ? State.Patrol : State.Carry); } break; case State.Carry: if (stateImpulse) { stateImpulse = false; pathTimer = 0f; } if (!Object.op_Implicit((Object)(object)carried)) { SetState(State.Patrol); break; } val = Flat(archivePos - ((Component)erb).transform.position); if (((Vector3)(ref val)).magnitude < 1.6f) { SetState(State.Deposit); } else { GoTo(archivePos, dt); } break; case State.Deposit: if (stateImpulse) { stateImpulse = false; stateTimer = 1f; depositDone = false; } Halt(); stateTimer -= dt; if (!depositDone && stateTimer <= 0.5f) { depositDone = true; DepositCarried(); } if (stateTimer <= 0f) { SetState(State.Patrol); } break; case State.Angry: { if (stateImpulse) { stateImpulse = false; } if (!angry || !ValidPlayer(targetPlayer)) { EndAnger("target gone"); break; } bool flag3 = angryLose <= 0f; pathTimer -= dt; if (pathTimer <= 0f) { pathTimer = 0.25f; enemy.NavMeshAgent.SetDestination(flag3 ? ((Component)targetPlayer).transform.position : angryLastSeen); } enemy.NavMeshAgent.OverrideAgent(Plugin.CfgAngrySpeed.Value, 20f, 0.3f); if (flag3 && riposteCooldown <= 0f) { val = Flat(((Component)targetPlayer).transform.position - ((Component)erb).transform.position); if (((Vector3)(ref val)).magnitude < 1.8f) { angryHit = true; riposteCooldown = Plugin.CfgAngryHitCooldown.Value; SetState(State.Riposte); } } break; } case State.Riposte: if (stateImpulse) { stateImpulse = false; stateTimer = 0.8f; riposteDone = false; Sounds.Play(Sounds.Swing, ((Component)erb).transform.position, 0.9f); } Halt(); stateTimer -= dt; if (!riposteDone && stateTimer <= 0.5f) { riposteDone = true; RiposteHit(); } if (stateTimer <= 0f) { SetState(angry ? State.Angry : ((!Object.op_Implicit((Object)(object)carried)) ? State.Patrol : State.Carry)); } break; case State.Stunned: if (stateImpulse) { stateImpulse = false; } if (!enemy.IsStunned()) { SetState(angry ? State.Angry : ((!Object.op_Implicit((Object)(object)carried)) ? State.Patrol : State.Carry)); } break; } } private void GoTo(Vector3 p, float dt) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) pathTimer -= dt; if (pathTimer <= 0f) { pathTimer = 0.4f; enemy.NavMeshAgent.SetDestination(p); } enemy.NavMeshAgent.OverrideAgent(Plugin.CfgWalkSpeed.Value, 12f, 0.5f); } private void Halt() { enemy.NavMeshAgent.Stop(0.2f); } private void FaceLogic(float dt) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_008f: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00d9: 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) Vector3 val = Vector3.zero; switch (state) { case State.Inspect: case State.Riposte: case State.Angry: if (ValidPlayer(targetPlayer)) { val = ((Component)targetPlayer).transform.position - ((Component)erb).transform.position; } break; case State.Stamp: case State.Wait: case State.Confiscate: if (Object.op_Implicit((Object)(object)targetItem)) { val = targetItem.midPoint - ((Component)erb).transform.position; } else if (ValidPlayer(targetPlayer)) { val = ((Component)targetPlayer).transform.position - ((Component)erb).transform.position; } break; case State.Spawn: case State.Stunned: return; } if (val == Vector3.zero) { Vector3 agentVelocity = enemy.NavMeshAgent.AgentVelocity; if (((Vector3)(ref agentVelocity)).sqrMagnitude > 0.04f) { val = agentVelocity; } } val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, 1f - Mathf.Exp(-6f * dt)); } } private void PickTarget() { ValuableDirector instance = ValuableDirector.instance; PhysGrabObject val = null; float num = 0f; if (Object.op_Implicit((Object)(object)instance) && instance.valuableList != null) { foreach (ValuableObject valuable in instance.valuableList) { PhysGrabObject val2 = Usable(valuable); if (!Object.op_Implicit((Object)(object)val2)) { continue; } int viewID = val2.photonView.ViewID; if (!unreachable.TryGetValue(viewID, out var value) || !(Time.time < value)) { float num2 = valuable.dollarValueCurrent * (Seals.IsSealed(val2) ? 2.5f : 1f); if (num2 > num) { num = num2; val = val2; } } } } PlayerAvatar val3 = null; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (ValidPlayer(item)) { int num3 = BagValue(item); if ((float)num3 > num) { num = num3; val3 = item; val = null; } } } if ((Object)(object)val != (Object)(object)targetItem || (Object)(object)val3 != (Object)(object)targetPlayer) { targetItem = val; targetPlayer = (Object.op_Implicit((Object)(object)val3) ? val3 : ((Object.op_Implicit((Object)(object)val) && val.playerGrabbing.Count > 0) ? val.playerGrabbing[0].playerAvatar : null)); SyncState(); } } private PhysGrabObject Usable(ValuableObject v) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)v) || !((Component)v).gameObject.activeInHierarchy) { return null; } PhysGrabObject physGrabObject = v.physGrabObject; if (!Object.op_Implicit((Object)(object)physGrabObject) || (Object)(object)physGrabObject == (Object)(object)carried || !Object.op_Implicit((Object)(object)physGrabObject.photonView)) { return null; } if (Stash.IsHidden(physGrabObject.photonView.ViewID)) { return null; } if (archived.Contains(physGrabObject.photonView.ViewID) && physGrabObject.playerGrabbing.Count == 0) { Vector3 val = Flat(((Component)physGrabObject).transform.position - archivePos); if (((Vector3)(ref val)).magnitude < 5f) { return null; } } return physGrabObject; } private void PatrolMove(float dt) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0054: 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) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_011c: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) Vector3 p; Vector3 val; if (Object.op_Implicit((Object)(object)targetItem)) { p = targetItem.midPoint; } else { if (!ValidPlayer(targetPlayer)) { if (archiveSet) { val = Flat(archivePos - ((Component)erb).transform.position); if (((Vector3)(ref val)).magnitude > 2f) { p = archivePos; goto IL_0082; } } Halt(); return; } p = ((Component)targetPlayer).transform.position; } goto IL_0082; IL_0082: GoTo(p, dt); if (!Object.op_Implicit((Object)(object)targetItem) || targetItem.playerGrabbing.Count != 0) { return; } if (InReach(targetItem, 1.45f)) { if (Seals.IsSealed(targetItem)) { StartConfiscate(targetItem); } else { SetState(State.Stamp); } return; } Vector3 destination = enemy.NavMeshAgent.GetDestination(); NavMeshAgent agent = enemy.NavMeshAgent.Agent; if (Object.op_Implicit((Object)(object)agent) && !agent.pathPending) { val = Flat(destination - ((Component)erb).transform.position); if (((Vector3)(ref val)).magnitude < 0.8f && Vector3.Distance(targetItem.midPoint, ((Component)erb).transform.position) > 2.6f) { unreachable[targetItem.photonView.ViewID] = Time.time + 30f; targetItem = null; retargetTimer = 0f; } } } private bool InReach(PhysGrabObject p, float r) { //IL_0001: 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_001b: 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_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_002d: 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) Vector3 val = p.midPoint - ((Component)erb).transform.position; Vector3 val2 = Flat(val); if (((Vector3)(ref val2)).magnitude < r && val.y > -1.2f) { return val.y < 1.8f; } return false; } private void TouchTick() { //IL_0081: 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) if (Object.op_Implicit((Object)(object)carried)) { return; } ValuableDirector instance = ValuableDirector.instance; if (!Object.op_Implicit((Object)(object)instance) || instance.valuableList == null) { return; } if (Object.op_Implicit((Object)(object)pendingBagOwner) && Time.time < pendingBagUntil) { foreach (ValuableObject valuable in instance.valuableList) { PhysGrabObject val = Usable(valuable); if (Object.op_Implicit((Object)(object)val) && !Seals.IsSealed(val) && IRSBridge.IsMoneyBag(valuable) && Vector3.Distance(((Component)val).transform.position, ((Component)pendingBagOwner).transform.position) < 4f) { ApplySeal(val); targetItem = val; pendingBagOwner = null; SyncState(); break; } } } foreach (ValuableObject valuable2 in instance.valuableList) { PhysGrabObject val2 = Usable(valuable2); if (Object.op_Implicit((Object)(object)val2) && Seals.IsSealed(val2) && !Seals.IsTorn(val2) && InReach(val2, 1.25f)) { StartConfiscate(val2); break; } } } private void GazeTick(float dt) { Dictionary<PlayerAvatar, PhysGrabObject> dictionary = new Dictionary<PlayerAvatar, PhysGrabObject>(); ValuableDirector instance = ValuableDirector.instance; if (Object.op_Implicit((Object)(object)instance) && instance.valuableList != null) { foreach (ValuableObject valuable in instance.valuableList) { PhysGrabObject val = Usable(valuable); if (!Object.op_Implicit((Object)(object)val) || val.playerGrabbing.Count == 0 || Seals.IsSealed(val)) { continue; } foreach (PhysGrabber item in val.playerGrabbing) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.playerAvatar) && (!dictionary.TryGetValue(item.playerAvatar, out var value) || ((Component)value).GetComponent<ValuableObject>().dollarValueCurrent < valuable.dollarValueCurrent)) { dictionary[item.playerAvatar] = val; } } } } PlayerAvatar val2 = null; float num = 0f; float value2 = Plugin.CfgGazeRange.Value; foreach (PlayerAvatar item2 in SemiFunc.PlayerGetList()) { if (!ValidPlayer(item2)) { continue; } int viewID = item2.photonView.ViewID; bool num2 = dictionary.ContainsKey(item2) || (Plugin.CfgSeizeBag.Value && BagValue(item2) > 0); float num3 = (gaze.TryGetValue(viewID, out var value3) ? value3 : 0f); if (!num2) { gaze[viewID] = 0f; continue; } bool num4 = CanSee(item2, value2); num3 = (num4 ? (num3 + dt) : Mathf.Max(0f, num3 - 2f * dt)); gaze[viewID] = num3; if (num4 && num3 > num) { num = num3; val2 = item2; } } if ((Object)(object)val2 == (Object)null) { return; } lastSeenWatched = Time.time; if (state != State.Inspect || (Object)(object)targetPlayer != (Object)(object)val2) { targetPlayer = val2; if (state != State.Inspect) { SetState(State.Inspect); } else { SyncState(); } } if (num >= Plugin.CfgGazeTime.Value) { gaze[val2.photonView.ViewID] = 0f; if (dictionary.TryGetValue(val2, out var value4)) { targetItem = value4; SetState(State.Stamp); } else { SeizeBag(val2); } } } 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 CanSee(PlayerAvatar p, float range) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0073: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00ad: 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_00bf: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00f1: 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) //IL_0126: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) Vector3 a = (Object.op_Implicit((Object)(object)visionT) ? visionT.position : (((Component)erb).transform.position + Vector3.up * 1.3f)); Vector3 val = ((Object.op_Implicit((Object)(object)p.PlayerVisionTarget) && Object.op_Implicit((Object)(object)p.PlayerVisionTarget.VisionTransform)) ? p.PlayerVisionTarget.VisionTransform.position : (((Component)p).transform.position + Vector3.up * 1f)); Vector3 val2 = val - ((Component)erb).transform.position; Vector3 val3 = Flat(val2); if (((Vector3)(ref val3)).magnitude > range + 0.3f || Mathf.Abs(val2.y) > 2.5f) { return false; } val3 = Flat(((Component)erb).transform.forward); Vector3 normalized = ((Vector3)(ref val3)).normalized; if (state != State.Inspect && Vector3.Angle(normalized, Flat(val2)) > 70f) { return false; } int mask = LayerMask.GetMask(new string[1] { "Default" }); return ClearLine(a, val, mask); } internal bool SeesPoint(Vector3 point, float range) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_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_0054: 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_0060: Unknown result type (might be due to invalid IL or missing references) if (!ready || state == State.Stunned) { return false; } Vector3 val = (Object.op_Implicit((Object)(object)visionT) ? visionT.position : (((Component)erb).transform.position + Vector3.up * 1.3f)); if (Vector3.Distance(val, point) > range) { return false; } return ClearLine(val, point, LayerMask.GetMask(new string[1] { "Default" })); } private int BagValue(PlayerAvatar p) { if (!IRSBridge.Available || !Object.op_Implicit((Object)(object)p)) { return 0; } if (p.isLocal) { return IRSBridge.LocalBagValue(); } if (!bagValues.TryGetValue(p.photonView.ViewID, out var value)) { return 0; } return value; } private void BagReportTick(float dt) { if (!IRSBridge.Available || !MP) { return; } bagReportTimer -= dt; if (!(bagReportTimer > 0f)) { bagReportTimer = 1.5f; int num = IRSBridge.LocalBagValue(); if (num != lastBagSent || Random.value < 0.25f) { lastBagSent = num; photonView.RPC("HuissierBagReportRPC", (RpcTarget)2, new object[1] { num }); } } } [PunRPC] private void HuissierBagReportRPC(int value, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0007: 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) if (Master && info.Sender != null) { PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonPlayer(info.Sender); if (Object.op_Implicit((Object)(object)val)) { bagValues[val.photonView.ViewID] = Mathf.Max(0, value); } } } private void SeizeBag(PlayerAvatar p) { //IL_0046: 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_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) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (IRSBridge.Available && Object.op_Implicit((Object)(object)p)) { pendingBagOwner = p; pendingBagUntil = Time.time + 4f; bagValues[p.photonView.ViewID] = 0; RpcStamp(((Component)p).transform.position + Vector3.up * 1f); if (MP) { photonView.RPC("HuissierSeizeBagRPC", (RpcTarget)0, new object[1] { p.photonView.ViewID }); } else { HuissierSeizeBagRPC(p.photonView.ViewID); } Plugin.Log.LogInfo((object)("[Huissier] Seizing the IRS bag of " + p.playerName)); } } [PunRPC] private void HuissierSeizeBagRPC(int playerViewID, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if (Object.op_Implicit((Object)(object)val) && val.photonView.ViewID == playerViewID) { IRSBridge.DropLocalBag(); } } } private void ApplySeal(PhysGrabObject p) { //IL_00b1: 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) ValuableObject val = (Object.op_Implicit((Object)(object)p) ? ((Component)p).GetComponent<ValuableObject>() : null); if (Object.op_Implicit((Object)(object)val) && !Seals.IsSealed(p)) { float num = Mathf.Max(1f, Mathf.Round(val.dollarValueCurrent * (1f - (float)Plugin.CfgValueLoss.Value / 100f))); float value = Plugin.CfgMassMultiplier.Value; if (MP) { photonView.RPC("HuissierSealRPC", (RpcTarget)0, new object[3] { p.photonView.ViewID, num, value }); } else { HuissierSealRPC(p.photonView.ViewID, num, value); } Plugin.Log.LogInfo((object)$"[Huissier] SAISI: {((Object)val).name} {val.dollarValueCurrent:0} -> {num:0}"); } } [PunRPC] private void HuissierSealRPC(int viewID, float newValue, float massMult, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { Seals.Apply(viewID, newValue, massMult); } } internal void Unseal(PhysGrabObject p) { //IL_0051: 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) if (Master && Object.op_Implicit((Object)(object)p)) { if (MP) { photonView.RPC("HuissierUnsealRPC", (RpcTarget)0, new object[1] { p.photonView.ViewID }); } else { HuissierUnsealRPC(p.photonView.ViewID); } Plugin.Log.LogInfo((object)("[Huissier] Seal torn off " + ((Object)p).name)); } } [PunRPC] private void HuissierUnsealRPC(int viewID, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { Seals.Tear(viewID); } } private void RpcStamp(Vector3 pos) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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("HuissierStampRPC", (RpcTarget)0, new object[1] { pos }); } else { HuissierStampRPC(pos); } } [PunRPC] private void HuissierStampRPC(Vector3 pos, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: 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_0023: 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) if (SemiFunc.MasterOnlyRPC(info)) { Sounds.Play(Sounds.StampSlam, pos, 0.55f, 1.25f); Sounds.Play(Sounds.Seal, pos, 0.8f); if (Object.op_Implicit((Object)(object)GameDirector.instance) && Object.op_Implicit((Object)(object)GameDirector.instance.CameraShake)) { GameDirector.instance.CameraShake.ShakeDistance(3f, 2f, 8f, pos, 0.25f); } } } private void StartConfiscate(PhysGrabObject p) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)p) || Object.op_Implicit((Object)(object)carried)) { return; } targetItem = p; int viewID = p.photonView.ViewID; foreach (PhysGrabber item in p.playerGrabbing.ToList()) { if (Object.op_Implicit((Object)(object)item)) { if (SemiFunc.IsMultiplayer()) { item.ReleaseObject(viewID, 1.5f); } else { item.OverrideGrabRelease(viewID, 1.5f); } } } carried = p; archived.Remove(viewID); if (MP) { photonView.RPC("HuissierStashRPC", (RpcTarget)0, new object[2] { viewID, true }); } else { HuissierStashRPC(viewID, hide: true); } SetState(State.Confiscate); Plugin.Log.LogInfo((object)("[Huissier] Confiscated " + ((Object)p).name + " -> archives at " + ((object)Unsafe.As<Vector3, Vector3>(ref archivePos)/*cast due to .constrained prefix*/).ToString())); } [PunRPC] private void HuissierStashRPC(int viewID, bool hide, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: 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_001c: 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) //IL_005f: 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) if (SemiFunc.MasterOnlyRPC(info)) { Vector3 pos = (Object.op_Implicit((Object)(object)erb) ? ((Component)erb).transform.position : ((Component)this).transform.position); if (hide) { Sounds.Play(Sounds.Stash, pos, 0.8f); Stash.Hide(viewID, (MonoBehaviour)(object)this, mouth); } else { Sounds.Play(Sounds.Deposit, pos, 0.7f); Stash.Show(viewID); } } } private void DepositCarried() { //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_0023: 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_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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_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_0081: 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) if (Object.op_Implicit((Object)(object)carried)) { Vector3 val = Flat(((Component)erb).transform.forward); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = ((Component)erb).transform.position + normalized * 0.75f; NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(val2, ref val3, 1.5f, -1)) { val2 = ((NavMeshHit)(ref val3)).position; } Release(carried, val2 + Vector3.up * 0.45f, Vector3.zero); archived.Add(carried.photonView.ViewID); carried = null; } } private void SpillCarried() { //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_0023: 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_002b: 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_0043: 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) //IL_004e: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0072: 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_0081: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)carried)) { Vector3 val = Flat(((Component)erb).transform.forward); Vector3 normalized = ((Vector3)(ref val)).normalized; Release(carried, ((Component)erb).transform.position + normalized * 0.5f + Vector3.up * 0.7f, normalized * 1.5f + Vector3.up * 2f); carried = null; } } private void Release(PhysGrabObject p, Vector3 pos, Vector3 vel) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //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_0043: 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_009f: Unknown result type (might be due to invalid IL or missing references) int viewID = p.photonView.ViewID; if (Object.op_Implicit((Object)(object)p.rb)) { p.rb.position = pos; ((Component)p).transform.position = pos; p.rb.linearVelocity = vel; p.rb.angularVelocity = Vector3.zero; } p.OverrideIndestructible(2f); p.OverrideBreakEffects(2f); if (MP) { photonView.RPC("HuissierStashRPC", (RpcTarget)0, new object[2] { viewID, false }); } else { HuissierStashRPC(viewID, hide: false); } } private void ChooseArchive() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_011f: 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) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (archiveSet) { return; } LevelGenerator instance = LevelGenerator.Instance; Vector3 val = ((Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.LevelPathTruck)) ? ((Component)instance.LevelPathTruck).transform.position : ((Component)erb).transform.position); float num = -1f; Vector3 position = ((Component)erb).transform.position; if (Object.op_Implicit((Object)(object)instance) && instance.LevelPathPoints != null) { foreach (LevelPoint levelPathPoint in instance.LevelPathPoints) { if (Object.op_Implicit((Object)(object)levelPathPoint) && !levelPathPoint.Truck) { float num2 = Vector3.Distance(((Component)levelPathPoint).transform.position, val); if (num2 > num) { num = num2; position = ((Component)levelPathPoint).transform.position; } } } } archivePos = position; archiveSet = true; if (MP) { photonView.RPC("HuissierArchiveRPC", (RpcTarget)0, new object[1] { archivePos }); } else { HuissierArchiveRPC(archivePos); } Plugin.Log.LogInfo((object)$"[Huissier] Archives set at {archivePos} ({num:0} m from the truck)."); } [PunRPC] private void HuissierArchiveRPC(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) //IL_000b: 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_004d: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_009e: 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_00a9: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MasterOnlyRPC(info)) { return; } archivePos = pos; archiveSet = true; if (Object.op_Implicit((Object)(object)archiveMarker)) { Object.Destroy((Object)(object)archiveMarker); } if (!((Object)(object)PrefabBuilder.SealMesh == (Object)null)) { archiveMarker = new GameObject("Huissier Archives"); Vector3 val = pos; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(pos + Vector3.up * 0.5f, Vector3.down, ref val2, 3f, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1)) { val = ((RaycastHit)(ref val2)).point; } archiveMarker.transform.position = val + Vector3.up * 0.012f; archiveMarker.transform.rotation = Quaternion.Euler(-90f, Random.Range(0f, 360f), 0f); archiveMarker.transform.localScale = Vector3.one * 7f; archiveMarker.AddComponent<MeshFilter>().sharedMesh = PrefabBuilder.SealMesh; MeshRenderer obj = archiveMarker.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = PrefabBuilder.StampFloorMaterial; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; } } private void GrabTick(float dt) { //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) List<PhysGrabber> playerGrabbing = erb.physGrabObject.playerGrabbing; if (!Plugin.CfgGrabAnger.Value || playerGrabbing.Count == 0 || state == State.Stunned || state == State.Spawn) { grabTime = 0f; } else { if ((grabTime += dt) < 0.25f) { return; } grabTime = 0f; PlayerAvatar val = null; int viewID = erb.physGrabObject.photonView.ViewID; foreach (PhysGrabber item in playerGrabbing.ToList()) { if (Object.op_Implicit((Object)(object)item)) { if (!Object.op_Implicit((Object)(object)val) && ValidPlayer(item.playerAvatar)) { val = item.playerAvatar; } if (SemiFunc.IsMultiplayer()) { item.ReleaseObject(viewID, 1.5f); } else { item.OverrideGrabRelease(viewID, 1.5f); } } } if (Object.op_Implicit((Object)(object)val)) { Plugin.Log.LogInfo((object)("[Huissier] Grabbed by " + val.playerName + ": angry.")); targetPlayer = val; angry = true; angryLose = 0f; angryEnd = Time.time + Plugin.CfgAngryTime.Value; angryLastSeen = ((Component)val).transform.position; if (state == State.Angry) { SyncState(); } else if (state != State.Riposte && state != State.Stunned) { SetState(State.Angry); } } } } private void AngerTick(float dt) { //IL_004e: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00e3: 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_010b: Unknown result type (might be due to invalid IL or missing references) if (!angry) { return; } if (!ValidPlayer(targetPlayer) || Time.time > angryEnd) { EndAnger((Time.time > angryEnd) ? "time limit" : "target gone"); return; } Vector3 val = ((Component)erb).transform.position + Vector3.up * 0.9f; Vector3 val2 = ((Component)targetPlayer).transform.position + Vector3.up * 1.4f; int mask = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) & ~LayerMask.GetMask(new string[3] { "Player", "PhysGrabObject", "Enemy" }); if (ClearLine(val, val2, mask)) { angryLose = 0f; angryLastSeen = ((Component)targetPlayer).transform.position; } else { angryLose += dt; } if (angryLose > Plugin.CfgLoseSight.Value || Vector3.Distance(val, val2) > Plugin.CfgLoseDistance.Value) { EndAnger("shaken off"); } } private void EndAnger(string why) { if (angry) { angry = false; angryHit = false; Plugin.Log.LogInfo((object)("[Huissier] Calms down (" + why + ").")); if (state == State.Angry) { SetState((!Object.op_Implicit((Object)(object)carried)) ? State.Patrol : State.Carry); } } } internal void HeavyHit(PhysGrabObject by, float speed) { if (enemy.HasStateStunned && !enemy.IsStunned()) { enemy.StateStunned.Set(Plugin.CfgStunDuration.Value); Plugin.Log.LogInfo((object)$"[Huissier] Stunned by {((Object)by).name} ({by.rb.mass:0.0} kg at {speed:0.0} m/s)"); } } private void RiposteHit() { //IL_0016: 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_002b: 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_0031: 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_0037: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_014e: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = targetPlayer; if (!ValidPlayer(val)) { return; } Vector3 v = ((Component)val).transform.position - ((Component)erb).transform.position; Vector3 val2 = Flat(v); if (((Vector3)(ref val2)).magnitude > 2.3f) { return; } val2 = Flat(((Component)erb).transform.forward); Vector3 normalized = ((Vector3)(ref val2)).normalized; val2 = Flat(v); if (!(Vector3.Dot(normalized, ((Vector3)(ref val2)).normalized) < 0.2f)) { int num = (angryHit ? Plugin.CfgGrabDamage.Value : Plugin.CfgCounterDamage.Value); angryHit = false; if (num > 0) { val.playerHealth.HurtOther(num, ((Component)val).transform.position + Vector3.up, false, SemiFunc.EnemyGetIndex(enemy), false); } val2 = Flat(v); val.ForceImpulse(((Vector3)(ref val2)).normalized * 5f + Vector3.up * 2f); if (MP) { photonView.RPC("HuissierFineRPC", (RpcTarget)0, new object[1] { val.photonView.ViewID }); } else { HuissierFineRPC(val.photonView.ViewID); } } } [PunRPC] private void HuissierFineRPC(int playerViewID, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: 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_001c: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MasterOnlyRPC(info)) { return; } Vector3 pos = (Object.op_Implicit((Object)(object)erb) ? ((Component)erb).transform.position : ((Component)this).transform.position); Sounds.Play(Sounds.Hit, pos); PlayerAvatar val = SemiFunc.PlayerAvatarLocal(); if (Object.op_Implicit((Object)(object)val) && val.photonView.ViewID == playerViewID && Object.op_Implicit((Object)(object)PlayerController.instance)) { PlayerController.instance.OverrideSpeed(Plugin.CfgFineSpeed.Value, Plugin.CfgFineDuration.Value, -1f); if (Object.op_Implicit((Object)(object)GameDirector.instance) && Object.op_Implicit((Object)(object)GameDirector.instance.CameraShake)) { GameDirector.instance.CameraShake.Shake(4f, 0.35f); } } } private void SetState(State s) { if (s != state) { if (s == State.Riposte || s == State.Stunned) { resumeState = state; } ApplyState(s); SyncState(); } } private void SyncState() { if (MP) { photonView.RPC("HuissierStateRPC", (RpcTarget)1, new object[3] { (int)state, Object.op_Implicit((Object)(object)targetPlayer) ? targetPlayer.photonView.ViewID : (-1), (Object.op_Implicit((Object)(object)targetItem) && Object.op_Implicit((Object)(object)targetItem.photonView)) ? targetItem.photonView.ViewID : (-1) }); } } [PunRPC] private void HuissierStateRPC(int s, int playerID, int itemID, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MasterOnlyRPC(info)) { return; } targetPlayer = null; targetItem = null; if (playerID >= 0) { PhotonView val = PhotonView.Find(playerID); if (Object.op_Implicit((Object)(object)val)) { targetPlayer = ((Component)val).GetComponent<PlayerAvatar>(); } } if (itemID >= 0) { PhotonView val2 = PhotonView.Find(itemID); if (Object.op_Implicit((Object)(object)val2)) { targetItem = ((Component)val2).GetComponent<PhysGrabObject>(); } } if (s != (int)state) { ApplyState((State)s); } } private void ApplyState(State s) { //IL_0050: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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; Vector3 pos = (Object.op_Implicit((Object)(object)erb) ? ((Component)erb).transform.position : ((Component)this).transform.position); if (Master) { Plugin.Log.LogInfo((object)($"[Huissier] {state} -> {s}" + (Object.op_Implicit((Object)(object)targetItem) ? (" (item: " + ((Object)targetItem).name + ")") : "") + (Object.op_Implicit((Object)(object)targetPlayer) ? (" (player: " + targetPlayer.playerName + ")") : ""))); } switch (s) { case State.Spawn: Sounds.Play(Sounds.Spawn, pos, 0.7f); break; case State.Inspect: Sounds.Play(Sounds.Notice, pos, 0.6f); break; case State.Stunned: Sounds.Play(Sounds.Stun, pos); break; case State.Angry: Sounds.Play(Sounds.StampSlam, pos, 1f, 0.8f); Sounds.Play(Sounds.Notice, pos, 0.9f, 0.75f); break; case State.Patrol: if (state == State.Stunned) { Sounds.Play(Sounds.StunOutro, pos, 0.8f); } break; } } private void OnSpawn() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0099: 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) eyeGlow = 0f; if (Object.op_Implicit((Object)(object)erb)) { lastVisPos = ((Component)erb).transform.position; } if (!Master) { return; } angry = false; bool flag = Time.time < SkipTeleportUntil; if (flag) { SkipTeleportUntil = 0f; } if (!flag && Plugin.TryFarLevelPoint(out var pos)) { enemy.EnemyTeleported(pos); flag = true; } if (!flag) { flag = SemiFunc.EnemySpawn(enemy); } if (flag) { Plugin.Log.LogInfo((object)("[Huissier] Spawned at " + ((object)((Component)erb).transform.position/*cast due to .constrained prefix*/).ToString())); targetItem = null; targetPlayer = null; if (state == State.Spawn) { stateImpulse = true; stateTimer = 0f; stateTime = 0f; } else { SetState(State.Spawn); } } } 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); if (Object.op_Implicit((Object)(object)carried)) { SpillCarried(); } targetItem = null; targetPlayer = null; angry = false; SetState(State.Spawn); } private void OnHurt() { //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_0016: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00db: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)erb).transform.position; Sounds.Play(Sounds.Hurt, position, 0.8f); flicker = 0.25f; if (!Master || state == State.Stunned || state == State.Riposte || riposteCooldown > 0f) { return; } PlayerAvatar val = health.onObjectHurtPlayer; if (!ValidPlayer(val) || Vector3.Distance(((Component)val).transform.position, position) > 3.5f) { val = SemiFunc.PlayerGetNearestPlayerAvatarWithinRange(3f, position, false, default(LayerMask)); } if (ValidPlayer(val)) { Vector3 val2 = Flat(((Component)val).transform.position - position); Vector3 val3 = Flat(((Component)erb).transform.forward); if (!(Vector3.Dot(((Vector3)(ref val3)).normalized, ((Vector3)(ref val2)).normalized) < 0.25f)) { targetPlayer = val; riposteCooldown = 2.5f; SetState(State.Riposte); } } } 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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) //IL_005e: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)erb).transform.position; Sounds.Play(Sounds.Death, position); Sounds.Play(Sounds.DeathSpark, position, 0.9f); if (Object.op_Implicit((Object)(object)particles)) { particles.position = position + Vector3.up * 0.8f; ParticleSystem[] componentsInChildren = ((Component)particles).GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].Play(true); } } if (Master) { if (Object.op_Implicit((Object)(object)carried)) { SpillCarried(); } 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 target, float speed, float dt) { return Mathf.Lerp(c, target, 1f - Mathf.Exp((0f - speed) * dt)); } private static float Smooth(float a, float b, float x) { float num = Mathf.Clamp01((x - a) / (b - a)); return num * num * (3f - 2f * num); } private void P(string j, float x, float y = 0f, float z = 0f) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) pose[j] = new Vector3(x, y, z); } private void Blend(string j, float x, float y, float z, float w) { //IL_0017: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) Vector3 value; Vector3 val = (pose.TryGetValue(j, out value) ? value : Vector3.zero); pose[j] = Vector3.Lerp(val, new Vector3(x, y, z), w); } 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: 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_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: 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_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0524: 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_0530: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0138: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_0e8d: Unknown result type (might be due to invalid IL or missing references) //IL_0e92: Unknown result type (might be due to invalid IL or missing references) //IL_0ecd: Unknown result type (might be due to invalid IL or missing references) //IL_0f2e: Unknown result type (might be due to invalid IL or missing references) //IL_0f39: Unknown result type (might be due to invalid IL or missing references) //IL_0f3e: Unknown result type (might be due to invalid IL or missing references) //IL_0f4f: Unknown result type (might be due to invalid IL or missing references) //IL_0f54: Unknown result type (might be due to invalid IL or missing references) //IL_108a: Unknown result type (might be due to invalid IL or missing references) //IL_1095: 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 val = Flat(position - lastVisPos); lastVisPos = position; float num = ((Vector3)(ref val)).magnitude / dt; if (num > 15f) { num = 0f; } bodySpeed = Damp(bodySpeed, num, 8f, dt); float num2 = Mathf.Clamp01(bodySpeed / 1.4f); walkPhase += ((Vector3)(ref val)).magnitude / 1.7f * (float)Math.PI * 2f * ((num > 15f) ? 0f : 1f); float num3 = Mathf.Sin(walkPhase); float num4 = Mathf.Cos(walkPhase); if (num2 > 0.25f && Mathf.Sign(num3) != Mathf.Sign(lastStepSin) && state != State.Stunned) { Vector3 pos = position + ((Component)erb).transform.right * ((num3 > 0f) ? 0.1f : (-0.1f)) - Vector3.up * 0.45f; Sounds.Play(Sounds.Footstep, pos, 0.55f, 0.9f); Sounds.Play(Sounds.StepClick, pos, 0.18f, 1.3f); } lastStepSin = num3; pose.Clear(); float num5 = 24f * num2; float num6 = 38f * num2; P("thigh_l", (0f - num5) * num3 - 2f); P("thigh_r", num5 * num3 - 2f); P("shin_l", num6 * Mathf.Pow(Mathf.Max(0f, num4), 1.3f) + 4f * num2); P("shin_r", num6 * Mathf.Pow(Mathf.Max(0f, 0f - num4), 1.3f) + 4f * num2); P("foot_l", (0f - (pose["thigh_l"].x + pose["shin_l"].x)) * 0.85f); P("foot_r", (0f - (pose["thigh_r"].x + pose["shin_r"].x)) * 0.85f); P("pelvis", 0f, 5f * num2 * num3); P("torso", 3f + 4f * num2, -6f * num2 * num3); P("upperarm_l", 14f * num2 * num3 + 2f, 0f, -7f); P("forearm_l", -5f - 6f * num2 * Mathf.Max(0f, 0f - num3)); P("briefcase", -9f * num2 * num4); P("upperarm_r", -24f - 4f * num2 * num3, 0f, 5f); P("forearm_r", -62f); P("hat", 1.5f * num2 * num4); float num7 = -0.02f * num2 * Mathf.Abs(num4); Vector3 val2 = Vector3.zero; bool flag = false; if (Object.op_Implicit((Object)(object)targetItem) && (state == State.Stamp || state == State.Wait || state == State.Confiscate || state == State.Patrol)) { val2 = targetItem.midPoint; flag = true; } if (ValidPlayer(targetPlayer) && (state == State.Inspect || state == State.Riposte)) { val2 = ((Component)targetPlayer).transform.position + Vector3.up * 1f; flag = true; } float target = 0f; float target2 = 0f; if (flag && J.TryGetValue("torso", out var _)) { Vector3 val3 = visuals.InverseTransformDirection(val2 - J["head"].position); target = Mathf.Clamp(Mathf.Atan2(val3.x, val3.z) * 57.29578f, -55f, 55f); float y = val3.y; Vector2 val4 = new Vector2(val3.x, val3.z); target2 = Mathf.Clamp((0f - Mathf.Atan2(y, ((Vector2)(ref val4)).magnitude)) * 57.29578f, -25f, 40f); } if (state == State.Spawn) { target = 40f * Mathf.Sin(stateTime * 3f); } headYaw = Damp(headYaw, target, 7f, dt); headPitch = Damp(headPitch, target2, 7f, dt); P("head", headPitch - 2f * num2 * num4, headYaw); float num8 = stateTime; switch (state) { case State.Inspect: { float w8 = Smooth(0f, 0.3f, num8); Blend("torso", 9f, 0f, 0f, w8); Blend("upperarm_r", -40f, 0f, 6f, w8); Blend("forearm_r", -70f, 0f, 0f, w8); break; } case State.Stamp: { float num11 = (Object.op_Implicit((Object)(object)targetItem) ? Mathf.Clamp01((targetItem.midPoint.y - (position.y - 0.5f)) / 1.3f) : 0.6f); float num12 = Mathf.Lerp(42f, 6f, num11); float w7 = Smooth(0f, 0.42f, num8) * (1f - Smooth(0.42f, 0.55f, num8)); float num13 = Smooth(0.42f, 0.55f, num8) * (1f - Smooth(0.75f, 1f, num8)); Blend("upperarm_r", -155f, 0f, 8f, w7); Blend("forearm_r", -20f, 0f, 0f, w7); Blend("torso", -6f, 0f, 0f, w7); Blend("upperarm_r", -62f - num12 * 0.5f, 0f, 4f, num13); Blend("forearm_r", -18f, 0f, 0f, num13); Blend("torso", num12, 0f, 0f, num13); Blend("head", 20f, 0f, 0f, num13); Blend("thigh_l", -18f, 0f, 0f, num13 * (1f - num11)); Blend("thigh_r", -18f, 0f, 0f, num13 * (1f - num11)); Blend("shin_l", 30f, 0f, 0f, num13 * (1f - num11)); Blend("shin_r", 30f, 0f, 0f, num13 * (1f - num11)); num7 -= 0.06f * num13 * (1f - num11); break; } case State.Wait: { float w6 = Smooth(0.1f, 0.4f, num8) * (1f - Smooth(1.1f, 1.5f, num8)); Blend("head", 22f, 0f, 0f, w6); Blend("torso", 8f, 0f, 0f, w6); Blend("hat", -28f, 0f, 0f, w6); break; } case State.Confiscate: { float w5 = Smooth(0f, 0.25f, num8) * (1f - Smooth(0.6f, 0.8f, num8)); Blend("upperarm_l", -72f, 0f, -12f, w5); Blend("forearm_l", -40f, 0f, 0f, w5); Blend("briefcase", 25f, 0f, 0f, w5); Blend("torso", 10f, -15f, 0f, w5); break; } case State.Deposit: { float num10 = Smooth(0f, 0.35f, num8) * (1f - Smooth(0.7f, 1f, num8)); Blend("upperarm_l", -55f, 0f, -10f, num10); Blend("forearm_l", -25f, 0f, 0f, num10); Blend("briefcase", 35f, 0f, 0f, num10); Blend("torso", 24f, 0f, 0f, num10); Blend("thigh_l", -22f, 0f, 0f, num10); Blend("thigh_r", -22f, 0f, 0f, num10); Blend("shin_l", 36f, 0f, 0f, num10); Blend("shin_r", 36f, 0f, 0f, num10); num7 -= 0.07f * num10; break; } case State.Angry: { float w4 = Smooth(0f, 0.3f, num8); Blend("upperarm_l", -70f, 0f, -20f, w4); Blend("forearm_l", -45f, 0f, 0f, w4); Blend("briefcase", 20f, 0f, 0f, w4); Blend("torso", 12f, 0f, 0f, w4); break; } case State.Riposte: { float w2 = Smooth(0f, 0.25f, num8) * (1f - Smooth(0.25f, 0.4f, num8)); float w3 = Smooth(0.25f, 0.4f, num8) * (1f - Smooth(0.55f, 0.8f, num8)); Blend("upperarm_l", 45f, 0f, -25f, w2); Blend("torso", 4f, 25f, 0f, w2); Blend("upperarm_l", -100f, 0f, -38f, w3); Blend("forearm_l", -20f, 0f, 0f, w3); Blend("torso", 6f, -30f, 0f, w3); Blend("briefcase", -40f, 0f, 0f, w3); break; } case State.Stunned: { float num9 = Smooth(0f, 0.3f, num8); Blend("torso", 28f, 6f * Mathf.Sin(t * 9f), 4f * Mathf.Sin(t * 7f), num9); Blend("head", 35f + 8f * Mathf.Sin(t * 13f), 15f * Mathf.Sin(t * 5f), 10f * Mathf.Sin(t * 11f), num9); Blend("upperarm_l", 6f, 0f, -12f, num9); Blend("upperarm_r", -6f, 0f, 10f, num9); Blend("forearm_r", -12f, 0f, 0f, num9); Blend("thigh_l", -14f, 0f, 0f, num9); Blend("thigh_r", -14f, 0f, 0f, num9); Blend("shin_l", 26f, 0f, 0f, num9); Blend("shin_r", 26f, 0f, 0f, num9); Blend("hat", -15f, 0f, 12f, num9); num7 -= 0.05f * num9; break; } case State.Spawn: { float w = 1f - Smooth(0.8f, 1.6f, num8); Blend("torso", 18f, 0f, 0f, w); Blend("head", 25f, 0f, 0f, w); break; } } foreach (KeyValuePair<string, Vector3> item in pose) { if (J.TryGetValue(item.Key, out var value2)) { value2.localRotation = Quaternion.Euler(item.Value); } } model.localPosition = new Vector3(0f, -0.5f + num7, 0f); Transform obj = J["hat"]; float num14 = ((state == State.Wait) ? (0.03f * Smooth(0.1f, 0.4f, num8) * (1f - Smooth(1.1f, 1.5f, num8))) : 0f); obj.localPosition = ModelLayout.Pivots[3] - ModelLayout.Pivots[2] + new Vector3(0f, num14, 0f); float num15 = 1f; if (state == State.Inspect) { num15 = 1f + 1.6f * Mathf.Clamp01(num8 / Plugin.CfgGazeTime.Value); } if (state == State.Stamp) { num15 = 2.4f; } if (state == State.Spawn) { num15 = Smooth(0.2f, 1.2f, num8) * ((Mathf.PerlinNoise(t * 20f, 0f) > 0.35f) ? 1f : 0.2f); } if (state == State.Stunned) { num15 = ((Mathf.PerlinNoise(t * 15f, 3f) > 0.5f) ? 0.7f : 0.05f); } if (flicker > 0f) { flicker -= dt; num15 *= ((Random.value > 0.5f) ? 1f : 0.15f); } eyeGlow = Damp(eyeGlow, num15, 14f, dt); if (Object.op_Implicit((Object)(object)headR) && eyeMat >= 0) { eyeMpb.SetColor(EmissionId, EyeBase * eyeGlow); headR.SetPropertyBlock(eyeMpb, eyeMat); } if (Object.op_Implicit((Object)(object)eyeLight)) { eyeLight.intensity = 0.9f * eyeGlow; } } } 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", "Bailiff" }, { "fr", "Huissier" }, { "de", "Gerichtsvollzieher" }, { "es", "Alguacil" }, { "es-419", "Alguacil" }, { "it", "Ufficiale Giudiziario" }, { "pt", "Oficial de Justiça" }, { "pt-BR", "Oficial de Justiça" }, { "ru", "Пристав" }, { "uk", "Пристав" }, { "pl", "Komornik" }, { "tr", "İcra Memuru" }, { "ja", "執行官" }, { "ko", "집행관" }, { "zh-Hans", "执行官" }, { "zh-Hant", "執行官" }, { "ar", "مأمور التنفيذ" }, { "da", "Foged" }, { "fi", "Ulosottomies" }, { "sv", "Kronofogde" }, { "th", "เจ\u0e49าพน\u0e31กงานบ\u0e31งค\u0e31บคด\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 (HuissierAI item in HuissierAI.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[16] { "pelvis", "torso", "head", "hat", "upperarm_l", "forearm_l", "briefcase", "upperarm_r", "forearm_r", "thigh_l", "shin_l", "foot_l", "thigh_r", "shin_r", "foot_r", "seal" }; public static readonly string[] Parents = new string[16] { "", "pelvis", "torso", "head", "torso", "upperarm_l", "forearm_l", "torso", "upperarm_r", "pelvis", "thigh_l", "shin_l", "pelvis", "thigh_r", "shin_r", "" }; public static readonly Vector3[] Pivots = (Vector3[])(object)new Vector3[16] { new Vector3(0f, 0.985f, 0f), new Vector3(0f, 1.04f, 0f), new Vector3(0f, 1.66f, 0f), new Vector3(0f, 1.925f, 0.01f), new Vector3(-0.203f, 1.552f, 0f), new Vector3(-0.212f, 1.222f, 0f), new Vector3(-0.216f, 0.867f, 0f), new Vector3(0.203f, 1.552f, 0f), new Vector3(0.212f, 1.222f, 0f), new Vector3(-0.095f, 0.985f, 0f), new Vector3(-0.095f, 0.545f, 0f), new Vector3(-0.095f, 0.085f, 0f), new Vector3(0.095f, 0.985f, 0f), new Vector3(0.095f, 0.545f, 0f), new Vector3(0.095f, 0.085f, 0f), new Vector3(0f, 0f, 0f) }; public const float StampFaceY = -0.4545f; public const float Height = 2.05f; } internal static class Sounds { public static Sound Footstep; public static Sound StepClick; public static Sound StampSlam; public static Sound StampClick; public static Sound Seal; public static Sound Stash; public static Sound Deposit; public static Sound Swing; public static Sound Hit; public static Sound Hurt; public static Sound Stun; public static Sound StunOutro; public static Sound Death; public static Sound DeathSpark; public static Sound Spawn; public static Sound Notice; public static Sound Tear; private static bool levelSoundsTried; 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; } } public static void TryLevelSounds() { if (levelSoundsTried && Seal != null) { return; } levelSoundsTried = true; try { ExtractionPoint val = Object.FindObjectOfType<ExtractionPoint>(); if ((Object)(object)val == (Object)null) { levelSoundsTried = false; return; } Seal = val.soundHaulDecrease; Stash = val.soundSuckEnd; if (StampSlam == null) { StampSlam = val.soundTubeSlam; } } catch (Exception ex) { Plugin.Log.LogDebug((object)("Level sounds: " + ex.Message)); } } } [BepInPlugin("maxime.repo.huissier", "Huissier", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string GUID = "maxime.repo.huissier"; public const string NAME = "Huissier"; 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> CfgCounterDamage; internal static ConfigEntry<int> CfgValueLoss; internal static ConfigEntry<float> CfgWalkSpeed; internal static ConfigEntry<float> CfgGazeRange; internal static ConfigEntry<float> CfgGazeTime; internal static ConfigEntry<float> CfgMassMultiplier; internal static ConfigEntry<float> CfgTearShake; internal static ConfigEntry<float> CfgFineSpeed; internal static ConfigEntry<float> CfgFineDuration; internal static ConfigEntry<float> CfgStunDuration; internal static ConfigEntry<float> CfgStunMass; internal static ConfigEntry<float> CfgStunSpeed; internal static ConfigEntry<bool> CfgSeizeBag; internal static ConfigEntry<bool> CfgDebugSpawn; internal static ConfigEntry<bool> CfgGrabAnger; internal static ConfigEntry<float> CfgAngrySpeed; internal static ConfigEntry<float> CfgAngryTime; internal static ConfigEntry<float> CfgLoseSight; internal static ConfigEntry<float> CfgLoseDistance; internal static ConfigEntry<float> CfgAngryHitCooldown; internal static ConfigEntry<int> CfgGrabDamage; 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("HuissierPrefabHolder"); 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