public void SaveOverride(ZPackage zPackage)
 {
     using (StreamWriter saveFile = new StreamWriter(Path.Combine(PocketContainerPath, PlayerID.ToString() + "_pocket.txt")))
     {
         saveFile.Write(zPackage.GetBase64());
     }
 }
Exemple #2
0
        public void Save()
        {
            var pkg = new ZPackage();

            spellsBarInventory.Save(pkg);
            SaveValue(player, nameof(spellsBarInventory), pkg.GetBase64());
        }
        private static void SaveInventory(ItemStorage itemStorage)
        {
            string itemFile = Path.Combine(itemsPath, itemStorage.meta.itemId + "_" + itemStorage.guid);

            if (!File.Exists(itemFile) && itemStorage.inventory.NrOfItems() == 0)
            {
                return;
            }

            Dbgl($"Saving {itemStorage.inventory.GetAllItems().Count} items from inventory for item {itemStorage.guid}, type {itemStorage.meta.itemId}");

            ZPackage zpackage = new ZPackage();

            itemStorage.inventory.Save(zpackage);

            string data = zpackage.GetBase64();

            File.WriteAllText(itemFile, data);

            string templateFile = Path.Combine(templatesPath, itemStorage.meta.itemId + ".json");

            if (!File.Exists(templateFile))
            {
                string json = JsonUtility.ToJson(itemStorage.meta);
                File.WriteAllText(templateFile, json);
            }
        }
Exemple #4
0
    // Token: 0x06000CBB RID: 3259 RVA: 0x0005B2A8 File Offset: 0x000594A8
    private void Save()
    {
        ZPackage zpackage = new ZPackage();

        this.m_inventory.Save(zpackage);
        string @base = zpackage.GetBase64();

        this.m_nview.GetZDO().Set("items", @base);
        this.m_lastRevision   = this.m_nview.GetZDO().m_dataRevision;
        this.m_lastDataString = @base;
    }
Exemple #5
0
        public void Load(Player fromPlayer)
        {
            if (fromPlayer == null)
            {
                EquipmentAndQuickSlots.LogError("Tried to load an ExtendedPlayerData with a null player!");
                return;
            }

            _player = fromPlayer;
            LoadValue(fromPlayer, "ExtendedPlayerData", out var init);
            EquipmentAndQuickSlots.LogWarning("Loaded ExtendedPlayerData");

            if (LoadValue(fromPlayer, nameof(QuickSlotInventory), out var quickSlotData))
            {
                var pkg = new ZPackage(quickSlotData);
                _isLoading = true;
                QuickSlotInventory.Load(pkg);

                if (!EquipmentAndQuickSlots.QuickSlotsEnabled.Value)
                {
                    _player.m_inventory.MoveAll(QuickSlotInventory);

                    pkg = new ZPackage(quickSlotData);
                    QuickSlotInventory.Save(pkg);
                    SaveValue(_player, nameof(QuickSlotInventory), pkg.GetBase64());
                }

                _isLoading = false;
            }

            if (LoadValue(fromPlayer, nameof(EquipmentSlotInventory), out var equipSlotData))
            {
                var pkg = new ZPackage(equipSlotData);
                _isLoading = true;
                EquipmentSlotInventory.Load(pkg);

                if (!EquipmentAndQuickSlots.EquipmentSlotsEnabled.Value)
                {
                    _player.m_inventory.MoveAll(EquipmentSlotInventory);

                    pkg = new ZPackage(quickSlotData);
                    EquipmentSlotInventory.Save(pkg);
                    SaveValue(_player, nameof(EquipmentSlotInventory), pkg.GetBase64());
                }

                _isLoading = false;
            }
        }
            static void Prefix()
            {
                if (!modEnabled.Value)
                {
                    return;
                }

                if (backpackInventory != null)
                {
                    ZPackage zpackage = new ZPackage();
                    backpackInventory.Save(zpackage);
                    string output = zpackage.GetBase64();

                    File.WriteAllText(Path.Combine(assetPath, backpackFileName), output);
                }
            }
        public void Initialize(BountyInfo bounty, string monsterID, bool isAdd)
        {
            _zdo.Set(BountyIDKey, bounty.ID);

            var pkg = new ZPackage();

            bounty.ToPackage(pkg);
            pkg.SetPos(0);
            _zdo.Set(BountyDataKey, pkg.GetBase64());
            _zdo.Set(MonsterIDKey, monsterID);
            _zdo.Set(IsAddKey, isAdd);
            _zdo.Set(BountyTargetNameKey, GetTargetName(_character.m_name, isAdd, bounty.TargetName));

            _character.SetLevel(GetTargetLevel(bounty, monsterID, isAdd));
            _character.SetMaxHealth(GetModifiedMaxHealth(_character, bounty, isAdd));
            _character.m_baseAI.SetPatrolPoint();

            Reinitialize();
        }
        public void Save()
        {
            if (_player == null)
            {
                EquipmentAndQuickSlots.LogError("Tried to save an ExtendedPlayerData without a player!");
                return;
            }

            EquipmentAndQuickSlots.LogWarning("Saving ExtendedPlayerData");
            SaveValue(_player, "ExtendedPlayerData", "This player is using ExtendedPlayerData!");

            var pkg = new ZPackage();

            QuickSlotInventory.Save(pkg);
            SaveValue(_player, nameof(QuickSlotInventory), pkg.GetBase64());

            pkg = new ZPackage();
            EquipmentSlotInventory.Save(pkg);
            SaveValue(_player, nameof(EquipmentSlotInventory), pkg.GetBase64());
        }