mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-19 03:36:56 -06:00
Compare commits
22 Commits
copilot/si
...
MM12-Testi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05dc5d6fcd | ||
|
|
c24c756f73 | ||
|
|
bdb380aed2 | ||
|
|
2baef3f198 | ||
|
|
fbf7833b7b | ||
|
|
05c67fd712 | ||
|
|
9d4d618e63 | ||
|
|
6aa7c592a2 | ||
|
|
68187d9f96 | ||
|
|
716e8c646c | ||
|
|
d2cecd0073 | ||
|
|
d97f374a90 | ||
|
|
a6c6474e67 | ||
|
|
dbdf4ac46a | ||
|
|
6ed504c88e | ||
|
|
9be2ab03b6 | ||
|
|
e53e31021f | ||
|
|
41b8762c8f | ||
|
|
da07a70d4d | ||
|
|
d78b2958d3 | ||
|
|
9cfc126842 | ||
|
|
56e3d07669 |
@@ -42,7 +42,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
|||||||
Entity* entity = EntityManager::Instance()->GetEntity(objectID);
|
Entity* entity = EntityManager::Instance()->GetEntity(objectID);
|
||||||
|
|
||||||
User* usr = UserManager::Instance()->GetUser(sysAddr);
|
User* usr = UserManager::Instance()->GetUser(sysAddr);
|
||||||
|
Game::logger->Log("GameMessageHandler", "handling message %i", messageID);
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
Game::logger->Log("GameMessageHandler", "Failed to find associated entity (%llu), aborting GM (%X)!", objectID, messageID);
|
Game::logger->Log("GameMessageHandler", "Failed to find associated entity (%llu), aborting GM (%X)!", objectID, messageID);
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
#include "AMFDeserialize.h"
|
#include "AMFDeserialize.h"
|
||||||
#include "eBlueprintSaveResponseType.h"
|
#include "eBlueprintSaveResponseType.h"
|
||||||
#include "eAninmationFlags.h"
|
#include "eAninmationFlags.h"
|
||||||
|
#include "AMFFormat_BitStream.h"
|
||||||
|
|
||||||
void GameMessages::SendFireEventClientSide(const LWOOBJID& objectID, const SystemAddress& sysAddr, std::u16string args, const LWOOBJID& object, int64_t param1, int param2, const LWOOBJID& sender) {
|
void GameMessages::SendFireEventClientSide(const LWOOBJID& objectID, const SystemAddress& sysAddr, std::u16string args, const LWOOBJID& object, int64_t param1, int param2, const LWOOBJID& sender) {
|
||||||
CBITSTREAM;
|
CBITSTREAM;
|
||||||
@@ -2554,6 +2555,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
|||||||
|
|
||||||
//We runs this in async because the http library here is blocking, meaning it'll halt the thread.
|
//We runs this in async because the http library here is blocking, meaning it'll halt the thread.
|
||||||
//But we don't want the server to go unresponsive, because then the client would disconnect.
|
//But we don't want the server to go unresponsive, because then the client would disconnect.
|
||||||
|
Game::logger->Log("GameMessages", "launching async");
|
||||||
std::async(std::launch::async, [&]() {
|
std::async(std::launch::async, [&]() {
|
||||||
|
|
||||||
//We need to get a new ID for our model first:
|
//We need to get a new ID for our model first:
|
||||||
@@ -2573,7 +2575,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
|||||||
|
|
||||||
const auto zoneId = worldId.GetMapID();
|
const auto zoneId = worldId.GetMapID();
|
||||||
const auto cloneId = worldId.GetCloneID();
|
const auto cloneId = worldId.GetCloneID();
|
||||||
|
Game::logger->Log("GameMessages", "doing cdc lookup");
|
||||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||||
"SELECT id FROM PropertyTemplate WHERE mapID = ?;");
|
"SELECT id FROM PropertyTemplate WHERE mapID = ?;");
|
||||||
query.bind(1, (int)zoneId);
|
query.bind(1, (int)zoneId);
|
||||||
@@ -2585,7 +2587,8 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
|||||||
int templateId = result.getIntField(0);
|
int templateId = result.getIntField(0);
|
||||||
|
|
||||||
result.finalize();
|
result.finalize();
|
||||||
|
try {
|
||||||
|
Game::logger->Log("GameMessages", "preparing stmt for properties");
|
||||||
auto* propertyLookup = Database::CreatePreppedStmt("SELECT * FROM properties WHERE template_id = ? AND clone_id = ?;");
|
auto* propertyLookup = Database::CreatePreppedStmt("SELECT * FROM properties WHERE template_id = ? AND clone_id = ?;");
|
||||||
|
|
||||||
propertyLookup->setInt(1, templateId);
|
propertyLookup->setInt(1, templateId);
|
||||||
@@ -2600,7 +2603,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
|||||||
|
|
||||||
delete propertyEntry;
|
delete propertyEntry;
|
||||||
delete propertyLookup;
|
delete propertyLookup;
|
||||||
|
Game::logger->Log("GameMessages", "preparing ugc lookup");
|
||||||
//Insert into ugc:
|
//Insert into ugc:
|
||||||
auto ugcs = Database::CreatePreppedStmt("INSERT INTO `ugc`(`id`, `account_id`, `character_id`, `is_optimized`, `lxfml`, `bake_ao`, `filename`) VALUES (?,?,?,?,?,?,?)");
|
auto ugcs = Database::CreatePreppedStmt("INSERT INTO `ugc`(`id`, `account_id`, `character_id`, `is_optimized`, `lxfml`, `bake_ao`, `filename`) VALUES (?,?,?,?,?,?,?)");
|
||||||
ugcs->setUInt(1, blueprintIDSmall);
|
ugcs->setUInt(1, blueprintIDSmall);
|
||||||
@@ -2616,7 +2619,9 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
|||||||
ugcs->setBlob(5, &iss);
|
ugcs->setBlob(5, &iss);
|
||||||
ugcs->setBoolean(6, false);
|
ugcs->setBoolean(6, false);
|
||||||
ugcs->setString(7, "weedeater.lxfml");
|
ugcs->setString(7, "weedeater.lxfml");
|
||||||
|
Game::logger->Log("GameMessages", "prepared ugc lookup");
|
||||||
ugcs->execute();
|
ugcs->execute();
|
||||||
|
Game::logger->Log("GameMessages", "preparing properties_contents lookup");
|
||||||
delete ugcs;
|
delete ugcs;
|
||||||
|
|
||||||
//Insert into the db as a BBB model:
|
//Insert into the db as a BBB model:
|
||||||
@@ -2639,9 +2644,14 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
|||||||
stmt->setDouble(16, 0); // behavior 3. TODO implement this.
|
stmt->setDouble(16, 0); // behavior 3. TODO implement this.
|
||||||
stmt->setDouble(17, 0); // behavior 4. TODO implement this.
|
stmt->setDouble(17, 0); // behavior 4. TODO implement this.
|
||||||
stmt->setDouble(18, 0); // behavior 5. TODO implement this.
|
stmt->setDouble(18, 0); // behavior 5. TODO implement this.
|
||||||
|
Game::logger->Log("GameMessages", "Executing insertion");
|
||||||
stmt->execute();
|
stmt->execute();
|
||||||
delete stmt;
|
delete stmt;
|
||||||
|
} catch (sql::SQLException& e) {
|
||||||
|
Game::logger->Log("GameMessages", "error is %s", e.what());
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
Game::logger->Log("GameMessages", "caught error %s", e.what());
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
Commented out until UGC server would be updated to use a sd0 file instead of lxfml stream.
|
Commented out until UGC server would be updated to use a sd0 file instead of lxfml stream.
|
||||||
(or you uncomment the lxfml decomp stuff above)
|
(or you uncomment the lxfml decomp stuff above)
|
||||||
|
|||||||
@@ -413,21 +413,27 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
UserManager::Instance()->DeletePendingRemovals();
|
UserManager::Instance()->DeletePendingRemovals();
|
||||||
|
|
||||||
auto t1 = std::chrono::high_resolution_clock::now();
|
try {
|
||||||
for (uint32_t curPacket = 0; curPacket < maxPacketsToProcess && timeSpent < maxPacketProcessingTime; curPacket++) {
|
auto t1 = std::chrono::high_resolution_clock::now();
|
||||||
packet = Game::server->Receive();
|
for (uint32_t curPacket = 0; curPacket < maxPacketsToProcess && timeSpent < maxPacketProcessingTime; curPacket++) {
|
||||||
if (packet) {
|
packet = Game::server->Receive();
|
||||||
auto t1 = std::chrono::high_resolution_clock::now();
|
if (packet) {
|
||||||
HandlePacket(packet);
|
auto t1 = std::chrono::high_resolution_clock::now();
|
||||||
auto t2 = std::chrono::high_resolution_clock::now();
|
HandlePacket(packet);
|
||||||
|
auto t2 = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
timeSpent += std::chrono::duration_cast<std::chrono::duration<float>>(t2 - t1).count();
|
timeSpent += std::chrono::duration_cast<std::chrono::duration<float>>(t2 - t1).count();
|
||||||
Game::server->DeallocatePacket(packet);
|
Game::server->DeallocatePacket(packet);
|
||||||
packet = nullptr;
|
packet = nullptr;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (sql::SQLException& e) {
|
||||||
|
Game::logger->Log("WorldServer", "Caught an error (%s)", e.what());
|
||||||
|
std::raise(SIGTERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Metrics::EndMeasurement(MetricVariable::PacketHandling);
|
Metrics::EndMeasurement(MetricVariable::PacketHandling);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user