Decompiled source of Gentlemens Map Kit v0.10.0
GentlemensMapKit/GentlemensMapKit.dll
Decompiled a day 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.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security.Cryptography; using System.Text; using AGD.ModAPI; using AGD.Modding; using AGDKit; using Character; using Core; using DisputeLib; using FMOD; using FMOD.Studio; using FMODUnity; using FishNet; using FishNet.Connection; using FishNet.Managing; using FishNet.Managing.Object; using FishNet.Managing.Timing; using FishNet.Object; using Game; using Hazards; using HeldItems; using Items; using Map; using Newtonsoft.Json.Linq; using Player; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations; using UnityEngine.Events; using UnityEngine.Localization; using UnityEngine.Localization.Settings; using UnityEngine.Localization.Tables; using UnityEngine.Playables; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using Util; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace GentlemensMapKit { internal static class Bell { public unsafe static string Build(Scene scene, JObject o) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("AGD_MapKitBell"); SceneManager.MoveGameObjectToScene(val, scene); SlapBell slapBell = val.AddComponent<SlapBell>(); slapBell.Center = V(o["center"], Vector3.zero); slapBell.Radius = F(o, "radius", 1.6f); slapBell.Height = F(o, "height", 3.2f); slapBell.Reach = F(o, "reach", 1.4f); slapBell.Shock = F(o, "shock", 5f); slapBell.ShockSpeed = F(o, "shockSpeed", 11f); slapBell.ShockUp = F(o, "shockUp", 4f); slapBell.Cooldown = F(o, "cooldown", 2.5f); slapBell.Dust = V(o["dust"], slapBell.Center + Vector3.up * (slapBell.Height + 1.5f)); string text = ((o["pivot"] != null) ? ((string)o["pivot"]) : null); if (!string.IsNullOrEmpty(text)) { GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); for (int i = 0; i < rootGameObjects.Length; i++) { Transform val2 = Find(rootGameObjects[i].transform, text); if ((Object)(object)val2 != (Object)null) { slapBell.Pivot = val2; break; } } } string[] obj = new string[8] { "bell: at ", null, null, null, null, null, null, null }; Vector3 center = slapBell.Center; obj[1] = ((object)(*(Vector3*)(¢er))/*cast due to .constrained prefix*/).ToString(); obj[2] = " r "; obj[3] = slapBell.Radius.ToString(); obj[4] = ", shock "; obj[5] = slapBell.Shock.ToString(); obj[6] = " m, pivot "; obj[7] = (((Object)(object)slapBell.Pivot != (Object)null) ? ((Object)slapBell.Pivot).name : "none"); return string.Concat(obj); } private static Transform Find(Transform t, string name) { if (((Object)t).name == name) { return t; } for (int i = 0; i < t.childCount; i++) { Transform val = Find(t.GetChild(i), name); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static float F(JObject o, string k, float def) { if (o[k] == null) { return def; } return (float)o[k]; } private static Vector3 V(JToken t, Vector3 def) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) JArray val = (JArray)(object)((t is JArray) ? t : null); if (val == null || ((JContainer)val).Count != 3) { return def; } return new Vector3((float)val[0], (float)val[1], (float)val[2]); } } internal class SlapBell : MonoBehaviour { private class Watch { public int GoId; public Melee Slap; public HeldItem Item; public ItemUseState Last; public float UsingSince = -1f; public float LastRing = -10f; } public Vector3 Center; public Vector3 Dust; public float Radius; public float Height; public float Reach; public float Shock; public float ShockSpeed; public float ShockUp; public float Cooldown; public Transform Pivot; public static int Rings; public static int Shocks; private readonly Dictionary<int, Watch> _watch = new Dictionary<int, Watch>(); private CoreCharacterController[] _chars = (CoreCharacterController[])(object)new CoreCharacterController[0]; private float _charsAt = -10f; private bool _failed; private Vector3 _axis = Vector3.right; private float _amp; private float _phase0 = -10f; private Quaternion _rest = Quaternion.identity; private Material _dust; private Texture2D _tex; private float _lastShock = -10f; private void Start() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Pivot != (Object)null) { _rest = Pivot.localRotation; } } private void Update() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) if (Time.time - _charsAt > 0.5f) { _chars = Object.FindObjectsByType<CoreCharacterController>((FindObjectsSortMode)0); _charsAt = Time.time; } for (int i = 0; i < _chars.Length; i++) { try { Tick(_chars[i]); } catch (Exception ex) { if (!_failed) { _failed = true; Kit.Error("bell: " + ex); } } } if ((Object)(object)Pivot != (Object)null) { float num = Time.time - _phase0; float num2 = ((num < 8f) ? (_amp * Mathf.Exp(-0.55f * num) * Mathf.Sin(num * 2.4f)) : 0f); Pivot.localRotation = _rest * Quaternion.AngleAxis(num2, ((Object)(object)Pivot.parent != (Object)null) ? Pivot.parent.InverseTransformDirection(_axis) : _axis); } } private void Tick(CoreCharacterController ch) { //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Invalid comparison between Unknown and I4 //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Invalid comparison between Unknown and I4 //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Invalid comparison between Unknown and I4 //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Invalid comparison between Unknown and I4 //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Invalid comparison between Unknown and I4 //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ch == (Object)null || !ch.IsAlive) { return; } int instanceID = ((Object)ch).GetInstanceID(); if (!_watch.TryGetValue(instanceID, out var value)) { value = new Watch(); _watch[instanceID] = value; } GameObject val = (((Object)(object)ch.Model != (Object)null) ? ch.Model.HeldItemObject : null); if ((Object)(object)val == (Object)null) { value.GoId = 0; value.Slap = null; return; } if (((Object)val).GetInstanceID() != value.GoId) { value.GoId = ((Object)val).GetInstanceID(); Melee component = val.GetComponent<Melee>(); value.Slap = (((Object)(object)component != (Object)null && component.isDefaultSlap) ? component : null); value.Item = (((Object)(object)value.Slap != (Object)null) ? ((Component)value.Slap).GetComponent<HeldItem>() : null); value.Last = (ItemUseState)0; value.UsingSince = -1f; } if ((Object)(object)value.Item == (Object)null) { return; } ItemUseState useState = value.Item.UseState; float num = 0f; if ((int)useState == 1) { if (value.UsingSince < 0f) { value.UsingSince = Time.time; } } else if (value.UsingSince >= 0f) { num = Time.time - value.UsingSince; value.UsingSince = -1f; } bool num2 = (int)value.Last == 1 && ((int)useState == 3 || (int)useState == 2); value.Last = useState; if (!num2) { return; } Vector3 val2 = ((Component)ch).transform.position + Vector3.up * 1.2f; Vector3 forward = ((Component)ch).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.01f) { return; } ((Vector3)(ref forward)).Normalize(); Vector3 val3 = Center - val2; val3.y = 0f; float magnitude = ((Vector3)(ref val3)).magnitude; bool isServerStarted = InstanceFinder.IsServerStarted; if (!(magnitude > Radius + Reach + (isServerStarted ? 0.2f : 0f)) && !(magnitude < 0.01f) && !(Vector3.Dot(forward, val3 / magnitude) < (isServerStarted ? 0.25f : 0.35f)) && !(val2.y < Center.y - 0.6f) && !(val2.y > Center.y + Height) && !(Time.time - value.LastRing < 0.25f)) { value.LastRing = Time.time; float num3 = 0f; try { num3 = Mathf.Clamp01(num / Mathf.Max(0.05f, value.Slap.chargePeriodDuration)); } catch { } if ((int)useState == 2) { num3 = Mathf.Min(num3, 0.5f); } Ring(ch, forward, num3); } } private void Ring(CoreCharacterController slapper, Vector3 fwd, float charge) { //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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) Rings++; bool flag = charge >= 0.95f; Vector3 position = Center + Vector3.up * (Height * 0.5f); if (flag) { Sfx.Play("sounds/bell_grand.wav", position); } Sfx.Play("sounds/bell_toll.wav", position, flag ? 0.45f : Mathf.Lerp(0.55f, 1f, charge), Mathf.Lerp(1.08f, 0.94f, charge)); _axis = Vector3.Cross(Vector3.up, fwd); _amp = Mathf.Lerp(7f, 24f, charge); _phase0 = Time.time; Burst(Dust, Vector3.down, (int)Mathf.Lerp(40f, 140f, charge), 0.2f, 1.2f, 2.6f, 0.05f, 0.11f, 70f, 1.6f, 0.35f, (ParticleSystemShapeType)4); if (flag) { Burst(new Vector3(Center.x, Center.y - 0.85f, Center.z), Vector3.up, 160, 9f, 13f, 0.6f, 0.08f, 0.16f, 0f, Radius, 0f, (ParticleSystemShapeType)10); } Kit.Log("bell: rung by " + ((Object)slapper).name + " charge " + charge.ToString("0.00") + (flag ? " (shockwave)" : "")); if (charge < 0.8f || !InstanceFinder.IsServerStarted || Time.time - _lastShock < Cooldown) { return; } _lastShock = Time.time; Shocks++; for (int i = 0; i < _chars.Length; i++) { CoreCharacterController val = _chars[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)slapper) && val.IsAlive) { RagdollController ragdollController = val.RagdollController; Vector3 val2 = (((Object)(object)ragdollController != (Object)null && ragdollController.IsRagdoll && (Object)(object)ragdollController.RootRigidbody != (Object)null) ? ragdollController.RootRigidbody.position : ((Component)val).transform.position) - Center; float y = val2.y; val2.y = 0f; if (!(((Vector3)(ref val2)).magnitude > Shock) && !(y < -2.5f) && !(y > Height + 1f)) { Vector3 val3 = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : fwd); float num = 1f - Mathf.Clamp01(((Vector3)(ref val2)).magnitude / Shock) * 0.5f; ((MonoBehaviour)this).StartCoroutine(Knock(val, val3 * ShockSpeed * num + Vector3.up * ShockUp)); } } } } private static IEnumerator Knock(CoreCharacterController ch, Vector3 v) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) try { RagdollController ragdollController = ch.RagdollController; ragdollController.SetRagdoll(true, (Item)null); ragdollController.SetRagdollVelocity(v); } catch (Exception ex) { Kit.Log("bell: knock failed " + ex.Message); yield break; } yield return (object)new WaitForFixedUpdate(); try { if ((Object)(object)ch != (Object)null) { ch.RagdollController.SetRagdollVelocity(v); } } catch { } } private void Burst(Vector3 at, Vector3 dir, int count, float vMin, float vMax, float life, float sMin, float sMax, float angle, float radius, float gravity, ParticleSystemShapeType shape) { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Invalid comparison between Unknown and I4 //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_dust == (Object)null) { Texture2D val = new Texture2D(16, 16, (TextureFormat)4, false); ((Object)val).name = "AGD_BellDust"; ((Texture)val).wrapMode = (TextureWrapMode)1; for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { float num = ((float)j - 7.5f) / 7.5f; float num2 = ((float)i - 7.5f) / 7.5f; val.SetPixel(j, i, new Color(1f, 1f, 1f, (num * num + num2 * num2 < 0.9f) ? 1f : 0f)); } } val.Apply(); _tex = val; _dust = Models.Material(new Color(0.72f, 0.62f, 0.48f), null, 0.95f, 0f, new Color(0.55f, 0.46f, 0.34f)); _dust.SetTexture("_BaseMap", (Texture)(object)_tex); _dust.mainTexture = (Texture)(object)_tex; _dust.SetFloat("_AlphaClip", 1f); _dust.EnableKeyword("_ALPHATEST_ON"); _dust.SetFloat("_Cutoff", 0.5f); _dust.SetFloat("_Cull", 0f); _dust.renderQueue = 2450; } GameObject val2 = new GameObject("AGD_BellDust"); SceneManager.MoveGameObjectToScene(val2, ((Component)this).gameObject.scene); val2.transform.position = at; val2.transform.rotation = (((int)shape == 10) ? Quaternion.Euler(90f, 0f, 0f) : Quaternion.LookRotation(dir)); ParticleSystem val3 = val2.AddComponent<ParticleSystem>(); val3.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val3.main; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).duration = 0.2f; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(life * 0.6f, life); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(vMin, vMax); ((MainModule)(ref main)).startSize = new MinMaxCurve(sMin, sMax); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(gravity); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = Mathf.Max(count, 200); EmissionModule emission = val3.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)count) }); ShapeModule shape2 = val3.shape; ((ShapeModule)(ref shape2)).shapeType = shape; ((ShapeModule)(ref shape2)).angle = angle; ((ShapeModule)(ref shape2)).radius = radius; if ((int)shape == 10) { LimitVelocityOverLifetimeModule limitVelocityOverLifetime = val3.limitVelocityOverLifetime; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = 0.12f; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = MinMaxCurve.op_Implicit(1.5f); } SizeOverLifetimeModule sizeOverLifetime = val3.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 1f, 1f, 0.3f)); ParticleSystemRenderer component = val2.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = _dust; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; val3.Play(); Object.Destroy((Object)(object)val2, life + 0.5f); } private void OnDestroy() { if ((Object)(object)_dust != (Object)null) { Object.Destroy((Object)(object)_dust); } if ((Object)(object)_tex != (Object)null) { Object.Destroy((Object)(object)_tex); } } } internal static class Crane { public unsafe static string Build(Scene scene, JObject o) { //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) string text = ((o["root"] != null) ? ((string)o["root"]) : "CraneSlew"); string text2 = ((o["warn"] != null) ? ((string)o["warn"]) : null); Transform val = null; Transform val2 = null; GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val3 in rootGameObjects) { if ((Object)(object)val == (Object)null) { val = Find(val3.transform, text); } if ((Object)(object)val2 == (Object)null && !string.IsNullOrEmpty(text2)) { val2 = Find(val3.transform, text2); } } if ((Object)(object)val == (Object)null) { return "crane: no '" + text + "' in the scene"; } CraneDriver craneDriver = ((Component)val).gameObject.AddComponent<CraneDriver>(); craneDriver.Step = F(o, "step", 180f); craneDriver.Swing = Mathf.Max(0.5f, F(o, "swing", 7f)); craneDriver.Wait = Mathf.Max(0f, F(o, "wait", 6f)); craneDriver.WarnLead = F(o, "warnLead", 2.5f); craneDriver.Warn = val2; craneDriver.Bell = ((o["bell"] != null) ? ((string)o["bell"]) : null); craneDriver.Rest = val.rotation; Rigidbody val4 = ((Component)val).GetComponent<Rigidbody>(); if ((Object)(object)val4 == (Object)null) { val4 = ((Component)val).gameObject.AddComponent<Rigidbody>(); } val4.isKinematic = true; val4.interpolation = (RigidbodyInterpolation)1; val4.useGravity = false; craneDriver.Body = val4; JToken obj = o["hitbox"]; JArray val5 = (JArray)(object)((obj is JArray) ? obj : null); Vector3 val6 = ((val5 != null && ((JContainer)val5).Count == 6) ? new Vector3((float)val5[0], (float)val5[1], (float)val5[2]) : new Vector3(10.5f, 5.7f, 0f)); Vector3 val7 = ((val5 != null && ((JContainer)val5).Count == 6) ? new Vector3((float)val5[3], (float)val5[4], (float)val5[5]) : new Vector3(8f, 1.2f, 1f)); Item val8 = null; try { val8 = Kit.FindItem("Train"); } catch (Exception) { } GameObject val9 = new GameObject("CraneHitbox"); val9.SetActive(false); val9.transform.SetParent(val, false); val9.transform.localPosition = val6; BoxCollider val10 = val9.AddComponent<BoxCollider>(); ((Collider)val10).isTrigger = true; val10.size = val7; Transform from = new GameObject("CraneKnockFrom").transform; from.SetParent(val, false); from.localPosition = val6; Damager val11 = val9.AddComponent<Damager>(); float num = F(o, "damage", 15f); float outward = F(o, "out", 0.8f); Reflect.Set(val11, "mainCollider", val10); Reflect.Set(val11, "active", true); Reflect.Set(val11, "kill", false); Reflect.Set(val11, "damage", num); Reflect.Set(val11, "forceMagnitude", F(o, "force", 180f)); Reflect.Set(val11, "upwardForce", F(o, "up", 120f)); Reflect.Set(val11, "flattenForce", true); Reflect.Set(val11, "includeRagdolls", true); Reflect.Set(val11, "forcePoint", from); Reflect.Set(val11, "forceType", (object)(ForceType)0); if ((Object)(object)val8 != (Object)null) { Reflect.Set(val11, "item", val8); } Transform rootT = val; float sign = ((craneDriver.Step >= 0f) ? 1f : (-1f)); val11.OnHitCharacter = (Action<CoreCharacterController>)Delegate.Combine(val11.OnHitCharacter, (Action<CoreCharacterController>)delegate(CoreCharacterController victim) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0052: 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) try { Vector3 position = ((Component)victim).transform.position; Vector3 position2 = rootT.position; Vector3 right = default(Vector3); ((Vector3)(ref right))..ctor(position.x - position2.x, 0f, position.z - position2.z); if (((Vector3)(ref right)).sqrMagnitude < 0.01f) { right = rootT.right; } right.y = 0f; ((Vector3)(ref right)).Normalize(); Vector3 val13 = Vector3.Cross(Vector3.up, right) * sign + outward * right; Vector3 normalized = ((Vector3)(ref val13)).normalized; from.position = position - normalized * 20f; } catch (Exception) { } }); object obj2 = Reflect.Get<object>(val11, "kill"); object obj3 = Reflect.Get<object>(val11, "damage"); if (!(obj2 is bool) || (bool)obj2 || !(obj3 is float) || Mathf.Abs((float)obj3 - num) > 0.01f) { Object.Destroy((Object)(object)val9); return "crane: Damager fields did not take (kill " + obj2?.ToString() + ", damage " + obj3?.ToString() + "): the crane swings without a hit"; } craneDriver.Hit = (Collider)(object)val10; val9.SetActive(true); string[] obj4 = new string[20] { "crane: ", ((Object)val).name, " ", craneDriver.Step.ToString(), " deg in ", craneDriver.Swing.ToString(), " s, wait ", craneDriver.Wait.ToString(), " s, hitbox ", null, null, null, null, null, null, null, null, null, null, null }; Vector3 val12 = val7; obj4[9] = ((object)(*(Vector3*)(&val12))/*cast due to .constrained prefix*/).ToString(); obj4[10] = " at "; val12 = val6; obj4[11] = ((object)(*(Vector3*)(&val12))/*cast due to .constrained prefix*/).ToString(); obj4[12] = ", damage "; obj4[13] = num.ToString(); obj4[14] = ", force "; obj4[15] = F(o, "force", 180f).ToString(); obj4[16] = " + up "; obj4[17] = F(o, "up", 120f).ToString(); obj4[18] = ", warn "; obj4[19] = (((Object)(object)val2 != (Object)null) ? ((Object)val2).name : "none"); return string.Concat(obj4); } private static Transform Find(Transform t, string name) { if (((Object)t).name == name) { return t; } for (int i = 0; i < t.childCount; i++) { Transform val = Find(t.GetChild(i), name); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static float F(JObject o, string k, float def) { if (o[k] == null) { return def; } return (float)o[k]; } } internal class CraneDriver : MonoBehaviour { public float Step; public float Swing; public float Wait; public float WarnLead; public Quaternion Rest; public Transform Warn; public string Bell; public Rigidbody Body; public Collider Hit; public static float LastAngle; public static bool LastMoving; private GameObject _warnA; private GameObject _warnB; private bool _warnLooked; private bool _wasWarn; private float _flash; private double _clock; private bool _clockSet; private float Cycle => Swing + Wait; private double Clock() { double num = Time.timeAsDouble; try { TimeManager timeManager = InstanceFinder.TimeManager; if ((Object)(object)timeManager != (Object)null && timeManager.Tick != 0) { num = ((double)timeManager.Tick + timeManager.GetTickPercentAsDouble()) * timeManager.TickDelta; } } catch (Exception) { } if (!_clockSet || Math.Abs(num - _clock) > 0.5) { _clock = num; _clockSet = true; } else { _clock += (num - _clock) * 0.2; } return _clock; } private float Phase(double t) { double num = Cycle; double num2 = t % num; if (num2 < 0.0) { num2 += num; } return (float)num2; } public float AngleAt(double t) { double num = Cycle; double num2 = Math.Floor(t / num); float num3 = Phase(t); float num4 = ((num3 < Swing) ? (num3 / Swing) : 1f); num4 = num4 * num4 * (3f - 2f * num4); double num5 = (num2 + (double)num4) * (double)Step; num5 %= 360.0; if (num5 < 0.0) { num5 += 360.0; } return (float)num5; } private void FixedUpdate() { //IL_0065: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) double t = Clock() + (double)Time.fixedDeltaTime; float num = (LastAngle = AngleAt(t)); bool flag = (LastMoving = Phase(t) < Swing); if ((Object)(object)Hit != (Object)null && Hit.enabled != flag) { Hit.enabled = flag; } Quaternion val = Quaternion.Euler(0f, num, 0f) * Rest; if ((Object)(object)Body != (Object)null) { Body.MoveRotation(val); } else { ((Component)this).transform.rotation = val; } } private void Update() { float num = Phase(_clock); bool flag = num < Swing || num > Cycle - WarnLead; if ((Object)(object)Warn != (Object)null) { _flash += Time.deltaTime; bool flag2 = (int)(_flash / 0.45f) % 2 == 0; if (!_warnLooked) { _warnLooked = true; Transform val = Warn.Find("A"); Transform val2 = Warn.Find("B"); _warnA = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null); _warnB = (((Object)(object)val2 != (Object)null) ? ((Component)val2).gameObject : null); } if ((Object)(object)_warnA != (Object)null) { _warnA.SetActive(flag && flag2); } if ((Object)(object)_warnB != (Object)null) { _warnB.SetActive(flag && !flag2); } } if (flag && !_wasWarn && _clockSet) { Ring(); } _wasWarn = flag; } private void Ring() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(Bell)) { return; } try { RuntimeManager.PlayOneShot(GUID.Parse(Bell), ((Component)this).transform.position + Vector3.up * 13f); } catch (Exception ex) { Kit.Log("[crane] bell: " + ex.Message); Bell = null; } } } internal static class Destructibles { private static Type T(string name) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = assemblies[i].GetType(name, throwOnError: false); if (type != null) { return type; } } return null; } public static void Build(Scene scene, List<GameObject> all, string tag) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown Type type = T("Game.DestructibleParent"); Type type2 = T("Game.DestructibleChild"); List<GameObject> list = all.Where((GameObject g) => ((Object)g).name.StartsWith("Destructible_")).ToList(); if (list.Count == 0) { return; } if (type == null || type2 == null) { Kit.Warn(tag + list.Count + " destructible group(s) but the game has no DestructibleParent/Child"); return; } FieldInfo field = type2.GetField("MaterialType"); int num = 0; int num2 = 0; using (MD5 mD = MD5.Create()) { foreach (GameObject item in list) { try { if ((Object)(object)item.GetComponent(type) != (Object)null) { continue; } List<GameObject> list2 = new List<GameObject>(); foreach (Transform item2 in item.transform) { Transform val = item2; if ((Object)(object)((Component)val).GetComponent<Collider>() != (Object)null) { list2.Add(((Component)val).gameObject); } } if (list2.Count == 0) { continue; } object obj = MatType(field, ((Object)item).name); foreach (GameObject item3 in list2) { Rigidbody val2 = item3.GetComponent<Rigidbody>(); if ((Object)(object)val2 == (Object)null) { val2 = item3.AddComponent<Rigidbody>(); } val2.isKinematic = true; Component val3 = item3.AddComponent(type2); if (obj != null) { field.SetValue(val3, obj); } byte[] b = mD.ComputeHash(Encoding.UTF8.GetBytes(((Scene)(ref scene)).name + "|" + Path(item3.transform))); Reflect.Set(val3, "DestructibleGuidString", new Guid(b).ToString()); num2++; } Component o = item.AddComponent(type); Transform val4 = item.transform.Find("Intact"); Renderer val5 = (((Object)(object)val4 != (Object)null) ? ((Component)val4).GetComponent<Renderer>() : item.GetComponent<Renderer>()); Reflect.Set(o, "goodRenderer", val5); Reflect.Set(o, "useGoodRenderer", (Object)(object)val5 != (Object)null); num++; } catch (Exception ex) { Kit.Warn(tag + "destructible group " + ((Object)item).name + " skipped: " + ex.Message); } } } Kit.Log(tag + "destructibles: " + num + " groups, " + num2 + " pieces"); } private static object MatType(FieldInfo f, string groupName) { if (f == null || !f.FieldType.IsEnum) { return null; } string[] array = groupName.Split('_'); string value = ((array.Length > 1) ? array[1] : ""); if (Array.IndexOf(Enum.GetNames(f.FieldType), value) < 0) { return null; } return Enum.Parse(f.FieldType, value); } private static string Path(Transform t) { StringBuilder stringBuilder = new StringBuilder(); while ((Object)(object)t != (Object)null) { stringBuilder.Insert(0, "/" + t.GetSiblingIndex() + ":" + ((Object)t).name); t = t.parent; } return stringBuilder.ToString(); } } internal static class Dunk { public unsafe static string Build(Scene scene, JObject o) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("AGD_MapKitDunk"); SceneManager.MoveGameObjectToScene(val, scene); DunkZone dunkZone = val.AddComponent<DunkZone>(); dunkZone.Below = F(o, "below", -3.5f); dunkZone.Above = F(o, "above", -1f); JToken obj = o["box"]; JArray val2 = (JArray)(object)((obj is JArray) ? obj : null); dunkZone.HasBox = val2 != null && ((JContainer)val2).Count == 4; if (dunkZone.HasBox) { dunkZone.Box = new Vector4((float)val2[0], (float)val2[1], (float)val2[2], (float)val2[3]); } JToken obj2 = o["to"]; JArray val3 = (JArray)(object)((obj2 is JArray) ? obj2 : null); if (val3 != null && ((JContainer)val3).Count > 0 && val3[0] is JArray) { dunkZone.Tos = (Vector3[])(object)new Vector3[((JContainer)val3).Count]; for (int i = 0; i < ((JContainer)val3).Count; i++) { dunkZone.Tos[i] = V(val3[i], Vector3.zero); } } else { dunkZone.Tos = (Vector3[])(object)new Vector3[1] { V(o["to"], Vector3.zero) }; } dunkZone.To = dunkZone.Tos[0]; dunkZone.HasSplash = o["splash"] != null; dunkZone.Splash = V(o["splash"], dunkZone.To + Vector3.up * 3f); dunkZone.Damage = Mathf.Max(0f, F(o, "damage", 0f)); dunkZone.Lift = o["theme"] != null && (string)o["theme"] == "lift"; dunkZone.Slow = Mathf.Clamp(F(o, "slow", 0.553f), 0.05f, 1f); dunkZone.Seconds = Mathf.Max(0.5f, F(o, "seconds", 5f)); dunkZone.PerRound = (int)F(o, "perRound", -1f); string[] obj3 = new string[14] { "dunk: below ", dunkZone.Below.ToString(), null, null, null, null, null, null, null, null, null, null, null, null }; object obj4; if (!dunkZone.HasBox) { obj4 = ""; } else { Vector4 box = dunkZone.Box; obj4 = ", outside box " + ((object)(*(Vector4*)(&box))/*cast due to .constrained prefix*/).ToString() + " under " + dunkZone.Above; } obj3[2] = (string)obj4; obj3[3] = " -> "; Vector3 to = dunkZone.To; obj3[4] = ((object)(*(Vector3*)(&to))/*cast due to .constrained prefix*/).ToString(); obj3[5] = ((dunkZone.Tos.Length > 1) ? (" (+" + (dunkZone.Tos.Length - 1) + " more)") : ""); obj3[6] = (dunkZone.Lift ? ", lift" : ""); obj3[7] = ((dunkZone.Damage > 0f) ? (", " + dunkZone.Damage + " damage") : ""); obj3[8] = ", slow x"; obj3[9] = dunkZone.Slow.ToString(); obj3[10] = " for "; obj3[11] = dunkZone.Seconds.ToString(); obj3[12] = " s, "; obj3[13] = ((dunkZone.PerRound < 0) ? "every fall" : (dunkZone.PerRound + " per round")); return string.Concat(obj3); } private static float F(JObject o, string k, float def) { if (o[k] == null) { return def; } return (float)o[k]; } private static Vector3 V(JToken t, Vector3 def) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) JArray val = (JArray)(object)((t is JArray) ? t : null); if (val == null || ((JContainer)val).Count != 3) { return def; } return new Vector3((float)val[0], (float)val[1], (float)val[2]); } } internal class DunkZone : MonoBehaviour { public float Below; public float Above; public float Slow; public float Seconds; public bool HasBox; public Vector4 Box; public Vector3 To; public Vector3 Splash; public Vector3[] Tos; public bool HasSplash; public bool Lift; public float Damage; public int PerRound; private readonly Dictionary<int, int> _count = new Dictionary<int, int>(); private readonly Dictionary<int, float> _busy = new Dictionary<int, float>(); private float _next; private float _lastRound; private readonly HashSet<long> _seen = new HashSet<long>(); private CoreCharacterController[] _chars = (CoreCharacterController[])(object)new CoreCharacterController[0]; private float _charsAt = -10f; private Material _water; private Material _foam; private Material _dust; private Texture2D _tex; public static float RoundTime() { try { return RoundManager.GetRoundTime(); } catch { return float.NaN; } } private static Vector3 RootOf(CoreCharacterController c) { //IL_002c: 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) RagdollController ragdollController = c.RagdollController; if (!((Object)(object)ragdollController != (Object)null) || !ragdollController.IsRagdoll || !((Object)(object)ragdollController.RootRigidbody != (Object)null)) { return ((Component)c).transform.position; } return ragdollController.RootRigidbody.position; } private CoreCharacterController[] Chars() { if (Time.time - _charsAt > 0.5f) { _chars = Object.FindObjectsByType<CoreCharacterController>((FindObjectsSortMode)0); _charsAt = Time.time; } return _chars; } public bool Falling(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (p.y < Below) { return true; } if (HasBox && p.y < Above) { if (!(p.x < Box.x) && !(p.x > Box.y) && !(p.z < Box.z)) { return p.z > Box.w; } return true; } return false; } private void Update() { if (InstanceFinder.IsServerStarted && Time.time >= _next) { _next = Time.time + 0.05f; HostCheck(); } ClientScan(); } private void HostCheck() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) float num = RoundTime(); if (num < _lastRound - 0.5f) { _count.Clear(); _busy.Clear(); } _lastRound = num; CoreCharacterController[] array = Chars(); foreach (CoreCharacterController val in array) { if ((Object)(object)val == (Object)null || !val.IsAlive) { continue; } int instanceID = ((Object)val).GetInstanceID(); if ((!_busy.TryGetValue(instanceID, out var value) || !(Time.time < value)) && Falling(RootOf(val))) { _count.TryGetValue(instanceID, out var value2); if (PerRound < 0 || value2 < PerRound) { _count[instanceID] = value2 + 1; _busy[instanceID] = Time.time + 3f; ((MonoBehaviour)this).StartCoroutine(Catch(val)); } } } } public Vector3 Nearest(Vector3 p) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) Vector3 result = To; float num = float.MaxValue; if (Tos != null) { for (int i = 0; i < Tos.Length; i++) { float num2 = Tos[i].x - p.x; float num3 = Tos[i].z - p.z; float num4 = num2 * num2 + num3 * num3; if (num4 < num) { num = num4; result = Tos[i]; } } } return result; } private unsafe IEnumerator Catch(CoreCharacterController c) { float started = RoundTime(); RagdollController rc = c.RagdollController; Vector3 To = Nearest(RootOf(c)); if (Damage > 0f) { try { c.DealDamage(new DamageSource { Damage = Damage }); } catch (Exception ex) { Kit.Warn("dunk: damage failed: " + ex.Message); } if ((Object)(object)c == (Object)null || !c.IsAlive) { Kit.Log("dunk: the fall killed " + (((Object)(object)c != (Object)null) ? ((Object)c).name : "?")); yield break; } } if (Lift && (Object)(object)rc != (Object)null && rc.IsRagdoll) { try { rc.ForceOutOfRagdoll(); } catch (Exception ex2) { Kit.Warn("dunk: unragdoll failed: " + ex2.Message); } yield return (object)new WaitForFixedUpdate(); if ((Object)(object)c == (Object)null) { yield break; } } if (!Lift && (Object)(object)rc != (Object)null && rc.IsRagdoll && (Object)(object)rc.RootRigidbody != (Object)null) { Vector3 from = rc.RootRigidbody.position; float linearDamping = rc.RootRigidbody.linearDamping; float num = 2f; float bestFree = -1f; Vector3 val = To + Vector3.up * 0.5f; Vector3 val2 = Vector3.up * 14f; for (float num2 = 1.2f; num2 <= 4.01f; num2 += 0.2f) { float apex; Vector3 val3 = Ballistic.Solve(from, val, num2, linearDamping, out apex); if (!(apex < Mathf.Max(from.y, val.y) + 1.5f)) { float num3 = SharkLaunch.FreeFraction(from, val3, num2 * 0.97f, linearDamping); if (num3 > bestFree + 0.001f) { bestFree = num3; val2 = val3; num = num2; } if (num3 >= 0.999f) { break; } } } if (bestFree < 0.999f) { try { rc.ForceOutOfRagdoll(); } catch (Exception ex3) { Kit.Warn("dunk: unragdoll failed: " + ex3.Message); } yield return (object)new WaitForFixedUpdate(); if ((Object)(object)c == (Object)null) { yield break; } CharacterMovementController component = ((Component)c).GetComponent<CharacterMovementController>(); try { if ((Object)(object)component != (Object)null) { component.ServerTeleport(To); } } catch (Exception ex4) { Kit.Warn("dunk: teleport failed: " + ex4.Message); } string[] obj = new string[7] { "dunk: ", ((Object)c).name, " ragdoll from ", null, null, null, null }; Vector3 val4 = from; obj[3] = ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString(); obj[4] = " had no clear arc (best "; obj[5] = bestFree.ToString("0.00"); obj[6] = "), teleported"; Kit.Log(string.Concat(obj)); } else { rc.ApplyForce(val2, (RagdollForceType)1); _busy[((Object)c).GetInstanceID()] = Time.time + num + 2f; string[] obj2 = new string[7] { "dunk: ", ((Object)c).name, " ragdoll from ", null, null, null, null }; Vector3 val4 = from; obj2[3] = ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString(); obj2[4] = " arc "; obj2[5] = num.ToString("0.0"); obj2[6] = " s"; Kit.Log(string.Concat(obj2)); yield return (object)new WaitForSeconds(num); } } else { CharacterMovementController component2 = ((Component)c).GetComponent<CharacterMovementController>(); if ((Object)(object)component2 == (Object)null) { Kit.Warn("dunk: no movement controller on " + ((Object)c).name); yield break; } try { component2.ServerTeleport(To); } catch (Exception ex5) { Kit.Warn("dunk: teleport failed: " + ex5.Message); yield break; } string name = ((Object)c).name; Vector3 val4 = To; Kit.Log("dunk: " + name + " teleported to " + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString()); } if ((Object)(object)c == (Object)null || !c.IsAlive) { yield break; } float num4 = RoundTime(); if (float.IsNaN(num4) || num4 < started) { yield break; } try { StatusEffectController statusEffectController = c.statusEffectController; StatusEffectData val5 = new StatusEffectData(); int num5 = (val5.Id = statusEffectController.GetNextStatusEffectId()); val5.Effect = (StatusEffect)13; val5.Value = Slow; val5.Item = null; val5.Owner = (NetworkBehaviour)(object)c; val5.RemoveAfterTime = true; val5.EndTime = num4 + Seconds; statusEffectController.AddStatusEffect(num5, val5); } catch (Exception ex6) { Kit.Warn("dunk: slow failed: " + ex6.Message); } } private void ClientScan() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 CoreCharacterController[] array = Chars(); foreach (CoreCharacterController val in array) { if ((Object)(object)val == (Object)null || (Object)(object)val.statusEffectController == (Object)null) { continue; } List<StatusEffectData> collection = val.statusEffectController.StatusEffects.Collection; for (int j = 0; j < collection.Count; j++) { StatusEffectData val2 = collection[j]; if (val2 == null || (Object)(object)val2.Item != (Object)null || (int)val2.Effect != 13 || Mathf.Abs(val2.Value - Slow) > 0.0005f) { continue; } long item = ((long)((Object)val).GetInstanceID() << 32) | (uint)val2.Id; if (_seen.Add(item)) { if (_seen.Count > 500) { _seen.Clear(); } Soak(val); } } } } private unsafe void Soak(CoreCharacterController c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) Vector3 val = RootOf(c); string[] obj = new string[5] { "dunk: soak ", ((Object)c).name, ((NetworkBehaviour)c).IsOwner ? " (own)" : "", " at ", null }; Vector3 val2 = val; obj[4] = ((object)(*(Vector3*)(&val2))/*cast due to .constrained prefix*/).ToString(); Kit.Log(string.Concat(obj)); if (Lift) { Vector3 val3 = Nearest(val); Burst(val3 + Vector3.up * 0.15f, Vector3.up, 70, 1.2f, 3.2f, 1.3f, 0.06f, 0.14f, 80f, 0.6f, dust: true); Sfx.Play("sounds/bell_toll.wav", val3 + Vector3.up * 2f, 0.55f, 1.7f); return; } Vector3 val4 = (HasSplash ? Splash : (Nearest(val) + Vector3.up * 3f)); Burst(val4, Vector3.up, 200, 8f, 15f, 1.8f, 0.07f, 0.13f, 7f, 0.5f); Burst(val4 + Vector3.up * 0.3f, Vector3.up, 80, 3f, 6f, 1.4f, 0.06f, 0.11f, 55f, 0.8f); Burst(val + Vector3.up * 0.4f, Vector3.up, 60, 2.5f, 5f, 1.1f, 0.05f, 0.09f, 40f, 0.4f); Sfx.Play("sounds/splash.wav", val4); Sfx.Play("sounds/splash.wav", val, 0.8f, 1.15f); GameObject obj2 = Burst(Vector3.zero, Vector3.down, 0, 0f, 0.5f, 0.7f, 0.04f, 0.07f, 10f, 0.35f); obj2.transform.SetParent(((Component)c).transform, false); obj2.transform.localPosition = Vector3.up * 1.1f; ParticleSystem component = obj2.GetComponent<ParticleSystem>(); ShapeModule shape = component.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5; ((ShapeModule)(ref shape)).scale = new Vector3(0.6f, 1.3f, 0.45f); EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(45f); MainModule main = component.main; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).duration = 1f; component.Play(); ((MonoBehaviour)this).StartCoroutine(StopAfter(component, Seconds)); Object.Destroy((Object)(object)obj2, Seconds + 1.5f); } private static IEnumerator StopAfter(ParticleSystem ps, float t) { yield return (object)new WaitForSeconds(t); if ((Object)(object)ps != (Object)null) { ps.Stop(true, (ParticleSystemStopBehavior)1); } } private GameObject Burst(Vector3 at, Vector3 dir, int count, float vMin, float vMax, float life, float sMin, float sMax, float angle, float radius) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return Burst(at, dir, count, vMin, vMax, life, sMin, sMax, angle, radius, dust: false); } private GameObject Burst(Vector3 at, Vector3 dir, int count, float vMin, float vMax, float life, float sMin, float sMax, float angle, float radius, bool dust) { //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029b: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: 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_0090: 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) if ((Object)(object)_water == (Object)null) { Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false); ((Object)val).name = "AGD_Droplet"; ((Texture)val).wrapMode = (TextureWrapMode)1; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = ((float)j - 15.5f) / 15.5f; float num2 = ((float)i - 15.5f) / 15.5f; float num3 = Mathf.Sqrt(num * num + num2 * num2); Vector2 val2 = new Vector2(num + 0.35f, num2 - 0.35f); float num4 = Mathf.Clamp01(1f - ((Vector2)(ref val2)).magnitude * 2.2f); val.SetPixel(j, i, new Color(0.8f + 0.2f * num4, 0.9f + 0.1f * num4, 1f, (num3 < 0.95f) ? 1f : 0f)); } } val.Apply(); _tex = val; _water = Cutout(new Color(0.62f, 0.8f, 0.95f), new Color(0.12f, 0.18f, 0.24f)); _foam = Cutout(new Color(0.9f, 0.95f, 1f), new Color(0.2f, 0.24f, 0.28f)); _dust = Cutout(new Color(0.62f, 0.56f, 0.47f), new Color(0.06f, 0.05f, 0.04f)); } GameObject val3 = new GameObject("AGD_DunkSplash"); SceneManager.MoveGameObjectToScene(val3, ((Component)this).gameObject.scene); val3.transform.position = at; val3.transform.rotation = Quaternion.LookRotation(dir); ParticleSystem val4 = val3.AddComponent<ParticleSystem>(); val4.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val4.main; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).duration = 0.25f; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(life * 0.6f, life); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(vMin, vMax); ((MainModule)(ref main)).startSize = new MinMaxCurve(sMin, sMax); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(dust ? 0.15f : 1.3f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = Mathf.Max(count, 300); EmissionModule emission = val4.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); if (count > 0) { ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)count) }); } ShapeModule shape = val4.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).angle = angle; ((ShapeModule)(ref shape)).radius = radius; SizeOverLifetimeModule sizeOverLifetime = val4.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 1f, 1f, 0.4f)); ParticleSystemRenderer component = val3.GetComponent<ParticleSystemRenderer>(); component.renderMode = (ParticleSystemRenderMode)1; component.velocityScale = 0.06f; component.lengthScale = 1.5f; ((Renderer)component).sharedMaterial = (dust ? _dust : ((count > 100) ? _foam : _water)); if (dust) { component.renderMode = (ParticleSystemRenderMode)0; } ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; if (count > 0) { val4.Play(); Object.Destroy((Object)(object)val3, life + 0.5f); } return val3; } private Material Cutout(Color tint, Color glow) { //IL_0000: 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) Material obj = Models.Material(tint, null, 0.9f, 0f, glow); obj.SetTexture("_BaseMap", (Texture)(object)_tex); obj.mainTexture = (Texture)(object)_tex; obj.SetFloat("_AlphaClip", 1f); obj.EnableKeyword("_ALPHATEST_ON"); obj.SetFloat("_Cutoff", 0.5f); obj.SetFloat("_Cull", 0f); obj.renderQueue = 2450; return obj; } private void OnDestroy() { if ((Object)(object)_water != (Object)null) { Object.Destroy((Object)(object)_water); } if ((Object)(object)_foam != (Object)null) { Object.Destroy((Object)(object)_foam); } if ((Object)(object)_dust != (Object)null) { Object.Destroy((Object)(object)_dust); } if ((Object)(object)_tex != (Object)null) { Object.Destroy((Object)(object)_tex); } } } internal static class MapContract { private static readonly string[] Contract = new string[7] { "Game.SpawnPoint", "Game.ItemSpawnPoint", "Game.StageBounds", "Map.StageConfig", "Game.KingOfTheHillMapZone", "Map.CannonSpawnPoint", "Map.CannonSpawner" }; private static Type T(string name) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = assemblies[i].GetType(name, throwOnError: false); if (type != null) { return type; } } return null; } public static void Check(Scene scene, string pack) { //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) string text = "pack map " + ((Scene)(ref scene)).name + " (" + pack + "): "; List<GameObject> list = (from val2 in ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject r) => r.GetComponentsInChildren<Transform>(true)) select ((Component)val2).gameObject).ToList(); List<string> list2 = new List<string>(); string[] contract = Contract; foreach (string text2 in contract) { Type t = T(text2); if (t == null) { list2.Add(text2 + "=no such type"); continue; } list2.Add(text2.Substring(text2.IndexOf('.') + 1) + "=" + list.Count((GameObject g) => (Object)(object)g.GetComponent(t) != (Object)null) + ((t.Assembly.GetName().Name != "AGD") ? ("(" + t.Assembly.GetName().Name + ")") : "")); } Kit.Log(text + "components " + string.Join(", ", list2.ToArray())); List<GameObject> list3 = list.Where((GameObject g) => g.GetComponents<Component>().Any((Component c) => (Object)(object)c == (Object)null)).ToList(); Kit.Log(text + list3.Count + " object(s) with missing scripts" + ((list3.Count > 0) ? (": " + string.Join(", ", list3.Select((GameObject g) => ((Object)g).name).Distinct().Take(20) .ToArray())) : "")); int num2 = 0; int num3 = 0; foreach (Renderer item in list.SelectMany((GameObject g) => g.GetComponents<Renderer>())) { num2++; Material[] sharedMaterials = item.sharedMaterials; foreach (Material val in sharedMaterials) { if ((Object)(object)val == (Object)null || (Object)(object)val.shader == (Object)null || !val.shader.isSupported) { num3++; } } } Kit.Log(text + num2 + " renderers, " + num3 + " materials with an unsupported shader, " + LightmapSettings.lightmaps.Length + " lightmaps, navmesh triangles " + NavMesh.CalculateTriangulation().vertices.Length); if (list3.Count > 0) { Rebuild(scene, list, text); } Destructibles.Build(scene, list, text); AddCannonSpawner(scene, text); } private static void Rebuild(Scene scene, List<GameObject> all, string tag) { //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) Type type = T("Game.SpawnPoint"); Type type2 = T("Game.ItemSpawnPoint"); Type type3 = T("Game.StageBounds"); Type type4 = T("Map.StageConfig"); Type type5 = T("Game.KingOfTheHillMapZone"); Type type6 = T("Map.CannonSpawnPoint"); int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; List<string> list = new List<string>(); foreach (GameObject item in all) { string name = ((Object)item).name; if (type != null && name.StartsWith("SpawnPoint") && item.transform.childCount == 0 && (Object)(object)item.GetComponent(type) == (Object)null) { item.AddComponent(type); num++; } else if (type2 != null && name.StartsWith("ItemSpawn") && item.transform.childCount == 0 && (Object)(object)item.GetComponent(type2) == (Object)null) { list.Add(SetItemType(item.AddComponent(type2), name)); num2++; } else if (type3 != null && name == "StageBounds" && (Object)(object)item.GetComponent(type3) == (Object)null && (Object)(object)item.GetComponent<BoxCollider>() != (Object)null) { BoxCollider component = item.GetComponent<BoxCollider>(); ((Collider)component).isTrigger = true; Reflect.Set(item.AddComponent(type3), "_bounds", component); num3++; } else if (type6 != null && name.StartsWith("CannonSpawnPoint") && (Object)(object)item.GetComponent(type6) == (Object)null) { item.AddComponent(type6); num4++; } else if (type5 != null && name.StartsWith("KothZone") && (Object)(object)item.GetComponent(type5) == (Object)null && (Object)(object)item.GetComponent<BoxCollider>() != (Object)null) { Component o = item.AddComponent(type5); Reflect.Set(o, "spawnVolume", item.GetComponent<BoxCollider>()); num5++; try { if (Reflect.Has(o, "groundLayers")) { LayerMask val = Reflect.Get<LayerMask>(o, "groundLayers"); if (((LayerMask)(ref val)).value == 0) { Reflect.Set(o, "groundLayers", LayerMask.op_Implicit(1)); } } } catch (Exception ex) { Kit.Warn(tag + "hill groundLayers not set: " + ex.Message); } } else if (type4 != null && name == "StageConfig" && (Object)(object)item.GetComponent(type4) == (Object)null) { Component o2 = item.AddComponent(type4); GameObject val2 = ((IEnumerable<GameObject>)all).FirstOrDefault((Func<GameObject, bool>)((GameObject x) => ((Object)x).name == "SpectateCamera")); if ((Object)(object)val2 != (Object)null) { Reflect.Set(o2, "spectateCamera", val2.transform); } Light val3 = all.Select((GameObject x) => x.GetComponent<Light>()).FirstOrDefault((Func<Light, bool>)((Light l) => (Object)(object)l != (Object)null && (int)l.type == 1)); if ((Object)(object)val3 != (Object)null) { Reflect.Set(o2, "directionalLight", val3); } num6++; } } Kit.Log(tag + "rebuilt " + num + " spawns, " + num2 + " item spawns (" + string.Join(" ", list.ToArray()) + "), " + num3 + " bounds, " + num6 + " stage config, " + num5 + " koth zones, " + num4 + " cannon markers"); } private static string SetItemType(Component it, string objectName) { int num = objectName.LastIndexOf('_'); if (num < 0) { return "default"; } string text = objectName.Substring(num + 1); FieldInfo field = ((object)it).GetType().GetField("itemSpawnType", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null || !field.FieldType.IsEnum || Array.IndexOf(Enum.GetNames(field.FieldType), text) < 0) { return "default"; } field.SetValue(it, Enum.Parse(field.FieldType, text)); return text; } private static void AddCannonSpawner(Scene scene, string tag) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_00ad: Unknown result type (might be due to invalid IL or missing references) List<CannonSpawnPoint> list = ((Scene)(ref scene)).GetRootGameObjects().SelectMany((GameObject r) => r.GetComponentsInChildren<CannonSpawnPoint>(true)).ToList(); if (list.Count != 0 && !Object.FindObjectsByType<CannonSpawner>((FindObjectsSortMode)0).Any((CannonSpawner s) => ((Component)s).gameObject.scene == scene)) { List<CannonSpawnPoint> list2 = list.Where((CannonSpawnPoint m) => ((Object)m).name.EndsWith("_Catapult", StringComparison.OrdinalIgnoreCase)).ToList(); Spawner(scene, tag, "Cannon", list.Except(list2).ToList()); Spawner(scene, tag, "Catapult", list2); } } private static void Spawner(Scene scene, string tag, string prefabName, List<CannonSpawnPoint> markers) { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (markers.Count == 0) { return; } GameObject val = null; PrefabObjects val2 = (((Object)(object)InstanceFinder.NetworkManager != (Object)null) ? InstanceFinder.NetworkManager.SpawnablePrefabs : null); if ((Object)(object)val2 != (Object)null) { for (int i = 0; i < val2.GetObjectCount(); i++) { NetworkObject val3 = val2.GetObject(true, i); if ((Object)(object)val3 != (Object)null && ((Object)val3).name == prefabName && (Object)(object)((Component)val3).GetComponent<Cannon>() != (Object)null) { val = ((Component)val3).gameObject; break; } } } if ((Object)(object)val == (Object)null) { Kit.Warn(tag + "no '" + prefabName + "' prefab among the network prefabs; " + markers.Count + " markers stay empty"); return; } GameObject val4 = new GameObject("CannonSpawner " + prefabName + " (map kit)"); SceneManager.MoveGameObjectToScene(val4, scene); val4.SetActive(false); CannonSpawner obj = val4.AddComponent<CannonSpawner>(); obj.cannonPrefab = val; obj.count = markers.Count; foreach (CannonSpawnPoint marker in markers) { ((Component)marker).transform.SetParent(val4.transform, true); } val4.SetActive(true); Kit.Log(tag + "added a CannonSpawner (" + ((Object)val).name + ") for " + markers.Count + " markers"); } } internal static class Mover { public static string Build(Scene scene, JArray list) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) List<string> list2 = new List<string>(); for (int i = 0; i < ((JContainer)list).Count; i++) { JToken obj = list[i]; JObject val = (JObject)(object)((obj is JObject) ? obj : null); if (val == null) { list2.Add("#" + i + " not an object"); continue; } try { list2.Add(One(scene, val)); } catch (Exception ex) { list2.Add("#" + i + " failed: " + ex.Message); Kit.Error("movers #" + i + ": " + ex); } } return "movers: " + string.Join("; ", list2.ToArray()); } private unsafe static string One(Scene scene, JObject o) { //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: 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_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) string text = ((o["root"] != null) ? ((string)o["root"]) : null); string text2 = ((o["warn"] != null) ? ((string)o["warn"]) : null); if (string.IsNullOrEmpty(text)) { return "no 'root'"; } Transform val = null; Transform val2 = null; GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val3 in rootGameObjects) { if ((Object)(object)val == (Object)null) { val = Find(val3.transform, text); } if ((Object)(object)val2 == (Object)null && !string.IsNullOrEmpty(text2)) { val2 = Find(val3.transform, text2); } } if ((Object)(object)val == (Object)null) { return "no '" + text + "' in the scene"; } if ((Object)(object)((Component)val).GetComponentInParent<NetworkObject>() != (Object)null) { return text + " is networked, movers only drive scene objects"; } if ((Object)(object)((Component)val).GetComponent<MoverDriver>() != (Object)null || (Object)(object)((Component)val).GetComponent<TramDriver>() != (Object)null || (Object)(object)((Component)val).GetComponent<CraneDriver>() != (Object)null) { return text + " is already driven"; } Rigidbody component = ((Component)val).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null && !component.isKinematic) { return text + " has a physics Rigidbody, movers only drive static objects"; } if (((Component)val).gameObject.isStatic) { Kit.Log("[mapkit] mover " + text + " is marked static: batched meshes stay put while the collider moves"); } MoverDriver moverDriver = ((Component)val).gameObject.AddComponent<MoverDriver>(); float num = Mathf.Max(0.1f, F(o, "travel", 3f)); float num2 = Mathf.Max(0f, F(o, "hold", 0f)); JToken obj = o["keys"]; JArray val4 = (JArray)(object)((obj is JArray) ? obj : null); if (val4 != null) { foreach (JToken item in val4) { JObject val5 = (JObject)(object)((item is JObject) ? item : null); if (val5 != null) { moverDriver.Keys.Add(new MoverDriver.Key { At = V(val5["at"], Vector3.zero), Rot = V(val5["rot"], Vector3.zero), Travel = Mathf.Max(0.1f, F(val5, "travel", num)), Hold = Mathf.Max(0f, F(val5, "hold", num2)) }); } } } if (moverDriver.Keys.Count == 0) { moverDriver.Keys.Add(new MoverDriver.Key { Travel = num, Hold = Mathf.Max(1f, num2) }); } moverDriver.Linear = o["ease"] != null && (string)o["ease"] == "linear"; moverDriver.Offset = F(o, "offset", 0f); moverDriver.Spin = V(o["spin"], Vector3.zero); moverDriver.WarnLead = Mathf.Max(0f, F(o, "warnLead", 0f)); moverDriver.Warn = val2; moverDriver.Bell = ((o["bell"] != null) ? ((string)o["bell"]) : null); moverDriver.Loop = ((o["loop"] != null) ? ((string)o["loop"]) : null); moverDriver.RestPos = val.position; moverDriver.RestRot = val.rotation; moverDriver.Always = o["always"] != null && (bool)o["always"]; Rigidbody val6 = ((Component)val).GetComponent<Rigidbody>(); if ((Object)(object)val6 == (Object)null) { val6 = ((Component)val).gameObject.AddComponent<Rigidbody>(); } val6.isKinematic = true; val6.interpolation = (RigidbodyInterpolation)1; val6.useGravity = false; moverDriver.Body = val6; string text3 = "no hitbox"; JToken obj2 = o["hitbox"]; JArray val7 = (JArray)(object)((obj2 is JArray) ? obj2 : null); if (val7 != null && ((JContainer)val7).Count == 6) { text3 = Hitbox(val, moverDriver, o, new Vector3((float)val7[0], (float)val7[1], (float)val7[2]), new Vector3((float)val7[3], (float)val7[4], (float)val7[5])); } string[] obj3 = new string[11] { ((Object)val).name, " ", moverDriver.Keys.Count.ToString(), " key(s), cycle ", moverDriver.Cycle.ToString("F1"), " s", null, null, null, null, null }; object obj4; if (!(moverDriver.Spin != Vector3.zero)) { obj4 = ""; } else { Vector3 spin = moverDriver.Spin; obj4 = ", spin " + ((object)(*(Vector3*)(&spin))/*cast due to .constrained prefix*/).ToString(); } obj3[6] = (string)obj4; obj3[7] = ", "; obj3[8] = text3; obj3[9] = ", warn "; obj3[10] = (((Object)(object)val2 != (Object)null) ? ((Object)val2).name : "none"); return string.Concat(obj3); } private unsafe static string Hitbox(Transform root, MoverDriver d, JObject o, Vector3 centre, Vector3 size) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) float num = F(o, "damage", 20f); float num2 = F(o, "force", 180f); float num3 = F(o, "up", 120f); Item val = null; try { val = Kit.FindItem("Train"); } catch (Exception) { } GameObject val2 = new GameObject("MoverHitbox"); val2.SetActive(false); val2.transform.SetParent(root, false); val2.transform.localPosition = centre; BoxCollider val3 = val2.AddComponent<BoxCollider>(); ((Collider)val3).isTrigger = true; val3.size = size; Transform from = new GameObject("MoverKnockFrom").transform; from.SetParent(root, false); from.localPosition = centre; Damager val4 = val2.AddComponent<Damager>(); Reflect.Set(val4, "mainCollider", val3); Reflect.Set(val4, "active", true); Reflect.Set(val4, "kill", false); Reflect.Set(val4, "damage", num); Reflect.Set(val4, "forceMagnitude", num2); Reflect.Set(val4, "upwardForce", num3); Reflect.Set(val4, "flattenForce", true); Reflect.Set(val4, "includeRagdolls", true); Reflect.Set(val4, "forcePoint", from); Reflect.Set(val4, "forceType", (object)(ForceType)0); if ((Object)(object)val != (Object)null) { Reflect.Set(val4, "item", val); } Transform boxT = val2.transform; val4.OnHitCharacter = (Action<CoreCharacterController>)Delegate.Combine(val4.OnHitCharacter, (Action<CoreCharacterController>)delegate(CoreCharacterController victim) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) try { Vector3 position = ((Component)victim).transform.position; Vector3 val6 = position - boxT.position; val6.y = 0f; if (((Vector3)(ref val6)).sqrMagnitude < 0.01f) { val6 = boxT.forward; } ((Vector3)(ref val6)).Normalize(); from.position = position - val6 * 20f; } catch (Exception) { } }); object obj = Reflect.Get<object>(val4, "kill"); object obj2 = Reflect.Get<object>(val4, "damage"); if (!(obj is bool) || (bool)obj || !(obj2 is float) || Mathf.Abs((float)obj2 - num) > 0.01f) { Object.Destroy((Object)(object)val2); return "Damager fields did not take (kill " + obj?.ToString() + ", damage " + obj2?.ToString() + "): no hit"; } d.Hit = (Collider)(object)val3; val2.SetActive(true); string[] obj3 = new string[11] { "hitbox ", null, null, null, null, null, null, null, null, null, null }; Vector3 val5 = size; obj3[1] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString(); obj3[2] = " at "; val5 = centre; obj3[3] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString(); obj3[4] = ", damage "; obj3[5] = num.ToString(); obj3[6] = ", force "; obj3[7] = num2.ToString(); obj3[8] = " + up "; obj3[9] = num3.ToString(); obj3[10] = (d.Always ? ", always" : ", while travelling"); return string.Concat(obj3); } private static Transform Find(Transform t, string name) { if (((Object)t).name == name) { return t; } for (int i = 0; i < t.childCount; i++) { Transform val = Find(t.GetChild(i), name); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static float F(JObject o, string k, float def) { if (o[k] == null) { return def; } return (float)o[k]; } private static Vector3 V(JToken t, Vector3 def) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) JArray val = (JArray)(object)((t is JArray) ? t : null); if (val == null || ((JContainer)val).Count != 3) { return def; } return new Vector3((float)val[0], (float)val[1], (float)val[2]); } } internal class MoverDriver : MonoBehaviour { public class Key { public Vector3 At; public Vector3 Rot; public float Travel; public float Hold; } public readonly List<Key> Keys = new List<Key>(); public bool Linear; public bool Always; public float Offset; public float WarnLead; public Vector3 Spin; public Vector3 RestPos; public Quaternion RestRot; public Transform Warn; public string Bell; public string Loop; public Rigidbody Body; public Collider Hit; public static int Count; public static Vector3 LastPos; public static bool LastMoving; private GameObject _warnA; private GameObject _warnB; private bool _warnLooked; private bool _wasWarn; private float _flash; private double _clock; private bool _clockSet; private EventInstance _loop; private bool _loopOn; private bool _loopTried; public float Cycle { get { float num = 0f; foreach (Key key in Keys) { num += key.Hold + ((Keys.Count > 1) ? key.Travel : 0f); } return Mathf.Max(0.1f, num); } } private void Awake() { Count++; } private double Clock() { double num = Time.timeAsDouble; try { TimeManager timeManager = InstanceFinder.TimeManager; if ((Object)(object)timeManager != (Object)null && timeManager.Tick != 0) { num = ((double)timeManager.Tick + timeManager.GetTickPercentAsDouble()) * timeManager.TickDelta; } } catch (Exception) { } if (!_clockSet || Math.Abs(num - _clock) > 0.5) { _clock = num; _clockSet = true; } else { _clock += (num - _clock) * 0.2; } return _clock; } private void At(double t, out Key from, out Key to, out float u, out float untilTravel) { double num = Cycle; float num2 = (float)((t + (double)Offset) % num); if (num2 < 0f) { num2 += (float)num; } int count = Keys.Count; for (int i = 0; i < count; i++) { Key key = Keys[i]; if (num2 < key.Hold) { from = (to = key); u = 0f; untilTravel = ((count > 1) ? (key.Hold - num2) : float.MaxValue); return; } num2 -= key.Hold; if (count < 2) { break; } Key key2 = Keys[(i + 1) % count]; if (num2 < key2.Travel) { from = key; to = key2; u = num2 / key2.Travel; untilTravel = 0f; return; } num2 -= key2.Travel; } from = (to = Keys[0]); u = 0f; untilTravel = ((count > 1) ? Keys[0].Hold : float.MaxValue); } private void FixedUpdate() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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) //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) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) double num = Clock() + (double)Time.fixedDeltaTime; At(num, out var from, out var to, out var u, out var _); float num2 = (Linear ? u : (u * u * (3f - 2f * u))); Vector3 val = RestPos + Vector3.LerpUnclamped(from.At, to.At, num2); Quaternion val2 = Quaternion.Euler(Vector3.LerpUnclamped(from.Rot, to.Rot, num2)); if (Spin != Vector3.zero) { double num3 = num + (double)Offset; val2 = Quaternion.Euler((float)(num3 * (double)Spin.x % 360.0), (float)(num3 * (double)Spin.y % 360.0), (float)(num3 * (double)Spin.z % 360.0)) * val2; } val2 *= RestRot; bool flag = from != to || Spin != Vector3.zero; LastPos = val; LastMoving = flag; if ((Object)(object)Hit != (Object)null) { bool flag2 = Always || flag; if (Hit.enabled != flag2) { Hit.enabled = flag2; } } if ((Object)(object)Body != (Object)null) { Body.MovePosition(val); Body.MoveRotation(val2); } else { ((Component)this).transform.position = val; ((Component)this).transform.rotation = val2; } } private void Update() { //IL_014c: 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) if (!_clockSet) { return; } At(_clock, out var from, out var to, out var _, out var untilTravel); bool flag = from != to; bool flag2 = flag || (WarnLead > 0f && untilTravel <= WarnLead); if ((Object)(object)Warn != (Object)null) { _flash += Time.deltaTime; bool flag3 = (int)(_flash / 0.45f) % 2 == 0; if (!_warnLooked) { _warnLooked = true; Transform val = Warn.Find("A"); Transform val2 = Warn.Find("B"); _warnA = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null); _warnB = (((Object)(object)val2 != (Object)null) ? ((Component)val2).gameObject : null); } if ((Object)(object)_warnA != (Object)null) { _warnA.SetActive(flag2 && flag3); } if ((Object)(object)_warnB != (Object)null) { _warnB.SetActive(flag2 && !flag3); } } if (flag2 && !_wasWarn) { Ring(); } _wasWarn = flag2; Sound(flag || Spin != Vector3.zero); } private void Ring() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(Bell)) { return; } try { RuntimeManager.PlayOneShot(GUID.Parse(Bell), ((Component)this).transform.position); } catch (Exception ex) { Kit.Log("[movers] bell: " + ex.Message); Bell = null; } } private void Sound(bool moving) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown res