fix: make deserialisation work correctly

This commit is contained in:
Anna 2024-02-18 12:35:06 -05:00
parent ddbb06b170
commit 9440dc6af2
Signed by: anna
GPG Key ID: D0943384CD9F87D1
2 changed files with 9 additions and 4 deletions

View File

@ -8,6 +8,7 @@ using FFXIVClientStructs.FFXIV.Client.Graphics.Environment;
using FFXIVClientStructs.FFXIV.Client.System.Framework;
using FFXIVClientStructs.FFXIV.Client.UI.Agent;
using Lumina.Excel.GeneratedSheets;
using Newtonsoft.Json;
using Map = Lumina.Excel.GeneratedSheets.Map;
namespace Screenie;
@ -191,6 +192,10 @@ public class Character {
this.JobId = player.ClassJob.Id;
}
[JsonConstructor]
internal Character() {
}
private static float ConvertRawPositionToMapCoordinate(float pos, float scale, short offset) {
var num2 = (pos + offset) * scale;
return (float) (41.0 / scale * ((num2 + 1024.0) / 2048.0) + 1.0);

View File

@ -49,15 +49,15 @@ internal class DatabaseTab : ITab {
LocationSub = reader.GetNullableFieldValue<string>(4),
Area = reader.GetNullableFieldValue<string>(5),
AreaSub = reader.GetNullableFieldValue<string>(6),
TerritoryType = (uint) reader.GetFieldValue<long>(7),
TerritoryType = (uint) reader.GetFieldValue<int>(7),
World = reader.GetNullableFieldValue<string>(8),
WorldId = (uint) reader.GetFieldValue<long>(9),
WorldId = (uint) reader.GetFieldValue<int>(9),
CapturedAtLocal = reader.GetFieldValue<DateTime>(10),
CapturedAtUtc = reader.GetFieldValue<DateTime>(11),
EorzeaTime = reader.GetFieldValue<string>(12),
Weather = reader.GetNullableFieldValue<string>(13),
Ward = (uint?) reader.GetNullableFieldValue<long>(14),
Plot = (uint?) reader.GetNullableFieldValue<long>(15),
Ward = (uint?) reader.GetNullableFieldValue<int>(14),
Plot = (uint?) reader.GetNullableFieldValue<int>(15),
VisibleCharacters = JsonConvert.DeserializeObject<Character[]>(
reader.GetFieldValue<string>(16)
) ?? [],