Beispiel #1
0
        public override void ReadBinary(ESPReader reader)
        {
            List <string> readTags = new List <string>();

            while (reader.BaseStream.Position < reader.BaseStream.Length)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "PRKE":
                    if (readTags.Contains("PRKE"))
                    {
                        return;
                    }
                    Header.ReadBinary(reader);
                    break;

                case "DATA":
                    if (readTags.Contains("DATA"))
                    {
                        return;
                    }

                    switch (Header.Type)
                    {
                    case PerkType.QuestStage:
                        EffectData = new PerkQuestStageData();
                        break;

                    case PerkType.Ability:
                        EffectData = new PerkAbilityData();
                        break;

                    case PerkType.EntryPoint:
                        EffectData = new PerkEntryPointData();
                        break;
                    }

                    EffectData.ReadBinary(reader);
                    break;

                case "PRKC":
                    if (Conditions == null)
                    {
                        Conditions = new List <PerkCondition>();
                    }

                    PerkCondition tempPRKC = new PerkCondition();
                    tempPRKC.ReadBinary(reader);
                    Conditions.Add(tempPRKC);
                    break;

                case "EPFT":
                    if (readTags.Contains("EPFT"))
                    {
                        return;
                    }
                    if (EntryPointFunctionType == null)
                    {
                        EntryPointFunctionType = new SimpleSubrecord <EntryPointFunctionType>();
                    }

                    EntryPointFunctionType.ReadBinary(reader);
                    break;

                case "EPFD":
                    if (readTags.Contains("EPFD"))
                    {
                        return;
                    }
                    switch (EntryPointFunctionType.Value)
                    {
                    case Enums.EntryPointFunctionType.None:
                        EntryPointFunctionData = new SimpleSubrecord <byte[]>();
                        break;

                    case Enums.EntryPointFunctionType.Float:
                        EntryPointFunctionData = new SimpleSubrecord <float>();
                        break;

                    case Enums.EntryPointFunctionType.FloatFloat:
                        EntryPointFunctionData = new EntryPointRandRange();
                        break;

                    case Enums.EntryPointFunctionType.LeveledItem:
                        EntryPointFunctionData = new RecordReference();
                        break;

                    case Enums.EntryPointFunctionType.Script:
                        EntryPointFunctionData = new SimpleSubrecord <byte[]>();
                        break;

                    case Enums.EntryPointFunctionType.ActorValueMult:
                        EntryPointFunctionData = new EntryPointActorValMult();
                        break;
                    }

                    EntryPointFunctionData.ReadBinary(reader);
                    break;

                case "EPF2":
                    if (readTags.Contains("EPF2"))
                    {
                        return;
                    }
                    if (ButtonLabel == null)
                    {
                        ButtonLabel = new SimpleSubrecord <String>();
                    }

                    ButtonLabel.ReadBinary(reader);
                    break;

                case "EPF3":
                    if (readTags.Contains("EPF3"))
                    {
                        return;
                    }
                    if (RunImmediately == null)
                    {
                        RunImmediately = new SimpleSubrecord <NoYesShort>();
                    }

                    RunImmediately.ReadBinary(reader);
                    break;

                case "SCHR":
                    if (readTags.Contains("SCHR"))
                    {
                        return;
                    }
                    if (Script == null)
                    {
                        Script = new EmbeddedScript();
                    }

                    Script.ReadBinary(reader);
                    break;

                case "PRKF":
                    if (readTags.Contains("PRKF"))
                    {
                        return;
                    }
                    if (EndMarker == null)
                    {
                        EndMarker = new SubMarker();
                    }

                    EndMarker.ReadBinary(reader);
                    break;

                default:
                    return;
                }

                readTags.Add(subTag);
            }
        }
Beispiel #2
0
        public override void ReadXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("Header", false, out subEle))
            {
                if (Header == null)
                {
                    Header = new PerkEffectHeader();
                }

                Header.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("EffectData", false, out subEle))
            {
                switch (Header.Type)
                {
                case PerkType.QuestStage:
                    EffectData = new PerkQuestStageData();
                    break;

                case PerkType.Ability:
                    EffectData = new PerkAbilityData();
                    break;

                case PerkType.EntryPoint:
                    EffectData = new PerkEntryPointData();
                    break;
                }

                EffectData.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Conditions", false, out subEle))
            {
                if (Conditions == null)
                {
                    Conditions = new List <PerkCondition>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    PerkCondition temp = new PerkCondition();
                    temp.ReadXML(e, master);
                    Conditions.Add(temp);
                }
            }
            if (ele.TryPathTo("EntryPoint/FunctionType", false, out subEle))
            {
                if (EntryPointFunctionType == null)
                {
                    EntryPointFunctionType = new SimpleSubrecord <EntryPointFunctionType>();
                }

                EntryPointFunctionType.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("EntryPoint/FunctionData", false, out subEle))
            {
                switch (EntryPointFunctionType.Value)
                {
                case Enums.EntryPointFunctionType.None:
                    EntryPointFunctionData = new SimpleSubrecord <byte[]>();
                    break;

                case Enums.EntryPointFunctionType.Float:
                    EntryPointFunctionData = new SimpleSubrecord <float>();
                    break;

                case Enums.EntryPointFunctionType.FloatFloat:
                    EntryPointFunctionData = new EntryPointRandRange();
                    break;

                case Enums.EntryPointFunctionType.LeveledItem:
                    EntryPointFunctionData = new RecordReference();
                    break;

                case Enums.EntryPointFunctionType.Script:
                    EntryPointFunctionData = new SimpleSubrecord <byte[]>();
                    break;

                case Enums.EntryPointFunctionType.ActorValueMult:
                    EntryPointFunctionData = new EntryPointActorValMult();
                    break;
                }

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

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

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

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

                EndMarker.ReadXML(subEle, master);
            }
        }
Beispiel #3
0
 public PerkCondition(PerkCondition copyObject)
 {
 }