Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SylwisCharm v1.8.8
Sylwi's Charm.dll
Decompiled 8 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Sylwi's Charm")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Sylwi's Charm")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("565ae970-41fd-48cd-90e7-10edb1394458")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace SylwisCharm; [BepInPlugin("com.miha.sylwischarm", "Sylwis Charm", "1.8.7")] public class SylwiisOrbPlugin : BaseUnityPlugin { private class OrbState { public GameObject orb; public Light orbLight; public bool isRushingOut = false; public Vector3 rushOutTarget; public bool isReadyForCleanup = false; public Vector3 lastPlayerPos; public bool hasLastPlayerPos; public Vector3 currentVelocity = Vector3.zero; public float targetSpeed = 0f; public float noiseTimeX; public float noiseTimeY; public float noiseTimeZ; public float baseHeight = 2.3f; public float hoverRadius = 2.2f; public float minSeparation = 1.3f; public float pulseSpeed; public float pulseOffset; public float pulseStrength = 0.35f; public float spawnRushTimer = 0f; public float spawnRushSpeed = 10f; } [CompilerGenerated] private sealed class <>c__DisplayClass14_0 { public ZDOID ownerId; internal bool <Co_RobustSpawnOrb>b__0(Player p) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ((Character)p).GetZDOID() == ownerId; } } [CompilerGenerated] private sealed class <Co_RobustDismissOrb>d__15 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ZDOID ownerId; public int seed; public SylwiisOrbPlugin <>4__this; private int <retries>5__1; private OrbState <state>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Co_RobustDismissOrb>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <state>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <retries>5__1 = 0; <state>5__2 = null; break; case 1: <>1__state = -1; break; } while ((<state>5__2 == null || (Object)(object)<state>5__2.orb == (Object)null) && <retries>5__1 < 10) { <>4__this.orbs.TryGetValue(ownerId, out <state>5__2); if (<state>5__2 == null || (Object)(object)<state>5__2.orb == (Object)null) { <retries>5__1++; <>2__current = null; <>1__state = 1; return true; } } if (<state>5__2 == null || (Object)(object)<state>5__2.orb == (Object)null) { ((BaseUnityPlugin)<>4__this).Logger.LogWarning((object)$"SylwiisOrb: Failed to find active orb state for ZDOID {ownerId} during dismissal after {10} attempts (RPC). Dismissal aborted."); return false; } <>4__this.ImmediateDismissOrb(ownerId, seed); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <Co_RobustSpawnOrb>d__14 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public ZDOID ownerId; public int seed; public SylwiisOrbPlugin <>4__this; private <>c__DisplayClass14_0 <>8__1; private int <retries>5__2; private Player <owner>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Co_RobustSpawnOrb>d__14(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <owner>5__3 = null; <>1__state = -2; } private bool MoveNext() { //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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass14_0(); <>8__1.ownerId = ownerId; <retries>5__2 = 0; <owner>5__3 = null; break; case 1: <>1__state = -1; break; } while ((Object)(object)<owner>5__3 == (Object)null && <retries>5__2 < 10) { <owner>5__3 = ((IEnumerable<Player>)Player.GetAllPlayers()).FirstOrDefault((Func<Player, bool>)((Player p) => ((Character)p).GetZDOID() == <>8__1.ownerId)); if ((Object)(object)<owner>5__3 == (Object)null) { <retries>5__2++; <>2__current = null; <>1__state = 1; return true; } } if ((Object)(object)<owner>5__3 == (Object)null) { ((BaseUnityPlugin)<>4__this).Logger.LogWarning((object)$"SylwiisOrb: Failed to find player with ZDOID {<>8__1.ownerId} after {10} attempts. Orb spawn aborted (RPC)."); return false; } <>4__this.ImmediateSpawnOrb(<>8__1.ownerId, <owner>5__3, seed); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private ConfigEntry<KeyCode> configSummonKey; private const float TeleportSnapDistance = 50f; private readonly Dictionary<ZDOID, OrbState> orbs = new Dictionary<ZDOID, OrbState>(); private const string RpcSpawn = "SylwiisOrb_Spawn"; private const string RpcDismiss = "SylwiisOrb_Dismiss"; private bool rpcsRegistered = false; private ZDOID localPlayerZDOID = ZDOID.None; private void Awake() { configSummonKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "SummonKey", (KeyCode)289, "The key used to summon or dismiss the Sylwiis Orb. Set to any Unity KeyCode."); } private void Update() { //IL_015a: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0091: 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_009e: 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_019d: 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_00ee: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) if (!rpcsRegistered && ZRoutedRpc.instance != null) { RegisterRPCs(); rpcsRegistered = true; } if (IsTextInputFocused()) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { localPlayerZDOID = ((Character)localPlayer).GetZDOID(); if (((Character)localPlayer).IsDead()) { ImmediateDespawnOrb(localPlayerZDOID); } if (ZInput.GetKeyDown(configSummonKey.Value, true)) { ZDOID val = localPlayerZDOID; OrbState value; bool flag = orbs.TryGetValue(val, out value) && (Object)(object)value.orb != (Object)null && !value.isRushingOut; int num = Random.Range(int.MinValue, int.MaxValue); if (ZRoutedRpc.instance != null) { ZPackage val2 = new ZPackage(); val2.Write(val); val2.Write(num); if (!flag) { ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "SylwiisOrb_Spawn", new object[1] { val2 }); } else { ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "SylwiisOrb_Dismiss", new object[1] { val2 }); } } } } else { localPlayerZDOID = ZDOID.None; } List<Player> allPlayers = Player.GetAllPlayers(); foreach (KeyValuePair<ZDOID, OrbState> item in orbs.ToList()) { ZDOID ownerId = item.Key; OrbState value2 = item.Value; if ((Object)(object)value2.orb == (Object)null || value2.isReadyForCleanup) { ImmediateDespawnOrb(ownerId); continue; } Player val3 = ((IEnumerable<Player>)allPlayers).FirstOrDefault((Func<Player, bool>)((Player p) => ((Character)p).GetZDOID() == ownerId)); if ((Object)(object)val3 == (Object)null) { ImmediateDespawnOrb(ownerId); continue; } UpdateOrbMovement(value2, val3); UpdateOrbGlow(value2); } } private void RegisterRPCs() { ZRoutedRpc.instance.Register<ZPackage>("SylwiisOrb_Spawn", (Action<long, ZPackage>)delegate(long sender, ZPackage pkg) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) ZDOID ownerId2 = pkg.ReadZDOID(); int seed2 = pkg.ReadInt(); ((MonoBehaviour)this).StartCoroutine(Co_RobustSpawnOrb(ownerId2, seed2)); }); ZRoutedRpc.instance.Register<ZPackage>("SylwiisOrb_Dismiss", (Action<long, ZPackage>)delegate(long sender, ZPackage pkg) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) ZDOID ownerId = pkg.ReadZDOID(); int seed = pkg.ReadInt(); ((MonoBehaviour)this).StartCoroutine(Co_RobustDismissOrb(ownerId, seed)); }); ((BaseUnityPlugin)this).Logger.LogInfo((object)"SylwiisOrb: RPCs registered"); } private bool IsTextInputFocused() { if ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) { return true; } if (Console.IsVisible()) { return true; } return false; } private void ImmediateDespawnOrb(ZDOID ownerId) { //IL_0007: 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) if (orbs.TryGetValue(ownerId, out var value)) { if ((Object)(object)value.orb != (Object)null) { Object.Destroy((Object)(object)value.orb); } orbs.Remove(ownerId); } } private void ImmediateSpawnOrb(ZDOID ownerId, Player owner, int seed) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!orbs.TryGetValue(ownerId, out var value)) { value = new OrbState(); orbs[ownerId] = value; } if (!((Object)(object)value.orb != (Object)null)) { SpawnOrb(value, owner, seed); } } private void ImmediateDismissOrb(ZDOID ownerId, int seed) { //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_0015: 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_0068: Unknown result type (might be due to invalid IL or missing references) if (orbs.TryGetValue(ownerId, out var value) && !((Object)(object)value.orb == (Object)null) && !value.isRushingOut) { Player val = ((IEnumerable<Player>)Player.GetAllPlayers()).FirstOrDefault((Func<Player, bool>)((Player p) => ((Character)p).GetZDOID() == ownerId)); if ((Object)(object)val == (Object)null) { ImmediateDespawnOrb(ownerId); } else { StartRushOut(value, ownerId, seed); } } } [IteratorStateMachine(typeof(<Co_RobustSpawnOrb>d__14))] private IEnumerator Co_RobustSpawnOrb(ZDOID ownerId, int seed) { //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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Co_RobustSpawnOrb>d__14(0) { <>4__this = this, ownerId = ownerId, seed = seed }; } [IteratorStateMachine(typeof(<Co_RobustDismissOrb>d__15))] private IEnumerator Co_RobustDismissOrb(ZDOID ownerId, int seed) { //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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Co_RobustDismissOrb>d__15(0) { <>4__this = this, ownerId = ownerId, seed = seed }; } private void SpawnOrb(OrbState s, Player owner, int seed) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00b0: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Expected O, but got Unknown //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Expected O, but got Unknown //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_0717: Unknown result type (might be due to invalid IL or missing references) //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_071d: Unknown result type (might be due to invalid IL or missing references) //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_072b: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Unknown result type (might be due to invalid IL or missing references) //IL_073a: Unknown result type (might be due to invalid IL or missing references) //IL_078b: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_0820: Unknown result type (might be due to invalid IL or missing references) //IL_0825: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) s.orb = GameObject.CreatePrimitive((PrimitiveType)0); s.orb.transform.localScale = Vector3.one * 0.3f; Collider component = s.orb.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } s.orbLight = s.orb.AddComponent<Light>(); s.orbLight.type = (LightType)2; s.orbLight.color = Color.white; s.orbLight.intensity = 2f; s.orbLight.range = 8f; ParticleSystem val = s.orb.AddComponent<ParticleSystem>(); MainModule main = val.main; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.45f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.15f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.4f, 0.6f, 1f, 1f)); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).rateOverDistance = MinMaxCurve.op_Implicit(40f); ShapeModule shape = val.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.05f; ColorOverLifetimeModule colorOverLifetime = val.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val2 = new Gradient(); val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(new Color(0.4f, 0.6f, 1f, 1f), 0f), new GradientColorKey(new Color(0.4f, 0.6f, 1f, 1f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val2); SizeOverLifetimeModule sizeOverLifetime = val.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; AnimationCurve val3 = new AnimationCurve(); val3.AddKey(0f, 1f); val3.AddKey(1f, 0f); ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, val3); Renderer component2 = s.orb.GetComponent<Renderer>(); Material val4 = null; GameObject val5 = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab("staff_iceshard_projectile") : null); if ((Object)(object)val5 != (Object)null) { Renderer componentInChildren = val5.GetComponentInChildren<Renderer>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.sharedMaterial != (Object)null) { val4 = componentInChildren.sharedMaterial; } } if ((Object)(object)val4 != (Object)null) { component2.material = new Material(val4); } else { Material material = component2.material; material.color = Color.black; if (material.HasProperty("_Metallic")) { material.SetFloat("_Metallic", 0f); } if (material.HasProperty("_Glossiness")) { material.SetFloat("_Glossiness", 0f); } Color val6 = default(Color); ((Color)(ref val6))..ctor(0.4f, 0.6f, 1f, 1f); material.EnableKeyword("_EMISSION"); material.SetColor("_EmissionColor", val6 * 20f); } GameObject val7 = GameObject.CreatePrimitive((PrimitiveType)0); val7.transform.SetParent(s.orb.transform); val7.transform.localPosition = Vector3.zero; val7.transform.localScale = s.orb.transform.localScale * 1.15f; MeshRenderer component3 = val7.GetComponent<MeshRenderer>(); Material val8 = new Material(component2.material); val8.color = new Color(val8.color.r, val8.color.g, val8.color.b, 0.25f); val8.SetColor("_EmissionColor", val8.color * 10f); val8.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; val8.EnableKeyword("_EMISSION"); val8.SetInt("_SrcBlend", 5); val8.SetInt("_DstBlend", 1); val8.SetInt("_ZWrite", 0); val8.DisableKeyword("_ALPHATEST_ON"); val8.EnableKeyword("_ALPHABLEND_ON"); val8.renderQueue = 3000; ((Renderer)component3).material = val8; Object.Destroy((Object)(object)val7.GetComponent<Collider>()); DynamicGI.SetEmissive((Renderer)(object)component3, val8.color * 10f); Material material2 = component2.material; material2.SetFloat("_Mode", 3f); material2.SetInt("_SrcBlend", 5); material2.SetInt("_DstBlend", 10); material2.SetInt("_ZWrite", 0); material2.DisableKeyword("_ALPHATEST_ON"); material2.EnableKeyword("_ALPHABLEND_ON"); material2.DisableKeyword("_ALPHAPREMULTIPLY_ON"); material2.renderQueue = 3000; Color color = material2.color; color.a = 0.6f; material2.color = color; ParticleSystemRenderer component4 = ((Component)val).GetComponent<ParticleSystemRenderer>(); ((Renderer)component4).material = material2; component4.renderMode = (ParticleSystemRenderMode)0; MainModule main2 = val.main; ((MainModule)(ref main2)).startSize = new MinMaxCurve(0.05f, 0.15f); ((MainModule)(ref main2)).startLifetime = MinMaxCurve.op_Implicit(0.35f); ((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(new Color(color.r, color.g, color.b, 0.35f)); ((MainModule)(ref main2)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission2 = val.emission; ((EmissionModule)(ref emission2)).rateOverDistance = MinMaxCurve.op_Implicit(80f); ShapeModule shape2 = val.shape; ((ShapeModule)(ref shape2)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape2)).radius = 0.15f; ((ShapeModule)(ref shape2)).angle = 15f; ((ShapeModule)(ref shape2)).position = new Vector3(0f, 0f, -0.15f); ParticleSystemRenderer component5 = ((Component)val).GetComponent<ParticleSystemRenderer>(); ((Renderer)component5).material = material2; component5.renderMode = (ParticleSystemRenderMode)0; component5.alignment = (ParticleSystemRenderSpace)1; component5.sortMode = (ParticleSystemSortMode)1; Random random = new Random(seed); Vector3 position = ((Component)owner).transform.position; Vector3 val9 = ((Character)owner).GetLookDir(); Vector3 normalized = ((Vector3)(ref val9)).normalized; val9 = Vector3.Cross(Vector3.up, normalized); Vector3 normalized2 = ((Vector3)(ref val9)).normalized; float num = Mathf.Lerp(100f, 150f, (float)random.NextDouble()); float num2 = Mathf.Lerp(-20f, 20f, (float)random.NextDouble()); Vector3 val10 = position + normalized * num + normalized2 * num2; float groundY = GetGroundY(val10, position.y); s.baseHeight = 2.3f; s.hoverRadius = 2.2f; s.minSeparation = 1.3f; float num3 = s.baseHeight + Mathf.Lerp(-0.3f, 0.3f, (float)random.NextDouble()); Vector3 position2 = default(Vector3); ((Vector3)(ref position2))..ctor(val10.x, groundY + num3, val10.z); s.orb.transform.position = position2; s.spawnRushTimer = Mathf.Lerp(2f, 3f, (float)random.NextDouble()); s.spawnRushSpeed = num / Mathf.Max(0.8f, s.spawnRushTimer); s.noiseTimeX = Random.value * 100f; s.noiseTimeY = Random.value * 100f; s.noiseTimeZ = Random.value * 100f; s.currentVelocity = Vector3.zero; s.targetSpeed = 0f; s.hasLastPlayerPos = false; s.pulseSpeed = Mathf.Lerp(0.6f, 1.2f, (float)random.NextDouble()); s.pulseOffset = Mathf.Lerp(0f, (float)Math.PI * 2f, (float)random.NextDouble()); s.pulseStrength = 0.35f; s.isRushingOut = false; s.isReadyForCleanup = false; } private void StartRushOut(OrbState s, ZDOID ownerId, int seed) { //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_0089: 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_009d: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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) if (!((Object)(object)s.orb == (Object)null)) { Player val = ((IEnumerable<Player>)Player.GetAllPlayers()).FirstOrDefault((Func<Player, bool>)((Player p) => ((Character)p).GetZDOID() == ownerId)); if (!((Object)(object)val == (Object)null)) { s.isRushingOut = true; s.isReadyForCleanup = false; Random random = new Random(seed); double num = Math.PI * 2.0 * random.NextDouble(); float num2 = 120f; Vector2 val2 = new Vector2((float)Math.Cos(num), (float)Math.Sin(num)) * num2; Vector3 rushOutTarget = ((Component)val).transform.position + new Vector3(val2.x, 0f, val2.y); s.rushOutTarget = rushOutTarget; s.rushOutTarget.y = GetGroundY(s.rushOutTarget, ((Component)val).transform.position.y) + s.baseHeight; float num3 = s.spawnRushSpeed * 0.6f; float num4 = Vector3.Distance(s.orb.transform.position, s.rushOutTarget); s.spawnRushTimer = num4 / Mathf.Max(0.8f, num4 / num3); s.spawnRushSpeed = num3; } } } private void UpdateOrbMovement(OrbState s, Player owner) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0270: 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) //IL_0288: 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_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: 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_030e: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: 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_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0379: 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_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s.orb == (Object)null) { return; } float deltaTime = Time.deltaTime; Vector3 position = ((Component)owner).transform.position; float groundY = GetGroundY(new Vector3(position.x, 0f, position.z), position.y); float num = Mathf.Max(groundY, position.y); Vector3 val = new Vector3(position.x, num, position.z) + Vector3.up * s.baseHeight; float num2 = Vector3.Distance(s.orb.transform.position, val); if (num2 > 50f && s.spawnRushTimer <= 0f && !s.isRushingOut) { s.orb.transform.position = val; s.currentVelocity = Vector3.zero; s.targetSpeed = 0f; s.lastPlayerPos = val; return; } Vector3 val2 = Vector3.zero; if (s.hasLastPlayerPos) { val2 = (position - s.lastPlayerPos) / Mathf.Max(deltaTime, 0.0001f); } s.lastPlayerPos = position; s.hasLastPlayerPos = true; Vector3 val3 = val; s.noiseTimeX += deltaTime * 0.25f; s.noiseTimeY += deltaTime * 0.25f; s.noiseTimeZ += deltaTime * 0.25f; Vector3 val4 = new Vector3((Mathf.PerlinNoise(s.noiseTimeX, 0f) - 0.5f) * 2f, (Mathf.PerlinNoise(s.noiseTimeY, 1f) - 0.5f) * 2f, (Mathf.PerlinNoise(s.noiseTimeZ, 2f) - 0.5f) * 2f) * s.hoverRadius; Vector3 val5 = val3 + val4; float num3 = Mathf.Max(3f, ((Vector3)(ref val2)).magnitude + 2.5f); bool flag = s.spawnRushTimer > 0f; if (flag) { num3 = s.spawnRushSpeed; s.spawnRushTimer -= deltaTime; } s.targetSpeed = Mathf.Lerp(s.targetSpeed, num3, deltaTime * 2f); Vector3 val6 = Vector3.SmoothDamp(s.orb.transform.position, val5, ref s.currentVelocity, 0.25f, s.targetSpeed); if (s.isRushingOut) { Vector3 val7 = s.rushOutTarget - s.orb.transform.position; Vector3 normalized = ((Vector3)(ref val7)).normalized; val6 = s.orb.transform.position + normalized * s.spawnRushSpeed * deltaTime; float groundY2 = GetGroundY(new Vector3(val6.x, 0f, val6.z), position.y); float num4 = groundY2 + s.baseHeight - 0.2f; if (val6.y < num4) { val6.y = num4; } if (Vector3.Distance(val6, s.rushOutTarget) < 1f) { s.isRushingOut = false; s.isReadyForCleanup = true; return; } } if (flag) { float groundY3 = GetGroundY(new Vector3(val6.x, 0f, val6.z), position.y); float num5 = groundY3 + s.baseHeight - 0.2f; if (val6.y < num5) { val6.y = num5; } } Vector3 val8 = position + Vector3.up * (s.baseHeight - 0.4f); Vector3 val9 = val6 - val8; float magnitude = ((Vector3)(ref val9)).magnitude; if (magnitude < s.minSeparation) { Vector3 val10 = ((magnitude > 0.001f) ? ((Vector3)(ref val9)).normalized : Vector3.up); val6 = val8 + val10 * s.minSeparation; } s.orb.transform.position = val6; s.orb.transform.Rotate(0f, 25f * deltaTime, 0f, (Space)0); } private void UpdateOrbGlow(OrbState s) { if (!((Object)(object)s.orbLight == (Object)null)) { float num = Mathf.Sin(Time.time * s.pulseSpeed + s.pulseOffset) * s.pulseStrength + 1f; s.orbLight.intensity = 2f * num; } } private float GetGroundY(Vector3 xzPos, float fallbackY) { //IL_0027: 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_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_0088: 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_00a0: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) float result = fallbackY; if ((Object)(object)ZoneSystem.instance != (Object)null) { try { result = ZoneSystem.instance.GetGroundHeight(xzPos); } catch { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(xzPos.x, fallbackY + 200f, xzPos.z); RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 400f, LayerMask.GetMask(new string[2] { "terrain", "Default" }))) { result = ((RaycastHit)(ref val2)).point.y; } } } else { Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(xzPos.x, fallbackY + 200f, xzPos.z); RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val3, Vector3.down, ref val4, 400f, LayerMask.GetMask(new string[2] { "terrain", "Default" }))) { result = ((RaycastHit)(ref val4)).point.y; } } return result; } }