Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: Get Resets on Character Selection (1.04j)  (Visto 1057 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline plyn Posteado: February 01, 2025, 06:12:06 PM | Modificado: February 01, 2025, 06:16:19 PM by plyn

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 246
  • Gracias recibida: 767
  • br
Antes de tudo, não está completo, fiz de modo bem bruto pra ver se funciona !

Quem conseguir entender e souber o que está sendo feito de errado e otimizar o codigo deixando menor, compartilha com a gente :)

DATASERVER
DataServerProtocol.cpp
Code: [Select]
case 0x13:
switch(((lpMsg[0]==0xC1)?lpMsg[3]:lpMsg[4]))
{
case 0x31:
GSC((SC_INFO_D*)lpMsg, index);
break;
}

Code: [Select]
void GSC(SC_INFO_D* lpMsg, int index)
{
LogAdd(LOG_GREEN, "PACKET RECEBIDO GS -> DS [%s]", lpMsg->name);

SC_INFO_E pMsg;

pMsg.header.set(0x0F, 0x07, sizeof(pMsg));

if (gQueryManager->ExecQuery("SELECT * FROM Character WHERE Name='%s'", lpMsg->name) == 0 || gQueryManager->Fetch() == SQL_NO_DATA)
{
gQueryManager->Close();
}
else
{
pMsg.Reset = (WORD)gQueryManager->GetAsInteger("ResetCount");

pMsg.MReset = (BYTE)gQueryManager->GetAsInteger("MasterResetCount");

gQueryManager->Close();

}

LogAdd(LOG_GREEN, "PACKET ENVIADO %s - %d - %d", lpMsg->name, pMsg.Reset, pMsg.MReset);

gSocketManager->DataSend(index, (BYTE*)&pMsg, sizeof(pMsg));
}

DataServerProtocol.h
Code: [Select]
struct SC_INFO_D
{
PSBMSG_HEAD header;
char name[11];
};

struct SC_INFO_E
{
PSBMSG_HEAD header;
char name[11];
DWORD Reset;
DWORD MReset;
};

void GSC(SC_INFO_D* lpMsg, int index);

GAMESERVER
DSProtocol.cpp
Code: [Select]
case 0x0F:
switch(((lpMsg[0]==0xC1)?lpMsg[3]:lpMsg[4]))
{
case 0x07:
DSC((SC_INFO_F*)lpMsg,0);
break;
}

Protocol.cpp
Code: [Select]
				case 0xF2:
SC((SC_INFO_B*)lpMsg, aIndex);
break;

void SC(SC_INFO_B* lpMsg, int aIndex)
{

//LogAdd(LOG_GREEN, "PACKET RECEBIDO MAIN -> CLIENTE [Char: %s]", lpMsg->name); // ENVIAR PRO DATASERVER PARA RETORNAR

SC_INFO_C pMsg;

pMsg.header.set(0x13, 0x31, sizeof(pMsg));

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

gDataServerConnection.DataSend((BYTE*)&pMsg, sizeof(pMsg));
}

void DSC(SC_INFO_F* lpMsg, int aIndex)
{

LogAdd(LOG_GREEN, "PACKET RECEBIDO DS -> GS [Char: %s - Reset:%d - MReset - %d]", lpMsg->name, lpMsg->Reset, lpMsg->MReset); // ENVIAR PRO DATASERVER PARA RETORNAR

SC_INFO_G pMsg;
//
pMsg.header.set(0xF3, 0xF2, sizeof(pMsg));

pMsg.Reset = lpMsg->Reset;

pMsg.MReset = lpMsg->MReset;

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

Protoco.h
Code: [Select]
struct SC_INFO_B
{
PSBMSG_HEAD header;
char name[11];
};

struct SC_INFO_C
{
PSBMSG_HEAD header;
char name[11];
};

struct SC_INFO_F
{
PSBMSG_HEAD header;
char name[11];
DWORD Reset;
DWORD MReset;
};

struct SC_INFO_G
{
PSBMSG_HEAD header;
char name[11];
DWORD Reset;
DWORD MReset;
};

MAIN
Protocol.cpp
Code: [Select]
			case 0xF2:
GSC((PMSG_SC_H*)lpMsg);
return 0;

Protocol.h
Code: [Select]
struct PMSG_SC_A
{
PSBMSG_HEAD header;
DWORD Reset;
DWORD MasterReset;
};


struct PMSG_SC_H
{
PSBMSG_HEAD header;
DWORD Reset;
DWORD MasterReset;
};

struct SC_INFO_A {

PSBMSG_HEAD header;
char name[11];
};

struct SCData {
int SCViewReset;
int SCViewMReset;
};

void GSC(PMSG_SC_H* lpMsg);

void CSetInfo(float x, float Y, int Class) <-- Select PJ S13 1.04j

Code: [Select]


SC_INFO_A pMsg;

pMsg.header.set(0xF3, 0xF2, sizeof(pMsg));

memcpy(pMsg.name, (char*)m_szName, sizeof(pMsg.name));

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


gInterface.AddText(X + 10, Y + 47, "%d/500", 0, dados[Class].SCViewReset, 0, 4, size);
gInterface.AddText(X + 10, Y + 57, "%d", 0, dados[Class].SCViewMReset, 0, 4, size);



Creditos: eu pela tentativa haha

Hisashiburi dana, Mugiwara!

Gracias:


Offline Ryzenn #1 Posteado: February 01, 2025, 06:29:10 PM

  • Colaborador
  • +1 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 291
  • Gracias recibida: 4875
  • ar
Se tu mismo, lo demás lo vas aprendiendo por el camino.

Gracias:


Offline SPK #2 Posteado: February 03, 2025, 05:15:46 AM

  • 0 puntos por ventas
  • *
  • Rank: Avanzado
  • Posts: 141
  • Gracias recibida: 1381
  • vn
GoodJob, btw I'm using other method.

MainDLL -> Protocol.h add or Edit

Code: [Select]
struct PMSG_CHARACTER_LIST
{
BYTE slot;
char Name[10];
WORD Level;
BYTE CtlCode;
BYTE CharSet[18];
BYTE GuildStatus;
DWORD Reset; //Add
DWORD MasterReset; //Add
};

DrawString ur code CSCharacterS13.cpp

Code: [Select]
char IsResetCount[255];
ZeroMemory(IsResetCount, sizeof(IsResetCount));
wsprintf(IsResetCount, "Reset %d", GetStatus(it->second.Reset)));
SetTextColorByHDC(pTextThis(), pMakeColor(0xFFu, 0xFFu, 0xFFu, 0xFFu));
g_pRenderText.CRenderText(a - (ACoord_X + BitMapRenderX), b + (ACoord_Y + 21), IsResetCount, BitMapRenderW, 0, 3, 0);

GameServer->DSProtocol.cpp Find DGCharacterListRecv
Add below:
Code: [Select]
info.Level          = lpInfo->level;
info.Reset          = lpInfo->Reset;
info.MasterReset    = lpInfo->MasterReset;

Find struct PMSG_CHARACTER_LIST
add:

Code: [Select]
struct PMSG_CHARACTER_LIST
{
BYTE slot;
char Name[10];
WORD Level;
BYTE CtlCode;
BYTE CharSet[18];
BYTE GuildStatus;
DWORD Reset; // Add
DWORD MasterReset; //Add
};
DataServer Find -> void GDCharacterListRecv

Add:
Code: [Select]
memcpy(info.name,CharacterName[n],sizeof(info.name));
info.level = (WORD)gQueryManager.GetAsInteger("cLevel");
info.Class = (BYTE)gQueryManager.GetAsInteger("Class");
BYTE Inventory[12][16];
gQueryManager.GetAsBinary("Inventory",Inventory[0],sizeof(Inventory));
info.CtlCode = (BYTE)gQueryManager.GetAsInteger("CtlCode");
info.Reset = (DWORD)gQueryManager.GetAsInteger("ResetCount");
info.MasterReset = (DWORD)gQueryManager.GetAsInteger("MasterResetCount");
gQueryManager.Close();

Gracias:


Offline plyn #3 Posteado: February 03, 2025, 03:21:34 PM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 246
  • Gracias recibida: 767
  • br
GoodJob, btw I'm using other method.

MainDLL -> Protocol.h add or Edit

Code: [Select]
struct PMSG_CHARACTER_LIST
{
BYTE slot;
char Name[10];
WORD Level;
BYTE CtlCode;
BYTE CharSet[18];
BYTE GuildStatus;
DWORD Reset; //Add
DWORD MasterReset; //Add
};

DrawString ur code CSCharacterS13.cpp

Code: [Select]
char IsResetCount[255];
ZeroMemory(IsResetCount, sizeof(IsResetCount));
wsprintf(IsResetCount, "Reset %d", GetStatus(it->second.Reset)));
SetTextColorByHDC(pTextThis(), pMakeColor(0xFFu, 0xFFu, 0xFFu, 0xFFu));
g_pRenderText.CRenderText(a - (ACoord_X + BitMapRenderX), b + (ACoord_Y + 21), IsResetCount, BitMapRenderW, 0, 3, 0);

GameServer->DSProtocol.cpp Find DGCharacterListRecv
Add below:
Code: [Select]
info.Level          = lpInfo->level;
info.Reset          = lpInfo->Reset;
info.MasterReset    = lpInfo->MasterReset;

Find struct PMSG_CHARACTER_LIST
add:

Code: [Select]
struct PMSG_CHARACTER_LIST
{
BYTE slot;
char Name[10];
WORD Level;
BYTE CtlCode;
BYTE CharSet[18];
BYTE GuildStatus;
DWORD Reset; // Add
DWORD MasterReset; //Add
};
DataServer Find -> void GDCharacterListRecv

Add:
Code: [Select]
memcpy(info.name,CharacterName[n],sizeof(info.name));
info.level = (WORD)gQueryManager.GetAsInteger("cLevel");
info.Class = (BYTE)gQueryManager.GetAsInteger("Class");
BYTE Inventory[12][16];
gQueryManager.GetAsBinary("Inventory",Inventory[0],sizeof(Inventory));
info.CtlCode = (BYTE)gQueryManager.GetAsInteger("CtlCode");
info.Reset = (DWORD)gQueryManager.GetAsInteger("ResetCount");
info.MasterReset = (DWORD)gQueryManager.GetAsInteger("MasterResetCount");
gQueryManager.Close();

Muito bom, mano, obrigado pela ajuda :)

Hisashiburi dana, Mugiwara!

Offline SPK #4 Posteado: February 03, 2025, 10:11:17 PM

  • 0 puntos por ventas
  • *
  • Rank: Avanzado
  • Posts: 141
  • Gracias recibida: 1381
  • vn
Muito bom, mano, obrigado pela ajuda :)


Essa é a maneira mais rápida e fácil que já fiz. Basta adicionar às estruturas existentes para executar sem precisar passar por nenhum novo protocolo.


Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate


 

Related Topics

  Subject / Started by Replies Last post
3 Replies
2192 Views
Last post January 23, 2018, 01:41:02 PM
by Peluuca
3 Replies
9597 Views
Last post May 22, 2020, 02:40:30 AM
by gtpro
33 Replies
7949 Views
Last post April 27, 2020, 02:44:15 PM
by Deidad
2 Replies
897 Views
Last post April 21, 2020, 09:22:05 PM
by Broda
16 Replies
3029 Views
Last post December 26, 2024, 10:57:31 AM
by kosama11