40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
|
|
using Lumina.Excel.Sheets;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace QuestShare.Common
|
|
{
|
|
internal static class Maps
|
|
{
|
|
public static int MarkerToMap(double coord, double scale)
|
|
=> (int)(2 * coord / scale + 100.9);
|
|
|
|
public static int NodeToMap(double coord, double scale)
|
|
=> (int)(2 * coord + 2048 / scale + 100.9);
|
|
|
|
public static int IntegerToInternal(int coord, double scale)
|
|
=> (int)(coord - 100 - 2048 / scale) / 2;
|
|
|
|
public static unsafe void SetFlagMarker(AgentMap* instance, Location location, uint iconId = 60561U)
|
|
{
|
|
instance->IsFlagMarkerSet = 0;
|
|
var x = IntegerToInternal(location.XCoord, location.SizeFactor);
|
|
var y = IntegerToInternal(location.YCoord, location.SizeFactor);
|
|
instance->SetFlagMapMarker(location.Id, location.Data.Map.RowId, x, y, iconId);
|
|
}
|
|
}
|
|
internal class Location(int X, int Y)
|
|
{
|
|
public uint Id { get; init; }
|
|
public float SizeFactor => (Data.Map.ValueNullable?.SizeFactor ?? 100f) / 100f;
|
|
|
|
public int XCoord { get; init; } = X;
|
|
public int YCoord { get; init; } = Y;
|
|
public TerritoryType Data { get; init; }
|
|
}
|
|
}
|