Fix HoH 31-90 display names

This commit is contained in:
Liza 2023-02-12 22:32:22 +01:00
parent a39eaa11f1
commit f9cbf0494a
4 changed files with 44 additions and 15 deletions

View File

@ -11,6 +11,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with:
submodules: true
- name: Setup .NET SDK - name: Setup .NET SDK
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3

View File

@ -1,16 +1,15 @@
using Dalamud.Interface.Windowing; using Dalamud.Interface.Windowing;
using ImGuiNET; using ImGuiNET;
using Lumina.Excel.GeneratedSheets;
using Pal.Common; using Pal.Common;
using Palace; using Palace;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Common;
using System.Linq; using System.Linq;
using System.Numerics; using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using Pal.Client.Properties; using Pal.Client.Properties;
using System.ComponentModel.DataAnnotations;
using System.Runtime.CompilerServices;
using System.Reflection;
namespace Pal.Client.Windows namespace Pal.Client.Windows
{ {
@ -57,7 +56,7 @@ namespace Pal.Client.Windows
ImGui.TableSetupColumn(Localization.Statistics_HoardCoffers); ImGui.TableSetupColumn(Localization.Statistics_HoardCoffers);
ImGui.TableHeadersRow(); ImGui.TableHeadersRow();
foreach (var (territoryType, stats) in _territoryStatistics.Where(x => x.Key >= minTerritory && x.Key <= maxTerritory)) foreach (var (territoryType, stats) in _territoryStatistics.Where(x => x.Key >= minTerritory && x.Key <= maxTerritory).OrderBy(x => x.Key.GetOrder() ?? (int)x.Key))
{ {
ImGui.TableNextRow(); ImGui.TableNextRow();
if (ImGui.TableNextColumn()) if (ImGui.TableNextColumn())

View File

@ -1,4 +1,6 @@
namespace Pal.Common using System.ComponentModel.DataAnnotations;
namespace Pal.Common
{ {
public enum ETerritoryType : ushort public enum ETerritoryType : ushort
{ {
@ -23,15 +25,25 @@
Palace_181_190, Palace_181_190,
Palace_191_200, Palace_191_200,
[Display(Order = 1)]
HeavenOnHigh_1_10 = 770, HeavenOnHigh_1_10 = 770,
HeavenOnHigh_11_20, [Display(Order = 2)]
HeavenOnHigh_21_30, HeavenOnHigh_11_20 = 771,
HeavenOnHigh_31_40, [Display(Order = 3)]
HeavenOnHigh_41_50, HeavenOnHigh_21_30 = 772,
HeavenOnHigh_51_60, [Display(Order = 4)]
HeavenOnHigh_61_70 = 782, HeavenOnHigh_31_40 = 782,
HeavenOnHigh_71_80, [Display(Order = 5)]
HeavenOnHigh_81_90, HeavenOnHigh_41_50 = 773,
HeavenOnHigh_91_100 [Display(Order = 6)]
HeavenOnHigh_51_60 = 783,
[Display(Order = 7)]
HeavenOnHigh_61_70 = 774,
[Display(Order = 8)]
HeavenOnHigh_71_80 = 784,
[Display(Order = 9)]
HeavenOnHigh_81_90 = 775,
[Display(Order = 10)]
HeavenOnHigh_91_100 = 785
} }
} }

View File

@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using System.Reflection;
namespace Pal.Common
{
public static class EnumExtensions
{
public static int? GetOrder(this Enum e)
{
Type type = e.GetType();
MemberInfo field = type.GetMember(e.ToString()).Single();
DisplayAttribute? attribute = field.GetCustomAttributes(typeof(DisplayAttribute), false).Cast<DisplayAttribute>().FirstOrDefault();
return attribute?.Order;
}
}
}