예제 #1
0
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("EditorID", false, out subEle))
            {
                if (EditorID == null)
                {
                    EditorID = new SimpleSubrecord <String>();
                }

                EditorID.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ObjectBounds", false, out subEle))
            {
                if (ObjectBounds == null)
                {
                    ObjectBounds = new ObjectBounds();
                }

                ObjectBounds.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Name", false, out subEle))
            {
                if (Name == null)
                {
                    Name = new SimpleSubrecord <String>();
                }

                Name.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Model", false, out subEle))
            {
                if (Model == null)
                {
                    Model = new Model();
                }

                Model.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ActorEffects", false, out subEle))
            {
                if (ActorEffects == null)
                {
                    ActorEffects = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempSPLO = new RecordReference();
                    tempSPLO.ReadXML(e, master);
                    ActorEffects.Add(tempSPLO);
                }
            }
            if (ele.TryPathTo("Unarmed/AttackEffect", false, out subEle))
            {
                if (UnarmedAttackEffect == null)
                {
                    UnarmedAttackEffect = new RecordReference();
                }

                UnarmedAttackEffect.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Unarmed/AttackAnimation", false, out subEle))
            {
                if (UnarmedAttackAnimation == null)
                {
                    UnarmedAttackAnimation = new SimpleSubrecord <UInt16>();
                }

                UnarmedAttackAnimation.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Models", false, out subEle))
            {
                if (Models == null)
                {
                    Models = new SubNullStringList();
                }

                Models.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("TextureHashes", false, out subEle))
            {
                if (TextureHashes == null)
                {
                    TextureHashes = new SimpleSubrecord <Byte[]>();
                }

                TextureHashes.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("BaseStats", false, out subEle))
            {
                if (BaseStats == null)
                {
                    BaseStats = new CreatureBaseStats();
                }

                BaseStats.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Factions", false, out subEle))
            {
                if (Factions == null)
                {
                    Factions = new List <FactionMembership>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    FactionMembership tempSNAM = new FactionMembership();
                    tempSNAM.ReadXML(e, master);
                    Factions.Add(tempSNAM);
                }
            }
            if (ele.TryPathTo("DeathItem", false, out subEle))
            {
                if (DeathItem == null)
                {
                    DeathItem = new RecordReference();
                }

                DeathItem.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("VoiceType", false, out subEle))
            {
                if (VoiceType == null)
                {
                    VoiceType = new RecordReference();
                }

                VoiceType.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Template", false, out subEle))
            {
                if (Template == null)
                {
                    Template = new RecordReference();
                }

                Template.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Destructable", false, out subEle))
            {
                if (Destructable == null)
                {
                    Destructable = new Destructable();
                }

                Destructable.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Script", false, out subEle))
            {
                if (Script == null)
                {
                    Script = new RecordReference();
                }

                Script.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Contents", false, out subEle))
            {
                if (Contents == null)
                {
                    Contents = new List <InventoryItem>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    InventoryItem tempCNTO = new InventoryItem();
                    tempCNTO.ReadXML(e, master);
                    Contents.Add(tempCNTO);
                }
            }
            if (ele.TryPathTo("AIData", false, out subEle))
            {
                if (AIData == null)
                {
                    AIData = new AIData();
                }

                AIData.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Packages", false, out subEle))
            {
                if (Packages == null)
                {
                    Packages = new List <RecordReference>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RecordReference tempPKID = new RecordReference();
                    tempPKID.ReadXML(e, master);
                    Packages.Add(tempPKID);
                }
            }
            if (ele.TryPathTo("Animations", false, out subEle))
            {
                if (Animations == null)
                {
                    Animations = new SubNullStringList();
                }

                Animations.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Data", false, out subEle))
            {
                if (Data == null)
                {
                    Data = new CreatureData();
                }

                Data.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("AttackReach", false, out subEle))
            {
                if (AttackReach == null)
                {
                    AttackReach = new SimpleSubrecord <Byte>();
                }

                AttackReach.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("CombatStyle", false, out subEle))
            {
                if (CombatStyle == null)
                {
                    CombatStyle = new RecordReference();
                }

                CombatStyle.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("BodyPartData", false, out subEle))
            {
                if (BodyPartData == null)
                {
                    BodyPartData = new RecordReference();
                }

                BodyPartData.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("TurningSpeed", false, out subEle))
            {
                if (TurningSpeed == null)
                {
                    TurningSpeed = new SimpleSubrecord <Single>();
                }

                TurningSpeed.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("BaseScale", false, out subEle))
            {
                if (BaseScale == null)
                {
                    BaseScale = new SimpleSubrecord <Single>();
                }

                BaseScale.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("FootWeight", false, out subEle))
            {
                if (FootWeight == null)
                {
                    FootWeight = new SimpleSubrecord <Single>();
                }

                FootWeight.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("ImpactMaterialType", false, out subEle))
            {
                if (ImpactMaterialType == null)
                {
                    ImpactMaterialType = new SimpleSubrecord <MaterialTypeUInt>();
                }

                ImpactMaterialType.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SoundLevel", false, out subEle))
            {
                if (SoundLevel == null)
                {
                    SoundLevel = new SimpleSubrecord <SoundLevel>();
                }

                SoundLevel.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SoundTemplate", false, out subEle))
            {
                if (SoundTemplate == null)
                {
                    SoundTemplate = new RecordReference();
                }

                SoundTemplate.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("SoundData", false, out subEle))
            {
                if (SoundData == null)
                {
                    SoundData = new List <CreatureSoundData>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    CreatureSoundData tempCSDT = new CreatureSoundData();
                    tempCSDT.ReadXML(e, master);
                    SoundData.Add(tempCSDT);
                }
            }
            if (ele.TryPathTo("ImpactDataset", false, out subEle))
            {
                if (ImpactDataset == null)
                {
                    ImpactDataset = new RecordReference();
                }

                ImpactDataset.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MeleeWeaponList", false, out subEle))
            {
                if (MeleeWeaponList == null)
                {
                    MeleeWeaponList = new RecordReference();
                }

                MeleeWeaponList.ReadXML(subEle, master);
            }
        }
예제 #2
0
        public override void ReadData(ESPReader reader, long dataEnd)
        {
            while (reader.BaseStream.Position < dataEnd)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "EDID":
                    if (EditorID == null)
                    {
                        EditorID = new SimpleSubrecord <String>();
                    }

                    EditorID.ReadBinary(reader);
                    break;

                case "OBND":
                    if (ObjectBounds == null)
                    {
                        ObjectBounds = new ObjectBounds();
                    }

                    ObjectBounds.ReadBinary(reader);
                    break;

                case "FULL":
                    if (Name == null)
                    {
                        Name = new SimpleSubrecord <String>();
                    }

                    Name.ReadBinary(reader);
                    break;

                case "MODL":
                    if (Model == null)
                    {
                        Model = new Model();
                    }

                    Model.ReadBinary(reader);
                    break;

                case "SPLO":
                    if (ActorEffects == null)
                    {
                        ActorEffects = new List <RecordReference>();
                    }

                    RecordReference tempSPLO = new RecordReference();
                    tempSPLO.ReadBinary(reader);
                    ActorEffects.Add(tempSPLO);
                    break;

                case "EITM":
                    if (UnarmedAttackEffect == null)
                    {
                        UnarmedAttackEffect = new RecordReference();
                    }

                    UnarmedAttackEffect.ReadBinary(reader);
                    break;

                case "EAMT":
                    if (UnarmedAttackAnimation == null)
                    {
                        UnarmedAttackAnimation = new SimpleSubrecord <UInt16>();
                    }

                    UnarmedAttackAnimation.ReadBinary(reader);
                    break;

                case "NIFZ":
                    if (Models == null)
                    {
                        Models = new SubNullStringList();
                    }

                    Models.ReadBinary(reader);
                    break;

                case "NIFT":
                    if (TextureHashes == null)
                    {
                        TextureHashes = new SimpleSubrecord <Byte[]>();
                    }

                    TextureHashes.ReadBinary(reader);
                    break;

                case "ACBS":
                    if (BaseStats == null)
                    {
                        BaseStats = new CreatureBaseStats();
                    }

                    BaseStats.ReadBinary(reader);
                    break;

                case "SNAM":
                    if (Factions == null)
                    {
                        Factions = new List <FactionMembership>();
                    }

                    FactionMembership tempSNAM = new FactionMembership();
                    tempSNAM.ReadBinary(reader);
                    Factions.Add(tempSNAM);
                    break;

                case "INAM":
                    if (DeathItem == null)
                    {
                        DeathItem = new RecordReference();
                    }

                    DeathItem.ReadBinary(reader);
                    break;

                case "VTCK":
                    if (VoiceType == null)
                    {
                        VoiceType = new RecordReference();
                    }

                    VoiceType.ReadBinary(reader);
                    break;

                case "TPLT":
                    if (Template == null)
                    {
                        Template = new RecordReference();
                    }

                    Template.ReadBinary(reader);
                    break;

                case "DEST":
                    if (Destructable == null)
                    {
                        Destructable = new Destructable();
                    }

                    Destructable.ReadBinary(reader);
                    break;

                case "SCRI":
                    if (Script == null)
                    {
                        Script = new RecordReference();
                    }

                    Script.ReadBinary(reader);
                    break;

                case "CNTO":
                    if (Contents == null)
                    {
                        Contents = new List <InventoryItem>();
                    }

                    InventoryItem tempCNTO = new InventoryItem();
                    tempCNTO.ReadBinary(reader);
                    Contents.Add(tempCNTO);
                    break;

                case "AIDT":
                    if (AIData == null)
                    {
                        AIData = new AIData();
                    }

                    AIData.ReadBinary(reader);
                    break;

                case "PKID":
                    if (Packages == null)
                    {
                        Packages = new List <RecordReference>();
                    }

                    RecordReference tempPKID = new RecordReference();
                    tempPKID.ReadBinary(reader);
                    Packages.Add(tempPKID);
                    break;

                case "KFFZ":
                    if (Animations == null)
                    {
                        Animations = new SubNullStringList();
                    }

                    Animations.ReadBinary(reader);
                    break;

                case "DATA":
                    if (Data == null)
                    {
                        Data = new CreatureData();
                    }

                    Data.ReadBinary(reader);
                    break;

                case "RNAM":
                    if (AttackReach == null)
                    {
                        AttackReach = new SimpleSubrecord <Byte>();
                    }

                    AttackReach.ReadBinary(reader);
                    break;

                case "ZNAM":
                    if (CombatStyle == null)
                    {
                        CombatStyle = new RecordReference();
                    }

                    CombatStyle.ReadBinary(reader);
                    break;

                case "PNAM":
                    if (BodyPartData == null)
                    {
                        BodyPartData = new RecordReference();
                    }

                    BodyPartData.ReadBinary(reader);
                    break;

                case "TNAM":
                    if (TurningSpeed == null)
                    {
                        TurningSpeed = new SimpleSubrecord <Single>();
                    }

                    TurningSpeed.ReadBinary(reader);
                    break;

                case "BNAM":
                    if (BaseScale == null)
                    {
                        BaseScale = new SimpleSubrecord <Single>();
                    }

                    BaseScale.ReadBinary(reader);
                    break;

                case "WNAM":
                    if (FootWeight == null)
                    {
                        FootWeight = new SimpleSubrecord <Single>();
                    }

                    FootWeight.ReadBinary(reader);
                    break;

                case "NAM4":
                    if (ImpactMaterialType == null)
                    {
                        ImpactMaterialType = new SimpleSubrecord <MaterialTypeUInt>();
                    }

                    ImpactMaterialType.ReadBinary(reader);
                    break;

                case "NAM5":
                    if (SoundLevel == null)
                    {
                        SoundLevel = new SimpleSubrecord <SoundLevel>();
                    }

                    SoundLevel.ReadBinary(reader);
                    break;

                case "CSCR":
                    if (SoundTemplate == null)
                    {
                        SoundTemplate = new RecordReference();
                    }

                    SoundTemplate.ReadBinary(reader);
                    break;

                case "CSDT":
                    if (SoundData == null)
                    {
                        SoundData = new List <CreatureSoundData>();
                    }

                    CreatureSoundData tempCSDT = new CreatureSoundData();
                    tempCSDT.ReadBinary(reader);
                    SoundData.Add(tempCSDT);
                    break;

                case "CNAM":
                    if (ImpactDataset == null)
                    {
                        ImpactDataset = new RecordReference();
                    }

                    ImpactDataset.ReadBinary(reader);
                    break;

                case "LNAM":
                    if (MeleeWeaponList == null)
                    {
                        MeleeWeaponList = new RecordReference();
                    }

                    MeleeWeaponList.ReadBinary(reader);
                    break;

                default:
                    throw new Exception();
                }
            }
        }