Upload from upload_mods.ps1
This commit is contained in:
50
Scripts/Dialog/DialogRequirementNPCNotHasBuffSDX.cs
Normal file
50
Scripts/Dialog/DialogRequirementNPCNotHasBuffSDX.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Match at least one of these buffs, by default.
|
||||
* <requirement type="NPCNotHasBuffSDX, RebirthUtils" requirementtype="Hide" value="buffCursed,buffGodMode,buffImagination" />
|
||||
|
||||
* Do not have these buffs
|
||||
* <requirement type="NPCNotHasBuffSDX, RebirthUtils" requirementtype="Hide" value="!buffCursed" " />
|
||||
*/
|
||||
|
||||
using System.Linq;
|
||||
|
||||
public class DialogRequirementNPCNotHasBuffSDX : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
var matches = -1;
|
||||
|
||||
// If there's more than one buff listed, loop around, recording how many we match.
|
||||
string[] array = Value.Split(new char[]
|
||||
{
|
||||
','
|
||||
});
|
||||
if (Value.Contains(","))
|
||||
{
|
||||
matches = array.Count(t => talkingTo.Buffs.HasBuff(t));
|
||||
if (matches > 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reverse condition on the buff.
|
||||
if (Value.StartsWith("!"))
|
||||
{
|
||||
var tempBuff = Value.Replace("!", "");
|
||||
if (!talkingTo.Buffs.HasBuff(tempBuff))
|
||||
return false;
|
||||
}
|
||||
// If no operator, just check if we have it
|
||||
if (talkingTo.Buffs.HasBuff(Value))
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user