Upload from upload_mods.ps1
This commit is contained in:
54
Scripts/MinEvents/MinEventActionFactionChangeSDX.cs
Normal file
54
Scripts/MinEvents/MinEventActionFactionChangeSDX.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionFactionChangeSDX : MinEventActionRemoveBuff
|
||||
{
|
||||
private string Faction = "";
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
//Log.Out("MinEventActionFactionChangeSDX-Execute START");
|
||||
|
||||
for (var i = 0; i < targets.Count; i++)
|
||||
{
|
||||
var entity = targets[i];
|
||||
|
||||
//Log.Out("MinEventActionFactionChangeSDX-Execute entityClassName:" + entity.EntityClass.entityClassName);
|
||||
|
||||
if (entity != null)
|
||||
{
|
||||
//Log.Out("MinEventActionFactionChangeSDX-Execute 1");
|
||||
// If the faction name is original, try to find the original faction of the entity, stored via cvar.
|
||||
if (Faction == "original")
|
||||
{
|
||||
//Log.Out("MinEventActionFactionChangeSDX-Execute 2");
|
||||
entity.Buffs.SetCustomVar("$faction", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionFactionChangeSDX-Execute 3");
|
||||
entity.Buffs.SetCustomVar("$faction", RebirthUtilities.GetFactionID(Faction));
|
||||
}
|
||||
|
||||
entity.attackTarget = (EntityAlive) null;
|
||||
entity.SetRevengeTarget((EntityAlive) null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(_attribute);
|
||||
if (!flag)
|
||||
{
|
||||
var name = _attribute.Name;
|
||||
if (name != null)
|
||||
if (name == "value")
|
||||
{
|
||||
Faction = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user