r2mods/ilspy_dump/ror2_csproj/RoR2.Achievements/MaxHealingShrineAchievement.cs

46 lines
1.1 KiB
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
namespace RoR2.Achievements;
[RegisterAchievement("MaxHealingShrine", "Items.PassiveHealing", null, 1u, typeof(MaxHealingShrineServerAchievement))]
public class MaxHealingShrineAchievement : BaseAchievement
{
private class MaxHealingShrineServerAchievement : BaseServerAchievement
{
private const int requirement = 2;
public override void OnInstall()
{
base.OnInstall();
ShrineHealingBehavior.onActivated += OnHealingShrineActivated;
}
public override void OnUninstall()
{
ShrineHealingBehavior.onActivated -= OnHealingShrineActivated;
base.OnUninstall();
}
private void OnHealingShrineActivated(ShrineHealingBehavior shrine, Interactor activator)
{
if (shrine.purchaseCount >= shrine.maxPurchaseCount)
{
CharacterBody currentBody = GetCurrentBody();
if ((bool)currentBody && currentBody.gameObject == activator.gameObject)
{
Grant();
}
}
}
}
public override void OnInstall()
{
base.OnInstall();
SetServerTracked(shouldTrack: true);
}
public override void OnUninstall()
{
base.OnUninstall();
}
}