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 UltimateChickenSpider v1.0.10
UltimateChickenSpider/UltimateChickenSpider.dll
Decompiled a week 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.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Architect.Behaviour.Custom; using Architect.Behaviour.Utility; using Architect.Config; using Architect.Config.Types; using Architect.Content.Custom; using Architect.Content.Preloads; using Architect.Editor; using Architect.Events.Blocks; using Architect.Objects; using Architect.Objects.Categories; using Architect.Objects.Groups; using Architect.Objects.Placeable; using Architect.Objects.Tools; using Architect.Placements; using Architect.Sharer; using Architect.Sharer.States; using Architect.Storage; using Architect.Utils; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HutongGames.PlayMaker; using HutongGames.PlayMaker.Actions; using InControl; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using SSMP.Api.Client; using SSMP.Api.Client.Networking; using SSMP.Api.Command; using SSMP.Api.Command.Client; using SSMP.Api.Command.Server; using SSMP.Api.Server; using SSMP.Api.Server.Networking; using SSMP.Networking.Packet; using Silksong.AssetHelper.ManagedAssets; using UltimateChickenSpider.Mp; using UltimateChickenSpider.Mp.Data; using UltimateChickenSpider.Picker; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.SceneManagement; using UnityEngine.UI; [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("UltimateChickenSpider")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.10.0")] [assembly: AssemblyInformationalVersion("1.0.10+47bb1d61abe01a422cdf8ea73e070f5e5142b359")] [assembly: AssemblyProduct("UltimateChickenSpider")] [assembly: AssemblyTitle("UltimateChickenSpider")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.10.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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace UltimateChickenSpider { public static class ResourceUtils { internal static Sprite LoadSpriteResource(string spritePath, FilterMode filterMode = 1, Vector4 border = default(Vector4), float ppu = 100f) { //IL_000c: 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_0012: Unknown result type (might be due to invalid IL or missing references) return LoadSpriteResource(spritePath, new Vector2(0.5f, 0.5f), filterMode, border, ppu); } private static Sprite LoadSpriteResource(string spritePath, Vector2 pivot, FilterMode filterMode = 1, Vector4 border = default(Vector4), float ppu = 100f) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0083: 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_009c: Unknown result type (might be due to invalid IL or missing references) string name = "UltimateChickenSpider.Resources." + spritePath + ".png"; Assembly executingAssembly = Assembly.GetExecutingAssembly(); using Stream stream = executingAssembly.GetManifestResourceStream(name); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array, true); ((Texture)val).wrapMode = (TextureWrapMode)1; Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), pivot, ppu, 0u, (SpriteMeshType)1, border); ((Texture)val2.texture).filterMode = filterMode; return val2; } } public static class UcsEditManager { [CompilerGenerated] private sealed class <DeactivateLater>d__13 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TransitionPoint obj; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DeactivateLater>d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; Object.Destroy((Object)(object)obj); 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 <DoGoToScene>d__15 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string sceneName; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoGoToScene>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (GameManager.instance.isPaused) { <>2__current = GameManager.instance.PauseGameToggle(false); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } GameManager.instance.BeginSceneTransition(new SceneLoadInfo { SceneName = sceneName, EntryGateName = "ucs_start" }); 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 IsPlaying; public static bool OpenEditor; public static bool RoundOver; public static bool DidWin; public static bool IsSpectating; public static bool StartedSpectating; [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private static bool <IsEditing>k__BackingField; public static LevelData CurrentEdits = new LevelData(new List<ObjectPlacement>(), new List<(int, int)>(), new List<ScriptBlock>(), new List<Comment>()); private static Vector3 _noclipPos; public static bool IsEditing { [CompilerGenerated] get { return <IsEditing>k__BackingField; } set { <IsEditing>k__BackingField = value; if (PlayerData.instance != null) { PlayerData.instance.isInvincible = value; } if (!value) { UcsEditorUI.Close(); RoundOver = false; } } } public static void Init() { HookUtils.Hook(typeof(SendMessage), "OnEnter", (Delegate)(Action<Action<SendMessage>, SendMessage>)delegate(Action<SendMessage> orig, SendMessage self) { if (self.functionCall.FunctionName.Contains("FreezeMoment") && ((Object)((FsmStateAction)self).fsmComponent).name.Contains("[UCS]")) { ((FsmStateAction)self).Finish(); } else { orig(self); } }, Array.Empty<Type>()); HookUtils.Hook(typeof(CreateObject), "OnEnter", (Delegate)(Action<Action<CreateObject>, CreateObject>)delegate(Action<CreateObject> orig, CreateObject self) { GameObject value = self.gameObject.value; if (Object.op_Implicit((Object)(object)value) && Object.op_Implicit((Object)(object)value.GetComponent<FreezeMomentOnEnable>()) && ((Object)((FsmStateAction)self).fsmComponent).name.Contains("[UCS]")) { ((FsmStateAction)self).Finish(); } else { orig(self); } }, Array.Empty<Type>()); EditManager.ToggleChecks.Add(() => !IsPlaying); HookUtils.Hook(typeof(HeroController), "SceneInit", (Delegate)(Action<Action<HeroController>, HeroController>)delegate(Action<HeroController> orig, HeroController self) { //IL_0062: 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_004c: 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) orig(self); if (PreloadManager.HasPreloaded && IsPlaying) { foreach (ObjectPlacement placement in CurrentEdits.Placements) { if (IsEditing) { placement.PlaceGhost(default(Vector3), false, (string)null); } else { GameObject val = placement.SpawnObject(default(Vector3), (string)null, 0f, 1f, false); ObjectUtils.RemoveComponent<PersistentBoolItem>(val); ObjectUtils.RemoveComponent<PersistentIntItem>(val); } } if (IsEditing && OpenEditor) { UcsEditorUI.DoOpen(); } OpenEditor = false; } }, Array.Empty<Type>()); HookUtils.Hook(typeof(TransitionPoint), "Start", (Delegate)(Action<Action<TransitionPoint>, TransitionPoint>)delegate(Action<TransitionPoint> orig, TransitionPoint self) { if (IsPlaying) { ((MonoBehaviour)self).StartCoroutine(DeactivateLater(self)); } orig(self); }, Array.Empty<Type>()); HookUtils.Hook(typeof(HeroController), "CanTakeDamage", (Delegate)new Func<Func<HeroController, bool>, HeroController, bool>(BlockAction), Array.Empty<Type>()); HookUtils.Hook(typeof(HeroController), "CanTakeDamageIgnoreInvul", (Delegate)new Func<Func<HeroController, bool>, HeroController, bool>(BlockAction), Array.Empty<Type>()); HookUtils.Hook(typeof(GameManager), "FindTransitionPoint", (Delegate)(Func<Func<GameManager, string, Scene, bool, TransitionPoint>, GameManager, string, Scene, bool, TransitionPoint>)delegate(Func<GameManager, string, Scene, bool, TransitionPoint> orig, GameManager self, string entryPointName, Scene filterScene, bool fallbackToAnyAvailable) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) if (entryPointName == "ucs_start") { List<TransitionPoint> list = TransitionPoint.TransitionPoints.Where((TransitionPoint transitionPoint) => ((Object)transitionPoint).name == "ucs_start" && (!((Scene)(ref filterScene)).IsValid() || ((Component)transitionPoint).gameObject.scene == filterScene)).ToList(); if (!Extensions.IsNullOrEmpty<TransitionPoint>((ICollection<TransitionPoint>)list)) { return Extensions.GetRandomElement<TransitionPoint>(list); } } return orig(self, entryPointName, filterScene, fallbackToAnyAvailable); }, Array.Empty<Type>()); } private static bool BlockAction(Func<HeroController, bool> orig, HeroController self) { return !IsEditing && !IsSpectating && orig(self); } [IteratorStateMachine(typeof(<DeactivateLater>d__13))] private static IEnumerator DeactivateLater(TransitionPoint obj) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DeactivateLater>d__13(0) { obj = obj }; } public static void GoToScene(string sceneName) { IsSpectating = false; ((Component)HeroController.instance.vignette).gameObject.SetActive(true); HeroController.instance.MaxHealth(); ((MonoBehaviour)UltimateChickenSpiderPlugin.Instance).StartCoroutine(DoGoToScene(sceneName)); } [IteratorStateMachine(typeof(<DoGoToScene>d__15))] private static IEnumerator DoGoToScene(string sceneName) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoGoToScene>d__15(0) { sceneName = sceneName }; } public static void Update() { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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 (!Object.op_Implicit((Object)(object)GameManager.SilentInstance) || !GameManager.instance.IsGameplayScene()) { return; } if (!IsPlaying) { IsSpectating = false; if (IsEditing) { IsEditing = false; } } if (IsSpectating) { HeroActions inputActions = ManagerSingleton<InputHandler>.Instance.inputActions; bool wasPressed = ((OneAxisInputControl)inputActions.Left).WasPressed; bool wasPressed2 = ((OneAxisInputControl)inputActions.Right).WasPressed; HeroController.instance.ResetHardLandingTimer(); if (wasPressed != wasPressed2) { StartedSpectating = true; UcsClientAddon.MoveSpectate((!wasPressed) ? 1 : (-1)); } if (!DidWin) { Extensions.SetPosition2D(HeroController.instance.transform, 9999999f, 9999999f); } if (StartedSpectating) { GameManager.instance.cameraCtrl.isGameplayScene = false; Vector3 spectatePos = UcsClientAddon.GetSpectatePos(); GameManager.instance.cameraCtrl.SnapTo(spectatePos.x, spectatePos.y); } } if (IsEditing) { DoFlyMovement(); HeroController.instance.ResetHardLandingTimer(); } } private static void DoFlyMovement() { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Invalid comparison between Unknown and I4 //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0083: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00cd: 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_00e7: 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) HeroActions inputActions = ManagerSingleton<InputHandler>.Instance.inputActions; bool isPaused = GameManager.instance.isPaused; bool isPressed = ((OneAxisInputControl)inputActions.Up).IsPressed; bool isPressed2 = ((OneAxisInputControl)inputActions.Down).IsPressed; bool isPressed3 = ((OneAxisInputControl)inputActions.Left).IsPressed; bool isPressed4 = ((OneAxisInputControl)inputActions.Right).IsPressed; int num = (((OneAxisInputControl)inputActions.Dash).IsPressed ? 35 : 20); if (!EditManager.LoadPos) { if (!isPaused && isPressed != isPressed2) { _noclipPos += (isPressed ? Vector3.up : Vector3.down) * (Time.deltaTime * (float)num); } if (!isPaused && isPressed3 != isPressed4) { _noclipPos += (isPressed3 ? Vector3.left : Vector3.right) * (Time.deltaTime * (float)num); } } if ((int)HeroController.instance.transitionState == 0) { HeroController.instance.transform.position = _noclipPos; } else { _noclipPos = HeroController.instance.transform.position; } } } public static class UcsEditorUI { public class NamePreview : MonoBehaviour { public Image img; public Text text; public string currentText; private Vector3 _offset; private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.position = Input.mousePosition + _offset; } public void UpdateText(string txt) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //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) currentText = txt; text.text = txt; ((Graphic)img).rectTransform.sizeDelta = new Vector2(text.preferredWidth + 5f, text.preferredHeight + 5f); _offset = Vector2.op_Implicit(((Graphic)img).rectTransform.sizeDelta); Update(); } } public class PlayerInfo : MonoBehaviour { public Image img; public Text userText; public Text scoreText; } public class ImageSelector : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler { public Image img; public int index; public SelectableObject Target; public void OnPointerClick(PointerEventData eventData) { if (_currentObject == null) { _currentObject = Target; ((Component)this).gameObject.SetActive(false); UcsClientAddon.Send(index); } } public void OnPointerEnter(PointerEventData eventData) { _namePreview.UpdateText(Target.GetName()); ((Component)_namePreview).gameObject.SetActive(true); } public void OnPointerExit(PointerEventData eventData) { if (_namePreview.currentText == Target.GetName()) { ((Component)_namePreview).gameObject.SetActive(false); } } } private class UcsCursor : MonoBehaviour { [CompilerGenerated] private sealed class <BlinkRed>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private float <i>5__1; private float <i>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BlinkRed>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //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_0051: 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_006c: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00de: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <i>5__1 = 0f; goto IL_008f; case 1: <>1__state = -1; <i>5__1 += 0.1f; goto IL_008f; case 2: { <>1__state = -1; <i>5__2 += 0.1f; break; } IL_008f: if (<i>5__1 < 1f) { _cursorRenderer.color = Color.Lerp(Color.white, Color.red, <i>5__1); <>2__current = (object)new WaitForSeconds(0.01f); <>1__state = 1; return true; } <i>5__2 = 0f; break; } if (<i>5__2 < 1f) { _cursorRenderer.color = Color.Lerp(Color.red, Color.white, <i>5__2); <>2__current = (object)new WaitForSeconds(0.01f); <>1__state = 2; return true; } _cursorRenderer.color = Color.white; 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 Vector3 offset; private void Update() { //IL_002a: 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_0034: Invalid comparison between Unknown and I4 //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected I4, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0253: 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_02ef: Expected O, but got Unknown if (Settings.Rotate.IsPressed) { SelectableObject currentObject = _currentObject; PlaceableObject val = (PlaceableObject)(object)((currentObject is PlaceableObject) ? currentObject : null); if (val != null) { RotationGroup rotationGroup = val.GetRotationGroup(); float num; if ((int)rotationGroup == 5 && Settings.Rotate.IsPressed) { num = Time.deltaTime * 60f; } else { if (!Settings.Rotate.WasPressed) { return; } if (1 == 0) { } int num2 = (rotationGroup - 1) switch { 0 => 180, 1 => 90, 2 => 90, 3 => 45, _ => 0, }; if (1 == 0) { } num = num2; } if (Input.GetKey((KeyCode)304)) { num = 0f - num; } float num3 = _cursorRot + num; if ((int)rotationGroup == 2 && Mathf.Approximately(num3, 180f)) { num3 = 270f; } _cursorRot = num3; RefreshCursor(); } } if (Settings.Flip.WasPressed) { _cursorFlipped = !_cursorFlipped; RefreshCursor(); } ((Component)this).transform.position = EditManager.GetWorldPos(Input.mousePosition, false, 0f) + offset; if (!UcsEditManager.IsEditing) { ((Component)this).gameObject.SetActive(false); } SelectableObject currentObject2 = _currentObject; PlaceableObject val2 = (PlaceableObject)(object)((currentObject2 is PlaceableObject) ? currentObject2 : null); string objectId = ((val2 == null) ? "eraser" : val2.GetId()); UcsClientAddon.SendCursorInfo(objectId, Extensions.GetRotation2D(((Component)this).transform), ((Component)this).transform.position, ((Component)this).transform.localScale); if (!Input.GetMouseButtonDown(0)) { return; } SelectableObject currentObject3 = _currentObject; PlaceableObject val3 = (PlaceableObject)(object)((currentObject3 is PlaceableObject) ? currentObject3 : null); if (val3 != null) { Vector3 worldPos = EditManager.GetWorldPos(Input.mousePosition, false, 0f); worldPos.z = val3.ZPosition; if (UcsObjects.SafeRanges.Any(delegate(UcsObjects.SafeRange o) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //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_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) Bounds bounds = ((Renderer)_cursorRenderer).bounds; Vector3 val5 = ((Bounds)(ref bounds)).ClosestPoint(((Component)o).transform.position); if (_currentObject.GetName() == "Falling Lava") { val5.y = Extensions.GetPositionY(((Component)o).transform); } return Object.op_Implicit((Object)(object)o) && o.WithinRange(Vector2.op_Implicit(val5)); })) { ((MonoBehaviour)this).StartCoroutine(BlinkRed()); return; } ((Component)this).gameObject.SetActive(false); ObjectPlacement placement2 = new ObjectPlacement(val3, worldPos, Guid.NewGuid().ToString().Substring(0, 8) + " [UCS]", _cursorFlipped, _cursorRot, 1f, false, 0, Array.Empty<(string, string)>(), Array.Empty<(string, string, int)>(), (from cfg in val3.ConfigGroup select cfg.GetDefaultValue() into dv where dv != null select dv).ToArray()); UcsClientAddon.DoPlace(placement2); } else { ObjectPlacement val4 = ((IEnumerable<ObjectPlacement>)UcsEditManager.CurrentEdits.Placements).FirstOrDefault((Func<ObjectPlacement, bool>)((ObjectPlacement placement) => placement.Touching(Input.mousePosition))); if (val4 != null) { ((Component)this).gameObject.SetActive(false); UcsClientAddon.DoErase(val4); } } } [IteratorStateMachine(typeof(<BlinkRed>d__2))] private static IEnumerator BlinkRed() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BlinkRed>d__2(0); } } private class UcsForeignCursor : MonoBehaviour { public SpriteRenderer renderer; private void Update() { if (!UcsEditManager.IsEditing) { ((Component)this).gameObject.SetActive(false); } } } [CompilerGenerated] private sealed class <DoFinishSelect>d__25 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private Dictionary<ushort, UcsForeignCursor>.ValueCollection.Enumerator <>s__1; private UcsForeignCursor <fc>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoFinishSelect>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = default(Dictionary<ushort, UcsForeignCursor>.ValueCollection.Enumerator); <fc>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; _selector.SetActive(false); ((Component)_namePreview).gameObject.SetActive(false); _cursorObj.SetActive(true); <>s__1 = ForeignCursors.Values.GetEnumerator(); try { while (<>s__1.MoveNext()) { <fc>5__2 = <>s__1.Current; ((Component)<fc>5__2).gameObject.SetActive(true); <fc>5__2 = null; } } finally { ((IDisposable)<>s__1).Dispose(); } <>s__1 = default(Dictionary<ushort, UcsForeignCursor>.ValueCollection.Enumerator); _cursorRot = 0f; _cursorFlipped = false; RefreshCursor(); 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 <Open>d__19 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; private List<SelectableObject> <selected>5__1; private List<ImageSelector>.Enumerator <>s__2; private ImageSelector <selector>5__3; private Image <img>5__4; private SelectableObject <selectable>5__5; private float <rot>5__6; private PlaceableObject <placeable>5__7; private SpritePackingRotation <>s__8; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Open>d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <selected>5__1 = null; <>s__2 = default(List<ImageSelector>.Enumerator); <selector>5__3 = null; <img>5__4 = null; <selectable>5__5 = null; <placeable>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected I4, but got Unknown try { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -3; goto IL_0158; } <>1__state = -1; _currentObject = null; <selected>5__1 = new List<SelectableObject>(); <>s__2 = Images.GetEnumerator(); <>1__state = -3; goto IL_02bd; IL_0158: <img>5__4.sprite = <selectable>5__5.GetUISprite(); <rot>5__6 = 0f; Extensions.SetScaleX(((Component)<img>5__4).transform, 0.5f); Extensions.SetScaleY(((Component)<img>5__4).transform, 0.5f); ref PlaceableObject reference = ref <placeable>5__7; SelectableObject obj = <selectable>5__5; reference = (PlaceableObject)(object)((obj is PlaceableObject) ? obj : null); if (<placeable>5__7 != null) { SpritePackingRotation packingRotation = ((SelectableObject)<placeable>5__7).GetUISprite().packingRotation; <>s__8 = packingRotation; SpritePackingRotation val = <>s__8; switch (val - 1) { case 0: Extensions.SetScaleX(((Component)<img>5__4).transform, -0.5f); break; case 1: Extensions.SetScaleY(((Component)<img>5__4).transform, -0.5f); break; case 2: <rot>5__6 += 180f; break; } <rot>5__6 += <placeable>5__7.Rotation + <placeable>5__7.ChildRotation + (float)<placeable>5__7.Tk2dRotation; } Extensions.SetRotationZ(((Component)<img>5__4).transform, <rot>5__6); Seed = Random.RandomRangeInt(0, int.MaxValue); <img>5__4 = null; <selectable>5__5 = null; <placeable>5__7 = null; <selector>5__3 = null; goto IL_02bd; IL_02bd: if (<>s__2.MoveNext()) { <selector>5__3 = <>s__2.Current; <img>5__4 = <selector>5__3.img; ((Component)<img>5__4).gameObject.SetActive(true); <selectable>5__5 = Pool.Generate(Seed); while (<selected>5__1.Contains(<selectable>5__5) || Random.value > 0.8f) { Seed++; <selectable>5__5 = Pool.Generate(Seed); } <selected>5__1.Add(<selectable>5__5); <selector>5__3.Target = <selectable>5__5; SelectableObject obj2 = <selectable>5__5; PreloadObject val2 = (PreloadObject)(object)((obj2 is PreloadObject) ? obj2 : null); if (val2 != null && !val2.Loaded) { <>2__current = <selectable>5__5.EnsureLoaded(); <>1__state = 1; return true; } goto IL_0158; } <>m__Finally1(); <>s__2 = default(List<ImageSelector>.Enumerator); _selector.SetActive(true); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__2).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <UpdateForeignCursor>d__30 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CursorInfoPacket data; private bool <got>5__1; private PlaceableObject <obj>5__2; private UcsForeignCursor <cursor>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <UpdateForeignCursor>d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <obj>5__2 = null; <cursor>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!ForeignCursors.ContainsKey(data.Id)) { CreateForeignCursor(data.Id); } <got>5__1 = PlaceableObject.RegisteredObjects.TryGetValue(data.ObjectID, out <obj>5__2); if (<got>5__1) { <>2__current = ((SelectableObject)<obj>5__2).EnsureLoaded(); <>1__state = 1; return true; } break; case 1: <>1__state = -1; break; } <cursor>5__3 = ForeignCursors[data.Id]; ((Component)<cursor>5__3).transform.position = new Vector3(data.Pos.Item1, data.Pos.Item2, data.Pos.Item3); Extensions.SetRotation2D(((Component)<cursor>5__3).transform, data.Rotation); ((Component)<cursor>5__3).transform.localScale = new Vector3(data.Scale.Item1, data.Scale.Item2, data.Scale.Item3); <cursor>5__3.renderer.sprite = (<got>5__1 ? <obj>5__2.Sprite : ((SelectableObject)UcsEraser.Instance).GetUISprite()); 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 readonly Sprite BoxSprite = ResourceUtils.LoadSpriteResource("box", (FilterMode)0); private static readonly Pool Pool = new Pool(new EraserElement(), new CategoryElement(Categories.Enemies, 200), new CategoryElement(Categories.Abilities, 40, delegate(string s) { if (1 == 0) { } bool result5; switch (s) { case "Silk Heart": case "Mask Shard": case "Spool Fragment": case "Frost Binding": result5 = false; break; default: result5 = true; break; } if (1 == 0) { } return result5; }), new CategoryElement(Categories.Hazards, 800, delegate(string s) { if (1 == 0) { } bool result4; switch (s) { case "Lava": case "Pilgrim Trap Spike": case "Stake Trap": case "Spike Ball": case "Groal's Spike Ball": case "Rubble Field": case "Void Tendrils": case "Craw Chain": case "Junk Pipe": case "Voltring": case "Coral Spike S": case "Coral Spike L": case "Sickle Trap": result4 = false; break; default: result4 = true; break; } if (1 == 0) { } return result4; }), new CategoryElement(Categories.Misc, 140, delegate(string s) { if (s.Contains("Statue")) { return true; } if (1 == 0) { } bool result3; switch (s) { case "Skull": case "Large Skull": case "Lifeblood Cocoon": case "Judge Statue": case "Coal Bucket": case "Coldshard": case "Floating Coldshard": case "Weaver Heat Lamp S": case "Weaver Heat Lamp L": case "Coal Lamp": case "Maggot Sack": case "Body Sack": case "Kratt": case "Shaman Shell S": case "Shaman Shell M": case "Shaman Shell L": case "Lily Pad / Nuphar": case "Hornet Cocoon": case "Silk Sphere": case "Breakable Wall A": case "Breakable Wall B": case "Breakable Window": case "Winged Lifeseed": result3 = true; break; default: result3 = false; break; } if (1 == 0) { } return result3; }), new CategoryElement(Categories.Solids, 160), new CategoryElement(Categories.Interactable, 25, delegate(string s) { if (1 == 0) { } bool result2; switch (s) { case "Silk Vines": case "Falling Exploding Rock": case "Temporary Gate": case "Collapsing Bone Platform": case "Collapsing Underworks Platform": case "Exploding Wall": result2 = true; break; default: result2 = false; break; } if (1 == 0) { } return result2; }), new CategoryElement(Categories.Platforming, 500, delegate(string s) { if (1 == 0) { } bool result; switch (s) { case "Magma Rocks": case "Clover Pod": case "Bumper": case "Slope Area": result = false; break; default: result = true; break; } if (1 == 0) { } return result; })); public static int Seed; private static GameObject _ui; private static GameObject _selector; private static GameObject _playerInfo; private static readonly List<PlayerInfo> InfoLines = new List<PlayerInfo>(); private static NamePreview _namePreview; private static GameObject _cursorObj; private static float _cursorRot; private static bool _cursorFlipped; private static UcsCursor _cursor; private static SpriteRenderer _cursorRenderer; private static readonly List<ImageSelector> Images = new List<ImageSelector>(); private static SelectableObject _currentObject; private static readonly Dictionary<ushort, UcsForeignCursor> ForeignCursors = new Dictionary<ushort, UcsForeignCursor>(); public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: 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_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05ac: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Expected O, but got Unknown //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0466: Unknown result type (might be due to invalid IL or missing references) _ui = new GameObject("[UCS] UI"); Object.DontDestroyOnLoad((Object)(object)_ui); _ui.AddComponent<Canvas>().renderMode = (RenderMode)0; CanvasScaler val = _ui.AddComponent<CanvasScaler>(); val.uiScaleMode = (ScaleMode)1; val.screenMatchMode = (ScreenMatchMode)1; _ui.AddComponent<GraphicRaycaster>(); Image val2 = UIUtils.MakeImage("Selector", _ui, Vector2.zero, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(200f, 200f)); val2.preserveAspect = true; val2.sprite = BoxSprite; _selector = ((Component)val2).gameObject; UIUtils.RemoveOffset(_selector); _selector.SetActive(false); ((RectTransform)_selector.transform).sizeDelta = new Vector2(200f, 200f); int num = 0; for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { Image val3 = UIUtils.MakeImage($"Object {num}", _selector, new Vector2((float)(i * 250), (float)(j * 250)), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(250f, 250f)); val3.preserveAspect = true; ImageSelector imageSelector = ((Component)val3).gameObject.AddComponent<ImageSelector>(); imageSelector.img = val3; imageSelector.index = num; Images.Add(imageSelector); num++; } } HookUtils.Hook(typeof(InputHandler), "SetCursorVisible", (Delegate)new Action<Action<InputHandler, bool>, InputHandler, bool>(EnableCursor), Array.Empty<Type>()); _cursorObj = new GameObject("[UCS] Cursor"); _cursorObj.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_cursorObj); _cursor = _cursorObj.AddComponent<UcsCursor>(); _cursorRenderer = _cursorObj.AddComponent<SpriteRenderer>(); Image val4 = UIUtils.MakeImage("User Info", _ui, Vector2.zero, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(200f, 200f)); val4.preserveAspect = true; val4.sprite = BoxSprite; _playerInfo = ((Component)val4).gameObject; UIUtils.RemoveOffset(_playerInfo); _playerInfo.SetActive(false); for (int k = 0; k <= 1; k++) { for (float num2 = 1.5f; num2 >= -1.5f; num2 -= 1f) { GameObject val5 = new GameObject($"User {num2}"); val5.transform.SetParent(_playerInfo.transform); UIUtils.RemoveOffset(val5); PlayerInfo playerInfo = val5.AddComponent<PlayerInfo>(); playerInfo.img = UIUtils.MakeImage("Profile", val5, new Vector2((float)(-200 + k * 260), num2 * 135f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(200f, 200f)); playerInfo.img.preserveAspect = true; playerInfo.userText = (Text)(object)UIUtils.MakeLabel("Name", val5, new Vector2((float)(-100 + k * 260), num2 * 135f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), 80f, 80f, (HorizontalWrapMode)1).textComponent; ((Graphic)playerInfo.userText).color = Color.black; playerInfo.userText.fontSize = 21; playerInfo.userText.alignment = (TextAnchor)0; playerInfo.scoreText = (Text)(object)UIUtils.MakeLabel("Score", val5, new Vector2((float)(-100 + k * 260), num2 * 135f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), 80f, 80f, (HorizontalWrapMode)1).textComponent; ((Graphic)playerInfo.scoreText).color = Color.black; playerInfo.scoreText.fontSize = 21; playerInfo.scoreText.alignment = (TextAnchor)6; InfoLines.Add(playerInfo); } } ((RectTransform)_playerInfo.transform).sizeDelta = new Vector2(600f, 600f); Image val6 = UIUtils.MakeImage("Name Preview", _ui, Vector2.zero, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(10f, 10f)); ((Graphic)val6).raycastTarget = false; ((Graphic)val6).color = Color.black; val6.sprite = UIUtils.Square; _namePreview = ((Component)val6).gameObject.AddComponent<NamePreview>(); _namePreview.img = val6; _namePreview.text = (Text)(object)UIUtils.MakeLabel("Text", ((Component)_namePreview).gameObject, Vector2.zero, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), 80f, 80f, (HorizontalWrapMode)1).textComponent; _namePreview.text.fontSize = 24; ((Graphic)_namePreview.text).raycastTarget = false; _namePreview.text.alignment = (TextAnchor)4; ((Component)_namePreview).gameObject.SetActive(false); } public static void DoOpen() { ((MonoBehaviour)UltimateChickenSpiderPlugin.Instance).StartCoroutine(Open()); } [IteratorStateMachine(typeof(<Open>d__19))] private static IEnumerator Open() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Open>d__19(0); } private static void EnableCursor(Action<InputHandler, bool> orig, InputHandler self, bool value) { if (UcsEditManager.IsEditing) { if (!GameManager.instance.isPaused && _currentObject != null) { Cursor.visible = false; Cursor.lockState = (CursorLockMode)0; } else { orig(self, arg2: true); } } else { orig(self, value); } } public static void Select(int index) { ((Component)Images[index]).gameObject.SetActive(false); } public static void Close() { _selector.SetActive(false); ((Component)_namePreview).gameObject.SetActive(false); } public static void FinishSelect() { ((MonoBehaviour)UltimateChickenSpiderPlugin.Instance).StartCoroutine(DoFinishSelect()); } [IteratorStateMachine(typeof(<DoFinishSelect>d__25))] private static IEnumerator DoFinishSelect() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoFinishSelect>d__25(0); } private static void RefreshCursor() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) Vector3 offset = default(Vector3); float num = 0f; SelectableObject currentObject = _currentObject; PlaceableObject val = (PlaceableObject)(object)((currentObject is PlaceableObject) ? currentObject : null); if (val != null) { num += _cursorRot + val.Rotation; _cursorRenderer.sprite = val.Sprite; offset = PreviewUtils.FixPreview(_cursorRenderer, val, _cursorFlipped, num, 1f); offset.z += val.ZPosition + 0.001f; num += val.ChildRotation + (float)val.Tk2dRotation; _cursorObj.transform.localScale = val.LossyScale; foreach (ConfigValue item in from cfg in val.ConfigGroup select cfg.GetDefaultValue() into dv where dv != null select dv into configVal orderby configVal.GetPriority() select configVal) { item.SetupPreview(_cursorObj, (PreviewContext)0); } } else { _cursorRenderer.sprite = _currentObject.GetUISprite(); _cursorObj.transform.localScale = new Vector3(0.2f, 0.2f); } _cursor.offset = offset; Extensions.SetRotation2D(_cursorObj.transform, num); } private static void CreateForeignCursor(ushort id) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject($"[Architect] Foreign Cursor ({id})"); Object.DontDestroyOnLoad((Object)(object)val); UcsForeignCursor ucsForeignCursor = val.AddComponent<UcsForeignCursor>(); ucsForeignCursor.renderer = val.AddComponent<SpriteRenderer>(); ucsForeignCursor.renderer.color = new Color(0.2f, 0.8f, 1f, 0.6f); ForeignCursors[id] = ucsForeignCursor; } [IteratorStateMachine(typeof(<UpdateForeignCursor>d__30))] public static IEnumerator UpdateForeignCursor(CursorInfoPacket data) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <UpdateForeignCursor>d__30(0) { data = data }; } public static void ShowInfo(List<(string, string, int)> userInfo) { userInfo.Sort(((string, string, int) a, (string, string, int) b) => string.Compare(a.Item1, b.Item1, StringComparison.InvariantCulture)); _playerInfo.SetActive(true); for (int i = 0; i < 8; i++) { if (i < userInfo.Count) { PlayerInfo playerInfo = InfoLines[i]; ((Component)playerInfo).gameObject.SetActive(true); playerInfo.userText.text = userInfo[i].Item1; playerInfo.scoreText.text = userInfo[i].Item3.ToString(); SharerManager.DoGetSprite(userInfo[i].Item2, playerInfo.img); } else { ((Component)InfoLines[i]).gameObject.SetActive(false); } } } public static void HideInfo() { _playerInfo.SetActive(false); } public static void HideSelect() { _selector.SetActive(false); ((Component)_namePreview).gameObject.SetActive(false); } public static void HideForeignCursor(ushort id) { if (ForeignCursors.TryGetValue(id, out var value)) { ((Component)value).gameObject.SetActive(false); } } public static void HideForeignCursors() { foreach (UcsForeignCursor value in ForeignCursors.Values) { ((Component)value).gameObject.SetActive(false); } } } public class UcsEraser : ToolObject { public static readonly UcsEraser Instance = new UcsEraser(); public UcsEraser() : base("eraser", (Keybind)null, -2) { } public override string GetName() { return "Eraser"; } public override string GetDescription() { return "Erases"; } public override void Click(Vector3 mousePosition, bool first) { } } public static class UcsObjects { public class SafeRange : MonoBehaviour { private SpriteRenderer _renderer; private void Start() { ((Component)this).transform.SetParent((Transform)null, true); _renderer = ((Component)this).GetComponent<SpriteRenderer>(); } private void Update() { ((Renderer)_renderer).enabled = UcsEditManager.IsEditing || !UcsEditManager.IsPlaying; } public bool WithinRange(Vector2 pos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) return Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), pos) <= Extensions.GetScaleX(((Component)this).transform) / 2f; } private void OnEnable() { SafeRanges.Add(this); } private void OnDisable() { SafeRanges.Remove(this); } } public class StartPoint : MonoBehaviour { public bool isRight; private void Start() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) ((Object)this).name = "ucs_start"; PlayerData.instance.SetBenchRespawn(((Component)this).GetComponent<RespawnMarker>(), GameManager.instance.sceneName, 0); PlayerData.instance.SetHazardRespawn(((Component)this).transform.position, isRight); StartPos = ((Component)this).transform.position; } } public class EndPoint : MonoBehaviour { [CompilerGenerated] private sealed class <EndControl>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <EndControl>d__4(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; <>2__current = MiscUtils.FreeControl(HeroController.instance, (Predicate<HeroController>)null); <>1__state = 1; return true; case 1: <>1__state = -1; HeroController.instance.RelinquishControl(); 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 <LoadConfetti>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public EndPoint <>4__this; private GameObject <confetti>5__1; private MainModule <main>5__2; private EmissionModule <emission>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadConfetti>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) <confetti>5__1 = null; <main>5__2 = default(MainModule); <emission>5__3 = default(EmissionModule); <>1__state = -2; } private bool MoveNext() { //IL_0026: 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_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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = _confetti.Load(); <>1__state = 1; return true; case 1: <>1__state = -1; <confetti>5__1 = ManagedAssetExtensions.InstantiateAsset<GameObject>(_confetti); <confetti>5__1.transform.SetParent(((Component)<>4__this).transform); <confetti>5__1.transform.localPosition = Vector3.zero; <>4__this._confettiSystem = <confetti>5__1.GetComponent<ParticleSystem>(); <main>5__2 = <>4__this._confettiSystem.main; ((MainModule)(ref <main>5__2)).maxParticles = 100000; <emission>5__3 = <>4__this._confettiSystem.emission; ((EmissionModule)(ref <emission>5__3)).rateOverTime = MinMaxCurve.op_Implicit(0f); 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 ParticleSystem _confettiSystem; private void Start() { ((MonoBehaviour)this).StartCoroutine(LoadConfetti()); } [IteratorStateMachine(typeof(<LoadConfetti>d__2))] private IEnumerator LoadConfetti() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadConfetti>d__2(0) { <>4__this = this }; } private void OnTriggerEnter2D(Collider2D collider) { if (UcsEditManager.IsPlaying && !UcsEditManager.IsEditing && !UcsEditManager.RoundOver && Object.op_Implicit((Object)(object)((Component)collider).GetComponent<HeroController>())) { UcsClientAddon.SendRoundInfo(won: true); UcsEditManager.RoundOver = true; UcsEditManager.DidWin = true; UcsEditManager.StartedSpectating = false; UcsEditManager.IsSpectating = true; ((MonoBehaviour)this).StartCoroutine(EndControl()); PlayerData.instance.isInvincible = true; if (Object.op_Implicit((Object)(object)_confettiSystem)) { _confettiSystem.Emit(200); } } } [IteratorStateMachine(typeof(<EndControl>d__4))] private static IEnumerator EndControl() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <EndControl>d__4(0); } } public static readonly List<SafeRange> SafeRanges = new List<SafeRange>(); public static Vector3 StartPos; private static ManagedAsset<GameObject> _confetti; private static readonly List<ConfigType> SafeRangeConfig = new List<ConfigType>(1) { ConfigurationManager.RegisterConfigType((ConfigType)(object)new BoolConfigType("Safe Range", "start_safe_range", (Action<GameObject, BoolConfigValue>)delegate(GameObject o, BoolConfigValue value) { if (!value.GetValue()) { ((Component)o.GetComponentInChildren<SafeRange>()).gameObject.SetActive(false); } }, (Action<GameObject, BoolConfigValue, PreviewContext>)null).WithDefaultValue(true)) }; private static readonly List<ConfigType> StartPointConfig = GroupUtils.Merge<ConfigType>(SafeRangeConfig, new List<ConfigType>(1) { ConfigurationManager.RegisterConfigType((ConfigType)(object)new ChoiceConfigType("Facing Direction", "start_face_dir", (Action<GameObject, ChoiceConfigValue>)delegate(GameObject o, ChoiceConfigValue value) { o.GetComponent<StartPoint>().isRight = value.GetValue() == 1; }, (Action<GameObject, ChoiceConfigValue, PreviewContext>)null).WithOptions(new string[2] { "Left", "Right" }).WithDefaultValue(0)) }); private static readonly Sprite SafeRangeSprite = ResourceUtils.LoadSpriteResource("safe_range", (FilterMode)0, default(Vector4), 98f); public static void Init() { UltimateChickenSpiderPlugin.Arena.Add(CreateSafeRange()); UltimateChickenSpiderPlugin.Arena.Add(CreateStart()); UltimateChickenSpiderPlugin.Arena.Add(CreateEnd()); _confetti = ManagedAsset<GameObject>.FromSceneAsset("Aqueduct_05_festival", "Caravan_States/Flea_Games_Start_effect/confetti_burst (1)"); } private static PlaceableObject CreateStart() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0039: 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) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("UCS Start"); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); GameObject val2 = CreateSafeRangeObject(); val2.transform.SetParent(val.transform); val2.transform.localPosition = Vector3.zero; val2.SetActive(true); Extensions.SetPositionZ(val.transform, 0.006f); val.AddComponent<CustomTransitionPoint>(); TransitionPoint val3 = val.AddComponent<TransitionPoint>(); val3.entryPoint = ""; val3.nonHazardGate = true; val.AddComponent<RespawnMarker>(); val.AddComponent<StartPoint>(); val.AddComponent<SpriteRenderer>().sprite = ResourceUtils.LoadSpriteResource("start_point", (FilterMode)0, default(Vector4), 7.5f); val.AddComponent<FloatAnim>(); return ((PlaceableObject)new CustomObject("Starting Point", "ucs_start", val, "Defines the spawn point for the room.\nIf multiple start points are placed, each player will start at a random one.\n\nObjects cannot be added by players within the Safe Range.", (Action<GameObject>)null, false, (Sprite)null, (Sprite)null)).WithConfigGroup(StartPointConfig); } private static PlaceableObject CreateEnd() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0039: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("UCS End"); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); GameObject val2 = CreateSafeRangeObject(); val2.transform.SetParent(val.transform); val2.transform.localPosition = Vector3.zero; val2.SetActive(true); Extensions.SetPositionZ(val.transform, 0.006f); CircleCollider2D val3 = val.AddComponent<CircleCollider2D>(); val3.radius = 1.2f; ((Collider2D)val3).isTrigger = true; val.AddComponent<EndPoint>(); val.AddComponent<SpriteRenderer>().sprite = ResourceUtils.LoadSpriteResource("goal", (FilterMode)0, default(Vector4), 7.5f); return ((PlaceableObject)new CustomObject("End Point", "ucs_end", val, "Defines the end point for the room.\nIf multiple end points are placed, reaching any of them will count as a win.\n\nObjects cannot be added by players within the Safe Range.", (Action<GameObject>)null, false, (Sprite)null, (Sprite)null)).WithConfigGroup(SafeRangeConfig); } private static PlaceableObject CreateSafeRange() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown GameObject val = CreateSafeRangeObject(); Object.DontDestroyOnLoad((Object)(object)val); return (PlaceableObject)new CustomObject("Safe Range", "ucs_safe", val, "Objects cannot be added by players within the Safe Range.", (Action<GameObject>)null, false, (Sprite)null, (Sprite)null); } private static GameObject CreateSafeRangeObject() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_001b: 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) GameObject val = new GameObject("UCS Safe"); val.SetActive(false); Transform transform = val.transform; transform.localScale *= 5f; Extensions.SetPositionZ(val.transform, 0.006f); val.AddComponent<SafeRange>(); CircleCollider2D val2 = val.AddComponent<CircleCollider2D>(); ((Collider2D)val2).isTrigger = true; val2.radius = 1f; val.AddComponent<SpriteRenderer>().sprite = SafeRangeSprite; return val; } } public static class UcsPrefabManager { public class UcsPrefab : PlaceableObject { public LevelData Data; public UcsPrefab(LevelData data, string url, string name, string id) : base(name, id, (string)null, (Action<GameObject>)null, false, (Sprite)null, (Sprite)null) { Data = data; base.Sprite = SharerManager.Placeholder; CustomAssetManager.DoLoadSprite(url, false, 100f, 1, 1, (Action<Sprite[]>)delegate(Sprite[] sprites) { base.Sprite = sprites[0]; }); } } } public static class UcsRoundManager { [CompilerGenerated] private sealed class <Deactivate>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Deactivate>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = MiscUtils.FreeControl(HeroController.instance, (Predicate<HeroController>)((HeroController hero) => !hero.cState.dead)); <>1__state = 2; return true; case 2: <>1__state = -1; UcsEditManager.DidWin = false; UcsEditManager.IsSpectating = true; UcsEditManager.StartedSpectating = true; Extensions.SetPosition2D(HeroController.instance.transform, 9999999f, 9999999f); ((Component)HeroController.instance.vignette).gameObject.SetActive(false); UcsClientAddon.SendRoundInfo(won: false); 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 void Init() { HookUtils.Hook(typeof(PlayerData), "TakeHealth", (Delegate)(Action<Action<PlayerData, int, bool, bool>, PlayerData, int, bool, bool>)delegate(Action<PlayerData, int, bool, bool> orig, PlayerData self, int amount, bool hasBlue, bool breakMask) { orig(self, amount, hasBlue, breakMask); Died(UltimateChickenSpiderPlugin.DeathType.Damage); }, Array.Empty<Type>()); HookUtils.OnHeroAwake = (Action<HeroController>)Delegate.Combine(HookUtils.OnHeroAwake, (Action<HeroController>)delegate(HeroController self) { self.OnDeath += delegate { Died(UltimateChickenSpiderPlugin.DeathType.Death); }; self.OnHazardRespawn += delegate { Died(UltimateChickenSpiderPlugin.DeathType.Hazard); }; }); HookUtils.Hook(typeof(AbilityObjects), "ShouldDisableFreezing", (Delegate)(Func<Func<bool>, bool>)((Func<bool> orig) => UcsEditManager.IsSpectating || (orig() && (!UcsEditManager.IsPlaying || UcsEditManager.IsEditing))), Array.Empty<Type>()); } private static void Died(UltimateChickenSpiderPlugin.DeathType type) { if (!UcsEditManager.RoundOver && UcsEditManager.IsPlaying && !UcsEditManager.IsEditing && (type == UltimateChickenSpiderPlugin.SetDeathType.Value || type == UltimateChickenSpiderPlugin.DeathType.Death || UltimateChickenSpiderPlugin.SetDeathType.Value == UltimateChickenSpiderPlugin.DeathType.Damage)) { UcsEditManager.RoundOver = true; ((MonoBehaviour)UltimateChickenSpiderPlugin.Instance).StartCoroutine(Deactivate()); } } [IteratorStateMachine(typeof(<Deactivate>d__2))] private static IEnumerator Deactivate() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Deactivate>d__2(0); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("me.cometcake575.ultimatechickenspider", "UltimateChickenSpider", "1.0.10")] public class UltimateChickenSpiderPlugin : BaseUnityPlugin { public enum DeathType { Damage, Hazard, Death } public static Category Arena; internal static UltimateChickenSpiderPlugin Instance; internal static ManualLogSource Logger; public static ConfigEntry<DeathType> SetDeathType; public const string Id = "me.cometcake575.ultimatechickenspider"; public static string Name => "UltimateChickenSpider"; public static string Version => "1.0.10"; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Logger.LogInfo((object)("Plugin " + Name + " (me.cometcake575.ultimatechickenspider) has loaded!")); ClientAddon.RegisterAddon((ClientAddon)(object)new UcsClientAddon()); ServerAddon.RegisterAddon((ServerAddon)(object)new UcsServerAddon()); Arena = Categories.RegisterCategory("UCS Arena", -1); UcsObjects.Init(); UcsEditManager.Init(); UcsEditorUI.Init(); UcsRoundManager.Init(); SetupConfig(); ((MonoBehaviour)this).StartCoroutine(Account.PrepareUserInfo()); } private void Update() { UcsEditManager.Update(); } private void SetupConfig() { SetDeathType = ((BaseUnityPlugin)this).Config.Bind<DeathType>("Options", "DeathType", DeathType.Damage, "Whether a player should lose the round on damage, hazard damage or death"); } } } namespace UltimateChickenSpider.Picker { public class CategoryElement : IPoolElement { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private int <weight>P; private readonly SelectableObject[] _objects; public CategoryElement(Category category, int weight, Func<string, bool> filter = null) { <weight>P = weight; _objects = ((filter == null) ? ((AbstractCategory)category).GetObjects().ToArray() : (from o in ((AbstractCategory)category).GetObjects() where filter(o.GetName()) select o).ToArray()); base..ctor(); } public SelectableObject Generate(int seed) { PlaceableObject val; while (true) { Random.InitState(seed); SelectableObject obj = _objects.ElementAt(Random.RandomRangeInt(0, _objects.Length)); val = (PlaceableObject)(object)((obj is PlaceableObject) ? obj : null); if (val != null) { break; } seed++; } return (SelectableObject)(object)val; } public int GetWeight() { return <weight>P; } } public class EraserElement : IPoolElement { public SelectableObject Generate(int seed) { return (SelectableObject)(object)UcsEraser.Instance; } public int GetWeight() { return Math.Min(30 * UcsEditManager.CurrentEdits.Placements.Count, 1000); } } public interface IPoolElement { SelectableObject Generate(int seed); int GetWeight(); } public class Pool : IPoolElement { [CompilerGenerated] [DebuggerBrowsable(DebuggerBrowsableState.Never)] private IPoolElement[] <elements>P; public Pool(params IPoolElement[] elements) { <elements>P = elements; base..ctor(); } public SelectableObject Generate(int seed) { Random.InitState(seed); int num = Random.RandomRangeInt(0, GetWeight()); IPoolElement[] array = <elements>P; foreach (IPoolElement poolElement in array) { num -= poolElement.GetWeight(); if (num <= 0) { return poolElement.Generate(Random.RandomRangeInt(0, int.MaxValue)); } } return null; } public int GetWeight() { return <elements>P.Sum((IPoolElement e) => e.GetWeight()); } } } namespace UltimateChickenSpider.Mp { public class UcsClientAddon : ClientAddon { public class DumpCommand : IClientCommand, ICommand { public string Trigger => "/ucsdump"; public string[] Aliases => Array.Empty<string>(); public void Execute(string[] arguments) { string fullPath = Path.GetFullPath(Application.persistentDataPath + "/UCS/"); Directory.CreateDirectory(fullPath); string text = fullPath + DateTime.Now.ToString("yy-MM-dd-HH-mm-ss") + "/"; Directory.CreateDirectory(text); File.WriteAllText(text + GameManager.instance.sceneName + ".architect.json", JsonConvert.SerializeObject((object)UcsEditManager.CurrentEdits)); } } [CompilerGenerated] private sealed class <DoModeToggle>d__9 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ToEditorPacket data; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoModeToggle>d__9(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; UcsEditorUI.ShowInfo(data.UserInfo); <>2__current = (object)new WaitForSeconds(6f); <>1__state = 2; return true; case 2: <>1__state = -1; UcsEditorUI.HideInfo(); <>2__current = (object)new WaitForSeconds(1f); <>1__state = 3; return true; case 3: <>1__state = -1; UcsEditorUI.Seed = data.Seed; UcsEditManager.IsEditing = true; UcsEditManager.OpenEditor = true; UcsEditManager.GoToScene(GameManager.instance.sceneName); 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 <StopEditing>d__14 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StopEditing>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; UcsEditManager.IsEditing = false; UcsEditManager.GoToScene(GameManager.instance.sceneName); 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 IClientApi ClientApi; private static IClientAddonNetworkSender<PacketId> _networkSender; private static readonly ObjectPlacementConverter Opc = new ObjectPlacementConverter(); private static int _playerIndex; public override uint ApiVersion => 1u; protected override string Name => "UltimateChickenSpider"; protected override string Version => UltimateChickenSpiderPlugin.Version; public override bool NeedsNetwork => true; public override void Initialize(IClientApi clientApi) { ClientApi = clientApi; _networkSender = clientApi.NetClient.GetNetworkSender<PacketId>((ClientAddon)(object)this); ((ICommandManager<IClientCommand>)(object)clientApi.CommandManager).RegisterCommand((IClientCommand)(object)new DumpCommand()); IClientAddonNetworkReceiver<PacketId> networkReceiver = clientApi.NetClient.GetNetworkReceiver<PacketId>((ClientAddon)(object)this, (Func<PacketId, IPacketData>)((PacketId id) => id.GetData())); networkReceiver.RegisterPacketHandler<TogglePlayingPacket>(PacketId.StartStop, (GenericClientPacketHandler<TogglePlayingPacket>)HandlePlayToggle); networkReceiver.RegisterPacketHandler<CursorInfoPacket>(PacketId.CursorInfo, (GenericClientPacketHandler<CursorInfoPacket>)delegate(CursorInfoPacket data) { ((MonoBehaviour)UltimateChickenSpiderPlugin.Instance).StartCoroutine(UcsEditorUI.UpdateForeignCursor(data)); }); networkReceiver.RegisterPacketHandler<ToEditorPacket>(PacketId.ToEditor, (GenericClientPacketHandler<ToEditorPacket>)HandleModeToggle); networkReceiver.RegisterPacketHandler<PickObjectPacket>(PacketId.DidSelect, (GenericClientPacketHandler<PickObjectPacket>)HandlePickObject); networkReceiver.RegisterPacketHandler<PlacePacket>(PacketId.DidPlace, (GenericClientPacketHandler<PlacePacket>)HandlePlace); networkReceiver.RegisterPacketHandler<TeleportPacket>(PacketId.Teleport, (GenericClientPacketHandler<TeleportPacket>)HandleTeleport); networkReceiver.RegisterPacketHandler<GameInfoPacket>(PacketId.GameInfo, (GenericClientPacketHandler<GameInfoPacket>)delegate(GameInfoPacket packet) { if (packet.Complete) { UltimateChickenSpiderPlugin.SetDeathType.Value = (UltimateChickenSpiderPlugin.DeathType)packet.DeathType; } else { packet.DeathType = (int)UltimateChickenSpiderPlugin.SetDeathType.Value; packet.Complete = true; _networkSender.SendSingleData(PacketId.GameInfo, (IPacketData)(object)packet); } }); clientApi.ClientManager.DisconnectEvent += delegate { UcsEditorUI.HideForeignCursors(); UcsEditorUI.HideInfo(); UcsEditorUI.HideSelect(); UcsEditManager.IsPlaying = false; UcsEditManager.RoundOver = false; UcsEditManager.IsEditing = false; UcsEditManager.OpenEditor = false; }; } public static void Send(int index) { _networkSender.SendSingleData(PacketId.DidSelect, (IPacketData)(object)new PickObjectPacket { Index = index }); } public static void SendCursorInfo(string objectId, float rot, Vector3 pos, Vector3 scale) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_003e: 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) _networkSender.SendSingleData(PacketId.CursorInfo, (IPacketData)(object)new CursorInfoPacket { ObjectID = objectId, Rotation = rot, Pos = (pos.x, pos.y, pos.z), Scale = (scale.x, scale.y, scale.z) }); } private static void HandlePlayToggle(TogglePlayingPacket data) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown UcsEditManager.CurrentEdits = new LevelData(new List<ObjectPlacement>(), new List<(int, int)>(), new List<ScriptBlock>(), new List<Comment>()); if (data.Playing) { UcsEditorUI.HideForeignCursors(); EditManager.IsEditing = false; UcsEditManager.RoundOver = false; UcsEditManager.IsEditing = true; UcsEditManager.IsPlaying = true; UcsEditManager.OpenEditor = true; } else { UcsEditorUI.HideForeignCursors(); UcsEditManager.IsPlaying = false; UcsEditManager.RoundOver = false; UcsEditManager.IsEditing = false; UcsEditManager.OpenEditor = false; } UcsEditorUI.Seed = data.Seed; UcsEditManager.GoToScene(data.Scene); } private static void HandleModeToggle(ToEditorPacket data) { ((MonoBehaviour)UltimateChickenSpiderPlugin.Instance).StartCoroutine(DoModeToggle(data)); } [IteratorStateMachine(typeof(<DoModeToggle>d__9))] private static IEnumerator DoModeToggle(ToEditorPacket data) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoModeToggle>d__9(0) { data = data }; } private static void HandlePickObject(PickObjectPacket data) { UcsEditorUI.Select(data.Index); if (data.FinishSelect) { UcsEditorUI.FinishSelect(); } } private static void HandleTeleport(TeleportPacket data) { UcsEditManager.GoToScene(data.Scene); } private static void HandlePlace(PlacePacket data) { //IL_0084: 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) if (data.IsErase) { ObjectPlacement val = ((IEnumerable<ObjectPlacement>)UcsEditManager.CurrentEdits.Placements).FirstOrDefault((Func<ObjectPlacement, bool>)((ObjectPlacement o) => o.ID == data.Data)); if (val != null) { val.Destroy(); UcsEditManager.CurrentEdits.Placements.Remove(val); } } else { ObjectPlacement val2 = JsonConvert.DeserializeObject<ObjectPlacement>(data.Data, (JsonConverter[])(object)new JsonConverter[1] { (JsonConverter)Opc }); val2.PlaceGhost(default(Vector3), true, (string)null); UcsEditManager.CurrentEdits.Placements.Add(val2); } UcsEditorUI.HideForeignCursor(data.Id); if (data.FinishPlace) { ((MonoBehaviour)UltimateChickenSpiderPlugin.Instance).StartCoroutine(StopEditing()); } } [IteratorStateMachine(typeof(<StopEditing>d__14))] private static IEnumerator StopEditing() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StopEditing>d__14(0); } public static void DoPlace(ObjectPlacement placement) { _networkSender.SendSingleData(PacketId.DidPlace, (IPacketData)(object)new PlacePacket { Data = JsonConvert.SerializeObject((object)placement, (JsonConverter[])(object)new JsonConverter[1] { (JsonConverter)Opc }) }); } public static void DoErase(ObjectPlacement placement) { _networkSender.SendSingleData(PacketId.DidPlace, (IPacketData)(object)new PlacePacket { IsErase = true, Data = placement.ID }); } public static void SendRoundInfo(bool won) { _networkSender.SendSingleData(PacketId.RoundInfo, (IPacketData)(object)new RoundInfoPacket { Won = won, UserPfp = (Account.CurrentUserInfo?.PfpUrl ?? string.Empty) }); } public static void MoveSpectate(int amount) { _playerIndex += amount; int num = ClientApi.ClientManager.Players.Count((IClientPlayer p) => p.IsInLocalScene && Object.op_Implicit((Object)(object)p.PlayerContainer) && Extensions.GetPositionY(p.PlayerContainer.transform) < 999999f) - 1; if (_playerIndex < 0) { _playerIndex = num; } if (_playerIndex > num) { _playerIndex = 0; } } public static Vector3 GetSpectatePos() { //IL_00b6: 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_00bf: 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) do { int num = 0; foreach (IClientPlayer player in ClientApi.ClientManager.Players) { if (player.IsInLocalScene && Object.op_Implicit((Object)(object)player.PlayerContainer) && Extensions.GetPositionY(player.PlayerContainer.transform) < 999999f) { if (num >= _playerIndex) { return player.PlayerContainer.transform.position; } num++; } } _playerIndex--; } while (_playerIndex > 0); return UcsObjects.StartPos; } } public class UcsServerAddon : ServerAddon { public class TogglePlayingCommand : IServerCommand, ICommand { public string Trigger => "/ucs"; public string[] Aliases => Array.Empty<string>(); public bool AuthorizedOnly => true; public void Execute(ICommandSender commandSender, string[] arguments) { IPlayerCommandSender val = (IPlayerCommandSender)(object)((commandSender is IPlayerCommandSender) ? commandSender : null); IServerPlayer val2 = default(IServerPlayer); if (val == null || !_serverApi.ServerManager.TryGetPlayer(val.Id, ref val2)) { commandSender.SendMessage("Command can only be run by a player"); return; } if (arguments.Length < 2) { commandSender.SendMessage("Invalid usage: </ucs> <start|stop>\nOr: </ucs> <tp|tph> <player>"); return; } string text = arguments[1]; string text2 = text; if (!(text2 == "start")) { if (text2 == "stop") { if (!Scenes.ContainsKey(val2.CurrentScene)) { commandSender.SendMessage("Game is not running, run /ucs start to start"); return; } StopGame(val2.CurrentScene); commandSender.SendMessage("Stopping Ultimate Chicken Spider!"); return; } if (arguments.Length != 3 || (arguments[1] != "tph" && arguments[1] != "tp")) { commandSender.SendMessage("Invalid usage: </ucs> <start|stop>\nOr: </ucs> <tp|tph> <player>"); return; } IServerPlayer val3 = val2; IServerPlayer val4 = ((IEnumerable<IServerPlayer>)_serverApi.ServerManager.Players).FirstOrDefault((Func<IServerPlayer, bool>)((IServerPlayer p) => p.Username == arguments[2])); if (val4 != null) { if (arguments[1] == "tph") { IServerPlayer obj = val4; val4 = val3; val3 = obj; } _networkSender.SendSingleData(PacketId.Teleport, (IPacketData)(object)new TeleportPacket { Scene = val4.CurrentScene }, val3.Id); commandSender.SendMessage("Teleporting " + val3.Username + " to " + val4.CurrentScene); } } else if (Scenes.ContainsKey(val2.CurrentScene)) { commandSender.SendMessage("Game has already started, run /ucs stop to stop"); } else { Scenes.Add(val2.CurrentScene, new UcsServerScene(val2.CurrentScene)); _networkSender.SendSingleData(PacketId.GameInfo, (IPacketData)(object)new GameInfoPacket { Complete = false }, val2.Id); _networkSender.SendSingleData(PacketId.StartStop, (IPacketData)(object)new TogglePlayingPacket { Playing = true, Scene = val2.CurrentScene, Seed = Random.Next() }, GetPlayers(val2.CurrentScene)); commandSender.SendMessage("Starting Ultimate Chicken Spider!"); } } } private class UcsServerScene { public readonly string SceneName; public bool Editing; public int Selected; public int Placed; public readonly Dictionary<ushort, int> Wins; public readonly Dictionary<ushort, bool> Won; public UcsServerScene(string name) { SceneName = name; Wins = new Dictionary<ushort, int>(); Won = new Dictionary<ushort, bool>(); base..ctor(); } } private static IServerApi _serverApi; private static IServerAddonNetworkSender<PacketId> _networkSender; private static readonly Dictionary<string, UcsServerScene> Scenes = new Dictionary<string, UcsServerScene>(); private static readonly Dictionary<ushort, string> Pfps = new Dictionary<ushort, string>(); private static readonly Random Random = new Random(); public override uint ApiVersion => 1u; protected override string Name => "UltimateChickenSpider"; protected override string Version => UltimateChickenSpiderPlugin.Version; public override bool NeedsNetwork => true; public override void Initialize(IServerApi serverApi) { _serverApi = serverApi; _networkSender = serverApi.NetServer.GetNetworkSender<PacketId>((ServerAddon)(object)this); ((ICommandManager<IServerCommand>)(object)_serverApi.CommandManager).RegisterCommand((IServerCommand)(object)new TogglePlayingCommand()); IServerAddonNetworkReceiver<PacketId> networkReceiver = serverApi.NetServer.GetNetworkReceiver<PacketId>((ServerAddon)(object)this, (Func<PacketId, IPacketData>)((PacketId id) => id.GetData())); networkReceiver.RegisterPacketHandler<PickObjectPacket>(PacketId.DidSelect, (GenericServerPacketHandler<PickObjectPacket>)delegate(ushort id, PickObjectPacket packet) { if (GetScene(id, out var scene5)) { scene5.Selected++; if (scene5.Selected >= GetPlayers(scene5.SceneName).Length) { packet.FinishSelect = true; scene5.Placed = 0; scene5.Won.Clear(); } _networkSender.SendSingleData(PacketId.DidSelect, (IPacketData)(object)packet, GetPlayers(scene5.SceneName)); } }); networkReceiver.RegisterPacketHandler<PlacePacket>(PacketId.DidPlace, (GenericServerPacketHandler<PlacePacket>)delegate(ushort id, PlacePacket packet) { if (GetScene(id, out var scene4)) { scene4.Placed++; packet.Id = id; if (scene4.Placed >= GetPlayers(scene4.SceneName).Length) { packet.FinishPlace = true; scene4.Editing = false; scene4.Selected = 0; scene4.Won.Clear(); } _networkSender.SendSingleData(PacketId.DidPlace, (IPacketData)(object)packet, GetPlayers(scene4.SceneName)); } }); networkReceiver.RegisterPacketHandler<GameInfoPacket>(PacketId.GameInfo, (GenericServerPacketHandler<GameInfoPacket>)delegate(ushort id, GameInfoPacket packet) { if (GetScene(id, out var scene3)) { _networkSender.SendSingleData(PacketId.GameInfo, (IPacketData)(object)packet, GetPlayers(scene3.SceneName)); } }); networkReceiver.RegisterPacketHandler<CursorInfoPacket>(PacketId.CursorInfo, (GenericServerPacketHandler<CursorInfoPacket>)delegate(ushort id, CursorInfoPacket packet) { if (GetScene(id, out var scene2)) { packet.Id = id; _networkSender.SendSingleData(PacketId.CursorInfo, (IPacketData)(object)packet, GetPlayers(scene2.SceneName, id)); } }); networkReceiver.RegisterPacketHandler<RoundInfoPacket>(PacketId.RoundInfo, (GenericServerPacketHandler<RoundInfoPacket>)delegate(ushort id, RoundInfoPacket packet) { if (GetScene(id, out var scene)) { scene.Won[id] = packet.Won; Pfps[id] = packet.UserPfp; if (scene.Won.Count >= GetPlayers(scene.SceneName).Length && !scene.Editing) { ToEditor(scene); } } }); } private static void ToEditor(UcsServerScene scene) { scene.Selected = 0; scene.Placed = 0; foreach (var (key, flag2) in scene.Won) { scene.Wins[key] = scene.Wins.GetValueOrDefault(key, 0) + (flag2 ? 1 : 0); } scene.Won.Clear(); scene.Editing = true; _networkSender.SendSingleData(PacketId.ToEditor, (IPacketData)(object)new ToEditorPacket { UserInfo = scene.Wins.Select(delegate(KeyValuePair<ushort, int> i) { IServerPlayer player = _serverApi.ServerManager.GetPlayer(i.Key); return (((player != null) ? player.Username : null) ?? "", Pfps.GetValueOrDefault(i.Key, ""), i.Value); }).ToList(), Seed = Random.Next() }, GetPlayers(scene.SceneName)); } private static void StopGame(string scene) { Scenes.Remove(scene); _networkSender.SendSingleData(PacketId.StartStop, (IPacketData)(object)new TogglePlayingPacket { Playing = false, Scene = scene, Seed = Random.Next() }, GetPlayers(scene)); } private static bool GetScene(ushort id, out UcsServerScene scene) { return Scenes.TryGetValue(_serverApi.ServerManager.GetPlayer(id).CurrentScene, out scene); } private static ushort[] GetPlayers(string scene) { return (from p in _serverApi.ServerManager.Players where p.CurrentScene == scene select p.Id).ToArray(); } private static ushort[] GetPlayers(string scene, ushort id) { return (from p in _serverApi.ServerManager.Players where p.CurrentScene == scene select p.Id into i where i != id select i).ToArray(); } } } namespace UltimateChickenSpider.Mp.Data { public class CursorInfoPacket : IPacketData { public string ObjectID; public float Rotation; public ushort Id; public (float, float, float) Pos; public (float, float, float) Scale; public bool IsReliable => false; public bool DropReliableDataIfNewerExists => true; public void WriteData(IPacket packet) { packet.Write(ObjectID); packet.Write(Rotation); packet.Write(Id); packet.Write(Pos.Item1); packet.Write(Pos.Item2); packet.Write(Pos.Item3); packet.Write(Scale.Item1); packet.Write(Scale.Item2); packet.Write(Scale.Item3); } public void ReadData(IPacket packet) { ObjectID = packet.ReadString(); Rotation = packet.ReadFloat(); Id = packet.ReadUShort(); Pos = (packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat()); Scale = (packet.ReadFloat(), packet.ReadFloat(), packet.ReadFloat()); } } public class GameInfoPacket : IPacketData { public bool Complete; public int DeathType; public bool IsReliable => true; public bool DropReliableDataIfNewerExists => false; public void WriteData(IPacket packet) { packet.Write(DeathType); packet.Write(Complete); } public void ReadData(IPacket packet) { DeathType = packet.ReadInt(); Complete = packet.ReadBool(); } } public enum PacketId { GameInfo, StartStop, ToEditor, DidSelect, DidPlace, RoundInfo, CursorInfo, Teleport } public static class PacketIdExtension { public static IPacketData GetData(this PacketId packetId) { if (1 == 0) { } IPacketData result = (IPacketData)(packetId switch { PacketId.GameInfo => new GameInfoPacket(), PacketId.StartStop => new TogglePlayingPacket(), PacketId.ToEditor => new ToEditorPacket(), PacketId.DidSelect => new PickObjectPacket(), PacketId.DidPlace => new PlacePacket(), PacketId.RoundInfo => new RoundInfoPacket(), PacketId.CursorInfo => new CursorInfoPacket(), PacketId.Teleport => new TeleportPacket(), _ => null, }); if (1 == 0) { } return result; } } public class PickObjectPacket : IPacketData { public int Index; public bool FinishSelect; public bool IsReliable => true; public bool DropReliableDataIfNewerExists => false; public void WriteData(IPacket packet) { packet.Write(Index); packet.Write(FinishSelect); } public void ReadData(IPacket packet) { Index = packet.ReadInt(); FinishSelect = packet.ReadBool(); } } public class PlacePacket : IPacketData { public bool IsErase; public string Data; public bool FinishPlace; public ushort Id; public bool IsReliable => true; public bool DropReliableDataIfNewerExists => false; public void WriteData(IPacket packet) { packet.Write(IsErase); packet.Write(Data); packet.Write(FinishPlace); packet.Write(Id); } public void ReadData(IPacket packet) { IsErase = packet.ReadBool(); Data = packet.ReadString(); FinishPlace = packet.ReadBool(); Id = packet.ReadUShort(); } } public class RoundInfoPacket : IPacketData { public bool Won; public string UserPfp; public bool