2022-10-26 18:43:24 +00:00
|
|
|
|
using Dalamud.Interface.Windowing;
|
|
|
|
|
using ImGuiNET;
|
|
|
|
|
using Lumina.Excel.GeneratedSheets;
|
|
|
|
|
using Pal.Common;
|
|
|
|
|
using Palace;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data.Common;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Numerics;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Pal.Client.Windows
|
|
|
|
|
{
|
|
|
|
|
internal class StatisticsWindow : Window
|
|
|
|
|
{
|
|
|
|
|
private SortedDictionary<ETerritoryType, TerritoryStatistics> _territoryStatistics = new();
|
|
|
|
|
|
|
|
|
|
public StatisticsWindow() : base("Palace Pal - Statistics###PalacePalStats")
|
|
|
|
|
{
|
|
|
|
|
Size = new Vector2(500, 500);
|
|
|
|
|
SizeCondition = ImGuiCond.FirstUseEver;
|
|
|
|
|
|
|
|
|
|
foreach (ETerritoryType territory in typeof(ETerritoryType).GetEnumValues())
|
|
|
|
|
{
|
2022-10-30 10:02:49 +00:00
|
|
|
|
_territoryStatistics[territory] = new TerritoryStatistics(territory.ToString());
|
2022-10-26 18:43:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Draw()
|
|
|
|
|
{
|
2022-11-30 10:39:40 +00:00
|
|
|
|
DrawDungeonStats("Palace of the Dead", ETerritoryType.Palace_1_10, ETerritoryType.Palace_191_200);
|
|
|
|
|
DrawDungeonStats("Heaven on High", ETerritoryType.HeavenOnHigh_1_10, ETerritoryType.HeavenOnHigh_91_100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void DrawDungeonStats(string name, ETerritoryType minTerritory, ETerritoryType maxTerritory)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (ImGui.CollapsingHeader(name, ImGuiTreeNodeFlags.DefaultOpen))
|
2022-10-26 18:43:24 +00:00
|
|
|
|
{
|
2022-11-30 10:39:40 +00:00
|
|
|
|
if (ImGui.BeginTable($"TrapHoardStatistics{name}", 4, ImGuiTableFlags.Borders | ImGuiTableFlags.Resizable))
|
2022-10-26 18:43:24 +00:00
|
|
|
|
{
|
2022-10-27 14:48:09 +00:00
|
|
|
|
ImGui.TableSetupColumn("Id");
|
|
|
|
|
ImGui.TableSetupColumn("Instance");
|
|
|
|
|
ImGui.TableSetupColumn("Traps");
|
|
|
|
|
ImGui.TableSetupColumn("Hoard");
|
2022-10-26 18:43:24 +00:00
|
|
|
|
ImGui.TableHeadersRow();
|
|
|
|
|
|
2022-11-30 10:39:40 +00:00
|
|
|
|
foreach (var (territoryType, stats) in _territoryStatistics.Where(x => x.Key >= minTerritory && x.Key <= maxTerritory))
|
2022-10-26 18:43:24 +00:00
|
|
|
|
{
|
|
|
|
|
ImGui.TableNextRow();
|
2022-10-27 14:48:09 +00:00
|
|
|
|
if (ImGui.TableNextColumn())
|
|
|
|
|
ImGui.Text($"{(uint)territoryType}");
|
|
|
|
|
|
2022-10-26 18:43:24 +00:00
|
|
|
|
if (ImGui.TableNextColumn())
|
|
|
|
|
ImGui.Text(stats.TerritoryName);
|
|
|
|
|
|
|
|
|
|
if (ImGui.TableNextColumn())
|
|
|
|
|
ImGui.Text(stats.TrapCount?.ToString() ?? "-");
|
|
|
|
|
|
|
|
|
|
if (ImGui.TableNextColumn())
|
|
|
|
|
ImGui.Text(stats.HoardCofferCount?.ToString() ?? "-");
|
|
|
|
|
}
|
|
|
|
|
ImGui.EndTable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal void SetFloorData(IEnumerable<FloorStatistics> floorStatistics)
|
|
|
|
|
{
|
|
|
|
|
foreach (var territoryStatistics in _territoryStatistics.Values)
|
|
|
|
|
{
|
|
|
|
|
territoryStatistics.TrapCount = null;
|
|
|
|
|
territoryStatistics.HoardCofferCount = null;
|
|
|
|
|
}
|
2022-12-01 16:56:26 +00:00
|
|
|
|
|
2022-10-26 18:43:24 +00:00
|
|
|
|
foreach (var floor in floorStatistics)
|
|
|
|
|
{
|
2022-10-30 10:02:49 +00:00
|
|
|
|
if (_territoryStatistics.TryGetValue((ETerritoryType)floor.TerritoryType, out TerritoryStatistics? territoryStatistics))
|
2022-10-26 18:43:24 +00:00
|
|
|
|
{
|
|
|
|
|
territoryStatistics.TrapCount = floor.TrapCount;
|
|
|
|
|
territoryStatistics.HoardCofferCount = floor.HoardCount;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class TerritoryStatistics
|
|
|
|
|
{
|
|
|
|
|
public string TerritoryName { get; set; }
|
|
|
|
|
public uint? TrapCount { get; set; }
|
|
|
|
|
public uint? HoardCofferCount { get; set; }
|
2022-10-30 10:02:49 +00:00
|
|
|
|
|
|
|
|
|
public TerritoryStatistics(string territoryName)
|
|
|
|
|
{
|
|
|
|
|
TerritoryName = territoryName;
|
|
|
|
|
}
|
2022-10-26 18:43:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|