using System;
using NetWorkMessage;

namespace Server.Core
{
    public static class MessageHelper
    {
        public static IResponse CreateResponse(Type requestType, uint rpcId, int error)
        {
            Type responseType = OpcodeType.Instance.GetResponseType(requestType);
            if (responseType == null)
            {
                return null;
            }
            IResponse response = (IResponse)ReferencePool.Fetch(responseType);
            response.Error = error;
            response.RpcId = rpcId;
            return response;
        }
    }
}