示例#1
0
    // Deserialize and check Eqdp Entries and add them to the list if they are non-default.
    private void DeserializeEqdpEntries(MetaFileInfo metaFileInfo, byte[]?data)
    {
        if (data == null)
        {
            return;
        }

        var num = data.Length / 5;

        using var reader = new BinaryReader(new MemoryStream(data));
        for (var i = 0; i < num; ++i)
        {
            // Use the SE gender/race code.
            var gr        = ( GenderRace )reader.ReadUInt32();
            var byteValue = reader.ReadByte();
            if (!gr.IsValid() || !metaFileInfo.EquipSlot.IsEquipment() && !metaFileInfo.EquipSlot.IsAccessory())
            {
                continue;
            }

            var value = Eqdp.FromSlotAndBits(metaFileInfo.EquipSlot, (byteValue & 1) == 1, (byteValue & 2) == 2);
            var def   = new EqdpManipulation(ExpandedEqdpFile.GetDefault(gr, metaFileInfo.EquipSlot.IsAccessory(), metaFileInfo.PrimaryId),
                                             metaFileInfo.EquipSlot,
                                             gr.Split().Item1, gr.Split().Item2, metaFileInfo.PrimaryId);
            var manip = new EqdpManipulation(value, metaFileInfo.EquipSlot, gr.Split().Item1, gr.Split().Item2, metaFileInfo.PrimaryId);
            if (def.Entry != manip.Entry)
            {
                MetaManipulations.Add(manip);
            }
        }
    }
示例#2
0
        public bool ApplyMod(EqdpManipulation m, IMod mod)
        {
#if USE_EQDP
            Manipulations[m] = mod;
            var file = Files[Array.IndexOf(CharacterUtility.EqdpIndices, m.FileIndex())] ??=
                       new ExpandedEqdpFile(Names.CombinedRace(m.Gender, m.Race), m.Slot.IsAccessory()); // TODO: female Hrothgar
            return(m.Apply(file));
#else
            return(false);
#endif
        }
示例#3
0
        public bool RevertMod(EqdpManipulation m)
        {
#if USE_EQDP
            if (Manipulations.Remove(m))
            {
                var def   = ExpandedEqdpFile.GetDefault(Names.CombinedRace(m.Gender, m.Race), m.Slot.IsAccessory(), m.SetId);
                var file  = Files[Array.IndexOf(CharacterUtility.EqdpIndices, m.FileIndex())] !;
                var manip = new EqdpManipulation(def, m.Slot, m.Gender, m.Race, m.SetId);
                return(manip.Apply(file));
            }
#endif
            return(false);
        }