Skip to content

Commit

Permalink
Merge pull request #665 from Diyagi/custom_payload
Browse files Browse the repository at this point in the history
[FaloopIntegration] Remove SpawnRelease handler and fix SpawnState search logic.
  • Loading branch information
SlashNephy committed Jul 7, 2024
2 parents f900480 + ac3fe87 commit 80e4650
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
1 change: 0 additions & 1 deletion FaloopIntegration/Faloop/Model/MobReportData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public static class MobReportActions
{
public const string Spawn = "spawn";
public const string SpawnLocation = "spawn_location";
public const string SpawnRelease = "spawn_release";
public const string SpawnFalse = "spawn_false";
public const string Death = "death";
}
Expand Down
18 changes: 4 additions & 14 deletions FaloopIntegration/FaloopIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ private void OnMobReport(MobReportData data)
}
}

var previous = Config.SpawnStates.FirstOrDefault(x => x.MobId == mobData.BNpcId && x.WorldId == worldId);
var previous = Config.SpawnStates.FirstOrDefault(x =>
x.MobId == mobData.BNpcId &&
x.WorldId == worldId &&
x.ZoneInstance == data.Ids.ZoneInstance);
if (previous == default)
{
DalamudLog.Log.Debug("OnMobReport: previous == null");
Expand All @@ -176,19 +179,6 @@ private void OnMobReport(MobReportData data)
OnMobSpawn(ev, config.Channel);
break;
}
case MobReportActions.SpawnRelease when config.EnableSpawnReport:
{
var spawn = JsonSerializer.Deserialize<MobReportData.SpawnRelease>(data.Data) ?? throw new InvalidOperationException("invalid spawn release data");
var previous = Config.SpawnStates.FirstOrDefault(x => x.MobId == mobData.BNpcId && x.WorldId == worldId);
if (previous == default)
{
DalamudLog.Log.Debug("OnMobReport: previous == null");
break;
}
var ev = new MobSpawnEvent(mobData.BNpcId, worldId, previous.TerritoryTypeId, data.Ids.ZoneInstance, mobData.Rank, spawn.Timestamp, previous.Reporter, previous.Location);
OnMobSpawn(ev, config.Channel);
break;
}
case MobReportActions.SpawnFalse when config.EnableSpawnReport:
{
var ev = new MobDeathEvent(mobData.BNpcId, worldId, data.Ids.ZoneInstance, mobData.Rank, DateTime.Now);
Expand Down

0 comments on commit 80e4650

Please sign in to comment.