using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ItemCounterByLers")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ItemCounterByLers")]
[assembly: AssemblyTitle("ItemCounterByLers")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ItemCounterByLers
{
[BepInPlugin("com.lers.itemcounter", "Item Counter By Lers", "1.0.0")]
public class ItemCounterByLers : BaseUnityPlugin
{
private GUIStyle style;
private GUIStyle outlineStyle;
private void Awake()
{
//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_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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle
{
fontSize = 24,
fontStyle = (FontStyle)1
};
val.normal.textColor = Color.white;
style = val;
outlineStyle = new GUIStyle(style);
outlineStyle.normal.textColor = Color.black;
}
private void OnGUI()
{
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: 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_0133: 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_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected I4, but got Unknown
if (!Input.GetKey((KeyCode)9) || (Object)(object)Run.instance == (Object)null)
{
return;
}
float num = 340f;
float num2 = 316f;
float num3 = 70f;
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
if ((Object)(object)instance == (Object)null || (Object)(object)instance.master == (Object)null || (Object)(object)instance.master.inventory == (Object)null)
{
continue;
}
Inventory inventory = instance.master.inventory;
int num4 = 0;
int num5 = 0;
int num6 = 0;
int num7 = 0;
GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems;
AllItemsEnumerator enumerator2 = allItems.GetEnumerator();
try
{
while (((AllItemsEnumerator)(ref enumerator2)).MoveNext())
{
ItemIndex current2 = ((AllItemsEnumerator)(ref enumerator2)).Current;
int itemCount = inventory.GetItemCount(current2);
if (itemCount <= 0)
{
continue;
}
ItemDef itemDef = ItemCatalog.GetItemDef(current2);
if (!((Object)(object)itemDef == (Object)null))
{
ItemTier tier = itemDef.tier;
switch ((int)tier)
{
case 0:
num4 += itemCount;
break;
case 1:
num5 += itemCount;
break;
case 2:
num6 += itemCount;
break;
case 3:
num7 += itemCount;
break;
}
}
}
}
finally
{
((IDisposable)(AllItemsEnumerator)(ref enumerator2)).Dispose();
}
float x = num;
DrawNumber(num4, Color.white, ref x, num2);
DrawNumber(num5, Color.green, ref x, num2);
DrawNumber(num6, Color.red, ref x, num2);
DrawNumber(num7, Color.cyan, ref x, num2);
num2 += num3;
}
}
private void DrawNumber(int value, Color color, ref float x, float y)
{
//IL_003f: 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_00a5: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
Rect val = default(Rect);
((Rect)(ref val))..ctor(x, y, 30f, 25f);
string text = value.ToString();
GUI.Label(new Rect(((Rect)(ref val)).x - 1f, ((Rect)(ref val)).y, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, outlineStyle);
GUI.Label(new Rect(((Rect)(ref val)).x + 1f, ((Rect)(ref val)).y, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, outlineStyle);
GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y - 1f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, outlineStyle);
GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 1f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), text, outlineStyle);
style.normal.textColor = color;
GUI.Label(val, text, style);
int length = text.Length;
float num = 20f;
if (length == 2)
{
num = 35f;
}
else if (length >= 3)
{
num = 40f;
}
x += num;
}
}
}