Exemplo n.º 1
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                io.WriteInt16(Version);
                if (!skiplength)
                {
                    io.WriteBits(Length - 0x10, LengthBits);
                }
                if (Customizations == null)
                {
                    Customizations = new Customization[Options];

                    for (int xb = 0; xb < Options; xb++)
                    {
                        Customizations[xb] = new Customization(this);
                    }
                }
                io.WriteInt16((short)Customizations.Length);
                for (int i = 0; i < Customizations.Length; i++)
                {
                    Customizations[i].Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt16(Version);
                if ((Version & 0xFFFF) >= 2)
                {
                    io.WriteInt16(MarkerDataLength);
                    io.WriteString(MarkerData);
                }
                if ((Version & 0xFFFF) >= 1)
                {
                    BooleanFlagsThatAreTrue.Write(io);
                    BooleanFlagsThatAreFalse.Write(io);
                    io.WriteInt16(IntegerFlagsCount);
                    if (IntegerFlags == null)
                    {
                        IntegerFlags = new ValueFlag[IntegerFlagsCount];

                        for (int xb = 0; xb < IntegerFlagsCount; xb++)
                        {
                            IntegerFlags[xb] = new ValueFlag();
                        }
                    }
                    for (int i = 0; i < IntegerFlagsCount; i++)
                    {
                        IntegerFlags[i].Write(io);
                    }
                    io.WriteInt16(FloatFlagsCount);
                    if (FloatFlags == null)
                    {
                        FloatFlags = new ValueFlag[FloatFlagsCount];

                        for (int xb = 0; xb < FloatFlagsCount; xb++)
                        {
                            FloatFlags[xb] = new ValueFlag();
                        }
                    }
                    for (int i = 0; i < FloatFlagsCount; i++)
                    {
                        FloatFlags[i].Write(io);
                    }
                }

                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);
                }
                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 (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBits(ID, 0x20);
                if (Controllables == null)
                {
                    Controllables = new ControllableCreate[ControllablesCount];

                    for (int xb = 0; xb < ControllablesCount; xb++)
                    {
                        Controllables[xb] = new ControllableCreate();
                    }
                }
                ControllablesCount = (short)Controllables.Length;
                io.WriteInt16(ControllablesCount);
                for (int i = 0; i < ControllablesCount; i++)
                {
                    Controllables[i].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);
            }
        }
Exemplo n.º 6
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);
            }
        }
Exemplo n.º 7
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                StatData.Write(io);
                Script.Write(io);
                if (DelArgs == null)
                {
                    DelArgs = new ItemAsset[ArgsCount];

                    for (int xb = 0; xb < ArgsCount; xb++)
                    {
                        DelArgs[xb] = new ItemAsset();
                    }
                }
                io.WriteInt16((short)DelArgs.Length);
                foreach (ItemAsset t in DelArgs)
                {
                    t.Write(io);
                }
                io.WriteSingle(DefaultValue);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 8
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (Pins == null)
                {
                    Pins = new DynamicPinsMap[Count];

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

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (Guids == null)
                {
                    Guids = new byte[Count][];
                }
                Count = (short)Guids.Length;
                io.WriteInt16(Count);
                for (int i = 0; i < Count; i++)
                {
                    if (Guids[i] == null)
                    {
                        Guids[i] = new byte[0x10];
                    }
                    for (int j = 0; j < 0x10; j++)
                    {
                        io.WriteBits(Guids[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.WriteBits(NextUid, 0x20);
                if (LootOwners == null)
                {
                    LootOwners = new LootOwner[LootOwnersCount];
                    for (int xb = 0; xb < LootOwnersCount; xb++)
                    {
                        LootOwners[xb] = new LootOwner();
                    }
                }
                io.WriteInt16((short)LootOwners.Length);
                for (int i = 0; i < LootOwnersCount; i++)
                {
                    LootOwners[i].Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 11
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);
                }
                if (Items == null)
                {
                    Items = new ItemEntry[ItemCount];

                    for (int xb = 0; xb < ItemCount; xb++)
                    {
                        Items[xb] = new ItemEntry();
                    }
                }
                ItemCount = (short)Items.Length;
                io.WriteInt16(ItemCount);
                for (int i = 0; i < ItemCount; i++)
                {
                    Items[i].Write(io);
                }

                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
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteBits(Version, 0x10);
                if (Version == 1)
                {
                    if (Agents == null)
                    {
                        Agents = new AgentEntryData[AgentCount];

                        for (int xb = 0; xb < AgentCount; xb++)
                        {
                            Agents[xb] = new AgentEntryData();
                        }
                    }
                    io.WriteInt16((short)Agents.Length);
                    for (int i = 0; i < Agents.Length; i++)
                    {
                        Agents[i].Write(io);
                    }
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (ItemStats == null)
                {
                    ItemStats = new ItemStatsData[StatsCount];

                    for (int xb = 0; xb < StatsCount; xb++)
                    {
                        ItemStats[xb] = new ItemStatsData();
                    }
                }
                io.WriteInt16((short)ItemStats.Length);
                foreach (ItemStatsData t in ItemStats)
                {
                    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(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);
            }
        }
Exemplo n.º 17
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                if (Stats == null)
                {
                    Stats = new CraftedItemStats[StatsCount];

                    for (int xb = 0; xb < StatsCount; xb++)
                    {
                        Stats[xb] = new CraftedItemStats();
                    }
                }
                io.WriteInt16((short)Stats.Length);
                for (int i = 0; i < StatsCount; i++)
                {
                    Stats[i].Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 18
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (Abilities == null)
                {
                    Abilities = new ItemAsset[Count];

                    for (int xb = 0; xb < Count; xb++)
                    {
                        Abilities[xb] = new ItemAsset();
                    }
                }
                io.WriteInt16((short)Abilities.Length);
                foreach (ItemAsset t in Abilities)
                {
                    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(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);
                }
                if (Caches == null)
                {
                    Caches = new PartyMemberDataCache[Count];

                    for (int xb = 0; xb < Count; xb++)
                    {
                        Caches[xb] = new PartyMemberDataCache();
                    }
                }
                io.WriteInt16((short)Caches.Length);
                for (int i = 0; i < Count; i++)
                {
                    Caches[i].Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 21
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (Materials == null)
                {
                    Materials = new ItemMaterial[Count];

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

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (Upgrades == null)
                {
                    Upgrades = new ItemUpgrade[Count];

                    for (int xb = 0; xb < Count; xb++)
                    {
                        Upgrades[xb] = new ItemUpgrade();
                    }
                }
                Count = (short)Upgrades.Length;
                io.WriteInt16(Count);
                for (int i = 0; i < Count; i++)
                {
                    Upgrades[i].Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (Stats == null)
                {
                    Stats = new CraftedStatInstance[StatsCount];

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

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 24
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);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt16(OwnerInfoCount);
                if (OwnerInfos == null)
                {
                    OwnerInfos = new OwnerInfo[OwnerInfoCount];

                    for (int xb = 0; xb < OwnerInfoCount; xb++)
                    {
                        OwnerInfos[xb] = new OwnerInfo(SStructure);
                    }
                }
                for (int i = 0; i < OwnerInfoCount; i++)
                {
                    OwnerInfos[i].Write(io);
                }

                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);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                io.WriteInt16(SpawnerCreateCount);
                if (SpawnerCreates == null)
                {
                    SpawnerCreates = new SpawnerCreate[SpawnerCreateCount];

                    for (int xb = 0; xb < SpawnerCreateCount; xb++)
                    {
                        SpawnerCreates[xb] = new SpawnerCreate();
                    }
                }
                for (int i = 0; i < SpawnerCreateCount; i++)
                {
                    SpawnerCreates[i].Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 28
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                if (Maps == null)
                {
                    Maps = new Map[MapCount];

                    for (int xb = 0; xb < MapCount; xb++)
                    {
                        Maps[xb] = new Map();
                    }
                }
                io.WriteInt16((short)Maps.Length);
                for (int i = 0; i < MapCount; i++)
                {
                    Maps[i].Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 29
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)
        {
            try
            {
                io.WriteInt24(ID);
                io.WriteInt16((short)Name.Length);
                io.WriteString(Name);
                io.WriteInt16((short)Value.Length);
                io.WriteString(Value);

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