Upload from upload_mods.ps1
This commit is contained in:
33
Scripts/Dialog/NPCs/DialogRequirementHasCurrentOrder.cs
Normal file
33
Scripts/Dialog/NPCs/DialogRequirementHasCurrentOrder.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Linq;
|
||||
|
||||
public class DialogRequirementHasCurrentOrder : BaseDialogRequirement
|
||||
{
|
||||
public override bool CheckRequirement(EntityPlayer player, EntityNPC talkingTo)
|
||||
{
|
||||
|
||||
EntityAliveV2 myEntity = (EntityAliveV2)talkingTo;
|
||||
|
||||
if (myEntity != null)
|
||||
{
|
||||
// Split the Value string by commas, parse each part to an integer, and create a list
|
||||
var values = Value.Split(',')
|
||||
.Select(v => int.Parse(v.Trim()))
|
||||
.ToList();
|
||||
|
||||
// Get the CurrentOrder from myEntity
|
||||
int currentOrder = (int)myEntity.Buffs.GetCustomVar("CurrentOrder");
|
||||
|
||||
// Check if CurrentOrder is one of the values
|
||||
if (values.Contains(currentOrder))
|
||||
{
|
||||
//Log.Out("DialogRequirementHasCurrentOrder-CheckRequirement true");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("DialogRequirementHasCurrentOrder-CheckRequirement false");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user