public void HandleMessage(ScriptClient sender, PacketReader stream) { if (sender == null) { throw new ArgumentNullException(nameof(sender)); } if (stream == null) { throw new ArgumentNullException(nameof(stream)); } try { bool success = stream.ReadBit(); if (success) { CharacterCreationSuccessful?.Invoke(this); } else { CharacterCreationFailure reason = (CharacterCreationFailure)stream.ReadByte(); CharacterCreationFailed?.Invoke(this, reason); } } catch (Exception e) { string msg = $"Something went wrong while handling a '{SupportedMessage}' script message from the server."; _Log.Error(msg); throw new ScriptMessageHandlingException(msg, e); } }
public CharacterCreationFailed(CharacterCreationFailure reason) : base(false) { Reason = reason; }