using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak.Afflictions;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PeakGuide")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.4.2.0")]
[assembly: AssemblyInformationalVersion("0.4.2+593490fc9903cad85f0a3c4cad18a8369947699b")]
[assembly: AssemblyProduct("PeakGuide")]
[assembly: AssemblyTitle("PeakGuide")]
[assembly: AssemblyVersion("0.4.2.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace PeakGuide
{
internal struct FlightState
{
public double X;
public double Y;
public double Z;
public double Vx;
public double Vy;
public double Vz;
}
internal static class JumpKinematics
{
public static double MaximumSpeed(double force, double sprint, double drag, double damping, double dt)
{
return force * sprint * dt / (1.0 + damping * dt - drag);
}
public static FlightState Launch(double x, double y, double z, double targetX, double targetZ, double force, double sprint, double drag, double damping, double dt, double impulse)
{
double num = targetX - x;
double num2 = targetZ - z;
double num3 = Math.Sqrt(num * num + num2 * num2);
double num4 = MaximumSpeed(force, sprint, drag, damping, dt);
return new FlightState
{
X = x,
Y = y,
Z = z,
Vx = ((num3 > 0.001) ? (num / num3 * num4) : 0.0),
Vz = ((num3 > 0.001) ? (num2 / num3 * num4) : 0.0),
Vy = impulse * dt
};
}
public static FlightState Step(FlightState s, double ax, double ay, double az, double drag, double damping, double dt)
{
double num = 1.0 + damping * dt;
s.Vx = (s.Vx * drag + ax * dt) / num;
s.Vy = (s.Vy * drag + ay * dt) / num;
s.Vz = (s.Vz * drag + az * dt) / num;
s.X += s.Vx * dt;
s.Y += s.Vy * dt;
s.Z += s.Vz * dt;
return s;
}
}
internal static class LandingZone
{
public static void Build<T>(List<T> points, Func<double, T?> sample) where T : struct
{
points.Clear();
T? val = sample(0.0);
if (!val.HasValue)
{
return;
}
points.Add(val.Value);
for (int i = -1; i <= 1; i += 2)
{
for (int j = 1; j <= 16; j++)
{
T? val2 = sample((double)(i * j) * 0.4);
if (!val2.HasValue)
{
break;
}
points.Add(val2.Value);
}
}
}
}
internal enum UiLanguage
{
English,
SimplifiedChinese
}
internal static class L
{
public static UiLanguage Language { get; set; }
public static string T(string english, string chinese)
{
if (Language != UiLanguage.SimplifiedChinese)
{
return english;
}
return chinese;
}
}
internal sealed class Mark
{
public int Sender;
public bool IsLocal;
public string Name;
public Vector3 Point;
public Color Color;
public float Created;
public float EmphasizeUntil;
}
internal sealed class MarkStore
{
public readonly List<Mark> Items = new List<Mark>();
public void Add(Mark mark, float now)
{
bool flag = true;
for (int num = Items.Count - 1; num >= 0; num--)
{
if (Items[num].Sender == mark.Sender)
{
flag = now - Items[num].Created > 0.8f;
Items.RemoveAt(num);
}
}
mark.Created = now;
mark.EmphasizeUntil = (flag ? (now + 0.65f) : now);
Items.Add(mark);
if (Items.Count > 24)
{
Items.RemoveAt(0);
}
}
public void Tick(float now, float seconds)
{
Items.RemoveAll((Mark m) => now - m.Created > seconds);
}
}
internal static class World
{
public static int Terrain => LayerMask.op_Implicit(HelperFunctions.terrainMapMask);
public static bool InputAllowed
{
get
{
if (Object.op_Implicit((Object)(object)GUIManager.instance))
{
if (!GUIManager.instance.windowBlockingInput)
{
return !GUIManager.instance.wheelActive;
}
return false;
}
return true;
}
}
public static bool Finite(Vector3 p)
{
//IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references)
if (Valid(p.x) && Valid(p.y))
{
return Valid(p.z);
}
return false;
}
private static bool Valid(float n)
{
if (!float.IsNaN(n) && !float.IsInfinity(n))
{
return Mathf.Abs(n) < 100000f;
}
return false;
}
public static bool Aim(Camera camera, out RaycastHit hit)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: 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)
hit = default(RaycastHit);
if (!Object.op_Implicit((Object)(object)camera))
{
return false;
}
Vector3 val = (Vector3)(((int)Cursor.lockState == 1) ? new Vector3((float)Screen.width / 2f, (float)Screen.height / 2f) : Input.mousePosition);
return Physics.Raycast(camera.ScreenPointToRay(val), ref hit, 1500f, Terrain, (QueryTriggerInteraction)1);
}
public static string Name(Character c)
{
if ((Object)(object)c == (Object)(object)Character.localCharacter)
{
return L.T("You", "自己");
}
string text = ((Object.op_Implicit((Object)(object)c) && Object.op_Implicit((Object)(object)((MonoBehaviourPun)c).photonView) && ((MonoBehaviourPun)c).photonView.Owner != null) ? ((MonoBehaviourPun)c).photonView.Owner.NickName : L.T("Teammate", "队友"));
text = (text ?? L.T("Teammate", "队友")).Replace('\n', ' ').Replace('\r', ' ');
if (text.Length <= 20)
{
return text;
}
return text.Substring(0, 20);
}
public static Color Color(Character c)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)c) || c.refs == null || !Object.op_Implicit((Object)(object)c.refs.customization))
{
return Color.white;
}
return c.refs.customization.PlayerColor;
}
}
internal sealed class NativeHud : IDisposable
{
internal sealed class Card
{
public RectTransform Root;
public CanvasGroup Group;
public Image Dot;
public Image Background;
public bool Used;
public TMP_Text Heading;
public TMP_Text Detail;
public TMP_Text Reach;
public TMP_Text Fall;
public TMP_Text Note;
public ArrowGraphic Arrow;
}
private readonly Plugin p;
private GameObject root;
private Canvas canvas;
private RectTransform container;
private RectTransform menu;
private Card risk;
private readonly List<Card> markers = new List<Card>();
private readonly List<Rect> occupied = new List<Rect>();
private readonly List<TMP_Text> allText = new List<TMP_Text>();
private readonly List<Image> allPanels = new List<Image>();
private TMP_FontAsset font;
private Material textMaterial;
private Sprite panelSprite;
private Texture2D fallbackTexture;
private Sprite fallbackSprite;
private Color textColor = new Color(1f, 0.98f, 0.93f);
private Color panelColor = new Color(0.13f, 0.13f, 0.12f, 0.9f);
private float nextTheme;
private UiLanguage layoutLanguage;
private TMP_Text hudToggle;
private TMP_Text playerToggle;
private TMP_Text scaleText;
private TMP_Text opacityText;
private TMP_Text keys;
public NativeHud(Plugin plugin)
{
//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_005b: 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)
p = plugin;
}
public void ResetTheme()
{
nextTheme = 0f;
}
private bool Prepare()
{
//IL_01cc: 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_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_037d: Unknown result type (might be due to invalid IL or missing references)
//IL_0382: Unknown result type (might be due to invalid IL or missing references)
//IL_0395: Unknown result type (might be due to invalid IL or missing references)
//IL_039a: Unknown result type (might be due to invalid IL or missing references)
if (Time.unscaledTime >= nextTheme)
{
nextTheme = Time.unscaledTime + 3f;
TMP_Text val = (TMP_Text)(object)(Object.op_Implicit((Object)(object)GUIManager.instance) ? GUIManager.instance.interactNameText : null);
TMP_FontAsset val2 = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.font)) ? val.font : (Object.op_Implicit((Object)(object)FontFallbackSwapper.instance) ? FontFallbackSwapper.instance.mainBaseFont : null));
if (!Object.op_Implicit((Object)(object)val2))
{
TMP_Text[] array = Resources.FindObjectsOfTypeAll<TMP_Text>();
foreach (TMP_Text val3 in array)
{
if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.font) && (!Object.op_Implicit((Object)(object)root) || !val3.transform.IsChildOf(root.transform)) && ((Object)val3.font).name.Contains("Daruma"))
{
val2 = val3.font;
val = val3;
break;
}
}
}
Color color;
if (!Object.op_Implicit((Object)(object)font) && Object.op_Implicit((Object)(object)val2))
{
font = Object.Instantiate<TMP_FontAsset>(val2);
((Object)font).name = "PeakGuide.NativeFont";
font.fallbackFontAssetTable = new List<TMP_FontAsset>(val2.fallbackFontAssetTable ?? new List<TMP_FontAsset>());
FontFallbackSwapper instance = FontFallbackSwapper.instance;
if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.simplifiedChineseFont) && !font.fallbackFontAssetTable.Contains(instance.simplifiedChineseFont))
{
font.fallbackFontAssetTable.Add(instance.simplifiedChineseFont);
}
textMaterial = ((Object.op_Implicit((Object)(object)val) && (Object)(object)val.font == (Object)(object)val2) ? val.fontSharedMaterial : ((TMP_Asset)val2).material);
if (Object.op_Implicit((Object)(object)val))
{
color = ((Graphic)val).color;
if (((Color)(ref color)).maxColorComponent > 0.5f)
{
textColor = ((Graphic)val).color;
textColor.a = 1f;
}
}
p.Log("NATIVE_UI font=" + ((Object)val2).name + " material=" + (Object.op_Implicit((Object)(object)textMaterial) ? ((Object)textMaterial).name : "default") + " chinese=" + ((Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.simplifiedChineseFont)) ? ((Object)instance.simplifiedChineseFont).name : "native fallback"));
}
if (!Object.op_Implicit((Object)(object)panelSprite) || (Object)(object)panelSprite == (Object)(object)fallbackSprite)
{
Sprite[] array2 = Resources.FindObjectsOfTypeAll<Sprite>();
foreach (Sprite val4 in array2)
{
if (Object.op_Implicit((Object)(object)val4) && ((Object)val4).name == "UIMask")
{
panelSprite = val4;
break;
}
}
if (Object.op_Implicit((Object)(object)panelSprite) && (Object)(object)panelSprite != (Object)(object)fallbackSprite)
{
Image[] array3 = Resources.FindObjectsOfTypeAll<Image>();
foreach (Image val5 in array3)
{
if (Object.op_Implicit((Object)(object)val5) && (Object)(object)val5.sprite == (Object)(object)panelSprite && (!Object.op_Implicit((Object)(object)root) || !((Component)val5).transform.IsChildOf(root.transform)) && ((Graphic)val5).color.a > 0.2f)
{
color = ((Graphic)val5).color;
if (((Color)(ref color)).maxColorComponent < 0.5f)
{
panelColor = ((Graphic)val5).color;
panelColor.a = 0.9f;
break;
}
}
}
foreach (Image allPanel in allPanels)
{
allPanel.sprite = panelSprite;
allPanel.type = (Type)1;
}
}
}
}
if (!Object.op_Implicit((Object)(object)font))
{
return false;
}
if (!Object.op_Implicit((Object)(object)root))
{
Build();
}
return true;
}
private void Build()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
layoutLanguage = L.Language;
if (!Object.op_Implicit((Object)(object)panelSprite))
{
panelSprite = MakeFallback();
}
root = new GameObject("PeakGuide.NativeHUD", new Type[3]
{
typeof(RectTransform),
typeof(Canvas),
typeof(GraphicRaycaster)
});
Object.DontDestroyOnLoad((Object)(object)root);
canvas = root.GetComponent<Canvas>();
canvas.renderMode = (RenderMode)0;
canvas.sortingOrder = 30000;
container = root.GetComponent<RectTransform>();
risk = MakeRisk();
menu = MakeMenu();
}
public void Tick()
{
//IL_013c: 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_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_0619: Unknown result type (might be due to invalid IL or missing references)
//IL_061e: Unknown result type (might be due to invalid IL or missing references)
//IL_0628: Unknown result type (might be due to invalid IL or missing references)
//IL_062d: Unknown result type (might be due to invalid IL or missing references)
//IL_063b: Unknown result type (might be due to invalid IL or missing references)
//IL_064e: Unknown result type (might be due to invalid IL or missing references)
//IL_03df: Unknown result type (might be due to invalid IL or missing references)
//IL_03ec: 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_0451: Unknown result type (might be due to invalid IL or missing references)
//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0541: Unknown result type (might be due to invalid IL or missing references)
//IL_0569: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)root) && layoutLanguage != L.Language)
{
root.SetActive(false);
Object.Destroy((Object)(object)root);
root = null;
markers.Clear();
occupied.Clear();
allText.Clear();
allPanels.Clear();
p.Forecast = null;
}
if (!Prepare())
{
return;
}
canvas.scaleFactor = Mathf.Max(0.25f, Mathf.Min((float)Screen.width / 1920f, (float)Screen.height / 1080f)) * p.Options.Scale.Value;
float num = (float)Screen.width / canvas.scaleFactor;
float num2 = (float)Screen.height / canvas.scaleFactor;
((Component)menu).gameObject.SetActive(p.MenuOpen);
if (p.MenuOpen)
{
Place(menu, new Rect((num - 430f) / 2f, (num2 - 432f) / 2f, 430f, 432f));
hudToggle.text = (p.Options.Enabled.Value ? L.T("Pings On", "Ping 显示 开") : L.T("Pings Off", "Ping 显示 关"));
playerToggle.text = (p.Options.Teammates.Value ? L.T("Teammate labels On", "队友标签 开") : L.T("Teammate labels Off", "队友标签 关"));
scaleText.text = L.T("UI size ", "界面大小 ") + Mathf.RoundToInt(p.Options.Scale.Value * 100f) + "%";
opacityText.text = L.T("Background opacity ", "背景不透明度 ") + Mathf.RoundToInt(p.Options.Opacity.Value * 100f) + "%";
keys.text = ((object)p.Options.Predict.Value/*cast due to .constrained prefix*/).ToString() + L.T(" Hold to assess ", " 按住评估落点 ") + ((object)p.Options.Players.Value/*cast due to .constrained prefix*/).ToString() + L.T(" Teammates", " 队友标签");
}
Camera main = Camera.main;
bool flag = Object.op_Implicit((Object)(object)main) && World.InputAllowed && !p.MenuOpen;
foreach (Card marker in markers)
{
marker.Used = false;
}
((Component)risk.Root).gameObject.SetActive(flag && p.Forecast != null);
occupied.Clear();
if (!flag)
{
HideUnusedMarkers();
return;
}
if (p.Forecast != null)
{
Forecast forecast = p.Forecast;
Rect val = default(Rect);
((Rect)(ref val))..ctor(Mathf.Min(num - 380f, num / 2f + 65f), Mathf.Min(num2 - 193f, num2 / 2f + 50f), 360f, 167f);
Place(risk.Root, val);
occupied.Add(val);
risk.Reach.text = forecast.Reach;
((Graphic)risk.Reach).color = BandColor(forecast.Band);
risk.Fall.text = forecast.Fall;
((Graphic)risk.Fall).color = BandColor(forecast.FallBand);
risk.Note.text = forecast.Note;
risk.Group.alpha = 1f;
((Graphic)risk.Background).color = BackgroundColor(p.Options.Opacity.Value);
}
int num3 = 0;
if (p.Options.Enabled.Value)
{
for (int num4 = p.Marks.Items.Count - 1; num4 >= 0; num4--)
{
Mark mark = p.Marks.Items[num4];
float alpha = Mathf.Clamp01((p.Options.Lifetime.Value - (Time.unscaledTime - mark.Created)) / 1.2f);
DrawMarker(num3++, main, mark.Point, mark.IsLocal ? L.T("You", "自己") : mark.Name, mark.Color, alpha, mark.EmphasizeUntil, num, num2);
}
}
if (p.Options.Teammates.Value)
{
foreach (Character allCharacter in Character.AllCharacters)
{
if (Object.op_Implicit((Object)(object)allCharacter) && !((Object)(object)allCharacter == (Object)(object)Character.localCharacter) && allCharacter.IsPlayerControlled && !((Object)(object)allCharacter.data == (Object)null))
{
if (num3 >= 40)
{
break;
}
try
{
DrawMarker(num3++, main, allCharacter.Head + Vector3.up * 0.3f, World.Name(allCharacter), World.Color(allCharacter), 0.85f, 0f, num, num2, allCharacter.Center);
}
catch (Exception ex)
{
p.Report("player-label", ex);
}
}
}
}
HideUnusedMarkers();
}
private void HideUnusedMarkers()
{
foreach (Card marker in markers)
{
if (!marker.Used)
{
if (((Component)marker.Root).gameObject.activeSelf)
{
((Component)marker.Root).gameObject.SetActive(false);
}
if (((Component)marker.Arrow).gameObject.activeSelf)
{
((Component)marker.Arrow).gameObject.SetActive(false);
}
}
}
}
private Color BackgroundColor(float opacity)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
return new Color(panelColor.r, panelColor.g, panelColor.b, panelColor.a * Mathf.Clamp01(opacity));
}
private void DrawMarker(int index, Camera camera, Vector3 point, string name, Color color, float alpha, float emphasis, float w, float h, Vector3? measuredPoint = null)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_003d: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: 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_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: 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_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: 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_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: 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_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0343: 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_0387: Unknown result type (might be due to invalid IL or missing references)
//IL_039a: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
//IL_03f9: 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_0402: 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_0409: Unknown result type (might be due to invalid IL or missing references)
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_0417: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_0429: Unknown result type (might be due to invalid IL or missing references)
//IL_0436: Unknown result type (might be due to invalid IL or missing references)
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_0462: Unknown result type (might be due to invalid IL or missing references)
//IL_046c: Unknown result type (might be due to invalid IL or missing references)
//IL_0481: Unknown result type (might be due to invalid IL or missing references)
//IL_0488: Unknown result type (might be due to invalid IL or missing references)
//IL_0490: Unknown result type (might be due to invalid IL or missing references)
//IL_04af: Unknown result type (might be due to invalid IL or missing references)
//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
while (markers.Count <= index)
{
markers.Add(MakeMarker());
}
Card card = markers[index];
Vector3 val = camera.WorldToViewportPoint(point);
ScreenAnchor.Place(val.x, val.y, val.z <= 0f, w, h, 65.0, out var x, out var y, out var edge);
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor((float)x, (float)y);
Rect val3 = default(Rect);
((Rect)(ref val3))..ctor(Mathf.Clamp(val2.x - 108f, 14f, w - 230f), Mathf.Clamp(val2.y - 34f, 14f, h - 84f), 216f, 68f);
Rect val4 = val3;
bool flag = false;
for (int i = 0; i < 12; i++)
{
((Rect)(ref val4)).y = Mathf.Clamp(((Rect)(ref val3)).y + (float)((i + 1) / 2 * ((i % 2 == 0) ? (-72) : 72)), 14f, h - 84f);
bool flag2 = false;
foreach (Rect item in occupied)
{
Rect current = item;
if (((Rect)(ref current)).Overlaps(val4))
{
flag2 = true;
break;
}
}
if (!flag2)
{
flag = true;
break;
}
}
if (flag)
{
occupied.Add(val4);
Place(card.Root, val4);
card.Used = true;
if (!((Component)card.Root).gameObject.activeSelf)
{
((Component)card.Root).gameObject.SetActive(true);
}
card.Heading.text = name;
((Graphic)card.Dot).color = color;
Vector3 val5 = ((Component)camera).transform.position;
Character localCharacter = Character.localCharacter;
if (Object.op_Implicit((Object)(object)localCharacter) && (Object)(object)localCharacter.data != (Object)null)
{
val5 = (Vector3)(measuredPoint.HasValue ? localCharacter.Center : new Vector3(localCharacter.Center.x, localCharacter.data.isGrounded ? localCharacter.data.groundPos.y : (localCharacter.Center.y - localCharacter.data.targetHeadHeight * 0.5f), localCharacter.Center.z));
}
Vector3 val6 = measuredPoint ?? point;
float num = val6.y - val5.y;
card.Detail.text = Vector3.Distance(val5, val6).ToString("0") + " m " + ((num >= 0f) ? "↑ " : "↓ ") + Mathf.Abs(num).ToString("0") + " m";
card.Group.alpha = alpha;
float num2 = emphasis - Time.unscaledTime;
float num3 = ((num2 > 0f) ? (Mathf.Sin(Mathf.Clamp01(num2 / 0.65f) * MathF.PI) * 0.08f) : 0f);
((Transform)card.Root).localScale = Vector3.one;
((Graphic)card.Background).color = BackgroundColor(p.Options.Opacity.Value + num3 * 3f);
((Transform)((Graphic)card.Dot).rectTransform).localScale = Vector3.one * (1f + num3 * 4f);
if (((Component)card.Arrow).gameObject.activeSelf != edge)
{
((Component)card.Arrow).gameObject.SetActive(edge);
}
if (edge)
{
((Component)card.Arrow).gameObject.SetActive(true);
Vector2 val7 = val2 - new Vector2(w / 2f, h / 2f);
Vector2 normalized = ((Vector2)(ref val7)).normalized;
Vector2 val8 = val2 + normalized * 16f;
Place(((Graphic)card.Arrow).rectTransform, new Rect(val8.x - 8f, val8.y - 8f, 16f, 16f));
((Graphic)card.Arrow).rectTransform.pivot = Vector2.one * 0.5f;
((Graphic)card.Arrow).rectTransform.anchoredPosition = new Vector2(val8.x, 0f - val8.y);
((Transform)((Graphic)card.Arrow).rectTransform).localEulerAngles = new Vector3(0f, 0f, (0f - Mathf.Atan2(normalized.y, normalized.x)) * 57.29578f);
((Graphic)card.Arrow).color = new Color(textColor.r, textColor.g, textColor.b, alpha);
}
}
}
private Card MakeMarker()
{
//IL_0071: 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_00a6: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
Card card = new Card
{
Root = Panel("Ping", container)
};
card.Background = ((Component)card.Root).GetComponent<Image>();
card.Group = ((Component)card.Root).gameObject.AddComponent<CanvasGroup>();
card.Group.blocksRaycasts = false;
card.Dot = Image("Sender", card.Root, new Rect(15f, 16f, 8f, 8f), Color.white);
card.Heading = Text("Name", card.Root, new Rect(32f, 7f, 170f, 28f), 19f);
card.Heading.overflowMode = (TextOverflowModes)1;
card.Detail = Text("DistanceHeight", card.Root, new Rect(15f, 32f, 190f, 28f), 21f);
GameObject val = new GameObject("Direction", new Type[3]
{
typeof(RectTransform),
typeof(CanvasRenderer),
typeof(ArrowGraphic)
});
val.transform.SetParent((Transform)(object)container, false);
card.Arrow = val.GetComponent<ArrowGraphic>();
((Graphic)card.Arrow).raycastTarget = false;
return card;
}
private Card MakeRisk()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: 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_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: 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_01e4: Unknown result type (might be due to invalid IL or missing references)
Card card = new Card
{
Root = Panel("Assessment", container)
};
card.Background = ((Component)card.Root).GetComponent<Image>();
card.Group = ((Component)card.Root).gameObject.AddComponent<CanvasGroup>();
card.Group.blocksRaycasts = false;
Text("Title", card.Root, new Rect(18f, 9f, 320f, 32f), 24f).text = L.T("Landing assessment", "落点评估");
Text("JumpLabel", card.Root, new Rect(18f, 49f, 60f, 30f), 19f).text = L.T("Jump", "跳跃");
Text("FallLabel", card.Root, new Rect(18f, 86f, 60f, 30f), 19f).text = L.T("Fall", "摔伤");
card.Reach = Text("Jump", card.Root, new Rect(85f, 49f, 258f, 30f), 21f);
card.Fall = Text("Fall", card.Root, new Rect(85f, 86f, 258f, 30f), 19f);
card.Note = Text("Condition", card.Root, new Rect(18f, 134f, 324f, 22f), 16f);
((Graphic)card.Note).color = new Color(textColor.r, textColor.g, textColor.b, 0.75f);
return card;
}
private RectTransform MakeMenu()
{
//IL_002d: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_00a3: 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_00b9: Expected O, but got Unknown
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Expected O, but got Unknown
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Expected O, but got Unknown
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Expected O, but got Unknown
//IL_01d6: 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_01ec: Expected O, but got Unknown
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: 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_0252: Expected O, but got Unknown
//IL_027c: 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_0292: Expected O, but got Unknown
RectTransform val = Panel("Settings", container);
Text("Title", val, new Rect(24f, 16f, 382f, 40f), 28f).text = L.T("PeakGuide ", "攀登向导 ") + "0.4.2";
hudToggle = Button(val, new Rect(24f, 76f, 382f, 44f), (UnityAction)delegate
{
p.Options.Enabled.Value = !p.Options.Enabled.Value;
});
playerToggle = Button(val, new Rect(24f, 128f, 382f, 44f), (UnityAction)delegate
{
p.Options.Teammates.Value = !p.Options.Teammates.Value;
});
scaleText = Text("Size", val, new Rect(24f, 184f, 250f, 38f), 21f);
Button(val, new Rect(302f, 184f, 46f, 38f), (UnityAction)delegate
{
p.Options.Scale.Value = Mathf.Max(0.8f, p.Options.Scale.Value - 0.1f);
}).text = "−";
Button(val, new Rect(358f, 184f, 46f, 38f), (UnityAction)delegate
{
p.Options.Scale.Value = Mathf.Min(1.4f, p.Options.Scale.Value + 0.1f);
}).text = "+";
opacityText = Text("Opacity", val, new Rect(24f, 232f, 250f, 38f), 21f);
Button(val, new Rect(302f, 232f, 46f, 38f), (UnityAction)delegate
{
p.Options.Opacity.Value = Mathf.Max(0.4f, p.Options.Opacity.Value - 0.1f);
}).text = "−";
Button(val, new Rect(358f, 232f, 46f, 38f), (UnityAction)delegate
{
p.Options.Opacity.Value = Mathf.Min(1f, p.Options.Opacity.Value + 0.1f);
}).text = "+";
keys = Text("Keys", val, new Rect(24f, 282f, 382f, 25f), 15f);
Button(val, new Rect(24f, 316f, 382f, 42f), (UnityAction)delegate
{
p.Options.Language.Value = ((L.Language == UiLanguage.English) ? UiLanguage.SimplifiedChinese : UiLanguage.English);
}).text = L.T("Language: English / 中文", "语言:简体中文 / English");
Button(val, new Rect(24f, 374f, 382f, 38f), (UnityAction)delegate
{
p.SetMenu(open: false);
}).text = L.T("Done", "完成");
return val;
}
private TMP_Text Button(RectTransform parent, Rect rect, UnityAction action)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_0046: 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_007d: 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_009c: 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_00da: Unknown result type (might be due to invalid IL or missing references)
Image val = Image("Button", parent, rect, new Color(1f, 1f, 1f, 0.1f));
((Graphic)val).raycastTarget = true;
Button obj = ((Component)val).gameObject.AddComponent<Button>();
((Selectable)obj).targetGraphic = (Graphic)(object)val;
ColorBlock colors = ((Selectable)obj).colors;
((ColorBlock)(ref colors)).highlightedColor = new Color(1f, 1f, 1f, 1.5f);
((ColorBlock)(ref colors)).pressedColor = new Color(1f, 1f, 1f, 0.6f);
((Selectable)obj).colors = colors;
((UnityEvent)obj.onClick).AddListener(action);
Navigation navigation = default(Navigation);
((Navigation)(ref navigation)).mode = (Mode)0;
((Selectable)obj).navigation = navigation;
TMP_Text obj2 = Text("Label", ((Graphic)val).rectTransform, new Rect(12f, 0f, ((Rect)(ref rect)).width - 24f, ((Rect)(ref rect)).height), 21f);
obj2.alignment = (TextAlignmentOptions)514;
return obj2;
}
private RectTransform Panel(string name, RectTransform parent)
{
//IL_0017: 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)
return ((Graphic)Image(name, parent, new Rect(0f, 0f, 216f, 68f), panelColor)).rectTransform;
}
private Image Image(string name, RectTransform parent, Rect rect, Color color)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name, new Type[3]
{
typeof(RectTransform),
typeof(CanvasRenderer),
typeof(Image)
});
val.transform.SetParent((Transform)(object)parent, false);
Image component = val.GetComponent<Image>();
component.sprite = panelSprite;
component.type = (Type)1;
component.pixelsPerUnitMultiplier = 0.8f;
((Graphic)component).color = color;
((Graphic)component).raycastTarget = false;
allPanels.Add(component);
Place(((Graphic)component).rectTransform, rect);
return component;
}
private TMP_Text Text(string name, RectTransform parent, Rect rect, float size)
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name, new Type[3]
{
typeof(RectTransform),
typeof(CanvasRenderer),
typeof(TextMeshProUGUI)
});
val.transform.SetParent((Transform)(object)parent, false);
TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
((TMP_Text)component).font = font;
if (Object.op_Implicit((Object)(object)textMaterial))
{
((TMP_Text)component).fontSharedMaterial = textMaterial;
}
((TMP_Text)component).fontSize = size;
((Graphic)component).color = textColor;
((TMP_Text)component).richText = false;
((TMP_Text)component).textWrappingMode = (TextWrappingModes)0;
((TMP_Text)component).overflowMode = (TextOverflowModes)0;
((TMP_Text)component).alignment = (TextAlignmentOptions)4097;
((Graphic)component).raycastTarget = false;
Place(((TMP_Text)component).rectTransform, new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y - 20f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height + 40f));
allText.Add((TMP_Text)(object)component);
return (TMP_Text)(object)component;
}
private static void Place(RectTransform t, Rect rect)
{
//IL_0014: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_0038: 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)
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(0f, 1f);
t.pivot = val;
Vector2 anchorMin = (t.anchorMax = val);
t.anchorMin = anchorMin;
t.anchoredPosition = new Vector2(((Rect)(ref rect)).x, 0f - ((Rect)(ref rect)).y);
t.sizeDelta = new Vector2(((Rect)(ref rect)).width, ((Rect)(ref rect)).height);
}
private Color BandColor(RiskBand band)
{
//IL_004b: 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_002f: 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)
return (Color)(band switch
{
RiskBand.Caution => new Color(0.94f, 0.82f, 0.5f),
RiskBand.VerySafe => new Color(0.74f, 0.86f, 0.61f),
RiskBand.Unknown => textColor,
_ => new Color(0.97f, 0.65f, 0.5f),
});
}
private Sprite MakeFallback()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_00e4: 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_00f3: 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: 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_0098: Unknown result type (might be due to invalid IL or missing references)
fallbackTexture = new Texture2D(64, 64, (TextureFormat)4, false);
Color[] array = (Color[])(object)new Color[4096];
for (int i = 0; i < 64; i++)
{
for (int j = 0; j < 64; j++)
{
float num = Mathf.Max(Mathf.Abs((float)j - 31.5f) - 19f, 0f);
float num2 = Mathf.Max(Mathf.Abs((float)i - 31.5f) - 19f, 0f);
array[i * 64 + j] = new Color(1f, 1f, 1f, Mathf.Clamp01(12f - Mathf.Sqrt(num * num + num2 * num2)));
}
}
fallbackTexture.SetPixels(array);
fallbackTexture.Apply();
fallbackSprite = Sprite.Create(fallbackTexture, new Rect(0f, 0f, 64f, 64f), Vector2.one * 0.5f, 100f, 0u, (SpriteMeshType)0, Vector4.one * 16f);
return fallbackSprite;
}
public void Dispose()
{
if (Object.op_Implicit((Object)(object)root))
{
Object.Destroy((Object)(object)root);
}
if (Object.op_Implicit((Object)(object)font))
{
Object.Destroy((Object)(object)font);
}
if (Object.op_Implicit((Object)(object)fallbackSprite))
{
Object.Destroy((Object)(object)fallbackSprite);
}
if (Object.op_Implicit((Object)(object)fallbackTexture))
{
Object.Destroy((Object)(object)fallbackTexture);
}
}
}
internal sealed class ArrowGraphic : MaskableGraphic
{
protected override void OnPopulateMesh(VertexHelper vh)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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_005a: 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)
//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_008b: 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_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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: 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_00ce: 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)
vh.Clear();
Rect rect = ((Graphic)this).rectTransform.rect;
vh.AddVert(new Vector3(((Rect)(ref rect)).xMax, ((Rect)(ref rect)).center.y), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero));
vh.AddVert(new Vector3(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMin), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero));
vh.AddVert(new Vector3(((Rect)(ref rect)).xMin + ((Rect)(ref rect)).width * 0.25f, ((Rect)(ref rect)).center.y), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero));
vh.AddVert(new Vector3(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMax), Color32.op_Implicit(((Graphic)this).color), Vector4.op_Implicit(Vector2.zero));
vh.AddTriangle(0, 1, 2);
vh.AddTriangle(0, 2, 3);
}
}
[BepInPlugin("peakguide.local", "PeakGuide", "0.4.2")]
public sealed class Plugin : BaseUnityPlugin
{
public const string Id = "peakguide.local";
public const string Version = "0.4.2";
private static Plugin instance;
internal Settings Options;
internal readonly MarkStore Marks = new MarkStore();
internal Forecast Forecast;
internal bool MenuOpen;
private NativeHud hud;
private readonly RiskPredictor predictor = new RiskPredictor();
private readonly HashSet<string> errors = new HashSet<string>();
private Harmony harmony;
private float nextForecast;
private Guid run;
private CursorLockMode oldCursor;
private bool oldVisible;
private void Awake()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
instance = this;
Options = new Settings(((BaseUnityPlugin)this).Config);
hud = new NativeHud(this);
harmony = new Harmony("peakguide.local");
harmony.Patch((MethodBase)AccessTools.Method(typeof(PointPinger), "ReceivePoint_Rpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(Plugin), "CapturePing", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
harmony.Patch((MethodBase)AccessTools.Method(typeof(Character), "CanDoInput", (Type[])null, (Type[])null), new HarmonyMethod(typeof(Plugin), "FilterInput", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
harmony.Patch((MethodBase)AccessTools.Method(typeof(GUIManager), "UpdateWindowStatus", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "MenuStatus", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
SceneManager.activeSceneChanged += SceneChanged;
((BaseUnityPlugin)this).Logger.LogInfo((object)"PEAKGUIDE_READY 0.4.2 | native TMP UI | fixed-origin max-runup assessment");
}
private static void MenuStatus(GUIManager __instance)
{
if (Object.op_Implicit((Object)(object)instance) && instance.MenuOpen)
{
AccessTools.PropertySetter(typeof(GUIManager), "windowShowingCursor").Invoke(__instance, new object[1] { true });
AccessTools.PropertySetter(typeof(GUIManager), "windowBlockingInput").Invoke(__instance, new object[1] { true });
}
}
private static bool FilterInput(Character __instance, ref bool __result)
{
if (Object.op_Implicit((Object)(object)instance) && instance.MenuOpen && (Object)(object)__instance == (Object)(object)Character.localCharacter)
{
__result = false;
return false;
}
return true;
}
private static void CapturePing(PointPinger __instance, Vector3 __0)
{
//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_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)
if (!Object.op_Implicit((Object)(object)instance) || !instance.Options.Enabled.Value)
{
return;
}
try
{
Character character = __instance.character;
if (Object.op_Implicit((Object)(object)character) && Object.op_Implicit((Object)(object)((MonoBehaviourPun)character).photonView) && World.Finite(__0))
{
instance.Marks.Add(new Mark
{
Sender = ((MonoBehaviourPun)character).photonView.OwnerActorNr,
IsLocal = ((Object)(object)character == (Object)(object)Character.localCharacter),
Name = World.Name(character),
Point = __0,
Color = World.Color(character)
}, Time.unscaledTime);
}
}
catch (Exception ex)
{
instance.Report("ping", ex);
}
}
internal void Report(string area, Exception ex)
{
if (errors.Add(area))
{
((BaseUnityPlugin)this).Logger.LogError((object)(area + ": " + ex));
}
}
internal void Log(string text)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)text);
}
private void Update()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: 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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
try
{
KeyboardShortcut value = Options.Menu.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
SetMenu(!MenuOpen);
}
value = Options.Toggle.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
Options.Enabled.Value = !Options.Enabled.Value;
}
if (!MenuOpen && World.InputAllowed)
{
value = Options.Players.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
Options.Teammates.Value = !Options.Teammates.Value;
}
}
if (Object.op_Implicit((Object)(object)RunManager.Instance) && RunManager.Instance.RunId != run)
{
run = RunManager.Instance.RunId;
Marks.Items.Clear();
Forecast = null;
}
Marks.Tick(Time.unscaledTime, Options.Lifetime.Value);
if (!MenuOpen && World.InputAllowed)
{
value = Options.Predict.Value;
if (((KeyboardShortcut)(ref value)).IsPressed())
{
if (Time.unscaledTime >= nextForecast)
{
nextForecast = Time.unscaledTime + 0.25f;
Forecast = (World.Aim(Camera.main, out var hit) ? predictor.Evaluate(Character.localCharacter, ((RaycastHit)(ref hit)).point) : null);
}
goto IL_019d;
}
}
Forecast = null;
goto IL_019d;
IL_019d:
hud.Tick();
}
catch (Exception ex)
{
Report("update", ex);
Forecast = null;
}
}
internal void SetMenu(bool open)
{
//IL_003f: 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_001a: Unknown result type (might be due to invalid IL or missing references)
if (open != MenuOpen)
{
MenuOpen = open;
if (open)
{
oldCursor = Cursor.lockState;
oldVisible = Cursor.visible;
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
Forecast = null;
}
else
{
Cursor.lockState = oldCursor;
Cursor.visible = oldVisible;
}
}
}
private void SceneChanged(Scene oldScene, Scene newScene)
{
SetMenu(open: false);
Marks.Items.Clear();
Forecast = null;
hud.ResetTheme();
}
private void OnDestroy()
{
SetMenu(open: false);
SceneManager.activeSceneChanged -= SceneChanged;
Harmony obj = harmony;
if (obj != null)
{
obj.UnpatchSelf();
}
hud?.Dispose();
if ((Object)(object)instance == (Object)(object)this)
{
instance = null;
}
}
}
internal enum RiskBand
{
Unknown,
VerySafe,
Caution,
High,
AlmostImpossible,
Blocked
}
internal static class RiskMath
{
public static double Clamp01(double n)
{
return Math.Max(0.0, Math.Min(1.0, n));
}
public static double FallDamage(double effectiveTime, double downSpeed, double threshold, double ascent, bool skeleton, bool invincible, double cap = double.PositiveInfinity)
{
if (double.IsNaN(effectiveTime) || double.IsInfinity(effectiveTime) || double.IsNaN(downSpeed) || double.IsInfinity(downSpeed) || threshold >= 3.0 || threshold < 0.0)
{
return double.NaN;
}
if (invincible || effectiveTime <= threshold)
{
return 0.0;
}
double val = Math.Pow(Clamp01((effectiveTime - threshold) / (3.0 - threshold)), 1.5);
double num = Math.Min(val2: Math.Pow(Clamp01((downSpeed - 10.0) / 10.0), 1.5), val1: Math.Max(val, 0.05));
if (num < 0.025)
{
return 0.0;
}
return Math.Min(num, cap) * ascent * (double)((!skeleton) ? 1 : 8);
}
public static double EffectiveTime(double sinceGrounded, double sinceJump)
{
return Math.Min(sinceGrounded, sinceJump) - ((sinceGrounded - sinceJump > -0.05) ? 0.375 : 0.125);
}
public static RiskBand FallBand(double injury, double status)
{
if (double.IsNaN(injury) || double.IsNaN(status))
{
return RiskBand.Unknown;
}
if (injury + status > 0.99 || injury >= 0.3)
{
return RiskBand.High;
}
if (!(injury <= 0.0))
{
return RiskBand.Caution;
}
return RiskBand.VerySafe;
}
public static RiskBand LandingBand(bool landed, double supportMargin, double stamina, bool uncertain)
{
if (!landed)
{
return RiskBand.AlmostImpossible;
}
if (uncertain || supportMargin < 0.25 || stamina < 0.08)
{
return RiskBand.High;
}
if (!(supportMargin >= 0.6) || !(stamina >= 0.2))
{
return RiskBand.Caution;
}
return RiskBand.VerySafe;
}
public static bool IsLanding(bool support, double distanceFromTargetZone)
{
if (support)
{
return distanceFromTargetZone < 0.9;
}
return false;
}
}
internal sealed class Forecast
{
public string Reach = L.T("Unknown", "信息不足");
public string Fall = "—";
public string Note = L.T("Full run-up · Current takeoff point", "满速助跑 · 当前站位起跳");
public RiskBand Band;
public RiskBand FallBand;
public Vector3 Origin;
public Vector3 Target;
public float Speed;
}
internal sealed class RiskPredictor
{
private static readonly FieldInfo Threshold = AccessTools.Field(typeof(CharacterMovement), "fallDamageTime");
private static readonly FieldInfo Cap = AccessTools.Field(typeof(CharacterMovement), "fallDamageCap");
private static readonly FieldInfo CapEnd = AccessTools.Field(typeof(CharacterMovement), "fallDamageCapEndTime");
private readonly List<Vector3> zone = new List<Vector3>();
private const float Radius = 0.26f;
public Forecast Evaluate(Character c, Vector3 target)
{
//IL_0006: 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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: 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_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: 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_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0304: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Unknown result type (might be due to invalid IL or missing references)
//IL_035e: Unknown result type (might be due to invalid IL or missing references)
//IL_0363: 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_036f: 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_0399: Unknown result type (might be due to invalid IL or missing references)
//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
//IL_03bf: 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_03d3: Unknown result type (might be due to invalid IL or missing references)
//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: 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_0425: Unknown result type (might be due to invalid IL or missing references)
//IL_042d: Unknown result type (might be due to invalid IL or missing references)
//IL_0434: Unknown result type (might be due to invalid IL or missing references)
//IL_0491: Unknown result type (might be due to invalid IL or missing references)
//IL_0497: Unknown result type (might be due to invalid IL or missing references)
//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
//IL_04c4: 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_053d: Unknown result type (might be due to invalid IL or missing references)
//IL_0552: Unknown result type (might be due to invalid IL or missing references)
//IL_0579: 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_0582: Unknown result type (might be due to invalid IL or missing references)
//IL_0584: Unknown result type (might be due to invalid IL or missing references)
//IL_0589: Unknown result type (might be due to invalid IL or missing references)
//IL_058b: Unknown result type (might be due to invalid IL or missing references)
//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
//IL_05be: Unknown result type (might be due to invalid IL or missing references)
//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
//IL_05de: Unknown result type (might be due to invalid IL or missing references)
//IL_07a0: Unknown result type (might be due to invalid IL or missing references)
//IL_07a7: Unknown result type (might be due to invalid IL or missing references)
//IL_07b2: Unknown result type (might be due to invalid IL or missing references)
//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
//IL_07b5: Unknown result type (might be due to invalid IL or missing references)
//IL_07ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0610: Unknown result type (might be due to invalid IL or missing references)
//IL_0615: Unknown result type (might be due to invalid IL or missing references)
//IL_0646: Unknown result type (might be due to invalid IL or missing references)
//IL_064b: Unknown result type (might be due to invalid IL or missing references)
//IL_064f: Unknown result type (might be due to invalid IL or missing references)
//IL_0653: Unknown result type (might be due to invalid IL or missing references)
//IL_068a: Unknown result type (might be due to invalid IL or missing references)
Forecast forecast = new Forecast
{
Target = target
};
if (!Object.op_Implicit((Object)(object)c) || (Object)(object)c.data == (Object)null || c.refs == null || !Object.op_Implicit((Object)(object)c.refs.movement) || !Object.op_Implicit((Object)(object)c.refs.afflictions) || !World.Finite(target))
{
return forecast;
}
CharacterData data = c.data;
CharacterMovement movement = c.refs.movement;
if (!data.fullyConscious || !data.isGrounded || data.isClimbingAnything || Object.op_Implicit((Object)(object)data.currentClimbHandle) || data.currentRagdollControll < 0.9f)
{
forecast.Note = L.T("Stand on solid ground first", "请站稳后评估");
return forecast;
}
if (data.isInWater || movement.rocketActive || data.chargingJump || c.refs.afflictions.isStruggling || data.sincePalJump < 1f || data.lastBouncedTime + 2.5f > Time.time)
{
forecast.Note = L.T("Special movement: cannot assess", "当前特殊移动状态无法可靠评估");
return forecast;
}
if (c.isZombie || c.isScoutmaster || movement.jumpGravityCurve == null || movement.jumpImpulse <= 0f || movement.balloonFloatMultiplier <= 0f || movement.balloonJumpMultiplier <= 0f || movement.drag <= 0f || movement.drag >= 1f || movement.movementForce * movement.movementModifier <= 0f || movement.sprintMultiplier <= 0f)
{
forecast.Note = L.T("Movement data unavailable", "移动参数不可用");
return forecast;
}
if (Object.op_Implicit((Object)(object)data.currentItem) && (((Object)data.currentItem).name.IndexOf("glider", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)data.currentItem).name.IndexOf("parasol", StringComparison.OrdinalIgnoreCase) >= 0))
{
forecast.Note = L.T("Gliding is not supported", "滑翔状态暂无法评估");
return forecast;
}
float fixedDeltaTime = Time.fixedDeltaTime;
if (fixedDeltaTime <= 0f || fixedDeltaTime > 0.05f)
{
return forecast;
}
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(c.Center.x, data.groundPos.y + 0.06f, c.Center.z);
forecast.Origin = val;
if (!Object.op_Implicit((Object)(object)c.refs.ragdoll) || !c.refs.ragdoll.partDict.TryGetValue((BodypartType)2, out var value) || !Object.op_Implicit((Object)(object)value.Rig))
{
return forecast;
}
float linearDamping = value.Rig.linearDamping;
if (linearDamping < 0f || !World.Finite(val) || !World.Finite(new Vector3(linearDamping, movement.movementForce, movement.jumpImpulse)))
{
return forecast;
}
float num = movement.movementForce * movement.movementModifier;
float num2 = Mathf.Clamp(c.Head.y - val.y + 0.15f, 1.2f, 2.2f);
float injury = DropDamage(c, val.y - target.y, linearDamping);
SetFall(forecast, injury, c);
if (data.currentStamina <= 0f || data.currentStamina < movement.jumpStaminaUsageSprinting)
{
forecast.Note = L.T("Not enough stamina for a running jump", "当前体力不足以完成正常助跑跳");
return forecast;
}
if (Vector2.Distance(new Vector2(val.x, val.z), new Vector2(target.x, target.z)) < 0.1f)
{
forecast.Note = L.T("Aim at a landing point farther away", "请瞄准有水平距离的落点");
return forecast;
}
if (Vector3.Distance(val, target) > 120f)
{
forecast.Note = L.T("Target beyond assessment range", "目标超出局部跳跃评估范围");
return forecast;
}
if (Physics.CheckCapsule(val + Vector3.up * 0.29999998f, val + Vector3.up * (num2 - 0.26f), 0.26f, World.Terrain, (QueryTriggerInteraction)1))
{
forecast.Note = L.T("Not enough takeoff clearance", "起跳空间受限,无法可靠评估");
return forecast;
}
FlightState s = JumpKinematics.Launch(val.x, val.y, val.z, target.x, target.z, num, movement.sprintMultiplier, movement.drag, linearDamping, fixedDeltaTime, movement.jumpImpulse * movement.balloonJumpMultiplier);
forecast.Speed = (float)Math.Sqrt(s.Vx * s.Vx + s.Vz * s.Vz);
Vector3 val2 = new Vector3(target.x - val.x, 0f, target.z - val.z);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
BuildZone(target, normalized);
float num3 = data.currentStamina - movement.jumpStaminaUsageSprinting;
bool flag = movement.hasJetpack || data.extraJumps > 0;
RaycastHit val6 = default(RaycastHit);
for (int i = 1; i <= 600 && (float)i * fixedDeltaTime <= 8f; i++)
{
float num4 = (float)i * fixedDeltaTime;
Vector3 val3 = Position(s);
float num5 = Mathf.Lerp(movement.jumpGravity, movement.maxGravity, Mathf.Clamp01(movement.jumpGravityCurve.Evaluate(num4 * movement.gravityCurveSpeed))) * movement.balloonFloatMultiplier;
s = JumpKinematics.Step(s, normalized.x * num * movement.sprintMultiplier, num5, normalized.z * num * movement.sprintMultiplier, movement.drag, linearDamping, fixedDeltaTime);
Vector3 val4 = Position(s);
Vector3 val5 = val4 - val3;
if (!World.Finite(val4) || ((Vector3)(ref val5)).sqrMagnitude < 1E-07f)
{
continue;
}
if (Physics.CapsuleCast(val3 + Vector3.up * 0.29999998f, val3 + Vector3.up * (num2 - 0.26f), 0.26f, ((Vector3)(ref val5)).normalized, ref val6, ((Vector3)(ref val5)).magnitude, World.Terrain, (QueryTriggerInteraction)1))
{
bool flag2 = s.Vy < 0.0 && Vector3.Angle(((RaycastHit)(ref val6)).normal, Vector3.up) <= 50f;
float num6 = float.MaxValue;
foreach (Vector3 item in zone)
{
num6 = Mathf.Min(num6, Vector3.Distance(item, ((RaycastHit)(ref val6)).point));
}
float num7 = (flag2 ? SupportMargin(((RaycastHit)(ref val6)).point) : 0f);
bool flag3 = RiskMath.IsLanding(flag2, num6);
flag |= Object.op_Implicit((Object)(object)((RaycastHit)(ref val6)).rigidbody) && !((RaycastHit)(ref val6)).rigidbody.isKinematic;
forecast.Band = RiskMath.LandingBand(flag3, num7, num3, flag);
forecast.Reach = ((!flag3) ? L.T("Very unlikely", "几乎不可达") : ((forecast.Band == RiskBand.VerySafe) ? L.T("Likely reachable", "较稳可达") : L.T("Risky landing", "勉强可达")));
if (flag3)
{
SetFall(forecast, Damage(c, num4, num4, (float)(0.0 - s.Vy), num4), c, L.T("Landing", "落地"));
}
if (!flag3 && i < 5)
{
forecast.Reach = L.T("Takeoff blocked", "起跳方向受阻");
forecast.Band = RiskBand.Blocked;
}
forecast.Note = (flag ? L.T("Full run-up · Extra uncertainty", "满速助跑 · 特殊状态或落点需谨慎") : L.T("Full run-up · Current takeoff point", "满速助跑 · 当前站位起跳"));
return forecast;
}
if (val4.y < target.y - num2 && Vector3.Dot(val4 - target, normalized) > 1f)
{
forecast.Band = RiskBand.AlmostImpossible;
forecast.Reach = L.T("Very unlikely", "几乎不可达");
return forecast;
}
}
forecast.Reach = L.T("Unknown", "信息不足");
forecast.Band = RiskBand.Unknown;
forecast.Note = L.T("No stable landing found in range", "预测范围内尚未找到稳定落点");
return forecast;
}
private static Vector3 Position(FlightState s)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
return new Vector3((float)s.X, (float)s.Y, (float)s.Z);
}
private void BuildZone(Vector3 target, Vector3 direction)
{
//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_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)
RaycastHit val = default(RaycastHit);
LandingZone.Build<Vector3>(zone, (Func<double, Vector3?>)((double offset) => (!Physics.Raycast(target + direction * (float)offset + Vector3.up * 0.55f, Vector3.down, ref val, 1.1f, World.Terrain, (QueryTriggerInteraction)1) || Vector3.Angle(((RaycastHit)(ref val)).normal, Vector3.up) > 50f || Mathf.Abs(((RaycastHit)(ref val)).point.y - target.y) > 0.5f) ? ((Vector3?)null) : new Vector3?(((RaycastHit)(ref val)).point)));
}
private static float SupportMargin(Vector3 center)
{
//IL_000e: 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_001a: 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_0026: 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_0032: 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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
float num = 0.9f;
Vector3[] array = (Vector3[])(object)new Vector3[4]
{
Vector3.forward,
Vector3.back,
Vector3.left,
Vector3.right
};
RaycastHit val2 = default(RaycastHit);
foreach (Vector3 val in array)
{
float num2 = 0f;
for (float num3 = 0.15f; num3 <= 0.95f && Physics.Raycast(center + val * num3 + Vector3.up * 0.25f, Vector3.down, ref val2, 0.55f, World.Terrain, (QueryTriggerInteraction)1); num3 += 0.15f)
{
if (Vector3.Angle(((RaycastHit)(ref val2)).normal, Vector3.up) > 50f)
{
break;
}
num2 = num3;
}
num = Mathf.Min(num, num2);
}
return num;
}
private static float DropDamage(Character c, float height, float damping)
{
if (height < 0f)
{
return float.NaN;
}
CharacterMovement movement = c.refs.movement;
float fixedDeltaTime = Time.fixedDeltaTime;
FlightState s = new FlightState
{
Y = height
};
for (int i = 1; i <= 900; i++)
{
float num = (float)i * fixedDeltaTime;
float num2 = Mathf.Lerp(0f, movement.maxGravity, Mathf.Clamp01(movement.jumpGravityCurve.Evaluate(num * movement.gravityCurveSpeed))) * movement.balloonFloatMultiplier;
s = JumpKinematics.Step(s, 0.0, num2, 0.0, movement.drag, damping, fixedDeltaTime);
if (s.Y <= 0.0 && s.Vy <= 0.0)
{
return Damage(c, num, num + 100f, (float)(0.0 - s.Vy), num);
}
}
return float.NaN;
}
private static float Damage(Character c, float ground, float jump, float speed, float elapsed)
{
//IL_0047: 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)
if (Threshold == null || Cap == null || CapEnd == null)
{
return float.NaN;
}
bool flag = false;
AfflictionType[] array = (AfflictionType[])(object)new AfflictionType[2]
{
(AfflictionType)16,
(AfflictionType)14
};
Affliction val2 = default(Affliction);
foreach (AfflictionType val in array)
{
if (c.refs.afflictions.HasAfflictionType(val, ref val2) && val2.totalTime - val2.timeElapsed > elapsed + 0.15f)
{
flag = true;
}
}
float num = (((float)CapEnd.GetValue(c.refs.movement) > Time.time + elapsed) ? ((float)Cap.GetValue(c.refs.movement)) : float.PositiveInfinity);
return (float)RiskMath.FallDamage(RiskMath.EffectiveTime(ground, jump), speed, (float)Threshold.GetValue(c.refs.movement), Ascents.fallDamageMultiplier, c.data.isSkeleton, flag || c.inAirport, num);
}
private static void SetFall(Forecast result, float injury, Character c, string prefix = null)
{
if (prefix == null)
{
prefix = L.T("Drop", "该高度直落");
}
result.FallBand = RiskMath.FallBand(injury, c.refs.afflictions.statusSum);
result.Fall = (float.IsNaN(injury) ? L.T("Unknown at this height", "该高度暂无法判断") : (prefix + L.T(": ", ":") + ((injury + c.refs.afflictions.statusSum > 0.99f) ? L.T("May pass out", "可能昏迷") : ((injury <= 0f) ? L.T("No injury expected", "预计无伤") : ((injury >= 0.3f) ? L.T("Severe injury risk", "重伤风险") : L.T("Injury risk", "有摔伤风险"))))));
}
}
internal static class ScreenAnchor
{
internal static void Place(double vx, double vy, bool behind, double width, double height, double inset, out double x, out double y, out bool edge)
{
double num = (vx - 0.5) * width;
double num2 = (0.5 - vy) * height;
if (behind)
{
num = 0.0 - num;
num2 = 0.0 - num2;
}
double num3 = Math.Max(1.0, width / 2.0 - inset);
double num4 = Math.Max(1.0, height / 2.0 - inset);
edge = behind || Math.Abs(num) > num3 || Math.Abs(num2) > num4;
if (edge)
{
if (Math.Abs(num) + Math.Abs(num2) < 0.001)
{
num2 = 1.0;
}
double num5 = Math.Max(Math.Abs(num) / num3, Math.Abs(num2) / num4);
num /= num5;
num2 /= num5;
}
x = width / 2.0 + num;
y = height / 2.0 + num2;
}
}
internal sealed class Settings
{
public readonly ConfigEntry<bool> Enabled;
public readonly ConfigEntry<bool> Teammates;
public readonly ConfigEntry<float> Scale;
public readonly ConfigEntry<float> Opacity;
public readonly ConfigEntry<float> Lifetime;
public readonly ConfigEntry<KeyboardShortcut> Menu;
public readonly ConfigEntry<KeyboardShortcut> Predict;
public readonly ConfigEntry<KeyboardShortcut> Toggle;
public readonly ConfigEntry<KeyboardShortcut> Players;
public readonly ConfigEntry<UiLanguage> Language;
public Settings(ConfigFile c)
{
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Expected O, but got Unknown
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Expected O, but got Unknown
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
MigrateLegacy(c);
Language = c.Bind<UiLanguage>("General", "Language", UiLanguage.English, "UI language / 界面语言: English or SimplifiedChinese. Default: English.");
L.Language = Language.Value;
Language.SettingChanged += delegate
{
L.Language = Language.Value;
};
Enabled = c.Bind<bool>("Display", "Enabled", true, "Show enhanced pings / 显示增强 Ping");
Teammates = c.Bind<bool>("Display", "Teammates", false, "Optional teammate labels, off by default / 队友标签,默认关闭");
Scale = c.Bind<float>("Display", "Scale", 1f, new ConfigDescription("UI scale / 界面大小", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.8f, 1.4f), Array.Empty<object>()));
Opacity = c.Bind<float>("Display", "Opacity", 0.92f, new ConfigDescription("HUD background opacity; text stays readable / 提示背景不透明度,文字保持清晰", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.4f, 1f), Array.Empty<object>()));
Lifetime = c.Bind<float>("Display", "PingSeconds", 8f, new ConfigDescription("Current ping lifetime in seconds / 当前 Ping 保留秒数", (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 15f), Array.Empty<object>()));
Menu = c.Bind<KeyboardShortcut>("Keys", "Settings", new KeyboardShortcut((KeyCode)286, Array.Empty<KeyCode>()), "Settings / 设置");
Predict = c.Bind<KeyboardShortcut>("Keys", "Assess", new KeyboardShortcut((KeyCode)112, Array.Empty<KeyCode>()), "Hold for jump and fall assessment / 按住显示跳跃与摔伤评估");
Toggle = c.Bind<KeyboardShortcut>("Keys", "HUD", new KeyboardShortcut((KeyCode)288, Array.Empty<KeyCode>()), "Toggle enhanced pings / Ping 显示开关");
Players = c.Bind<KeyboardShortcut>("Keys", "Teammates", new KeyboardShortcut((KeyCode)285, Array.Empty<KeyCode>()), "Toggle teammate labels / 队友标签开关");
}
private static void MigrateLegacy(ConfigFile c)
{
if (!File.Exists(c.ConfigFilePath))
{
return;
}
HashSet<string> hashSet = new HashSet<string> { "Accessibility", "Alerts", "Diagnostics", "HUD", "Input", "Network", "Pings", "Risk" };
List<string> list = new List<string>();
bool flag = false;
bool flag2 = false;
string[] array = File.ReadAllLines(c.ConfigFilePath);
foreach (string text in array)
{
string text2 = text.Trim();
if (text2.StartsWith("[") && text2.EndsWith("]"))
{
flag = hashSet.Contains(text2.Substring(1, text2.Length - 2));
flag2 = flag2 || flag;
}
if (!flag)
{
list.Add(text);
}
}
if (flag2)
{
File.Copy(c.ConfigFilePath, c.ConfigFilePath + ".pre-0.3.0-" + DateTime.UtcNow.Ticks + ".bak");
File.WriteAllLines(c.ConfigFilePath, list);
c.Reload();
}
}
}
}