diff --git a/dDatabase/GameDatabase/ITables/IPlayKeys.h b/dDatabase/GameDatabase/ITables/IPlayKeys.h index 841029b25..0a1db3894 100644 --- a/dDatabase/GameDatabase/ITables/IPlayKeys.h +++ b/dDatabase/GameDatabase/ITables/IPlayKeys.h @@ -9,7 +9,7 @@ class IPlayKeys { // Get the playkey id for the given playkey. // Optional of bool may seem pointless, however the optional indicates if the playkey exists // and the bool indicates if the playkey is active. - virtual std::optional IsPlaykeyActive(const uint32_t playkeyId) = 0; + virtual std::optional IsPlaykeyActive(const int32_t playkeyId) = 0; }; #endif //!__IPLAYKEYS__H__ diff --git a/dDatabase/GameDatabase/MySQL/MySQLDatabase.h b/dDatabase/GameDatabase/MySQL/MySQLDatabase.h index 930ac1c07..bed79bb78 100644 --- a/dDatabase/GameDatabase/MySQL/MySQLDatabase.h +++ b/dDatabase/GameDatabase/MySQL/MySQLDatabase.h @@ -101,7 +101,7 @@ class MySQLDatabase : public GameDatabase { void InsertDefaultPersistentId() override; void UpdatePersistentId(const uint32_t id) override; std::optional GetDonationTotal(const uint32_t activityId) override; - std::optional IsPlaykeyActive(const uint32_t playkeyId) override; + std::optional IsPlaykeyActive(const int32_t playkeyId) override; std::vector GetUgcModels(const LWOOBJID& propertyId) override; private: diff --git a/dDatabase/GameDatabase/MySQL/Tables/PlayKeys.cpp b/dDatabase/GameDatabase/MySQL/Tables/PlayKeys.cpp index 5a4f3d9ac..63f2822a1 100644 --- a/dDatabase/GameDatabase/MySQL/Tables/PlayKeys.cpp +++ b/dDatabase/GameDatabase/MySQL/Tables/PlayKeys.cpp @@ -1,6 +1,6 @@ #include "MySQLDatabase.h" -std::optional MySQLDatabase::IsPlaykeyActive(const uint32_t playkeyId) { +std::optional MySQLDatabase::IsPlaykeyActive(const int32_t playkeyId) { auto keyCheckRes = ExecuteSelect("SELECT active FROM `play_keys` WHERE id=?", playkeyId); if (!keyCheckRes->next()) { diff --git a/dNet/AuthPackets.cpp b/dNet/AuthPackets.cpp index 6bd080572..12f140d6d 100644 --- a/dNet/AuthPackets.cpp +++ b/dNet/AuthPackets.cpp @@ -80,9 +80,10 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) { return; } - if (Game::config->GetValue("dont_use_keys") != "1") { + if (Game::config->GetValue("dont_use_keys") != "1" && accountInfo->maxGmLevel == eGameMasterLevel::CIVILIAN) { + LOG(""); //Check to see if we have a play key: - if (accountInfo->playKeyId == 0 && accountInfo->maxGmLevel == eGameMasterLevel::CIVILIAN) { + if (accountInfo->playKeyId == 0) { AuthPackets::SendLoginResponse(server, packet->systemAddress, eLoginResponse::PERMISSIONS_NOT_HIGH_ENOUGH, "Your account doesn't have a play key associated with it!", "", 2001, username); LOG("User %s tried to log in, but they don't have a play key.", username.c_str()); return; @@ -91,12 +92,12 @@ void AuthPackets::HandleLoginRequest(dServer* server, Packet* packet) { //Check if the play key is _valid_: auto playKeyStatus = Database::Get()->IsPlaykeyActive(accountInfo->playKeyId); - if (!playKeyStatus || accountInfo->maxGmLevel == eGameMasterLevel::CIVILIAN) { - AuthPackets::SendLoginResponse(server, packet->systemAddress, eLoginResponse::PERMISSIONS_NOT_HIGH_ENOUGH, "Your account doesn't have a play key associated with it!", "", 2001, username); + if (!playKeyStatus) { + AuthPackets::SendLoginResponse(server, packet->systemAddress, eLoginResponse::PERMISSIONS_NOT_HIGH_ENOUGH, "Your account doesn't have a valid play key associated with it!", "", 2001, username); return; } - if (!playKeyStatus.value() && accountInfo->maxGmLevel == eGameMasterLevel::CIVILIAN) { + if (!playKeyStatus.value()) { AuthPackets::SendLoginResponse(server, packet->systemAddress, eLoginResponse::PERMISSIONS_NOT_HIGH_ENOUGH, "Your play key has been disabled.", "", 2001, username); LOG("User %s tried to log in, but their play key was disabled", username.c_str()); return;