//loadINI is responsible for setting up the UI based on the variable values of thisINI private void loadINI() { thisINI = INI.GetINI(); playedBox.Text = thisINI.timePlayed.ToString(); deathsBox.Text = thisINI.deaths.ToString(); FUNBox.Text = thisINI.FUN.ToString(); asrielCheck.IsChecked = thisINI.skipAsrielStory; resetCheck.IsChecked = thisINI.trueResetted; doorCheck.IsChecked = thisINI.doorUnlocked; floweyMetBox.Text = thisINI.timesMetFlowey.ToString(); floweyChatCombo.SelectedIndex = thisINI.floweyChatProgress; pieCombo.SelectedIndex = thisINI.piePreference - 1; sansMetBox.Text = thisINI.timesMetSans.ToString(); sansPasswordCombo.SelectedIndex = thisINI.sansPasswordProgress; papyrusMetBox.Text = thisINI.timesMetPapyrus.ToString(); skipTurnCheck.IsChecked = thisINI.mettatonSkip; fightCombo.SelectedIndex = thisINI.fightStage; skipPhotoshopCheck.IsChecked = thisINI.skipFight; }
//We use the Window_Loaded event to create new instances of our SAVEFile and INI file classes, as well as populating our UI controls and item dicts private void SharpWindow_Loaded(object sender, RoutedEventArgs e) { loading = true; thisSave = new SAVE.SAVEFile(); thisINI = new INI.INIFile(); IDs.Weapons.populateDictionary(); IDs.Armors.populateDictionary(); IDs.Items.populateDictionary(); IDs.PhoneItems.populateDictionary(); IDs.InventoryItems.populateDictionary(); IDs.Locations.populateDictionary(); Stats.populateDictionary(); populateAllCombos(); setDefaultValues(); thisINI = INI.GetINI(); loadINI(); loading = false; }
//makeSave loops through all UI controls and converts and casts to thisSave variable types as required to create a new save void makeSave() { thisSave.PlayerName = nameBox.Text; thisSave.Location = IDs.Locations.GetRoomID(locationCombo.SelectedItem.ToString()); thisSave.LOVE = Convert.ToInt16(LOVECombo.Text); thisSave.KillCount = Convert.ToInt16(killsBox.Text); thisSave.GOLD = Convert.ToInt16(GOLDBox.Text); thisSave.Weapon = IDs.GetID(weaponCombo.SelectedItem.ToString()); thisSave.Armor = IDs.GetID(armorCombo.SelectedItem.ToString()); thisSave.HP = Convert.ToInt16(HPBox.Text); thisSave.friskAT = Convert.ToInt16(friskATBox.Text) + 10; //For some reason, the game sets Frisk's base AT to -10 of what is set in the thisSave.friskDF = Convert.ToInt16(friskDFBox.Text) + 10; //save file. Am I missing something regarding the AT/DF system? thisSave.weaponAT = Convert.ToInt16(weaponATBox.Text); thisSave.armorDF = Convert.ToInt16(armorDFBox.Text); int i = 0; Array.Clear(thisSave.inventoryItems, 0, thisSave.inventoryItems.Length); foreach (Grid grid in inventoryGrid.Children.OfType <Grid>()) { foreach (ComboBox comboBox in grid.Children.OfType <ComboBox>()) { thisSave.inventoryItems[i] = IDs.GetID(comboBox.SelectedItem.ToString()); i++; } } i = 0; Array.Clear(thisSave.phoneItems, 0, thisSave.phoneItems.Length); foreach (var checkBox in phoneItemsGrid.Children.OfType <CheckBox>()) { if ((bool)checkBox.IsChecked) { thisSave.phoneItems[i] = IDs.GetID(checkBox.Content.ToString()); i++; } } thisSave.SaveName = saveNameBox.Text; thisINI = INI.GetINI(); thisINI.sansMetInJudgment = MiscFunctions.SetBooleanValueFromLocation(thisSave.Location, 232); if (thisSave.Location == 999) { thisINI.photoshopFight = true; } else { thisINI.skipFight = false; } if (thisSave.Location == 998) { thisSave = SAVE.SAVEFile.SetSaveForRoute(thisSave, thisSave.Location, Routes.GameRoutes.Genocide); genocideRadio.IsChecked = true; } if (GetSelectedRoute() >= Routes.GameRoutes.TruePacifistAsrielTalk) { thisINI.barrierDestroyed = true; } if (GetSelectedRoute() == Routes.GameRoutes.TruePacifistEpilogue) { thisINI.canTrueReset = true; } else if (GetSelectedRoute() == Routes.GameRoutes.Genocide) { thisINI.killedSans = MiscFunctions.SetBooleanValueFromLocation(thisSave.Location, 232); } }