using System.Collections.Generic; using System.Xml.Linq; public class MinEventActionSpawnEntityRebirth : MinEventActionRemoveBuff { private string strEntity = ""; private string entityPos = ""; private string entityRot = ""; private string strDistance = ""; private string strHeight = ""; private string strSpawner = ""; private string strDirection = "random"; private string strSound = ""; private float numStartScale = 0; private int minion = 0; private int numEntities = 1; private int attackPlayer = 0; private int checkMaxEntities = 0; public int minMax = 40; public int maxEntities = 20; public int repeat = 1; public int allNames = 1; public int atPlayerLevel = 0; public int randomRotation = 1; public int numRotation = -1; public int isBoss = -1; public int handParticle = -1; public string lootListName = ""; public string lootDropClass = ""; public int lootDropChance = 1; public string navIcon = ""; public string buffList = ""; public bool forceSpawn = false; public override void Execute(MinEventParams _params) { //Log.Out("MinEventActionSpawnEntityRebirth-Execute START"); /*if (!SingletonMonoBehaviour.Instance.IsServer) { //Log.Out("MinEventActionSpawnEntityRebirth-Execute IS CLIENT"); return; }*/ Vector3 transformPos = MinEventParams.CachedEventParam.Position; int numDistance = 0; int numHeight = 0; if (strDistance != "") { numDistance = Int16.Parse(strDistance); } if (strHeight != "") { numHeight = Int16.Parse(strHeight); } //Log.Out("MinEventActionSpawnEntityRebirth-Execute numDistance: " + numDistance); //Log.Out("MinEventActionSpawnEntityRebirth-Execute numHeight: " + numHeight); //Log.Out("MinEventActionSpawnEntityRebirth-Execute this.targets.Count: " + this.targets.Count); //Log.Out("MinEventActionSpawnEntityRebirth-Execute entityClassName: " + this.targets[0].EntityClass.entityClassName); EntityAlive entity = _params.Self as EntityAlive; EntityAlive entityPlayer = _params.Self as EntityAlive; if (targetType == TargetTypes.other) { entity = this.targets[0]; } if (entity == null) { //Log.Out("MinEventActionSpawnEntityRebirth-Execute 0"); return; } else { //Log.Out("MinEventActionSpawnEntityRebirth-Execute entityPlayer: " + entityPlayer.EntityClass.entityClassName); } if (checkMaxEntities == 1) { List entitiesInBounds = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityZombieSDX), BoundsUtils.BoundsForMinMax(entity.position.x - this.minMax, entity.position.y - 50, entity.position.z - this.minMax, entity.position.x + this.minMax, entity.position.y + 30, entity.position.z + this.minMax), new List()); List entitiesInBounds2 = GameManager.Instance.World.GetEntitiesInBounds(typeof(EntityZombieCopRebirth), BoundsUtils.BoundsForMinMax(entity.position.x - this.minMax, entity.position.y - 50, entity.position.z - this.minMax, entity.position.x + this.minMax, entity.position.y + 30, entity.position.z + this.minMax), new List()); int numEntities = 0; List entities = new List(); foreach (Entity validateEntity in entitiesInBounds) { if (validateEntity != null && !validateEntity.IsDead()) { entities.Add(validateEntity); } } foreach (Entity validateEntity in entitiesInBounds2) { if (validateEntity != null && !validateEntity.IsDead() && !entities.Contains(validateEntity)) { entities.Add(validateEntity); } } foreach (Entity validateEntity in entities) { numEntities++; } //Log.Out("MinEventActionSpawnEntityRebirth-Execute entitiesInBounds.Count: " + (entitiesInBounds.Count + entitiesInBounds2.Count)); if (numEntities > this.maxEntities) { return; } } bool shouldAttackPlayer = false; if (attackPlayer == 1) { shouldAttackPlayer = true; } bool spawnAtPlayerLevel = false; if (atPlayerLevel == 1) { spawnAtPlayerLevel = true; } bool spawnAtRandomRotation = true; if (randomRotation == 0) { spawnAtRandomRotation = false; } //Log.Out("MinEventActionSpawnEntityRebirth-Execute entity: " + entity.EntityClass.entityClassName); //Log.Out("MinEventActionSpawnEntityRebirth-Execute strDistance: " + strDistance); //Log.Out("MinEventActionSpawnEntityRebirth-Execute entityPlayer.entityId: " + entityPlayer.entityId); RebirthUtilities.SpawnEntity(entity.entityId, strEntity, numEntities, entityPos, entityRot, strDistance, strSpawner, strHeight, strDirection, numStartScale, numRotation, spawnAtRandomRotation, spawnAtPlayerLevel, shouldAttackPlayer, entityPlayer.entityId, minion, strSound, maxEntities, checkMaxEntities, minMax, repeat, allNames, isBoss, handParticle, lootListName, lootDropClass, lootDropChance, navIcon, buffList, false, forceSpawn); } 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 == "entityname") { strEntity = _attribute.Value; return true; } else if (name == "numEntities") { numEntities = Int32.Parse(_attribute.Value); return true; } else if (name == "StartScale") { float.TryParse(_attribute.Value, out numStartScale); return true; } else if (name == "distance") { strDistance = _attribute.Value; return true; } else if (name == "height") { strHeight = _attribute.Value; return true; } else if (name == "spawner") { strSpawner = _attribute.Value; return true; } else if (name == "direction") { strDirection = _attribute.Value; return true; } else if (name == "sound") { strSound = _attribute.Value; return true; } else if (name == "minion") { minion = Int32.Parse(_attribute.Value); return true; } else if (name == "checkMaxEntities") { checkMaxEntities = Int32.Parse(_attribute.Value); return true; } else if (name == "minMax") { minMax = int.Parse(_attribute.Value); return true; } else if (name == "maxEntities") { maxEntities = int.Parse(_attribute.Value); return true; } else if (name == "attackPlayer") { attackPlayer = Int32.Parse(_attribute.Value); return true; } else if (name == "repeat") { repeat = int.Parse(_attribute.Value); return true; } else if (name == "allNames") { allNames = int.Parse(_attribute.Value); return true; } else if (name == "atplayerlevel") { atPlayerLevel = int.Parse(_attribute.Value); return true; } else if (name == "rotation") { numRotation = int.Parse(_attribute.Value); return true; } else if (name == "randomRotation") { randomRotation = int.Parse(_attribute.Value); return true; } else if (name == "isBoss") { isBoss = int.Parse(_attribute.Value); return true; } else if (name == "handParticle") { handParticle = int.Parse(_attribute.Value); return true; } else if (name == "lootListName") { lootListName = _attribute.Value; return true; } else if (name == "lootDropClass") { lootDropClass = _attribute.Value; return true; } else if (name == "lootDropChance") { lootDropChance = int.Parse(_attribute.Value); return true; } else if (name == "navIcon") { navIcon = _attribute.Value; return true; } else if (name == "buffList") { buffList = _attribute.Value; return true; } else if (name == "forceSpawn") { if (_attribute.Value == "true") { forceSpawn = true; } return true; } else { return false; } } }