using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("PxntxrezStudio")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Valuable Inspector")]
[assembly: AssemblyTitle("Valuable Inspector")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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;
}
}
}
public static class ValuableInspectorConfig
{
public static ConfigEntry<bool> RemoveCloneSuffix;
public static ConfigEntry<bool> RemoveValuablePrefix;
public static ConfigEntry<bool> CapitalizeNameWords;
public static ConfigEntry<bool> ShowName;
public static ConfigEntry<bool> ShowValue;
public static ConfigEntry<bool> ShowWeight;
public static ConfigEntry<bool> ShowStunInfo;
public static ConfigEntry<string> UIPreset;
public static ConfigEntry<int> OffsetX;
public static ConfigEntry<int> OffsetY;
public static ConfigEntry<int> BoxWidth;
public static ConfigEntry<int> BoxHeight;
public static ConfigEntry<int> FontSize;
public static ConfigEntry<FontStyle> FontStyleSetting;
public static ConfigEntry<bool> AutoResize;
public static ConfigEntry<Vector2> ShadowOffset;
public static ConfigEntry<int> TextColorR;
public static ConfigEntry<int> TextColorG;
public static ConfigEntry<int> TextColorB;
public static ConfigEntry<int> BackgroundColorR;
public static ConfigEntry<int> BackgroundColorG;
public static ConfigEntry<int> BackgroundColorB;
public static ConfigEntry<int> ShadowColorR;
public static ConfigEntry<int> ShadowColorG;
public static ConfigEntry<int> ShadowColorB;
private static string _lastPreset = "";
public static Color TextColor => new Color((float)TextColorR.Value / 255f, (float)TextColorG.Value / 255f, (float)TextColorB.Value / 255f);
public static Color BackgroundColor => new Color((float)BackgroundColorR.Value / 255f, (float)BackgroundColorG.Value / 255f, (float)BackgroundColorB.Value / 255f);
public static Color ShadowColor => new Color((float)ShadowColorR.Value / 255f, (float)ShadowColorG.Value / 255f, (float)ShadowColorB.Value / 255f);
public static void Init(ConfigFile config)
{
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Expected O, but got Unknown
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Expected O, but got Unknown
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Expected O, but got Unknown
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Expected O, but got Unknown
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Expected O, but got Unknown
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Expected O, but got Unknown
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Expected O, but got Unknown
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Expected O, but got Unknown
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Expected O, but got Unknown
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_033b: Expected O, but got Unknown
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_036b: Expected O, but got Unknown
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_039b: Expected O, but got Unknown
//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Expected O, but got Unknown
//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
//IL_03fb: Expected O, but got Unknown
//IL_0421: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Expected O, but got Unknown
RemoveCloneSuffix = config.Bind<bool>("Debug", "RemoveCloneSuffix", true, "Remove (Clone) from names");
RemoveValuablePrefix = config.Bind<bool>("Debug", "RemoveValuablePrefix", true, "Remove Valuable prefix");
CapitalizeNameWords = config.Bind<bool>("Debug", "CapitalizeNameWords", false, "Capitalize each word in the item name (e.g., 'golden apple' → 'Golden Apple')");
ShowName = config.Bind<bool>("Information", "ShowName", true, "Show Name line");
ShowValue = config.Bind<bool>("Information", "ShowValue", true, "Show Value line");
ShowWeight = config.Bind<bool>("Information", "ShowWeight", true, "Show Weight line");
ShowStunInfo = config.Bind<bool>("Information", "ShowStunInfo", false, "Show Stuns on hit line");
UIPreset = config.Bind<string>("UI Position Settings", "UIPreset", "TopCenter", new ConfigDescription("UI position preset", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[5] { "BottomRight", "BottomLeft", "TopLeft", "TopRight", "TopCenter" }), Array.Empty<object>()));
OffsetX = config.Bind<int>("UI Position Settings", "OffsetX", 1, new ConfigDescription("Offset X", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-250, 2500), Array.Empty<object>()));
OffsetY = config.Bind<int>("UI Position Settings", "OffsetY", 66, new ConfigDescription("Offset Y", (AcceptableValueBase)(object)new AcceptableValueRange<int>(-100, 1500), Array.Empty<object>()));
BoxWidth = config.Bind<int>("UI Settings", "BoxWidth", 500, new ConfigDescription("Box Width", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 800), Array.Empty<object>()));
BoxHeight = config.Bind<int>("UI Settings", "BoxHeight", 225, new ConfigDescription("Box Height", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 600), Array.Empty<object>()));
FontSize = config.Bind<int>("UI Settings", "FontSize", 28, new ConfigDescription("Font Size", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 60), Array.Empty<object>()));
FontStyleSetting = config.Bind<FontStyle>("UI Settings", "FontStyle", (FontStyle)1, "Font Style");
AutoResize = config.Bind<bool>("UI Settings", "AutoResize", true, "Automatically resize box to fit text");
ShadowOffset = config.Bind<Vector2>("UI Settings", "ShadowOffset", new Vector2(2f, 2f), "Shadow offset");
TextColorR = config.Bind<int>("Color Settings", "TextColorR", 255, new ConfigDescription("Text Red", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
TextColorG = config.Bind<int>("Color Settings", "TextColorG", 255, new ConfigDescription("Text Green", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
TextColorB = config.Bind<int>("Color Settings", "TextColorB", 255, new ConfigDescription("Text Blue", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
BackgroundColorR = config.Bind<int>("Color Settings", "BackgroundColorR", 0, new ConfigDescription("Background Red", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
BackgroundColorG = config.Bind<int>("Color Settings", "BackgroundColorG", 0, new ConfigDescription("Background Green", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
BackgroundColorB = config.Bind<int>("Color Settings", "BackgroundColorB", 0, new ConfigDescription("Background Blue", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
ShadowColorR = config.Bind<int>("Color Settings", "ShadowColorR", 0, new ConfigDescription("Shadow Red", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
ShadowColorG = config.Bind<int>("Color Settings", "ShadowColorG", 0, new ConfigDescription("Shadow Green", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
ShadowColorB = config.Bind<int>("Color Settings", "ShadowColorB", 0, new ConfigDescription("Shadow Blue", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 255), Array.Empty<object>()));
_lastPreset = UIPreset.Value;
ApplyUIPreset();
}
public static void TryApplyPresetIfChanged()
{
if (UIPreset.Value != _lastPreset)
{
ApplyUIPreset();
}
}
public static void ApplyUIPreset()
{
_lastPreset = UIPreset.Value;
}
}
public static class ValuableRegistry
{
public static readonly List<ValuableObject> AllValuables = new List<ValuableObject>();
public static void Register(ValuableObject vo)
{
if ((Object)(object)vo != (Object)null && !AllValuables.Contains(vo))
{
AllValuables.Add(vo);
}
}
public static void Unregister(ValuableObject vo)
{
if ((Object)(object)vo != (Object)null)
{
AllValuables.Remove(vo);
}
}
}
public class ValuableTracker : MonoBehaviour
{
private ValuableObject valuable;
private void Awake()
{
valuable = ((Component)this).GetComponent<ValuableObject>();
}
private void OnDestroy()
{
ValuableRegistry.Unregister(valuable);
}
}
[HarmonyPatch(typeof(ValuableObject))]
public static class ValuableObjectPatches
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void AwakePatch(ValuableObject __instance)
{
ValuableRegistry.Register(__instance);
if ((Object)(object)((Component)__instance).GetComponent<ValuableTracker>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<ValuableTracker>();
}
}
}
[BepInPlugin("Pxntxrez.ValuableInspector", "Valuable Inspector", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
private Harmony harmony;
private ValuableObject lastValuable;
private string infoText = string.Empty;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
harmony = new Harmony("Pxntxrez.ValuableInspector");
harmony.PatchAll();
ValuableInspectorConfig.Init(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Valuable Inspector initialized!");
}
private void Update()
{
ValuableInspectorConfig.TryApplyPresetIfChanged();
ValuableObject val = null;
foreach (ValuableObject allValuable in ValuableRegistry.AllValuables)
{
if (!((Object)(object)allValuable == (Object)null) && !((Object)(object)allValuable.physGrabObject == (Object)null))
{
PhysGrabObject physGrabObject = allValuable.physGrabObject;
if (!physGrabObject.dead && physGrabObject.playerGrabbing != null && physGrabObject.playerGrabbing.Count > 0 && ((GameManager.instance.gameMode == 0) ? physGrabObject.grabbed : physGrabObject.grabbedLocal))
{
val = allValuable;
break;
}
}
}
if ((Object)(object)lastValuable != (Object)null && lastValuable.physGrabObject.dead)
{
val = null;
}
if ((Object)(object)val != (Object)(object)lastValuable)
{
if ((Object)(object)val == (Object)null)
{
ClearInfo();
}
else
{
BuildInfo(val);
}
lastValuable = val;
}
}
private void BuildInfo(ValuableObject vo)
{
string text = ((Object)((Component)vo).gameObject).name;
if (ValuableInspectorConfig.RemoveCloneSuffix.Value && text.EndsWith("(Clone)"))
{
string text2 = text;
text = text2.Substring(0, text2.Length - 7);
}
if (ValuableInspectorConfig.RemoveValuablePrefix.Value && text.StartsWith("Valuable "))
{
string text2 = text;
text = text2.Substring(9, text2.Length - 9);
}
if (ValuableInspectorConfig.CapitalizeNameWords.Value)
{
text = CapitalizeEachWord(text);
}
int num = Mathf.RoundToInt(vo.valuePreset.valueMin);
int num2 = Mathf.RoundToInt(vo.valuePreset.valueMax);
float mass = vo.physAttributePreset.mass;
StringBuilder stringBuilder = new StringBuilder();
if (ValuableInspectorConfig.ShowName.Value)
{
stringBuilder.AppendLine("Name: " + text);
}
if (ValuableInspectorConfig.ShowValue.Value)
{
stringBuilder.AppendLine($"Value: {num}-{num2}");
}
if (ValuableInspectorConfig.ShowWeight.Value)
{
stringBuilder.AppendLine("Weight: " + FormatWeight(mass));
}
if (ValuableInspectorConfig.ShowStunInfo.Value)
{
string stunInfo = GetStunInfo(mass);
if (!string.IsNullOrEmpty(stunInfo))
{
stringBuilder.AppendLine(stunInfo);
}
}
infoText = stringBuilder.ToString().TrimEnd();
}
private string FormatWeight(float weight)
{
if (!Mathf.Approximately(weight % 1f, 0f))
{
return weight.ToString("0.##", CultureInfo.InvariantCulture);
}
return ((int)weight).ToString();
}
private string GetStunInfo(float weight)
{
if (weight < 0.5f)
{
return null;
}
if (!(weight < 2f))
{
return "Stuns on hit:\n- All Enemies except:\n DUCK, PEAPER";
}
return "Stuns on hit:\n- SHADOW CHILD\n- SPEWER\n- RUGRAT\n- ANIMAL\n- UPSCREAM\n- CHEF\n- HIDDEN";
}
private string CapitalizeEachWord(string input)
{
string[] array = input.Split(' ');
for (int i = 0; i < array.Length; i++)
{
if (array[i].Length > 0)
{
int num = i;
string text = char.ToUpper(array[i][0]).ToString();
string text2 = array[i];
array[num] = text + text2.Substring(1, text2.Length - 1);
}
}
return string.Join(" ", array);
}
private void ClearInfo()
{
infoText = string.Empty;
lastValuable = null;
}
private void OnGUI()
{
//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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: 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_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
if (!string.IsNullOrEmpty(infoText))
{
GUIStyle val = new GUIStyle(GUI.skin.label)
{
fontSize = ValuableInspectorConfig.FontSize.Value,
fontStyle = ValuableInspectorConfig.FontStyleSetting.Value,
wordWrap = true
};
val.normal.textColor = ValuableInspectorConfig.TextColor;
GUIStyle val2 = val;
Vector2 val3 = val2.CalcSize(new GUIContent(infoText));
float num = (ValuableInspectorConfig.AutoResize.Value ? (val3.x + 40f) : ((float)ValuableInspectorConfig.BoxWidth.Value));
float num2 = (ValuableInspectorConfig.AutoResize.Value ? (val3.y + 40f) : ((float)ValuableInspectorConfig.BoxHeight.Value));
float num3 = 0f;
float num4 = 0f;
switch (ValuableInspectorConfig.UIPreset.Value)
{
case "BottomLeft":
num3 = ValuableInspectorConfig.OffsetX.Value;
num4 = (float)Screen.height - num2 - (float)ValuableInspectorConfig.OffsetY.Value;
break;
case "TopLeft":
num3 = ValuableInspectorConfig.OffsetX.Value;
num4 = ValuableInspectorConfig.OffsetY.Value;
break;
case "TopRight":
num3 = (float)Screen.width - num - (float)ValuableInspectorConfig.OffsetX.Value;
num4 = ValuableInspectorConfig.OffsetY.Value;
break;
case "TopCenter":
num3 = ((float)Screen.width - num) / 2f;
num4 = ValuableInspectorConfig.OffsetY.Value;
break;
default:
num3 = (float)Screen.width - num - (float)ValuableInspectorConfig.OffsetX.Value;
num4 = (float)Screen.height - num2 - (float)ValuableInspectorConfig.OffsetY.Value;
break;
}
Rect val4 = default(Rect);
((Rect)(ref val4))..ctor(num3, num4, num, num2);
GUI.color = ValuableInspectorConfig.BackgroundColor;
GUI.Box(val4, GUIContent.none);
GUI.color = ValuableInspectorConfig.ShadowColor;
Rect val5 = default(Rect);
((Rect)(ref val5))..ctor(((Rect)(ref val4)).x + 20f + ValuableInspectorConfig.ShadowOffset.Value.x, ((Rect)(ref val4)).y + 20f + ValuableInspectorConfig.ShadowOffset.Value.y, num - 40f, num2 - 40f);
GUI.Label(val5, infoText, val2);
GUI.color = ValuableInspectorConfig.TextColor;
Rect val6 = default(Rect);
((Rect)(ref val6))..ctor(((Rect)(ref val4)).x + 20f, ((Rect)(ref val4)).y + 20f, num - 40f, num2 - 40f);
GUI.Label(val6, infoText, val2);
}
}
}