Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent double-membership for pawns in party, causing XP duplication.
Browse files Browse the repository at this point in the history
RyanYappert committed Dec 4, 2024
1 parent 8afe27d commit a1446eb
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Arrowgene.Ddon.GameServer/Party/PartyGroup.cs
Original file line number Diff line number Diff line change
@@ -740,6 +740,17 @@ private int TakeSlot(PartyMember partyMember)
int slotIndex = InvalidSlotIndex;
lock (_lock)
{
for (int i = 0; i < MaxSlots; i++)
{
if (_slots[i] != null && _slots[i].CommonId == partyMember.CommonId)
{
// This character is already in the party, so fail gracefully without letting them take a second slot.
Logger.Error($"[PartyId:{Id}][TakeSlot] Party member already present.");
slotIndex = i;
break;
}
}

for (int i = 0; i < MaxSlots; i++)
{
if (_slots[i] == null)
@@ -789,6 +800,7 @@ private PlayerPartyMember CreatePartyMember(GameClient client)
PlayerPartyMember partyMember = new PlayerPartyMember(client, _partyManager.Server);
partyMember.IsPawn = false;
partyMember.MemberType = 1;
partyMember.CommonId = client.Character.CommonId;
partyMember.PawnId = 0;
partyMember.IsPlayEntry = false;
partyMember.AnyValueList = new byte[8];
@@ -804,6 +816,7 @@ private PawnPartyMember CreatePartyMember(Pawn pawn)
PawnPartyMember partyMember = new PawnPartyMember();
partyMember.Pawn = pawn;
partyMember.IsPawn = true;
partyMember.CommonId = pawn.CommonId;
partyMember.MemberType = 2;
partyMember.PawnId = pawn.PawnId;
partyMember.IsPlayEntry = false;
1 change: 1 addition & 0 deletions Arrowgene.Ddon.GameServer/Party/PartyMember.cs
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ public abstract class PartyMember
{
public byte MemberType { get; set; }
public int MemberIndex { get; set; }
public uint CommonId { get; set; }
public uint PawnId { get; set; }
public bool IsLeader { get; set; }
public bool IsPawn { get; set; }

0 comments on commit a1446eb

Please sign in to comment.