예제 #1
0
        private void infuseLegendaryComponentsButton_Click(object sender, EventArgs e)
        {
            var components = activeSaveFile.GetInventory(1).Items.Where(x => x.ItemGameName == "Legendary Upgrade Components").FirstOrDefault();

            if (components == null || ((ItemData.SimpleItemData)components.Data).Quantity < 5)
            {
                MessageBox.Show("Insufficient Legendary Upgrade Components. (5) required.");
                return;
            }

            if (activeSaveFile.GetItemStatData(activeItem) == null)
            {
                MessageBox.Show("Item has no stat data. To fix this, please upgrade the item in-game at least once.");
                return;
            }

            if (MessageBox.Show("This process will remove (5) Legendary Upgrade Components from your inventory in exchange for upgrading the selected item to legendary quality. The selected item's level will also be upgraded to your current level. Do you wish to continue?", "Infuse Legendary Components", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                var playerData = activeSaveFile.GetPlayerDevelopmentData();
                var level      = playerData.Value.Proficiencies[Array.FindIndex(playerData.Value.Proficiencies, x => x.Type == gamedataProficiencyType.Level)].CurrentLevel;

                ((ItemData.SimpleItemData)components.Data).Quantity -= 5;
                activeSaveFile.SetConstantStat(gamedataStatType.Quality, 4, activeSaveFile.GetItemStatData(activeItem));
                activeSaveFile.SetConstantStat(gamedataStatType.ItemLevel, level * 10, activeSaveFile.GetItemStatData(activeItem));
                activeSaveFile.SetConstantStat(gamedataStatType.PowerLevel, level, activeSaveFile.GetItemStatData(activeItem));
                ReloadData();

                MessageBox.Show("Legendary components infused.");
            }
        }
예제 #2
0
 private void lifePathBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lifePathBox.SelectedIndex == 0)
     {
         lifePathPictureBox.Image = CP2077SaveEditor.Properties.Resources.nomad;
         activeSaveFile.GetPlayerDevelopmentData().Value.LifePath = gamedataLifePath.Nomad;
     }
     else if (lifePathBox.SelectedIndex == 1)
     {
         lifePathPictureBox.Image = CP2077SaveEditor.Properties.Resources.streetkid;
         activeSaveFile.GetPlayerDevelopmentData().Value.LifePath = gamedataLifePath.StreetKid;
     }
     else if (lifePathBox.SelectedIndex == 2)
     {
         lifePathPictureBox.Image = CP2077SaveEditor.Properties.Resources.corpo;
         activeSaveFile.GetPlayerDevelopmentData().Value.LifePath = gamedataLifePath.Corporate;
     }
 }
예제 #3
0
        private void openSaveButton_Click(object sender, EventArgs e)
        {
            var fileWindow = new OpenFileDialog();

            fileWindow.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Saved Games\\CD Projekt Red\\Cyberpunk 2077\\";
            fileWindow.Filter           = "Cyberpunk 2077 Save File|*.dat";
            if (fileWindow.ShowDialog() == DialogResult.OK)
            {
                loadingSave = true;
                //Initialize NameResolver & FactResolver dictionaries, build parsers list & load save file
                NameResolver.UseDictionary(JsonConvert.DeserializeObject <Dictionary <ulong, NameResolver.NameStruct> >(CP2077SaveEditor.Properties.Resources.ItemNames));
                FactResolver.UseDictionary(JsonConvert.DeserializeObject <Dictionary <ulong, string> >(CP2077SaveEditor.Properties.Resources.Facts));

                var parsers = new List <INodeParser>();
                parsers.AddRange(new INodeParser[] {
                    new CharacterCustomizationAppearancesParser(), new InventoryParser(), new ItemDataParser(), new FactsDBParser(),
                    new FactsTableParser(), new GameSessionConfigParser(), new ItemDropStorageManagerParser(), new ItemDropStorageParser(),
                    new StatsSystemParser(), new ScriptableSystemsContainerParser()
                });

                var newSave = new SaveFileHelper(parsers);
                newSave.LoadPCSaveFile(new MemoryStream(File.ReadAllBytes(fileWindow.FileName)));
                activeSaveFile = newSave;

                //Appearance parsing
                RefreshAppearanceValues();

                //Inventory parsing
                moneyUpDown.Enabled = false;
                moneyUpDown.Value   = 0;

                containersListBox.Items.Clear();
                foreach (Inventory.SubInventory container in activeSaveFile.GetInventoriesContainer().SubInventories)
                {
                    var containerID = container.InventoryId.ToString(); if (containerID == "1")
                    {
                        containerID = "Player Inventory";
                    }
                    containersListBox.Items.Add(containerID);
                }

                if (containersListBox.Items.Count > 0)
                {
                    containersListBox.SelectedIndex = 0;
                }

                //Facts parsing
                RefreshFacts();
                //These lines may look redundant, but they initialize the factsListView so that the render thread doesn't freeze when selecting the Quest Facts tab for the first time.
                //Since the render thread will be frozen here anyways while everything loads, it's best to do this here.
                factsSaveButton.Visible = false;
                factsPanel.Visible      = true;
                factsPanel.Visible      = false;
                factsSaveButton.Visible = true;

                //Player stats parsing
                var profics = activeSaveFile.GetPlayerDevelopmentData().Value.Proficiencies;

                levelUpDown.Value      = profics[Array.FindIndex(profics, x => x.Type == CyberCAT.Core.DumpedEnums.gamedataProficiencyType.Level)].CurrentLevel;
                streetCredUpDown.Value = profics[Array.FindIndex(profics, x => x.Type == CyberCAT.Core.DumpedEnums.gamedataProficiencyType.StreetCred)].CurrentLevel;

                var attrs = activeSaveFile.GetPlayerDevelopmentData().Value.Attributes;

                bodyUpDown.Value             = attrs[Array.FindIndex(attrs, x => x.AttributeName == CyberCAT.Core.DumpedEnums.gamedataStatType.Strength)].Value;
                reflexesUpDown.Value         = attrs[Array.FindIndex(attrs, x => x.AttributeName == CyberCAT.Core.DumpedEnums.gamedataStatType.Reflexes)].Value;
                technicalAbilityUpDown.Value = attrs[Array.FindIndex(attrs, x => x.AttributeName == CyberCAT.Core.DumpedEnums.gamedataStatType.TechnicalAbility)].Value;
                intelligenceUpDown.Value     = attrs[Array.FindIndex(attrs, x => x.AttributeName == CyberCAT.Core.DumpedEnums.gamedataStatType.Intelligence)].Value;
                coolUpDown.Value             = attrs[Array.FindIndex(attrs, x => x.AttributeName == CyberCAT.Core.DumpedEnums.gamedataStatType.Cool)].Value;

                if (activeSaveFile.GetPlayerDevelopmentData().Value.LifePath == CyberCAT.Core.DumpedEnums.gamedataLifePath.Nomad)
                {
                    lifePathBox.SelectedIndex = 0;
                }
                else if (activeSaveFile.GetPlayerDevelopmentData().Value.LifePath == CyberCAT.Core.DumpedEnums.gamedataLifePath.StreetKid)
                {
                    lifePathBox.SelectedIndex = 1;
                }
                else
                {
                    lifePathBox.SelectedIndex = 2;
                }

                var points = activeSaveFile.GetPlayerDevelopmentData().Value.DevPoints;

                perkPointsUpDown.Value = points[Array.FindIndex(points, x => x.Type == CyberCAT.Core.DumpedEnums.gamedataDevelopmentPointType.Primary)].Unspent;
                attrPointsUpDown.Value = points[Array.FindIndex(points, x => x.Type == null)].Unspent;

                //Update controls
                loadingSave          = false;
                editorPanel.Enabled  = true;
                optionsPanel.Enabled = true;
                filePathLabel.Text   = Path.GetFileName(Path.GetDirectoryName(fileWindow.FileName));
                statusLabel.Text     = "Save file loaded.";
                SwapTab(statsButton, statsPanel);
            }
        }