// Copyright © 2017-2018 Atomic Software, LLC. All Rights Reserved.
// See LICENSE.md for full license information.

using Atom.Core.Networking.Messages;
using Atom.LoginServer.Logic;
using Atom.LoginServer.Services;

namespace Atom.LoginServer.Networking.Messages.Handlers
{
    public static class LocalHandlers
    {
        [MessageHandler(MessageProtocol.NC_LOCAL_REGISTERWORLD_REQ)]
        public static void NC_LOCAL_REGISTERWORLD_REQ(NetworkMessage msg)
        {
            var Number = msg.ReadByte();
            var Name = msg.ReadString(16);
            var IP = msg.ReadString(16);
            var Port = msg.ReadInt32();

            WMLogic.RegisterWorld(msg.Client, Number, Name, IP, Port);
        }

        [MessageHandler(MessageProtocol.NC_LOCAL_ADDTRANSFER_CMD)]
        public static void NC_LOCAL_ADDTRANSFER_CMD(NetworkMessage msg)
        {
            var ValidateNew = msg.ReadString(64);
            TransferService.AddTransfer(ValidateNew);
        }
    }
}
