예제 #1
0
        public static EquipmentSetDesc FromElem(ushort type, XElement setElem, out ushort skinType)
        {
            skinType = 0;

            var activate = new List <ActivateEffect>();

            foreach (XElement i in setElem.Elements("ActivateOnEquipAll"))
            {
                var ae = new ActivateEffect(i);
                activate.Add(ae);

                if (ae.SkinType != 0)
                {
                    skinType = ae.SkinType;
                }
            }

            var setpiece = new List <Setpiece>();

            foreach (XElement i in setElem.Elements("Setpiece"))
            {
                setpiece.Add(new Setpiece(i));
            }

            var eqSet = new EquipmentSetDesc();

            eqSet.Type = type;
            eqSet.Id   = setElem.Attribute("id").Value;
            eqSet.ActivateOnEquipAll = activate.ToArray();
            eqSet.Setpieces          = setpiece.ToArray();

            return(eqSet);
        }
예제 #2
0
파일: XmlData.cs 프로젝트: fiowb/RotMG-RPG
        private void AddEquipmentSets(XElement root)
        {
            foreach (var elem in root.XPathSelectElements("//EquipmentSet"))
            {
                string id = elem.Attribute("id").Value;

                ushort type;
                var    typeAttr = elem.Attribute("type");
                type = (ushort)Utils.FromString(typeAttr.Value);

                if (type2id_equipSet.ContainsKey(type))
                {
                    log.WarnFormat("'{0}' and '{1}' has the same ID of 0x{2:x4}!", id, type2id_equipSet[type], type);
                }
                if (id2type_equipSet.ContainsKey(id))
                {
                    log.WarnFormat("0x{0:x4} and 0x{1:x4} has the same name of {2}!", type, id2type_equipSet[id], id);
                }

                type2id_equipSet[type]   = id;
                id2type_equipSet[id]     = type;
                type2elem_equipSet[type] = elem;

                ushort skinType;
                equipmentSets[type] = EquipmentSetDesc.FromElem(type, elem, out skinType);

                if (skinType != 0)
                {
                    if (skinType2equipSetType.ContainsKey(skinType))
                    {
                        log.WarnFormat("'{0}' and '{1}' has the same skinType of 0x{2:x4}!",
                                       id, type2id_equipSet[skinType2equipSetType[skinType]], skinType);
                    }

                    skinType2equipSetType[skinType] = type;
                }
            }
        }