/// <summary> /// Things that may of changed before screen loads or junction is changed. /// </summary> public override void Refresh() { if (Memory.State.Characters != null) { Contents = Array.ConvertAll(Contents, c => c = default); base.Refresh(); if (Memory.State.Characters != null && unlocked != null) { ITEM[5, 0] = new IGMDataItem.Icon(Icons.ID.Icon_Status_Attack, new Rectangle(SIZE[5].X + 200, SIZE[5].Y, 0, 0), (byte)(unlocked.Contains(Kernel_bin.Abilities.ST_Atk_J) ? 2 : 7)); ITEM[5, 1] = new IGMDataItem.Icon(Icons.ID.Icon_Status_Defense, new Rectangle(SIZE[5].X + 240, SIZE[5].Y, 0, 0), (byte)(unlocked.Contains(Kernel_bin.Abilities.ST_Def_Jx1) || unlocked.Contains(Kernel_bin.Abilities.ST_Def_Jx2) || unlocked.Contains(Kernel_bin.Abilities.ST_Def_Jx4) ? 2 : 7)); ITEM[5, 2] = new IGMDataItem.Icon(Icons.ID.Icon_Elemental_Attack, new Rectangle(SIZE[5].X + 280, SIZE[5].Y, 0, 0), (byte)(unlocked.Contains(Kernel_bin.Abilities.EL_Atk_J) ? 2 : 7)); ITEM[5, 3] = new IGMDataItem.Icon(Icons.ID.Icon_Elemental_Defense, new Rectangle(SIZE[5].X + 320, SIZE[5].Y, 0, 0), (byte)(unlocked.Contains(Kernel_bin.Abilities.EL_Def_Jx1) || unlocked.Contains(Kernel_bin.Abilities.EL_Def_Jx2) || unlocked.Contains(Kernel_bin.Abilities.EL_Def_Jx4) ? 2 : 7)); BLANKS[5] = true; foreach (Kernel_bin.Stat stat in (Kernel_bin.Stat[])Enum.GetValues(typeof(Kernel_bin.Stat))) { if (Stat2Icon.ContainsKey(stat) && Damageable.GetCharacterData(out Saves.CharacterData c)) { int pos = (int)stat; if (pos >= 5) { pos++; } Contents[pos] = stat; FF8String name = Kernel_bin.MagicData[c.Stat_J[stat]].Name; if (name == null || name.Length == 0) { name = Misc[Items._]; } ITEM[pos, 0] = new IGMDataItem.Icon(Stat2Icon[stat], new Rectangle(SIZE[pos].X, SIZE[pos].Y, 0, 0), 2); ITEM[pos, 1] = new IGMDataItem.Text(name, new Rectangle(SIZE[pos].X + 80, SIZE[pos].Y, 0, 0)); if (!unlocked.Contains(Kernel_bin.Stat2Ability[stat])) { ((IGMDataItem.Icon)ITEM[pos, 0]).Palette = ((IGMDataItem.Icon)ITEM[pos, 0]).Faded_Palette = 7; ((IGMDataItem.Text)ITEM[pos, 1]).FontColor = Font.ColorID.Grey; BLANKS[pos] = true; } else { BLANKS[pos] = false; } ITEM[pos, 2] = new IGMDataItem.Integer(Damageable.TotalStat(stat), new Rectangle(SIZE[pos].X + 152, SIZE[pos].Y, 0, 0), 2, Icons.NumType.sysFntBig, spaces: 10); ITEM[pos, 3] = stat == Kernel_bin.Stat.HIT || stat == Kernel_bin.Stat.EVA ? new IGMDataItem.Text(Misc[Items.Percent], new Rectangle(SIZE[pos].X + 350, SIZE[pos].Y, 0, 0)) : null; if (GetPrevSetting() == null || (Damageable.GetCharacterData(out Saves.CharacterData _c) && GetPrevSetting().Stat_J[stat] == _c.Stat_J[stat]) || GetPrevSetting().TotalStat(stat) == Damageable.TotalStat(stat)) { ITEM[pos, 4] = null; } else if (GetPrevSetting().TotalStat(stat) > Damageable.TotalStat(stat)) { ((IGMDataItem.Icon)ITEM[pos, 0]).Palette = 5; ((IGMDataItem.Icon)ITEM[pos, 0]).Faded_Palette = 5; ((IGMDataItem.Text)ITEM[pos, 1]).FontColor = Font.ColorID.Red; ((IGMDataItem.Integer)ITEM[pos, 2]).FontColor = Font.ColorID.Red; if (ITEM[pos, 3] != null) { ((IGMDataItem.Text)ITEM[pos, 3]).FontColor = Font.ColorID.Red; } ITEM[pos, 4] = new IGMDataItem.Icon(Icons.ID.Arrow_Down, new Rectangle(SIZE[pos].X + 250, SIZE[pos].Y, 0, 0), 16); } else { ((IGMDataItem.Icon)ITEM[pos, 0]).Palette = 6; ((IGMDataItem.Icon)ITEM[pos, 0]).Faded_Palette = 6; ((IGMDataItem.Text)ITEM[pos, 1]).FontColor = Font.ColorID.Yellow; ((IGMDataItem.Integer)ITEM[pos, 2]).FontColor = Font.ColorID.Yellow; if (ITEM[pos, 3] != null) { ((IGMDataItem.Text)ITEM[pos, 3]).FontColor = Font.ColorID.Yellow; } ITEM[pos, 4] = new IGMDataItem.Icon(Icons.ID.Arrow_Up, new Rectangle(SIZE[pos].X + 250, SIZE[pos].Y, 0, 0), 17); } } } } }
/// <summary> /// Things that may of changed before screen loads or junction is changed. /// </summary> public override void Refresh() { if (Memory.State?.Characters != null) { Contents = Array.ConvertAll(Contents, c => c = default); base.Refresh(); if (unlocked != null) { ((IGMDataItem.Icon)ITEM[5, 0]).Palette = (byte)(unlocked.Contains(Kernel_bin.Abilities.ST_Atk_J) ? 2 : 7); ((IGMDataItem.Icon)ITEM[5, 1]).Palette = (byte)(unlocked.Contains(Kernel_bin.Abilities.ST_Def_Jx1) || unlocked.Contains(Kernel_bin.Abilities.ST_Def_Jx2) || unlocked.Contains(Kernel_bin.Abilities.ST_Def_Jx4) ? 2 : 7); ((IGMDataItem.Icon)ITEM[5, 2]).Palette = (byte)(unlocked.Contains(Kernel_bin.Abilities.EL_Atk_J) ? 2 : 7); ((IGMDataItem.Icon)ITEM[5, 3]).Palette = (byte)(unlocked.Contains(Kernel_bin.Abilities.EL_Def_Jx1) || unlocked.Contains(Kernel_bin.Abilities.EL_Def_Jx2) || unlocked.Contains(Kernel_bin.Abilities.EL_Def_Jx4) ? 2 : 7); BLANKS[5] = true; foreach (Kernel_bin.Stat stat in Stat2Icon.Keys.OrderBy(o => (byte)o)) { if (Damageable.GetCharacterData(out Saves.CharacterData c)) { bool isUnlocked = unlocked.Contains(Kernel_bin.Stat2Ability[stat]); int pos = (int)stat; if (pos >= 5) { pos++; } Contents[pos] = stat; FF8String name = Kernel_bin.MagicData[c.Stat_J[stat]].Name; if (name == null || name.Length == 0) { name = Strings.Name._; } ushort currentValue = Damageable.TotalStat(stat); ushort previousValue = GetPrevSetting()?.TotalStat(stat) ?? currentValue; ((IGMDataItem.Text)ITEM[pos, 1]).Data = name; ((IGMDataItem.Integer)ITEM[pos, 2]).Data = currentValue; if (previousValue == currentValue) { ITEM[pos, 4].Hide(); if (isUnlocked) { SetPalettes(pos, 2); SetFontColor(pos, Font.ColorID.White); } else { SetPalettes(pos, 7); SetFontColor(pos, Font.ColorID.Grey); } } else if (previousValue > currentValue) { SetPalettes(pos, 5, 16, Icons.ID.Arrow_Down); SetFontColor(pos, Font.ColorID.Red); } else { SetPalettes(pos, 6, 17, Icons.ID.Arrow_Up); SetFontColor(pos, Font.ColorID.Yellow); } BLANKS[pos] = !isUnlocked; } } } } }
/// <summary> /// Things that may of changed before screen loads or junction is changed. /// </summary> public override void Refresh() { if (Memory.State?.Characters == null) { return; } Contents = Array.ConvertAll(Contents, c => { if (!Enum.IsDefined(typeof(Stat), c)) { throw new InvalidEnumArgumentException(nameof(c), (int)c, typeof(Stat)); } return(Stat.None); }); base.Refresh(); if (unlocked == null) { return; } { ((IGMDataItem.Icon)ITEM[5, 0]).Palette = (byte)(unlocked.Contains(Abilities.StAtkJ) ? 2 : 7); ((IGMDataItem.Icon)ITEM[5, 1]).Palette = (byte)(unlocked.Contains(Abilities.StDefJ) || unlocked.Contains(Abilities.StDefJ2) || unlocked.Contains(Abilities.StDefJ4) ? 2 : 7); ((IGMDataItem.Icon)ITEM[5, 2]).Palette = (byte)(unlocked.Contains(Abilities.ElAtkJ) ? 2 : 7); ((IGMDataItem.Icon)ITEM[5, 3]).Palette = (byte)(unlocked.Contains(Abilities.ElDefJ) || unlocked.Contains(Abilities.ElDefJ2) || unlocked.Contains(Abilities.ElDefJ4) ? 2 : 7); BLANKS[5] = true; foreach (var stat in Stat2Icon.Keys.OrderBy(o => (byte)o)) { if (Damageable.GetCharacterData(out var c)) { var isUnlocked = unlocked.Contains(Kernel.KernelBin.Stat2Ability[stat]); var pos = (int)stat; if (pos >= 5) { pos++; } Contents[pos] = stat; var name = Memory.KernelBin.MagicData[c.StatJ[stat]].Name; if (name == null || name.Length == 0) { name = Strings.Name._; } var currentValue = Damageable.TotalStat(stat); var previousValue = GetPrevSetting()?.TotalStat(stat) ?? currentValue; ((IGMDataItem.Text)ITEM[pos, 1]).Data = name; ((IGMDataItem.Integer)ITEM[pos, 2]).Data = currentValue; if (previousValue == currentValue) { ITEM[pos, 4].Hide(); if (isUnlocked) { SetPalettes(pos, 2); SetFontColor(pos, Font.ColorID.White); } else { SetPalettes(pos, 7); SetFontColor(pos, Font.ColorID.Grey); } } else if (previousValue > currentValue) { SetPalettes(pos, 5, 16, Icons.ID.Arrow_Down); SetFontColor(pos, Font.ColorID.Red); } else { SetPalettes(pos, 6, 17, Icons.ID.Arrow_Up); SetFontColor(pos, Font.ColorID.Yellow); } BLANKS[pos] = !isUnlocked; } } } }