Ejemplo n.º 1
0
        /// <summary>
        /// Constructor used to create a SpawnZone for a Unique Entity in the EntityCreationManager.
        /// </summary>
        public SpawnZone(Facet facet, ZUniqueEntity zUnique, NPC npc, short landID, short mapID, int spawnZ, bool limitToWater)
        {
            m_enabled = true;
            m_zoneID  = CreateUniqueSpawnZoneID(facet);

            if (m_zoneID < 0)
            {
                Utils.Log("Failed to create new Unique Entity SpawnZone from EntityCreationManager. Invalid ZoneID.", Utils.LogType.SystemWarning);
                return;
            }

            m_npcID        = npc.npcID;
            m_spawnMessage = zUnique.spawnMessage;
            m_npcList      = new List <int>();
            m_landID       = landID;
            m_mapID        = mapID;
            m_spawnX       = zUnique.xCord;
            m_spawnY       = zUnique.yCord;
            m_spawnZ       = spawnZ;
            m_radius       = zUnique.spawnRadius;

            if (!string.IsNullOrEmpty(zUnique.zRange))
            {
                m_spawnZRangeList.AddRange(Utils.ConvertStringToIntArray(zUnique.zRange));
            }

            m_isAutonomous = false;

            // Highly unlikely x and y coordinates will both be 0 -- this means coordinates were not set in the map text file, make it random in EstablishSpawnRadius
            if (m_spawnX == 0 && m_spawnX == 0)
            {
                m_isAutonomous = true;
            }

            m_isUniqueEntity = true;

            EstablishSpawnRadius(limitToWater);

            m_maxAllowed = 1;
            m_spawnTimer = zUnique.spawnTimer;
            m_timer      = 10000; // ???
        }
Ejemplo n.º 2
0
        public ZAutonomy(string zPlaneName, string info)
        {
            this.m_zPlaneName      = zPlaneName;
            this.uniqueEntities    = new List <ZUniqueEntity>();
            this.artifacts         = new List <ZArtifact>();
            this.guardZone         = false;
            this.genderExclusive   = Globals.eGender.Random;
            this.spawnIntensityMod = 0;
            this.allowChaosPortal  = true;

            foreach (XElement element in XDocument.Parse(info).Descendants())
            {
                if (element.Name == "minimumSuggestedLevel")
                {
                    this.minimumSuggestedLevel = Convert.ToInt32(element.Value);
                }
                else if (element.Name == "maximumSuggestedLevel")
                {
                    this.maximumSuggestedLevel = Convert.ToInt32(element.Value);
                }
                else if (element.Name == "entities")
                {
                    this.entities = element.Value;
                }
                else if (element.Name == "uniqueEntity")
                {
                    foreach (XElement ele in element.Elements())
                    {
                        if (ele.Name == "entity")
                        {
                            EntityLists.Entity entity;

                            if (Enum.TryParse(ele.Value.ToString(), true, out entity))
                            {
                                ZUniqueEntity zUnique = new ZUniqueEntity(entity, ele.ElementsAfterSelf());

                                this.uniqueEntities.Add(zUnique);
                            }
                        }
                    }
                }
                else if (element.Name == "artifact")
                {
                    ZArtifact zArtifact = new ZArtifact(element.DescendantNodes());

                    this.artifacts.Add(zArtifact);
                }
                else if (element.Name.ToString().ToLower() == "spawnintensitymod")
                {
                    this.spawnIntensityMod = Convert.ToInt32(element.Value);
                }
                else if (element.Name == "asocial")
                {
                    this.asocial = Convert.ToBoolean(element.Value);
                }
                else if (element.Name == "guardzone")
                {
                    this.guardZone = Convert.ToBoolean(element.Value);
                }
                else if (element.Name.ToString().ToLower() == "gender")
                {
                    Enum.TryParse <Globals.eGender>(element.Name.ToString(), out this.genderExclusive);
                }
                else if (element.Name == "chaosportal")
                {
                    this.allowChaosPortal = Convert.ToBoolean(element.Value);
                }
            }
        }