SRC Registro en Main Serve – JoinServer

SRC Registro en Main Serve - JoinServer

 

 

Instrucciones para Agregar Registro en el Lado JoinServer

1. Modificaciones en stdafx.h

  • Agregar la definición para el registro en el lado JoinServer:

 

stdafx.h

Agregar registro lado joinserver
Agregar registro lado joinserver
//Dakosmu
#define LOGIN_REGISTER			1

2. Modificaciones en JoinServerProtocol.cpp

  • Buscar la función GJExternalDisconnectAccountRecv y agregar el siguiente código:
GJExternalDisconnectAccountRecv
GJExternalDisconnectAccountRecv

Agregar la implementación de GJRegisterAccountRecv al final del archivo JoinServerProtocol.cpp:

#if(LOGIN_REGISTER)
        case 0x40:
            GJRegisterAccountRecv((SDHP_REGISTER_ACCOUNT_SEND*)lpMsg, index);
            break;
#endif

y agregar en JoinServerProtocol.cpp este código al final de todo los demás códigos lo mas abajo posible

agregar en JoinServerProtocol.cpp
#if(LOGIN_REGISTER)
void GJRegisterAccountRecv(SDHP_REGISTER_ACCOUNT_SEND* lpMsg, int index)
{
    SDHP_CONNECT_ACCOUNT_SEND pMsg;

    pMsg.header.set(0x40, sizeof(pMsg));

    pMsg.index = lpMsg->index;

    memcpy(pMsg.account, lpMsg->account, sizeof(pMsg.account));

    pMsg.result = CREATE_ACCOUNT_FAIL_ID;

    if (CheckTextSyntax(lpMsg->account, sizeof(lpMsg->account)) == 0)
    {
        pMsg.result = CREATE_ACCOUNT_FAIL_RESIDENT;
        gSocketManager.DataSend(index, (BYTE*)&pMsg, pMsg.header.size);
        LogAdd(LOG_RED, "Account %s Register fail Syntax!");
        return;
    }

    if (gAccountManager.GetAccountCount() >=
#if    PROTECT_STATE
        gJoinServerMaxAccount[gProtect.m_AuthInfo.PackageType][gProtect.m_AuthInfo.PlanType]
#else
        MAX_ACCOUNT
#endif
        )
        if (gAccountManager.GetAccountCount() >= gJoinServerMaxAccount[gProtect.m_AuthInfo.PackageType][gProtect.m_AuthInfo.PlanType])
        {
            pMsg.result = CREATE_ACCOUNT_FAIL_RESIDENT;
            gSocketManager.DataSend(index, (BYTE*)&pMsg, pMsg.header.size);
            LogAdd(LOG_RED, "Account %s Register fail, CONNECTION!!!");
            return;
        }
    if (MD5Encryption == 0)
    {
        if (gQueryManager.ExecQuery("SELECT memb__pwd FROM MEMB_INFO WHERE memb___id='%s' COLLATE Latin1_General_BIN", lpMsg->account) == 0 || gQueryManager.Fetch() == SQL_NO_DATA)
        {
            gQueryManager.Close();
            if (gQueryManager.ExecQuery("INSERT INTO dbo.MEMB_INFO(memb___id, memb__pwd, memb_name, sno__numb, mail_addr, mail_chek, bloc_code, ctl1_code) VALUES ('%s', '%s', '%s', '%s', '%s', 1, 0, 1)",
                lpMsg->account,
                lpMsg->password,
                "JoinServer",
                lpMsg->personalcode,
                lpMsg->Email) == TRUE)
            {
                gQueryManager.Close();
                pMsg.result = CREATE_ACCOUNT_SUCCESS;
                gLog.Output(LOG_ACCOUNT, "[AccountInfo] Account created (Account: %s, Password: %s )", lpMsg->account, lpMsg->password);
            }
        }
        else
        {
            pMsg.result = CREATE_ACCOUNT_FAIL_ID;
            gQueryManager.Close();
        }
    }
    else
    {
        if (gQueryManager.ExecQuery("SELECT memb__pwd FROM MEMB_INFO WHERE memb___id='%s'", lpMsg->account) == 0 || gQueryManager.Fetch() == SQL_NO_DATA)
        {
            gQueryManager.Close();
            if (gQueryManager.ExecQuery("INSERT INTO dbo.MEMB_INFO(memb___id, memb__pwd, memb_name, sno__numb, mail_addr, mail_chek, bloc_code, ctl1_code) VALUES ('%s', '%s', '%s', '%s', '%s', 1, 0, 1)",
                lpMsg->account,
                lpMsg->password,
                "JoinServer",
                lpMsg->personalcode,
                lpMsg->Email) == TRUE)
            {
                gQueryManager.Close();
                pMsg.result = CREATE_ACCOUNT_SUCCESS;
                gLog.Output(LOG_ACCOUNT, "[AccountInfo] Account created (Account: %s, Password: %s )", lpMsg->account, lpMsg->password);
            }
        }
        else
        {
            pMsg.result = CREATE_ACCOUNT_FAIL_ID;
            gQueryManager.Close();
        }

    }
    gSocketManager.DataSend(index, (BYTE*)&pMsg, pMsg.header.size);
}
#endif

3. Modificaciones en JoinServerProtocol.h

  • Agregar las definiciones de resultados de registro:
CREATE_ACCOUNT_FAIL_ID
CREATE_ACCOUNT_FAIL_ID
#define CREATE_ACCOUNT_FAIL_ID				0
#define CREATE_ACCOUNT_SUCCESS				1
#define CREATE_ACCOUNT_FAIL_RESIDENT		2

 

Buscar la estructura PWMSG_HEAD y agregar la nueva estructura SDHP_REGISTER_ACCOUNT_SEND:

PWMSG_HEAD

4. Modificaciones en JoinServerProtocolCore

  • Buscar void JoinServerProtocolCore y agregar la declaración de la función:
#if(LOGIN_REGISTER)
struct SDHP_REGISTER_ACCOUNT_SEND
{
    PBMSG_HEAD header; // C1:01
    WORD index;
    char account[11];
    char password[11];
    char personalcode[11];
    char Email[50];
};
#endif

Buscamos void JoinServerProtocolCore

JoinServerProtocolCore
JoinServerProtocolCore

Y agregamos

#if(LOGIN_REGISTER)
void GJRegisterAccountRecv(SDHP_REGISTER_ACCOUNT_SEND* lpMsg, int index);
#endif

 

Conclusión

Con estas modificaciones, habrás agregado la funcionalidad de registro de cuentas en el lado JoinServer. Asegúrate de probar el código para verificar que todo funcione correctamente. Si tienes alguna pregunta o necesitas más ayuda, no dudes en preguntar.

  1. Registro Main Autologin Todas las Bases Season 6
  2. Tiempo Límite en el Login Registro Dentro del Juego MuOnline
  3. MU Server MUEMU Repack Update 25 by Emershow – New
  4. Mostrar Texto MUEMU Season 6

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *