fix: Refresh Mark & Mark window lag spike

Added Server-Side mark broadcast
This commit is contained in:
rtw1x1
2026-01-21 08:34:32 +00:00
parent 9299cea61c
commit 2e2becf1a3
8 changed files with 92 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
#include "StdAfx.h"
#include "PythonNetworkStream.h"
#include "Packet.h"
#include "GuildMarkDownloader.h"
#include "PythonGuild.h"
#include "PythonCharacterManager.h"
@@ -440,6 +441,10 @@ void CPythonNetworkStream::GamePhase()
ret = RecvGuild();
break;
case HEADER_GC_MARK_UPDATE:
ret = RecvMarkUpdate();
break;
case HEADER_GC_PARTY_INVITE:
ret = RecvPartyInvite();
break;
@@ -3930,6 +3935,30 @@ bool CPythonNetworkStream::RecvGuild()
return true;
}
static DWORD gs_dwMarkUpdateRequestTime = 0;
bool CPythonNetworkStream::RecvMarkUpdate()
{
TPacketGCMarkUpdate packet;
if (!Recv(sizeof(packet), &packet))
return false;
Tracef(" >> RecvMarkUpdate: guildID=%u, imgIdx=%u\n", packet.guildID, packet.imgIdx);
// Rate limit mark downloads to prevent connection spam from multiple simultaneous guild uploads
// Allow at most one download request per 5 seconds from server-pushed updates
DWORD dwCurrentTime = ELTimer_GetMSec();
if (dwCurrentTime < gs_dwMarkUpdateRequestTime)
return true;
gs_dwMarkUpdateRequestTime = dwCurrentTime + 5000; // 5 second cooldown
CGuildMarkDownloader& rkGuildMarkDownloader = CGuildMarkDownloader::Instance();
rkGuildMarkDownloader.Connect(m_kMarkAuth.m_kNetAddr, m_kMarkAuth.m_dwHandle, m_kMarkAuth.m_dwRandomKey);
return true;
}
// Guild
//////////////////////////////////////////////////////////////////////////