Upload from upload_mods.ps1
This commit is contained in:
104
Scripts/MinEvents/NPCs/MinEventActionChangeWeaponRebirth.cs
Normal file
104
Scripts/MinEvents/NPCs/MinEventActionChangeWeaponRebirth.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionChangeWeaponRebirth : MinEventActionRemoveBuff
|
||||
{
|
||||
private string itemName = "";
|
||||
private string jointName = "";
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
var theEntity = _params.Self as EntityNPCRebirth;
|
||||
|
||||
int i = 0;
|
||||
|
||||
Transform transform = theEntity.RootTransform.FindInChilds(theEntity.GetRightHandTransformName(), true);
|
||||
|
||||
float currentX = transform.localPosition.x;
|
||||
float currentY = transform.localPosition.y;
|
||||
float currentZ = transform.localPosition.z;
|
||||
|
||||
float newX = 0;
|
||||
float newY = 0;
|
||||
float newZ = 0;
|
||||
|
||||
//Log.Out("TRANSFORM Local Position X: " + transform.localPosition.x);
|
||||
//Log.Out("TRANSFORM Local Position Y: " + transform.localPosition.y);
|
||||
//Log.Out("TRANSFORM Local Position Z: " + transform.localPosition.z);
|
||||
//Log.Out("TRANSFORM GameObject Name: " + transform.gameObject.name);
|
||||
|
||||
foreach (string text in itemName.Split(new char[]
|
||||
{
|
||||
','
|
||||
}))
|
||||
{
|
||||
ItemStack itemStack = ItemStack.FromString(text.Trim());
|
||||
|
||||
var forId = ItemClass.GetForId(itemStack.itemValue.type);
|
||||
|
||||
if (forId.HasQuality)
|
||||
{
|
||||
itemStack.itemValue = new ItemValue(itemStack.itemValue.type, 1, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemStack.count = forId.Stacknumber.Value;
|
||||
}
|
||||
|
||||
//Log.Out("Item Name: " + text.Trim());
|
||||
if (i == 0)
|
||||
{
|
||||
Transform transform2 = theEntity.RootTransform.FindInChilds(jointName, true);
|
||||
|
||||
newX = transform2.localPosition.x;
|
||||
newX = transform2.localPosition.y;
|
||||
newX = transform2.localPosition.z;
|
||||
|
||||
newX = newX - currentX;
|
||||
newY = newY - currentY;
|
||||
newZ = newZ - currentZ;
|
||||
|
||||
//Log.Out("Joint Name: " + jointName);
|
||||
theEntity.rightHandTransformName = jointName;
|
||||
theEntity.emodel.SetInRightHand(transform2);
|
||||
|
||||
//Log.Out("TRANSFORM2 Local Position X: " + transform2.localPosition.x);
|
||||
//Log.Out("TRANSFORM2 Local Position Y: " + transform2.localPosition.y);
|
||||
//Log.Out("TRANSFORM2 Local Position Z: " + transform2.localPosition.z);
|
||||
//Log.Out("TRANSFORM2 GameObject Name: " + transform2.gameObject.name);
|
||||
}
|
||||
|
||||
theEntity.inventory.SetItem(i, itemStack);
|
||||
i++;
|
||||
}
|
||||
|
||||
theEntity.inventory.ForceHoldingItemUpdate();
|
||||
|
||||
//Log.Out("NEW TRANSFORM NAME: " + theEntity.GetRightHandTransformName());
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(_attribute);
|
||||
if (flag) return true;
|
||||
var name = _attribute.Name;
|
||||
|
||||
if (name == null)
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
else if (name == "itemName")
|
||||
{
|
||||
itemName = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
else if (name == "jointName")
|
||||
{
|
||||
jointName = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
98
Scripts/MinEvents/NPCs/MinEventActionGiveNPCItemRebirth.cs
Normal file
98
Scripts/MinEvents/NPCs/MinEventActionGiveNPCItemRebirth.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
using Audio;
|
||||
using System.Globalization;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionGiveNPCItemRebirth : MinEventActionRemoveBuff
|
||||
{
|
||||
private int numItems = 1;
|
||||
private string strNumItems = "";
|
||||
private int numMining = 0;
|
||||
private string itemName = "";
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
var entity = _params.Self as EntityNPCRebirth;
|
||||
|
||||
ItemValue item = ItemClass.GetItem(itemName, false);
|
||||
ItemValue itemValue = new ItemValue(ItemClass.GetItem(itemName, false).type, true);
|
||||
|
||||
if (strNumItems.Contains("-"))
|
||||
{
|
||||
string[] array = strNumItems.Split(new char[]
|
||||
{
|
||||
'-'
|
||||
});
|
||||
int min = StringParsers.ParseSInt32(array[0], 0, -1, NumberStyles.Integer);
|
||||
int maxExclusive = StringParsers.ParseSInt32(array[1], 0, -1, NumberStyles.Integer) + 1;
|
||||
numItems = Manager.random.RandomRange(min, maxExclusive);
|
||||
}
|
||||
else
|
||||
{
|
||||
numItems = StringParsers.ParseSInt32(strNumItems, 0, -1, NumberStyles.Integer);
|
||||
}
|
||||
|
||||
int num = numItems;
|
||||
|
||||
if (itemValue.HasQuality)
|
||||
{
|
||||
itemValue = new ItemValue(item.type, num, num, true, null, 1f);
|
||||
num = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemValue = new ItemValue(item.type, true);
|
||||
}
|
||||
|
||||
if (numMining > 0)
|
||||
{
|
||||
float flNPCMiningLevel = entity.Buffs.GetCustomVar("$FR_NPC_MiningLevel");
|
||||
|
||||
num = (int)((1 + (flNPCMiningLevel / 5)) * num);
|
||||
}
|
||||
|
||||
if (entity.lootContainer != null)
|
||||
{
|
||||
//Log.Out("MinEventActionGiveNPCItemRebirth-Execute Item Nalue: " + itemValue.ItemClass.GetItemName());
|
||||
ValueTuple<bool, bool> tryStack = entity.lootContainer.TryStackItem(0, new ItemStack(itemValue, num));
|
||||
|
||||
if (!tryStack.Item1)
|
||||
{
|
||||
if (!entity.lootContainer.AddItem(new ItemStack(itemValue, num)))
|
||||
{
|
||||
entity.world.gameManager.ItemDropServer(new ItemStack(itemValue, num), entity.GetPosition(), Vector3.zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(_attribute);
|
||||
if (flag) return true;
|
||||
var name = _attribute.Name;
|
||||
|
||||
if (name == null)
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
else if (name == "numMining")
|
||||
{
|
||||
numMining = numItems = StringParsers.ParseSInt32(_attribute.Value, 0, -1, NumberStyles.Integer);
|
||||
return true;
|
||||
}
|
||||
else if (name == "numItems")
|
||||
{
|
||||
strNumItems = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
else if (name == "itemName")
|
||||
{
|
||||
itemName = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Scripts/MinEvents/NPCs/MinEventActionGiveOrder.cs
Normal file
33
Scripts/MinEvents/NPCs/MinEventActionGiveOrder.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionGiveOrder : MinEventActionTargetedBase
|
||||
{
|
||||
private int order;
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
EntityAliveV2 entity = _params.Self as EntityAliveV2;
|
||||
if (entity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("MinEventActionGiveOrder-Execute order: " + order);
|
||||
entity.Buffs.SetCustomVar("CurrentOrder", order);
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(_attribute);
|
||||
if (!flag)
|
||||
{
|
||||
var name = _attribute.Name;
|
||||
if (name != null)
|
||||
if (name == "order")
|
||||
this.order = int.Parse((_attribute.Value));
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
}
|
||||
14
Scripts/MinEvents/NPCs/MinEventActionGuardHereRebirth.cs
Normal file
14
Scripts/MinEvents/NPCs/MinEventActionGuardHereRebirth.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
public class MinEventActionGuardHereRebirth : MinEventActionTargetedBase
|
||||
{
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
EntityNPCRebirth entityAlive = _params.Self as EntityNPCRebirth;
|
||||
if (entityAlive == null) return;
|
||||
|
||||
if (entityAlive.LeaderUtils.Owner == null) return;
|
||||
|
||||
entityAlive.guardPosition = entityAlive.LeaderUtils.Owner.position;
|
||||
entityAlive.bWillRespawn = true;
|
||||
entityAlive.guardLookPosition = entityAlive.LeaderUtils.Owner.position + entityAlive.LeaderUtils.Owner.GetForwardVector();
|
||||
}
|
||||
}
|
||||
12
Scripts/MinEvents/NPCs/MinEventActionGuardThereRebirth.cs
Normal file
12
Scripts/MinEvents/NPCs/MinEventActionGuardThereRebirth.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
public class MinEventActionGuardThereRebirth : MinEventActionTargetedBase
|
||||
{
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
EntityNPCRebirth entityAlive = _params.Self as EntityNPCRebirth;
|
||||
if (entityAlive == null) return;
|
||||
|
||||
entityAlive.guardPosition = _params.Self.position;
|
||||
entityAlive.bWillRespawn = true;
|
||||
entityAlive.guardLookPosition = _params.Self.position + _params.Self.GetLookVector();
|
||||
}
|
||||
}
|
||||
53
Scripts/MinEvents/NPCs/MinEventActionHideNPCRebirth.cs
Normal file
53
Scripts/MinEvents/NPCs/MinEventActionHideNPCRebirth.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionHideNPCRebirth : MinEventActionTargetedBase
|
||||
{
|
||||
private bool hide;
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
var entity = _params.Self as EntityNPCRebirth;
|
||||
if (entity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float flHidden = entity.Buffs.GetCustomVar("$FR_NPC_Hidden");
|
||||
|
||||
//Log.Out("MinEventActionHideNPCRebirth-Execute flHidden: " + flHidden);
|
||||
|
||||
if (hide)
|
||||
{
|
||||
//Log.Out("MinEventActionHideNPCRebirth-Execute HIDE 1");
|
||||
if (flHidden == 0)
|
||||
{
|
||||
//Log.Out("MinEventActionHideNPCRebirth-Execute HIDE 2");
|
||||
entity.HideNPC(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionHideNPCRebirth-Execute SHOW 1");
|
||||
if (flHidden == 1)
|
||||
{
|
||||
//Log.Out("MinEventActionHideNPCRebirth-Execute SHOW 2");
|
||||
entity.HideNPC(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(_attribute);
|
||||
if (!flag)
|
||||
{
|
||||
var name = _attribute.Name;
|
||||
if (name != null)
|
||||
if (name == "hide")
|
||||
hide = StringParsers.ParseBool(_attribute.Value);
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
}
|
||||
60
Scripts/MinEvents/NPCs/MinEventActionNPCGiveItemRebirth.cs
Normal file
60
Scripts/MinEvents/NPCs/MinEventActionNPCGiveItemRebirth.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionNPCGiveItemRebirth : MinEventActionTargetedBase
|
||||
{
|
||||
private int numItems = 1;
|
||||
private string itemName = "";
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
var myEntity = _params.Self as EntityAlive;
|
||||
if (myEntity == null)
|
||||
return;
|
||||
|
||||
if (myEntity.Buffs.HasBuff("FuriousRamsayNPCSilencer"))
|
||||
{
|
||||
EntityPlayerLocal player = myEntity.world.GetPrimaryPlayer();
|
||||
|
||||
var uiforPlayer = LocalPlayerUI.GetUIForPlayer(player as EntityPlayerLocal);
|
||||
var playerInventory = uiforPlayer.xui.PlayerInventory;
|
||||
if (playerInventory == null) return;
|
||||
|
||||
var item = ItemClass.GetItem(itemName);
|
||||
if (item == null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCGiveItemRebirth: Item Not Found: " + ID);
|
||||
return;
|
||||
}
|
||||
var itemStack = new ItemStack(item, numItems);
|
||||
if (!playerInventory.AddItem(itemStack, true))
|
||||
player.world.gameManager.ItemDropServer(itemStack, player.GetPosition(), Vector3.zero);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(_attribute);
|
||||
if (flag) return true;
|
||||
var name = _attribute.Name;
|
||||
|
||||
if (name == null)
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
else if (name == "numItems")
|
||||
{
|
||||
numItems = Int32.Parse(_attribute.Value);
|
||||
return true;
|
||||
}
|
||||
else if (name == "itemName")
|
||||
{
|
||||
itemName = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
314
Scripts/MinEvents/NPCs/MinEventActionNPCSoundTrigger.cs
Normal file
314
Scripts/MinEvents/NPCs/MinEventActionNPCSoundTrigger.cs
Normal file
@@ -0,0 +1,314 @@
|
||||
using Audio;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionNPCSoundTrigger : MinEventActionBuffModifierBase
|
||||
{
|
||||
string strAction = "";
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute strAction: " + strAction);
|
||||
|
||||
if (_params.Self is EntityNPCRebirth)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 1");
|
||||
EntityNPCRebirth npc = (EntityNPCRebirth)_params.Self;
|
||||
|
||||
if (npc != null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute npc: " + npc.EntityClass.entityClassName);
|
||||
|
||||
if (this.targets[0] != null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 2");
|
||||
if (strAction == "onOtherAttackedSelf")
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3");
|
||||
|
||||
if (this.targets[0].HasAllTags(FastTags<TagGroup.Global>.Parse("bandit,ranged")) &&
|
||||
!npc.Buffs.HasBuff("FuriousRamsayNPCCanSeeTarget") &&
|
||||
!npc.Buffs.HasBuff("FuriousRamsayNPCOtherDamagedSelf")
|
||||
)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3a");
|
||||
npc.Buffs.AddBuff("FuriousRamsayNPCOtherAttackedSelf");
|
||||
|
||||
List<string> myTags = npc.EntityTags.GetTagNames();
|
||||
List<string> myRandomSounds = new List<string>();
|
||||
|
||||
foreach (string tag in myTags)
|
||||
{
|
||||
if (tag.Contains("-OAS-"))
|
||||
{
|
||||
myRandomSounds.Add(tag);
|
||||
}
|
||||
}
|
||||
|
||||
if (myRandomSounds.Count > 0)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3b");
|
||||
int index = UnityEngine.Random.Range(0, myRandomSounds.Count - 1);
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3c");
|
||||
if (npc.LeaderUtils.Owner != null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3d");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3e");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3f");
|
||||
if (npc.LeaderUtils.Owner != null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3d");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3e");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strAction == "onOtherDamagedSelf")
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 4");
|
||||
|
||||
if (this.targets[0].HasAllTags(FastTags<TagGroup.Global>.Parse("bandit,ranged")) &&
|
||||
!npc.Buffs.HasBuff("FuriousRamsayNPCCanSeeTarget") &&
|
||||
!npc.Buffs.HasBuff("FuriousRamsayNPCOtherAttackedSelf") &&
|
||||
!npc.Buffs.HasBuff("FuriousRamsayNPCOtherDamagedSelf")
|
||||
)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 4a");
|
||||
npc.Buffs.AddBuff("FuriousRamsayNPCOtherDamagedSelf");
|
||||
|
||||
List<string> myTags = npc.EntityTags.GetTagNames();
|
||||
List<string> myRandomSounds = new List<string>();
|
||||
|
||||
foreach (string tag in myTags)
|
||||
{
|
||||
if (tag.Contains("-ODS-"))
|
||||
{
|
||||
myRandomSounds.Add(tag);
|
||||
}
|
||||
}
|
||||
|
||||
if (myRandomSounds.Count > 0)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 4b");
|
||||
int index = UnityEngine.Random.Range(0, myRandomSounds.Count - 1);
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 4c");
|
||||
if (npc.LeaderUtils.Owner != null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 4d");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
//Manager.BroadcastPlay(leader.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 4e");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 4f");
|
||||
//var leader = EntityUtilities.GetLeaderOrOwner(npc.entityId) as EntityAlive;
|
||||
|
||||
if (npc.LeaderUtils.Owner != null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3d");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3e");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (strAction == "onSelfKilledOther" && !RebirthUtilities.IsHordeNight())
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 5");
|
||||
|
||||
if (!npc.Buffs.HasBuff("FuriousRamsayNPCCanSeeTarget") &&
|
||||
!npc.Buffs.HasBuff("FuriousRamsayNPCSelfKilledOther")
|
||||
)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 5a");
|
||||
npc.Buffs.AddBuff("FuriousRamsayNPCSelfKilledOther");
|
||||
npc.Buffs.AddBuff("FuriousRamsayNPCSelfKilledOtherKillingSpree");
|
||||
|
||||
List<string> myTags = npc.EntityTags.GetTagNames();
|
||||
List<string> myRandomSounds = new List<string>();
|
||||
|
||||
foreach (string tag in myTags)
|
||||
{
|
||||
if (tag.Contains("-SKOD-"))
|
||||
{
|
||||
myRandomSounds.Add(tag);
|
||||
}
|
||||
}
|
||||
|
||||
if (myRandomSounds.Count > 0)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 5b");
|
||||
int index = UnityEngine.Random.Range(0, myRandomSounds.Count - 1);
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 5c");
|
||||
if (npc.LeaderUtils.Owner != null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 5d");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 5e");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 5f");
|
||||
|
||||
if (npc.LeaderUtils.Owner != null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3d");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3e");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (strAction == "killingSpree")
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 6");
|
||||
|
||||
if (!npc.Buffs.HasBuff("FuriousRamsayNPCCanSeeTarget") &&
|
||||
!(npc.Buffs.HasBuff("FuriousRamsayNPCKillingSpree") || npc.Buffs.HasBuff("FuriousRamsayNPCKillingSpreeHN") || npc.Buffs.HasBuff("FuriousRamsayNPCSelfKilledOtherKillingSpree"))
|
||||
)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 6a");
|
||||
|
||||
npc.killingSpree = npc.killingSpree + 1;
|
||||
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute npc.killingSpree: " + npc.killingSpree);
|
||||
|
||||
if (npc.killingSpree < 3)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 6a1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (RebirthUtilities.IsHordeNight())
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 6a2");
|
||||
npc.Buffs.AddBuff("FuriousRamsayNPCKillingSpreeHN");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 6a3");
|
||||
npc.Buffs.AddBuff("FuriousRamsayNPCKillingSpree");
|
||||
}
|
||||
|
||||
List<string> myTags = npc.EntityTags.GetTagNames();
|
||||
List<string> myRandomSounds = new List<string>();
|
||||
|
||||
foreach (string tag in myTags)
|
||||
{
|
||||
if (tag.Contains("-KS-"))
|
||||
{
|
||||
myRandomSounds.Add(tag);
|
||||
}
|
||||
}
|
||||
|
||||
if (myRandomSounds.Count > 0)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 6b");
|
||||
int index = UnityEngine.Random.Range(0, myRandomSounds.Count - 1);
|
||||
|
||||
if (SingletonMonoBehaviour<ConnectionManager>.Instance.IsSinglePlayer)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 6c");
|
||||
if (npc.LeaderUtils.Owner != null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 6d");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 6e");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 6f");
|
||||
if (npc.LeaderUtils.Owner != null)
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3d");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionNPCSoundTrigger-Execute 3e");
|
||||
Manager.BroadcastPlay(npc.position, myRandomSounds[index], 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
npc.killingSpree = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(_attribute);
|
||||
if (flag) return true;
|
||||
var name = _attribute.Name;
|
||||
|
||||
if (name == null)
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
else if (name == "NPCAction")
|
||||
{
|
||||
strAction = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
90
Scripts/MinEvents/NPCs/MinEventActionRespawnEntity.cs
Normal file
90
Scripts/MinEvents/NPCs/MinEventActionRespawnEntity.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
public class MinEventActionRespawnEntity : MinEventActionTargetedBase
|
||||
{
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute START");
|
||||
|
||||
if (!GameManager.IsDedicatedServer)
|
||||
{
|
||||
EntityNPCRebirth entity = _params.Self as EntityNPCRebirth;
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute Entity: " + entity.EntityName);
|
||||
if (entity == null)
|
||||
{
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity.LeaderUtils.Owner)
|
||||
{
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute flLeader: " + flLeader);
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute 3");
|
||||
float flX = 0; //entity.Buffs.GetCustomVar("$FR_NPC_RespawnX");
|
||||
float flY = 0; //entity.Buffs.GetCustomVar("$FR_NPC_RespawnY");
|
||||
float flZ = 0; //entity.Buffs.GetCustomVar("$FR_NPC_RespawnZ");
|
||||
float flRotY = 0; //entity.Buffs.GetCustomVar("$FR_NPC_RespawnRotY");
|
||||
|
||||
foreach (RebirthManager.hireInfo hire in RebirthManager.playerHires)
|
||||
{
|
||||
if (hire.hireID == entity.entityId)
|
||||
{
|
||||
flX = hire.reSpawnPosition.x;
|
||||
flY = hire.reSpawnPosition.y;
|
||||
flZ = hire.reSpawnPosition.z;
|
||||
flRotY = hire.reSpawnRotation.y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute X: " + flX);
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute Y: " + flY);
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute Z: " + flZ);
|
||||
|
||||
if (flX != 0 && flY != 0 && flZ != 0)
|
||||
{
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute 4");
|
||||
Vector3 vector = new Vector3(flX, flY, flZ);
|
||||
|
||||
if (entity.PhysicsTransform != null)
|
||||
{
|
||||
entity.PhysicsTransform.gameObject.layer = 15;
|
||||
}
|
||||
entity.emodel.SetAlive();
|
||||
|
||||
entity.motion = Vector3.zero;
|
||||
entity.navigator?.clearPath();
|
||||
entity.moveHelper?.Stop();
|
||||
entity.speedForward = 0;
|
||||
entity.speedStrafe = 0;
|
||||
//entity.motion = Vector3.zero;
|
||||
//entity.navigator?.clearPath();
|
||||
entity.LeaderUtils.IsTeleporting = true;
|
||||
entity.isHirable = false;
|
||||
entity.SetPosition(vector, true);
|
||||
entity.rotation.y = flRotY;
|
||||
entity.ClearDamagedTarget();
|
||||
entity.ClearStun();
|
||||
entity.numReposition = 1;
|
||||
|
||||
entity.LeaderUtils.IsTeleporting = false;
|
||||
|
||||
entity.Buffs.AddBuff("FuriousRamsayDeathParticle");
|
||||
|
||||
entity.Buffs.SetCustomVar("$FR_NPC_RespawnCommandActivation", 0);
|
||||
////Log.Out("MinEventActionRespawnEntity-Execute EntityID: " + entity.entityId);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute 5");
|
||||
entity.bWillRespawn = false;
|
||||
GameManager.Instance.World.RemoveEntity(entity.entityId, EnumRemoveEntityReason.Unloaded);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventActionRespawnEntity-Execute 7");
|
||||
entity.bWillRespawn = false;
|
||||
GameManager.Instance.World.RemoveEntity(entity.entityId, EnumRemoveEntityReason.Unloaded);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
81
Scripts/MinEvents/NPCs/MinEventActionReturnNPCFromRebirth.cs
Normal file
81
Scripts/MinEvents/NPCs/MinEventActionReturnNPCFromRebirth.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionReturnNPCFromRebirth : MinEventActionTargetedBase
|
||||
{
|
||||
private bool hide;
|
||||
private string task = "";
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
//Log.Out("MinEventActionReturnNPCFromRebirth-Execute");
|
||||
|
||||
switch (task)
|
||||
{
|
||||
case null:
|
||||
//Log.Out("MinEventActionReturnNPCFromRebirth-Execute 1");
|
||||
return;
|
||||
case "mine":
|
||||
{
|
||||
var entity = _params.Self as EntityNPCRebirth;
|
||||
if (entity == null)
|
||||
{
|
||||
//Log.Out("MinEventActionReturnNPCFromRebirth-Execute 2");
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("MinEventActionReturnNPCFromRebirth-Execute 3");
|
||||
entity.bMine = false;
|
||||
entity.HideNPC(false);
|
||||
return;
|
||||
}
|
||||
case "repair":
|
||||
{
|
||||
var entity = _params.Self as EntityPlayerLocal;
|
||||
if (entity == null)
|
||||
{
|
||||
//Log.Out("MinEventActionReturnNPCFromRebirth-Execute 4");
|
||||
return;
|
||||
}
|
||||
|
||||
//Log.Out("MinEventActionReturnNPCFromRebirth-Execute 5");
|
||||
|
||||
float flRepairNPCID = entity.Buffs.GetCustomVar("$FR_NPC_Repair");
|
||||
//Log.Out("$varFuriousRamsayHelpRepairNPC: " + flRepairNPCID);
|
||||
|
||||
var myNPC = entity.world.GetEntity((int)flRepairNPCID) as EntityNPCRebirth;
|
||||
if (myNPC)
|
||||
{
|
||||
//Log.Out("MinEventActionReturnNPCFromRebirth-Execute 6");
|
||||
myNPC.bRepair = false;
|
||||
myNPC.HideNPC(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
default:
|
||||
//Log.Out("MinEventActionReturnNPCFromRebirth-Execute 5");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(_attribute);
|
||||
if (flag) return true;
|
||||
var name = _attribute.Name;
|
||||
|
||||
if (name == null)
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
else if (name == "task")
|
||||
{
|
||||
task = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
76
Scripts/MinEvents/NPCs/MinEventActionSendNPCForRebirth.cs
Normal file
76
Scripts/MinEvents/NPCs/MinEventActionSendNPCForRebirth.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System.Xml.Linq;
|
||||
|
||||
public class MinEventActionSendNPCForRebirth : MinEventActionTargetedBase
|
||||
{
|
||||
private bool hide;
|
||||
private string task = "";
|
||||
private float duration = 600;
|
||||
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
//Log.Out("MinEventActionSendNPCForRebirth-Execute START");
|
||||
|
||||
var entity = _params.Self as EntityNPCRebirth;
|
||||
if (entity == null)
|
||||
{
|
||||
//Log.Out("MinEventActionSendNPCForRebirth-Execute 1");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (task)
|
||||
{
|
||||
case null:
|
||||
//Log.Out("MinEventActionSendNPCForRebirth-Execute 2");
|
||||
return;
|
||||
case "mine":
|
||||
{
|
||||
//Log.Out("MinEventActionSendNPCForRebirth-Execute 3");
|
||||
entity.GameTimerTicks = GameTimer.Instance.ticks;
|
||||
entity.HideDuration = ((int)GameManager.Instance.World.worldTime / GameStats.GetInt(EnumGameStats.TimeOfDayIncPerSec)) + duration;
|
||||
//Log.Out("MinEventActionSendNPCForRebirth-Execute entity.HideDuration: " + entity.HideDuration);
|
||||
entity.bMine = true;
|
||||
entity.HideNPC(true);
|
||||
return;
|
||||
}
|
||||
case "repair":
|
||||
{
|
||||
//Log.Out("MinEventActionSendNPCForRebirth-Execute 4");
|
||||
entity.GameTimerTicks = GameTimer.Instance.ticks;
|
||||
entity.HideDuration = ((int)GameManager.Instance.World.worldTime / GameStats.GetInt(EnumGameStats.TimeOfDayIncPerSec)) + duration;
|
||||
entity.bRepair = true;
|
||||
entity.HideNPC(true);
|
||||
return;
|
||||
}
|
||||
default:
|
||||
//Log.Out("MinEventActionSendNPCForRebirth-Execute 5");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ParseXmlAttribute(XAttribute _attribute)
|
||||
{
|
||||
var flag = base.ParseXmlAttribute(_attribute);
|
||||
if (flag) return true;
|
||||
var name = _attribute.Name;
|
||||
|
||||
if (name == null)
|
||||
{
|
||||
return flag;
|
||||
}
|
||||
else if (name == "task")
|
||||
{
|
||||
task = _attribute.Value;
|
||||
return true;
|
||||
}
|
||||
else if (name == "duration")
|
||||
{
|
||||
duration = float.Parse(_attribute.Value); //Convert.ToUInt64(_attribute.Value) * 20UL;
|
||||
//Log.Out("MinEventActionSendNPCForRebirth-ParseXmlAttribute duration: " + duration);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Scripts/MinEvents/NPCs/MinEventActionSetPositionRebirth.cs
Normal file
21
Scripts/MinEvents/NPCs/MinEventActionSetPositionRebirth.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
public class MinEventActionSetPositionRebirth : MinEventActionRemoveBuff
|
||||
{
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
for (var i = 0; i < targets.Count; i++)
|
||||
{
|
||||
var entity = targets[i];
|
||||
if (entity != null)
|
||||
{
|
||||
foreach (RebirthManager.hireInfo hire in RebirthManager.playerHires)
|
||||
{
|
||||
if (hire.hireID == entity.entityId)
|
||||
{
|
||||
hire.reSpawnPosition = entity.position;
|
||||
hire.reSpawnRotation = entity.rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
public class MinEventActionVerifyNPCActionsRebirth : MinEventActionRemoveBuff
|
||||
{
|
||||
public override void Execute(MinEventParams _params)
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute START");
|
||||
var entity = _params.Self as EntityAlive;
|
||||
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute BUF ENTITY: " + entity.EntityClass.entityClassName);
|
||||
|
||||
if (entity is EntityPlayerLocal)
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute ENTITY IS PLAYER");
|
||||
EntityPlayerLocal ___entityPlayerLocal = (EntityPlayerLocal)entity;
|
||||
|
||||
float flMode = ___entityPlayerLocal.Buffs.GetCustomVar("varNPCModMode");
|
||||
float flHalt = ___entityPlayerLocal.Buffs.GetCustomVar("varNPCModStopAttacking");
|
||||
|
||||
for (int j = 0; j < ___entityPlayerLocal.Companions.Count; j++)
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute j: " + j);
|
||||
var entityNPC = ___entityPlayerLocal.Companions[j] as EntityNPCRebirth;
|
||||
if (entityNPC != null)
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute entityNPC: " + entityNPC.EntityClass.entityClassName);
|
||||
if (flMode == 0)
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 1");
|
||||
entityNPC.Buffs.AddBuff("buffNPCModFullControlMode");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 2");
|
||||
entityNPC.Buffs.RemoveBuff("buffNPCModFullControlMode");
|
||||
}
|
||||
|
||||
if (flHalt == 1)
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 3");
|
||||
entityNPC.Buffs.AddBuff("buffNPCModStopAttacking");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 4");
|
||||
entityNPC.Buffs.RemoveBuff("buffNPCModStopAttacking");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute ENTITY IS NPC");
|
||||
|
||||
EntityNPCRebirth entityNPC = (EntityNPCRebirth)entity;
|
||||
|
||||
if (entityNPC.LeaderUtils.Owner)
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 6");
|
||||
float flMode = entityNPC.LeaderUtils.Owner.Buffs.GetCustomVar("varNPCModMode");
|
||||
float flHalt = entityNPC.LeaderUtils.Owner.Buffs.GetCustomVar("varNPCModStopAttacking");
|
||||
|
||||
if (flMode == 0)
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 7");
|
||||
entityNPC.Buffs.AddBuff("buffNPCModFullControlMode");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 8");
|
||||
entityNPC.Buffs.RemoveBuff("buffNPCModFullControlMode");
|
||||
}
|
||||
|
||||
if (flHalt == 1)
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 9");
|
||||
entityNPC.Buffs.AddBuff("buffNPCModStopAttacking");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Log.Out("MinEventVerifyNPCActionsRebirth-Execute 10");
|
||||
entityNPC.Buffs.RemoveBuff("buffNPCModStopAttacking");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user