mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Working in game again
hooray
This commit is contained in:
@@ -93,8 +93,7 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std
|
||||
}
|
||||
|
||||
EntityManager::Instance()->SerializeEntity(self);
|
||||
auto leaderboardType = LeaderboardManager::GetLeaderboardType(scriptedActivityComponent->GetActivityID());
|
||||
// LeaderboardManager::Instance().SaveScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(), leaderboardType, 1, finish);
|
||||
LeaderboardManager::SaveScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(), static_cast<float>(finish));
|
||||
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ToggleLeaderBoard",
|
||||
scriptedActivityComponent->GetActivityID(), 0, sender->GetObjectID(),
|
||||
|
@@ -79,16 +79,14 @@ void ActivityManager::StopActivity(Entity* self, const LWOOBJID playerID, const
|
||||
}
|
||||
}
|
||||
|
||||
void ActivityManager::SaveScore(Entity* self, LWOOBJID playerID, uint32_t val1, uint32_t val2, uint32_t val3) {
|
||||
void ActivityManager::SaveScore(Entity* self, const LWOOBJID playerID, const float primaryScore, const float secondaryScore, const float tertiaryScore) const {
|
||||
auto* player = EntityManager::Instance()->GetEntity(playerID);
|
||||
if (!player) return;
|
||||
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
uint32_t gameID = sac != nullptr ? sac->GetActivityID() : self->GetLOT();
|
||||
// Save the new score to the leaderboard and show the leaderboard to the player
|
||||
auto leaderboardType = LeaderboardManager::GetLeaderboardType(gameID);
|
||||
Game::logger->Log("ActivityManager", "leaderboard type %i %i args %i %i %i", leaderboardType, gameID, val1, val2, val3);
|
||||
// LeaderboardManager::Instance().SaveScore(playerID, gameID, leaderboardType, 3, val1, val2, val3);
|
||||
LeaderboardManager::SaveScore(playerID, gameID, primaryScore, secondaryScore, tertiaryScore);
|
||||
|
||||
// Makes the leaderboard show up for the player
|
||||
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ToggleLeaderBoard", gameID, 0, playerID, "", player->GetSystemAddress());
|
||||
@@ -123,9 +121,7 @@ void ActivityManager::GetLeaderboardData(Entity* self, const LWOOBJID playerID,
|
||||
auto* sac = self->GetComponent<ScriptedActivityComponent>();
|
||||
uint32_t gameID = sac != nullptr ? sac->GetActivityID() : self->GetLOT();
|
||||
// Save the new score to the leaderboard and show the leaderboard to the player
|
||||
auto leaderboardType = LeaderboardManager::GetLeaderboardType(gameID);
|
||||
Game::logger->Log("ActivityManager", "gameID %i", gameID, activityID);
|
||||
// LeaderboardManager::Instance().SendLeaderboard(activityID, Leaderboard::InfoType::MyStanding, false, playerID, self->GetObjectID(), 0, numResults);
|
||||
LeaderboardManager::SendLeaderboard(activityID, Leaderboard::InfoType::MyStanding, false, playerID, self->GetObjectID(), 0, numResults);
|
||||
}
|
||||
|
||||
void ActivityManager::ActivityTimerStart(Entity* self, const std::string& timerName, const float_t updateInterval,
|
||||
|
@@ -18,7 +18,7 @@ public:
|
||||
static bool TakeActivityCost(const Entity* self, LWOOBJID playerID);
|
||||
static uint32_t GetActivityID(const Entity* self);
|
||||
void StopActivity(Entity* self, LWOOBJID playerID, uint32_t score, uint32_t value1 = 0, uint32_t value2 = 0, bool quit = false);
|
||||
void SaveScore(Entity* self, LWOOBJID playerID, uint32_t val1 = 0, uint32_t val2 = 0, uint32_t val3 = 0);
|
||||
void SaveScore(Entity* self, const LWOOBJID playerID, const float primaryScore, const float secondaryScore = 0.0f, const float tertiaryScore = 0.0f) const;
|
||||
virtual uint32_t CalculateActivityRating(Entity* self, LWOOBJID playerID);
|
||||
static void GetLeaderboardData(Entity* self, LWOOBJID playerID, uint32_t activityID, uint32_t numResults = 0);
|
||||
// void FreezePlayer(Entity *self, const LWOOBJID playerID, const bool state) const;
|
||||
|
@@ -42,7 +42,7 @@ void BaseFootRaceManager::OnFireEventServerSide(Entity* self, Entity* sender, st
|
||||
}
|
||||
|
||||
StopActivity(self, player->GetObjectID(), 0, param1);
|
||||
SaveScore(self, player->GetObjectID(), param1, param2, param3);
|
||||
SaveScore(self, player->GetObjectID(), static_cast<float>(param1), static_cast<float>(param2), static_cast<float>(param3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -150,7 +150,7 @@ void SGCannon::OnMessageBoxResponse(Entity* self, Entity* sender, int32_t button
|
||||
if (IsPlayerInActivity(self, player->GetObjectID())) return;
|
||||
self->SetNetworkVar<bool>(ClearVariable, true);
|
||||
StartGame(self);
|
||||
} else if (button == 0 && ((identifier == u"Shooting_Gallery_Retry" || identifier == u"RePlay"))){
|
||||
} else if (button == 0 && ((identifier == u"Shooting_Gallery_Retry" || identifier == u"RePlay"))) {
|
||||
RemovePlayer(player->GetObjectID());
|
||||
UpdatePlayer(self, player->GetObjectID(), true);
|
||||
} else if (button == 1 && identifier == u"Shooting_Gallery_Exit") {
|
||||
@@ -436,8 +436,8 @@ void SGCannon::RemovePlayer(LWOOBJID playerID) {
|
||||
}
|
||||
}
|
||||
|
||||
void SGCannon::OnRequestActivityExit(Entity* self, LWOOBJID player, bool canceled){
|
||||
if (canceled){
|
||||
void SGCannon::OnRequestActivityExit(Entity* self, LWOOBJID player, bool canceled) {
|
||||
if (canceled) {
|
||||
StopGame(self, canceled);
|
||||
RemovePlayer(player);
|
||||
}
|
||||
@@ -565,7 +565,8 @@ void SGCannon::StopGame(Entity* self, bool cancel) {
|
||||
LootGenerator::Instance().GiveActivityLoot(player, self, GetGameID(self), self->GetVar<uint32_t>(TotalScoreVariable));
|
||||
|
||||
StopActivity(self, player->GetObjectID(), self->GetVar<uint32_t>(TotalScoreVariable), self->GetVar<uint32_t>(MaxStreakVariable), percentage);
|
||||
SaveScore(self, player->GetObjectID(), self->GetVar<uint32_t>(TotalScoreVariable), percentage, self->GetVar<uint32_t>(MaxStreakVariable));
|
||||
SaveScore(self, player->GetObjectID(),
|
||||
static_cast<float>(self->GetVar<uint32_t>(TotalScoreVariable)), percentage, static_cast<float>(self->GetVar<uint32_t>(MaxStreakVariable)));
|
||||
self->SetNetworkVar<bool>(AudioFinalWaveDoneVariable, true);
|
||||
|
||||
// Give the player the model rewards they earned
|
||||
|
Reference in New Issue
Block a user