public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                if (PinGuid == null)
                {
                    PinGuid = new byte[0x10];
                }
                io.Write(PinGuid, 0, 0x10);
                if (WorldPos == null)
                {
                    WorldPos = new byte[0xc];
                }
                io.Write(WorldPos, 0, 0xC);
                io.WriteInt16(FloorId);
                io.WriteBoolean(VisibilityOverridden);
                if (VisibilityOverridden)
                {
                    io.WriteBoolean(Visible);
                }
                io.WriteBoolean(DisplayAsDiscovered);
                io.WriteBoolean(DisplayAsExplored);
                io.WriteBoolean(DeadOrDying);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public bool Write(DAIIO io, bool skiplength = false)
 {
     try
     {
         if (!skiplength)
         {
             io.WriteBits(Length, LengthBits);
         }
         io.WriteInt32(Id);
         io.WriteInt32(DestroyedPartsCount);
         io.WriteBoolean(KeepInfoOnUnregister);
         if (PartIds == null)
         {
             PartIds = new int[PartIdsCount];
         }
         io.WriteInt16((short)PartIds.Length);
         foreach (int t in PartIds)
         {
             io.WriteInt32(t);
         }
         io.WriteInt32(BitCount);
         if (BitArray == null)
         {
             BitArray = new byte[BitCount.NumberOfSetBits() << 2];
         }
         io.Write(BitArray, 0, BitArray.Length);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 3
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                if (MapGuid == null)
                {
                    MapGuid = new byte[0x10];
                }
                io.Write(MapGuid, 0, 0X10);
                if (Pins == null)
                {
                    Pins = new DynamicMapPinInfo[PinsCount];

                    for (int xb = 0; xb < PinsCount; xb++)
                    {
                        Pins[xb] = new DynamicMapPinInfo();
                    }
                }
                io.WriteInt16((short)Pins.Length);
                foreach (DynamicMapPinInfo t in Pins)
                {
                    t.Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (PosAndImpacts == null)
                {
                    PosAndImpacts = new byte[DestructionInfoCount][];
                }
                io.WriteInt16((short)PosAndImpacts.Length);
                for (int i = 0; i < PosAndImpacts.Length; i++)
                {
                    if (PosAndImpacts[i] == null)
                    {
                        PosAndImpacts[i] = new byte[0x10];
                    }
                    io.Write(PosAndImpacts[i], 0, 0x10);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBits(Index, 0x8);
                if (FaceVerticesBytes == null)
                {
                    FaceVerticesBytes = new byte[FaceVerticesSize];
                }
                FaceVerticesSize = FaceVerticesBytes.Length;
                io.WriteBits(FaceVerticesSize, 0x20);
                io.Write(FaceVerticesBytes, 0, FaceVerticesSize);
                ////for (int j = 0; j < FaceVerticesSize; j++)
                ////    io.WriteBits(FaceVerticesBytes[j], 0x8);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 6
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBits(Name.Length, 0x10);
                if (Name.Length > 0)
                {
                    io.WriteString(Name);
                    if (Hash == null)
                    {
                        Hash = new byte[0];
                    }
                    io.WriteBits(Hash.Length, 0x10);
                    if (Hash.Length > 0)
                    {
                        io.Write(Hash, 0, Hash.Length);
                    }
                    else if (Unknown != null)
                    {
                        io.Write(Unknown, 0, Unknown.Length);
                    }
                }
                else if (Unknown != null)
                {
                    io.Write(Unknown, 0, Unknown.Length);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public bool Write(DAIIO io, bool skiplength = false)
 {
     if (!skiplength)
     {
         io.WriteBits(Length, LengthBits);
     }
     io.WriteInt32(ID);
     io.WriteBoolean(HasNoGuid);
     if (!HasNoGuid)
     {
         if (Guid == null)
         {
             Guid = new byte[0x10];
         }
         io.Write(Guid, 0, 0X10);
     }
     return(true);
 }
Exemplo n.º 8
0
 public bool Write(DAIIO io, bool skiplength = false)
 {
     try
     {
         io.WriteInt32(PartyMemberID);
         io.WriteInt32(Buffer.Length);
         if (Buffer == null)
         {
             Buffer = new byte[BufferSize];
         }
         io.Write(Buffer, 0, Buffer.Length);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 9
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt32(Version);
                io.WriteInt32(ClassId);
                io.WriteInt32(BackgroundId);
                io.WriteInt32(GenderId);
                io.WriteInt32(RaceId);
                io.WriteInt16((short)CharacterName.Length);
                io.WriteString(CharacterName);
                io.WriteInt32(VoiceVariationID);
                io.WriteInt32(DifficultyModeID);
                if (Version > 9)
                {
                    io.WriteInt32(LowestDifficultyModeID);
                }
                io.WriteInt32(CharacterSubclassID);
                if (Version >= 8)
                {
                    if (CharacterID == null)
                    {
                        CharacterID = new byte[0x10];
                    }
                    io.Write(CharacterID, 0, 0x10);
                }
                if (Version >= 0xD)
                {
                    io.WriteSingle(AgeInRealTimeSeconds);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 10
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBits(HeadOverrideIndex, 0x8);
                io.WriteBits(Gender, 0x8);
                io.WriteBits(Race, 0x8);
                io.WriteBits(Hair, 0x8);
                io.WriteBits(Beard, 0x8);
                if (_data.Version >= 9)
                {
                    io.WriteBits(Horns, 0x8);
                }
                VectorShaderParams.Write(io);
                TextureShaderParams.Write(io);
                if (_data.Version >= 0xF)
                {
                    BodyShaderHandles.Write(io);
                }
                if (_data.Version >= 0xC)
                {
                    if (_data.Version < 0xE)
                    {
                        BoneOffsetsV1.Write(io);
                    }
                    else
                    {
                        BoneOffsetsV2.Write(io);
                    }
                }
                if (_data.Version >= 0x9)
                {
                    if (_data.Version >= 0xB)
                    {
                        HeadVariations.Write(io);
                    }
                    else
                    {
                        if (FaceVerticesBytes == null)
                        {
                            FaceVerticesBytes = new byte[FaceVerticesSize];
                        }
                        FaceVerticesSize = FaceVerticesBytes.Length;
                        io.WriteBits(FaceVerticesSize, 0x20);
                        io.Write(FaceVerticesBytes, 0, FaceVerticesSize);
                    }
                }
                else
                {
                    io.WriteBits(FaceCodeVersion, 0x20);
                    io.WriteInt16((short)FaceCode.Length);
                    io.WriteString(FaceCode);
                }
                if (_data.Version >= 0x10)
                {
                    if (DnaData == null)
                    {
                        DnaData = new byte[DnaSize];
                    }
                    DnaSize = DnaData.Length;
                    io.WriteInt32(DnaSize);
                    for (int j = 0; j < DnaSize; j++)
                    {
                        if (j == (DnaSize - 3))
                        {
                            Console.WriteLine();
                        }
                        io.WriteBits(DnaData[j], 8);
                    }
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }