示例#1
0
        public static SkillRotatorCollection CreateFromFile(string file)
        {
            SkillRotatorCollection collection = new SkillRotatorCollection();

            using (XmlReader reader = new XmlTextReader(file))
            {
                string value = string.Empty;
                uint   skill = 0;
                uint   prob  = 0;
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case XmlNodeType.Element:
                        switch (reader.Name.ToUpperInvariant())
                        {
                        case "SKILL": uint.TryParse(reader["probability"], out prob); break;
                        }
                        break;

                    case XmlNodeType.Text:
                        value = reader.Value;
                        break;

                    case XmlNodeType.EndElement:
                        switch (reader.Name.ToUpperInvariant())
                        {
                        case "SKILL": uint.TryParse(value, out skill);
                            collection.AddSkill(skill, prob);
                            break;
                        }
                        break;
                    }
                }
            }

            return(collection);
        }
示例#2
0
        public static SkillRotatorCollection CreateFromFile(string file)
        {
            SkillRotatorCollection collection = new SkillRotatorCollection();
            using (XmlReader reader = new XmlTextReader(file))
            {
                string value = string.Empty;
                uint skill = 0;
                uint prob = 0;
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element:
                            switch (reader.Name.ToUpperInvariant())
                            {
                                case "SKILL": uint.TryParse(reader["probability"], out prob); break;
                            }
                            break;

                        case XmlNodeType.Text:
                            value = reader.Value;
                            break;

                        case XmlNodeType.EndElement:
                            switch (reader.Name.ToUpperInvariant())
                            {
                                case "SKILL": uint.TryParse(value, out skill);
                                    collection.AddSkill(skill, prob);
                                    break;
                            }
                            break;
                    }
                }
            }

            return collection;
        }
示例#3
0
        /// <summary>
        /// Set's the initial spawn coords of the specified point.
        /// </summary>
        /// <param name="startpoint">Startpoint</param>
        public override void OnInitialize(Point startpoint)
        {
            this.RespawnOrigin = startpoint;

            //Create hate & damage table
            hatetable = new HateCollection();
            damagetable = new DamageCollection();

            //Clear collection table
            collection = null;

            //Load skill rotator
            string file = Server.SecurePath("~/mobskills/{0}.xml", this.ModelId);
            string defaultfile = Server.SecurePath("~/mobskills/default.xml");
            if (File.Exists(file))
                skills = SkillRotatorCollection.CreateFromFile(file);
            else if (File.Exists(defaultfile))
                skills = SkillRotatorCollection.CreateFromFile(defaultfile);
            else
                skills = SkillRotatorCollection.Empty;

            //Call base
            base.OnInitialize(startpoint);
        }