Skip to content

Commit

Permalink
fix: Cache player party in Entity.Die to avoid Collection Modified Ex…
Browse files Browse the repository at this point in the history
…ceptions (#1914)
  • Loading branch information
Cheshire92 authored Sep 20, 2023
1 parent 63ba58a commit 0363f11
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Intersect.Server/Entities/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2834,11 +2834,15 @@ public virtual void Die(bool dropItems = true, Entity killer = null)
var player = Player.FindOnline(entityEntry);
if (player != null)
{

// Cache our value for further processing.
var party = player.Party.ToArray();

// is this player in a party?
if (player.Party.Count > 0 && Options.Instance.LootOpts.IndividualizedLootAutoIncludePartyMembers)
if (party.Length > 0 && Options.Instance.LootOpts.IndividualizedLootAutoIncludePartyMembers)
{
// They are, so check for all party members and drop if still eligible!
foreach (var partyMember in player.Party)
foreach (var partyMember in party)
{
if (!lootGenerated.Contains(partyMember))
{
Expand Down

0 comments on commit 0363f11

Please sign in to comment.