r2mods/ilspy_dump/ror2_csproj/RoR2.Items/UseAmbientLevelManager.cs

29 lines
743 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using System;
using System.Collections.ObjectModel;
namespace RoR2.Items;
public class UseAmbientLevelManager
{
[SystemInitializer(new Type[] { typeof(ItemCatalog) })]
private static void Init()
{
Run.onRunAmbientLevelUp += OnRunAmbientLevelUp;
}
private static void OnRunAmbientLevelUp(Run run)
{
ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList;
int i = 0;
for (int count = readOnlyInstancesList.Count; i < count; i++)
{
CharacterBody characterBody = readOnlyInstancesList[i];
Inventory inventory = characterBody.inventory;
if ((bool)inventory && inventory.GetItemCount(RoR2Content.Items.UseAmbientLevel) > 0)
{
characterBody.MarkAllStatsDirty();
}
}
}
}