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 Better Combat Random QoL v1.0.2
BetterCombatQoL.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using TMPro; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; 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("BetterCombatQoL")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("BetterCombatQoL")] [assembly: AssemblyTitle("BetterCombatQoL")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: UnverifiableCode] [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 WeaponWieldMod { internal sealed class Combat : MonoBehaviour, IHudDrawer { private sealed class Popup { public Vector3 World; public Vector3 Drift; public string Text; public Color Color; public float Born; public float Life; public float Size; } private const float NumberLife = 0.9f; private const float KillLife = 1.3f; private const float MarkerLife = 0.22f; private static readonly Color DamageColor = new Color(1f, 0.9f, 0.35f); private static readonly Color BigDamageColor = new Color(1f, 0.45f, 0.15f); private static readonly Color KillColor = new Color(1f, 0.2f, 0.2f); private static readonly List<Popup> popups = new List<Popup>(); private static float markerTime = -10f; private static bool markerKill; private static float attackTime = -10f; private static float attackWindow; private GUIStyle style; internal static void LocalAttack(float window) { attackTime = Time.time; attackWindow = window; } internal static void OnHurt(EnemyHealth health, int rawDamage) { //IL_003d: 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_0043: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(1, (int)((float)rawDamage * (1f - Mathf.Min(health.damageResistance, 1f)))); if (!SemiFunc.IsMasterClientOrSingleplayer()) { health.healthCurrent = Mathf.Max(1, health.healthCurrent - num); } Vector3 at = EnemyPoint(health); bool flag = Mine(at); LevelStats.EnemyDamaged(num, flag); if (WieldConfig.DamageNumbers.Value) { AddPopup(at, num.ToString(), (num >= 50) ? BigDamageColor : DamageColor, 0.9f, (num >= 50) ? 1.3f : 1f); if (flag) { Marker(kill: false); } } } internal static void OnDeath(EnemyHealth health) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_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_003a: 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_0049: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { health.healthCurrent = 0; } Vector3 val = EnemyPoint(health); bool flag = Mine(val); LevelStats.EnemyKilled(flag); if (WieldConfig.DamageNumbers.Value) { AddPopup(val + Vector3.up * 0.3f, "KILL", KillColor, 1.3f, 1.6f); if (flag) { Marker(kill: true); } } } private static Vector3 EnemyPoint(EnemyHealth health) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Enemy enemy = health.enemy; return ((Object.op_Implicit((Object)(object)enemy) && Object.op_Implicit((Object)(object)enemy.CenterTransform)) ? enemy.CenterTransform : ((Component)health).transform).position + Vector3.up * 0.5f; } private static bool Mine(Vector3 at) { //IL_0024: 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_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_004a: 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) if (Time.time - attackTime > attackWindow) { return false; } Camera val = ScreenSpace.GameCamera(); if (!Object.op_Implicit((Object)(object)val)) { return false; } Vector3 val2 = at - ((Component)val).transform.position; if (((Vector3)(ref val2)).magnitude < 60f) { return Vector3.Angle(((Component)val).transform.forward, val2) < 50f; } return false; } private static void Marker(bool kill) { markerTime = Time.time; markerKill = kill; } internal static void AddPopup(Vector3 at, string text, Color color, float life, float size) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0075: Unknown result type (might be due to invalid IL or missing references) if (popups.Count > 40) { popups.RemoveAt(0); } popups.Add(new Popup { World = at + Random.insideUnitSphere * 0.15f, Drift = new Vector3(Random.Range(-0.3f, 0.3f), 1f, Random.Range(-0.3f, 0.3f)), Text = text, Color = color, Born = Time.time, Life = life, Size = size }); } private void Update() { if (!Object.op_Implicit((Object)(object)LevelGenerator.Instance) || !LevelGenerator.Instance.Generated) { popups.Clear(); } popups.RemoveAll((Popup p) => Time.time - p.Born > p.Life); } public void DrawHud() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_009e: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) if (ScreenSpace.HudHidden() || (Object.op_Implicit((Object)(object)Map.Instance) && Map.Instance.Active)) { return; } Camera val = ScreenSpace.GameCamera(); if (!Object.op_Implicit((Object)(object)val)) { return; } if (style == null) { style = new GUIStyle { alignment = (TextAnchor)4, fontStyle = (FontStyle)1, wordWrap = false }; } Rect view = ScreenSpace.GameView(); float num = ((Rect)(ref view)).height / 720f; foreach (Popup popup in popups) { float num2 = (Time.time - popup.Born) / popup.Life; Vector3 world = popup.World + popup.Drift * (0.6f * num2); if (ScreenSpace.Project(val, view, world, out var gui)) { float num3 = 1f + Mathf.Max(0f, 0.15f - num2) * 4f; style.fontSize = Mathf.Max(10, Mathf.RoundToInt(20f * num * popup.Size * num3)); float num4 = Mathf.Clamp01((1f - num2) * 2f); ScreenSpace.Shadowed(new Rect(gui.x - 150f, gui.y - 30f, 300f, 60f), popup.Text, style, new Color(popup.Color.r, popup.Color.g, popup.Color.b, num4)); } } DrawMarker(view, num); } private static void DrawMarker(Rect view, float scale) { //IL_0049: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) float num = Time.time - markerTime; float num2 = (markerKill ? 0.44f : 0.22f); if (WieldConfig.DamageNumbers.Value && !(num > num2)) { float num3 = 1f - num / num2; Color val = (markerKill ? KillColor : Color.white); Color c = default(Color); ((Color)(ref c))..ctor(val.r, val.g, val.b, num3); Vector2 center = ((Rect)(ref view)).center; float num4 = 7f * scale; float num5 = 9f * scale; float num6 = Mathf.Max(2f, 2.5f * scale); for (int i = 0; i < 4; i++) { float num7 = 45f + 90f * (float)i; float num8 = num7 * (MathF.PI / 180f); Vector2 val2 = center + new Vector2(Mathf.Cos(num8), Mathf.Sin(num8)) * (num4 + num5 * 0.5f); ScreenSpace.Icon(new Rect(val2.x - num5 * 0.5f, val2.y - num6 * 0.5f, num5, num6), ScreenSpace.White, c, num7); } } } } internal sealed class ControlsHint : MonoBehaviour, IHudDrawer { private struct Line { public string Key; public string Action; public float Charge; public Line(string key, string action, float charge = -1f) { Key = key; Action = action; Charge = charge; } } private static readonly Color Accent = new Color(1f, 0.82f, 0.25f); private static readonly Color Text = new Color(0.92f, 0.92f, 0.92f); private static readonly Color Chip = new Color(0f, 0f, 0f, 0.55f); private static readonly Color ChipLit = new Color(1f, 0.82f, 0.25f, 0.85f); private float fade; private GUIStyle keyStyle; private GUIStyle actionStyle; private static readonly Color BatteryColor = new Color(1f, 0.88f, 0.1f); private static readonly Color BatteryLow = new Color(1f, 0.25f, 0.15f); private void Update() { bool flag = WieldConfig.ControlsHint.Value && Wielder.Equipped; fade = Mathf.MoveTowards(fade, flag ? 1f : 0f, Time.deltaTime * 5f); } public void DrawHud() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0056: 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_0067: Expected O, but got Unknown //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_020c: 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_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0247: 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_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0288: 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_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) if (fade <= 0f || ScreenSpace.HudHidden() || (Object.op_Implicit((Object)(object)Map.Instance) && Map.Instance.Active)) { return; } if (keyStyle == null) { keyStyle = new GUIStyle { alignment = (TextAnchor)4, fontStyle = (FontStyle)1 }; actionStyle = new GUIStyle(keyStyle) { alignment = (TextAnchor)3 }; } Rect view = HudCanvas.View; float num = ((Rect)(ref view)).height / 720f; keyStyle.fontSize = Mathf.Max(9, Mathf.RoundToInt(12f * num)); actionStyle.fontSize = Mathf.Max(9, Mathf.RoundToInt(13f * num)); Line[] array = Lines(); float num2 = 24f * num; float num3 = 6f * num; float num4 = ((Rect)(ref view)).x + 24f * num; float num5 = ((Rect)(ref view)).y + ((Rect)(ref view)).height * 0.42f; num4 -= (1f - fade) * 30f * num; string text = WeaponName(); float num6 = num5 - num2 * 1.1f; ScreenSpace.Shadowed(new Rect(num4, num6, 300f * num, num2), text, actionStyle, new Color(Accent.r, Accent.g, Accent.b, fade)); float num7 = Mathf.Max(HudCanvas.Measure(text, actionStyle.fontSize), 70f * num); DrawBattery(new Rect(num4, num6 - 14f * num, num7, 12f * num), num); Line[] array2 = array; Rect r = default(Rect); Rect r2 = default(Rect); for (int i = 0; i < array2.Length; i++) { Line line = array2[i]; bool flag = line.Charge >= 0f; float num8 = Mathf.Max(num2, HudCanvas.Measure(line.Key, keyStyle.fontSize) + 12f * num); ScreenSpace.Box(new Rect(num4, num5, num8, num2), Faded(flag ? ChipLit : Chip)); ScreenSpace.Shadowed(new Rect(num4, num5, num8, num2), line.Key, keyStyle, Faded(flag ? Color.black : Text)); ((Rect)(ref r))..ctor(num4 + num8 + 8f * num, num5, 260f * num, num2); ScreenSpace.Shadowed(r, line.Action, actionStyle, Faded(flag ? Accent : Text)); if (flag) { float num9 = 90f * num; float num10 = Mathf.Max(2f, 3f * num); ((Rect)(ref r2))..ctor(((Rect)(ref r)).x, num5 + num2 - num10 * 0.5f, num9, num10); ScreenSpace.Box(r2, Faded(new Color(0f, 0f, 0f, 0.6f))); ScreenSpace.Box(new Rect(((Rect)(ref r2)).x, ((Rect)(ref r2)).y, num9 * line.Charge, num10), Faded((line.Charge >= 1f) ? Color.white : Accent)); } num5 += num2 + num3; } } private Color Faded(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_001f: Unknown result type (might be due to invalid IL or missing references) return new Color(c.r, c.g, c.b, c.a * fade); } private void DrawBattery(Rect r, float scale) { //IL_0052: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) PhysGrabObject held = Wielder.Held; ItemBattery val = (Object.op_Implicit((Object)(object)held) ? ((Component)held).GetComponent<ItemBattery>() : null); if (Object.op_Implicit((Object)(object)val) && val.batteryBars > 0) { int batteryBars = val.batteryBars; int num = Mathf.Clamp(val.currentBars, 0, batteryBars); Color c = ((num <= Mathf.Max(1, batteryBars / 4)) ? BatteryLow : BatteryColor); float num2 = Mathf.Max(1f, 1.5f * scale); Color c2 = Faded(c); ScreenSpace.Box(r, Faded(new Color(0f, 0f, 0f, 0.6f))); ScreenSpace.Box(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, num2), c2); ScreenSpace.Box(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - num2, ((Rect)(ref r)).width, num2), c2); ScreenSpace.Box(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, num2, ((Rect)(ref r)).height), c2); ScreenSpace.Box(new Rect(((Rect)(ref r)).xMax - num2, ((Rect)(ref r)).y, num2, ((Rect)(ref r)).height), c2); float num3 = num2 * 2f; float num4 = ((Rect)(ref r)).width - num3 * 2f; float num5 = Mathf.Max(1f, scale); float num6 = (num4 - num5 * (float)(batteryBars - 1)) / (float)batteryBars; for (int i = 0; i < num; i++) { ScreenSpace.Box(new Rect(((Rect)(ref r)).x + num3 + (float)i * (num6 + num5), ((Rect)(ref r)).y + num3, num6, ((Rect)(ref r)).height - num3 * 2f), c2); } } } private static string WeaponName() { PhysGrabObject held = Wielder.Held; if (!Object.op_Implicit((Object)(object)held)) { return "WEAPON"; } return Weapons.DisplayName(held).ToUpperInvariant(); } private static Line[] Lines() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) string key = ((object)WieldConfig.DropKey.Value/*cast due to .constrained prefix*/).ToString().ToUpperInvariant(); if (Wielder.HoldingMelee) { float swingCharge = Wielder.SwingCharge; return new Line[5] { new Line("LMB", "SWING"), new Line("HOLD LMB", (swingCharge >= 1f) ? "CHARGED - RELEASE!" : "CHARGE SWING", swingCharge), new Line("HOLD RMB", "THROW", Wielder.ThrowChargeLevel), new Line("1", "HOLSTER"), new Line(key, "DROP") }; } return new Line[4] { new Line(Wielder.AutomaticGun ? "HOLD LMB" : "LMB", "FIRE"), new Line("HOLD RMB", "THROW", Wielder.ThrowChargeLevel), new Line("1", "HOLSTER"), new Line(key, "DROP") }; } } internal sealed class DeathRecap : MonoBehaviour, IHudDrawer { private struct Hit { public float Time; public int Damage; public string Source; } private const float Window = 10f; private const float ShowFor = 9f; private const int MaxLines = 5; private static readonly List<Hit> hits = new List<Hit>(); private static string killer; private static List<Hit> recap; private static float diedAt = -100f; private bool wasDead; private static readonly Color Title = new Color(1f, 0.3f, 0.25f); internal static void OnLocalHurt(int damage, int enemyIndex) { hits.Add(new Hit { Time = Time.time, Damage = damage, Source = SourceName(enemyIndex) }); if (hits.Count > 30) { hits.RemoveAt(0); } } private static string SourceName(int enemyIndex) { Enemy val = ((enemyIndex >= 0) ? SemiFunc.EnemyGetFromIndex(enemyIndex) : null); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.EnemyParent)) { return val.EnemyParent.enemyName; } if (!Object.op_Implicit((Object)(object)val)) { return "something"; } return "an enemy"; } private void Update() { PlayerAvatar instance = PlayerAvatar.instance; bool flag = Object.op_Implicit((Object)(object)instance) && instance.deadSet; if (flag && !wasDead) { LevelStats.Died(); diedAt = Time.time; recap = hits.FindAll((Hit h) => Time.time - h.Time <= 10f); killer = ((recap.Count > 0) ? recap[recap.Count - 1].Source : "something"); if (recap.Count > 5) { recap.RemoveRange(0, recap.Count - 5); } hits.Clear(); } wasDead = flag; } public void DrawHud() { //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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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) if (!WieldConfig.DeathRecap.Value || recap == null) { return; } float num = Time.time - diedAt; if (num > 9f || ScreenSpace.HudHidden()) { return; } Rect view = ScreenSpace.GameView(); float num2 = ScreenSpace.Scale(view); float num3 = Mathf.Clamp01(num * 3f) * Mathf.Clamp01(9f - num); float num4 = 320f * num2; float num5 = 16f * num2; float num6 = ((Rect)(ref view)).center.x - num4 * 0.5f; float num7 = ((Rect)(ref view)).y + ((Rect)(ref view)).height * 0.18f; GUIStyle style = ScreenSpace.Label(num2, 16f); ScreenSpace.Shadowed(new Rect(num6, num7, num4, num5 * 1.5f), "KILLED BY " + killer.ToUpperInvariant(), style, new Color(Title.r, Title.g, Title.b, num3)); GUIStyle style2 = ScreenSpace.Small(num2); float num8 = num7 + num5 * 1.7f; int num9 = 0; foreach (Hit item in recap) { num9 += item.Damage; string text = (diedAt - item.Time).ToString("0.0") + "s before"; ScreenSpace.Shadowed(new Rect(num6, num8, num4, num5), "-" + item.Damage + " " + item.Source + " " + text, style2, new Color(1f, 0.85f, 0.8f, num3 * 0.9f)); num8 += num5; } if (recap.Count > 1) { ScreenSpace.Shadowed(new Rect(num6, num8 + 2f * num2, num4, num5), num9 + " damage in " + 10f + "s", style2, new Color(1f, 1f, 1f, num3 * 0.7f)); } } } internal sealed class GunAim : MonoBehaviour { private const float Range = 60f; private void LateUpdate() { //IL_0086: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_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) Weapons.Info weapon = Wielder.Weapon; if (weapon == null || weapon.Kind != Weapons.Kind.ScriptGun || !Object.op_Implicit((Object)(object)weapon.Muzzle) || !SemiFunc.IsMasterClientOrSingleplayer()) { return; } PhysGrabber instance = PhysGrabber.instance; PhysGrabObject held = Wielder.Held; if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)held) && held.playerGrabbing.Contains(instance) && Object.op_Implicit((Object)(object)instance.playerAvatar) && Object.op_Implicit((Object)(object)instance.playerAvatar.localCamera)) { Transform overrideTransform = instance.playerAvatar.localCamera.GetOverrideTransform(); Vector3 val = AimPoint(overrideTransform, held); Transform muzzle = weapon.Muzzle; Vector3 val2 = val - muzzle.position; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = overrideTransform.forward; } Quaternion val3 = Quaternion.Inverse(((Component)held).transform.rotation) * muzzle.rotation; Quaternion val4 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, overrideTransform.up) * Quaternion.Inverse(val3); Quaternion val5 = Quaternion.Inverse(instance.GamepadMeleeRotationGet() * instance.physRotation) * Quaternion.Inverse(overrideTransform.rotation) * val4; instance.cameraRelativeGrabbedForward = val5 * Vector3.forward; instance.cameraRelativeGrabbedUp = val5 * Vector3.up; } } private static Vector3 AimPoint(Transform cam, PhysGrabObject body) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00a9: 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) int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) | LayerMask.GetMask(new string[1] { "Enemy" }); foreach (RaycastHit item in from h in Physics.RaycastAll(cam.position, cam.forward, 60f, num, (QueryTriggerInteraction)1) orderby ((RaycastHit)(ref h)).distance select h) { RaycastHit current = item; if (!((RaycastHit)(ref current)).transform.IsChildOf(((Component)body).transform) && (!Object.op_Implicit((Object)(object)PlayerAvatar.instance) || !((RaycastHit)(ref current)).transform.IsChildOf(((Component)PlayerAvatar.instance).transform))) { return ((RaycastHit)(ref current)).point; } } return cam.position + cam.forward * 60f; } } internal static class HudCanvas { private const float FontScale = 1.3f; private static RectTransform root; private static RectTransform imageLayer; private static RectTransform textLayer; private static TMP_FontAsset font; private static Material fontMaterial; private static TextMeshProUGUI measurer; private static readonly List<TextMeshProUGUI> texts = new List<TextMeshProUGUI>(); private static readonly List<Image> images = new List<Image>(); private static readonly Dictionary<Texture2D, Sprite> sprites = new Dictionary<Texture2D, Sprite>(); private static int textsUsed; private static int imagesUsed; private static Rect view; private static Vector2 canvasSize; internal static Rect View => view; internal static bool Begin() { //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) //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_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) textsUsed = (imagesUsed = 0); if (!EnsureRoot()) { return false; } view = ScreenSpace.GameView(); Rect rect = root.rect; canvasSize = ((Rect)(ref rect)).size; if (canvasSize.x > 1f && canvasSize.y > 1f) { return ((Rect)(ref view)).width > 1f; } return false; } internal static void End() { for (int i = textsUsed; i < texts.Count; i++) { if (Object.op_Implicit((Object)(object)texts[i]) && ((Component)texts[i]).gameObject.activeSelf) { ((Component)texts[i]).gameObject.SetActive(false); } } for (int j = imagesUsed; j < images.Count; j++) { if (Object.op_Implicit((Object)(object)images[j]) && ((Component)images[j]).gameObject.activeSelf) { ((Component)images[j]).gameObject.SetActive(false); } } } private static bool EnsureRoot() { //IL_008f: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)root)) { return true; } texts.Clear(); images.Clear(); TextMeshProUGUI val = (Object.op_Implicit((Object)(object)ItemInfoUI.instance) ? ((Component)ItemInfoUI.instance).GetComponent<TextMeshProUGUI>() : null); Canvas val2 = (Object.op_Implicit((Object)(object)val) ? ((Graphic)val).canvas : null); if (!Object.op_Implicit((Object)(object)val2)) { return false; } val2 = val2.rootCanvas; font = ((TMP_Text)val).font; fontMaterial = ((TMP_Text)val).fontSharedMaterial; root = NewRect("WeaponWield HUD", ((Component)val2).transform); root.anchorMin = Vector2.zero; root.anchorMax = Vector2.one; RectTransform obj = root; Vector2 offsetMin = (root.offsetMax = Vector2.zero); obj.offsetMin = offsetMin; ((Transform)root).SetAsLastSibling(); imageLayer = Stretch(NewRect("Shapes", (Transform)(object)root)); textLayer = Stretch(NewRect("Text", (Transform)(object)root)); measurer = NewText(); ((Component)measurer).gameObject.SetActive(false); return true; } private static RectTransform NewRect(string name, Transform parent) { //IL_0014: 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_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_003d: Expected O, but got Unknown RectTransform val = (RectTransform)new GameObject(name, new Type[1] { typeof(RectTransform) }) { layer = ((Component)parent).gameObject.layer }.transform; ((Transform)val).SetParent(parent, false); return val; } private static RectTransform Stretch(RectTransform rt) { //IL_0001: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; Vector2 offsetMin = (rt.offsetMax = Vector2.zero); rt.offsetMin = offsetMin; return rt; } private static TextMeshProUGUI NewText() { TextMeshProUGUI val = ((Component)NewRect("Label", (Transform)(object)textLayer)).gameObject.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val).font = font; if (Object.op_Implicit((Object)(object)fontMaterial)) { ((TMP_Text)val).fontSharedMaterial = fontMaterial; } ((Graphic)val).raycastTarget = false; ((TMP_Text)val).richText = true; ((TMP_Text)val).enableWordWrapping = false; ((TMP_Text)val).overflowMode = (TextOverflowModes)0; ((TMP_Text)val).enableVertexGradient = false; return val; } private static Image NewImage() { Image obj = ((Component)NewRect("Shape", (Transform)(object)imageLayer)).gameObject.AddComponent<Image>(); ((Graphic)obj).raycastTarget = false; return obj; } private static void Place(RectTransform rt, Rect r, float rotation) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) float num = (((Rect)(ref r)).center.x - ((Rect)(ref view)).x) / ((Rect)(ref view)).width; float num2 = (((Rect)(ref r)).center.y - ((Rect)(ref view)).y) / ((Rect)(ref view)).height; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); rt.anchorMax = val; rt.anchorMin = val; rt.pivot = new Vector2(0.5f, 0.5f); rt.anchoredPosition = new Vector2(num * canvasSize.x, (0f - num2) * canvasSize.y); rt.sizeDelta = new Vector2(((Rect)(ref r)).width / ((Rect)(ref view)).width * canvasSize.x, ((Rect)(ref r)).height / ((Rect)(ref view)).height * canvasSize.y); ((Transform)rt).localEulerAngles = new Vector3(0f, 0f, 0f - rotation); } private static float ToCanvasFont(float guiPixels) { return guiPixels / ((Rect)(ref view)).height * canvasSize.y * 1.3f; } internal static void Text(Rect r, string text, float guiFontPixels, Color color, TextAnchor anchor, bool bold = true) { //IL_0014: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)root) && !string.IsNullOrEmpty(text) && !(color.a <= 0.003f)) { if (textsUsed == texts.Count) { texts.Add(NewText()); } TextMeshProUGUI val = texts[textsUsed++]; if (!((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } Place(((TMP_Text)val).rectTransform, r, 0f); if (((TMP_Text)val).text != text) { ((TMP_Text)val).text = text; } ((TMP_Text)val).fontSize = ToCanvasFont(guiFontPixels); ((TMP_Text)val).fontStyle = (FontStyles)(bold ? 1 : 0); ((Graphic)val).color = color; ((TMP_Text)val).alignment = Alignment(anchor); } } internal static void Rect(Rect r, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Image(r, ScreenSpace.White, color); } internal static void Image(Rect r, Texture2D texture, Color color, float rotation = 0f) { //IL_0014: 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_009d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)root) && Object.op_Implicit((Object)(object)texture) && !(color.a <= 0.003f)) { if (imagesUsed == images.Count) { images.Add(NewImage()); } Image val = images[imagesUsed++]; if (!((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } Place(((Graphic)val).rectTransform, r, rotation); Sprite val2 = SpriteOf(texture); if ((Object)(object)val.sprite != (Object)(object)val2) { val.sprite = val2; } ((Graphic)val).color = color; } } internal static float Measure(string text, float guiFontPixels, bool bold = true) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root) || !Object.op_Implicit((Object)(object)measurer) || ((Rect)(ref view)).height <= 0f) { return (float)text.Length * guiFontPixels * 0.5f; } ((TMP_Text)measurer).fontSize = ToCanvasFont(guiFontPixels); ((TMP_Text)measurer).fontStyle = (FontStyles)(bold ? 1 : 0); return ((TMP_Text)measurer).GetPreferredValues(text).x / canvasSize.x * ((Rect)(ref view)).width; } private static Sprite SpriteOf(Texture2D texture) { //IL_0032: 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) if (sprites.TryGetValue(texture, out var value) && Object.op_Implicit((Object)(object)value)) { return value; } value = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f), 100f); ((Object)value).hideFlags = (HideFlags)61; sprites[texture] = value; return value; } private static TextAlignmentOptions Alignment(TextAnchor anchor) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected I4, but got Unknown switch ((int)anchor) { case 0: case 3: case 6: return (TextAlignmentOptions)4097; case 2: case 5: case 8: return (TextAlignmentOptions)4100; default: return (TextAlignmentOptions)4098; } } } internal interface IHudDrawer { void DrawHud(); } internal sealed class HudDriver : MonoBehaviour { private IHudDrawer[] drawers; private readonly HashSet<Type> reported = new HashSet<Type>(); private void LateUpdate() { if (drawers == null) { drawers = ((Component)this).GetComponents<IHudDrawer>(); } if (!HudCanvas.Begin()) { HudCanvas.End(); return; } IHudDrawer[] array = drawers; foreach (IHudDrawer hudDrawer in array) { try { hudDrawer.DrawHud(); } catch (Exception ex) { if (reported.Add(hudDrawer.GetType())) { Plugin.Log.LogError((object)(hudDrawer.GetType().Name + " HUD failed: " + ex)); } } } HudCanvas.End(); } } internal sealed class LevelStats : MonoBehaviour, IHudDrawer { private static int kills; private static int yourKills; private static int damageDealt; private static int yourHits; private static int damageTaken; private static int deaths; private static float valueLost; private static float levelStart; private static bool inLevel; private static readonly Color Title = new Color(1f, 0.82f, 0.25f); private static readonly Color Text = new Color(0.92f, 0.92f, 0.92f); private static readonly Color Bad = new Color(1f, 0.45f, 0.35f); internal static void EnemyDamaged(int damage, bool mine) { damageDealt += damage; if (mine) { yourHits++; } } internal static void EnemyKilled(bool mine) { kills++; if (mine) { yourKills++; } } internal static void ValueLost(float amount) { valueLost += amount; } internal static void DamageTaken(int damage) { damageTaken += damage; } internal static void Died() { deaths++; } private void Update() { int num; if (Object.op_Implicit((Object)(object)LevelGenerator.Instance) && LevelGenerator.Instance.Generated) { num = (SemiFunc.RunIsLevel() ? 1 : 0); if (num != 0 && !inLevel) { kills = (yourKills = (damageDealt = (yourHits = (damageTaken = (deaths = 0))))); valueLost = 0f; levelStart = Time.time; } } else { num = 0; } inLevel = (byte)num != 0; } public void DrawHud() { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01da: 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_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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) if (WieldConfig.LevelStats.Value && inLevel && Object.op_Implicit((Object)(object)Map.Instance) && Map.Instance.Active && !ScreenSpace.HudHidden()) { Rect view = ScreenSpace.GameView(); float num = ScreenSpace.Scale(view); float num2 = 210f * num; float num3 = 17f * num; float num4 = ((Rect)(ref view)).x + 30f * num; float num5 = ((Rect)(ref view)).y + ((Rect)(ref view)).height * 0.3f; string[] array = new string[7] { "Time in level", "Enemies killed", "Damage to enemies", "Your hits", "Damage taken", "Deaths", "Lost to breakage" }; string[] array2 = new string[7] { Clock(Time.time - levelStart), kills + ((yourKills > 0) ? (" (" + yourKills + " yours)") : ""), damageDealt.ToString(), yourHits.ToString(), damageTaken.ToString(), deaths.ToString(), "$" + SemiFunc.DollarGetString(Mathf.RoundToInt(valueLost)) }; ScreenSpace.Box(new Rect(num4 - 10f * num, num5 - num3 * 1.6f, num2 + 20f * num, num3 * ((float)array.Length + 1.9f)), new Color(0f, 0f, 0f, 0.55f)); GUIStyle val = ScreenSpace.Label(num, 13f); val.alignment = (TextAnchor)3; ScreenSpace.Shadowed(new Rect(num4, num5 - num3 * 1.3f, num2, num3), "THIS LEVEL", val, Title); GUIStyle val2 = ScreenSpace.Small(num); for (int i = 0; i < array.Length; i++) { Rect r = new Rect(num4, num5 + (float)i * num3, num2, num3); val2.alignment = (TextAnchor)3; ScreenSpace.Shadowed(r, array[i], val2, Text); val2.alignment = (TextAnchor)5; ScreenSpace.Shadowed(color: ((i == 4 && damageTaken > 0) || (i == 5 && deaths > 0) || (i == 6 && valueLost >= 1f)) ? Bad : Text, r: r, text: array2[i], style: val2); } val2.alignment = (TextAnchor)4; val.alignment = (TextAnchor)4; } } private static string Clock(float seconds) { int num = Mathf.Max(0, Mathf.FloorToInt(seconds)); return num / 60 + ":" + (num % 60).ToString("00"); } } internal sealed class LootInfo : MonoBehaviour, IHudDrawer { private const float ScanInterval = 0.1f; private const float LossRange = 25f; private static readonly Color LossColor = new Color(1f, 0.3f, 0.25f); private static readonly Color CounterColor = new Color(1f, 0.85f, 0.35f); private readonly Dictionary<ValuableObject, float> lastValue = new Dictionary<ValuableObject, float>(); private readonly List<ValuableObject> gone = new List<ValuableObject>(); private float scanTimer; private int count; private float total; private void Update() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)LevelGenerator.Instance) || !LevelGenerator.Instance.Generated || !Object.op_Implicit((Object)(object)ValuableDirector.instance) || !SemiFunc.RunIsLevel()) { lastValue.Clear(); count = 0; return; } scanTimer -= Time.deltaTime; if (scanTimer > 0f) { return; } scanTimer = 0.1f; Camera val = ScreenSpace.GameCamera(); Vector3 val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).transform.position : Vector3.zero); count = 0; total = 0f; foreach (ValuableObject valuable in ValuableDirector.instance.valuableList) { if (!Object.op_Implicit((Object)(object)valuable) || !((Behaviour)valuable).isActiveAndEnabled) { continue; } count++; total += valuable.dollarValueCurrent; if (lastValue.TryGetValue(valuable, out var value)) { float num = value - valuable.dollarValueCurrent; if (num >= 1f) { LevelStats.ValueLost(num); } if (num >= 1f && WieldConfig.ValueLossPopups.Value && Vector3.Distance(val2, ((Component)valuable).transform.position) < 25f) { Combat.AddPopup(((Component)valuable).transform.position + Vector3.up * 0.4f, "-$" + SemiFunc.DollarGetString(Mathf.RoundToInt(num)), LossColor, 1.1f, (num >= 1000f) ? 1.3f : 1f); } } lastValue[valuable] = valuable.dollarValueCurrent; } gone.Clear(); foreach (ValuableObject key in lastValue.Keys) { if (!Object.op_Implicit((Object)(object)key)) { gone.Add(key); } } foreach (ValuableObject item in gone) { lastValue.Remove(item); } } public void DrawHud() { //IL_001d: 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_0023: 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_00a1: Unknown result type (might be due to invalid IL or missing references) if (WieldConfig.LootCounter.Value && count != 0 && !ScreenSpace.WorldHudHidden()) { Rect view = ScreenSpace.GameView(); float num = ScreenSpace.Scale(view); GUIStyle val = ScreenSpace.Label(num, 12f); val.alignment = (TextAnchor)5; string text = "LOOT LEFT " + count + " · $" + SemiFunc.DollarGetString(Mathf.RoundToInt(total)); ScreenSpace.Shadowed(new Rect(((Rect)(ref view)).xMax - 320f * num, ((Rect)(ref view)).y + ((Rect)(ref view)).height * 0.245f, 300f * num, 20f * num), text, val, CounterColor); val.alignment = (TextAnchor)4; } } } [HarmonyPatch(typeof(PhysGrabber), "Update")] internal static class PhysGrabberUpdatePatch { private static void Postfix(PhysGrabber __instance) { if (__instance.isLocal && !((Object)(object)__instance != (Object)(object)PhysGrabber.instance)) { Wielder.Tick(__instance); } } } [HarmonyPatch(typeof(ItemToggle), "Update")] internal static class ItemToggleUpdatePatch { private static void Prefix(ItemToggle __instance, out bool __state) { __state = __instance.disabled; PhysGrabObject physGrabObject = __instance.physGrabObject; if ((Wielder.Equipped && (Object)(object)Wielder.Held == (Object)(object)physGrabObject) || (Object.op_Implicit((Object)(object)physGrabObject) && (Object)(object)Wielder.LastReleased == (Object)(object)physGrabObject && Time.time - Wielder.LastReleaseTime < 0.25f)) { __instance.disabled = true; } } private static void Postfix(ItemToggle __instance, bool __state) { __instance.disabled = __state; } } [HarmonyPatch(typeof(ItemAttributes), "ShowingInfo")] internal static class ItemAttributesShowingInfoPatch { private static void Postfix(ItemAttributes __instance) { if (Wielder.Equipped && (Object)(object)Wielder.Held == (Object)(object)__instance.physGrabObject) { __instance.promptName = WeaponSlot.HeldPrompt(__instance.cachedItemName); } } } [HarmonyPatch(typeof(ItemBattery), "Update")] internal static class ItemBatteryUpdatePatch { private static void Prefix(ItemBattery __instance, out bool __state) { __state = __instance.suppressBatteryUI; if (WieldConfig.ControlsHint.Value && Wielder.Equipped && (Object)(object)Wielder.Held == (Object)(object)__instance.physGrabObject) { __instance.suppressBatteryUI = true; } } private static void Postfix(ItemBattery __instance, bool __state) { __instance.suppressBatteryUI = __state; } } [HarmonyPatch(typeof(EnemyHealth), "HurtRPC")] internal static class EnemyHurtPatch { private static void Postfix(EnemyHealth __instance, int _damage) { Combat.OnHurt(__instance, _damage); } } [HarmonyPatch(typeof(EnemyHealth), "DeathRPC")] internal static class EnemyDeathPatch { private static void Postfix(EnemyHealth __instance) { Combat.OnDeath(__instance); } } [HarmonyPatch(typeof(PlayerHealth), "Hurt")] internal static class PlayerHurtPatch { private static void Prefix(PlayerHealth __instance, out int __state) { __state = __instance.health; } private static void Postfix(PlayerHealth __instance, int __state, int enemyIndex) { if (__instance.health < __state && Object.op_Implicit((Object)(object)__instance.playerAvatar) && __instance.playerAvatar.isLocal) { int damage = __state - __instance.health; Vitals.OnLocalHurt(enemyIndex); DeathRecap.OnLocalHurt(damage, enemyIndex); LevelStats.DamageTaken(damage); } } } [HarmonyPatch(typeof(Inventory), "Awake")] internal static class InventoryAwakePatch { private static void Postfix(Inventory __instance) { if ((Object)(object)Inventory.instance == (Object)(object)__instance && __instance.inventorySpots.Count == 3) { __instance.inventorySpots.Add(null); } } } [HarmonyPatch(typeof(InventorySpot), "StateEmpty")] internal static class InventorySpotStateEmptyPatch { private static bool Prefix(InventorySpot __instance) { return WeaponSlot.DrawnSlotState(__instance); } } [HarmonyPatch(typeof(Inventory), "InventorySpotsOccupied")] internal static class InventorySpotsOccupiedPatch { private static void Postfix(ref int __result) { InventorySpot spot = WeaponSlot.Spot; if (Wielder.Equipped && Object.op_Implicit((Object)(object)spot) && !spot.IsOccupied()) { __result++; } } } [HarmonyPatch(typeof(InventoryUI), "Awake")] internal static class InventoryUIAwakePatch { private static void Postfix(InventoryUI __instance) { try { WeaponSlot.BuildUI(__instance); } catch (Exception ex) { Plugin.Log.LogError((object)("Couldn't add the weapon slot: " + ex)); } } } [HarmonyPatch(typeof(InputManager), "KeyDown")] internal static class InputKeyDownPatch { private static bool Prefix(InputManager __instance, InputKey key, bool allowWhenDisabled, ref bool __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return InventoryKeys.Remap(__instance, key, allowWhenDisabled, (KeyControl k) => ((ButtonControl)k).wasPressedThisFrame, ref __result); } } [HarmonyPatch(typeof(InputManager), "KeyUp")] internal static class InputKeyUpPatch { private static bool Prefix(InputManager __instance, InputKey key, bool allowWhenDisabled, ref bool __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return InventoryKeys.Remap(__instance, key, allowWhenDisabled, (KeyControl k) => ((ButtonControl)k).wasReleasedThisFrame, ref __result); } } [HarmonyPatch(typeof(InputManager), "KeyHold")] internal static class InputKeyHoldPatch { private static bool Prefix(InputManager __instance, InputKey key, bool allowWhenDisabled, ref bool __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return InventoryKeys.Remap(__instance, key, allowWhenDisabled, (KeyControl k) => ((ButtonControl)k).isPressed, ref __result); } } internal static class InventoryKeys { internal static bool Remap(InputManager input, InputKey key, bool allowWhenDisabled, Func<KeyControl, bool> state, ref bool result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if ((int)key == 14) { if (!Wielder.Equipped && Time.time - Wielder.LastReleaseTime > 0.3f) { return true; } Key value = WieldConfig.DropKey.Value; if ((int)value == 0 || Keyboard.current == null) { return true; } KeyControl val = Keyboard.current[value]; if (!((ButtonControl)val).isPressed && !((ButtonControl)val).wasReleasedThisFrame) { return true; } result = false; return false; } Key? val2 = WeaponSlot.RemappedKey(key); if (!val2.HasValue || (int)input.CurrentMode != 0 || Keyboard.current == null) { return true; } result = false; if (input.gamepadTextInputBlockTimer > 0f) { return false; } if (!allowWhenDisabled) { if (input.disableMovementTimer > 0f) { return false; } if (input.disableControlsExceptTimer > 0f && !input.disableControlsExceptList.Contains(key)) { return false; } if (input.disableControlsIncludeTimer > 0f && input.disableControlsIncludeList.Contains(key)) { return false; } } result = state(Keyboard.current[val2.Value]); return false; } } [HarmonyPatch(typeof(StatsManager), "PlayerInventoryUpdate")] internal static class PlayerInventoryUpdatePatch { private static void Postfix(string _steamID, string itemName, int spot) { if (spot == 3 && SemiFunc.IsMasterClientOrSingleplayer()) { WeaponSlot.StoreUpdate(_steamID, itemName); } } } [HarmonyPatch(typeof(PunManager), "SetItemNameLOGIC")] internal static class SetItemNamePatch { private static void Postfix(string _name, int photonViewID, ItemAttributes _itemAttributes) { ItemAttributes attrs = _itemAttributes; if (SemiFunc.IsMultiplayer()) { PhotonView val = PhotonView.Find(photonViewID); attrs = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<ItemAttributes>() : null); } WeaponSlot.Restore(_name, attrs); } } [HarmonyPatch(typeof(StatsManager), "StuffNeedingResetAtTheEndOfAScene")] internal static class SceneResetPatch { private static void Postfix() { WeaponSlot.NewLevel(); } } [HarmonyPatch(typeof(PunManager), "TruckPopulateItemVolumes", new Type[] { typeof(List<ItemSpawn>) })] internal static class TruckPopulatePatch { private static void Postfix() { WeaponSlot.NewLevel(); } } internal sealed class Pings : MonoBehaviour, IHudDrawer { internal enum Kind : byte { Location, Enemy, Valuable, Item } private sealed class Ping { public int Sender; public string SenderName; public Color SenderColor; public Kind Kind; public Vector3 Point; public int TargetId = -1; public Enemy Enemy; public ValuableObject Valuable; public ItemAttributes Item; public PhysGrabObject Body; public Collider[] Colliders; public float Born; public float Life; public Vector3 World; public string Label; public Color Color; public GameObject Anchor; public bool MapSized; } private const float Range = 80f; private const float EnemyAimRadius = 0.6f; private const float Cooldown = 0.35f; private const float EdgeMargin = 40f; private static readonly Color EnemyColor = new Color(1f, 0.25f, 0.2f); private static readonly Color ValuableColor = new Color(1f, 0.8f, 0.2f); private static readonly Color ItemColor = new Color(0.35f, 0.85f, 1f); private static readonly Color LocationColor = new Color(0.9f, 0.95f, 1f); private static NetworkedEvent pingEvent; private static readonly Dictionary<int, Ping> active = new Dictionary<int, Ping>(); private float lastPing = -10f; private Texture2D ring; private Texture2D dot; private Texture2D arrow; private static Texture2D mapDot; private GUIStyle labelStyle; private GUIStyle nameStyle; private static Sprite mapSprite; private static Component localTarget; internal static void Init() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown pingEvent = new NetworkedEvent("WeaponWield Ping", (Action<EventData>)OnPingEvent); } private void Update() { if (!WieldConfig.Pings.Value || !Object.op_Implicit((Object)(object)LevelGenerator.Instance) || !LevelGenerator.Instance.Generated) { ClearAll(); return; } UpdatePings(); HandleInput(); } private static void ClearAll() { foreach (Ping value in active.Values) { Remove(value); } active.Clear(); } private static void Remove(Ping p) { if (Object.op_Implicit((Object)(object)p.Anchor)) { Object.Destroy((Object)(object)p.Anchor); } } private void UpdatePings() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) foreach (int item in active.Keys.ToList()) { Ping ping = active[item]; if (Time.time - ping.Born > ping.Life || !Resolve(ping)) { Remove(ping); active.Remove(item); continue; } if (!Object.op_Implicit((Object)(object)ping.Anchor)) { AddToMap(ping); } if (Object.op_Implicit((Object)(object)ping.Anchor)) { ping.Anchor.transform.position = ping.World; if (!ping.MapSized) { SizeMapMarker(ping); } } } } private void AddToMap(Ping p) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Map.Instance)) { return; } EnsureTextures(); if (!Object.op_Implicit((Object)(object)mapSprite)) { mapSprite = Sprite.Create(mapDot, new Rect(0f, 0f, (float)((Texture)mapDot).width, (float)((Texture)mapDot).height), new Vector2(0.5f, 0.5f), 100f); ((Object)mapSprite).hideFlags = (HideFlags)61; } GameObject val = new GameObject("Ping Marker"); val.transform.position = p.World; MapCustom val2 = val.AddComponent<MapCustom>(); val2.autoAdd = false; val2.fadeAlpha = 0.5f; val2.sprite = mapSprite; val2.color = p.Color; p.Anchor = val; try { val2.Add(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Couldn't put a ping on the map: " + ex.Message)); } } private static void SizeMapMarker(Ping p) { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Map.Instance) || !Map.Instance.Active) { return; } MapCustom component = p.Anchor.GetComponent<MapCustom>(); SpriteRenderer val = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.mapCustomEntity)) ? component.mapCustomEntity.spriteRenderer : null); if (!Object.op_Implicit((Object)(object)val)) { p.MapSized = true; return; } float num = 0.2f; Transform playerGraphicTransform = Map.Instance.PlayerGraphicTransform; Renderer val2 = (Object.op_Implicit((Object)(object)playerGraphicTransform) ? ((Component)playerGraphicTransform).GetComponentInChildren<Renderer>() : null); Bounds bounds; if (Object.op_Implicit((Object)(object)val2)) { bounds = val2.bounds; if (((Bounds)(ref bounds)).size.x > 0f) { bounds = val2.bounds; float x = ((Bounds)(ref bounds)).size.x; bounds = val2.bounds; num = Mathf.Max(x, ((Bounds)(ref bounds)).size.z) * 1.4f; } } bounds = ((Renderer)val).bounds; float x2 = ((Bounds)(ref bounds)).size.x; bounds = ((Renderer)val).bounds; float num2 = Mathf.Max(x2, ((Bounds)(ref bounds)).size.z); if (!(num2 <= 0f)) { Transform transform = ((Component)val).transform; transform.localScale *= num / num2; p.MapSized = true; } } private void HandleInput() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar instance = PlayerAvatar.instance; if (Object.op_Implicit((Object)(object)instance) && !instance.deadSet && !instance.isDisabled && PingPressed() && SemiFunc.NoTextInputsActive() && (!Object.op_Implicit((Object)(object)MenuManager.instance) || !Object.op_Implicit((Object)(object)MenuManager.instance.currentMenuPage)) && !(Time.time - lastPing < 0.35f)) { lastPing = Time.time; Camera val = (Object.op_Implicit((Object)(object)GameDirector.instance) ? GameDirector.instance.MainCamera : Camera.main); if (Object.op_Implicit((Object)(object)val) && Aim(instance, ((Component)val).transform, out var kind, out var point, out var targetId, out var target)) { Send(instance, kind, point, targetId, target); } } } private static bool PingPressed() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (WieldConfig.PingWithMiddleMouse.Value && Mouse.current != null && Mouse.current.middleButton.wasPressedThisFrame) { return true; } return WeaponSlot.KeyPressed(WieldConfig.PingKey.Value); } private static bool Aim(PlayerAvatar me, Transform cam, out Kind kind, out Vector3 point, out int targetId, out Component target) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) kind = Kind.Location; point = Vector3.zero; targetId = -1; target = null; int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()); int mask = LayerMask.GetMask(new string[2] { "Enemy", "PhysGrabObject" }); Vector3 position = cam.position; RaycastHit[] source = Physics.RaycastAll(position, cam.forward, 80f, num | mask, (QueryTriggerInteraction)1); RaycastHit? val = null; foreach (RaycastHit item in source.OrderBy((RaycastHit h) => ((RaycastHit)(ref h)).distance)) { RaycastHit current = item; if (!Ignore(me, ((RaycastHit)(ref current)).collider)) { val = current; break; } } float num2; if (!val.HasValue) { num2 = 80f; } else { RaycastHit valueOrDefault = val.GetValueOrDefault(); num2 = ((RaycastHit)(ref valueOrDefault)).distance; } float num3 = num2; foreach (RaycastHit item2 in from h in Physics.SphereCastAll(position, 0.6f, cam.forward, num3, mask, (QueryTriggerInteraction)1) orderby ((RaycastHit)(ref h)).distance select h) { RaycastHit current2 = item2; if (!Ignore(me, ((RaycastHit)(ref current2)).collider)) { Enemy val2 = EnemyOf(((RaycastHit)(ref current2)).collider); if (Object.op_Implicit((Object)(object)val2)) { kind = Kind.Enemy; point = (Object.op_Implicit((Object)(object)val2.CenterTransform) ? val2.CenterTransform.position : ((RaycastHit)(ref current2)).point); targetId = (Object.op_Implicit((Object)(object)val2.PhotonView) ? val2.PhotonView.ViewID : (-1)); target = (Component)(object)val2; return true; } } } if (!val.HasValue) { return false; } RaycastHit value = val.Value; point = ((RaycastHit)(ref value)).point + ((RaycastHit)(ref value)).normal * 0.1f; Enemy val3 = EnemyOf(((RaycastHit)(ref value)).collider); if (Object.op_Implicit((Object)(object)val3)) { kind = Kind.Enemy; targetId = (Object.op_Implicit((Object)(object)val3.PhotonView) ? val3.PhotonView.ViewID : (-1)); target = (Component)(object)val3; return true; } ValuableObject componentInParent = ((Component)((RaycastHit)(ref value)).collider).GetComponentInParent<ValuableObject>(); if (Object.op_Implicit((Object)(object)componentInParent)) { kind = Kind.Valuable; targetId = ViewId((Component)(object)componentInParent); target = (Component)(object)componentInParent; return true; } ItemAttributes componentInParent2 = ((Component)((RaycastHit)(ref value)).collider).GetComponentInParent<ItemAttributes>(); if (Object.op_Implicit((Object)(object)componentInParent2)) { kind = Kind.Item; targetId = ViewId((Component)(object)componentInParent2); target = (Component)(object)componentInParent2; } return true; } private static bool Ignore(PlayerAvatar me, Collider c) { if (((Component)c).transform.IsChildOf(((Component)me).transform)) { return true; } if (Wielder.Equipped && ((Component)c).transform.IsChildOf(((Component)Wielder.Held).transform)) { return true; } return false; } private static Enemy EnemyOf(Collider c) { EnemyRigidbody componentInParent = ((Component)c).GetComponentInParent<EnemyRigidbody>(); if (Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)componentInParent.enemy)) { return componentInParent.enemy; } EnemyParent componentInParent2 = ((Component)c).GetComponentInParent<EnemyParent>(); if (!Object.op_Implicit((Object)(object)componentInParent2)) { return null; } return componentInParent2.Enemy; } private static int ViewId(Component c) { PhotonView component = c.GetComponent<PhotonView>(); if (!Object.op_Implicit((Object)(object)component)) { return -1; } return component.ViewID; } private static void Send(PlayerAvatar me, Kind kind, Vector3 point, int targetId, Component target) { //IL_0040: 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) if (pingEvent != null && Object.op_Implicit((Object)(object)me.photonView)) { localTarget = target; object[] array = new object[4] { me.photonView.ViewID, (byte)kind, point, targetId }; pingEvent.RaiseEvent((object)array, NetworkingEvents.RaiseAll, SendOptions.SendReliable); localTarget = null; } } private static void OnPingEvent(EventData e) { //IL_0038: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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) if (!WieldConfig.Pings.Value || !(e.CustomData is object[] array) || array.Length < 4) { return; } int num = (int)array[0]; Kind kind = (Kind)(byte)array[1]; Vector3 val = (Vector3)array[2]; int num2 = (int)array[3]; PlayerAvatar val2 = (SemiFunc.IsMultiplayer() ? SemiFunc.PlayerAvatarGetFromPhotonID(num) : PlayerAvatar.instance); if (!Object.op_Implicit((Object)(object)val2)) { return; } if (active.TryGetValue(num, out var value)) { Remove(value); active.Remove(num); if (value.Kind == kind && ((num2 != -1) ? (value.TargetId == num2) : (Vector3.Distance(value.Point, val) < 1f))) { Blip(0.6f); return; } } Ping ping = new Ping { Sender = num, SenderName = (string.IsNullOrEmpty(val2.playerName) ? "Player" : val2.playerName), SenderColor = SafeColor(val2), Kind = kind, Point = val, TargetId = num2, Born = Time.time, Life = ((kind == Kind.Location) ? 10f : 15f) }; Component val3 = null; if (!SemiFunc.IsMultiplayer()) { val3 = localTarget; } else if (num2 != -1) { val3 = (Component)(object)PhotonView.Find(num2); } if (Object.op_Implicit((Object)(object)val3)) { if (kind == Kind.Enemy) { ping.Enemy = (Enemy)(((object)((val3 is Enemy) ? val3 : null)) ?? ((object)(val3.GetComponent<Enemy>() ?? val3.GetComponentInChildren<Enemy>()))); EnemyParent val4 = (Object.op_Implicit((Object)(object)ping.Enemy) ? ((Component)ping.Enemy).GetComponentInParent<EnemyParent>() : null); EnemyRigidbody val5 = (Object.op_Implicit((Object)(object)val4) ? ((Component)val4).GetComponentInChildren<EnemyRigidbody>() : null); if (Object.op_Implicit((Object)(object)val5)) { ping.Colliders = SolidColliders(((Component)val5).transform); } } else { ping.Valuable = val3.GetComponent<ValuableObject>(); ping.Item = val3.GetComponent<ItemAttributes>(); ping.Body = val3.GetComponent<PhysGrabObject>(); ping.Colliders = SolidColliders(val3.transform); } } if (kind == Kind.Enemy && !Object.op_Implicit((Object)(object)ping.Enemy)) { ping.Kind = Kind.Location; } if (kind == Kind.Valuable && !Object.op_Implicit((Object)(object)ping.Valuable)) { ping.Kind = Kind.Location; } if (kind == Kind.Item && !Object.op_Implicit((Object)(object)ping.Item)) { ping.Kind = Kind.Location; } if (Resolve(ping)) { active[num] = ping; Blip((ping.Kind == Kind.Enemy) ? 0.75f : 1.25f); } } private static Collider[] SolidColliders(Transform root) { return (from c in ((Component)root).GetComponentsInChildren<Collider>() where !c.isTrigger select c).ToArray(); } private static Color SafeColor(PlayerAvatar who) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0012: Unknown result type (might be due to invalid IL or missing references) try { return SemiFunc.PlayerGetColorMain(who); } catch { return Color.white; } } private static void Blip(float pitch) { if (!Object.op_Implicit((Object)(object)MenuManager.instance)) { return; } try { MenuManager.instance.MenuEffectHover(pitch, 0.6f); } catch { } } public void DrawHud() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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) if (!WieldConfig.Pings.Value || active.Count == 0 || (Object.op_Implicit((Object)(object)MenuManager.instance) && Object.op_Implicit((Object)(object)MenuManager.instance.currentMenuPage)) || (Object.op_Implicit((Object)(object)Map.Instance) && Map.Instance.Active)) { return; } Camera val = (Object.op_Implicit((Object)(object)GameDirector.instance) ? GameDirector.instance.MainCamera : Camera.main); if (!Object.op_Implicit((Object)(object)val)) { return; } EnsureAssets(); Rect view = GameView(); float scale = ((Rect)(ref view)).height / 720f; foreach (Ping value in active.Values) { float num = Time.time - value.Born; float alpha = Mathf.Clamp01(value.Life - num); float num2 = Vector3.Distance(((Component)val).transform.position, value.World); Draw(val, view, value.World, value.Label + " " + Mathf.RoundToInt(num2) + "m", value, value.Color, alpha, num, scale); } } private static Rect GameView() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return ScreenSpace.GameView(); } private static bool Resolve(Ping p) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0268: 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_0277: 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_0281: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) p.World = p.Point; p.Color = LocationColor; switch (p.Kind) { case Kind.Enemy: { Enemy enemy = p.Enemy; if (!Object.op_Implicit((Object)(object)enemy) || !((Behaviour)enemy).isActiveAndEnabled) { return false; } if (Object.op_Implicit((Object)(object)enemy.EnemyParent) && !enemy.EnemyParent.Spawned) { return false; } if (enemy.HasHealth && Object.op_Implicit((Object)(object)enemy.Health) && (enemy.Health.dead || enemy.Health.healthCurrent <= 0)) { return false; } Vector3 fallback = (Object.op_Implicit((Object)(object)enemy.CenterTransform) ? enemy.CenterTransform.position : ((Component)enemy).transform.position) + Vector3.up; p.World = Above(p.Colliders, fallback); string text = (Object.op_Implicit((Object)(object)enemy.EnemyParent) ? enemy.EnemyParent.enemyName : "Enemy"); p.Label = ((enemy.HasHealth && Object.op_Implicit((Object)(object)enemy.Health)) ? (text + " " + enemy.Health.healthCurrent + "/" + enemy.Health.health) : text); p.Color = EnemyColor; return true; } case Kind.Valuable: if (!Object.op_Implicit((Object)(object)p.Valuable)) { return false; } p.World = Above(p.Colliders, ((Component)p.Valuable).transform.position + Vector3.up * 0.5f); p.Label = "$" + SemiFunc.DollarGetString(Mathf.RoundToInt(p.Valuable.dollarValueCurrent)); p.Color = ValuableColor; return true; case Kind.Item: if (!Object.op_Implicit((Object)(object)p.Item)) { return false; } p.World = Above(p.Colliders, ((Component)p.Item).transform.position + Vector3.up * 0.5f); p.Label = (Object.op_Implicit((Object)(object)p.Item.item) ? p.Item.item.itemName : "Item"); p.Color = ItemColor; return true; default: p.World = p.Point + Vector3.up * 0.3f; p.Label = "Here"; return true; } } private static Vector3 Above(Collider[] colliders, Vector3 fallback) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0090: 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_004d: 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) if (colliders == null) { return fallback; } bool flag = false; Bounds val = default(Bounds); foreach (Collider val2 in colliders) { if (Object.op_Implicit((Object)(object)val2) && val2.enabled && ((Component)val2).gameObject.activeInHierarchy) { if (!flag) { val = val2.bounds; flag = true; } else { ((Bounds)(ref val)).Encapsulate(val2.bounds); } } } if (!flag) { return fallback; } return new Vector3(((Bounds)(ref val)).center.x, ((Bounds)(ref val)).max.y + 0.3f, ((Bounds)(ref val)).center.z); } private void Draw(Camera cam, Rect view, Vector3 world, string label, Ping p, Color color, float alpha, float age, float scale) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_025a: 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_0278: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) Vector3 val = cam.WorldToViewportPoint(world); bool num = val.z < 0f; if (num) { ((Vector3)(ref val))..ctor(1f - val.x, 1f - val.y, val.z); } Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(((Rect)(ref view)).x + val.x * ((Rect)(ref view)).width, ((Rect)(ref view)).y + (1f - val.y) * ((Rect)(ref view)).height); float num2 = 40f * scale; bool num3 = num || val2.x < ((Rect)(ref view)).xMin + num2 || val2.x > ((Rect)(ref view)).xMax - num2 || val2.y < ((Rect)(ref view)).yMin + num2 || val2.y > ((Rect)(ref view)).yMax - num2; float num4 = 22f * scale; float num5 = 1f + Mathf.Max(0f, 0.6f - age) * 1.2f; if (num3) { Vector2 center = ((Rect)(ref view)).center; Vector2 val3 = val2 - center; if (((Vector2)(ref val3)).sqrMagnitude < 1f) { val3 = Vector2.down; } ((Vector2)(ref val3)).Normalize(); float num6 = ((Rect)(ref view)).width * 0.5f - num2; float num7 = ((Rect)(ref view)).height * 0.5f - num2; float num8 = Mathf.Min(num6 / Mathf.Max(Mathf.Abs(val3.x), 0.0001f), num7 / Mathf.Max(Mathf.Abs(val3.y), 0.0001f)); Vector2 val4 = center + val3 * num8; float rotation = Mathf.Atan2(val3.y, val3.x) * 57.29578f + 90f; ScreenSpace.Icon(new Rect(val4.x - num4 * 0.5f, val4.y - num4 * 0.5f, num4, num4), arrow, new Color(color.r, color.g, color.b, alpha), rotation); Vector2 at = val4 - val3 * (num4 * 1.4f); DrawLabels(at, label, p, color, alpha, scale); } else { float num9 = num4 * num5; Color c = default(Color); ((Color)(ref c))..ctor(color.r, color.g, color.b, alpha); ScreenSpace.Icon(new Rect(val2.x - num9 * 0.5f, val2.y - num9 * 0.5f, num9, num9), ring, c); float num10 = num4 * 0.3f; ScreenSpace.Icon(new Rect(val2.x - num10 * 0.5f, val2.y - num10 * 0.5f, num10, num10), dot, c); DrawLabels(val2 - new Vector2(0f, num4 * 1.25f), label, p, color, alpha, scale); } } private void DrawLabels(Vector2 at, string label, Ping p, Color color, float alpha, float scale) { //IL_0051: 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_008c: 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_0099: 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_00a7: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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) labelStyle.fontSize = Mathf.Max(10, Mathf.RoundToInt(16f * scale)); nameStyle.fontSize = Mathf.Max(8, Mathf.RoundToInt(12f * scale)); float num = 600f * scale; float num2 = 26f * scale; Rect r = default(Rect); ((Rect)(ref r))..ctor(at.x - num * 0.5f, at.y - num2 * 0.5f, num, num2); Rect r2 = new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y - num2 * 0.8f, num, num2); Shadowed(r, label, labelStyle, new Color(color.r, color.g, color.b, alpha), alpha); Color senderColor = p.SenderColor; Shadowed(r2, p.SenderName, nameStyle, new Color(senderColor.r, senderColor.g, senderColor.b, alpha * 0.9f), alpha); } private static void Shadowed(Rect r, string text, GUIStyle style, Color color, float alpha) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) ScreenSpace.Shadowed(r, text, style, color); } private void EnsureAssets() { //IL_0009: 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_0015: 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_0028: Expected O, but got Unknown //IL_0033: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown if (labelStyle == null) { labelStyle = new GUIStyle { alignment = (TextAnchor)4, fontStyle = (FontStyle)1, wordWrap = false }; labelStyle.normal.textColor = Color.white; nameStyle = new GUIStyle(labelStyle) { fontStyle = (FontStyle)0 }; } EnsureTextures(); } private void EnsureTextures() { if (!Object.op_Implicit((Object)(object)ring)) { ring = Circle(64, 0.36f, 0.48f); } if (!Object.op_Implicit((Object)(object)dot)) { dot = Circle(32, 0f, 0.48f); } if (!Object.op_Implicit((Object)(object)arrow)) { arrow = Triangle(64); } if (!Object.op_Implicit((Object)(object)mapDot)) { mapDot = Combine(Circle(64, 0.34f, 0.48f), Circle(64, 0f, 0.2f)); } } private static Texture2D Combine(Texture2D a, Texture2D b) { //IL_000b: Unknown result type (might be due to invalid IL