Skip to content

Commit

Permalink
Don't show trial reward
Browse files Browse the repository at this point in the history
  • Loading branch information
MunWolf committed Nov 30, 2023
1 parent 7849c0a commit 872971f
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions projects/Core/api/game/trials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Modloader/app/methods/Moon/Race/LeaderBoardService.h>
#include <Modloader/app/methods/Moon/Race/Networking/WebService.h>
#include <Modloader/app/methods/OutputFolder.h>
#include <Modloader/app/methods/RaceFinishIcon.h>
#include <Modloader/app/methods/System/IO/Directory.h>
#include <Modloader/app/methods/System/IO/Path.h>
#include <Modloader/interception_macros.h>
Expand All @@ -19,7 +20,7 @@ namespace core::api::game::trials {
std::string get_ghosts_directory_suffix() {
std::string suffix;

for (const auto& item : ghosts_directory_suffixes) {
for (const auto& item: ghosts_directory_suffixes) {
if (!suffix.empty()) {
suffix += "_";
}
Expand Down Expand Up @@ -50,11 +51,21 @@ namespace core::api::game::trials {
return System::IO::Path::Combine_1(ghosts_path, race_id);
}

IL2CPP_INTERCEPT(Moon::Race::LeaderBoardService, void, UploadReplay_1, (app::LeaderBoardService * this_ptr, app::String* race_id, float duration, app::String* replay_data, app::ITrialData* trial_data)) {
IL2CPP_INTERCEPT(
Moon::Race::LeaderBoardService,
void,
UploadReplay_1,
(app::LeaderBoardService * this_ptr, app::String* race_id, float duration, app::String* replay_data, app::ITrialData* trial_data)
) {
// NOOP
}

IL2CPP_INTERCEPT(Moon::Race::LeaderBoardService, bool, UploadReplay_2, (app::LeaderBoardService * this_ptr, app::String* race_id, float duration, app::String* replay_data, app::ReplayValidatorData* data)) {
IL2CPP_INTERCEPT(
Moon::Race::LeaderBoardService,
bool,
UploadReplay_2,
(app::LeaderBoardService * this_ptr, app::String* race_id, float duration, app::String* replay_data, app::ReplayValidatorData* data)
) {
return false; // NOOP
}

Expand All @@ -69,9 +80,14 @@ namespace core::api::game::trials {
IL2CPP_INTERCEPT(GhostManager, app::String*, GetOfflineRaceDirectory, (app::String * race_id)) {
return get_suffixed_ghost_directory("offlineGhosts", race_id);
}

IL2CPP_INTERCEPT(RaceFinishIcon, void, SetRaceData, (app::RaceFinishIcon * this_ptr, float elapsed_time, bool show_trial_reward)) {
// TODO: Instead of not showing the reward change the text to show the correct reward instead and disable the spirit light icon
next::RaceFinishIcon::SetRaceData(this_ptr, elapsed_time, false);
}
} // namespace

void add_ghosts_directory_suffix(std::string suffix) {
ghosts_directory_suffixes.insert(std::move(suffix));
}
} // namespace core::api::game::trials
} // namespace core::api::game::trials

0 comments on commit 872971f

Please sign in to comment.