Initial HSMappy release (fork of Mappy)

Made-with: Cursor
This commit is contained in:
2026-02-26 03:54:51 -05:00
commit 9659f7a7d1
72 changed files with 6625 additions and 0 deletions
@@ -0,0 +1,53 @@
using System.Numerics;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility.Raii;
using KamiLib.Extensions;
using Lumina.Excel.Sheets;
namespace Mappy.Classes.SelectionWindowComponents;
public class AetheryteDrawableOption : DrawableOption
{
public required Aetheryte Aetheryte { get; set; }
public override string ExtraLineLong => GetName();
public override Map Map => GetAetheryteMap()!.Value; // Probably a bad idea
protected override string[] GetAdditionalFilterStrings() =>
[
Aetheryte.PlaceName.Value.Name.ExtractText(),
Aetheryte.AethernetName.Value.Name.ExtractText(),
];
protected override void DrawIcon()
{
using var imageFrame = ImRaii.Child($"image_frame{Aetheryte.RowId}#{MarkerLocation}#{ExtraLineLong}", new Vector2(Width, Height), false, ImGuiWindowFlags.NoInputs);
if (!imageFrame) return;
var xOffset = (Width - Height) / 2.0f;
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + xOffset);
ImGui.Image(Service.TextureProvider.GetFromGameIcon(Aetheryte.IsAetheryte ? 60453 : 60430).GetWrapOrEmpty().Handle, new Vector2(Height, Height));
}
private Map? GetAetheryteMap()
{
if (Aetheryte.Map.RowId is not 0) return Aetheryte.Map.Value;
if (Service.DataManager.GetExcelSheet<Aetheryte>().FirstOrNull(aetheryte => aetheryte.IsAetheryte && aetheryte.AethernetGroup == Aetheryte.AethernetGroup) is not
{ } targetAetheryte)
return null;
return targetAetheryte.Map.Value;
}
private string GetName()
{
if (Aetheryte.AethernetName.RowId is not 0) return Aetheryte.AethernetName.Value.Name.ExtractText();
if (Aetheryte.PlaceName.RowId is not 0) return Aetheryte.PlaceName.Value.Name.ExtractText();
return string.Empty;
}
public override string GetElementKey() => base.GetElementKey() + $"{Aetheryte.RowId}";
}
@@ -0,0 +1,97 @@
using System.Drawing;
using System.Linq;
using System.Numerics;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Dalamud.Utility;
using Lumina.Excel.Sheets;
namespace Mappy.Classes.SelectionWindowComponents;
public abstract class DrawableOption
{
protected virtual string[] GetAdditionalFilterStrings() => [];
public virtual Map Map { get; set; }
protected static float Width => 133.5f * ImGuiHelpers.GlobalScale;
protected static float Height => 75.0f * ImGuiHelpers.GlobalScale;
protected abstract void DrawIcon();
public virtual string ExtraLineLong => string.Empty;
public virtual string ExtraLineShort => string.Empty;
public virtual Vector2? MarkerLocation => null;
public virtual string GetElementKey() => $"{Map.RowId}{MarkerLocation}{ExtraLineShort}{ExtraLineLong}";
public string[] GetFilterStrings()
{
if (Map.RowId is 0) return [];
var baseStrings = new[]
{
Map.PlaceNameRegion.ValueNullable?.Name.ExtractText() ?? string.Empty, Map.PlaceName.ValueNullable?.Name.ExtractText() ?? string.Empty,
Map.PlaceNameSub.ValueNullable?.Name.ExtractText() ?? string.Empty, Map.TerritoryType.ValueNullable?.Name.ExtractText() ?? string.Empty, Map.Id.ExtractText(),
};
return baseStrings.Concat(GetAdditionalFilterStrings()).ToArray();
}
public void Draw()
{
using var id = ImRaii.PushId(Map.RowId.ToString());
DrawIcon();
ImGui.SameLine();
using var contentsFrame = ImRaii.Child($"contents_frame#{GetElementKey()}", new Vector2(ImGui.GetContentRegionAvail().X, Height), false, ImGuiWindowFlags.NoInputs);
if (!contentsFrame) return;
ImGuiHelpers.ScaledDummy(1.0f);
using var table = ImRaii.Table("data_table", 2, ImGuiTableFlags.SizingStretchProp);
if (!table) return;
ImGui.TableSetupColumn("##column1", ImGuiTableColumnFlags.None, 2.0f);
ImGui.TableSetupColumn("##column2", ImGuiTableColumnFlags.None, 1.0f);
var placeName = Map.PlaceName.ValueNullable?.Name.ExtractText() ?? string.Empty;
var zoneName = Map.PlaceNameSub.ValueNullable?.Name.ExtractText() ?? string.Empty;
var regionName = Map.PlaceNameRegion.ValueNullable?.Name.ExtractText() ?? string.Empty;
ImGui.TableNextColumn();
ImGui.TextUnformatted(placeName);
ImGui.TableNextColumn();
ImGui.TextUnformatted(Map.RowId.ToString());
ImGui.TableNextRow();
ImGui.TableNextColumn();
using var grayColor = ImRaii.PushColor(ImGuiCol.Text, KnownColor.DarkGray.Vector());
if (!zoneName.IsNullOrEmpty() && !regionName.IsNullOrEmpty()) {
ImGui.TextUnformatted($"{regionName}, {zoneName}");
}
else if (!zoneName.IsNullOrEmpty()) {
ImGui.TextUnformatted($"{zoneName}");
}
else if (!regionName.IsNullOrEmpty()) {
ImGui.TextUnformatted($"{regionName}");
}
ImGui.TableNextColumn();
ImGui.TextUnformatted($"{Map.Id}");
ImGui.TableNextColumn();
ImGui.TextUnformatted(ExtraLineLong);
ImGui.TableNextColumn();
ImGui.TextUnformatted(ExtraLineShort);
}
}
@@ -0,0 +1,42 @@
using System.Numerics;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Textures.TextureWraps;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Utility.Raii;
using Lumina.Excel.Sheets;
namespace Mappy.Classes.SelectionWindowComponents;
public class MapDrawableOption : DrawableOption
{
protected override void DrawIcon()
{
var option = Map.TerritoryType.Value;
using var imageFrame = ImRaii.Child($"image_frame{option}", new Vector2(Width, Height), false, ImGuiWindowFlags.NoInputs);
if (!imageFrame) return;
var texture = GetMapTexture(Map.RowId);
if (texture is not null) {
ImGui.Image(texture.Handle, new Vector2(Width, Height), new Vector2(0.15f, 0.15f), new Vector2(0.85f, 0.85f));
}
else {
ImGuiHelpers.ScaledDummy(Width, Height);
}
}
public static IDalamudTextureWrap? GetMapTexture(uint mapId)
{
if (mapId is 0) return null;
var map = Service.DataManager.GetExcelSheet<Map>().GetRow(mapId);
var territory = map.TerritoryType;
if (!territory.IsValid) return null;
var loadingImage = territory.Value.LoadingImage;
if (!loadingImage.IsValid) return null;
var texturePath = $"ui/loadingimage/{loadingImage.Value.FileName}_hr1.tex";
return Service.TextureProvider.GetFromGame(texturePath).GetWrapOrDefault();
}
}
@@ -0,0 +1,35 @@
using System.Linq;
using System.Numerics;
using Dalamud.Bindings.ImGui;
using Dalamud.Interface.Utility.Raii;
using Lumina.Excel.Sheets;
namespace Mappy.Classes.SelectionWindowComponents;
public class PoiDrawableOption : DrawableOption
{
public required MapMarker MapMarker { get; set; }
public override Vector2? MarkerLocation => new Vector2(MapMarker.X, MapMarker.Y);
public override Map Map => Service.DataManager.GetExcelSheet<Map>().FirstOrDefault(map => map.MapMarkerRange == MapMarker.RowId);
public override string ExtraLineLong => MapMarker.PlaceNameSubtext.Value.Name.ExtractText();
protected override void DrawIcon()
{
using var imageFrame = ImRaii.Child($"image_frame{MapMarker.RowId}#{MarkerLocation}", new Vector2(Width, Height), false, ImGuiWindowFlags.NoInputs);
if (!imageFrame) return;
var xOffset = (Width - Height) / 2.0f;
ImGui.SetCursorPosX(ImGui.GetCursorPosX() + xOffset);
ImGui.Image(Service.TextureProvider.GetFromGameIcon((uint)MapMarker.Icon).GetWrapOrEmpty().Handle, new Vector2(Height, Height));
}
protected override string[] GetAdditionalFilterStrings() =>
[
MapMarker.PlaceNameSubtext.Value.Name.ExtractText(),
];
public override string GetElementKey() => base.GetElementKey() + $"{MapMarker.RowId}";
}