From fdd3e15b2f51e4ebfaf28c7201f0e12686c830f7 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Tue, 29 Mar 2022 19:52:07 -0700 Subject: [PATCH] Added GM for reputation update --- dGame/dGameMessages/GameMessageHandler.cpp | 4 +++- dGame/dGameMessages/GameMessages.cpp | 25 ++++++++++++++++++++++ dGame/dGameMessages/GameMessages.h | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/dGame/dGameMessages/GameMessageHandler.cpp b/dGame/dGameMessages/GameMessageHandler.cpp index 83187e2f..45760cc9 100644 --- a/dGame/dGameMessages/GameMessageHandler.cpp +++ b/dGame/dGameMessages/GameMessageHandler.cpp @@ -595,7 +595,9 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System case GAME_MSG_VEHICLE_NOTIFY_HIT_IMAGINATION_SERVER: GameMessages::HandleVehicleNotifyHitImaginationServer(inStream, entity, sysAddr); break; - + case GAME_MSG_UPDATE_PROPERTY_PERFORMANCE_COST: + GameMessages::HandleUpdatePropertyPerformanceCost(inStream, entity, sysAddr); + break; // SG case GAME_MSG_UPDATE_SHOOTING_GALLERY_ROTATION: GameMessages::HandleUpdateShootingGalleryRotation(inStream, entity, sysAddr); diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 53699f4e..6d70e105 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -4137,6 +4137,31 @@ void GameMessages::HandleRacingPlayerInfoResetFinished(RakNet::BitStream* inStre } } +void GameMessages::HandleUpdatePropertyPerformanceCost(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { + float performanceCost = 0.0f; + + if (inStream->ReadBit()) inStream->Read(performanceCost); + + Game::logger->Log("GameMessages", "new value is %f\n", performanceCost); + + if (performanceCost == 0.0f) return; + + auto zone = dZoneManager::Instance()->GetZone(); + const auto& worldId = zone->GetZoneID(); + const auto cloneId = worldId.GetCloneID(); + const auto zoneId = worldId.GetMapID(); + + auto updatePerformanceCostQuery = Database::CreatePreppedStmt("UPDATE properties SET performance_cost = ? WHERE clone_id = ? AND zone_id = ?"); + + updatePerformanceCostQuery->setDouble(1, performanceCost); + updatePerformanceCostQuery->setInt(2, cloneId); + updatePerformanceCostQuery->setInt(3, zoneId); + + updatePerformanceCostQuery->execute(); + + delete updatePerformanceCostQuery; + updatePerformanceCostQuery = nullptr; +} void GameMessages::HandleVehicleNotifyHitImaginationServer(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { diff --git a/dGame/dGameMessages/GameMessages.h b/dGame/dGameMessages/GameMessages.h index 671c3b3a..b2d9a6c9 100644 --- a/dGame/dGameMessages/GameMessages.h +++ b/dGame/dGameMessages/GameMessages.h @@ -386,6 +386,8 @@ namespace GameMessages { bool bUseLeaderboards ); + void HandleUpdatePropertyPerformanceCost(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr); + void SendNotifyClientShootingGalleryScore(LWOOBJID objectId, const SystemAddress& sysAddr, float addTime, int32_t score,