mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-21 12:12:48 +00:00
feat(stats): zone statistics for quickbuilds and achievements reach the client
Live sent the player ModifyPlayerZoneStatistic(set false, value 1, the current map) for "QuickBuildsCompleted" (227) after a quickbuild's EnableRebuild and for "AchievementsCompleted" (186) at the end of an achievement's completion. DLU counted both server side (they are saved and shown at the next load) but never told the client, so the zone summary only caught up after a zone change. The client counts enemies, coins and bricks itself and sends those to the server. Check: complete a quickbuild and an achievement, then open the zone summary (passport / map zone stats) without changing zones: both counts went up by one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "HavokVehiclePhysicsComponent.h"
|
||||
#include "GameMessages.h"
|
||||
#include "EffectsMessages.h"
|
||||
#include "PlayerMessages.h"
|
||||
#include "Item.h"
|
||||
#include "Amf3.h"
|
||||
#include "eGameMasterLevel.h"
|
||||
@@ -550,6 +551,16 @@ void CharacterComponent::TrackMissionCompletion(bool isAchievement) {
|
||||
}
|
||||
}
|
||||
|
||||
void CharacterComponent::SendZoneStatisticIncrement(const std::u16string& statName) const {
|
||||
GameMessages::ModifyPlayerZoneStatistic statistic;
|
||||
statistic.target = m_Parent->GetObjectID();
|
||||
statistic.bSet = false;
|
||||
statistic.statName = statName;
|
||||
statistic.statValue = 1;
|
||||
statistic.zoneID = Game::zoneManager->GetZoneID().GetMapID();
|
||||
statistic.SendToClient(m_Parent->GetSystemAddress());
|
||||
}
|
||||
|
||||
void CharacterComponent::TrackLOTCollection(LOT lot) {
|
||||
const auto statistic = GetPowerUpStatistic(lot);
|
||||
if (statistic) UpdatePlayerStatistic(statistic.value());
|
||||
|
||||
@@ -194,6 +194,13 @@ public:
|
||||
*/
|
||||
void TrackMissionCompletion(bool isAchievement);
|
||||
|
||||
/**
|
||||
* Tells this player's client one more of a zone statistic in the current zone, as live did for
|
||||
* "QuickBuildsCompleted" and "AchievementsCompleted" (ModifyPlayerZoneStatistic: not set, value 1, this map).
|
||||
* The client counts enemies, coins and bricks itself.
|
||||
*/
|
||||
void SendZoneStatisticIncrement(const std::u16string& statName) const;
|
||||
|
||||
/**
|
||||
* Handles statistics related to collecting heart flags and imagination bricks
|
||||
* @param lot the lot of the object that was collected
|
||||
|
||||
@@ -477,6 +477,7 @@ void QuickBuildComponent::CompleteQuickBuild(Entity* const user) {
|
||||
enableRebuild.fDuration = 0.0f;
|
||||
enableRebuild.user = user->GetObjectID();
|
||||
enableRebuild.Send(UNASSIGNED_SYSTEM_ADDRESS);
|
||||
characterComponent->SendZoneStatisticIncrement(u"QuickBuildsCompleted");
|
||||
GameMessages::TerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, m_Parent->GetObjectID()).Send(UNASSIGNED_SYSTEM_ADDRESS);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user