Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- namespace Boost
- {
- class Program
- {
- public static void Main(string[] args)
- {
- Console.WriteLine("Welcome to Rogue Legacy Savegame Editor");
- int input = -1;
- while (input != 0)
- {
- Console.WriteLine("What would you like to do? (enter a number)");
- Console.WriteLine("1 - Give me money");
- Console.WriteLine("2 - Unlock Gear & Enchantments");
- Console.WriteLine("3 - Boost my stats");
- Console.WriteLine("4 - Supercharge my stats");
- Console.WriteLine("0 - Exit");
- input = Convert.ToInt32(Console.ReadLine());
- switch (input)
- {
- case 0:
- break;
- case 1:
- Money();
- Console.WriteLine("Money Given\n");
- break;
- case 2:
- GearAndEnchantments();
- Console.WriteLine("Gear & Enchantments Given\n");
- break;
- case 3:
- Boost();
- Console.WriteLine("Boosted\n");
- break;
- case 4:
- SuperBoost();
- Console.WriteLine("SuperBoosted\n");
- break;
- }
- }
- }
- protected static void Money()
- {
- try
- {
- // Create a copy of the file that we will be adjusting, just to be safe.
- File.Delete(@".\Backup-RogueLegacyPlayer.rcdat");
- File.Copy(@".\RogueLegacyPlayer.rcdat", @".\Backup-RogueLegacyPlayer.rcdat");
- // Open the backup copy of the file. This file will not be edited, just read.
- BinaryReader reader = new BinaryReader(new FileStream(@".\Backup-RogueLegacyPlayer.rcdat", FileMode.Open), new ASCIIEncoding());
- // Open the other file for writing.
- BinaryWriter writer = new BinaryWriter(new FileStream(@".\RogueLegacyPlayer.rcdat", FileMode.Truncate));
- writer.Write(2000000000); reader.ReadInt32(); // money
- while (reader.PeekChar() != -1) // Everything else
- writer.Write(reader.ReadByte());
- reader.Close();
- writer.Close();
- }
- catch (FileNotFoundException ex)
- {
- Console.WriteLine("Error: " + ex.ToString());
- }
- }
- protected static void Boost()
- {
- try
- {
- // Create a copy of the file that we will be adjusting, just to be safe.
- File.Delete(@".\Backup-RogueLegacyPlayer.rcdat");
- File.Copy(@".\RogueLegacyPlayer.rcdat", @".\Backup-RogueLegacyPlayer.rcdat");
- // Open the backup copy of the file. This file will not be edited, just read.
- BinaryReader reader = new BinaryReader(new FileStream(@".\Backup-RogueLegacyPlayer.rcdat", FileMode.Open), new ASCIIEncoding());
- // Open the other file for writing.
- BinaryWriter writer = new BinaryWriter(new FileStream(@".\RogueLegacyPlayer.rcdat", FileMode.Truncate));
- /* The basic idea here is to use the reader to read data from the backup save and use the writer
- * to write most of that same data to the new save file. The data which is entered manually and not from the reader
- * is what makes the differences in the new save file.
- */
- writer.Write(reader.ReadInt32()); // money
- writer.Write(reader.ReadInt32()); // currentHealth
- writer.Write(reader.ReadInt32()); // currentMana
- writer.Write(reader.ReadByte());
- writer.Write(reader.ReadByte());
- writer.Write(reader.ReadByte()); // spell
- writer.Write(reader.ReadByte()); // class
- writer.Write(reader.ReadByte()); // special item
- writer.Write(reader.ReadByte()); // trait 0
- writer.Write(reader.ReadByte()); // trait 1
- Byte nameLength = reader.ReadByte();
- writer.Write(nameLength);
- writer.Write(reader.ReadChars(nameLength)); // name
- writer.Write(reader.ReadByte());
- writer.Write(reader.ReadByte());
- writer.Write(reader.ReadByte());
- writer.Write(reader.ReadByte()); // diary entries
- writer.Write(reader.ReadInt32() + 20); // bonus health
- writer.Write(reader.ReadInt32() + 10); // bonus strength
- writer.Write(reader.ReadInt32() + 20); // bonus mana
- writer.Write(reader.ReadInt32() + 20); // bonus defence
- writer.Write(reader.ReadInt32()); // bonus weight
- writer.Write(reader.ReadInt32() + 10); // bonus magic
- while (reader.PeekChar() != -1) // Everything else
- writer.Write(reader.ReadByte());
- reader.Close();
- writer.Close();
- }
- catch (FileNotFoundException ex)
- {
- Console.WriteLine("Error: " + ex.ToString());
- }
- }
- protected static void SuperBoost()
- {
- try
- {
- // Create a copy of the file that we will be adjusting, just to be safe.
- File.Delete(@".\Backup-RogueLegacyPlayer.rcdat");
- File.Copy(@".\RogueLegacyPlayer.rcdat", @".\Backup-RogueLegacyPlayer.rcdat");
- // Open the backup copy of the file. This file will not be edited, just read.
- BinaryReader reader = new BinaryReader(new FileStream(@".\Backup-RogueLegacyPlayer.rcdat", FileMode.Open), new ASCIIEncoding());
- // Open the other file for writing.
- BinaryWriter writer = new BinaryWriter(new FileStream(@".\RogueLegacyPlayer.rcdat", FileMode.Truncate));
- /* The basic idea here is to use the reader to read data from the backup save and use the writer
- * to write most of that same data to the new save file. The data which is entered manually and not from the reader
- * is what makes the differences in the new save file.
- */
- writer.Write(reader.ReadInt32()); // money
- writer.Write(reader.ReadInt32()); // currentHealth
- writer.Write(reader.ReadInt32()); // currentMana
- writer.Write(reader.ReadByte());
- writer.Write(reader.ReadByte());
- writer.Write(reader.ReadByte()); // spell
- writer.Write(reader.ReadByte()); // class
- writer.Write((Byte)4); reader.ReadByte(); // special item
- writer.Write((Byte)16); reader.ReadByte(); // trait 0
- writer.Write((Byte)23); reader.ReadByte(); // trait 1
- Byte nameLength = reader.ReadByte();
- writer.Write(nameLength);
- writer.Write(reader.ReadChars(nameLength)); // name
- writer.Write(reader.ReadByte());
- writer.Write(reader.ReadByte());
- writer.Write(reader.ReadByte());
- writer.Write((Byte)25); reader.ReadByte(); // diary entries
- writer.Write(10000); reader.ReadInt32(); // bonus health
- writer.Write(1000); reader.ReadInt32(); // bonus strength
- writer.Write(10000); reader.ReadInt32(); // bonus mana
- writer.Write(1000); reader.ReadInt32(); // bonus defence
- writer.Write(500); reader.ReadInt32(); // bonus weight
- writer.Write(1000); reader.ReadInt32(); // bonus magic
- while (reader.PeekChar() != -1) // Everything else
- writer.Write(reader.ReadByte());
- reader.Close();
- writer.Close();
- }
- catch (FileNotFoundException ex)
- {
- Console.WriteLine("Error: " + ex.ToString());
- }
- }
- protected static void GearAndEnchantments()
- {
- try
- {
- // Create a copy of the file that we will be adjusting, just to be safe.
- File.Delete(@".\Backup-RogueLegacyBP.rcdat");
- File.Copy(@".\RogueLegacyBP.rcdat", @".\Backup-RogueLegacyBP.rcdat");
- // Open the backup copy of the file. This file will not be edited, just read.
- BinaryReader reader = new BinaryReader(new FileStream(@".\Backup-RogueLegacyBP.rcdat", FileMode.Open), new ASCIIEncoding());
- // Open the other file for writing.
- BinaryWriter writer = new BinaryWriter(new FileStream(@".\RogueLegacyBP.rcdat", FileMode.Truncate));
- // Write 3 to the first 130 bytes. 130 bytes for the (5 * 15) equipment from the blacksmith and (5 * 11) for all of the
- // runes from the enchantress. 3 is the value of the enum meaning purchased.
- for (int i = 0; i < 5 * 15 + 5 * 11; i++)
- writer.Write((Byte)3);
- // Then read past the first 130 bytes
- reader.ReadBytes(130);
- while (reader.PeekChar() != -1) // Everything else
- writer.Write(reader.ReadByte());
- reader.Close();
- writer.Close();
- }
- catch (FileNotFoundException ex)
- {
- Console.WriteLine("Error: " + ex.ToString());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment