Exemple #1
0
    public override async Task Initialize(TcpClient client)
    {
        await base.Initialize(client);

        this.addressToClientBuildMap = this.accountService.GetClientBuildFromAddress(this.Address, this.Port);

        if (this.addressToClientBuildMap is null)
        {
            this.logger.LogWarning($"Could not find client build for {this.Address}:{this.Port - 1}.");
            this.Build = ClientBuild.Vanilla;
        }
        else
        {
            this.Build = this.addressToClientBuildMap.ClientBuild;
        }

        this.logger.LogDebug($"{this.ClientInfo} - connected");

        ServerPacketBase <Opcode> message = this.Build switch
        {
            ClientBuild.Vanilla or ClientBuild.TBC => SMSG_AUTH_CHALLENGE.VanillaTBC(),
                                  ClientBuild.WotLK => SMSG_AUTH_CHALLENGE.WotLK(),
                                  _ => throw new NotImplementedException($"SMSG_AUTH_CHALLENGE(build: {this.Build})"),
        };

        await Send(message.Get());

        this.logger.LogTrace($"{this.ClientInfo} - Sent {message.Opcode}");
        await HandleConnection();
    }
Exemple #2
0
    public static SMSG_AUTH_CHALLENGE VanillaTBC()
    {
        var packet = new SMSG_AUTH_CHALLENGE();

        packet.Writer
        .WriteUInt16Reversed(6)     // length
        .WriteUInt16((ushort)Opcode.SMSG_AUTH_CHALLENGE)
        .WriteBytes(AuthSeed);
        return(packet);
    }
Exemple #3
0
    public static SMSG_AUTH_CHALLENGE WotLK()
    {
        var packet = new SMSG_AUTH_CHALLENGE();

        packet.Writer
        .WriteUInt16Reversed(40)                                      // length
        .WriteUInt16((ushort)Opcode.SMSG_AUTH_CHALLENGE)
        .WriteUInt32(1)                                               // 1..31 ???
        .WriteBytes(AuthSeed)                                         // m_seed ???
        .WriteBytes(Classic.Shared.Cryptography.Random.GetBytes(16))  // seed1
        .WriteBytes(Classic.Shared.Cryptography.Random.GetBytes(16)); // seed2
        return(packet);
    }