Exemplo n.º 1
0
        private void Write(BinaryWriter writer)
        {
            writer.Write('t');
            writer.Write('t');
            writer.Write('p');
            writer.Write((byte)0);
            writer.Write(SaveVersionConstants.PLAYER_DATA_FILE);

            ecd.Write(writer);

            ItemStack.WriteItemStack(writer, inventory);
            writer.Write(selectedInventorySlot.Get());
            ItemStack.WriteItemStack(writer, bag);
            writer.Write((ushort)alreadyCraftedList.Count);

            foreach (string current in alreadyCraftedList)
            {
                writer.Write(current);
            }

            writer.Write((byte)spawnPoints.Count);
            for (int i = 0; i < spawnPoints.Count; ++i)
            {
                writer.Write(spawnPoints[i].x.Get());
                writer.Write(spawnPoints[i].y.Get());
                writer.Write(spawnPoints[i].z.Get());
            }

            writer.Write(selectedSpawnPointKey.Get());
            writer.Write(true);
            writer.Write((short)0);

            writer.Write(bLoaded.Get());

            writer.Write(lastSpawnPosition.x.Get());
            writer.Write(lastSpawnPosition.y.Get());
            writer.Write(lastSpawnPosition.z.Get());

            writer.Write(lastSpawnPosition.heading.Get());
            writer.Write(id.Get());

            writer.Write(droppedBackpackPosition.x.Get());
            writer.Write(droppedBackpackPosition.y.Get());
            writer.Write(droppedBackpackPosition.z.Get());

            writer.Write(playerKills.Get());
            writer.Write(zombieKills.Get());
            writer.Write(deaths.Get());
            writer.Write(score.Get());

            equipment.Write(writer);

            writer.Write((ushort)unlockedRecipeList.Count);
            foreach (string current in unlockedRecipeList)
            {
                writer.Write(current);
            }

            writer.Write((ushort)1);

            writer.Write(markerPosition.x.Get());
            writer.Write(markerPosition.y.Get());
            writer.Write(markerPosition.z.Get());

            favoriteEquipment.Write(writer);

            writer.Write(bCrouchedLocked.Get());
            craftingData.Write(writer);

            writer.Write((ushort)favoriteRecipeList.Count);
            foreach (string current in favoriteRecipeList)
            {
                writer.Write(current);
            }

            writer.Write(totalItemsCrafted.Get());
            writer.Write(distanceWalked.Get());
            writer.Write(longestLife.Get());
            writer.Write(gameStageBornAtWorldTime.Get());

            waypoints.Write(writer);
            questJournal.Write(writer);

            writer.Write(deathUpdateTime.Get());
            writer.Write(currentLife.Get());
            writer.Write(bDead.Get());

            writer.Write((byte)88);
            writer.Write(true);

            playerJournal.Write(writer);

            writer.Write(rentedVMPosition.x.Get());
            writer.Write(rentedVMPosition.y.Get());
            writer.Write(rentedVMPosition.z.Get());

            writer.Write(rentalEndTime.Get());

            writer.Write((ushort)trackedFriendEntityIds.Count);
            for (int i = 0; i < this.trackedFriendEntityIds.Count; ++i)
            {
                writer.Write(trackedFriendEntityIds[i]);
            }

            writer.Write((int)progressionData.Length);
            writer.Write(progressionData.ToArray());

            writer.Write((int)buffData.Length);
            writer.Write(buffData.ToArray());

            writer.Write((int)stealthData.Length);
            writer.Write(stealthData.ToArray());

            writer.Write((ushort)favoriteCreativeStacks.Count);
            for (int i = 0; i < favoriteCreativeStacks.Count; ++i)
            {
                writer.Write(favoriteCreativeStacks[i]);
            }
        }
        public void Write(string path)
        {
            BinaryWriter writer = new BinaryWriter(new FileStream(path, FileMode.Create));

            writer.Write('t');
            writer.Write('t');
            writer.Write('p');
            writer.Write((byte)0);
            writer.Write((byte)saveFileVersion.Get());

            ecd.Write(writer);
            food.Write(writer);
            drink.Write(writer);

            ItemStack.WriteItemStack(writer, inventory);
            writer.Write((byte)selectedInventorySlot.Get());
            ItemStack.WriteItemStack(writer, bag);

            writer.Write((ushort)alreadyCraftedList.Count);
            HashSet <string> .Enumerator enumerator = alreadyCraftedList.GetEnumerator();
            while (enumerator.MoveNext())
            {
                writer.Write(enumerator.Current);
            }

            writer.Write((byte)spawnPoints.Count);
            for (int i = 0; i < spawnPoints.Count; i++)
            {
                writer.Write(spawnPoints[i].x.Get());
                writer.Write(spawnPoints[i].y.Get());
                writer.Write(spawnPoints[i].z.Get());
            }

            writer.Write(selectedSpawnPointKey.Get());
            writer.Write(randomBoolean.Get());
            writer.Write(randomShort.Get());
            writer.Write(bLoaded.Get());
            writer.Write((int)lastSpawnPosition.x.Get());
            writer.Write((int)lastSpawnPosition.y.Get());
            writer.Write((int)lastSpawnPosition.z.Get());
            writer.Write(lastSpawnPosition.heading.Get());
            writer.Write(id.Get());
            writer.Write(droppedBackpackPosition.x.Get());
            writer.Write(droppedBackpackPosition.y.Get());
            writer.Write(droppedBackpackPosition.z.Get());

            writer.Write(playerKills.Get());
            writer.Write(zombieKills.Get());
            writer.Write(deaths.Get());
            writer.Write(score.Get());

            equipment.Write(writer);

            writer.Write((ushort)unlockedRecipeList.Count);
            List <string> .Enumerator enumerator2 = unlockedRecipeList.GetEnumerator();
            while (enumerator2.MoveNext())
            {
                writer.Write(enumerator2.Current);
            }

            writer.Write(randomUShort.Get());
            writer.Write(markerPosition.x.Get());
            writer.Write(markerPosition.y.Get());
            writer.Write(markerPosition.z.Get());
            favoriteEquipment.Write(writer);
            writer.Write(experience.Get());
            writer.Write(level.Get());
            writer.Write(bCrouchedLocked.Get());
            craftingData.Write(writer);

            writer.Write((ushort)favoriteRecipeList.Count);
            List <string> .Enumerator enumerator3 = favoriteRecipeList.GetEnumerator();
            while (enumerator3.MoveNext())
            {
                writer.Write(enumerator3.Current);
            }

            skillStream = new MemoryStream();
            skills.Write(new BinaryWriter(skillStream));
            byte[] array = skillStream.ToArray();
            writer.Write((uint)array.Length);
            if (array.Length > 0)
            {
                writer.Write(array);
            }

            writer.Write(totalItemsCrafted.Get());
            writer.Write(distanceWalked.Get());
            writer.Write(longestLife.Get());

            if (saveFileVersion.Get() > 35)
            {
                writer.Write(gameStageLifetimeTicks.Get());
            }

            waypoints.Write(writer);
            writer.Write(skillPoints.Get());

            questJournal.Write(writer);
            writer.Write(deathUpdateTime.Get());
            writer.Write(currentLife.Get());
            writer.Write(bDead.Get());

            writer.Write((byte)88);
            writer.Write(true);

            playerJournal.Write(writer);

            writer.Write(rentedVMPosition.x.Get());
            writer.Write(rentedVMPosition.y.Get());
            writer.Write(rentedVMPosition.z.Get());

            writer.Write(rentalEndTime.Get());

            writer.Write((ushort)trackedFriendEntityIds.Count);

            for (int i = 0; i < this.trackedFriendEntityIds.Count; ++i)
            {
                writer.Write(trackedFriendEntityIds[i]);
            }

            writer.Close();
        }