~ruther/NosSmooth

2490c12ccc03bf2aad6e3ad1f4236b2fef4e07cc — Rutherther 2 years ago 74de6fd
fix(game): make current partner and pet null if pinit does not contain them
1 files changed, 10 insertions(+), 2 deletions(-)

M Core/NosSmooth.Game/PacketHandlers/Relations/MatesInitResponder.cs
M Core/NosSmooth.Game/PacketHandlers/Relations/MatesInitResponder.cs => Core/NosSmooth.Game/PacketHandlers/Relations/MatesInitResponder.cs +10 -2
@@ 227,21 227,29 @@ public class MatesInitResponder : IPacketResponder<ScPPacket>, IPacketResponder<
            {
                if (partner is not null)
                {
                    gamePartner = _game.Mates?.Partners.FirstOrDefault(x => x.MateId == partner.EntityId);
                    gamePartner = _game.Mates?.Partners.FirstOrDefault(x => x.TransportId == partner.EntityId);
                    if (gamePartner is not null && gamePartner != m.CurrentPartner?.Partner)
                    {
                        m.CurrentPartner = new PartyPartner(gamePartner);
                    }
                }
                else
                {
                    m.CurrentPartner = null;
                }

                if (pet is not null)
                {
                    gamePet = _game.Mates?.Pets.FirstOrDefault(x => x.MateId == pet.EntityId);
                    gamePet = _game.Mates?.Pets.FirstOrDefault(x => x.TransportId == pet.EntityId);
                    if (gamePet is not null && gamePet != m.CurrentPet?.Pet)
                    {
                        m.CurrentPet = new PartyPet(gamePet);
                    }
                }
                else
                {
                    m.CurrentPet = null;
                }

                return m;
            },

Do not follow this link