Advertisement
Scarlet

Hyrule Warriors Legends Save Editor

Jan 24th, 2016
1,359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 33.84 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Hyrule_Warriors_Legends_Save_Editor
  9. {
  10.     class Program
  11.     {
  12.         static string currentFolder = Directory.GetCurrentDirectory();
  13.  
  14.         static string[] characterNames = new string[24]
  15.         {
  16.             "Link",
  17.             "Zelda",
  18.             "Sheik",
  19.             "Impa",
  20.             "Ganon",
  21.             "Darunia",
  22.             "Ruto",
  23.             "Agitha",
  24.             "Imp Midna",
  25.             "Fi",
  26.             "Ghirahim",
  27.             "Zant",
  28.             "Lana",
  29.             "Cia",
  30.             "Volga",
  31.             "Wizzro",
  32.             "Twili Midna",
  33.             "Young Link",
  34.             "Tingle",
  35.             "Linkle",
  36.             "Skull Kid",
  37.             "Toon Link",
  38.             "Tetra",
  39.             "King Daphnes"
  40.         };
  41.  
  42.         static int[] characterOffsets = new int[24]
  43.         {
  44.             0x2EC0A,
  45.             0x2EC3A,
  46.             0x2EC6A,
  47.             0x2EC9A,
  48.             0x2ECCA,
  49.             0x2ECFA,
  50.             0x2ED2A,
  51.             0x2ED5A,
  52.             0x2ED8A,
  53.             0x2EDBA,
  54.             0x2EDEA,
  55.             0x2EE1A,
  56.             0x2EE4A,
  57.             0x2EE7A,
  58.             0x2EEAA,
  59.             0x2EEDA,
  60.             0x2EF0A,
  61.             0x2EF3A,
  62.             0x2EF6A,
  63.             0x2EFCA,
  64.             0x2EFFA,
  65.             0x2F02A,
  66.             0x2F05A,
  67.             0x2F08A
  68.         };
  69.  
  70.         static string[] bronzeMaterials = new string[22]
  71.             {
  72.                 "Metal Plate",
  73.                 "Monster Tooth",
  74.                 "Old Rag",
  75.                 "Soldier's Uniform",
  76.                 "Rock",
  77.                 "Aeralfos Leather",
  78.                 "Fiery Aeralfos Leather",
  79.                 "Gibdo Bandage",
  80.                 "Redead Bandage",
  81.                 "Lizalfos Scale",
  82.                 "Dinolfos Fang",
  83.                 "Moblin Flank",
  84.                 "Sheild-Moblin Helmet",
  85.                 "Piece of Darknut Armor",
  86.                 "Stalmaster Wrist Bone",
  87.                 "Big Poe Necklace",
  88.                 "Essence of Icy Big Poe",
  89.                 "Hylian Captain Gauntlet",
  90.                 "Goron Armor Breastplate",
  91.                 "Big Blin Hide",
  92.                 "Stone Blin Buckler",
  93.                 "Monster Horn"
  94.             };
  95.  
  96.         static int[] bronzeOffsets = new int[22]
  97.         {
  98.                 0x1924,
  99.                 0x1926,
  100.                 0x1928,
  101.                 0x192A,
  102.                 0x192C,
  103.                 0x192E,
  104.                 0x1930,
  105.                 0x1932,
  106.                 0x1934,
  107.                 0x1936,
  108.                 0x1938,
  109.                 0x193A,
  110.                 0x193C,
  111.                 0x193E,
  112.                 0x1940,
  113.                 0x1942,
  114.                 0x1944,
  115.                 0x1946,
  116.                 0x1948,
  117.                 0x19BE,
  118.                 0x19C0,
  119.                 0x19C2
  120.         };
  121.  
  122.         static string[] silverMaterials = new string[48]
  123.             {
  124.                 "Ganon's Mane",
  125.                 "King Dodongo's Claw",
  126.                 "Gohma's Acid",
  127.                 "Manhandla's Toxic Dust",
  128.                 "Argorok's Ember",
  129.                 "Imprisoned Scale",
  130.                 "Cia's Bracelet",
  131.                 "Volga's Helmet",
  132.                 "Wizzro's Robe",
  133.                 "Link's Boots",
  134.                 "Lana's Hair Clip",
  135.                 "Zelda's Brooch",
  136.                 "Impa's Hair Band",
  137.                 "Ganondorf's Gauntlet",
  138.                 "Sheik's Kunai",
  139.                 "Darunia's Spikes",
  140.                 "Ruto's Earrings",
  141.                 "Agitha's Basket",
  142.                 "Midna's Hair",
  143.                 "Fi's Heels",
  144.                 "Ghirahim's Sash",
  145.                 "Zant's Magic Gem",
  146.                 "Round Aeralfos Shield",
  147.                 "Fiery Aeralfos Wing",
  148.                 "Heavy Gibdo Sword",
  149.                 "ReDead Knight Ashes",
  150.                 "Lizalfos Gauntlet",
  151.                 "Dinolfos Arm Guard",
  152.                 "Moblin Spear",
  153.                 "Metal Moblin Shield",
  154.                 "Large Darknut Sword",
  155.                 "Stalmaster's Skull",
  156.                 "Big Poe's Lantern",
  157.                 "Icy Big Poe's Talisman",
  158.                 "Holy Hylian Shield",
  159.                 "Thick Goron Helmet",
  160.                 "Big Blin Club",
  161.                 "Stone Blin Helmet",
  162.                 "Helmaroc Plume",
  163.                 "Phantom Ganon's Cape",
  164.                 "Twili Midna's Hairpin",
  165.                 "Young Link's Belt",
  166.                 "Tingle's Map",
  167.                 "Linkle's Boots",
  168.                 "Skull Kid's Hat",
  169.                 "Pirate's Charm",
  170.                 "Tetra's Sandals",
  171.                 "King Daphnes's Robe"
  172.             };
  173.  
  174.         static int[] silverOffsets = new int[48]
  175.         {
  176.                 0x194A,
  177.                 0x194C,
  178.                 0x194E,
  179.                 0x1950,
  180.                 0x1952,
  181.                 0x1954,
  182.                 0x1956,
  183.                 0x1958,
  184.                 0x195A,
  185.                 0x195C,
  186.                 0x195E,
  187.                 0x1960,
  188.                 0x1962,
  189.                 0x1964,
  190.                 0x1966,
  191.                 0x1968,
  192.                 0x196A,
  193.                 0x196C,
  194.                 0x196E,
  195.                 0x1970,
  196.                 0x1972,
  197.                 0x1974,
  198.                 0x1976,
  199.                 0x1978,
  200.                 0x197A,
  201.                 0x197C,
  202.                 0x197E,
  203.                 0x1980,
  204.                 0x1982,
  205.                 0x1984,
  206.                 0x1986,
  207.                 0x1988,
  208.                 0x198A,
  209.                 0x198C,
  210.                 0x198E,
  211.                 0x1990,
  212.                 0x19C4,
  213.                 0x19C6,
  214.                 0x19C8,
  215.                 0x19CA,
  216.                 0x19CC,
  217.                 0x19CE,
  218.                 0x19D0,
  219.                 0x19D2,
  220.                 0x19D4,
  221.                 0x19D6,
  222.                 0x19D8,
  223.                 0x19DA
  224.         };
  225.  
  226.         static string[] goldMaterials = new string[32]
  227.         {
  228.             "Ganon's Fang",
  229.             "King Dodongo's Crystal",
  230.             "Gohma's Lens",
  231.             "Manhandla's Sapling",
  232.             "Argorok's Stone",
  233.             "The Imprisoned's Pillar",
  234.             "Cia's Staff",
  235.             "Volga's Dragon Spear",
  236.             "Wizzro's Ring",
  237.             "Link's Scarf",
  238.             "Lana's Cloak",
  239.             "Zelda's Tiara",
  240.             "Impa's Breastplate",
  241.             "Ganondorf's Jewel",
  242.             "Sheik's Turban",
  243.             "Darunia's Bracelet",
  244.             "Ruto's Scale",
  245.             "Agitha's Pendant",
  246.             "Midna's Fused Shadow",
  247.             "Fi's Crystal",
  248.             "Ghirahim's Cape",
  249.             "Zant's Helmet",
  250.             "Helmaroc King's Mask",
  251.             "Phantom Ganon's Sword",
  252.             "Twili Midna's Robe",
  253.             "Keaton Mask",
  254.             "Tingle's Watch",
  255.             "Linkle's Compass",
  256.             "Majora's Mask",
  257.             "Island Outfit",
  258.             "Tetra's Bandana",
  259.             "King Daphnes's Crown",
  260.         };
  261.  
  262.         static int[] goldOffsets = new int[32]
  263.         {
  264.             0x1992,
  265.             0x1994,
  266.             0x1996,
  267.             0x1998,
  268.             0x199A,
  269.             0x199C,
  270.             0x199E,
  271.             0x19A0,
  272.             0x19A2,
  273.             0x19A4,
  274.             0x19A6,
  275.             0x19A8,
  276.             0x19AA,
  277.             0x19AC,
  278.             0x19AE,
  279.             0x19B0,
  280.             0x19B2,
  281.             0x19B4,
  282.             0x19B6,
  283.             0x19B8,
  284.             0x19BA,
  285.             0x19BC,
  286.             0x19DC,
  287.             0x19DE,
  288.             0x19E0,
  289.             0x19E2,
  290.             0x19E4,
  291.             0x19E6,
  292.             0x19E8,
  293.             0x19EA,
  294.             0x19EC,
  295.             0x19EE
  296.         };
  297.  
  298.         static string[] itemNames = new string[]
  299.         {
  300.             "Weird Egg",
  301.             "Tasty Weird Egg",
  302.             "Delicious Weird Egg",
  303.             "Lon Lon Milk",
  304.             "Tasty Lon Lon Milk",
  305.             "Delicious Lon Lon Milk",
  306.             "Odd Mushroom",
  307.             "Tasty Odd Mushroom",
  308.             "Delicious Odd Mushroom",
  309.             "Deku Nut",
  310.             "Tasty Deku Nut",
  311.             "Delicious Deku Nut",
  312.             "Magic Beans",
  313.             "Tasty Magic Beans",
  314.             "Delicious Magic Beans",
  315.             "Pumpkin Soup",
  316.             "Tasty Pumpkin Soup",
  317.             "Delicious Pumpkin Soup",
  318.             "Sacred Water",
  319.             "Tasty Sacred Water",
  320.             "Delicious Sacred Water",
  321.             "Life Tree Fruit",
  322.             "Tasty Life Tree Fruit",
  323.             "Delicious Life Tree Fruit",
  324.             "Light Fruit",
  325.             "Tasty Light Fruit",
  326.             "Delicious Light Fruit",
  327.             "Stamina Fruit",
  328.             "Tasty Stamina Fruit",
  329.             "Delicious Stamina Fruit",
  330.             "Water Fruit",
  331.             "Tasty Water Fruit",
  332.             "Delicious Water Fruit",
  333.             "Mushroom Spores",
  334.             "Tasty Mushroom Spores",
  335.             "Delicious Mushroom Spores",
  336.             "All-Purpose Bait",
  337.             "Tasty All-Purpose Bait",
  338.             "Delicious All-Purpose Bait",
  339.             "Elixir Soup",
  340.             "Tasty Elixir Soup",
  341.             "Delicious Elixir Soup",
  342.             "Hyoi Pear",
  343.             "Tasty Hyoi Pear",
  344.             "Delicious Hyoi Pear",
  345.             "Ordon Goat Cheese",
  346.             "Tasty Ordon Goat Cheese",
  347.             "Delicious Ordon Goat Cheese",
  348.             "Great Fairy's Tears",
  349.             "Tasty Great Fairy's Tears",
  350.             "Delicious Great Fairy's Tears",
  351.             "Greengill",
  352.             "Tasty Greengill",
  353.             "Delicious Greengill",
  354.             "Ordon Catfish",
  355.             "Tasty Ordon Catfish",
  356.             "Delicious Ordon Catfish",
  357.             "Hyrule Bass",
  358.             "Tasty Hyrule Bass",
  359.             "Delicious Hyrule Bass",
  360.             "Hylian Pike",
  361.             "Tasty Hylian Pike",
  362.             "Delicious Hylian Pike",
  363.             "Reekfish",
  364.             "Tasty Reekfish",
  365.             "Delicious Reekfish",
  366.             "Hylian Loach",
  367.             "Tasty Hylian Loach",
  368.             "Delicious Hylian Loach",
  369.             "Skullfish",
  370.             "Tasty Skullfish",
  371.             "Delicious Skullfish",          
  372.             "Bombfish",
  373.             "Tasty Bombfish",
  374.             "Delicious Bombfish",
  375.             "Chu Jelly",
  376.             "Tasty Chu Jelly",
  377.             "Delicious Chu Jelly",
  378.             "Bee Larvae",
  379.             "Tasty Bee Larvae",
  380.             "Delicious Bee Larvae",
  381.             "Chateau Romani",
  382.             "Tasty Chateau Romani",
  383.             "Delicious Chateau Romani",          
  384.             "Bottled Water",
  385.             "Tasty Bottled Water",
  386.             "Delicious Bottled Water",
  387.             "Hot Spring Water",
  388.             "Tasty Hot Spring Water",
  389.             "Delicious Hot Spring Water",
  390.             "Rock Sirloin",
  391.             "Tasty Rock Sirloin",
  392.             "Delicious Rock Sirloin",
  393.             "Meat",
  394.             "Tasty Meat",
  395.             "Delicious Meat",
  396.             "Carrot",
  397.             "Tasty Carrot",
  398.             "Delicious Carrot",
  399.             "Ember Seeds",
  400.             "Tasty Ember Seeds",
  401.             "Delicious Ember Seeds",
  402.             "Scent Seeds",
  403.             "Tasty Scent Seeds",
  404.             "Delicious Scent Seeds",
  405.             "Pegasus Seeds",
  406.             "Tasty Pegasus Seeds",
  407.             "Delicious Pegasus Seeds",
  408.             "Gale Seeds",
  409.             "Tasty Gale Seeds",
  410.             "Delicious Gale Seeds",
  411.             "Mystery Seeds",
  412.             "Tasty Mystery Seeds",
  413.             "Delicious Mystery Seeds",
  414.             "Gratitude Crystal Red S",
  415.             "Gratitude Crystal Red M",
  416.             "Gratitude Crystal Red L",            // 0x23AE
  417.             "Gratitude Crystal Blue S",
  418.             "Gratitude Crystal Blue M",
  419.             "Gratitude Crystal Blue L",           // 0x23B1
  420.             "Gratitude Crystal Orange S",
  421.             "Gratitude Crystal Orange M",
  422.             "Gratitude Crystal Orange L",         // 0x23B4
  423.             "Gratitude Crystal Pink S",
  424.             "Gratitude Crystal Pink M",
  425.             "Gratitude Crystal Pink L",           // 0x23B7
  426.             "Gratitude Crystal Purple S",
  427.             "Gratitude Crystal Purple M",
  428.             "Gratitude Crystal Purple L",         // 0x23BA
  429.             "Pumpkin",
  430.             "Tasty Pumpkin",
  431.             "Delicious Pumpkin"
  432.         };
  433.  
  434.         static int[] itemOffsets = new int[]
  435.         {
  436.             0x233A,
  437.             0x233B,
  438.             0x233C,
  439.             0x233D,
  440.             0x233E,
  441.             0x233F,
  442.             0x2340,
  443.             0x2341,
  444.             0x2342,
  445.             0x2343,
  446.             0x2344,
  447.             0x2345,
  448.             0x2346,
  449.             0x2347,
  450.             0x2348,
  451.             0x2349,
  452.             0x234A,
  453.             0x234B,
  454.             0x234C,
  455.             0x234D,
  456.             0x234E,
  457.             0x234F,
  458.             0x2350,
  459.             0x2351,
  460.             0x2352,
  461.             0x2353,
  462.             0x2354,
  463.             0x2355,
  464.             0x2356,
  465.             0x2357,
  466.             0x2358,
  467.             0x2359,
  468.             0x235A,
  469.             0x235B,
  470.             0x235C,
  471.             0x235D,
  472.             0x235E,
  473.             0x235F,
  474.             0x2360,
  475.             0x2361,
  476.             0x2362,
  477.             0x2363,
  478.             0x2364,
  479.             0x2365,
  480.             0x2366,
  481.             0x2367,
  482.             0x2368,
  483.             0x2369,
  484.             0x236A,
  485.             0x236B,
  486.             0x236C,
  487.             0x236D,
  488.             0x236E,
  489.             0x236F,
  490.             0x2370,
  491.             0x2371,
  492.             0x2372,
  493.             0x2373,
  494.             0x2374,
  495.             0x2375,
  496.             0x2376,
  497.             0x2377,
  498.             0x2378,
  499.             0x2379,
  500.             0x237A,
  501.             0x237B,
  502.             0x237C,
  503.             0x237D,
  504.             0x237E,
  505.             0x237F,
  506.             0x2380,
  507.             0x2381,
  508.             0x2382,
  509.             0x2383,
  510.             0x2384,
  511.             0x2385,
  512.             0x2386,
  513.             0x2387,
  514.             0x2388,
  515.             0x2389,
  516.             0x238A,
  517.             0x238B,
  518.             0x238C,
  519.             0x238D,
  520.             0x238E,
  521.             0x238F,
  522.             0x2390,
  523.             0x2391,
  524.             0x2392,
  525.             0x2393,
  526.             0x2394,
  527.             0x2395,
  528.             0x2396,
  529.             0x2397,
  530.             0x2398,
  531.             0x2399,
  532.             0x239A,
  533.             0x239B,
  534.             0x239C,
  535.             0x239D,
  536.             0x239E,
  537.             0x239F,
  538.             0x23A0,
  539.             0x23A1,
  540.             0x23A2,
  541.             0x23A3,
  542.             0x23A4,
  543.             0x23A5,
  544.             0x23A6,
  545.             0x23A7,
  546.             0x23A8,
  547.             0x23A9,
  548.             0x23AA,
  549.             0x23AB,
  550.             0x23AC,
  551.             0x23AD,
  552.             0x23AE,
  553.             0x23AF,
  554.             0x23B0,
  555.             0x23B1,
  556.             0x23B2,
  557.             0x23B3,
  558.             0x23B4,
  559.             0x23B5,
  560.             0x23B6,
  561.             0x23B7,
  562.             0x23B8,
  563.             0x23B9,
  564.             0x23BA,
  565.             0x23BB,
  566.             0x23BC,
  567.             0x23BD
  568.         };
  569.  
  570.         static void Main(string[] args)
  571.         {
  572.  
  573.             /*-------------------*/
  574.             /*   Start of Main   */
  575.             /*-------------------*/
  576.  
  577.             int userSelection;
  578.  
  579.             DirectoryInfo folderInfo = new DirectoryInfo(currentFolder);
  580.             FileInfo[] fileList = folderInfo.GetFiles("zmha.bin");
  581.  
  582.             if (fileList.Length != 0)
  583.             {
  584.                 do
  585.                 {
  586.                     Console.Clear();
  587.  
  588.                     DrawMenu();
  589.  
  590.                     bool isNumber = int.TryParse(Console.ReadLine(), out userSelection);
  591.                     while (!isNumber || userSelection < 1 || userSelection > 10)
  592.                     {
  593.                         DisplayTextSameLine("Please enter a valid number: ");
  594.                         isNumber = int.TryParse(Console.ReadLine(), out userSelection);
  595.                     }
  596.  
  597.                     Console.Clear();
  598.  
  599.                     switch (userSelection)
  600.                     {
  601.                         case 1:
  602.                             MaxExp();
  603.                             break;
  604.  
  605.                         case 2:
  606.                             MaxRupees();
  607.                             break;
  608.  
  609.                         case 3:
  610.                             MaterialEdit("bronze", bronzeMaterials, bronzeOffsets);
  611.                             break;
  612.  
  613.                         case 4:
  614.                             MaterialEdit("silver", silverMaterials, silverOffsets);
  615.                             break;
  616.  
  617.                         case 5:
  618.                             MaterialEdit("gold", goldMaterials, goldOffsets);
  619.                             break;
  620.  
  621.                         case 6:
  622.                             FoodEdit();
  623.                             break;
  624.  
  625.                         case 7:
  626.                             AdventureItems();
  627.                             break;
  628.  
  629.                         case 8:
  630.                             GreatSeaItems();
  631.                             break;
  632.                         case 9:
  633.                             MasterItems();
  634.                             break;
  635.                     }
  636.  
  637.                 } while (userSelection != 10);
  638.             }
  639.  
  640.             else
  641.             {
  642.                 DisplayTextNewLine("zmha.bin not found, please place it in the same folder as this application.");
  643.                 PressEnterToContinue();
  644.             }
  645.  
  646.             /*-----------------*/
  647.             /*   End of Main   */
  648.             /*-----------------*/
  649.  
  650.         }
  651.  
  652.         static void DrawMenu()
  653.         {
  654.  
  655.             /*-----------------------*/
  656.             /*   Start of DrawMenu   */
  657.             /*-----------------------*/
  658.  
  659.             DisplayTextNewLine("Mediocre Hyrule Warriors Save Editor.");
  660.             DisplayTextNewLine("Choose something to edit <3");
  661.             string[] menuOptions = new string[]
  662.             {
  663.                 "1. Max Character Exp",
  664.                 "2. Max Your Rupees",
  665.                 "3. Bronze Materials",
  666.                 "4. Silver Materials",
  667.                 "5. Gold Materials",
  668.                 "6. Fairy Food",
  669.                 "7. Max Adventure Map Items",
  670.                 "8. Max Great Sea Map Items",
  671.                 "9. Max Master Quest Map Items",
  672.                 "10. Quit"
  673.             };
  674.  
  675.             for (int i = 0; i < menuOptions.Length; i++)
  676.             {
  677.                 DisplayTextNewLine(menuOptions[i]);
  678.             }
  679.  
  680.             /*---------------------*/
  681.             /*   End of DrawMenu   */
  682.             /*---------------------*/
  683.  
  684.         }
  685.  
  686.         static void MaxExp()
  687.         {
  688.  
  689.             /*---------------------*/
  690.             /*   Start of MaxExp   */
  691.             /*---------------------*/
  692.  
  693.             DisplayTextNewLine("Select a character with the appropriate number:");
  694.             DisplayTextNewLine("0. Max All Character Exp");
  695.             for (int i = 0; i < characterNames.Length; i++)
  696.             {
  697.                 DisplayTextNewLine((i + 1) + ". " + characterNames[i]);
  698.             }
  699.  
  700.             int userSelection;
  701.             bool isNumber = int.TryParse(ReadTextInput(), out userSelection);
  702.             while (!isNumber || userSelection < 0 || userSelection > characterNames.Length)
  703.             {
  704.                 DisplayTextSameLine("Please enter a valid number: ");
  705.                 isNumber = int.TryParse(ReadTextInput(), out userSelection);
  706.             }
  707.  
  708.             using (var fs = new FileStream(currentFolder + "\\zmha.bin", FileMode.Open, FileAccess.ReadWrite))
  709.             {
  710.                 if (userSelection != 0)
  711.                 {
  712.                     fs.Position = characterOffsets[userSelection - 1];
  713.                     fs.WriteByte(Convert.ToByte(0x11));
  714.  
  715.                     fs.Position = characterOffsets[userSelection - 1] + 1;
  716.                     fs.WriteByte(Convert.ToByte(0x7F));
  717.  
  718.                     fs.Position = characterOffsets[userSelection - 1] + 2;
  719.                     fs.WriteByte(Convert.ToByte(0x30));
  720.  
  721.                     fs.Position = characterOffsets[userSelection - 1] + 3;
  722.                     fs.WriteByte(Convert.ToByte(0x00));
  723.                 }
  724.  
  725.                 else
  726.                 {
  727.                     for (int i = 0; i < characterOffsets.Length; i++)
  728.                     {
  729.                         fs.Position = characterOffsets[i];
  730.                         fs.WriteByte(Convert.ToByte(0x11));
  731.  
  732.                         fs.Position = characterOffsets[i] + 1;
  733.                         fs.WriteByte(Convert.ToByte(0x7F));
  734.  
  735.                         fs.Position = characterOffsets[i] + 2;
  736.                         fs.WriteByte(Convert.ToByte(0x30));
  737.  
  738.                         fs.Position = characterOffsets[i] + 3;
  739.                         fs.WriteByte(Convert.ToByte(0x00));
  740.                     }
  741.                 }
  742.             }
  743.  
  744.             Console.Clear();
  745.  
  746.             DisplayTextNewLine("All done!");
  747.             DisplayTextNewLine("To apply the Exp, start a battle and KO a monster!");
  748.             PressEnterToContinue();
  749.  
  750.             /*-------------------*/
  751.             /*   End of MaxExp   */
  752.             /*-------------------*/
  753.  
  754.         }
  755.  
  756.         static void MaxRupees()
  757.         {
  758.  
  759.             /*------------------------*/
  760.             /*   Start of MaxRupees   */
  761.             /*------------------------*/
  762.  
  763.             using (var fs = new FileStream(currentFolder + "\\zmha.bin", FileMode.Open, FileAccess.ReadWrite))
  764.             {
  765.                 fs.Position = 0xE0;
  766.                 fs.WriteByte(Convert.ToByte(0x98));
  767.  
  768.                 fs.Position = 0xDF;
  769.                 fs.WriteByte(Convert.ToByte(0x96));
  770.  
  771.                 fs.Position = 0xDE;
  772.                 fs.WriteByte(Convert.ToByte(0x7F));
  773.  
  774.                 DisplayTextNewLine("You should now have 9,999,999 Rupees!");
  775.                 PressEnterToContinue();
  776.             }
  777.  
  778.             /*----------------------*/
  779.             /*   End of MaxRupees   */
  780.             /*----------------------*/
  781.  
  782.         }
  783.  
  784.         static void MaterialEdit(string materialType, string[] materialNames, int[] materialOffsets)
  785.         {
  786.  
  787.             /*---------------------------*/
  788.             /*   Start of MaterialEdit   */
  789.             /*---------------------------*/
  790.  
  791.             DisplayTextNewLine("Select a material with the appropriate number:");
  792.  
  793.             switch (materialType)
  794.             {
  795.                 case "bronze":
  796.                     DisplayTextNewLine("0. Edit All Bronze Materials");
  797.                     break;
  798.  
  799.                 case "silver":
  800.                     DisplayTextNewLine("0. Edit All Silver Materials");
  801.                     break;
  802.  
  803.                 case "gold":
  804.                     DisplayTextNewLine("0. Edit All Gold Materials");
  805.                     break;
  806.             }
  807.  
  808.             for (int i = 0; i < materialNames.Length; i++)
  809.             {
  810.                 DisplayTextNewLine((i + 1) + ". " + materialNames[i]);
  811.             }
  812.  
  813.             int userSelection;
  814.             bool isNumber = int.TryParse(ReadTextInput(), out userSelection);
  815.             while (!isNumber || userSelection < 0 || userSelection > materialNames.Length)
  816.             {
  817.                 DisplayTextSameLine("Please enter a valid number: ");
  818.                 isNumber = int.TryParse(ReadTextInput(), out userSelection);
  819.             }
  820.  
  821.             Console.Clear();
  822.  
  823.             using (var fs = new FileStream(currentFolder + "\\zmha.bin", FileMode.Open, FileAccess.ReadWrite))
  824.             {
  825.                 if (userSelection != 0)
  826.                 {
  827.                     DisplayTextNewLine(materialNames[userSelection - 1]);
  828.                     DisplayTextSameLine("Current Amount: ");
  829.  
  830.                     fs.Position = materialOffsets[userSelection - 1];
  831.                     string currentAmount2 = fs.ReadByte().ToString("X");
  832.  
  833.                     fs.Position = materialOffsets[userSelection - 1] + 1;
  834.                     string currentAmount1 = fs.ReadByte().ToString("X");
  835.  
  836.                     string currentAmountHex = currentAmount1 + currentAmount2;
  837.                     int currentAmountDec = int.Parse(currentAmountHex, System.Globalization.NumberStyles.HexNumber);
  838.  
  839.                     DisplayTextSameLine(currentAmountDec.ToString());
  840.  
  841.                     DisplayTextNewLine("");
  842.                     DisplayTextSameLine("Please enter a new value (between 0 and 999): ");
  843.  
  844.                     int newValueDec;
  845.                     isNumber = int.TryParse(ReadTextInput(), out newValueDec);
  846.  
  847.                     if (!isNumber || newValueDec < 0 || newValueDec > 999)
  848.                     {
  849.                         DisplayTextNewLine("Dude, if you don't want to follow the prompts, \nI don't want to help edit your save. BYE.");
  850.                         PressEnterToContinue();
  851.                         Environment.Exit(2);
  852.                     }
  853.  
  854.                     string newValueHex = newValueDec.ToString("X");
  855.  
  856.                     while (newValueHex.Length < 4)
  857.                     {
  858.                         newValueHex = "0" + newValueHex;
  859.                     }
  860.  
  861.                     currentAmount1 = "" + newValueHex[0] + newValueHex[1];
  862.                     currentAmount2 = "" + newValueHex[2] + newValueHex[3];
  863.  
  864.                     int amountInt1 = int.Parse(currentAmount1, System.Globalization.NumberStyles.HexNumber);
  865.                     int amountInt2 = int.Parse(currentAmount2, System.Globalization.NumberStyles.HexNumber);
  866.  
  867.                     fs.Position = materialOffsets[userSelection - 1];
  868.                     fs.WriteByte(Convert.ToByte(amountInt2));
  869.  
  870.                     fs.Position = materialOffsets[userSelection - 1] + 1;
  871.                     fs.WriteByte(Convert.ToByte(amountInt1));
  872.  
  873.                     DisplayTextNewLine("Values updated! ^^");
  874.                     PressEnterToContinue();
  875.                 }
  876.  
  877.                 else
  878.                 {
  879.                     string currentAmount1;
  880.                     string currentAmount2;
  881.  
  882.                     DisplayTextSameLine("Please enter a new value (between 0 and 999): ");
  883.  
  884.                     int newValueDec;
  885.                     isNumber = int.TryParse(ReadTextInput(), out newValueDec);
  886.  
  887.                     if (!isNumber || newValueDec < 0 || newValueDec > 999)
  888.                     {
  889.                         DisplayTextNewLine("Dude, if you don't want to follow the prompts, \nI don't want to help edit your save. BYE.");
  890.                         PressEnterToContinue();
  891.                         Environment.Exit(2);
  892.                     }
  893.  
  894.                     string newValueHex = newValueDec.ToString("X");
  895.  
  896.                     while (newValueHex.Length < 4)
  897.                     {
  898.                         newValueHex = "0" + newValueHex;
  899.                     }
  900.  
  901.                     currentAmount1 = "" + newValueHex[0] + newValueHex[1];
  902.                     currentAmount2 = "" + newValueHex[2] + newValueHex[3];
  903.  
  904.                     int amountInt1 = int.Parse(currentAmount1, System.Globalization.NumberStyles.HexNumber);
  905.                     int amountInt2 = int.Parse(currentAmount2, System.Globalization.NumberStyles.HexNumber);
  906.  
  907.                     for (int i = 0; i < materialOffsets.Length; i++)
  908.                     {
  909.                         fs.Position = materialOffsets[i];
  910.                         fs.WriteByte(Convert.ToByte(amountInt2));
  911.  
  912.                         fs.Position = materialOffsets[i] + 1;
  913.                         fs.WriteByte(Convert.ToByte(amountInt1));
  914.                     }
  915.  
  916.                     DisplayTextNewLine("Values updated! ^^");
  917.                     PressEnterToContinue();
  918.                 }
  919.             }
  920.  
  921.             /*-------------------------*/
  922.             /*   End of MaterialEdit   */
  923.             /*-------------------------*/
  924.  
  925.         }
  926.  
  927.         static void FoodEdit()
  928.         {
  929.  
  930.             /*-----------------------*/
  931.             /*   Start of FoodEdit   */
  932.             /*-----------------------*/
  933.  
  934.             DisplayTextNewLine("Select what you want to change with the appropriate number:");
  935.             DisplayTextNewLine("Or if you just want Gratitude Crystals, enter \"Grat\"");
  936.             DisplayTextNewLine("0. Max All Fairy Foods");
  937.             for (int i = 0; i < itemNames.Length; i++)
  938.             {
  939.                 DisplayTextNewLine((i + 1) + ". " + itemNames[i]);
  940.             }
  941.  
  942.             string userInput = ReadTextInput();
  943.            
  944.             if (userInput == "grat")
  945.             {
  946.                 using (var fs = new FileStream(currentFolder + "\\zmha.bin", FileMode.Open, FileAccess.ReadWrite))
  947.                 {
  948.                     for (int i = 0x23AE; i <= 0x23BA; i += 3)
  949.                     {// i starts on the offset of the first Gratitude crystal and adds 3 to get to the next
  950.                         fs.Position = i;
  951.                         fs.WriteByte(Convert.ToByte(0x63));
  952.                     }
  953.                 }
  954.  
  955.                 Console.Clear();
  956.  
  957.                 DisplayTextNewLine("All done! Be grateful! Geddit? :^)");
  958.                 PressEnterToContinue();
  959.                 return;
  960.             }
  961.  
  962.             int userSelection;
  963.             bool isNumber = int.TryParse(userInput, out userSelection);
  964.             while (!isNumber || userSelection < 0 || userSelection > itemNames.Length)
  965.             {
  966.                 DisplayTextSameLine("Please enter a valid number: ");
  967.                 isNumber = int.TryParse(ReadTextInput(), out userSelection);
  968.             }
  969.  
  970.             using (var fs = new FileStream(currentFolder + "\\zmha.bin", FileMode.Open, FileAccess.ReadWrite))
  971.             {
  972.                 if (userSelection != 0)
  973.                 {
  974.                     fs.Position = itemOffsets[userSelection - 1];
  975.                     fs.WriteByte(Convert.ToByte(0x63));
  976.                 }
  977.  
  978.                 else
  979.                 {
  980.                     for (int i = 0; i < itemOffsets.Length; i++)
  981.                     {
  982.                         fs.Position = itemOffsets[i];
  983.                         fs.WriteByte(Convert.ToByte(0x63));
  984.                     }
  985.                 }
  986.             }
  987.  
  988.             Console.Clear();
  989.  
  990.             DisplayTextNewLine("All done!");
  991.             DisplayTextNewLine("You should now have food to feed an army!");
  992.             PressEnterToContinue();
  993.  
  994.             /*---------------------*/
  995.             /*   End of FoodEdit   */
  996.             /*---------------------*/
  997.  
  998.         }
  999.  
  1000.         static void AdventureItems()
  1001.         {
  1002.  
  1003.             /*-----------------------------*/
  1004.             /*   Start of AdventureItems   */
  1005.             /*-----------------------------*/
  1006.  
  1007.             using (var fs = new FileStream(currentFolder + "\\zmha.bin", FileMode.Open, FileAccess.ReadWrite))
  1008.             {
  1009.                 for (int i = 0; i < 12; i++)
  1010.                 {
  1011.                     fs.Position = 0x2EFA + i;
  1012.                     fs.WriteByte(Convert.ToByte(0x5));
  1013.                 }
  1014.             }
  1015.  
  1016.             Console.Clear();
  1017.  
  1018.             DisplayTextNewLine("All done! Enjoy your items!");
  1019.             PressEnterToContinue();
  1020.  
  1021.             /*---------------------------*/
  1022.             /*   End of AdventureItems   */
  1023.             /*---------------------------*/
  1024.  
  1025.         }
  1026.  
  1027.         static void GreatSeaItems()
  1028.         {
  1029.  
  1030.             /*----------------------------*/
  1031.             /*   Start of GreatSeaItems   */
  1032.             /*----------------------------*/
  1033.  
  1034.             using (var fs = new FileStream(currentFolder + "\\zmha.bin", FileMode.Open, FileAccess.ReadWrite))
  1035.             {
  1036.                 // Compass
  1037.                 fs.Position = 0xEB56;
  1038.                 fs.WriteByte(Convert.ToByte(0x5));
  1039.  
  1040.                 // Hookshot
  1041.                 fs.Position = 0xEB5F;
  1042.                 fs.WriteByte(Convert.ToByte(0x5));
  1043.  
  1044.                 for (int i = 0; i < 10; i++)
  1045.                 {// Wind Waker / Cannon / Boomerang / Hero's Bow / Salvage Arm / Hyoi Pear / Deku Leaf / Sea Map / Power Bracelet / Hammer
  1046.                     fs.Position = 0xEB73 + i;
  1047.                     fs.WriteByte(Convert.ToByte(0x5));
  1048.                 }
  1049.             }
  1050.  
  1051.             Console.Clear();
  1052.  
  1053.             DisplayTextNewLine("All done! Enjoy your items!");
  1054.             PressEnterToContinue();
  1055.  
  1056.             /*--------------------------*/
  1057.             /*   End of GreatSeaItems   */
  1058.             /*--------------------------*/
  1059.  
  1060.         }
  1061.  
  1062.         static void MasterItems()
  1063.         {
  1064.  
  1065.             /*--------------------------*/
  1066.             /*   Start of MasterItems   */
  1067.             /*--------------------------*/
  1068.  
  1069.             using (var fs = new FileStream(currentFolder + "\\zmha.bin", FileMode.Open, FileAccess.ReadWrite))
  1070.             {
  1071.                 for (int i = 0; i < 12; i++)
  1072.                 {
  1073.                     fs.Position = 0x7A52 + i;
  1074.                     fs.WriteByte(Convert.ToByte(0x5));
  1075.                 }
  1076.             }
  1077.  
  1078.             Console.Clear();
  1079.  
  1080.             DisplayTextNewLine("All done! Enjoy your items!");
  1081.             PressEnterToContinue();
  1082.  
  1083.             /*------------------------*/
  1084.             /*   End of MasterItems   */
  1085.             /*------------------------*/
  1086.  
  1087.         }
  1088.  
  1089.         static string ReadTextInput()
  1090.         {
  1091.             string userText = Console.ReadLine().ToLower();
  1092.             return userText;
  1093.         }
  1094.  
  1095.         static void DisplayTextNewLine(string text)
  1096.         {
  1097.             Console.WriteLine("{0}", text);
  1098.         }
  1099.  
  1100.         static void DisplayTextSameLine(string text)
  1101.         {
  1102.             Console.Write("{0}", text);
  1103.         }
  1104.  
  1105.         static void PressEnterToContinue()
  1106.         {
  1107.             DisplayTextNewLine("\nPress Enter");
  1108.             Console.ReadLine();
  1109.         }
  1110.     }
  1111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement