public void Refresh(int partyIndex) { _statsOffset = (int)OffsetType.PartyStatBase + 0x80 * partyIndex; var statsBytes = LegacyMemoryReader.ReadBytes(_statsOffset, 0x80); TextCurrentExperience.Text = BitConverter.ToUInt32(statsBytes, (int)Offsets.StatOffsets.CurrentExperience).ToString(); CurrentHP.Content = BitConverter.ToUInt32(statsBytes, (int)Offsets.StatOffsets.CurrentHP).ToString(); MaxHP.Content = BitConverter.ToUInt32(statsBytes, (int)Offsets.StatOffsets.MaxHP).ToString(); ModHP.Text = BitConverter.ToUInt32(statsBytes, (int)Offsets.StatOffsets.HPModifier).ToString(); CurrentMP.Content = BitConverter.ToUInt32(statsBytes, (int)Offsets.StatOffsets.CurrentMP).ToString(); MaxMP.Content = BitConverter.ToUInt32(statsBytes, (int)Offsets.StatOffsets.MaxMP).ToString(); ModMP.Text = BitConverter.ToUInt32(statsBytes, (int)Offsets.StatOffsets.MPModifier).ToString(); LabelStrength.Content = statsBytes[(int)Offsets.StatOffsets.Strength].ToString(); LabelDefense.Content = statsBytes[(int)Offsets.StatOffsets.Defense].ToString(); LabelMagic.Content = statsBytes[(int)Offsets.StatOffsets.Magic].ToString(); LabelMagicDefense.Content = statsBytes[(int)Offsets.StatOffsets.MagicDefense].ToString(); LabelAgility.Content = statsBytes[(int)Offsets.StatOffsets.Agility].ToString(); LabelAccuracy.Content = statsBytes[(int)Offsets.StatOffsets.Accuracy].ToString(); LabelEvasion.Content = statsBytes[(int)Offsets.StatOffsets.Evasion].ToString(); LabelLuck.Content = statsBytes[(int)Offsets.StatOffsets.Luck].ToString(); TextStrength.Text = statsBytes[(int)Offsets.StatOffsets.ModStrength].ToString(); TextDefense.Text = statsBytes[(int)Offsets.StatOffsets.ModDefense].ToString(); TextMagic.Text = statsBytes[(int)Offsets.StatOffsets.ModMagic].ToString(); TextMagicDefense.Text = statsBytes[(int)Offsets.StatOffsets.ModMagicDefense].ToString(); TextAgility.Text = statsBytes[(int)Offsets.StatOffsets.ModAgility].ToString(); TextAccuracy.Text = statsBytes[(int)Offsets.StatOffsets.ModAccuracy].ToString(); TextEvasion.Text = statsBytes[(int)Offsets.StatOffsets.ModEvasion].ToString(); TextLuck.Text = statsBytes[(int)Offsets.StatOffsets.ModLuck].ToString(); }
public void Refresh() { itemTypes = LegacyMemoryReader.ReadBytes(_offsetItemType, 0x88); itemCounts = LegacyMemoryReader.ReadBytes(_offsetItemCount, 0x44); for (int i = 0; i < 68; i++) { var button = (Button)ItemsGrid.Children[i]; if (button == null) { continue; } SetButtonText((Button)button, i); button.Click += (sender, args) => { var itemNum = int.Parse(button.Name.Substring(4)); if (itemNum == editingItem && editingButton != null) { return; } SetButtonBox(button, itemNum); (button.Content as StackPanel).UpdateLayout(); (button.Content as StackPanel).Children[1].Focus(); }; } }
private ushort ReadAbility(int index) { var creatureBytes = LegacyMemoryReader.ReadBytes(_abilityOffset + (_creatureIndex * 0xE38), 0x16); var abilityId = BitConverter.ToUInt16(creatureBytes, index * 2); return(abilityId); }
public void Refresh() { var creatureBytes = LegacyMemoryReader.ReadBytes(_abilityOffset + (_creatureIndex * 0xE38), 0x16); // Refresh commands for (int commandSlot = 0; commandSlot < 8; commandSlot++) { var commandId = BitConverter.ToUInt16(creatureBytes, commandSlot * 2); var commandButton = (Button)this.FindName("Command" + commandSlot); if (commandButton == null) { return; } if (commandId == 0xFF || commandId == 0x0) { commandButton.Content = string.Empty; } else { var command = Commands.GetCommand(commandId); if (command != null) { SetCommandText(commandButton, command); } else { var auto = AutoAbilities.GetAutoAbility(commandId); SetAutoAbilityText(commandButton, auto); } } } }
public void Refresh() { _refreshing = true; var garmentGridBytes = LegacyMemoryReader.ReadBytes(_offsetGarmentGrids, 8); var ggLen = GarmentGrids.GarmentGridList.Length; for (int i = 0; i < GarmentGrids.GarmentGridList.Length; i++) { CheckBox checkBox = null; if (i < ggLen / 2) { checkBox = (CheckBox)GarmentGridList.Children[i]; } else { checkBox = (CheckBox)GarmentGridList2.Children[i - ggLen / 2]; } if (checkBox == null) { continue; } var byteIndex = i / 8; var bitIndex = i % 8; byte mask = (byte)(1 << bitIndex); bool isSet = (garmentGridBytes[byteIndex] & mask) != 0; checkBox.IsChecked = isSet; } _refreshing = false; }
private void GarmentGridChanged(object sender, RoutedEventArgs routedEventArgs) { if (_refreshing) { return; } var checkBox = sender as CheckBox; if (checkBox == null) { return; } var gridIndex = int.Parse(checkBox.Name.Substring(4)); var byteIndex = gridIndex / 8; var bitIndex = gridIndex % 8; var garmentGridBytes = LegacyMemoryReader.ReadBytes(_offsetGarmentGrids, 8); var gByte = garmentGridBytes[byteIndex]; var mask = (1 << bitIndex); var newByte = gByte ^ (byte)mask; LegacyMemoryReader.WriteBytes(_offsetGarmentGrids + byteIndex, new byte[] { (byte)newByte }); Refresh(); }
public void UpdateCreaturesMethod() { var tabs = TabCreatures.Items.SourceCollection.OfType <TabItem>().ToArray(); var creatureCount = LegacyMemoryReader.ReadByte(0x9FA6C1); for (int i = 0; i < 8; i++) { var creatureTab = tabs[i]; if (creatureTab == null) { continue; } if (i >= creatureCount) { creatureTab.Visibility = Visibility.Collapsed; continue; } creatureTab.Visibility = Visibility.Visible; var nameBytes = LegacyMemoryReader.ReadBytes(_offsetCreatureName + (i * 40), 18); var name = StringConverter.ToASCII(nameBytes); creatureTab.Header = name; _editors[i].Refresh(); } }
public void Refresh() { _trapBytes = LegacyMemoryReader.ReadBytes(_offsetCreatureTrap, 60); for (int i = 0; i < 15; i++) { var button = (Button)FindName("Trap" + i); if (button == null) { continue; } var creatureInTrap = GetTrap(i); if (creatureInTrap == 0 || creatureInTrap == 0xFF) { button.Content = "Click to Set Trap"; continue; } var creature = Creatures.CreatureList.FirstOrDefault(c => c.ID == creatureInTrap); if (creature == null) { button.Content = $"[{creatureInTrap.ToString("X4")}] ???? (Unknown ID)"; } else { button.Content = $"[{creature.ID.ToString("X4")}] {creature.Name}"; } } _podBytes = LegacyMemoryReader.ReadBytes(_offsetCreaturePods, 9); var trapCount = _podBytes[0]; for (int t = 0; t < 8; t++) { var trapButton = (Button)FindName("TrapItem" + t); if (trapButton == null) { continue; } if (t == trapCount) { trapButton.Content = "+"; trapButton.Visibility = Visibility.Visible; } else if (t > trapCount) { trapButton.Visibility = Visibility.Collapsed; } else if (t < 8) { trapButton.Content = GetPodName(t); trapButton.Visibility = Visibility.Visible; } trapButton.Width = 38; } _comboShowing = false; }
public void Refresh() { _refreshing = true; var nameBytes = LegacyMemoryReader.ReadBytes(_offsetCreatureName + (_creatureIndex * 40), 18); var name = StringConverter.ToASCII(nameBytes); CreatureName.Text = name; CreatureSize.SelectedIndex = GameMemory.Read <byte>(_statsOffset + (int)Offsets.StatOffsets.Size) - 1; _statsPanel.Refresh(_creatureIndex + 15); _creatureAbilities.Refresh(); _refreshing = false; }
public void Refresh() { var dressBytes = LegacyMemoryReader.ReadBytes(_offsetDresspheres, 30); for (int d = 1; d <= 29; d++) { var dressBox = (TextBox)FindName("Dressphere" + d); if (dressBox == null) { continue; } dressBox.Text = dressBytes[d].ToString(); } }
public static bool ReadEntity(EntityType entityType, int entityIndex, out BattleEntityData outputEntity) { var offsetEntity = GetEntityOffset(entityType, entityIndex); var entityData = LegacyMemoryReader.ReadBytes(offsetEntity, (int)Battle.BlockLengthEntity, true); // Copy entity data IntPtr ptrEntityData = Marshal.AllocHGlobal(entityData.Length); try { Marshal.Copy(entityData, 0, ptrEntityData, entityData.Length); outputEntity = (BattleEntityData)Marshal.PtrToStructure(ptrEntityData, typeof(BattleEntityData)); } finally { Marshal.FreeHGlobal(ptrEntityData); } return(true); }
public static void LearnAllAbilities() { var partyOffset = OffsetScanner.GetOffset(GameOffset.FFX_PartyStatBase); for (var i = 0; i < 18; i++) { int characterAbilityOffset = partyOffset + Marshal.SizeOf <PartyMember>() * i + StructHelper.GetFieldOffset <PartyMember>("SkillFlags");; var currentAbilities = LegacyMemoryReader.ReadBytes(characterAbilityOffset, 13); // Flip all normal ability bits currentAbilities[1] |= 0xF0; for (int b = 2; b < 11; b++) { currentAbilities[b] |= 0xFF; } currentAbilities[11] |= 0x0F; currentAbilities[12] |= 0xFF; LegacyMemoryReader.WriteBytes(characterAbilityOffset, currentAbilities); } }
public void Refresh() { itemTypes = LegacyMemoryReader.ReadBytes((int)OffsetType.AccessoryType, 0x100); itemCounts = LegacyMemoryReader.ReadBytes((int)OffsetType.AccessoryCount, 0x80); for (int i = 0; i < 128; i++) { var button = ItemsGrid.Children.OfType <Button>().First(butt => butt.Name == "Accessory" + i); SetButtonText((Button)button, i); button.Click += (sender, args) => { var itemNum = int.Parse(button.Name.Substring(9)); if (itemNum == editingItem && editingButton != null) { return; } SetButtonBox(button, itemNum); (button.Content as StackPanel).UpdateLayout(); (button.Content as StackPanel).Children[1].Focus(); }; } }