private static bool WeaponNameIsInUse(Model.ChapterSave chapterSave, byte nameId) { bool nameInUse = false; nameInUse = chapterSave.ConvoyRegion.Convoy.Any((x) => x.IsNamed && x.WeaponNameID == nameId); if (!nameInUse) { foreach (var unit in chapterSave.UnitRegion.Units) { nameInUse |= unit.Item_1.IsNamed && unit.Item_1.WeaponNameID == nameId; nameInUse |= unit.Item_2.IsNamed && unit.Item_2.WeaponNameID == nameId; nameInUse |= unit.Item_3.IsNamed && unit.Item_3.WeaponNameID == nameId; nameInUse |= unit.Item_4.IsNamed && unit.Item_4.WeaponNameID == nameId; nameInUse |= unit.Item_5.IsNamed && unit.Item_5.WeaponNameID == nameId; if (nameInUse) { break; } } } return(nameInUse); }
public void LoadChapterSave(Model.ChapterSave chapterSave) { _chapterSave = chapterSave; UnbindEvents(); PopulateControls(); BindEvents(); }
public static int GetItemTotalAcrossUnits(Model.ChapterSave chapterSave, Enums.Item itemId) { int count = 0; foreach (var unit in chapterSave.UnitRegion.Units) { if (unit.Item_1.ItemID == itemId) { count++; } if (unit.Item_2.ItemID == itemId) { count++; } if (unit.Item_3.ItemID == itemId) { count++; } if (unit.Item_4.ItemID == itemId) { count++; } if (unit.Item_5.ItemID == itemId) { count++; } } return(count); }
public void LoadChapterSave(Model.ChapterSave chapterSave) { _chapterSave = chapterSave; skills1.LoadChapterSave(_chapterSave); PopulateControls(); }
public Supports(Model.ChapterSave chapterSave, Model.Unit unit) { _chapterSave = chapterSave; _unit = unit; InitializeComponent(); SetTitle(); BindEvents(); }
private void LoadFile(string path) { var saveFile = Model.SaveFile.FromPath(path); if (saveFile.Type != Enums.SaveFileType.Chapter && saveFile.Type != Enums.SaveFileType.Global) { MessageBox.Show("This type of save is not supported yet. Only 'Chapter' and 'Global' saves are supported right now."); return; } else { _saveFile = saveFile; } UpdateTitleBar(path); Cursor.Current = Cursors.WaitCursor; switch (_saveFile.Type) { case Enums.SaveFileType.Chapter: _chapterSave = Model.ChapterSave.FromSaveFile(_saveFile); _globalSave = null; LoadChapterData(); LoadUnitViewer(); tabChapterData.Enabled = true; tabUnitViewer.Enabled = true; tabMegacheats.Enabled = true; tabNewGamePlus.Enabled = true; tabConvoy.Enabled = true; tabGlobalData.Enabled = false; break; case Enums.SaveFileType.Global: _globalSave = Model.GlobalSave.FromSaveFile(_saveFile); _chapterSave = null; LoadGlobalData(); tabChapterData.Enabled = false; tabUnitViewer.Enabled = false; tabMegacheats.Enabled = false; tabNewGamePlus.Enabled = false; tabConvoy.Enabled = false; tabGlobalData.Enabled = true; break; default: break; } Cursor.Current = Cursors.AppStarting; tabControl1.Enabled = true; }
public static void RemoveWeaponNameIfUnused(Model.ChapterSave chapterSave, byte nameId) { bool nameInUse = WeaponNameIsInUse(chapterSave, nameId); if (!nameInUse) { chapterSave.WeaponNameRegion.WeaponNames.RemoveAll((x) => x.ID == nameId); } }
public static void RemoveNamesFromHeldWeaponsWithInvalidNames(Model.ChapterSave chapterSave, Model.Unit unit) { if (unit.Item_1.IsNamed && !chapterSave.WeaponNameRegion.WeaponNames.Any((x) => x.ID == unit.Item_1.WeaponNameID)) { unit.Item_1.IsNamed = false; } if (unit.Item_2.IsNamed && !chapterSave.WeaponNameRegion.WeaponNames.Any((x) => x.ID == unit.Item_2.WeaponNameID)) { unit.Item_2.IsNamed = false; } if (unit.Item_3.IsNamed && !chapterSave.WeaponNameRegion.WeaponNames.Any((x) => x.ID == unit.Item_3.WeaponNameID)) { unit.Item_3.IsNamed = false; } if (unit.Item_4.IsNamed && !chapterSave.WeaponNameRegion.WeaponNames.Any((x) => x.ID == unit.Item_4.WeaponNameID)) { unit.Item_4.IsNamed = false; } if (unit.Item_5.IsNamed && !chapterSave.WeaponNameRegion.WeaponNames.Any((x) => x.ID == unit.Item_5.WeaponNameID)) { unit.Item_5.IsNamed = false; } }
private void openFileToolStripMenuItem_Click(object sender, EventArgs e) { openFileDialog1.FileName = ""; openFileDialog1.Filter = "'Chapter' save|*"; var startupPath = Config.StartupPath; if (startupPath == "" || !Directory.Exists(startupPath)) { startupPath = Application.StartupPath; } openFileDialog1.InitialDirectory = startupPath; if (openFileDialog1.ShowDialog() == DialogResult.OK) { Config.StartupPath = Path.GetDirectoryName(openFileDialog1.FileName); var saveFile = Model.SaveFile.FromPath(openFileDialog1.FileName); if (saveFile.Type != Enums.SaveFileType.Chapter && saveFile.Type != Enums.SaveFileType.Global) { MessageBox.Show("This type of save is not supported yet. Only 'Chapter' and 'Global' saves are supported right now."); return; } else { _saveFile = saveFile; } UpdateTitleBar(openFileDialog1.FileName); switch (_saveFile.Type) { case Enums.SaveFileType.Chapter: _chapterSave = Model.ChapterSave.FromSaveFile(_saveFile); _globalSave = null; LoadChapterData(); LoadUnitViewer(); tabChapterData.Enabled = true; tabUnitViewer.Enabled = true; tabMegacheats.Enabled = true; tabNewGamePlus.Enabled = true; tabGlobalData.Enabled = false; break; case Enums.SaveFileType.Global: _globalSave = Model.GlobalSave.FromSaveFile(_saveFile); _chapterSave = null; LoadGlobalData(); tabChapterData.Enabled = false; tabUnitViewer.Enabled = false; tabMegacheats.Enabled = false; tabNewGamePlus.Enabled = false; tabGlobalData.Enabled = true; break; default: break; } tabControl1.Enabled = true; } }
public void LoadCharacter(Model.ChapterSave chapterSave, Model.Character unit) { _chapterSave = chapterSave; _unit = unit; PopulateControls(); }
public void LoadUnit(Model.ChapterSave chapterSave, Model.Unit unit) { _chapterSave = chapterSave; _unit = unit; PopulateControls(); }
public ChapterHistory(Model.ChapterSave chapterSave) { _chapterSave = chapterSave; InitializeComponent(); }
public Randomizer(Model.ChapterSave chapterSave) { _rng = new Random(); _chapterSave = chapterSave; }
public void LoadItem(Model.ChapterSave chapterSave, Model.ConvoyItem convoyItem) { _chapterSave = chapterSave; _item = convoyItem; PopulateControls(); }
public TimeMachine(Model.ChapterSave chapterSave) { _chapterSave = chapterSave; }
public static void RemoveAllUnusedWeaponNames(Model.ChapterSave chapterSave) { chapterSave.WeaponNameRegion.WeaponNames.RemoveAll((x) => !WeaponNameIsInUse(chapterSave, x.ID)); }