mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-12-16 20:24:39 -06:00
Compare commits
22 Commits
v3.0.0
...
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);
|
||||
|
||||
User* usr = UserManager::Instance()->GetUser(sysAddr);
|
||||
|
||||
Game::logger->Log("GameMessageHandler", "handling message %i", messageID);
|
||||
if (!entity) {
|
||||
Game::logger->Log("GameMessageHandler", "Failed to find associated entity (%llu), aborting GM (%X)!", objectID, messageID);
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
#include "AMFDeserialize.h"
|
||||
#include "eBlueprintSaveResponseType.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) {
|
||||
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.
|
||||
//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, [&]() {
|
||||
|
||||
//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 cloneId = worldId.GetCloneID();
|
||||
|
||||
Game::logger->Log("GameMessages", "doing cdc lookup");
|
||||
auto query = CDClientDatabase::CreatePreppedStmt(
|
||||
"SELECT id FROM PropertyTemplate WHERE mapID = ?;");
|
||||
query.bind(1, (int)zoneId);
|
||||
@@ -2585,7 +2587,8 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
int templateId = result.getIntField(0);
|
||||
|
||||
result.finalize();
|
||||
|
||||
try {
|
||||
Game::logger->Log("GameMessages", "preparing stmt for properties");
|
||||
auto* propertyLookup = Database::CreatePreppedStmt("SELECT * FROM properties WHERE template_id = ? AND clone_id = ?;");
|
||||
|
||||
propertyLookup->setInt(1, templateId);
|
||||
@@ -2600,7 +2603,7 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
|
||||
delete propertyEntry;
|
||||
delete propertyLookup;
|
||||
|
||||
Game::logger->Log("GameMessages", "preparing ugc lookup");
|
||||
//Insert into ugc:
|
||||
auto ugcs = Database::CreatePreppedStmt("INSERT INTO `ugc`(`id`, `account_id`, `character_id`, `is_optimized`, `lxfml`, `bake_ao`, `filename`) VALUES (?,?,?,?,?,?,?)");
|
||||
ugcs->setUInt(1, blueprintIDSmall);
|
||||
@@ -2616,7 +2619,9 @@ void GameMessages::HandleBBBSaveRequest(RakNet::BitStream* inStream, Entity* ent
|
||||
ugcs->setBlob(5, &iss);
|
||||
ugcs->setBoolean(6, false);
|
||||
ugcs->setString(7, "weedeater.lxfml");
|
||||
Game::logger->Log("GameMessages", "prepared ugc lookup");
|
||||
ugcs->execute();
|
||||
Game::logger->Log("GameMessages", "preparing properties_contents lookup");
|
||||
delete ugcs;
|
||||
|
||||
//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(17, 0); // behavior 4. TODO implement this.
|
||||
stmt->setDouble(18, 0); // behavior 5. TODO implement this.
|
||||
Game::logger->Log("GameMessages", "Executing insertion");
|
||||
stmt->execute();
|
||||
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.
|
||||
(or you uncomment the lxfml decomp stuff above)
|
||||
|
||||
@@ -413,21 +413,27 @@ int main(int argc, char** argv) {
|
||||
|
||||
UserManager::Instance()->DeletePendingRemovals();
|
||||
|
||||
auto t1 = std::chrono::high_resolution_clock::now();
|
||||
for (uint32_t curPacket = 0; curPacket < maxPacketsToProcess && timeSpent < maxPacketProcessingTime; curPacket++) {
|
||||
packet = Game::server->Receive();
|
||||
if (packet) {
|
||||
auto t1 = std::chrono::high_resolution_clock::now();
|
||||
HandlePacket(packet);
|
||||
auto t2 = std::chrono::high_resolution_clock::now();
|
||||
try {
|
||||
auto t1 = std::chrono::high_resolution_clock::now();
|
||||
for (uint32_t curPacket = 0; curPacket < maxPacketsToProcess && timeSpent < maxPacketProcessingTime; curPacket++) {
|
||||
packet = Game::server->Receive();
|
||||
if (packet) {
|
||||
auto t1 = 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();
|
||||
Game::server->DeallocatePacket(packet);
|
||||
packet = nullptr;
|
||||
} else {
|
||||
break;
|
||||
timeSpent += std::chrono::duration_cast<std::chrono::duration<float>>(t2 - t1).count();
|
||||
Game::server->DeallocatePacket(packet);
|
||||
packet = nullptr;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (sql::SQLException& e) {
|
||||
Game::logger->Log("WorldServer", "Caught an error (%s)", e.what());
|
||||
std::raise(SIGTERM);
|
||||
}
|
||||
|
||||
|
||||
Metrics::EndMeasurement(MetricVariable::PacketHandling);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user