Upload from upload_mods.ps1
This commit is contained in:
67
Scripts/Requirements/IsClassAvailableRebirth.cs
Normal file
67
Scripts/Requirements/IsClassAvailableRebirth.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class IsClassAvailableRebirth : TargetedCompareRequirementBase
|
||||
{
|
||||
public override bool IsValid(MinEventParams _params)
|
||||
{
|
||||
//Log.Out("IsClassAvailableRebirth-IsValid START");
|
||||
|
||||
if (!base.IsValid(_params))
|
||||
{
|
||||
//Log.Out("IsClassAvailableRebirth-IsValid 1");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (RebirthUtilities.ScenarioSkip() || _params.Self.world.IsEditor() || GameUtils.IsWorldEditor())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool flag = false;
|
||||
|
||||
foreach (string classID in this.classID.Split(','))
|
||||
{
|
||||
flag = RebirthUtilities.IsClassActive(_params.Self, StringParsers.ParseFloat(classID));
|
||||
//Log.Out("IsClassAvailableRebirth-IsValid flag: " + flag);
|
||||
if (flag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("IsClassAvailableRebirth-IsValid flag: " + flag);
|
||||
|
||||
if (this.invert)
|
||||
{
|
||||
return !flag;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public override bool ParseXAttribute(XAttribute _attribute)
|
||||
{
|
||||
bool flag = base.ParseXAttribute(_attribute);
|
||||
if (!flag)
|
||||
{
|
||||
string name = _attribute.Name.LocalName;
|
||||
if (name != null)
|
||||
{
|
||||
if (name == "perkName")
|
||||
{
|
||||
this.perkName = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
if (name == "classID")
|
||||
{
|
||||
this.classID = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private string perkName;
|
||||
private string classID;
|
||||
}
|
||||
Reference in New Issue
Block a user