Upload from upload_mods.ps1
This commit is contained in:
37
Scripts/Dialog/NPCs/DialogActionNPCSetCVarRebirth.cs
Normal file
37
Scripts/Dialog/NPCs/DialogActionNPCSetCVarRebirth.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
public class DialogActionNPCSetCVarRebirth : DialogActionAddBuff
|
||||
{
|
||||
public override void PerformAction(EntityPlayer player)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Value))
|
||||
Value = "0";
|
||||
|
||||
float.TryParse(Value, out var flValue);
|
||||
|
||||
var entityId = -1;
|
||||
if (player.Buffs.HasCustomVar("CurrentNPC"))
|
||||
{
|
||||
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 1");
|
||||
entityId = (int)player.Buffs.GetCustomVar("CurrentNPC");
|
||||
}
|
||||
|
||||
if (entityId == -1)
|
||||
{
|
||||
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 2");
|
||||
return;
|
||||
}
|
||||
|
||||
var myEntity = GameManager.Instance.World.GetEntity(entityId) as EntityAliveV2;
|
||||
if (myEntity == null)
|
||||
{
|
||||
//Log.Out("DialogActionDespawnEntityRebirth-PerformAction 3");
|
||||
return;
|
||||
}
|
||||
|
||||
if (flValue == 0)
|
||||
myEntity.Buffs.SetCustomVar(ID, 0f);
|
||||
else
|
||||
myEntity.Buffs.SetCustomVar(ID, flValue, true);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user