feat: convert character ids to 64 bits (#1878)

* feat: convert character ids to 64 bits

remove all usages of the PERSISTENT bit with regards to storing of playerIDs on the server.  the bit does not exist and was a phantom in the first place.
Tested that a full playthrough of ag, ns and gf was still doable.  slash commands work, ugc works, friends works, ignore list works, properties work and have names, teaming works.
migrating an old mysql database works . need to test an old sqlite database

* fix sqlite migration

* remove nd specific column migration
This commit is contained in:
David Markowitz
2025-09-18 23:12:23 -07:00
committed by GitHub
parent 68f2e2dee2
commit 6389876c6e
56 changed files with 327 additions and 270 deletions

View File

@@ -861,7 +861,7 @@ void HandlePacket(Packet* packet) {
}
if (luBitStream.connectionType != ServiceType::WORLD) return;
LOG_DEBUG("Got world packet %s", StringifiedEnum::ToString(static_cast<MessageType::World>(luBitStream.internalPacketID)).data());
switch (static_cast<MessageType::World>(luBitStream.internalPacketID)) {
case MessageType::World::VALIDATION: {
CINSTREAM_SKIP_HEADER;
@@ -983,7 +983,7 @@ void HandlePacket(Packet* packet) {
LWOOBJID playerID = 0;
inStream.Read(playerID);
LOG("User is requesting to login with character %llu", playerID);
bool valid = CheatDetection::VerifyLwoobjidIsSender(
playerID,
packet->systemAddress,
@@ -991,18 +991,15 @@ void HandlePacket(Packet* packet) {
"Sending login request with a sending player that does not match their own. Player ID: %llu",
playerID
);
LOG("Login request for player %llu is %s", playerID, valid ? "valid" : "invalid");
if (!valid) return;
GeneralUtils::ClearBit(playerID, eObjectBits::CHARACTER);
GeneralUtils::ClearBit(playerID, eObjectBits::PERSISTENT);
auto user = UserManager::Instance()->GetUser(packet->systemAddress);
if (user) {
auto lastCharacter = user->GetLoggedInChar();
// This means we swapped characters and we need to remove the previous player from the container.
if (static_cast<uint32_t>(lastCharacter) != playerID) {
if (lastCharacter != playerID) {
CBITSTREAM;
BitStreamUtils::WriteHeader(bitStream, ServiceType::CHAT, MessageType::Chat::UNEXPECTED_DISCONNECT);
bitStream.Write(lastCharacter);
@@ -1010,7 +1007,7 @@ void HandlePacket(Packet* packet) {
}
}
UserManager::Instance()->LoginCharacter(packet->systemAddress, static_cast<uint32_t>(playerID));
UserManager::Instance()->LoginCharacter(packet->systemAddress, playerID);
break;
}