WIP debugging

This commit is contained in:
Aaron Kimbre
2025-01-19 19:07:55 -06:00
parent b7c579fb84
commit b01b3cc38d
9 changed files with 52 additions and 30 deletions

View File

@@ -1,6 +1,7 @@
#include "BitStreamUtils.h"
#include "dServer.h"
#include "BitStream.h"
#include "PacketUtils.h"
void LUBitStream::WriteHeader(RakNet::BitStream& bitStream) const {
@@ -25,5 +26,7 @@ void LUBitStream::Send(const SystemAddress& sysAddr) const {
RakNet::BitStream bitStream;
this->WriteHeader(bitStream);
this->Serialize(bitStream);
LOG("%s", sysAddr.ToString(true));
PacketUtils::SavePacket("mailv2", reinterpret_cast<const char *>(bitStream.GetData()), bitStream.GetNumberOfBytesUsed());
Game::server->Send(bitStream, sysAddr, sysAddr == UNASSIGNED_SYSTEM_ADDRESS);
}

View File

@@ -3,6 +3,7 @@ set(DNET_SOURCES "AuthPackets.cpp"
"ChatPackets.cpp"
"ClientPackets.cpp"
"dServer.cpp"
"MailInfo.cpp"
"MasterPackets.cpp"
"PacketUtils.cpp"
"WorldPackets.cpp"

View File

@@ -3,22 +3,26 @@
#include "DluAssert.h"
void MailInfo::Serialize(RakNet::BitStream& bitStream) const {
LOG("Writing MailInfo");
LOG("ID: %llu", id);
bitStream.Write(id);
LOG("Subject: %s", subject.c_str());
const LUWString subject(this->subject, 50);
bitStream.Write(subject);
LOG("Body: %s", body.c_str());
const LUWString body(this->body, 400);
bitStream.Write(body);
LOG("Sender: %s", senderUsername.c_str());
const LUWString sender(this->senderUsername, 32);
bitStream.Write(sender);
bitStream.Write<uint32_t>(0); // packing
bitStream.Write<uint64_t>(0); // attachedCurrency
LOG("ItemID: %llu", itemID);
bitStream.Write(itemID);
LOT lot = itemLOT;
LOG("ItemLOT: %u", lot);
if (lot <= 0) bitStream.Write<LOT>(LOT_NULL);
else bitStream.Write(lot);
bitStream.Write<uint32_t>(0); // packing

View File

@@ -26,8 +26,8 @@ struct MailInfo {
LWOOBJID itemSubkey{};
};
void Serialize(RakNet::BitStream& bitStream) const {}
bool Deserialize(RakNet::BitStream& bitStream) { return true; }
void Serialize(RakNet::BitStream& bitStream) const;
bool Deserialize(RakNet::BitStream& bitStream);
};
#endif // __MAILINFO_H__