Skip to content

Commit

Permalink
extract spawn location
Browse files Browse the repository at this point in the history
  • Loading branch information
SlashNephy committed Jun 29, 2024
1 parent 05826db commit d88c704
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions FaloopIntegration/Faloop/Model/MobReportData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public record Spawn(
[property: JsonPropertyName("timestamp")] DateTime Timestamp,
[property: JsonPropertyName("zoneId2")] string ZoneId,
[property: JsonPropertyName("zonePoiIds")] List<int>? ZonePoiIds,
[property: JsonPropertyName(name: "location")] string? Location,
[property: JsonPropertyName("reporters")] List<Reporter>? Reporters);

public record Reporter([property: JsonPropertyName("name")] string Name);
Expand Down
2 changes: 1 addition & 1 deletion FaloopIntegration/Faloop/Model/MockData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Divination.FaloopIntegration.Faloop.Model;

public static class MockData
{
private static readonly MobReportData.Spawn Spawn = new(DateTime.UtcNow, "the_dravanian_hinterlands", [643], null);
private static readonly MobReportData.Spawn Spawn = new(DateTime.UtcNow, "the_dravanian_hinterlands", [643], null, null);

public static readonly MobReportData SpawnMobReport = new(MobReportActions.Spawn,
Ids: new(
Expand Down
10 changes: 8 additions & 2 deletions FaloopIntegration/FaloopIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,15 @@ private void OnMobReport(MobReportData data)
DalamudLog.Log.Warning("OnMobReport: unknown zone id found: {ZoneId}", spawn.ZoneId);
return;
}
if (!FaloopEmbedData.Locations.TryGetValue(spawn.ZonePoiIds?.FirstOrDefault() ?? default, out var location))

string? location;
if (!string.IsNullOrEmpty(spawn.Location))
{
location = spawn.Location;
}
else if (!FaloopEmbedData.Locations.TryGetValue(spawn.ZonePoiIds?.FirstOrDefault() ?? default, out location))
{
DalamudLog.Log.Debug("OnMobReport: unknown zone poi id found: {ZonePoiId}", spawn.ZonePoiIds?.FirstOrDefault() ?? default);
DalamudLog.Log.Debug("OnMobReport: unknown location found: {Spawn}", spawn);
if (config.SkipPendingReport)
{
return;
Expand Down

0 comments on commit d88c704

Please sign in to comment.