rodecomp/Source/Network/ClientKeepalive.cpp
ragnarok-clanker 9cbb5257ed Maintenance: Resubmission of 15183 over main 662db5ca. PacketId: switch to the official packet names (names.txt, 1689 entries). 194 e
Batch #15189 by ragnarok-clanker: no function's compiled code changes; checked with 58 compiled unit(s), including every includer of Source/Network/Packets/PacketId.h, Source/Network/Packets/ShortcutPacket.h.
2026-11-09 12:56:29 +00:00

35 lines
991 B
C++

#include "Client/Mode/CLoginMode.h"
#include "Client/Session.h"
#include "Network/Connection/Connection.h"
#include "Network/Packets/PacketLengths.h"
#include "Network/Packets/PacketId.h"
#include <timeapi.h>
namespace {
#pragma pack(push, 1)
struct KeepalivePacket {
/* 0000 */ std::int16_t id;
/* 0002 */ std::uint32_t accountId;
};
#pragma pack(pop)
static_assert(sizeof(KeepalivePacket) == 6);
}
// OFFSET: 0x00D8D960
// FUNCTION: fn_22268
void CLoginMode::SendKeepalive() {
if (this->cursorType != 7 && this->cursorType != 8 && this->cursorType != 11 && this->cursorType != 19) {
return;
}
if (timeGetTime() > this->nextKeepaliveTime) {
this->nextKeepaliveTime = timeGetTime() + 12000;
KeepalivePacket packet;
packet.id = ID_PING;
packet.accountId = g_session.m_aid;
CRagConnection& connection = GetRagConnection();
connection.Send(reinterpret_cast<const PacketLengths*>(&GetRagConnection())->FixedLength(packet.id), &packet);
}
}