M2 Download Center
Download Here ( Internal )
Hi everyone,
Maybe just in my country, but it looks so many people started using this annoying PM flooder which cause a buffer overflow in the target client. It can be fixed easily on server-side, so let's do it:
Add these functions as public to char.h:
void ClearPMCounter(void) { m_iPMCounter = 0; }
void IncreasePMCounter(void) { m_iPMCounter++; }
void SetLastPMPulse(void);
int GetPMCounter(void) const { return m_iPMCounter; }
int GetLastPMPulse(void) const { return m_iLastPMPulse; }
Add these to char.h too, but as protected:
int m_iLastPMPulse;
int m_iPMCounter;
Add this function to char.cpp:
void CHARACTER::SetLastPMPulse(void)
{
m_iLastPMPulse = thecore_pulse() + 25;
}
Still in char.cpp search for the Initialize and add these to the function:
m_iLastPMPulse = 0;
m_iPMCounter = 0;
Now navigate to the Whisper function in input_main.cpp and add this after the iExtraLen variable checking at the top:
if (ch->GetLastPMPulse() < thecore_pulse())
ch->ClearPMCounter();
if (ch->GetPMCounter() > 3 && ch->GetLastPMPulse() > thecore_pulse())
{
ch->GetDesc()->SetPhase(PHASE_CLOSE);
return -1;
}
Search for this still in the Whisper function:
if (pkChr == ch)
return (iExtraLen);
Add these after that:
ch->IncreasePMCounter();
ch->SetLastPMPulse();