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 TrueTrajectory v1.3.0
plugins/TrueTrajectory/TrueTrajectory.dll
Decompiled 2 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("TrueTrajectory")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TrueTrajectory")] [assembly: AssemblyTitle("TrueTrajectory")] [assembly: AssemblyVersion("1.0.0.0")] namespace TrueTrajectory; [BepInPlugin("com.paul.truetrajectory", "True Trajectory", "1.4.0")] public class TrueTrajectory : BaseUnityPlugin { private LineRenderer line; private GameObject impactMarker; private GameObject labelObj; private TextMesh label; private GameObject[] outlineObjs; private TextMesh[] outlineMeshes; private const int POINTS = 40; private const float STEP = 0.05f; private Vector3[] offsets = (Vector3[])(object)new Vector3[4] { new Vector3(0.03f, 0f, 0f), new Vector3(-0.03f, 0f, 0f), new Vector3(0f, 0.03f, 0f), new Vector3(0f, -0.03f, 0f) }; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00a8: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) Harmony val = new Harmony("com.paul.truetrajectory"); val.PatchAll(); GameObject val2 = new GameObject("TrajectoryLine"); line = val2.AddComponent<LineRenderer>(); line.startWidth = 0.02f; line.endWidth = 0.02f; ((Renderer)line).material = new Material(Shader.Find("Sprites/Default")); line.positionCount = 40; ((Renderer)line).enabled = false; impactMarker = GameObject.CreatePrimitive((PrimitiveType)0); impactMarker.transform.localScale = new Vector3(0.15f, 0.15f, 0.15f); Collider component = impactMarker.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component)) { component.enabled = false; } impactMarker.GetComponent<Renderer>().material.color = Color.red; impactMarker.SetActive(false); labelObj = new GameObject("ImpactLabel"); label = labelObj.AddComponent<TextMesh>(); label.fontSize = 32; label.characterSize = 0.05f; label.anchor = (TextAnchor)4; label.alignment = (TextAlignment)1; label.color = Color.white; labelObj.SetActive(false); outlineObjs = (GameObject[])(object)new GameObject[4]; outlineMeshes = (TextMesh[])(object)new TextMesh[4]; for (int i = 0; i < 4; i++) { outlineObjs[i] = new GameObject("ImpactLabelOutline" + i); outlineMeshes[i] = outlineObjs[i].AddComponent<TextMesh>(); outlineMeshes[i].fontSize = label.fontSize; outlineMeshes[i].characterSize = label.characterSize; outlineMeshes[i].anchor = (TextAnchor)4; outlineMeshes[i].alignment = (TextAlignment)1; outlineMeshes[i].color = new Color(0f, 0f, 0f, 0.9f); outlineObjs[i].SetActive(false); } } private Color GetWeaponColor(ItemData weapon) { //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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_00db: 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_006e: Invalid comparison between Unknown and I4 //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //IL_0097: 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_00d3: 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_00cb: 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) ItemType itemType = weapon.m_shared.m_itemType; if ((int)itemType == 4) { return new Color(0.4f, 1f, 0.4f); } if ((int)itemType == 14 && (int)weapon.m_shared.m_skillType == 14) { return new Color(0.4f, 0.6f, 1f); } if ((int)weapon.m_shared.m_skillType == 9 || (int)weapon.m_shared.m_skillType == 10) { return new Color(0.7f, 0.3f, 1f); } if (weapon.m_shared.m_attack.m_projectileVel > 60f) { return new Color(1f, 0.3f, 0.3f); } return Color.white; } private void Update() { //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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Invalid comparison between Unknown and I4 //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Invalid comparison between Unknown and I4 //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_00b0: Invalid comparison between Unknown and I4 //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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) //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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01c9: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: 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) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: 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_026a: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0290: 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_02af: 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_021d: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0362: 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_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: 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_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { DisableAll(); return; } ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon(); if (currentWeapon == null) { DisableAll(); return; } Attack attack = currentWeapon.m_shared.m_attack; if (attack.m_projectileVel <= 0f) { DisableAll(); return; } ItemType itemType = currentWeapon.m_shared.m_itemType; if ((int)itemType != 4 && ((int)itemType != 14 || (int)currentWeapon.m_shared.m_skillType != 14) && (int)currentWeapon.m_shared.m_skillType != 9 && (int)currentWeapon.m_shared.m_skillType != 10) { DisableAll(); return; } ((Renderer)line).enabled = true; Color weaponColor = GetWeaponColor(currentWeapon); line.startColor = weaponColor; line.endColor = weaponColor; impactMarker.GetComponent<Renderer>().material.color = weaponColor; label.color = weaponColor; for (int i = 0; i < 4; i++) { outlineMeshes[i].color = new Color(weaponColor.r * 0.2f, weaponColor.g * 0.2f, weaponColor.b * 0.2f, 0.9f); } Vector3 position = ((Character)localPlayer).m_eye.position; Vector3 aimDir = ((Humanoid)localPlayer).GetAimDir(position); Vector3 normalized = ((Vector3)(ref aimDir)).normalized; float projectileVel = attack.m_projectileVel; float num = 9.81f; float num2 = 0.02f; Vector3 val = position; Vector3 val2 = normalized * projectileVel; bool flag = false; RaycastHit val3 = default(RaycastHit); RaycastHit val4 = default(RaycastHit); for (int j = 0; j < 40; j++) { line.SetPosition(j, val); if (!flag && Physics.Raycast(val, ((Vector3)(ref val2)).normalized, ref val4, ((Vector3)(ref val2)).magnitude * 0.05f)) { flag = true; val3 = val4; } val2 += Vector3.down * num * 0.05f; val2 *= 1f - num2 * 0.05f; val += val2 * 0.05f; } if (flag) { Vector3 point = ((RaycastHit)(ref val3)).point; impactMarker.SetActive(true); impactMarker.transform.position = point; Character componentInParent = ((Component)((RaycastHit)(ref val3)).collider).GetComponentInParent<Character>(); if ((Object)(object)componentInParent != (Object)null) { float num3 = Vector3.Distance(((Component)localPlayer).transform.position, point); string text = $"{componentInParent.m_name} ({Mathf.Round(num3)}m)"; labelObj.SetActive(true); label.text = text; labelObj.transform.position = point + Vector3.up * 0.5f; labelObj.transform.rotation = Quaternion.LookRotation(labelObj.transform.position - ((Component)localPlayer).transform.position); for (int k = 0; k < 4; k++) { outlineObjs[k].SetActive(true); outlineMeshes[k].text = text; outlineObjs[k].transform.position = labelObj.transform.position + offsets[k]; outlineObjs[k].transform.rotation = labelObj.transform.rotation; } } else { HideLabels(); } } else { DisableAll(); } } private void DisableAll() { if ((Object)(object)line != (Object)null) { ((Renderer)line).enabled = false; } if ((Object)(object)impactMarker != (Object)null) { impactMarker.SetActive(false); } HideLabels(); } private void HideLabels() { if ((Object)(object)labelObj != (Object)null) { labelObj.SetActive(false); } if (outlineObjs == null) { return; } for (int i = 0; i < outlineObjs.Length; i++) { if ((Object)(object)outlineObjs[i] != (Object)null) { outlineObjs[i].SetActive(false); } } } }