Exemple #1
0
        public static void Write_Encrypted_Figure()
        {
            // Save As
            var dialog = new SaveFileDialog
            {
                Filter           = "Dump File (*.bin)|*.bin|All files (*.*)|*.*",
                FilterIndex      = 1,
                RestoreDirectory = true,
                Title            = "Save Encrypted Dump",
                FileName         = frmMain.lstCharacters.SelectedItem
            };

            if (dialog.ShowDialog = DialogResult.OK)
            {
                var newFile = dialog.FileName;

                if (frmMain.chkSerial.Checked)
                {
                    CRC16CCITT.GenerateNewSerial();
                }
                Figures.EditCharacterIDVariant();
                Write_Data();
                // Since we are Writing an Encrypted Figure, I need to Re-Encrypt it.
                Encrypt();
                // Now we write the file.
                fs = new FileStream(NewFile, FileMode.OpenOrCreate);
                fs.Write(WholeFile, 0, WholeFile.Length);
                fs.Flush();
                fs.Close();
                // We Decrypt after we are done.
                Decrypt();
            }
        }
Exemple #2
0
        public static void Parse_Figure()
        {
            // We set the Decrypted Flag here
            blnEncrypted = false;
            // We set the Unique Trio Booleans to False.
            BlnVehicle = false;
            blnTrap    = false;
            blnCrystal = false;
            // We Reset WebCode here and early.
            frmMain.lblWebCode.Text = "";
            // We can get the Figure// s ID and Variant ID without Needing Encryption/Decryption
            // Get Figure ID and Alter Ego/Variant
            Figures.GetFigureID_AlterEgo_Variant();

            // Because Traps, Vehciles and Crystals are writing bytes to where the Nickname would normally show up, we Do NOT attempt to Decrypt here.
            // Though, Crystals may write here?
            if (!blnTrap && !blnCrystal && !BlnVehicle)
            {
                blnEncrypted = Enc_Fig();
            }
            else if (blnTrap)
            {
                blnEncrypted = Enc_Trap();
            }
            else if (BlnVehicle)
            {
                blnEncrypted = Enc_Veh();
            }
            else if (blnCrystal)
            {
                // Not Implimented Yet.
            }
            if (blnEncrypted)
            {
                Decrypt();
            }

            // Calculate the Checksums
            // Does NOT handle Traps or Crystals, yet.
            CRC16CCITT.Checksums();
            // Determine if we are going to use Area 0 or Area 1
            Figures.Area0orArea1();
            frmArea.Area0_1();

            // We break here if Vehicle, Crystal, Item or Trap
            if (BlnVehicle)
            {
                Application.DoEvents();
                var frmVehicles = new frmVehicles();
                frmVehicles.Show();
                frmMain.Hide();
                return;
            }
            else if (blnTrap)
            {
                Application.DoEvents();
                var frmTraps = new frmTraps();
                frmTraps.Show();
                frmMain.Hide();
                return;
            }
            else if (blnCrystal)
            {
#if DEBUG
                Application.DoEvents();
                var FrmCrystals = new frmCrystals();
                FrmCrystals.Show();
                frmMain.Hide();
                return;
#else
                frmMain.SaldeStatus.Text = "Crystals are not supported, yet.";
                return;
#endif
            }

            // Get the Current Skill Path.
            Skills.GetSkillPath();

            // Get the Current Hero Points value for Areas A and B.  Show the Larger Value.
            Hero.GetHero();

            // Get the Current Gold values for Areas A and B.  Show the Larger Value.
            Gold.GetGold();

            // Get EXP
            Exp.GetEXP();

            // Get the Current Heroic Challenges value for Areas A and B.  Show the Larger Value.
            Challenges.GetChallenges();

            // Show us what Figure we got.
            // Show us the Figures ID and Variant ID
            // Figures.ShowID()

            // Mostly complete Detection
            Figures.FigureItOut();

            // Select the Hat
            Hats.ReadHats();
            // btnSaveAs.Enabled = True
            // btnWrite.Enabled = True

            Web_Code.Load();
            // btnSaveAs.Enabled = True
            // btnWrite.Enabled = True

            System_ID.ReadSystem_ID();
        }
Exemple #3
0
        // Write_Data write// s Data to the Figures.
        // Note that Traps, Vehicles and Crystals do NOT use this because they have their own Editor that is used.
        public static void Write_Data()
        {
            if (!BlnVehicle && !blnTrap && !blnCrystal)
            {
                // Set Data that changed.
                Challenges.WriteChallenges();
                Exp.WriteEXP();
                Gold.WriteGold();
                Hero.WriteHero();
                Nickname.SetNickname();
                Hats.WriteHats();
                if (frmMain.numLevel.Value >= 10)
                {
                    Skills.WriteSkillPath();
                }
            }

            if (blnTrap)
            {
                // Special Byte Data Writes
                var ZeroTrap = 0;
                // Add 13 to reach End of Block
                // 194 = 0C2
                // 258 = 102
                // 322 = 142
                // 386 = 182
                // 450 = 1C2
                // 515 = 202

                // Then we do Area 2
                // +1C0
                // 642 = 282
                // 706 = 2C2
                // 770 = 302
                // 834 = 342
                // 898 = 382
                // 962 = 3C2

                var trap_Name   = new int[] { 194, 258, 322, 386, 450, 515, 642, 706, 770, 834, 898, 962 };
                var trapCounter = 0;

                do
                {
                    WholeFile[trap_Name[trapCounter] + ZeroTrap] = 0x0;
                    if (ZeroTrap = 13)
                    {
                        ZeroTrap     = 0;
                        trapCounter += 1;
                    }
                    else
                    {
                        ZeroTrap += 1;
                    }
                } while (trapCounter != 12);
            }
            else if (BlnVehicle)
            {
                // Special Byte Data Writes
                var ZeroVehicle = 0;
                // 192 = 0C0
                // +1C0
                // 640 = 280
                do
                {
                    WholeFile[192 + ZeroVehicle] = 0x0;
                    ZeroVehicle += 1;
                } while (ZeroVehicle != 14);

                ZeroVehicle = 0;
                do
                {
                    WholeFile[640 + ZeroVehicle] = 0x0;
                    ZeroVehicle += 1;
                } while (ZeroVehicle != 14);
            }
            else if (blnCrystal)
            {
                // Special Byte Data Writes
                // Not Implimented, Yet.
            }
            // All Figures need these Functions still.
            // Write the System ID
            System_ID.WriteSystem();
            // Fix Read/Write Blocks
            Figures.Fixing_Bytes();
            // In theory, this will fix any issues with the Edited Dumps.
            Figures.SetArea0AndArea1();
            // Fix the Checksums.
            CRC16CCITT.WriteCheckSums();
        }