using System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BlackMagicAPI.Managers; using BlackMagicAPI.Modules.Spells; using BlackMagicAPI.Network; using FishNet; using FishNet.Connection; using FishNet.Object; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("MikuBeam")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MikuBeam")] [assembly: AssemblyTitle("MikuBeam")] [assembly: AssemblyVersion("1.0.0.0")] namespace MikuBeam; public class MikuBeamData : SpellData { public override string Name => "Miku Beam"; public override float Cooldown => 90f; public override Color GlowColor => new Color(0.25f, 0.75f, 1f); public override string[] SubNames => new string[9] { "Mica Beam", "Mika Beam", "Miko Beam", "Mickey Beam", "Meeko Beam", "Micro Beam", "Meeker Beam", "Miku", "Mica" }; public override bool CanSpawnInTeamChest => false; public override bool DebugForceSpawn => false; } public class MikuBeamLogic : SpellLogic { private const float BEAM_DELAY = 10f; private const float BEAM_DURATION = 9f; private const float BEAM_RANGE = 80f; private const float EYE_HEIGHT = 1.5f; private const float LIGHTNING_INTERVAL = 0.8f; private static GameObject s_explosionPrefab; private static Material s_particleMat; public override bool CastSpell(PlayerMovement caster, PageController page, Vector3 spawnPos, Vector3 viewDirectionVector, int castingLevel) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(FireLightningLoop(caster, ((Vector3)(ref viewDirectionVector)).normalized)); return true; } public override void WriteData(DataWriter writer, PageController page, PlayerMovement caster, Vector3 spawnPos, Vector3 viewDirectionVector, int level) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0035: 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) writer.Write(spawnPos.x); writer.Write(spawnPos.y); writer.Write(spawnPos.z); writer.Write(viewDirectionVector.x); writer.Write(viewDirectionVector.y); writer.Write(viewDirectionVector.z); } public override void SyncData(object[] values) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (((SpellLogic)this).IsPrefab) { return; } try { Vector3 castOrigin = default(Vector3); ((Vector3)(ref castOrigin))..ctor(Convert.ToSingle(values[0]), Convert.ToSingle(values[1]), Convert.ToSingle(values[2])); Vector3 castDir = default(Vector3); ((Vector3)(ref castDir))..ctor(Convert.ToSingle(values[3]), Convert.ToSingle(values[4]), Convert.ToSingle(values[5])); ((MonoBehaviour)this).StartCoroutine(PlayBeamSequence(castOrigin, castDir)); } catch (Exception ex) { Debug.LogError((object)("[MikuBeam] SyncData failed: " + ex.Message)); } } private IEnumerator FireLightningLoop(PlayerMovement caster, Vector3 dir) { yield return (object)new WaitForSeconds(10f); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; MethodInfo lightningStrike = typeof(PlayerMovement).GetMethod("LightningStrike", bindingAttr); object? obj = typeof(PlayerMovement).GetField("playerCamera", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(caster); Camera playerCam = (Camera)((obj is Camera) ? obj : null); if ((Object)(object)s_explosionPrefab == (Object)null) { Type type = typeof(PlayerMovement).Assembly.GetType("FireballController"); FieldInfo fieldInfo = type?.GetField("explosion", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (type != null && fieldInfo != null) { Object[] array = Resources.FindObjectsOfTypeAll(type); foreach (Object obj2 in array) { object? value = fieldInfo.GetValue(obj2); GameObject val = (GameObject)((value is GameObject) ? value : null); if ((Object)(object)val != (Object)null) { s_explosionPrefab = val; break; } } } } if ((Object)(object)s_particleMat == (Object)null) { ParticleSystemRenderer[] array2 = Object.FindObjectsOfType(); foreach (ParticleSystemRenderer val2 in array2) { if ((Object)(object)((Renderer)val2).sharedMaterial != (Object)null) { s_particleMat = ((Renderer)val2).sharedMaterial; break; } } } Type expCtrlType = typeof(PlayerMovement).Assembly.GetType("ExplosionController"); FieldInfo fogeField = expCtrlType?.GetField("foge", bindingAttr); FieldInfo levelField = expCtrlType?.GetField("level", bindingAttr); MethodInfo explodeMethod = expCtrlType?.GetMethod("Explode", bindingAttr); Debug.Log((object)("[MikuBeam] Fireball loop ready | strike=" + ((lightningStrike != null) ? "found" : "missing") + " | cam=" + ((!((Object)(object)playerCam != (Object)null)) ? "none" : (((Behaviour)playerCam).enabled ? "active" : "disabled")) + " | explosionPrefab=" + (((Object)(object)s_explosionPrefab != (Object)null) ? ((Object)s_explosionPrefab).name : "none"))); for (float elapsed = 0f; elapsed < 9f; elapsed += 0.8f) { try { Vector3 val3 = (((Object)(object)playerCam != (Object)null && ((Behaviour)playerCam).enabled) ? ((Component)playerCam).transform.forward : ((Component)caster).transform.forward); Vector3 val4 = ((Component)caster).transform.position + Vector3.up * 1.5f; float beamRange = GetBeamRange(val4, val3); Vector3 val5 = val4 + val3 * beamRange; if ((Object)(object)s_explosionPrefab != (Object)null && explodeMethod != null) { Component component = Object.Instantiate(s_explosionPrefab, val5, Quaternion.identity).GetComponent(expCtrlType); if ((Object)(object)component != (Object)null) { object? obj3 = fogeField?.GetValue(component); Component val6 = (Component)((obj3 is Component) ? obj3 : null); if ((Object)(object)val6 != (Object)null) { Object.Destroy((Object)(object)val6); } levelField?.SetValue(component, 0); explodeMethod.Invoke(component, new object[1] { ((Component)caster).gameObject }); } } else { SpawnBlueImpact(val5); } ((MonoBehaviour)this).StartCoroutine(SpawnBlueFire(val5)); if (lightningStrike != null) { PlayerMovement[] array3 = Object.FindObjectsOfType(); foreach (PlayerMovement val7 in array3) { if (!((Object)(object)((Component)val7).gameObject == (Object)(object)((Component)caster).gameObject) && !(Vector3.Distance(((Component)val7).transform.position, val5) > 8f)) { try { lightningStrike.Invoke(val7, new object[2] { val5, ((Component)caster).gameObject }); } catch (Exception ex) { Debug.LogWarning((object)("[MikuBeam] LightningStrike: " + (ex.InnerException?.Message ?? ex.Message))); } } } } } catch (Exception ex2) { Debug.LogWarning((object)("[MikuBeam] Tick error: " + ex2.Message)); } yield return (object)new WaitForSeconds(0.8f); } } private static void SpawnBlueImpact(Vector3 pos) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00e1: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("MikuBlueImpact"); val.transform.position = pos; ParticleSystem val2 = val.AddComponent(); MainModule main = val2.main; ((MainModule)(ref main)).duration = 0.2f; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.25f, 0.65f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(4f, 10f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.15f, 0.55f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0f, 0.55f, 1f, 1f), new Color(0.6f, 0.92f, 1f, 0.8f)); ((MainModule)(ref main)).gravityModifier = new MinMaxCurve(0.25f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 40; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)25, (short)35, 1, 0.01f) }); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.3f; if ((Object)(object)s_particleMat != (Object)null) { ((Renderer)((Component)val2).GetComponent()).sharedMaterial = s_particleMat; } GameObject val3 = new GameObject("ImpactLight"); val3.transform.SetParent(val.transform, false); Light obj = val3.AddComponent(); obj.type = (LightType)2; obj.color = new Color(0.3f, 0.7f, 1f); obj.intensity = 18f; obj.range = 14f; Object.Destroy((Object)(object)val, 2f); } private IEnumerator SpawnBlueFire(Vector3 endpoint) { //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) yield return null; Vector3 val = default(Vector3); RaycastHit val3 = default(RaycastHit); for (int i = 0; i < 2; i++) { ((Vector3)(ref val))..ctor(Random.Range(-1.5f, 1.5f), 0f, Random.Range(-1.5f, 1.5f)); Vector3 val2 = endpoint + val + Vector3.up * 2f; Vector3 pos = endpoint + val; if (Physics.Raycast(val2, Vector3.down, ref val3, 30f)) { pos = ((RaycastHit)(ref val3)).point; } CreateBlueFirePool(pos); } } private static void CreateBlueFirePool(Vector3 pos) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00e1: 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_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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("MikuBlueFire"); val.transform.position = pos; ParticleSystem val2 = val.AddComponent(); MainModule main = val2.main; ((MainModule)(ref main)).duration = 5f; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(1.2f, 2.5f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.4f, 2f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.25f, 0.75f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0f, 0.55f, 1f, 1f), new Color(0.3f, 0.9f, 1f, 0.6f)); ((MainModule)(ref main)).gravityModifier = new MinMaxCurve(-0.1f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 60; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = new MinMaxCurve(15f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).angle = 15f; ((ShapeModule)(ref shape)).radius = 0.2f; if ((Object)(object)s_particleMat != (Object)null) { ((Renderer)((Component)val2).GetComponent()).sharedMaterial = s_particleMat; } GameObject val3 = new GameObject("FlameLight"); val3.transform.SetParent(val.transform, false); Light obj = val3.AddComponent(); obj.type = (LightType)2; obj.color = new Color(0.2f, 0.65f, 1f); obj.intensity = 5f; obj.range = 8f; Object.Destroy((Object)(object)val, 7f); } private IEnumerator PlayBeamSequence(Vector3 castOrigin, Vector3 castDir) { //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) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref castDir)).sqrMagnitude < 0.001f) { castDir = Vector3.forward; } castDir = ((Vector3)(ref castDir)).normalized; Transform casterTf = FindNearestPlayer(castOrigin); bool isCaster = IsLocalCaster(casterTf); ((MonoBehaviour)this).StartCoroutine(ShowCountdown(casterTf, castOrigin)); string text = Path.Combine(Path.GetDirectoryName(typeof(MikuBeamLogic).Assembly.Location), "Sounds", "MikuBeam.wav"); string text2 = "file:///" + text.Replace('\\', '/'); AudioClip clip = null; UnityWebRequest req = UnityWebRequestMultimedia.GetAudioClip(text2, (AudioType)20); yield return req.SendWebRequest(); if ((int)req.result == 1) { clip = DownloadHandlerAudioClip.GetContent(req); } else { Debug.LogError((object)("[MikuBeam] Audio load failed: " + req.error)); } req.Dispose(); GameObject audioObj = new GameObject("MikuBeamAudio"); AudioSource src = audioObj.AddComponent(); src.spatialBlend = 0f; src.volume = 1f; src.priority = 0; if ((Object)(object)clip != (Object)null) { src.clip = clip; src.Play(); } yield return (object)new WaitForSeconds(10f); MakeBeamLayer("MikuBeamOuter", 5f, new Color(0.2f, 0.8f, 1f, 0.22f), out var outerObj, out var outerLR); MakeBeamLayer("MikuBeamMid", 1.8f, new Color(0.3f, 0.9f, 1f, 0.9f), out var midObj, out var midLR); MakeBeamLayer("MikuBeamCore", 0.25f, new Color(0.9f, 1f, 1f, 1f), out var coreObj, out var coreLR); GameObject lightObj = new GameObject("MikuBeamLight"); Light beamLight = lightObj.AddComponent(); beamLight.type = (LightType)2; beamLight.color = new Color(0.3f, 0.85f, 1f); beamLight.intensity = 15f; beamLight.range = 40f; Shader val = Shader.Find("Particles/Additive") ?? Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Sprites/Default"); GameObject tipObj = new GameObject("MikuBeamTip"); Light tipLight = tipObj.AddComponent(); tipLight.type = (LightType)2; tipLight.color = new Color(0.7f, 0.95f, 1f); tipLight.intensity = 25f; tipLight.range = 14f; LineRenderer[] tipBolts = (LineRenderer[])(object)new LineRenderer[6]; for (int i = 0; i < 6; i++) { GameObject val2 = new GameObject("TipBolt" + i); val2.transform.SetParent(tipObj.transform); tipBolts[i] = val2.AddComponent(); tipBolts[i].useWorldSpace = true; tipBolts[i].positionCount = 6; tipBolts[i].startWidth = ((i % 2 == 0) ? 0.07f : 0.04f); tipBolts[i].endWidth = 0f; if ((Object)(object)val != (Object)null) { ((Renderer)tipBolts[i]).material = new Material(val); } tipBolts[i].startColor = new Color(0.85f, 0.97f, 1f, 1f); tipBolts[i].endColor = new Color(0.4f, 0.8f, 1f, 0f); } float elapsed = 0f; while (elapsed < 9f) { Vector3 val3 = (((Object)(object)casterTf != (Object)null) ? casterTf.position : castOrigin) + Vector3.up * 1.5f; Vector3 val4 = ((isCaster && (Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.forward : castDir); float beamRange = GetBeamRange(val3, val4); Vector3 val5 = val3 + val4 * beamRange; float num = 1f + Random.Range(-0.04f, 0.04f); ApplyBeam(outerLR, val3, val5, 5f * num, new Color(0.2f, 0.8f, 1f, 0.22f), new Color(0.3f, 0.9f, 1f, 0.04f)); ApplyBeam(midLR, val3, val5, 1.8f * num, new Color(0.3f, 0.9f, 1f, 0.9f), new Color(0.4f, 0.95f, 1f, 0.35f)); ApplyBeam(coreLR, val3, val5, 0.25f, new Color(0.9f, 1f, 1f, 1f), new Color(0.9f, 1f, 1f, 0.8f)); tipObj.transform.position = val5; tipLight.intensity = 20f + Random.Range(-8f, 8f); for (int j = 0; j < tipBolts.Length; j++) { Vector3 val6 = val4 + Random.insideUnitSphere * 0.7f; Vector3 normalized = ((Vector3)(ref val6)).normalized; float length = Random.Range(1f, 4f); SetJaggedBolt(tipBolts[j], val5, normalized, length); ((Renderer)tipBolts[j]).enabled = Random.value > 0.25f; } lightObj.transform.position = val3; beamLight.intensity = (15f + Random.Range(-1.5f, 1.5f)) * num; elapsed += Time.deltaTime; yield return null; } float fade = 0f; while (fade < 0.5f) { fade += Time.deltaTime; float num2 = 1f - fade / 0.5f; Vector3 val7 = (((Object)(object)casterTf != (Object)null) ? casterTf.position : castOrigin) + Vector3.up * 1.5f; Vector3 val8 = ((isCaster && (Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.forward : castDir); float beamRange2 = GetBeamRange(val7, val8); Vector3 val9 = val7 + val8 * beamRange2; ApplyBeam(outerLR, val7, val9, 5f * num2, new Color(0.2f, 0.8f, 1f, 0.22f * num2), new Color(0.3f, 0.9f, 1f, 0.04f * num2)); ApplyBeam(midLR, val7, val9, 1.8f * num2, new Color(0.3f, 0.9f, 1f, 0.9f * num2), new Color(0.4f, 0.95f, 1f, 0.35f * num2)); ApplyBeam(coreLR, val7, val9, 0.25f * num2, new Color(0.9f, 1f, 1f, num2), new Color(0.9f, 1f, 1f, 0.8f * num2)); tipObj.transform.position = val9; tipLight.intensity = 20f * num2; for (int k = 0; k < tipBolts.Length; k++) { ((Renderer)tipBolts[k]).enabled = num2 > 0.3f && Random.value > 0.25f; } beamLight.intensity = 15f * num2; yield return null; } Object.Destroy((Object)(object)outerObj); Object.Destroy((Object)(object)midObj); Object.Destroy((Object)(object)coreObj); Object.Destroy((Object)(object)lightObj); Object.Destroy((Object)(object)tipObj); if ((Object)(object)src != (Object)null && (Object)(object)src.clip != (Object)null) { float num3 = src.clip.length - 10f - 9f - 0.5f; if (num3 > 0f) { yield return (object)new WaitForSeconds(num3); } } Object.Destroy((Object)(object)audioObj); } private IEnumerator ShowCountdown(Transform casterTf, Vector3 fallbackPos) { //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 (object)new WaitForSeconds(5f); GameObject go = new GameObject("MikuCountdown"); TextMesh tm = go.AddComponent(); tm.fontSize = 200; tm.characterSize = 0.035f; tm.color = new Color(0.25f, 0.75f, 1f); tm.anchor = (TextAnchor)4; tm.alignment = (TextAlignment)1; Light obj = go.AddComponent(); obj.type = (LightType)2; obj.color = new Color(0.25f, 0.75f, 1f); obj.intensity = 80f; obj.range = 60f; float t = 0f; while (t < 5f) { tm.text = ((t < 1f) ? "1" : ((t < 2.5f) ? "2" : "3")); Vector3 position = (((Object)(object)casterTf != (Object)null) ? casterTf.position : fallbackPos) + Vector3.up * 2.8f; go.transform.position = position; if ((Object)(object)Camera.main != (Object)null) { go.transform.rotation = ((Component)Camera.main).transform.rotation; } t += Time.deltaTime; yield return null; } Object.Destroy((Object)(object)go); } private static void MakeBeamLayer(string name, float width, Color color, out GameObject go, out LineRenderer lr) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: 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_004e: 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_0060: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown go = new GameObject(name); lr = go.AddComponent(); lr.useWorldSpace = true; lr.positionCount = 2; lr.startWidth = width; lr.endWidth = width; lr.startColor = color; lr.endColor = new Color(color.r, color.g, color.b, color.a * 0.1f); Shader val = Shader.Find("Particles/Additive") ?? Shader.Find("Particles/Standard Unlit") ?? Shader.Find("Sprites/Default"); if ((Object)(object)val != (Object)null) { ((Renderer)lr).material = new Material(val) { color = color }; } } private static void ApplyBeam(LineRenderer lr, Vector3 from, Vector3 to, float width, Color startColor, Color endColor) { //IL_0002: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) lr.SetPosition(0, from); lr.SetPosition(1, to); lr.startWidth = width; lr.endWidth = Mathf.Max(width * 0.15f, 0.05f); lr.startColor = startColor; lr.endColor = endColor; } private static float GetBeamRange(Vector3 origin, Vector3 dir) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(origin + dir * 0.5f, dir, ref val, 80f, -5, (QueryTriggerInteraction)1)) { return Mathf.Min(((RaycastHit)(ref val)).distance + 0.5f, 80f); } return 80f; } private static Transform FindNearestPlayer(Vector3 pos) { //IL_001e: 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) Transform result = null; float num = float.MaxValue; PlayerMovement[] array = Object.FindObjectsOfType(); foreach (PlayerMovement val in array) { float num2 = Vector3.Distance(((Component)val).transform.position, pos); if (num2 < num) { num = num2; result = ((Component)val).transform; } } return result; } private static void SetJaggedBolt(LineRenderer lr, Vector3 start, Vector3 dir, float length) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0027: 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_007b: 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_0086: 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_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_00a0: 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_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) int positionCount = lr.positionCount; Vector3 val = Vector3.Cross(dir, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.Cross(dir, Vector3.right); } val = ((Vector3)(ref val)).normalized; Vector3 val2 = Vector3.Cross(dir, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; for (int i = 0; i < positionCount; i++) { float num = (float)i / (float)(positionCount - 1); float num2 = ((i == 0 || i == positionCount - 1) ? 0f : (0.35f * Mathf.Sin(num * (float)Math.PI))); Vector3 val3 = start + dir * (length * num) + val * Random.Range(0f - num2, num2) + normalized * Random.Range(0f - num2, num2); lr.SetPosition(i, val3); } } private static bool IsLocalCaster(Transform casterTf) { if ((Object)(object)casterTf == (Object)null) { return false; } try { NetworkConnection val = InstanceFinder.ClientManager?.Connection; if (val == (NetworkConnection)null) { return false; } foreach (NetworkObject @object in val.Objects) { PlayerMovement component = ((Component)@object).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)((Component)component).transform == (Object)(object)casterTf) { return true; } } } catch { } return false; } } [BepInPlugin("com.thewargod_ares.mikubeam", "MikuBeam", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string GUID = "com.thewargod_ares.mikubeam"; public const string NAME = "MikuBeam"; public const string VERSION = "1.0.0"; public static string modsync = "all"; private void Awake() { BlackMagicManager.RegisterSpell((BaseUnityPlugin)(object)this, typeof(MikuBeamData), typeof(MikuBeamLogic)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Miku Beam loaded — say 'Miku Beam' to unleash chaos."); } }