Fix SEQUENCE mismatch error in packet validation

This commit is contained in:
savis
2025-12-28 16:44:26 +01:00
parent c34a721328
commit 0735353405
2 changed files with 7 additions and 1 deletions

View File

@@ -77,6 +77,8 @@ void DESC::Initialize()
m_bChannelStatusRequested = false;
m_SequenceGenerator.seed(SEQUENCE_SEED);
// Pre-generate the first expected sequence to match what client will send
m_bNextExpectedSequence = m_SequenceGenerator(UINT8_MAX + 1);
m_pkLoginKey = NULL;
m_dwLoginKey = 0;
@@ -911,7 +913,10 @@ bool DESC::IsAdminMode()
BYTE DESC::GetSequence()
{
return m_SequenceGenerator(UINT8_MAX + 1);
// Return the next expected sequence and then generate the one after that
BYTE bCurrentExpected = m_bNextExpectedSequence;
m_bNextExpectedSequence = m_SequenceGenerator(UINT8_MAX + 1);
return bCurrentExpected;
}
void DESC::SendLoginSuccessPacket()

View File

@@ -226,6 +226,7 @@ class DESC
bool m_bPong;
pcg32 m_SequenceGenerator;
BYTE m_bNextExpectedSequence; // Next expected sequence number from client
CLoginKey * m_pkLoginKey;
DWORD m_dwLoginKey;