Example #1
0
        public WhiteMage(FFACE instance, Content content)
        {
            _content      = content;
            _fface        = instance;
            _settingsForm = new WhiteMageForm(instance);
            _hasteStates  = new Dictionary <string, bool>();
            _regenStates  = new Dictionary <string, bool>();
            _partyMembers = new List <PartyMember>();

            WhiteMageSettings = new WhiteMageSettings
            {
                CharacterFolder = _fface.Player.Name
            };

            // Loop through each active party member in the party list.
            foreach (KeyValuePair <byte, FFACE.PartyMemberTools> partyMember in _fface.PartyMember.Where(x => x.Value.Active))
            {
                // Add a new PartyMember object to the list of party members.
                _partyMembers.Add(new PartyMember
                {
                    Name         = partyMember.Value.Name,
                    HpCurrent    = partyMember.Value.HPCurrent,
                    HpCurrentMax = CalculateMaxHp(partyMember.Value.HPCurrent, partyMember.Value.HPPCurrent)
                });
            }

            // Check if the .json settings file exists.
            if (Utilities.IsFileValid(WhiteMageSettings.SettingsFolder + WhiteMageSettings.CharacterFolder + WhiteMageSettings.FileName))
            {
                WhiteMageSettings = JsonConvert.DeserializeObject <WhiteMageSettings>(Utilities.GetFileContents(WhiteMageSettings.SettingsFolder + WhiteMageSettings.CharacterFolder + WhiteMageSettings.FileName));
            }
        }
Example #2
0
        public void LoadJobSettings()
        {
            // Initialize the _jsonSettings as a new object.
            _jobSettings = new WhiteMageSettings
            {
                CharacterFolder = _fface.Player.Name
            };

            // Check if the .json settings file exists.
            if (Utilities.IsFileValid(_jobSettings.SettingsFolder + _jobSettings.CharacterFolder + _jobSettings.FileName))
            {
                // Get the data from the file and deserialize the data into the _jsonSettings object.
                _jobSettings = JsonConvert.DeserializeObject <WhiteMageSettings>(Utilities.GetFileContents(_jobSettings.SettingsFolder + _jobSettings.CharacterFolder + _jobSettings.FileName));
            }

            // Set the character values.
            _jobSettings.CharacterFolder  = _fface.Player.Name;
            _jobSettings.SelfActions.Name = _fface.Player.Name;

            // Loop through each row in the DataGridView.
            foreach (DataGridViewRow row in whmGridView.Rows)
            {
                // Get the character data from the settings.
                WhiteMageCharacterActions characterAction = _jobSettings.CharacterActions.SingleOrDefault(x => x.Name == row.Cells[0].Value.ToString());

                // Continue the loop if the character is not found.
                if (characterAction == null)
                {
                    continue;
                }

                // Get the haste/regen values and set their checkboxes accordingly.
                DataGridViewCheckBoxCell hastecell = (DataGridViewCheckBoxCell)row.Cells[1];
                hastecell.Value = characterAction.CastHasteOn;
                DataGridViewCheckBoxCell regenCell = (DataGridViewCheckBoxCell)row.Cells[2];
                regenCell.Value = characterAction.CastRegenOn;
            }

            // Check if the BarElemental spell was defined, otherwise select default.
            whmComboBarElemental.SelectedIndex = !string.IsNullOrEmpty(_jobSettings.Spells.BarElementalSpell)
                ? whmComboBarElemental.Items.IndexOf(_jobSettings.Spells.BarElementalSpell)
                : 0;

            // Check if the BarStatus spell was defined, otherwise select default.
            whmComboBarStatus.SelectedIndex = !string.IsNullOrEmpty(_jobSettings.Spells.BarStatusSpell)
                ? whmComboBarStatus.Items.IndexOf(_jobSettings.Spells.BarStatusSpell)
                : 0;

            // Check if the BoostStat spell was defined, otherwise select default.
            whmComboBoostStat.SelectedIndex = !string.IsNullOrEmpty(_jobSettings.Spells.BoostStatSpell)
                ? whmComboBoostStat.Items.IndexOf(_jobSettings.Spells.BoostStatSpell)
                : 0;

            // Set the Self Buffs values.
            whmCbReraise.Checked   = _jobSettings.SelfActions.Reraise;
            whmCbStoneskin.Checked = _jobSettings.SelfActions.Stoneskin;
            whmCbBlink.Checked     = _jobSettings.SelfActions.Blink;
            whmCbAquaveil.Checked  = _jobSettings.SelfActions.Aquaveil;

            // Set the Party Buffs values.
            whmCbProtectra.Checked = _jobSettings.SelfActions.Protectra;
            whmCbShellra.Checked   = _jobSettings.SelfActions.Shellra;

            // Set the Curaga values.
            whmCbCuragaV.Checked   = _jobSettings.SelfActions.CuragaV;
            whmCbCuragaIV.Checked  = _jobSettings.SelfActions.CuragaIV;
            whmCbCuragaIII.Checked = _jobSettings.SelfActions.CuragaIII;
            whmCbCuragaII.Checked  = _jobSettings.SelfActions.CuragaII;
            whmCbCuraga.Checked    = _jobSettings.SelfActions.Curaga;
        }