예제 #1
0
        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);
        }
예제 #2
0
 public void LoadChapterSave(Model.ChapterSave chapterSave)
 {
     _chapterSave = chapterSave;
     UnbindEvents();
     PopulateControls();
     BindEvents();
 }
예제 #3
0
        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);
        }
예제 #4
0
        public void LoadChapterSave(Model.ChapterSave chapterSave)
        {
            _chapterSave = chapterSave;

            skills1.LoadChapterSave(_chapterSave);

            PopulateControls();
        }
예제 #5
0
 public Supports(Model.ChapterSave chapterSave, Model.Unit unit)
 {
     _chapterSave = chapterSave;
     _unit        = unit;
     InitializeComponent();
     SetTitle();
     BindEvents();
 }
예제 #6
0
        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;
        }
예제 #7
0
        public static void RemoveWeaponNameIfUnused(Model.ChapterSave chapterSave, byte nameId)
        {
            bool nameInUse = WeaponNameIsInUse(chapterSave, nameId);

            if (!nameInUse)
            {
                chapterSave.WeaponNameRegion.WeaponNames.RemoveAll((x) => x.ID == nameId);
            }
        }
예제 #8
0
 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;
     }
 }
예제 #9
0
        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;
            }
        }
예제 #10
0
 public void LoadCharacter(Model.ChapterSave chapterSave, Model.Character unit)
 {
     _chapterSave = chapterSave;
     _unit        = unit;
     PopulateControls();
 }
예제 #11
0
 public void LoadUnit(Model.ChapterSave chapterSave, Model.Unit unit)
 {
     _chapterSave = chapterSave;
     _unit        = unit;
     PopulateControls();
 }
예제 #12
0
 public ChapterHistory(Model.ChapterSave chapterSave)
 {
     _chapterSave = chapterSave;
     InitializeComponent();
 }
예제 #13
0
 public Randomizer(Model.ChapterSave chapterSave)
 {
     _rng         = new Random();
     _chapterSave = chapterSave;
 }
예제 #14
0
 public void LoadItem(Model.ChapterSave chapterSave, Model.ConvoyItem convoyItem)
 {
     _chapterSave = chapterSave;
     _item        = convoyItem;
     PopulateControls();
 }
예제 #15
0
 public TimeMachine(Model.ChapterSave chapterSave)
 {
     _chapterSave = chapterSave;
 }
예제 #16
0
 public static void RemoveAllUnusedWeaponNames(Model.ChapterSave chapterSave)
 {
     chapterSave.WeaponNameRegion.WeaponNames.RemoveAll((x) => !WeaponNameIsInUse(chapterSave, x.ID));
 }