Skip to content

Commit

Permalink
Fix: CreatureHistory make sure to remove expired ones even if the cor…
Browse files Browse the repository at this point in the history
…responding cell were not updated!
  • Loading branch information
Xian55 committed Nov 16, 2021
1 parent 5513e05 commit 2a9495e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Core/AddonComponent/CreatureHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,13 @@ public void Update(int targetGuid, int targetHealthPercent)
KillCredit?.Invoke(this, EventArgs.Empty);
}
}
}

RemoveExpired(Targets);
RemoveExpired(Creatures);
RemoveExpired(DamageTaken);
RemoveExpired(DamageDone);
RemoveExpired(Deads);
}

private static void Update(int creatureId, float healthPercent, List<CreatureRecord> CombatCreatures)
{
Expand Down Expand Up @@ -122,10 +127,11 @@ private static void Update(int creatureId, float healthPercent, List<CreatureRec
});
}
}
}

CombatCreatures.Where(c => c.HasExpired(LifeTimeInSeconds))
.ToList()
.ForEach(c => CombatCreatures.Remove(c));
private static void RemoveExpired(List<CreatureRecord> CombatCreatures)
{
CombatCreatures.RemoveAll(x => x.HasExpired(LifeTimeInSeconds));
}
}
}

0 comments on commit 2a9495e

Please sign in to comment.