Upload from upload_mods.ps1
This commit is contained in:
60
Scripts/Requirements/HasBonusSpecific.cs
Normal file
60
Scripts/Requirements/HasBonusSpecific.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System.Globalization;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class HasBonusSpecific : TargetedCompareRequirementBase
|
||||
{
|
||||
|
||||
public override bool IsValid(MinEventParams _params)
|
||||
{
|
||||
//Log.Out("HasBonusSpecific-IsValid START");
|
||||
if (!base.IsValid(_params))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
EntityAlive me = _params.Self;
|
||||
|
||||
bool flag = false;
|
||||
|
||||
ItemValue itemValue = _params.ItemValue;
|
||||
|
||||
if (itemValue != null && itemValue.ItemClass != null)
|
||||
{
|
||||
if (itemValue != null &&
|
||||
itemValue.HasMetadata("bonus") &&
|
||||
itemValue.HasMetadata("level") &&
|
||||
itemValue.HasMetadata("type") &&
|
||||
itemValue.HasMetadata("active"))
|
||||
{
|
||||
if (bonus == (string)itemValue.GetMetadata("bonus") &&
|
||||
level == (int)itemValue.GetMetadata("level"))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public override bool ParseXAttribute(XAttribute _attribute)
|
||||
{
|
||||
string localName = _attribute.Name.LocalName;
|
||||
if (localName == "bonus")
|
||||
{
|
||||
bonus = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
else if (localName == "level")
|
||||
{
|
||||
level = int.Parse(_attribute.Value);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
protected string bonus;
|
||||
protected int level;
|
||||
}
|
||||
Reference in New Issue
Block a user