This commit is contained in:
David Markowitz 2023-05-09 22:00:13 -07:00
parent 7a067e7b48
commit 3448426caf
7 changed files with 20 additions and 15 deletions

View File

@ -31,7 +31,7 @@ Leaderboard::~Leaderboard() {
}
void Leaderboard::WriteLeaderboardRow(std::ostringstream& leaderboard, const uint32_t& index, LDFBaseData* data) {
leaderboard << "Result[0].Row[" << index << "]." << data->GetString() << '\n';
leaderboard << "\nResult[0].Row[" << index << "]." << data->GetString();
}
void Leaderboard::Serialize(RakNet::BitStream* bitStream) {
@ -40,10 +40,10 @@ void Leaderboard::Serialize(RakNet::BitStream* bitStream) {
std::ostringstream leaderboard;
Game::logger->Log("LeaderboardManager", "game is %i info type %i ", gameID, infoType);
leaderboard << "ADO.Result=7:1\n"; // Unused in 1.10.64, but is in captures
leaderboard << "Result.Count=1:1\n"; // number of results, always 1?
leaderboard << "Result[0].Index=0:RowNumber\n"; // "Primary key"
leaderboard << "Result[0].RowCount=1:" << entries.size() << '\n'; // number of rows
leaderboard << "ADO.Result=7:1"; // Unused in 1.10.64, but is in captures
leaderboard << "\nResult.Count=1:1"; // number of results, always 1?
if (!this->entries.empty()) leaderboard << "\nResult[0].Index=0:RowNumber"; // "Primary key"
leaderboard << "\nResult[0].RowCount=1:" << entries.size(); // number of rows
int32_t rowNumber = 0;
for (auto& entry : entries) {

View File

@ -44,7 +44,7 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
Entity* entity = EntityManager::Instance()->GetEntity(objectID);
User* usr = UserManager::Instance()->GetUser(sysAddr);
if (messageID != 888) Game::logger->Log("GameMessageHandler", "message %i", messageID);
if (!entity) {
Game::logger->Log("GameMessageHandler", "Failed to find associated entity (%llu), aborting GM (%X)!", objectID, messageID);

View File

@ -68,15 +68,12 @@ void NpcAgCourseStarter::OnMessageBoxResponse(Entity* self, Entity* sender, int3
}
}
void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3) {
void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
auto* scriptedActivityComponent = self->GetComponent<ScriptedActivityComponent>();
if (scriptedActivityComponent == nullptr)
return;
if (scriptedActivityComponent == nullptr) return;
auto* data = scriptedActivityComponent->GetActivityPlayerData(sender->GetObjectID());
if (data == nullptr)
return;
if (data == nullptr) return;
if (args == "course_cancel") {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"cancel_timer", 0, 0,
@ -96,7 +93,8 @@ void NpcAgCourseStarter::OnFireEventServerSide(Entity* self, Entity* sender, std
}
EntityManager::Instance()->SerializeEntity(self);
// LeaderboardManager::Instance().SaveFootRaceScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(), finish);
auto leaderboardType = LeaderboardManager::GetLeaderboardType(scriptedActivityComponent->GetActivityID());
LeaderboardManager::Instance().SaveScore(sender->GetObjectID(), scriptedActivityComponent->GetActivityID(), leaderboardType, 1, finish);
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"ToggleLeaderBoard",
scriptedActivityComponent->GetActivityID(), 0, sender->GetObjectID(),

View File

@ -120,7 +120,12 @@ uint32_t ActivityManager::GetActivityID(const Entity* self) {
}
void ActivityManager::GetLeaderboardData(Entity* self, const LWOOBJID playerID, const uint32_t activityID, uint32_t numResults) {
//LeaderboardManager::SendLeaderboard(activityID, Standings, false, self->GetObjectID(), 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, 0, numResults);
}
void ActivityManager::ActivityTimerStart(Entity* self, const std::string& timerName, const float_t updateInterval,

View File

@ -377,6 +377,7 @@ void BaseSurvivalServer::GameOver(Entity* self) {
}
StopActivity(self, playerID, score, time);
SaveScore(self, playerID, time, score);
}
state.waveNumber = 1;

View File

@ -378,6 +378,7 @@ void BaseWavesServer::GameOver(Entity* self, bool won) {
}
StopActivity(self, playerID, wave, time, score);
SaveScore(self, playerID, time, wave);
}
}

View File

@ -349,7 +349,7 @@ void SGCannon::StartGame(Entity* self) {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
GetLeaderboardData(self, player->GetObjectID(), GetActivityID(self));
GetLeaderboardData(self, player->GetObjectID(), GetActivityID(self), 1);
Game::logger->Log("SGCannon", "Sending ActivityStart");
GameMessages::SendActivityStart(self->GetObjectID(), player->GetSystemAddress());