~ruther/NosSmooth

bb9afc07375e5ccc808873e15dabf7d00b7084a1 — František Boháček 2 years ago 24f45c4
fix(game): treat nullable fields in cmode packet correctly
1 files changed, 20 insertions(+), 10 deletions(-)

M Core/NosSmooth.Game/PacketHandlers/Characters/CharacterInitResponder.cs
M Core/NosSmooth.Game/PacketHandlers/Characters/CharacterInitResponder.cs => Core/NosSmooth.Game/PacketHandlers/Characters/CharacterInitResponder.cs +20 -10
@@ 178,16 178,26 @@ public class CharacterInitResponder : IPacketResponder<CInfoPacket>, IPacketResp
            () => throw new NotImplementedException(),
            (character) =>
            {
                character.Morph = new Morph
                (
                    packet.MorphVNum,
                    packet.MorphUpgrade,
                    packet.MorphDesign,
                    packet.MorphBonus,
                    packet.MorphSkin
                );

                character.Size = packet.Size;
                if (packet.MorphVNum is not null)
                {
                    character.Morph = new Morph
                    (
                        packet.MorphVNum.Value,
                        packet.MorphUpgrade ?? 0,
                        packet.MorphDesign,
                        packet.MorphBonus,
                        packet.MorphSkin
                    );
                }
                else
                {
                    character.Morph = null;
                }

                if (packet.Size is not null)
                {
                    character.Size = packet.Size.Value;
                }
                return character;
            },
            ct: ct

Do not follow this link