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 Minecart v1.0.0
Hcart.dll
Decompiled 6 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Hcart")] [assembly: AssemblyTitle("Hcart")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Hcart { [BepInPlugin("Omniscye.Hcart", "Hcart", "1.0")] public class Hcart : BaseUnityPlugin { internal static Hcart Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } } namespace Empress.CartSwap { [BepInPlugin("com.empress.repo.cart.poolswap", "Empress Cart Pool+SO Swap", "1.4.0")] public sealed class CartSwap_PoolAndSO : BaseUnityPlugin { private sealed class SwapPool : IPunPrefabPool { public readonly IPunPrefabPool Inner; private readonly string _targetId; private readonly GameObject _replacement; private readonly bool _enableAnimator; private readonly string _mode; private readonly string _boolPush; private readonly string _boolPull; private readonly string _floatSignedSpeed; private readonly string _trigForward; private readonly string _trigBackward; private readonly bool _useGrabberForward; private readonly float _speedThreshold; private readonly float _cooldown; public SwapPool(IPunPrefabPool inner, string targetId, GameObject replacement, bool enableAnimator, string mode, string boolPush, string boolPull, string floatSignedSpeed, string trigFwd, string trigBack, bool useGrabberForward, float speedThreshold, float cooldown) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) Inner = (IPunPrefabPool)(((object)inner) ?? ((object)new DefaultPool())); _targetId = targetId; _replacement = replacement; _enableAnimator = enableAnimator; _mode = (string.IsNullOrWhiteSpace(mode) ? "Bools" : mode); _boolPush = (string.IsNullOrWhiteSpace(boolPush) ? "IsPushing" : boolPush); _boolPull = (string.IsNullOrWhiteSpace(boolPull) ? "IsPulling" : boolPull); _floatSignedSpeed = (string.IsNullOrWhiteSpace(floatSignedSpeed) ? "SignedSpeed" : floatSignedSpeed); _trigForward = (string.IsNullOrWhiteSpace(trigFwd) ? "Forward" : trigFwd); _trigBackward = (string.IsNullOrWhiteSpace(trigBack) ? "Backwards" : trigBack); _useGrabberForward = useGrabberForward; _speedThreshold = Mathf.Max(0f, speedThreshold); _cooldown = Mathf.Clamp(cooldown, 0f, 5f); } public GameObject Instantiate(string prefabId, Vector3 position, Quaternion rotation) { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) try { if (string.Equals(prefabId, _targetId, StringComparison.Ordinal) || (prefabId != null && _targetId.EndsWith(prefabId, StringComparison.Ordinal))) { GameObject val = Object.Instantiate<GameObject>(_replacement, position, rotation); if (val.activeSelf) { val.SetActive(false); } if (_enableAnimator && Object.op_Implicit((Object)(object)val)) { CartPushPullAnimator cartPushPullAnimator = val.GetComponent<CartPushPullAnimator>() ?? val.AddComponent<CartPushPullAnimator>(); cartPushPullAnimator.fireMode = (string.Equals(_mode, "Triggers", StringComparison.OrdinalIgnoreCase) ? CartPushPullAnimator.FireMode.Triggers : CartPushPullAnimator.FireMode.Bools); cartPushPullAnimator.boolPushing = _boolPush; cartPushPullAnimator.boolPulling = _boolPull; cartPushPullAnimator.floatSignedSpeed = _floatSignedSpeed; cartPushPullAnimator.triggerForward = _trigForward; cartPushPullAnimator.triggerBackward = _trigBackward; cartPushPullAnimator.speedThreshold = _speedThreshold; cartPushPullAnimator.retriggerCooldown = _cooldown; cartPushPullAnimator.useGrabberForward = _useGrabberForward; } return val; } } catch (Exception arg) { ManualLogSource logS = LogS; if (logS != null) { logS.LogError((object)$"SwapPool Instantiate error: {arg}"); } } return Inner.Instantiate(prefabId, position, rotation); } public void Destroy(GameObject gameObject) { Inner.Destroy(gameObject); } } [CompilerGenerated] private sealed class <InitLate>d__26 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CartSwap_PoolAndSO <>4__this; private int <i>5__1; private int <i>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <InitLate>d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <i>5__1 = 0; goto IL_005e; case 1: <>1__state = -1; <i>5__1++; goto IL_005e; case 2: { <>1__state = -1; <i>5__2++; break; } IL_005e: if (<i>5__1 < 120) { <>2__current = null; <>1__state = 1; return true; } if (<>4__this._patchScriptableObjects.Value) { <>4__this.TryPatchItemScriptableObjects(); } if (<>4__this._wrapPhotonPool.Value) { <>4__this.TryWrapPhotonPool(); } <i>5__2 = 0; break; } if (<i>5__2 < 120) { <>2__current = null; <>1__state = 2; return true; } if (<>4__this._wrapPhotonPool.Value && !<>4__this._wrapped) { LogS.LogWarning((object)"Pool wasn’t wrapped yet; trying again..."); <>4__this.TryWrapPhotonPool(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const string PluginGuid = "com.empress.repo.cart.poolswap"; public const string PluginName = "Empress Cart Pool+SO Swap"; public const string PluginVersion = "1.4.0"; internal static ManualLogSource LogS; private ConfigEntry<string> _bundleFileName; private ConfigEntry<string> _replacementAssetName; private ConfigEntry<string> _resourcesPathId; private ConfigEntry<string> _itemNameMatch; private ConfigEntry<bool> _patchScriptableObjects; private ConfigEntry<bool> _wrapPhotonPool; private ConfigEntry<bool> _enableAnimatorDriver; private ConfigEntry<string> _animMode; private ConfigEntry<string> _animBoolPushing; private ConfigEntry<string> _animBoolPulling; private ConfigEntry<string> _animFloatSignedSpeed; private ConfigEntry<string> _animTriggerForward; private ConfigEntry<string> _animTriggerBackward; private ConfigEntry<float> _animSpeedThreshold; private ConfigEntry<float> _animRetriggerCooldown; private ConfigEntry<bool> _animUseGrabberForward; private AssetBundle _bundle; private GameObject _replacementPrefab; private IPunPrefabPool _originalPool; private bool _wrapped; private void Awake() { LogS = ((BaseUnityPlugin)this).Logger; _bundleFileName = ((BaseUnityPlugin)this).Config.Bind<string>("Cart", "BundleFileName", "hcart", "AssetBundle file name next to this DLL."); _replacementAssetName = ((BaseUnityPlugin)this).Config.Bind<string>("Cart", "ReplacementAssetName", "Item Cart Medium", "Prefab name inside your bundle."); _resourcesPathId = ((BaseUnityPlugin)this).Config.Bind<string>("Cart", "ResourcesPathId", "Items/Item Cart Medium", "Prefab ID used by Photon (usually Resources path)."); _itemNameMatch = ((BaseUnityPlugin)this).Config.Bind<string>("Cart", "ItemName", "Item Cart Medium", "Item.itemName to retarget (SO -> prefab)."); _patchScriptableObjects = ((BaseUnityPlugin)this).Config.Bind<bool>("Cart", "PatchScriptableObjects", true, "Also retarget Item ScriptableObject prefab for SP/direct instantiates."); _wrapPhotonPool = ((BaseUnityPlugin)this).Config.Bind<bool>("Cart", "WrapPhotonPool", true, "Wrap PhotonNetwork.PrefabPool to intercept this cart."); _enableAnimatorDriver = ((BaseUnityPlugin)this).Config.Bind<bool>("Cart.Animator", "EnableAnimatorDriver", true, "Attach a driver that feeds bools/triggers and a SignedSpeed float."); _animMode = ((BaseUnityPlugin)this).Config.Bind<string>("Cart.Animator", "Mode", "Bools", "Bools or Triggers."); _animBoolPushing = ((BaseUnityPlugin)this).Config.Bind<string>("Cart.Animator", "BoolPushingName", "IsPushing", "Animator bool for pushing forward."); _animBoolPulling = ((BaseUnityPlugin)this).Config.Bind<string>("Cart.Animator", "BoolPullingName", "IsPulling", "Animator bool for pulling backward."); _animFloatSignedSpeed = ((BaseUnityPlugin)this).Config.Bind<string>("Cart.Animator", "FloatSignedSpeedName", "SignedSpeed", "Animator float with signed speed along cart.forward."); _animTriggerForward = ((BaseUnityPlugin)this).Config.Bind<string>("Cart.Animator", "ForwardTriggerName", "Forward", "Animator Trigger name for pushing (used if Mode=Triggers)."); _animTriggerBackward = ((BaseUnityPlugin)this).Config.Bind<string>("Cart.Animator", "BackwardTriggerName", "Backwards", "Animator Trigger name for pulling (used if Mode=Triggers)."); _animSpeedThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("Cart.Animator", "SpeedThreshold", 0.25f, "Minimum |signed speed| along forward to consider push/pull."); _animRetriggerCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Cart.Animator", "RetriggerCooldown", 0.3f, "Seconds between trigger fires / bool flips."); _animUseGrabberForward = ((BaseUnityPlugin)this).Config.Bind<bool>("Cart.Animator", "UseGrabberForward", true, "If true, project velocity onto the grabber’s forward (else cart.forward)."); if (!LoadBundleAndPrefab()) { LogS.LogError((object)"Cart swap disabled: failed to load bundle or prefab."); } else { ((MonoBehaviour)this).StartCoroutine(InitLate()); } } private bool LoadBundleAndPrefab() { try { string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "."; string text = Path.Combine(path, _bundleFileName.Value); if (!File.Exists(text)) { LogS.LogError((object)("AssetBundle not found: " + text)); return false; } _bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_bundle == (Object)null) { LogS.LogError((object)("Failed to load AssetBundle: " + text)); return false; } _replacementPrefab = _bundle.LoadAsset<GameObject>(_replacementAssetName.Value); if ((Object)(object)_replacementPrefab == (Object)null) { LogS.LogError((object)("Prefab '" + _replacementAssetName.Value + "' not found in bundle '" + _bundleFileName.Value + "'.")); return false; } LogS.LogInfo((object)("Loaded replacement prefab '" + ((Object)_replacementPrefab).name + "' from '" + _bundleFileName.Value + "'.")); return true; } catch (Exception arg) { LogS.LogError((object)$"Bundle load error: {arg}"); return false; } } [IteratorStateMachine(typeof(<InitLate>d__26))] private IEnumerator InitLate() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <InitLate>d__26(0) { <>4__this = this }; } private void TryPatchItemScriptableObjects() { try { Item[] array = Resources.FindObjectsOfTypeAll<Item>(); int num = 0; Item[] array2 = array; foreach (Item val in array2) { if (!((Object)(object)val == (Object)null) && (string.Equals(val.itemName, _itemNameMatch.Value, StringComparison.Ordinal) || string.Equals(val.itemAssetName, _replacementAssetName.Value, StringComparison.Ordinal)) && (Object)(object)val.prefab != (Object)(object)_replacementPrefab) { val.prefab = _replacementPrefab; num++; } } LogS.LogInfo((object)$"Retargeted {num} Item ScriptableObject(s) to prefab '{((Object)_replacementPrefab).name}'."); } catch (Exception arg) { LogS.LogError((object)$"SO retarget failed: {arg}"); } } private void TryWrapPhotonPool() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown try { if (PhotonNetwork.PrefabPool == null) { PhotonNetwork.PrefabPool = (IPunPrefabPool)new DefaultPool(); } if (!_wrapped) { _originalPool = PhotonNetwork.PrefabPool; PhotonNetwork.PrefabPool = (IPunPrefabPool)(object)new SwapPool(_originalPool, _resourcesPathId.Value, _replacementPrefab, _enableAnimatorDriver.Value, _animMode.Value, _animBoolPushing.Value, _animBoolPulling.Value, _animFloatSignedSpeed.Value, _animTriggerForward.Value, _animTriggerBackward.Value, _animUseGrabberForward.Value, _animSpeedThreshold.Value, _animRetriggerCooldown.Value); _wrapped = true; LogS.LogInfo((object)("Wrapped Photon PrefabPool. Will swap '" + _resourcesPathId.Value + "' -> '" + ((Object)_replacementPrefab).name + "'.")); } } catch (Exception arg) { LogS.LogError((object)$"Pool wrap failed: {arg}"); } } private void OnDestroy() { try { if (_wrapped && PhotonNetwork.PrefabPool is SwapPool swapPool && swapPool.Inner == _originalPool) { PhotonNetwork.PrefabPool = _originalPool; } } catch { } try { AssetBundle bundle = _bundle; if (bundle != null) { bundle.Unload(false); } } catch { } _bundle = null; _replacementPrefab = null; } } [DisallowMultipleComponent] internal sealed class CartPushPullAnimator : MonoBehaviour { public enum FireMode { Bools, Triggers } [Header("Animator params")] public FireMode fireMode = FireMode.Bools; public string boolPushing = "IsPushing"; public string boolPulling = "IsPulling"; public string triggerForward = "Forward"; public string triggerBackward = "Backwards"; public string floatSignedSpeed = "SignedSpeed"; [Header("Motion")] public float speedThreshold = 0.25f; public float retriggerCooldown = 0.25f; public bool useGrabberForward = true; private Animator _anim; private Rigidbody _rb; private Component _grabArea; private Component _cartComp; private float _lastFire; private bool _lastPush; private bool _lastPull; private Vector3 _lastPos; private void Awake() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) _anim = ((Component)this).GetComponentInChildren<Animator>(true) ?? ((Component)this).GetComponent<Animator>(); _rb = ((Component)this).GetComponent<Rigidbody>() ?? ((Component)this).GetComponentInParent<Rigidbody>(); _grabArea = FindByTypeName("PhysGrabObjectGrabArea"); _cartComp = FindByTypeName("PhysGrabCart"); _lastPos = ((Component)this).transform.position; } private Component FindByTypeName(string typeName) { Component[] componentsInChildren = ((Component)this).GetComponentsInChildren<Component>(true); foreach (Component val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && ((object)val).GetType().Name == typeName) { return val; } } Component[] componentsInParent = ((Component)this).GetComponentsInParent<Component>(true); foreach (Component val2 in componentsInParent) { if (Object.op_Implicit((Object)(object)val2) && ((object)val2).GetType().Name == typeName) { return val2; } } return null; } private void Update() { //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) //IL_00a5: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_anim)) { return; } if (!IsGrabbed(out Transform grabberForwardRef)) { if (fireMode == FireMode.Bools) { if (_anim.HasParameterOfType(boolPulling, (AnimatorControllerParameterType)4)) { _anim.SetBool(boolPulling, false); } if (_anim.HasParameterOfType(boolPushing, (AnimatorControllerParameterType)4)) { _anim.SetBool(boolPushing, false); } } return; } Vector3 velocity = GetVelocity(); Vector3 forward = ((Component)this).transform.forward; if (useGrabberForward && Object.op_Implicit((Object)(object)grabberForwardRef)) { forward = grabberForwardRef.forward; } float num = Vector3.Dot(velocity, forward); if (_anim.HasParameterOfType(floatSignedSpeed, (AnimatorControllerParameterType)1)) { _anim.SetFloat(floatSignedSpeed, num); } bool boolField = GetBoolField(_cartComp, "cartBeingPulled"); bool flag = num > speedThreshold && !boolField; bool flag2 = num < 0f - speedThreshold || boolField; float time = Time.time; if (fireMode == FireMode.Bools) { if (_anim.HasParameterOfType(boolPushing, (AnimatorControllerParameterType)4)) { _anim.SetBool(boolPushing, flag); } if (_anim.HasParameterOfType(boolPulling, (AnimatorControllerParameterType)4)) { _anim.SetBool(boolPulling, flag2); } } else { if (flag && !_lastPush && time - _lastFire >= retriggerCooldown) { if (_anim.HasParameterOfType(triggerBackward, (AnimatorControllerParameterType)9)) { _anim.ResetTrigger(triggerBackward); } if (_anim.HasParameterOfType(triggerForward, (AnimatorControllerParameterType)9)) { _anim.SetTrigger(triggerForward); } _lastFire = time; } if (flag2 && !_lastPull && time - _lastFire >= retriggerCooldown) { if (_anim.HasParameterOfType(triggerForward, (AnimatorControllerParameterType)9)) { _anim.ResetTrigger(triggerForward); } if (_anim.HasParameterOfType(triggerBackward, (AnimatorControllerParameterType)9)) { _anim.SetTrigger(triggerBackward); } _lastFire = time; } } _lastPush = flag; _lastPull = flag2; } private Vector3 GetVelocity() { //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_003d: 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_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_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) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_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_0069: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_rb) && !_rb.isKinematic) { return _rb.velocity; } Vector3 position = ((Component)this).transform.position; Vector3 result = (position - _lastPos) / Mathf.Max(Time.deltaTime, 0.0001f); _lastPos = position; return result; } private bool IsGrabbed(out Transform grabberForwardRef) { grabberForwardRef = null; if ((Object)(object)_grabArea == (Object)null) { return false; } try { Type type = ((object)_grabArea).GetType(); FieldInfo field = type.GetField("listOfAllGrabbers", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { return false; } if (!(field.GetValue(_grabArea) is IEnumerable enumerable)) { return false; } Transform val = null; foreach (object item in enumerable) { if (item == null) { continue; } Type type2 = item.GetType(); bool boolField = GetBoolField(item, "isLocal"); Transform val2 = null; FieldInfo field2 = type2.GetField("transform", BindingFlags.Instance | BindingFlags.Public); if (field2 != null) { object? value = field2.GetValue(item); val2 = (Transform)((value is Transform) ? value : null); } else { PropertyInfo property = type2.GetProperty("transform", BindingFlags.Instance | BindingFlags.Public); if (property != null) { object? value2 = property.GetValue(item, null); val2 = (Transform)((value2 is Transform) ? value2 : null); } } if (Object.op_Implicit((Object)(object)val2)) { if (boolField) { grabberForwardRef = val2; return true; } if (!Object.op_Implicit((Object)(object)val)) { val = val2; } } } if (Object.op_Implicit((Object)(object)val)) { grabberForwardRef = val; return true; } } catch { } return false; } private static bool GetBoolField(object obj, string name) { if (obj == null) { return false; } try { FieldInfo field = obj.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object value = field.GetValue(obj); bool flag = default(bool); int num; if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } } catch { } return false; } } internal static class AnimatorParamUtil { private static readonly Dictionary<(Animator, string), AnimatorControllerParameterType> cache = new Dictionary<(Animator, string), AnimatorControllerParameterType>(); public static bool HasParameterOfType(this Animator self, string name, AnimatorControllerParameterType type) { //IL_008b: 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_003b: 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_0067: 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) if (!Object.op_Implicit((Object)(object)self) || string.IsNullOrEmpty(name)) { return false; } (Animator, string) key = (self, name); if (!cache.TryGetValue(key, out var value)) { value = (AnimatorControllerParameterType)(-1); AnimatorControllerParameter[] parameters = self.parameters; foreach (AnimatorControllerParameter val in parameters) { if (val.name == name) { value = val.type; break; } } cache[key] = value; } return value == type; } } }