78 lines
2.3 KiB
C#
78 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Xml.Linq;
|
|
|
|
public class GeneticsCompareRebirth : TargetedCompareRequirementBase
|
|
{
|
|
public override bool IsValid(MinEventParams _params)
|
|
{
|
|
if (!this.ParamsValid(_params))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
int level = (int)RebirthVariables.localVariables["$varFuriousRamsay" + genetic + "PercUnit"];
|
|
|
|
//Log.Out("GeneticsCompareRebirth-IsValid level: " + level);
|
|
|
|
if (this.invert)
|
|
{
|
|
return !RequirementBase.compareValues(level, this.operation, this.value);
|
|
}
|
|
return RequirementBase.compareValues(level, this.operation, this.value);
|
|
}
|
|
|
|
public override void GetInfoStrings(ref List<string> list)
|
|
{
|
|
|
|
|
|
list.Add(string.Format("cvar.{0} {1} {2}", genetic, this.operation.ToStringCached<RequirementBase.OperationTypes>(), this.value.ToCultureInvariantString()));
|
|
}
|
|
|
|
public override bool ParseXAttribute(XAttribute _attribute)
|
|
{
|
|
string localName = _attribute.Name.LocalName;
|
|
if (localName == "operation")
|
|
{
|
|
this.operation = EnumUtils.Parse<RequirementBase.OperationTypes>(_attribute.Value, true);
|
|
return true;
|
|
}
|
|
else if (localName == "value")
|
|
{
|
|
if (_attribute.Value.StartsWith("@"))
|
|
{
|
|
this.useCVar = true;
|
|
this.refCvarName = _attribute.Value.Substring(1);
|
|
}
|
|
else
|
|
{
|
|
this.value = StringParsers.ParseFloat(_attribute.Value, 0, -1, NumberStyles.Any);
|
|
}
|
|
fullValue = _attribute.Value;
|
|
return true;
|
|
}
|
|
else if (localName == "invert")
|
|
{
|
|
this.invert = StringParsers.ParseBool(_attribute.Value, 0, -1, true);
|
|
return true;
|
|
}
|
|
else if (localName == "target")
|
|
{
|
|
this.targetType = EnumUtils.Parse<TargetedCompareRequirementBase.TargetTypes>(_attribute.Value, true);
|
|
return true;
|
|
}
|
|
else if (localName == "genetic")
|
|
{
|
|
genetic = _attribute.Value;
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
protected string genetic;
|
|
protected string fullValue;
|
|
}
|