mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Merge remote-tracking branch 'refs/remotes/origin/main'
Conflicts: dGame/EntityManager.cpp dGame/Player.h dGame/dComponents/RenderComponent.cpp
This commit is contained in:
@@ -70,7 +70,7 @@ std::map<LWOMAPID, PerformanceProfile> PerformanceManager::m_Profiles = {
|
||||
|
||||
void PerformanceManager::SelectProfile(LWOMAPID mapID) {
|
||||
// Try to get it from zoneTable
|
||||
CDZoneTableTable* zoneTable = CDClientManager::Instance().GetTable<CDZoneTableTable>();
|
||||
CDZoneTableTable* zoneTable = CDClientManager::GetTable<CDZoneTableTable>();
|
||||
if (zoneTable) {
|
||||
const CDZoneTable* zone = zoneTable->Query(mapID);
|
||||
if (zone) {
|
||||
|
@@ -56,7 +56,6 @@
|
||||
#include "DestroyableComponent.h"
|
||||
#include "Game.h"
|
||||
#include "MasterPackets.h"
|
||||
#include "Player.h"
|
||||
#include "PropertyManagementComponent.h"
|
||||
#include "AssetManager.h"
|
||||
#include "LevelProgressionComponent.h"
|
||||
@@ -79,6 +78,7 @@
|
||||
#include "Server.h"
|
||||
#include "PositionUpdate.h"
|
||||
#include "PlayerManager.h"
|
||||
#include "eLoginResponse.h"
|
||||
|
||||
#include "ServerPreconditions.h"
|
||||
#include "Scene.h"
|
||||
@@ -86,7 +86,6 @@
|
||||
namespace Game {
|
||||
Logger* logger = nullptr;
|
||||
dServer* server = nullptr;
|
||||
dpWorld* physicsWorld = nullptr;
|
||||
dChatFilter* chatFilter = nullptr;
|
||||
dConfig* config = nullptr;
|
||||
AssetManager* assetManager = nullptr;
|
||||
@@ -184,7 +183,7 @@ int main(int argc, char** argv) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
CDClientManager::Instance().LoadValuesFromDatabase();
|
||||
CDClientManager::LoadValuesFromDatabase();
|
||||
|
||||
Diagnostics::SetProduceMemoryDump(Game::config->GetValue("generate_dump") == "1");
|
||||
|
||||
@@ -212,8 +211,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
UserManager::Instance()->Initialize();
|
||||
|
||||
bool dontGenerateDCF = false;
|
||||
GeneralUtils::TryParse(Game::config->GetValue("dont_generate_dcf"), dontGenerateDCF);
|
||||
const bool dontGenerateDCF = GeneralUtils::TryParse<bool>(Game::config->GetValue("dont_generate_dcf")).value_or(false);
|
||||
Game::chatFilter = new dChatFilter(Game::assetManager->GetResPath().string() + "/chatplus_en_us", dontGenerateDCF);
|
||||
|
||||
Game::server = new dServer(masterIP, ourPort, instanceID, maxClients, false, true, Game::logger, masterIP, masterPort, ServerType::World, Game::config, &Game::lastSignal, zoneID);
|
||||
@@ -259,7 +257,7 @@ int main(int argc, char** argv) {
|
||||
Game::zoneManager = new dZoneManager();
|
||||
//Load our level:
|
||||
if (zoneID != 0) {
|
||||
dpWorld::Instance().Initialize(zoneID);
|
||||
dpWorld::Initialize(zoneID);
|
||||
Game::zoneManager->Initialize(LWOZONEID(zoneID, instanceID, cloneID));
|
||||
g_CloneID = cloneID;
|
||||
|
||||
@@ -400,7 +398,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
if (zoneID != 0 && deltaTime > 0.0f) {
|
||||
Metrics::StartMeasurement(MetricVariable::Physics);
|
||||
dpWorld::Instance().StepWorld(deltaTime);
|
||||
dpWorld::StepWorld(deltaTime);
|
||||
Metrics::EndMeasurement(MetricVariable::Physics);
|
||||
|
||||
Metrics::StartMeasurement(MetricVariable::UpdateEntities);
|
||||
@@ -620,9 +618,10 @@ void HandlePacketChat(Packet* packet) {
|
||||
inStream.Read(expire);
|
||||
|
||||
auto* entity = Game::entityManager->GetEntity(playerId);
|
||||
|
||||
if (entity != nullptr) {
|
||||
entity->GetParentUser()->SetMuteExpire(expire);
|
||||
auto* character = entity != nullptr ? entity->GetCharacter() : nullptr;
|
||||
auto* user = character != nullptr ? character->GetParentUser() : nullptr;
|
||||
if (user) {
|
||||
user->SetMuteExpire(expire);
|
||||
|
||||
entity->GetCharacter()->SendMuteNotice();
|
||||
}
|
||||
@@ -880,10 +879,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1026,8 +1043,8 @@ void HandlePacket(Packet* packet) {
|
||||
|
||||
Game::entityManager->ConstructEntity(player, UNASSIGNED_SYSTEM_ADDRESS, true);
|
||||
|
||||
if (respawnPoint != NiPoint3::ZERO) {
|
||||
GameMessages::SendPlayerReachedRespawnCheckpoint(player, respawnPoint, NiQuaternion::IDENTITY);
|
||||
if (respawnPoint != NiPoint3Constant::ZERO) {
|
||||
GameMessages::SendPlayerReachedRespawnCheckpoint(player, respawnPoint, NiQuaternionConstant::IDENTITY);
|
||||
}
|
||||
|
||||
Game::entityManager->ConstructAllEntities(packet->systemAddress);
|
||||
@@ -1122,9 +1139,10 @@ void HandlePacket(Packet* packet) {
|
||||
//Mail::HandleNotificationRequest(packet->systemAddress, player->GetObjectID());
|
||||
|
||||
//Notify chat that a player has loaded:
|
||||
{
|
||||
const auto& playerName = player->GetCharacter()->GetName();
|
||||
//RakNet::RakString playerName(player->GetCharacter()->GetName().c_str());
|
||||
auto* character = player->GetCharacter();
|
||||
auto* user = character != nullptr ? character->GetParentUser() : nullptr;
|
||||
if (user) {
|
||||
const auto& playerName = character->GetName();
|
||||
|
||||
CBITSTREAM;
|
||||
BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatInternalMessageType::PLAYER_ADDED_NOTIFICATION);
|
||||
@@ -1138,7 +1156,7 @@ void HandlePacket(Packet* packet) {
|
||||
bitStream.Write(zone.GetMapID());
|
||||
bitStream.Write(zone.GetInstanceID());
|
||||
bitStream.Write(zone.GetCloneID());
|
||||
bitStream.Write(player->GetParentUser()->GetMuteExpire());
|
||||
bitStream.Write(user->GetMuteExpire());
|
||||
bitStream.Write(player->GetGMLevel());
|
||||
|
||||
Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false);
|
||||
@@ -1439,6 +1457,7 @@ void FinalizeShutdown() {
|
||||
|
||||
//Delete our objects here:
|
||||
Metrics::Clear();
|
||||
dpWorld::Shutdown();
|
||||
Database::Destroy("WorldServer");
|
||||
if (Game::chatFilter) delete Game::chatFilter;
|
||||
Game::chatFilter = nullptr;
|
||||
|
Reference in New Issue
Block a user