mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-08 17:28:20 +00:00
Add announcement for mismatched fdb (#1424)
adds an announcement sent to the system address which had the mismatched FDB to let the developer know they have a mis-matched one. Tested that if a civilian tries to login without a gm level > developer, they are kicked. Tested that if a GM is found to have a mismatched FDB, they are let in but have an announcement sent to them. Use auth packets for msg added comment as to why ff remove default add comment Remove broadcast
This commit is contained in:
parent
99b3705a76
commit
6bf084ef8f
@ -625,6 +625,25 @@ void GameMessages::SendUIMessageServerToSingleClient(Entity* entity, const Syste
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendUIMessageServerToSingleClient(const std::string& message, AMFBaseValue& args, const SystemAddress& sysAddr) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
||||
LWOOBJID empty = 0;
|
||||
bitStream.Write(empty);
|
||||
bitStream.Write(eGameMessageType::UI_MESSAGE_SERVER_TO_ALL_CLIENTS); // This is intentional to allow the server to send a ui message to a client via their system address.
|
||||
|
||||
bitStream.Write<AMFBaseValue&>(args);
|
||||
uint32_t strMessageNameLength = message.size();
|
||||
bitStream.Write(strMessageNameLength);
|
||||
|
||||
for (uint32_t k = 0; k < strMessageNameLength; k++) {
|
||||
bitStream.Write<char>(message[k]);
|
||||
}
|
||||
|
||||
SEND_PACKET;
|
||||
}
|
||||
|
||||
void GameMessages::SendUIMessageServerToAllClients(const std::string& message, AMFBaseValue& args) {
|
||||
CBITSTREAM;
|
||||
CMSGHEADER;
|
||||
|
@ -92,6 +92,9 @@ namespace GameMessages {
|
||||
|
||||
void SendModifyLEGOScore(Entity* entity, const SystemAddress& sysAddr, int64_t score, eLootSourceType sourceType);
|
||||
void SendUIMessageServerToSingleClient(Entity* entity, const SystemAddress& sysAddr, const std::string& message, AMFBaseValue& args);
|
||||
|
||||
// Specify sysAddr if you need to send a flash message to a client who you dont know the objectID of.
|
||||
void SendUIMessageServerToSingleClient(const std::string& message, AMFBaseValue& args, const SystemAddress& sysAddr);
|
||||
void SendUIMessageServerToAllClients(const std::string& message, AMFBaseValue& args);
|
||||
|
||||
void SendPlayEmbeddedEffectOnAllClientsNearObject(Entity* entity, std::u16string effectName, const LWOOBJID& fromObjectID, float radius);
|
||||
|
@ -79,6 +79,7 @@
|
||||
#include "Server.h"
|
||||
#include "PositionUpdate.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "eLoginResponse.h"
|
||||
|
||||
namespace Game {
|
||||
Logger* logger = nullptr;
|
||||
@ -867,10 +868,28 @@ void HandlePacket(Packet* packet) {
|
||||
}
|
||||
|
||||
// Developers may skip this check
|
||||
if (accountInfo->maxGmLevel < eGameMasterLevel::DEVELOPER && clientDatabaseChecksum.string != databaseChecksum) {
|
||||
LOG("Client's database checksum does not match the server's, aborting connection.");
|
||||
Game::server->Disconnect(packet->systemAddress, eServerDisconnectIdentifiers::WRONG_GAME_VERSION);
|
||||
return;
|
||||
if (clientDatabaseChecksum.string != databaseChecksum) {
|
||||
|
||||
if (accountInfo->maxGmLevel < eGameMasterLevel::DEVELOPER) {
|
||||
LOG("Client's database checksum does not match the server's, aborting connection.");
|
||||
std::vector<Stamp> stamps;
|
||||
|
||||
// Using the LoginResponse here since the UI is still in the login screen state
|
||||
// and we have a way to send a message about the client mismatch.
|
||||
AuthPackets::SendLoginResponse(
|
||||
Game::server, packet->systemAddress, eLoginResponse::PERMISSIONS_NOT_HIGH_ENOUGH,
|
||||
Game::config->GetValue("cdclient_mismatch_message"), "", 0, "", stamps);
|
||||
return;
|
||||
} else {
|
||||
AMFArrayValue args;
|
||||
|
||||
args.Insert("title", Game::config->GetValue("cdclient_mismatch_title"));
|
||||
args.Insert("message", Game::config->GetValue("cdclient_mismatch_message"));
|
||||
|
||||
GameMessages::SendUIMessageServerToSingleClient("ToggleAnnounce", args, packet->systemAddress);
|
||||
LOG("Account (%s) with GmLevel (%s) does not have a matching FDB, but is a developer and will skip this check."
|
||||
, username.GetAsString().c_str(), StringifiedEnum::ToString(accountInfo->maxGmLevel).data());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,3 +73,7 @@ help_4_description=Visit Discussions on the DarkflameServer GitHub page<br/>to a
|
||||
|
||||
# Toggleable quality of life feature to allow users to skip most cinematics.
|
||||
allow_players_to_skip_cinematics=0
|
||||
|
||||
# Customizable message for what to say when there is a cdclient fdb mismatch
|
||||
cdclient_mismatch_title=Version out of date
|
||||
cdclient_mismatch_message=We detected that your client is out of date. Please update your client to the latest version.
|
||||
|
Loading…
Reference in New Issue
Block a user