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);
                }
                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);
            }
        }
Пример #3
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);
            }
        }
 public bool Write(DAIIO io, bool skiplength = false)
 {
     try
     {
         if (!skiplength)
         {
             io.WriteBits(Length, LengthBits);
         }
         io.WriteBits(Name.Length, 0x10);
         io.WriteString(Name);
         io.WriteBits(BundleHash, 0x20);
         io.WriteBits(ParentBundleHash, 0x20);
         io.WriteBits(HeapType, 0x8);
         io.WriteBits(InitSize, 0x20);
         io.WriteBoolean(AllowGrow);
         io.WriteBits(Status, 0x8);
         io.WriteBits(BundleType, 0x8);
         io.WriteBits(GroupID, 0x20);
         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);
                }
                io.WriteInt32(ArcheTypeID);
                io.WriteBoolean(Enabled);
                io.WriteBoolean(Unlocked);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #7
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);
     }
 }
        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);
            }
        }
        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);
            }
        }
Пример #10
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                io.WriteBits(Id, 0x20);
                io.WriteBoolean(HasCreatePos);
                if (HasCreatePos)
                {
                    io.WriteBits(CreatePos, 0x1A);
                }
                io.WriteBoolean(HasInitPos);
                if (HasInitPos)
                {
                    io.WriteBits(InitPos, 0x1A);
                }

                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);
            }
        }
 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.WriteBoolean(CustomizationManagerExists);
                if (CustomizationManagerExists)
                {
                    CustomizationManager.Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBoolean(HasControllable);
                if (HasControllable)
                {
                    Controllable.Write(io);
                    if (Controllable.ShouldSave)
                    {
                        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);
                            }
                        }
                        io.WriteInt16(IndexUsedByUniqueId);
                    }
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #15
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);
            }
        }
Пример #16
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBits(NameHash, 0x20);
                io.WriteBits(Version, 0x10);
                io.WriteBoolean(HasCustomizationData);
                if (HasCustomizationData)
                {
                    CustomizationData.Write(io);
                }

                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);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                ItemStats.Write(io);
                if ((io.Position - ItemStats.Offset) < ItemStats.xLength)
                {
                    if (ItemStats.Version >= 6)
                    {
                        io.WriteBits(MasterworkSuccesses, 5);
                    }
                    else
                    {
                        io.WriteBoolean(MasterworkSuccess);
                    }
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #19
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                io.xbaseStream.Write(DataMagic, 0, 8);
                io.Position = 0x41;
                io.WriteInt64(SavedTime.ToUnixSecondsWithAdd());
                io.WriteInt16((short)SID.Length);
                io.WriteString(SID);
                io.WriteUInt16(GameVersion);
                io.WriteUInt16(SaveVersion);
                io.WriteUInt16(ProjectVersion);
                io.WriteUInt16(BitstreamFeatures);
                io.WriteUInt32(ChangeList);
                io.WriteUInt16((ushort)Level.Length);
                io.WriteString(Level);
                io.WriteUInt32(Difficulty);
                if (BundleList == null)
                {
                    BundleList = new string[BundleCount];

                    for (int xb = 0; xb < BundleCount; xb++)
                    {
                        BundleList[xb] = "";
                    }
                }
                BundleCount = (ushort)BundleList.Length;
                io.WriteUInt16(BundleCount);
                for (int i = 0; i < BundleCount; i++)
                {
                    io.WriteInt16((short)BundleList[i].Length);
                    io.WriteString(BundleList[i]);
                }
                if (Inclusions == null)
                {
                    Inclusions = new Inclusion[InclusionCount];

                    for (int xb = 0; xb < InclusionCount; xb++)
                    {
                        Inclusions[xb] = new Inclusion();
                    }
                }
                InclusionCount = (ushort)Inclusions.Length;
                io.WriteInt16((short)InclusionCount);
                for (int i = 0; i < InclusionCount; i++)
                {
                    Inclusions[i].Write(io);
                }
                if (SubLevelInfoCount <= 0x40 && SubLevelInfoCount > 0)
                {
                    if (SubLevelEntries == null)
                    {
                        SubLevelEntries = new SubLevelInfo[SubLevelInfoCount];

                        for (int xb = 0; xb < SubLevelInfoCount; xb++)
                        {
                            SubLevelEntries[xb] = new SubLevelInfo();
                        }
                    }
                    SubLevelInfoCount = SubLevelEntries.Length;
                    io.WriteBits(SubLevelInfoCount, 0xc);
                    for (int i = 0; i < SubLevelInfoCount; i++)
                    {
                        SubLevelEntries[i].Write(io);
                    }
                }
                if (LevelChecksum == null)
                {
                    LevelChecksum = new byte[0x10];
                }
                for (int i = 0; i < 0x10; i++)
                {
                    io.WriteBits(LevelChecksum[i], 0x8);
                }
                io.WriteBits(DLC, 0x14);
                io.WriteBits(EntityVersion, 0x10);
                io.WriteBits(ProjectVersionContext, 0x10);
                io.WriteBoolean(HasDebugInfo);

                ///////////////////////////////////////////////////////////////////////////////////////////////////
                //////////////////////////////CALCULATE SECTION BOOKMARKS/////////////////////////////////////////
                var pos = io.Position;                                                                     ///////////////////////////////////////////////////////////////////////////
                pos += 0x54;                                                                               ////////////////////////////////////////////////////////////////////////////////////
                pos += (EntityContentLength +                                                              //////////////////////////////////////////////////////////////////
                        (((SaveEntityComplexLength + 0x38) + SaveEntity.Length) + EntityMetaData.Length)); ////
                AgentTocBookmark = (int)pos;                                                               ////////////////////////////////////////////////////////////////
                pos += (AgentToc.Length + 0x18);                                                           ////////////////////////////////////////////////////////////
                ClientDataBookmark = (int)pos;                                                             ////////////////////////////////////////////////////////////
                //////////////////////////////////////////////////////////////////////////////////////////

                io.WriteBits(AgentTocBookmark, 0x1A);
                io.WriteBits(ClientDataBookmark, 0x1A);
                io.WriteBits(EntityContentLength, 0x20);

                ///////////////////////////////////////////////////////////////////////////////
                ////////////////////////WRITE UNFINISHED SECTION//////////////////////////////
                EntityContent.Write(io);                                                 /////////////////////////////////////////////////////
                //MUST WRITE UNFINISHED RAW DATA, REMOVE IF CONTENT HAS BEEN MAPPED OUT/////
                if (tmpdata.Length > 0)                                                  ////////////////////////////////////////////////////
                {
                    io.WriteData(tmpdata, (EntityContentLength - EntityContent.Length)); ////
                }
                /////////////////////////////////////////////////////////////////////////

                //Start writing SaveEntity
                SaveEntityBookmark = (int)io.Position;
                io.WriteBits(SaveEntityComplexLength, 6);
                io.WriteData(SaveEntityComplex, SaveEntityComplexLength);
                io.WriteBits(SaveEntityBookmark, 0x1A);
                SaveEntity.Write(io);
                EntityMetaData.Write(io);
                AgentToc.Write(io);
                ClientData.Write(io);
                // io.FinishWriter();
                if (LastPartSeedLength > 0)
                {
                    io.WriteBits((uint)LastPartSeed, (uint)LastPartSeedLength, true);
                }
                io.Flush();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBoolean(InventoryExist);
                if (InventoryExist)
                {
                    Inventory.Write(io);
                }
                if (SStructure.EntityVersion > 8)
                {
                    io.WriteBoolean(ItemManagerExists);
                    if (ItemManagerExists)
                    {
                        if (ResearchedUpgradeIndexes == null)
                        {
                            ResearchedUpgradeIndexes = new int[ResearchedUpgradesCount];
                        }
                        io.WriteInt16((short)ResearchedUpgradeIndexes.Length);
                        foreach (int t in ResearchedUpgradeIndexes)
                        {
                            io.WriteInt32(t);
                        }
                        if (SStructure.ProjectVersion > 0x20)
                        {
                            if (PotionBanks == null)
                            {
                                PotionBanks = new PotionBank[PotionBankCount];

                                for (int xb = 0; xb < PotionBankCount; xb++)
                                {
                                    PotionBanks[xb] = new PotionBank();
                                }
                            }
                            io.WriteInt16((short)PotionBanks.Length);
                            foreach (PotionBank t in PotionBanks)
                            {
                                t.Write(io);
                            }
                            //if (PotionBanks.Length > 0)
                            //{
                            //    if (UnknownBanks == null)
                            //    {
                            //        UnknownBanks = new PotionBank[UnknownBankCount];

                            //        for (int xb = 0; xb < UnknownBankCount; xb++)
                            //            UnknownBanks[xb] = new PotionBank();
                            //    }
                            //    io.WriteInt16((short) UnknownBanks.Length);
                            //    foreach (PotionBank t in UnknownBanks)
                            //        t.Write(io);
                            //}
                        }
                    }
                }
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }