using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using RoR2;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Ash_ChestPrices")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ash_ChestPrices")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4fb74315-d95d-4dea-8ae0-0c45fef14b65")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Ash_ChestPrices;
[BepInPlugin("Ashen_O.Ash_ChestPrices", "Ash_ChestPrices", "2.0.0")]
public class Ash_ChestPrices : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <LogInteractables>d__2 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Ash_ChestPrices <>4__this;
private PurchaseInteraction[] <items>5__1;
private List<PurchaseInteraction> <moneyItems>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LogInteractables>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<items>5__1 = null;
<moneyItems>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<items>5__1 = Object.FindObjectsOfType<PurchaseInteraction>(true);
<moneyItems>5__2 = <>4__this.FilterAndCount(<items>5__1);
<>4__this.SendChatMessage(<moneyItems>5__2);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private Dictionary<string, int> assetSpawnCounts = new Dictionary<string, int>();
public void Awake()
{
SceneDirector.onPostPopulateSceneServer += delegate
{
assetSpawnCounts.Clear();
((MonoBehaviour)this).StartCoroutine(LogInteractables());
};
}
[IteratorStateMachine(typeof(<LogInteractables>d__2))]
private IEnumerator LogInteractables()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LogInteractables>d__2(0)
{
<>4__this = this
};
}
private List<PurchaseInteraction> FilterAndCount(PurchaseInteraction[] items)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
List<PurchaseInteraction> list = new List<PurchaseInteraction>();
foreach (PurchaseInteraction val in items)
{
if ((int)val.costType == 1)
{
list.Add(val);
string name = ((Object)((Component)val).gameObject).name;
if (!assetSpawnCounts.ContainsKey(name))
{
assetSpawnCounts[name] = 0;
}
assetSpawnCounts[name]++;
}
}
foreach (string item in assetSpawnCounts.Keys.ToList())
{
if (item.Contains("MultiShop"))
{
assetSpawnCounts[item] /= 3;
}
}
return list;
}
private void SendChatMessage(List<PurchaseInteraction> moneyItems)
{
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Expected O, but got Unknown
List<string> list = new List<string>();
list.Add("<color=red>[Ash]</color> Current stage costs:");
List<string> list2 = new List<string>();
foreach (PurchaseInteraction moneyItem in moneyItems)
{
string displayName = moneyItem.GetDisplayName();
string name = ((Object)((Component)moneyItem).gameObject).name;
int networkcost = moneyItem.Networkcost;
int num = assetSpawnCounts[name];
if (!name.Contains("Broken") && !list2.Contains(name))
{
list2.Add(name);
list.Add($"<color=green>{displayName}:</color> <color=yellow>{networkcost}</color>[{num}]");
Debug.Log((object)$"[Ash][ChestPrices][ChestCost] GameObject: {name}, In-game Name: {displayName}, Cost: {networkcost}, Count: {num}");
}
}
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = string.Join("\n", list)
});
}
}