public void Refresh(int characterIndex) { _refreshing = true; _characterIndex = characterIndex; var overdriveInfo = MemoryReader.ReadBytes(_partyOffset + (_characterIndex * 0x94) + (int)PartyStatOffset.OverdriveMode, 3); ComboCurrentOverdrive.SelectedIndex = overdriveInfo[0]; TextOverdriveCurrent.Text = overdriveInfo[1].ToString(); TextOverdriveMax.Text = overdriveInfo[2].ToString(); var totalOverdrives = GridOverdrive.Children.Count; _odBytes = MemoryReader.ReadBytes(_partyOffset + (_characterIndex * 0x94) + (int)PartyStatOffset.OverdriveModes, 0x3); _odCounters = MemoryReader.ReadBytes(_partyOffset + (_characterIndex * 0x94) + (int)PartyStatOffset.OverdriveWarrior, totalOverdrives * 2); var learnedOverdrives = BitHelper.GetBitArray(_odBytes, totalOverdrives); for (int i = 0; i < totalOverdrives; i++) { var checkLearned = ((GridOverdrive.Children[i] as DockPanel).Children[0] as CheckBox); var textCount = ((GridOverdrive.Children[i] as DockPanel).Children[1] as TextBox); checkLearned.IsChecked = learnedOverdrives[OverdriveMode.OverdriveModes[i].BitIndex]; textCount.Text = BitConverter.ToUInt16(_odCounters, OverdriveMode.OverdriveModes[i].BitIndex * 2).ToString(); } _refreshing = false; }
public void Refresh() { _refreshing = true; _editingItem = -1; _currentItems = Item.ReadItems(); // Refresh inventory items for (int i = 0; i < _currentItems.Length; i++) { if (_currentItems[i].ID == 0xFF) { // Empty slot _itemButtons.SetContent(i, "< EMPTY >"); } else { // Show item name and count _itemButtons.SetContent(i, _currentItems[i].Name + " x" + _currentItems[i].Count); } } // Refresh key items and al bhed dictionaries var keyItemData = GameMemory.Read <byte>(_offsetKeyItem, 8, false); var alBhedData = GameMemory.Read <byte>(_offsetAlBhed, 4, false); _keyItemState = BitHelper.GetBitArray(keyItemData, 58); _alBhedState = BitHelper.GetBitArray(alBhedData, 26); // Key Items for (int i = 0; i < KeyItem.KeyItems.Length - 1; i++) { if (_keyItemState[KeyItem.KeyItems[i].BitIndex]) { // Key item owned _keyItemButtons.Buttons[i].Foreground = _trueKeyItemBrush; _keyItemButtons.SetContent(i, $"{KeyItem.KeyItems[i].Name}"); } else { // Key item not owned _keyItemButtons.Buttons[i].Foreground = _falseKeyItemBrush; _keyItemButtons.SetContent(i, $"{KeyItem.KeyItems[i].Name}"); } } // Al Bhed Dictionaries for (int i = 0; i < 26; i++) { (PanelAlBhed.Children[i] as CheckBox).IsChecked = _alBhedState[i]; } _refreshing = false; }
private void refreshNode() { var node = SphereGridNode.ReadNode(currentNode); ComboNodeType.SelectedIndex = node.Type.ID; var activations = BitHelper.GetBitArray(new byte[] { node.ActivatedBy }, 7); for (int i = 0; i < 7; i++) { (PanelNodeActivatedBy.Children[i] as CheckBox).IsChecked = activations[i]; } }
public void Refresh(int characterIndex) { _refreshing = true; _characterIndex = characterIndex; var totalOverdrives = OverdriveMode.OverdriveModes.Length; var charOffset = _offsetPartyStats + _characterIndex * _sizePartyMember; var offsetLevels = (int)Marshal.OffsetOf <PartyMember>("OverdriveMode") + charOffset; var offsetFlags = (int)Marshal.OffsetOf <PartyMember>("OverdriveModes") + charOffset; var offsetCounters = (int)Marshal.OffsetOf <PartyMember>("OverdriveWarrior") + charOffset; var odLevels = GameMemory.Read <byte>(offsetLevels, 3, false); var odBytes = GameMemory.Read <byte>(offsetFlags, 3, false); var odCounters = GameMemory.Read <byte>(offsetCounters, totalOverdrives * 2, false); ComboCurrentOverdrive.SelectedIndex = odLevels[0]; TextOverdriveCurrent.Text = odLevels[1].ToString(); TextOverdriveMax.Text = odLevels[2].ToString(); var learnedOverdrives = BitHelper.GetBitArray(odBytes, totalOverdrives); for (int i = 0; i < totalOverdrives; i++) { var dockPanel = GridOverdrive.Children[i] as DockPanel; if (dockPanel == null) { continue; } var checkLearned = (dockPanel.Children[0] as CheckBox); var textCount = (dockPanel.Children[1] as TextBox); if (checkLearned != null) { checkLearned.IsChecked = learnedOverdrives[OverdriveMode.OverdriveModes[i].BitIndex]; } if (textCount != null) { textCount.Text = BitConverter.ToUInt16(odCounters, OverdriveMode.OverdriveModes[i].BitIndex * 2).ToString(); } } _refreshing = false; }
private void RefreshNode() { var node = SphereGrid.ReadNode(_currentNode); TextCurrentNode.Text = $"Currently editing node #{_currentNode}"; ComboNodeType.SelectedIndex = node.NodeType; var activations = BitHelper.GetBitArray(new[] { node.ActivatedBy }, 8); for (var i = 0; i < 7; i++) { var checkBox = PanelNodeActivatedBy.Children[i] as CheckBox; if (checkBox != null) { checkBox.IsChecked = activations[i]; } } }
public void Refresh(int characterIndex) { _characterIndex = characterIndex; if (_characterIndex == -1) { return; } var party = Data.Party.ReadPartyMember(_characterIndex); var skillArray = BitHelper.GetBitArray(party.SkillFlags); for (int i = 0; i < _skills.Length; i++) { var button = (Button)_gridSkill.GridBase.Children[i]; button.Foreground = skillArray[_skills[i].BitOffset] ? _trueAbilityBrush : _falseAbilityBrush; button.Content = _skills[i].Name; } for (int i = 0; i < _specials.Length; i++) { var button = (Button)_gridSpecial.GridBase.Children[i]; button.Foreground = skillArray[_specials[i].BitOffset] ? _trueAbilityBrush : _falseAbilityBrush; button.Content = _specials[i].Name; } for (int i = 0; i < _wMagic.Length; i++) { var button = (Button)_gridWhiteMagic.GridBase.Children[i]; button.Foreground = skillArray[_wMagic[i].BitOffset] ? _trueAbilityBrush : _falseAbilityBrush; button.Content = _wMagic[i].Name; } for (int i = 0; i < _bMagic.Length; i++) { var button = (Button)_gridBlackMagic.GridBase.Children[i]; button.Foreground = skillArray[_bMagic[i].BitOffset] ? _trueAbilityBrush : _falseAbilityBrush; button.Content = _bMagic[i].Name; } }
public void Refresh(int characterIndex) { _characterIndex = characterIndex; if (_characterIndex == -1) { return; } var skillBytes = MemoryReader.ReadBytes(Offsets.GetOffset(OffsetType.PartyStatsBase) + 0x94 * characterIndex + (int)PartyStatOffset.SkillFlags, 0x0D); var skillArray = BitHelper.GetBitArray(skillBytes); for (int i = 0; i < _skills.Length; i++) { var button = (Button)_gridSkill.GridBase.Children[i]; button.Foreground = skillArray[_skills[i].BitOffset] ? _trueAbilityBrush : _falseAbilityBrush; button.Content = _skills[i].Name; } for (int i = 0; i < _specials.Length; i++) { var button = (Button)_gridSpecial.GridBase.Children[i]; button.Foreground = skillArray[_specials[i].BitOffset] ? _trueAbilityBrush : _falseAbilityBrush; button.Content = _specials[i].Name; } for (int i = 0; i < _wMagic.Length; i++) { var button = (Button)_gridWhiteMagic.GridBase.Children[i]; button.Foreground = skillArray[_wMagic[i].BitOffset] ? _trueAbilityBrush : _falseAbilityBrush; button.Content = _wMagic[i].Name; } for (int i = 0; i < _bMagic.Length; i++) { var button = (Button)_gridBlackMagic.GridBase.Children[i]; button.Foreground = skillArray[_bMagic[i].BitOffset] ? _trueAbilityBrush : _falseAbilityBrush; button.Content = _bMagic[i].Name; } }
public void RefreshEntity() { //if (TabBattle.SelectedIndex == 0 && TabEntity.SelectedIndex >= _partyCount) // TabEntity.SelectedIndex = 0; //if (TabBattle.SelectedIndex == 1 && TabEntity.SelectedIndex >= _enemyCount) // TabEntity.SelectedIndex = 0; BattleEntityData entityData; BattleEntity.ReadEntity((EntityType)TabBattle.SelectedIndex, TabEntity.SelectedIndex, out entityData); // Refresh stats panel TextCurrentHP.Text = entityData.hp_current.ToString(); TextCurrentMP.Text = entityData.mp_current.ToString(); TextMaxHP.Text = entityData.hp_max.ToString(); TextMaxMP.Text = entityData.mp_max.ToString(); TextOverdrive.Text = entityData.overdrive_current.ToString(); TextOverdriveMax.Text = entityData.overdrive_max.ToString(); TextStrength.Text = entityData.strength.ToString(); TextDefense.Text = entityData.defense.ToString(); TextMagic.Text = entityData.magic.ToString(); TextMagicDefense.Text = entityData.magic_defense.ToString(); TextAgility.Text = entityData.agility.ToString(); TextLuck.Text = entityData.luck.ToString(); TextEvasion.Text = entityData.evasion.ToString(); TextAccuracy.Text = entityData.accuracy.ToString(); // Refresh negative status checkboxes var statusFlags = BitHelper.GetBitArray(entityData.status_flags_negative); for (int i = 0; i < 16; i++) { var boxName = "CheckFlag" + (i + 1).ToString().Trim(); var box = (CheckBox)FindName(boxName); if (box == null) { continue; } box.IsChecked = statusFlags[i]; } CheckSilence.IsChecked = entityData.status_turns_silence != 0; TextSilence.Text = entityData.status_turns_silence.ToString(); CheckDarkness.IsChecked = entityData.status_turns_darkness != 0; TextDarkness.Text = entityData.status_turns_darkness.ToString(); CheckSleep.IsChecked = entityData.status_turns_sleep != 0; TextSleep.Text = entityData.status_turns_sleep.ToString(); TextDoom.Text = entityData.timer_doom.ToString(); // Refresh positive status checkboxes CheckShell.IsChecked = entityData.status_shell != 0; CheckProtect.IsChecked = entityData.status_protect != 0; CheckReflect.IsChecked = entityData.status_reflect != 0; CheckNulTide.IsChecked = entityData.status_nultide != 0; CheckNulBlaze.IsChecked = entityData.status_nulblaze != 0; CheckNulShock.IsChecked = entityData.status_nulshock != 0; CheckNulFrost.IsChecked = entityData.status_nulfrost != 0; CheckRegen.IsChecked = entityData.status_regen != 0; CheckHaste.IsChecked = entityData.status_haste != 0; CheckSlow.IsChecked = entityData.status_slow != 0; CheckUnknown.IsChecked = entityData.status_unknown != 0; var posFlags = BitHelper.GetBitArray(entityData.status_flags_positive); for (int i = 0; i < 16; i++) { var boxName = "CheckPositiveFlag" + (i + 1).ToString().Trim(); var box = (CheckBox)FindName(boxName); if (box == null) { continue; } box.IsChecked = posFlags[i]; } }