Files
2026-06-04 11:42:34 +02:00

117 lines
3.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace RecRoom.Challenges
{
// Token: 0x02000AFA RID: 2810
public class Challenge : ChallengeBase
{
// Token: 0x06015A50 RID: 88656 RVA: 0x00604400 File Offset: 0x00602600
public Challenge()
{
this.IgnorePreviousCompletions = false;
}
// Token: 0x06015A51 RID: 88657 RVA: 0x00604428 File Offset: 0x00602628
protected bool EvalutateConditions(ChallengeEvents.IChallengeEventData challengeEventData)
{
List<bool> list = this.ResetConditions.Select((IChallenge _) => _.Evaluate(challengeEventData)).ToList<bool>();
bool flag = list.Any((bool _) => _);
if (flag)
{
this.Reset();
}
List<bool> list2 = this.WithConditions.Select((IChallenge _) => _.Evaluate(challengeEventData)).ToList<bool>();
bool flag2;
if (list2.Count<bool>() > 0)
{
flag2 = list2.All((bool _) => _);
}
else
{
flag2 = false;
}
bool flag3 = flag2;
base.Dirty |= this.WithConditions.Any((IChallenge _) => _.Dirty);
return flag3;
}
// Token: 0x06015A52 RID: 88658 RVA: 0x00604518 File Offset: 0x00602718
protected override bool EvaluateInternal(ChallengeEvents.IChallengeEventData challengeEventData)
{
return this.EvalutateConditions(challengeEventData);
}
// Token: 0x06015A53 RID: 88659 RVA: 0x00604524 File Offset: 0x00602724
public override void Reset()
{
base.Reset();
this.ResetChildren();
}
// Token: 0x06015A54 RID: 88660 RVA: 0x00604534 File Offset: 0x00602734
protected void ResetChildren()
{
foreach (IChallenge challenge in this.WithConditions)
{
challenge.Reset();
}
foreach (IChallenge challenge2 in this.ResetConditions)
{
challenge2.Reset();
}
}
// Token: 0x06015A55 RID: 88661 RVA: 0x006045DC File Offset: 0x006027DC
public override Dictionary<string, object> Serialize()
{
Dictionary<string, object> dictionary = base.Serialize();
List<Dictionary<string, object>> list = (from _ in this.ResetConditions
where !_.SkipSerialization
select _.Serialize()).ToList<Dictionary<string, object>>();
List<Dictionary<string, object>> list2 = (from _ in this.WithConditions
where !_.SkipSerialization
select _.Serialize()).ToList<Dictionary<string, object>>();
if (list.Count > 0)
{
dictionary["rc"] = list;
}
if (list2.Count > 0)
{
dictionary["wc"] = list2;
}
return dictionary;
}
// Token: 0x06015A56 RID: 88662 RVA: 0x006046C4 File Offset: 0x006028C4
protected override void DeserializeInternal(Dictionary<string, object> jsonDict)
{
this.ResetConditions = ChallengeParser.GetChallengeSet("rc", jsonDict);
this.WithConditions = ChallengeParser.GetChallengeSet("wc", jsonDict);
}
// Token: 0x170008DB RID: 2267
// (get) Token: 0x06015A57 RID: 88663 RVA: 0x006046E8 File Offset: 0x006028E8
public override ChallengeTypes ChallengeType
{
get
{
return ChallengeTypes.Challenge;
}
}
// Token: 0x04003BFB RID: 15355
public List<IChallenge> WithConditions = new List<IChallenge>();
// Token: 0x04003BFC RID: 15356
public List<IChallenge> ResetConditions = new List<IChallenge>();
// Token: 0x04003BFD RID: 15357
public const string RESET_CONDITIONS_KEY = "rc";
// Token: 0x04003BFE RID: 15358
public const string WITH_CONDITIONS_KEY = "wc";
}
}