Noticias:

SMF - Just Installed!

Menú principal

Source Registro Login al Main Season 6

Publicado por Dakosmu, Jun 26, 2023, 09:47 PM

Tema anterior - Siguiente tema

Dakosmu

Source Registro en Main, JoinServer, Gameserver Season 6

Los visitantes no pueden visualizar imágenes en los mensajes, por favor Regístrate o Inicia Sesión

Los visitantes no pueden visualizar imágenes en los mensajes, por favor Regístrate o Inicia Sesión

Los visitantes no pueden visualizar imágenes en los mensajes, por favor Regístrate o Inicia Sesión


Les comparto la guía completa para agregar el sistema de Registro en Main... Recuerden que las bases no son iguales...

Espero que les funcione a todos. Rebote.
You require the following to view this post content:
  • You require a post count of at least 1, you need another 1 posts.
struct
{
    #pragma pack(1)
    PSBMSG_HEAD Header;
    char lpszID[10];
    char lpszPass[20];
    char lpszPCode[20];
    char lpszEmail[50];
    DWORD TickCount;
    BYTE Version[5];  // Cambiado de "Versión" a "Version"
    BYTE Serial[16];  // Cambiado de "Serie" a "Serial"
    #pragma pack()
} PBMSG_REGISTER_ACCOUNT, * LPPBMSG_REGISTER_ACCOUNT;
[/code]

Protocol.cpp

#include "LoginMainWin.h"

case 0xF1:
    switch(((lpMsg[0] == 0xC1) ? lpMsg[3] : lpMsg[4]))
    {
        ...
        case 0x12:
            g_pLoginMainWin.ReceiveCreateAccount(((lpMsg[0] == 0xC1) ? lpMsg[4] : lpMsg[5]));
            break;  // Cambiado de "romper" a "break"
    }
    break;

Interface.cpp

// Agregar Sección IMAGEN

// AutoLogin / Register
LoadBitmapA("Custom\\Desig\\login_auto.tga", 531141, GL_NEAREST, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\login_auto.tga", 531141, GL_NEAREST, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\Login.tga", 71621, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\1.tga", 71622, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\2.tga", 71623, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\3.tga", 71624, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\4.tga", 71625, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\5.tga", 71626, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\6.tga", 71627, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\8.tga", 71629, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\9.tga", 71630, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\10.tga", 71630, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\login_back.tga", 71631, GL_LINEAR, GL_CLAMP, 1, 0);
LoadBitmapA("Personalizado\\Diseño\\reloadcap.jpg", 71632, GL_LINEAR, GL_CLAMP, 1, 0);

Main.cpp

#include "LoginMainWin.h"
#include "AutoLoginWin.h"

// Agregar dentro de:

extern "C" _declspec(dllexport) void EntryProc() // Aceptar
{     
    g_pLoginMainWin.Init(); // Inicio de sesión automático / Registro
    AutoLogin.Load(); // Auto Login / Register
}

Seguimos con SRC JOINSERVE

stdafx.h

// Abajo de

#define JOINSERVER_VERSION

// Agregar:

#define OBBY 1

JoinServerProtocol.cpp

// Abajo de :

case 0x30:
    GJExternalDisconnectAccountRecv((SDHP_EXTERNAL_DISCONNECT_ACCOUNT_RECV*)lpMsg,index);
    romper;

// Agregar:

#if(OBBY)
#if(OBBY)
case 0x40:
    GJRegisterAccountRecv((SDHP_REGISTER_ACCOUNT_SEND*)lpMsg, index);
    break; // Cambiado de "romper" a "break"
#endif

// Abajo de:

gLog.Output(LOG_ACCOUNT,"[AccountInfo] Cuenta conectada (Cuenta: %s, IpAddress: %s, GameServerCode: %d)",AccountInfo.Account,AccountInfo.IpAddress,AccountInfo.GameServerCode);

// Agregar:

#if(OBBY)
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,"Cuenta %s Registrar falla en la sintaxis!", lpMsg->account);
        return;
    }

    if(gAccountManager.GetAccountCount() >=
#if PROTECT_STATE
        gJoinServerMaxAccount[gProtect.m_AuthInfo.PackageType][gProtect.m_AuthInfo.PlanType]
#else
        MAX_ACCOUNT
#endif
    )
    {
        pMsg.result = CREATE_ACCOUNT_FAIL_RESIDENT;
        gSocketManager.DataSend(index,(BYTE*)&pMsg,pMsg.header.size);
        LogAdd(LOG_RED,"Error en el registro de la cuenta %s, ¡¡¡CONEXIÓN!!!", lpMsg->account);
        return;
    }

    // Continuar con la lógica de registro...
}
#endif

JoinServerProtocol.h

// Abajo de
#pragma once

// Agregar Esto
#define CREATE_ACCOUNT_FAIL_ID 0
#define CREATE_ACCOUNT_SUCCESS 1
#define CREATE_ACCOUNT_FAIL_RESIDENT 2

// Abajo de:
char IpAddress[16];

// Agregar:

#if(OBBY)
struct SDHP_REGISTER_ACCOUNT_SEND
{
    PBMSG_HEAD header; // C1:01
    int index;  // Cambiado de "índice" a "index"
    char account[11];  // Cambiado de "cuenta" a "account"
    char password[11];  // Cambiado de "contraseña" a "password"
    char personalCode[11];  // Cambiado de "código personal" a "personalCode"
    char email[50];  // Cambiado de "Correo electrónico" a "email"
};
#endif

// Abajo de:

void GJAccountLockSaveRecv(SDHP_LOCK_SAVE_RECV* lpMsg,int index);

// Agregar:

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

Seguimos con SRC GAMERSERVE

stdafx.h

// Agregar:

#define OBBY 1

JSProtocol.cpp

// Abajo de:

case 0x30:
    JGAccountAlreadyConnectedRecv((SDHP_ACCOUNT_ALREADY_CONNECTED_RECV*)lpMsg);
    romper;

// Agregar:

#if(OBBY)
case 0x40:
    JGRegisterAccountRecv((SDHP_CONNECT_ACCOUNT_RECV*)lpMsg);
    romper;
#endif

// Abajo de:

void JGServerInfoRecv(SDHP_JOIN_SERVER_INFO_RECV* lpMsg) // OK
{

}

// Agregar:

#if(OBBY)
void JGRegisterAccountRecv(SDHP_CONNECT_ACCOUNT_RECV* lpMsg) // OK
{
    if(OBJECT_RANGE(lpMsg->index) == 0)
    {
        return;
    }

    if((gObj[lpMsg->index].LoginMessageSend--) == 0)
    {
        CloseClient(lpMsg->index);
        return;
    }

    if(gObj[lpMsg->index].Connected != OBJECT_CONNECTED)
    {
        GJDisconnectAccountSend(lpMsg->index,lpMsg->account,gObj[lpMsg->index].IpAddr);
        return;
    }

    GCRegisterAccountSend(lpMsg->index, lpMsg->result);
    return;
}
#endif

// Abajo de:

gJoinServerConnection.DataSend((BYTE*)&pMsg,pMsg.header.size);
}

// Agregar:

#if(OBBY)
void GJRegisterAccountSend(int aIndex,char* account,char* password,char* personalCode,char* Email)
{
    SDHP_REGISTER_ACCOUNT_SEND pMsg;

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

    pMsg.index = aIndex;

    memcpy(pMsg.account,account,sizeof(pMsg.account));
    memcpy(pMsg.password,password,sizeof(pMsg.password));
    memcpy(pMsg.personalCode,personalCode,sizeof(pMsg.personalCode));
    memcpy(pMsg.email,Email,sizeof(pMsg.email));

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

JSProtocol.h

// Abajo de:

char IpAddress[16];
};

// Agregar:

#if(OBBY)
struct SDHP_REGISTER_ACCOUNT_SEND
{
    PBMSG_HEAD header; // C1:01
    int index;
    char account[11];
    char password[11];
    char personalCode[11];
    char email[50];
};
#endif

// Abajo de:

void GJAccountLockSaveSend(int aIndex,int Lock);

// Agregar:

#if(OBBY)
void JGRegisterAccountRecv(SDHP_CONNECT_ACCOUNT_RECV* lpMsg);
void GJRegisterAccountSend(int aIndex,char* account,char* password,char* personalCode,char* IpAddress);
#endif

Protocol.cpp

// Abajo de:

case 0x02:
    CGCloseClientRecv((PMSG_CLOSE_CLIENT_RECV*)lpMsg,aIndex);
    romper;

// Agregar:
#if(OBBY)
case 0x12:
    CGRegisterAccountRecv((PMSG_REGISTER_ACCOUNT_RECV*)lpMsg,aIndex);
    return;
#endif

// Abajo de:

GJConnectAccountSend(aIndex, account, password, lpObj->IpAddr);
}

// Agregar:

#if(OBBY)
void CGRegisterAccountRecv(PMSG_REGISTER_ACCOUNT_RECV* lpMsg,int aIndex)
{
    LPOBJ lpObj = &gObj[aIndex];

    if(lpObj->Connected != OBJECT_CONNECTED)
    {
        CloseClient(aIndex);
        return;
    }

    if(memcmp(gServerInfo.m_ServerVersion,lpMsg->ClientVersion,sizeof(lpMsg->ClientVersion)) != 0)
    {
        GCConnectAccountSend(aIndex,6);
        return;
    }

    if(memcmp(gServerInfo.m_ServerSerial,lpMsg->ClientSerial,sizeof(lpMsg->ClientSerial)) != 0)
    {
        GCConnectAccountSend(aIndex,6);
        return;
    }

    if(lpObj->LoginMessageSend == 0)
    {
        lpObj->LoginMessageSend++;
        lpObj->LoginMessageCount++;
        lpObj->ConnectTickCount = GetTickCount();
        lpObj->ClientTickCount = lpMsg->TickCount;
        lpObj->ServerTickCount = GetTickCount();

        char account[11] = {0};
        PacketArgumentDecrypt(account,lpMsg->account,(sizeof(account)-1));

        char password[11] = {0};
        PacketArgumentDecrypt(password,lpMsg->password,(sizeof(password)-1));

        char personalCode[11] = {0};
        PacketArgumentDecrypt(personalCode,lpMsg->PersonalCode,(sizeof(personalCode)-1));

        char personalEmail[50] = {0};
        PacketArgumentDecrypt(personalEmail, lpMsg->szEmail, (sizeof(personalEmail)-1));

        lpObj->MapServerMoveRequest = 0;
        lpObj->LastServerCode = -1;
        lpObj->DestMap = -1;
        lpObj->DestX = 0;
        lpObj->DestY = 0;

        GJRegisterAccountSend(aIndex,account,password,personalCode,personalEmail);
    }
}
#endif

// Abajo de:

DataSend(aIndex,(BYTE*)&pMsg,pMsg.header.size);
}

// Agregar:

#if(OBBY)
void GCRegisterAccountSend(int aIndex,BYTE result) // OK
{
    PMSG_CONNECT_ACCOUNT_SEND pMsg;

    pMsg.header.set(0xF1,0x12,sizeof(pMsg));

    pMsg.result = result;

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

Protocol.h

// Abajo de:

BYTE ClientSerial[16];
#pragma pack()
#endif
};

// Agregar:

#if(OBBY)
struct PMSG_REGISTER_ACCOUNT_RECV
{
    #pragma pack(1)
    BYTE header;
    char account[11];
    char password[11];
    char personalCode[11];
    char email[50];
};
#endif
Bon Dia

🡱 🡳