public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                io.WriteBoolean(IsNull);
                if (!IsNull)
                {
                    io.WriteInt32(Value1);
                    io.WriteInt32(Value2);
                    io.WriteBoolean(DataIsNull);
                    if (!DataIsNull)
                    {
                        if (DataBytes == null)
                        {
                            DataBytes = new byte[0x10];
                        }
                        for (int i = 0; i < 0x10; i++)
                        {
                            io.WriteBits(DataBytes[i], 0x8);
                        }
                    }
                }

                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);
     }
 }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                Offset = io.Position;
                io.WriteInt16(Version);
                if (StatsData == null)
                {
                    StatsData = new ItemAsset();
                }
                StatsData.Write(io);
                if (Version < 8)
                {
                    io.WriteInt32(Uid);
                }
                io.WriteBoolean(IsForSale);
                io.WriteBoolean(IsNew);
                io.WriteBoolean(IsCrafted);
                io.WriteInt32(StringId);
                if (StatsInstance != null)
                {
                    StatsInstance.Write(io);
                    if (Upgrades != null)
                    {
                        Upgrades.Write(io);
                        io.WriteBoolean(SuppressClassRestriction);
                        if (Version > 6)
                        {
                            io.WriteBoolean(IsPlaceHolder);
                        }
                        if (Version > 0xA)
                        {
                            io.WriteBoolean(HasSoundActionsReference);
                            if (HasSoundActionsReference)
                            {
                                SoundActionsReference.Write(io);
                            }
                        }
                    }
                }
                if (StackSize != 0xff)
                {
                    io.WriteBits(StackSize, 0x8);
                }
                if (MaxStackSize != 0xff)
                {
                    io.WriteBits(MaxStackSize, 0x8);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #4
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt32(MapID);
                io.WriteBoolean(IsPersistent);
                io.WriteInt32(UncompressedSize);
                io.WriteBoolean(IsCompressed);
                if (Blob == null)
                {
                    Blob = new byte[Size];
                }
                io.WriteInt32(Blob.Length);
                foreach (byte t in Blob)
                {
                    io.WriteBits(t, 0x8);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #5
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt16(Version);
                if (Version > 0)
                {
                    io.WriteInt16(ActiveJournalCount);
                    if (ActiveJournals == null)
                    {
                        ActiveJournals = new int[ActiveJournalCount];
                    }
                    for (int i = 0; i < ActiveJournalCount; i++)
                    {
                        io.WriteInt32(ActiveJournals[i]);
                    }
                    io.WriteInt16(ReadJournalCount);
                    if (ReadJournals == null)
                    {
                        ReadJournals = new int[ReadJournalCount];
                    }
                    for (int i = 0; i < ReadJournalCount; i++)
                    {
                        io.WriteInt32(ReadJournals[i]);
                    }
                }
                if (Version > 1)
                {
                    io.WriteInt16(RewardedJournalCount);
                    if (RewardedJournals == null)
                    {
                        RewardedJournals = new int[RewardedJournalCount];
                    }
                    for (int i = 0; i < RewardedJournalCount; i++)
                    {
                        io.WriteInt32(RewardedJournals[i]);
                    }
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (_info.Version > 1)
                {
                    io.WriteBoolean(HasDynamicStats);
                    if (HasDynamicStats)
                    {
                        DynamicStats.Write(io);
                    }
                    else if (_info.Version > 3)
                    {
                        DynamicStats.Write(io);
                    }
                }
                else if (_iscrafted)
                {
                    CraftedStatIntances.Write(io);
                }
                if (_info.Version > 9)
                {
                    ItemAbilities.Write(io);
                }
                if (_info.Version < 3)
                {
                    ItemTimelines.Write(io);
                }
                ItemMaterials.Write(io);
                if (_info.Version < 5)
                {
                    CompositionDisplay.Write(io);
                }
                else
                {
                    io.WriteInt16((short)DisplayString.Length);
                    io.WriteString(DisplayString);
                }
                io.WriteInt32(Level);
                io.WriteInt32(DamageType);
                io.WriteInt32(Quality);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #7
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt32(ID);
                if (Controllables == null)
                {
                    Controllables = new SpawnerControllable[ControllableCount];

                    for (int xb = 0; xb < ControllableCount; xb++)
                    {
                        Controllables[xb] = new SpawnerControllable();
                    }
                }
                io.WriteBits(Controllables.Length, 0xA);
                foreach (SpawnerControllable t in Controllables)
                {
                    t.Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                BluePrint.Write(io);
                io.WriteInt32(IndexUsedByUniqueId);
                if (TransForm == null)
                {
                    TransForm = new byte[4][];
                }
                for (int i = 0; i < 4; i++)
                {
                    if (TransForm[i] == null)
                    {
                        TransForm[i] = new byte[0xc];
                    }
                    for (int j = 0; j < 0xc; j++)
                    {
                        io.WriteBits(TransForm[i][j], 0x8);
                    }
                }

                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.WriteInt16(CallbackCount);
                if (Callbacks == null)
                {
                    Callbacks = new CallBackData[CallbackCount];

                    for (int xb = 0; xb < CallbackCount; xb++)
                    {
                        Callbacks[xb] = new CallBackData();
                    }
                }
                for (int i = 0; i < CallbackCount; i++)
                {
                    Callbacks[i].Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #10
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                //if(6 (<-????) > 5)
                //{
                io.WriteInt32(UserWaypoint_MapId);
                if (UserWaypoint_WorldPos == null)
                {
                    UserWaypoint_WorldPos = new byte[8];
                }
                for (int i = 0; i < 8; i++)
                {
                    io.WriteBits(UserWaypoint_WorldPos[i], 0x8);
                }
                FogArchive.Write(io);
                DynamicPinsMaps.Write(io);
                DiscoveredPins.Write(io);
                ExploredPins.Write(io);
                //}

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt32(Version);
                if (Inventories == null)
                {
                    Inventories = new StoreInventory[InventoryCount];

                    for (int xb = 0; xb < InventoryCount; xb++)
                    {
                        Inventories[xb] = new StoreInventory(SStructure);
                    }
                }
                io.WriteInt16((short)Inventories.Length);
                for (int i = 0; i < Inventories.Length; i++)
                {
                    Inventories[i].Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #12
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt32(storeEntitySaveUid);

                if (Items == null)
                {
                    Items = new StoreItemEntry[ItemCount];

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

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public bool Write(DAIIO io, bool skiplength = false)
 {
     try
     {
         if (!skiplength)
         {
             io.WriteBits(Length, LengthBits);
         }
         io.WriteInt32(NameHash);
         io.WriteInt32(Quantity);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #14
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);
     }
 }
Example #15
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBits(PositionPrecision, 0x8);
                io.WriteInt16(PositionCompressionArray);
                if (PositionCompression == null)
                {
                    PositionCompression = new byte[PositionCompressionArray];
                }
                for (int i = 0; i < PositionCompressionArray; i++)
                {
                    io.WriteBits(PositionCompression[i], 0x8);
                }
                io.WriteBits(ImpactPrecision, 8);
                io.WriteInt32(ImpactScale);
                io.WriteInt32(NextCallbackId);
                if (MasterInfoArray == null)
                {
                    MasterInfoArray = new MasterInfo[NextCallbackId];

                    for (int xb = 0; xb < NextCallbackId; xb++)
                    {
                        MasterInfoArray[xb] = new MasterInfo();
                    }
                }
                for (int i = 0; i < NextCallbackId; i++)
                {
                    MasterInfoArray[i].Write(io);
                }
                io.WriteInt32(LastDestructionId);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #16
0
 public bool Write(DAIIO io, bool skiplength = false)
 {
     try
     {
         if (!skiplength)
         {
             io.WriteBits(Length, LengthBits);
         }
         io.WriteInt32(PartyMemberID);
         io.WriteBits(FixedIndex, 8);
         io.WriteInt32(Player);
         io.WriteBoolean(IsLeader);
         io.WriteBoolean(IsUnspawned);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #17
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBoolean(IsInVehicle);
                if (IsInVehicle)
                {
                    io.WriteInt32(InVehicleControllable.ID);
                    io.WriteInt32(InVehicleControllable.EntryID);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #18
0
 public bool Write(DAIIO io, bool skiplength = false)
 {
     try
     {
         io.WriteInt32(NameHash);
         io.WriteBits((uint)Index, 8);
         io.WriteInt16(Entry);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Example #19
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);
            }
        }
Example #20
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBits(InProgress, 0x18);
                io.WriteInt32(MissionArraySize);
                if (MissionArray0 == null)
                {
                    MissionArray0 = new MissionArray[MissionArray0Count];

                    for (int xb = 0; xb < MissionArray0Count; xb++)
                    {
                        MissionArray0[xb] = new MissionArray(SStructure, true);
                    }
                }
                io.WriteInt16((short)MissionArray0.Length);
                for (int i = 0; i < MissionArray0.Length; i++)
                {
                    MissionArray0[i].Write(io);
                }
                io.WriteBits(Completed, 0x18);
                if (MissionArray1 == null)
                {
                    MissionArray1 = new MissionArray[MissionArray1Count];

                    for (int xb = 0; xb < MissionArray1Count; xb++)
                    {
                        MissionArray1[xb] = new MissionArray(SStructure, false);
                    }
                }
                io.WriteInt16((short)MissionArray1.Length);
                for (int i = 0; i < MissionArray1.Length; i++)
                {
                    MissionArray1[i].Write(io);
                }

                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);
 }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt32(Index);
                Asset.Write(io);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt32(ArcheTypeID);
                io.WriteBoolean(Enabled);
                io.WriteBoolean(Unlocked);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (StringIds == null)
                {
                    StringIds = new int[StringIdCount];
                }
                io.WriteInt16((short)StringIds.Length);
                foreach (int t in StringIds)
                {
                    io.WriteInt32(t);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #25
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                io.WriteInt16(PinIdCount);
                if (PinIds == null)
                {
                    PinIds = new int[PinIdCount];
                }
                for (int i = 0; i < PinIdCount; i++)
                {
                    io.WriteInt32(PinIds[i]);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #26
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                if (_isfirst)
                {
                    io.WriteInt32(Index);
                }
                WarTableEntry.Write(io);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #27
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (Guid == null)
                {
                    Guid = new byte[0x10];
                }
                for (int j = 0; j < 0x10; j++)
                {
                    io.WriteBits(Guid[j], 0x8);
                }
                io.WriteInt32(Value);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                io.WriteBoolean(ShouldSave);
                if (ShouldSave)
                {
                    io.WriteBoolean(IsHuman);
                    io.WriteBoolean(HasPlayer);
                    if (HasPlayer)
                    {
                        io.WriteInt32(PlayerID);
                    }
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBoolean(IsEmpty);
                if (!IsEmpty)
                {
                    if (WarTable == null)
                    {
                        WarTable = new WarTable();
                    }
                    WarTable.Write(io);
                }
                if (_isfirst)
                {
                    if (SStructure.ProjectVersion < 0x1A)
                    {
                        io.WriteInt32(ProgressTime.ToUnixSecondsNoAdd());
                    }
                    else
                    {
                        io.WriteInt64(ProgressTime.ToUnixSecondsNoAdd());
                    }
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #30
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);
            }
        }