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 MergedUpgrades v1.0.1
MergedUpgrades.dll
Decompiled 2 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.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ee6d99a477f142df0010e7f5c8c3bd67b4b5b005")] [assembly: AssemblyProduct("MergedUpgrades")] [assembly: AssemblyTitle("MergedUpgrades")] [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 Empress.Synthesis { [BepInPlugin("Empress.Synthesis", "Empress Synthesis", "1.0.0")] public class SynthesisPlugin : BaseUnityPlugin { internal static SynthesisPlugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_004d: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); ((MonoBehaviour)this).StartCoroutine(SynthesisAudio.LoadNearDll(((BaseUnityPlugin)this).Info.Location)); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded"); } private void OnDestroy() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(ItemUpgrade), "Start")] internal static class Patch_ItemUpgrade_Start { private static void Postfix(ItemUpgrade __instance) { if (!Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<SynthesisNode>())) { ((Component)__instance).gameObject.AddComponent<SynthesisNode>(); } } } [HarmonyPatch(typeof(ItemAttributes), "ShowInfo")] internal static class Patch_ItemAttributes_ShowInfo_NameMirror { private static void Prefix(ref string ___itemName, string ___instanceName) { if (!string.IsNullOrEmpty(___instanceName)) { int num = ___instanceName.IndexOf('/'); ___itemName = ((num >= 0) ? ___instanceName.Substring(0, num) : ___instanceName); } } } [HarmonyPatch(typeof(ItemAttributes), "ShowingInfo")] internal static class Patch_ItemAttributes_ShowingInfo_NameMirror { private static void Prefix(ref string ___itemName, string ___instanceName) { if (!string.IsNullOrEmpty(___instanceName)) { int num = ___instanceName.IndexOf('/'); ___itemName = ((num >= 0) ? ___instanceName.Substring(0, num) : ___instanceName); } } } public enum KnownUpgrade { None, Energy, SprintSpeed, Health, GrabStrength, ExtraJump, TumbleWings, GrabRange, GrabThrow, CrouchRest, TumbleClimb } public class SynthesisNode : MonoBehaviour { public bool merged; private float lastImpact; private PhysGrabObjectImpactDetector impact; private Rigidbody rb; private PhotonView pv; private ItemAttributes attrs; private ItemUpgrade baseUpgrade; public KnownUpgrade Type; private void Awake() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown impact = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>(); rb = ((Component)this).GetComponent<Rigidbody>(); pv = ((Component)this).GetComponent<PhotonView>(); attrs = ((Component)this).GetComponent<ItemAttributes>(); baseUpgrade = ((Component)this).GetComponent<ItemUpgrade>(); Type = SynthesisUtil.ResolveType(((Component)this).gameObject); if ((Object)(object)impact != (Object)null) { UnityEvent onAllImpacts = impact.onAllImpacts; if (onAllImpacts != null) { onAllImpacts.AddListener(new UnityAction(OnImpact)); } } if (Object.op_Implicit((Object)(object)pv) && !Object.op_Implicit((Object)(object)((Component)pv).gameObject.GetComponent<SynthesisNetwork>())) { ((Component)pv).gameObject.AddComponent<SynthesisNetwork>(); } } private void OnDestroy() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown if ((Object)(object)impact != (Object)null && impact.onAllImpacts != null) { impact.onAllImpacts.RemoveListener(new UnityAction(OnImpact)); } } private void OnImpact() { lastImpact = Time.time; } private void Update() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (merged || Time.time - lastImpact > 0.25f) { return; } Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 0.6f, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { GameObject val = (Object.op_Implicit((Object)(object)array[i].attachedRigidbody) ? ((Component)array[i].attachedRigidbody).gameObject : ((Component)array[i]).gameObject); if ((Object)(object)val == (Object)(object)((Component)this).gameObject) { continue; } SynthesisNode component = val.GetComponent<SynthesisNode>(); if (Object.op_Implicit((Object)(object)component) && !component.merged && component.Type != 0 && Type != 0 && SynthesisUtil.CanInitiate()) { merged = true; component.merged = true; if (Object.op_Implicit((Object)(object)pv) && pv.ViewID != 0) { SynthesisUtil.BeginMergeNetwork(pv, component.pv); } else { ((MonoBehaviour)this).StartCoroutine(SynthesisUtil.AnimateAndMergeLocal(this, component)); } break; } } } } public class SynthesisNetwork : MonoBehaviourPun { [PunRPC] public void RPC_Synthesize(int otherViewId) { ((MonoBehaviour)this).StartCoroutine(SynthesisUtil.AnimateAndMergeRPC(((MonoBehaviourPun)this).photonView, otherViewId)); } } public static class SynthesisUtil { [CompilerGenerated] private sealed class <AnimateAndMergeLocal>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public SynthesisNode a; public SynthesisNode b; private GameObject <host>5__1; private GameObject <other>5__2; private string <name>5__3; private float <hue>5__4; private KnownUpgrade[] <parts>5__5; private ItemAttributes <ia>5__6; private PhotonView <pv>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimateAndMergeLocal>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <host>5__1 = null; <other>5__2 = null; <name>5__3 = null; <parts>5__5 = null; <ia>5__6 = null; <pv>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0104: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <host>5__1 = ((Component)a).gameObject; <other>5__2 = ((Component)b).gameObject; <name>5__3 = ComposeName(<host>5__1, <other>5__2); <hue>5__4 = ComputeHue(((Object)(object)a != (Object)null) ? a.Type : KnownUpgrade.None, ((Object)(object)b != (Object)null) ? b.Type : KnownUpgrade.None); <parts>5__5 = BuildParts(a, b); <>2__current = AnimatePair(<host>5__1, <other>5__2); <>1__state = 1; return true; case 1: <>1__state = -1; if (Object.op_Implicit((Object)(object)<other>5__2)) { <other>5__2.SetActive(false); } SynthesisAudio.Play(<host>5__1.transform.position); ApplySynthesis(<host>5__1, <name>5__3, <hue>5__4, <parts>5__5); if (Object.op_Implicit((Object)(object)PunManager.instance) && <host>5__1.TryGetComponent<ItemAttributes>(ref <ia>5__6) && <host>5__1.TryGetComponent<PhotonView>(ref <pv>5__7)) { PunManager.instance.SetItemName(<name>5__3, <ia>5__6, <pv>5__7.ViewID); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <AnimateAndMergeRPC>d__3 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PhotonView hostPv; public int otherViewId; private GameObject <host>5__1; private PhotonView <otherPv>5__2; private GameObject <other>5__3; private SynthesisNode <hostNode>5__4; private SynthesisNode <otherNode>5__5; private string <name>5__6; private float <hue>5__7; private KnownUpgrade[] <parts>5__8; private ItemAttributes <ia>5__9; private PhotonView <pv>5__10; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimateAndMergeRPC>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <host>5__1 = null; <otherPv>5__2 = null; <other>5__3 = null; <hostNode>5__4 = null; <otherNode>5__5 = null; <name>5__6 = null; <parts>5__8 = null; <ia>5__9 = null; <pv>5__10 = null; <>1__state = -2; } private bool MoveNext() { //IL_0186: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <host>5__1 = (Object.op_Implicit((Object)(object)hostPv) ? ((Component)hostPv).gameObject : null); <otherPv>5__2 = ((otherViewId != 0) ? PhotonView.Find(otherViewId) : null); <other>5__3 = (Object.op_Implicit((Object)(object)<otherPv>5__2) ? ((Component)<otherPv>5__2).gameObject : null); if (!Object.op_Implicit((Object)(object)<host>5__1)) { return false; } <hostNode>5__4 = <host>5__1.GetComponent<SynthesisNode>(); <otherNode>5__5 = (Object.op_Implicit((Object)(object)<other>5__3) ? <other>5__3.GetComponent<SynthesisNode>() : null); <name>5__6 = ComposeName(<host>5__1, <other>5__3); <hue>5__7 = ComputeHue(((Object)(object)<hostNode>5__4 != (Object)null) ? <hostNode>5__4.Type : KnownUpgrade.None, ((Object)(object)<otherNode>5__5 != (Object)null) ? <otherNode>5__5.Type : KnownUpgrade.None); <parts>5__8 = BuildParts(<hostNode>5__4, <otherNode>5__5); <>2__current = AnimatePair(<host>5__1, <other>5__3); <>1__state = 1; return true; case 1: <>1__state = -1; if (Object.op_Implicit((Object)(object)<other>5__3)) { <other>5__3.SetActive(false); } SynthesisAudio.Play(<host>5__1.transform.position); ApplySynthesis(<host>5__1, <name>5__6, <hue>5__7, <parts>5__8); if (Object.op_Implicit((Object)(object)PunManager.instance) && <host>5__1.TryGetComponent<ItemAttributes>(ref <ia>5__9) && <host>5__1.TryGetComponent<PhotonView>(ref <pv>5__10)) { PunManager.instance.SetItemName(<name>5__6, <ia>5__9, <pv>5__10.ViewID); } if (Object.op_Implicit((Object)(object)<hostNode>5__4)) { <hostNode>5__4.Type = KnownUpgrade.None; } if (Object.op_Implicit((Object)(object)<otherNode>5__5)) { <otherNode>5__5.Type = KnownUpgrade.None; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <AnimatePair>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GameObject a; public GameObject b; private float <start>5__1; private float <dur>5__2; private Rigidbody <rbA>5__3; private Rigidbody <rbB>5__4; private bool <gA>5__5; private bool <gB>5__6; private Vector3 <pA>5__7; private Vector3 <pB>5__8; private Vector3 <center>5__9; private float <t>5__10; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimatePair>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <rbA>5__3 = null; <rbB>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_013d: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <start>5__1 = Time.time; <dur>5__2 = 1.2f; <rbA>5__3 = (Object.op_Implicit((Object)(object)a) ? a.GetComponent<Rigidbody>() : null); <rbB>5__4 = (Object.op_Implicit((Object)(object)b) ? b.GetComponent<Rigidbody>() : null); <gA>5__5 = Object.op_Implicit((Object)(object)<rbA>5__3) && <rbA>5__3.useGravity; <gB>5__6 = Object.op_Implicit((Object)(object)<rbB>5__4) && <rbB>5__4.useGravity; if (Object.op_Implicit((Object)(object)<rbA>5__3)) { <rbA>5__3.useGravity = false; } if (Object.op_Implicit((Object)(object)<rbB>5__4)) { <rbB>5__4.useGravity = false; } <pA>5__7 = (Object.op_Implicit((Object)(object)a) ? a.transform.position : Vector3.zero); <pB>5__8 = (Object.op_Implicit((Object)(object)b) ? b.transform.position : (<pA>5__7 + Vector3.right * 0.4f)); <center>5__9 = (<pA>5__7 + <pB>5__8) * 0.5f; break; case 1: <>1__state = -1; break; } if (Time.time - <start>5__1 < <dur>5__2) { <t>5__10 = Mathf.InverseLerp(0f, <dur>5__2, Time.time - <start>5__1); if (Object.op_Implicit((Object)(object)a)) { a.transform.position = Vector3.Lerp(<pA>5__7, <center>5__9 + Vector3.up * 0.5f, <t>5__10); } if (Object.op_Implicit((Object)(object)b)) { b.transform.position = Vector3.Lerp(<pB>5__8, <center>5__9 + Vector3.up * 0.5f, <t>5__10); } if (Object.op_Implicit((Object)(object)a)) { a.transform.Rotate(Vector3.up, 360f * Time.deltaTime, (Space)0); } if (Object.op_Implicit((Object)(object)b)) { b.transform.Rotate(Vector3.up, 360f * Time.deltaTime, (Space)0); } <>2__current = null; <>1__state = 1; return true; } if (Object.op_Implicit((Object)(object)<rbA>5__3)) { <rbA>5__3.useGravity = <gA>5__5; } if (Object.op_Implicit((Object)(object)<rbB>5__4)) { <rbB>5__4.useGravity = <gB>5__6; } 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 static bool CanInitiate() { if (SemiFunc.IsMultiplayer()) { return PhotonNetwork.IsMasterClient; } return true; } public static KnownUpgrade ResolveType(GameObject go) { if (Object.op_Implicit((Object)(object)go.GetComponent<ItemUpgradePlayerEnergy>())) { return KnownUpgrade.Energy; } if (Object.op_Implicit((Object)(object)go.GetComponent<ItemUpgradePlayerSprintSpeed>())) { return KnownUpgrade.SprintSpeed; } if (Object.op_Implicit((Object)(object)go.GetComponent<ItemUpgradePlayerHealth>())) { return KnownUpgrade.Health; } if (Object.op_Implicit((Object)(object)go.GetComponent<ItemUpgradePlayerGrabStrength>())) { return KnownUpgrade.GrabStrength; } if (Object.op_Implicit((Object)(object)go.GetComponent<ItemUpgradePlayerExtraJump>())) { return KnownUpgrade.ExtraJump; } if (Object.op_Implicit((Object)(object)go.GetComponent<ItemUpgradePlayerTumbleWings>())) { return KnownUpgrade.TumbleWings; } if (Object.op_Implicit((Object)(object)go.GetComponent<ItemUpgradePlayerGrabRange>())) { return KnownUpgrade.GrabRange; } if (Object.op_Implicit((Object)(object)go.GetComponent<ItemUpgradePlayerGrabThrow>())) { return KnownUpgrade.GrabThrow; } if (Object.op_Implicit((Object)(object)go.GetComponent<ItemUpgradePlayerCrouchRest>())) { return KnownUpgrade.CrouchRest; } if (Object.op_Implicit((Object)(object)go.GetComponent<ItemUpgradePlayerTumbleClimb>())) { return KnownUpgrade.TumbleClimb; } return KnownUpgrade.None; } public static void BeginMergeNetwork(PhotonView host, PhotonView other) { if (Object.op_Implicit((Object)(object)host)) { if (!Object.op_Implicit((Object)(object)((Component)host).gameObject.GetComponent<SynthesisNetwork>())) { ((Component)host).gameObject.AddComponent<SynthesisNetwork>(); } host.RPC("RPC_Synthesize", (RpcTarget)0, new object[1] { Object.op_Implicit((Object)(object)other) ? other.ViewID : 0 }); } } [IteratorStateMachine(typeof(<AnimateAndMergeRPC>d__3))] public static IEnumerator AnimateAndMergeRPC(PhotonView hostPv, int otherViewId) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimateAndMergeRPC>d__3(0) { hostPv = hostPv, otherViewId = otherViewId }; } [IteratorStateMachine(typeof(<AnimateAndMergeLocal>d__4))] public static IEnumerator AnimateAndMergeLocal(SynthesisNode a, SynthesisNode b) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimateAndMergeLocal>d__4(0) { a = a, b = b }; } private static string ComposeName(GameObject a, GameObject b) { string text = ResolveItemName(a); string text2 = ResolveItemName(b); if (string.CompareOrdinal(text, text2) > 0) { string text3 = text; text = text2; text2 = text3; } return text + " + " + text2; } private static string ResolveItemName(GameObject go) { if (!Object.op_Implicit((Object)(object)go)) { return "Item"; } ItemAttributes val = default(ItemAttributes); if (go.TryGetComponent<ItemAttributes>(ref val) && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.item)) { return val.item.itemName; } return ((Object)go).name; } private static float ComputeHue(KnownUpgrade a, KnownUpgrade b) { float num = (float)a * 0.1619f + (float)b * 0.3271f + 0.137f; return Mathf.Repeat(num, 1f); } private static KnownUpgrade[] BuildParts(SynthesisNode a, SynthesisNode b) { List<KnownUpgrade> list = new List<KnownUpgrade>(2); if ((Object)(object)a != (Object)null) { list.Add(a.Type); } if ((Object)(object)b != (Object)null) { list.Add(b.Type); } return list.ToArray(); } [IteratorStateMachine(typeof(<AnimatePair>d__9))] private static IEnumerator AnimatePair(GameObject a, GameObject b) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimatePair>d__9(0) { a = a, b = b }; } private static void ApplySynthesis(GameObject host, string newName, float hueShift, KnownUpgrade[] parts) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)host)) { ItemUpgrade val = host.GetComponent<ItemUpgrade>(); if (!Object.op_Implicit((Object)(object)val)) { val = host.AddComponent<ItemUpgrade>(); } if (val.upgradeEvent == null) { val.upgradeEvent = new UnityEvent(); } ((UnityEventBase)val.upgradeEvent).RemoveAllListeners(); SynthesisCombinedUpgrade synthesisCombinedUpgrade = host.GetComponent<SynthesisCombinedUpgrade>(); if (!Object.op_Implicit((Object)(object)synthesisCombinedUpgrade)) { synthesisCombinedUpgrade = host.AddComponent<SynthesisCombinedUpgrade>(); } synthesisCombinedUpgrade.parts = parts; synthesisCombinedUpgrade.applied = false; val.upgradeEvent.AddListener(new UnityAction(synthesisCombinedUpgrade.PerformUpgrade)); ApplyHue(host, hueShift); } } private static void ApplyHue(GameObject host, float hueShift) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0056: 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_005b: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = host.GetComponentsInChildren<Renderer>(true); float num = default(float); float num2 = default(float); float num3 = default(float); foreach (Renderer val in componentsInChildren) { MaterialPropertyBlock val2 = new MaterialPropertyBlock(); val.GetPropertyBlock(val2); Color val3 = ((Object.op_Implicit((Object)(object)val.sharedMaterial) && val.sharedMaterial.HasProperty("_Color")) ? val.sharedMaterial.color : Color.white); Color.RGBToHSV(val3, ref num, ref num2, ref num3); num = Mathf.Repeat(num + hueShift, 1f); Color val4 = Color.HSVToRGB(num, num2, num3); val2.SetColor("_Color", val4); val.SetPropertyBlock(val2); } } } public class SynthesisCombinedUpgrade : MonoBehaviour { public KnownUpgrade[] parts = Array.Empty<KnownUpgrade>(); public bool applied; private ItemToggle toggle; private void Awake() { toggle = ((Component)this).GetComponent<ItemToggle>(); } public void PerformUpgrade() { //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown if (applied || !Object.op_Implicit((Object)(object)toggle) || (Object)(object)PunManager.instance == (Object)null) { return; } PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(toggle.playerTogglePhotonID); if (!Object.op_Implicit((Object)(object)val)) { return; } string text = SemiFunc.PlayerGetSteamID(val); for (int i = 0; i < parts.Length; i++) { switch (parts[i]) { case KnownUpgrade.Energy: PunManager.instance.UpgradePlayerEnergy(text, 1); break; case KnownUpgrade.SprintSpeed: PunManager.instance.UpgradePlayerSprintSpeed(text, 1); break; case KnownUpgrade.Health: PunManager.instance.UpgradePlayerHealth(text, 1); break; case KnownUpgrade.GrabStrength: PunManager.instance.UpgradePlayerGrabStrength(text, 1); break; case KnownUpgrade.ExtraJump: PunManager.instance.UpgradePlayerExtraJump(text, 1); break; case KnownUpgrade.TumbleWings: PunManager.instance.UpgradePlayerTumbleWings(text, 1); break; case KnownUpgrade.GrabRange: PunManager.instance.UpgradePlayerGrabRange(text, 1); break; case KnownUpgrade.GrabThrow: PunManager.instance.UpgradePlayerThrowStrength(text, 1); break; case KnownUpgrade.CrouchRest: PunManager.instance.UpgradePlayerCrouchRest(text, 1); break; case KnownUpgrade.TumbleClimb: PunManager.instance.UpgradePlayerTumbleClimb(text, 1); break; } } applied = true; ItemUpgrade component = ((Component)this).GetComponent<ItemUpgrade>(); if ((Object)(object)component != (Object)null && component.upgradeEvent != null) { component.upgradeEvent.RemoveListener(new UnityAction(PerformUpgrade)); } } } public static class SynthesisAudio { [CompilerGenerated] private sealed class <LoadNearDll>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string dllLocation; private string <dir>5__1; private string[] <oggs>5__2; private string[] <wavs>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadNearDll>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <dir>5__1 = null; <oggs>5__2 = null; <wavs>5__3 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <dir>5__1 = ""; try { <dir>5__1 = Path.GetDirectoryName(dllLocation); } catch { } if (string.IsNullOrEmpty(<dir>5__1) || !Directory.Exists(<dir>5__1)) { return false; } <oggs>5__2 = Directory.GetFiles(<dir>5__1, "*.ogg", SearchOption.TopDirectoryOnly); if (<oggs>5__2 != null && <oggs>5__2.Length != 0) { <>2__current = LoadOgg(<oggs>5__2[0]); <>1__state = 1; return true; } break; case 1: <>1__state = -1; if (Object.op_Implicit((Object)(object)clip)) { return false; } break; } <wavs>5__3 = Directory.GetFiles(<dir>5__1, "*.wav", SearchOption.TopDirectoryOnly); if (<wavs>5__3 != null && <wavs>5__3.Length != 0) { clip = WavLoader.Load(<wavs>5__3[0]); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadOgg>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string path; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadOgg>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; 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(); } } private static AudioClip clip; [IteratorStateMachine(typeof(<LoadNearDll>d__1))] public static IEnumerator LoadNearDll(string dllLocation) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadNearDll>d__1(0) { dllLocation = dllLocation }; } [IteratorStateMachine(typeof(<LoadOgg>d__2))] private static IEnumerator LoadOgg(string path) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadOgg>d__2(0) { path = path }; } public static void Play(Vector3 pos) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)clip)) { AudioSource.PlayClipAtPoint(clip, pos); } } } internal static class WavLoader { public static AudioClip Load(string path) { try { using FileStream input = File.OpenRead(path); using BinaryReader binaryReader = new BinaryReader(input); if (ReadTag(binaryReader) != "RIFF") { return null; } binaryReader.ReadInt32(); if (ReadTag(binaryReader) != "WAVE") { return null; } int num = 1; int num2 = 44100; int num3 = 16; int num4 = 1; byte[] array = null; while (binaryReader.BaseStream.Position + 8 <= binaryReader.BaseStream.Length) { string text = ReadTag(binaryReader); int num5 = binaryReader.ReadInt32(); if (text == "fmt ") { num4 = binaryReader.ReadInt16(); num = binaryReader.ReadInt16(); num2 = binaryReader.ReadInt32(); binaryReader.ReadInt32(); binaryReader.ReadInt16(); num3 = binaryReader.ReadInt16(); int num6 = num5 - 16; if (num6 > 0) { binaryReader.ReadBytes(num6); } } else if (text == "data") { array = binaryReader.ReadBytes(num5); } else { binaryReader.ReadBytes(num5); } } if (array == null) { return null; } float[] array2; if (num4 == 1 && num3 == 16) { int num7 = array.Length / 2; array2 = new float[num7]; int num8 = 0; int num9 = 0; while (num9 < num7) { short num10 = (short)(array[num8] | (array[num8 + 1] << 8)); array2[num9] = (float)num10 / 32768f; num9++; num8 += 2; } } else { if (num4 != 3 || num3 != 32) { return null; } int num11 = array.Length / 4; array2 = new float[num11]; Buffer.BlockCopy(array, 0, array2, 0, array.Length); } int num12 = array2.Length / num; AudioClip val = AudioClip.Create(Path.GetFileNameWithoutExtension(path), num12, num, num2, false); val.SetData(array2, 0); return val; } catch { return null; } } private static string ReadTag(BinaryReader br) { byte[] array = br.ReadBytes(4); if (array.Length < 4) { return ""; } return new string(new char[4] { (char)array[0], (char)array[1], (char)array[2], (char)array[3] }); } } }