r2mods/ilspy_dump/ror2_csproj/RoR2.Achievements.Toolbot/ToolbotBeatArenaLaterAchiev...

53 lines
1.4 KiB
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using RoR2.Stats;
namespace RoR2.Achievements.Toolbot;
[RegisterAchievement("ToolbotBeatArenaLater", "Skills.Toolbot.SpecialAlt", "RepeatFirstTeleporter", 3u, typeof(ToolbotBeatArenaLaterServerAchievement))]
public class ToolbotBeatArenaLaterAchievement : BaseAchievement
{
private class ToolbotBeatArenaLaterServerAchievement : BaseServerAchievement
{
private MemoizedGetComponent<PlayerStatsComponent> playerStatsComponentGetter;
public override void OnInstall()
{
base.OnInstall();
ArenaMissionController.onBeatArena += OnBeatArena;
}
public override void OnUninstall()
{
ArenaMissionController.onBeatArena -= OnBeatArena;
base.OnInstall();
}
private void OnBeatArena()
{
PlayerStatsComponent playerStatsComponent = playerStatsComponentGetter.Get(base.networkUser.masterObject);
if ((bool)playerStatsComponent && playerStatsComponent.currentStats.GetStatValueULong(StatDef.highestStagesCompleted) >= 6)
{
Grant();
}
}
}
private const int requirement = 6;
protected override BodyIndex LookUpRequiredBodyIndex()
{
return BodyCatalog.FindBodyIndex("ToolbotBody");
}
protected override void OnBodyRequirementMet()
{
base.OnBodyRequirementMet();
SetServerTracked(shouldTrack: true);
}
protected override void OnBodyRequirementBroken()
{
SetServerTracked(shouldTrack: false);
base.OnBodyRequirementBroken();
}
}