Ejemplo n.º 1
0
        private void clearGenocideButton_Click(object sender, RoutedEventArgs e)
        {
            FileOperations.setGenocide(GenocideStates.None);

            Dictionary <Characters, string> messageDict = new Dictionary <Characters, string>()
            {
                { Characters.Alphys, "O-O-Okay, the effects are cleared!\nTrue Pacifist ending will proceed as normal." },
                { Characters.Asgore, "Well human, those effects have been removed!\nTrue Pacifist ending will proceed as normal." },
                { Characters.Asriel, "Hey, those effects are gone, ok?\nTrue Pacifist ending will proceed as normal." },
                { Characters.Flowey, "YOU. CHEATING. IDIOT.\nTrue Pacifist ending will proceed as normal." },
                { Characters.Papyrus, "HUMAN, THOSE BAD EFFECTS ARE GONE. I NEVER STOPPED BELIEVING IN YOU!\nTrue Pacifist ending will proceed as normal." },
                { Characters.Sans, "you dirty hacker.\nTrue Pacifist ending will proceed as normal." },
                { Characters.Toriel, "Those effects are gone now, my child.\nTrue Pacifist ending will proceed as normal." },
                { Characters.Undyne, "YOU PUNK! THOSE EFFECTS ARE GONE!\nTrue Pacifist ending will proceed as normal." },
                { Characters.None, "Genocide effects have been cleared. True Pacifist ending will proceed as normal." }
            };

            UTMessageBox.Show(messageDict, Constants.CharacterReactions.Positive, MessageBoxButton.OK);
        }
Ejemplo n.º 2
0
        private void setSoullessButton_Click(object sender, RoutedEventArgs e)
        {
            FileOperations.setGenocide(GenocideStates.Soulless);

            Dictionary <Characters, string> messageDict = new Dictionary <Characters, string>()
            {
                { Characters.Alphys, "W-w-why would you do such a horrible thing? True Pacifist ending will be altered." },
                { Characters.Asgore, "Uh, what kind of monster are you? True Pacifist ending will be altered." },
                { Characters.Asriel, "I can help, I can-- please don't kill me. True Pacifist ending will be altered." },
                { Characters.Flowey, "You're soulless. Just like me. True Pacifist ending will be altered." },
                { Characters.Papyrus, "YOU CAN DO BETTER HUMAN, I STILL BELIEVE IN YOU! True Pacifist ending will be altered." },
                { Characters.Sans, "you dirty brother killer. True Pacifist ending will be altered." },
                { Characters.Toriel, "Be good, alright? My child... True Pacifist ending will be altered." },
                { Characters.Undyne, "You've made your choice. You're going to have to get past ME. True Pacifist ending will be altered." },
                { Characters.None, "Genocide effects activated. True Pacifist ending will be altered." }
            };

            UTMessageBox.Show(messageDict, Constants.CharacterReactions.Negative, MessageBoxButton.OK);
        }
Ejemplo n.º 3
0
            //WriteSaveFile writes, well, the save file.
            public static bool WriteSaveFile(SAVEFile fileToWrite, INI.INIFile ini)
            {
                //SetFlagFromBool converts a boolean variable or value to a string to be written as a flag in file0
                string SetFlagFromBool(bool booleanToCheck, int valueToSet = 1)
                {
                    if (booleanToCheck)
                    {
                        return(valueToSet.ToString());
                    }

                    else
                    {
                        return("0");
                    }
                }

                //We use an ordered dictionary with the key as the line number in file0 to write the value to
                OrderedDictionary file0Contents = new OrderedDictionary
                {
                    { 1, fileToWrite.PlayerName },
                    { 2, fileToWrite.LOVE.ToString() },
                    { 3, fileToWrite.HP.ToString() },
                    { 4, "0" },
                    { 5, fileToWrite.friskAT.ToString() },
                    { 6, fileToWrite.weaponAT.ToString() },
                    { 7, fileToWrite.friskDF.ToString() },
                    { 8, fileToWrite.armorDF.ToString() },
                    { 9, "4" },
                    { 10, fileToWrite.EXP.ToString() },
                    { 11, fileToWrite.GOLD.ToString() },
                    { 12, fileToWrite.KillCount.ToString() },
                    { 13, fileToWrite.inventoryItems[0].ToString() },
                    { 14, fileToWrite.phoneItems[0].ToString() },
                    { 15, fileToWrite.inventoryItems[1].ToString() },
                    { 16, fileToWrite.phoneItems[1].ToString() },
                    { 17, fileToWrite.inventoryItems[2].ToString() },
                    { 18, fileToWrite.phoneItems[2].ToString() },
                    { 19, fileToWrite.inventoryItems[3].ToString() },
                    { 20, fileToWrite.phoneItems[3].ToString() },
                    { 21, fileToWrite.inventoryItems[4].ToString() },
                    { 22, "0" },
                    { 23, fileToWrite.inventoryItems[5].ToString() },
                    { 24, "0" },
                    { 25, fileToWrite.inventoryItems[6].ToString() },
                    { 26, "0" },
                    { 27, fileToWrite.inventoryItems[7].ToString() },
                    { 28, "0" },
                    { 29, fileToWrite.Weapon },
                    { 30, fileToWrite.Armor },
                    { 38, Convert.ToInt16(fileToWrite.asrielDefeated) },
                    { 39, Convert.ToInt16(fileToWrite.randomCountersDisabled) },
                    { 45, (int)fileToWrite.ruinsDummyState },
                    { 76, (int)fileToWrite.torielState },
                    { 83, (int)fileToWrite.doggoState },
                    { 84, (int)fileToWrite.dogamyState },
                    { 85, (int)fileToWrite.greaterDogState },
                    { 88, (int)fileToWrite.comedianState },
                    { 98, (int)fileToWrite.papyrusState },
                    { 112, (int)fileToWrite.shyrenState },
                    { 119, (int)fileToWrite.papyrusDated },
                    { 232, fileToWrite.KillCount },
                    { 233, fileToWrite.ruinsKills },
                    { 234, fileToWrite.snowdinKills },
                    { 235, fileToWrite.waterfallKills },
                    { 236, fileToWrite.hotlandKills },
                    { 282, (int)fileToWrite.undyneState },
                    { 283, (int)fileToWrite.madDummyState },
                    { 381, (int)fileToWrite.undyneState },
                    { 398, Convert.ToInt16(fileToWrite.disableAlphysCalls) },
                    { 399, Convert.ToInt16(fileToWrite.disableAlphysCalls) },
                    { 402, Convert.ToInt16(fileToWrite.disableHotlandPuzzles) },
                    { 404, Convert.ToInt16(fileToWrite.disableHotlandPuzzles) },
                    { 405, Convert.ToInt16(fileToWrite.disableHotlandPuzzles) },
                    { 406, Convert.ToInt16(fileToWrite.disableHotlandPuzzles) },
                    { 420, (int)fileToWrite.undyneDated },
                    { 428, (int)fileToWrite.muffetState },
                    { 430, Convert.ToInt16(fileToWrite.disableHotlandPuzzles) },
                    { 431, Convert.ToInt16(fileToWrite.disableHotlandPuzzles) },
                    { 433, (int)fileToWrite.broGuardsState },
                    { 449, SetFlagFromBool(fileToWrite.coreElevatorUnlocked) },
                    { 456, (int)fileToWrite.mettatonState },
                    { 462, SetFlagFromBool(fileToWrite.insideCastle) },
                    { 463, SetFlagFromBool(fileToWrite.rodeCastleLift) },
                    { 481, SetFlagFromBool(ini.skipAsrielStory, 17) },
                    { 483, SetFlagFromBool(fileToWrite.unlockedCastleChain) },
                    { 484, SetFlagFromBool(fileToWrite.unlockedCastleChain) },
                    { 485, SetFlagFromBool(fileToWrite.unlockedCastleChain) },
                    { 486, SetFlagFromBool(ini.skipAsrielStory) },
                    { 487, SetFlagFromBool(ini.skipAsrielStory, 2) },
                    { 496, Convert.ToInt16(fileToWrite.undyneOnPhone) },
                    { 510, SetFlagFromBool(fileToWrite.asrielDefeated, 2) },
                    { 512, SetFlagFromBool(fileToWrite.beatTrueLab, 3) },
                    { 513, SetFlagFromBool(fileToWrite.beatTrueLab, 3) },
                    { 514, SetFlagFromBool(fileToWrite.beatTrueLab, 3) },
                    { 515, SetFlagFromBool(fileToWrite.beatTrueLab, 3) },
                    { 516, SetFlagFromBool(fileToWrite.beatTrueLab) },
                    { 517, SetFlagFromBool(fileToWrite.beatTrueLab, 10) },
                    { 518, SetFlagFromBool(fileToWrite.beatTrueLab, 0) },
                    { 519, SetFlagFromBool(fileToWrite.beatTrueLab) },
                    { 520, SetFlagFromBool(fileToWrite.beatTrueLab) },
                    { 521, SetFlagFromBool(fileToWrite.beatTrueLab) },
                    { 522, SetFlagFromBool(fileToWrite.beatTrueLab) },
                    { 523, SetFlagFromBool(fileToWrite.dateAlphysFlag) },
                    { 524, fileToWrite.pacifistStage },
                    { 543, fileToWrite.Plot },
                    { 544, "1" },
                    { 545, "1" },
                    { 546, SetFlagFromBool(MiscFunctions.SetBooleanValueFromLocation(fileToWrite.Location, 12)) }, //Cell Phone
                    { 547, "0" },
                    { 548, fileToWrite.Location.ToString() },
                    { 549, "0" }
                };

                if (fileToWrite.Location == 998)
                {
                    fileToWrite.Location = 235;
                    FileOperations.setGenocide(GenocideStates.Abyss);
                }

                else if (fileToWrite.Location == 999)
                {
                    fileToWrite.Location = 237;
                }

                try
                {
                    StreamWriter file0Writer = new StreamWriter(File.Open(Constants.SavesPath + fileToWrite.SaveName + "//file0", FileMode.Create), Encoding.ASCII);

                    //We iterate through every line and key in file0Contents and if the key value matches lineNumber, we write the corresponding value
                    for (int lineNumber = 1; lineNumber <= 549; lineNumber++)
                    {
                        foreach (DictionaryEntry file0Entry in file0Contents)
                        {
                            if ((int)file0Entry.Key == lineNumber)
                            {
                                file0Writer.WriteLine(file0Entry.Value.ToString());
                                break;
                            }

                            else if ((int)file0Entry.Key > lineNumber)
                            {
                                file0Writer.WriteLine("0");
                                break;
                            }
                        }
                    }

                    file0Writer.Close();

                    if (fileToWrite.Location >= 238 || fileToWrite.Plot >= 208)
                    {
                        File.Copy(Constants.SavesPath + fileToWrite.SaveName + "//file0", Constants.SavesPath + fileToWrite.SaveName + "//file8", true);
                    }
                    return(true);
                }

                catch (Exception ex)
                {
                    System.Windows.MessageBox.Show("An exception occurred when writing the save file. Cannot continue. The exception was: \n\n" + ex, "Error!",
                                                   MessageBoxButton.OK, MessageBoxImage.Error);
                    return(false);
                }
            }