From bb9afc07375e5ccc808873e15dabf7d00b7084a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Sun, 15 Jan 2023 11:14:01 +0100 Subject: [PATCH] fix(game): treat nullable fields in cmode packet correctly --- .../Characters/CharacterInitResponder.cs | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/Core/NosSmooth.Game/PacketHandlers/Characters/CharacterInitResponder.cs b/Core/NosSmooth.Game/PacketHandlers/Characters/CharacterInitResponder.cs index e14d4fa..3f63ad3 100644 --- a/Core/NosSmooth.Game/PacketHandlers/Characters/CharacterInitResponder.cs +++ b/Core/NosSmooth.Game/PacketHandlers/Characters/CharacterInitResponder.cs @@ -178,16 +178,26 @@ public class CharacterInitResponder : IPacketResponder, 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 -- 2.49.0