adding stats diff check for not spam the users

This commit is contained in:
Detanup01 2024-09-25 13:23:30 +02:00 committed by GitHub
parent d40d306ccd
commit 9ddfa82878
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 29 additions and 2 deletions

View File

@ -258,6 +258,9 @@ public:
// when a stat that's tied to an achievement gets a new value, should the emu save that progress only if it's higher?
// the stat itself is always saved regardless of that flag, only affects the achievement progress
bool save_only_higher_stat_achievement_progress = true;
// Minimum value to indicate progress being made for the user.
int stat_int_min_diff_progress = 1;
float stat_float_min_diff_progress = 1f;
// the emulator loads the achievements icons is memory mainly for `ISteamUserStats::GetAchievementIcon()`
// this defines how many icons to load each iteration when the periodic callback in `Steam_User_Stats` is triggered
// or when the app calls `SteamAPI_RunCallbacks()`

View File

@ -1448,6 +1448,23 @@ static void parse_stats_features(class Settings *settings_client, class Settings
long val_server = ini.GetLongValue("main::stats", "paginated_achievements_icons", settings_server->paginated_achievements_icons);
settings_server->paginated_achievements_icons = static_cast<int>(val_server);
}
{
long val_client_i = ini.GetLongValue("main::stats", "stat_int_min_diff_progress", settings_client->stat_int_min_diff_progress);
settings_client->stat_int_min_diff_progress = static_cast<int>(val_client_i);
long val_server_i = ini.GetLongValue("main::stats", "stat_int_min_diff_progress", settings_server->stat_int_min_diff_progress);
settings_server->stat_int_min_diff_progress = static_cast<int>(val_server_i);
}
{
double val_client_d = ini.GetDoubleValue("main::stats", "stat_float_min_diff_progress", settings_client->stat_float_min_diff_progress);
settings_client->stat_float_min_diff_progress = static_cast<float>(val_client_d);
double val_server_d = ini.GetDoubleValue("main::stats", "stat_float_min_diff_progress", settings_server->stat_float_min_diff_progress);
settings_server->stat_float_min_diff_progress = static_cast<float>(val_server_d);
}
}

View File

@ -128,7 +128,7 @@ Steam_User_Stats::InternalSetResult<int32> Steam_User_Stats::set_stat_internal(
} catch(...){}
}
if (indicate_progress) {
if (indicate_progress && (stats_data->second + settings->start_int_min_diff_progress) >= nData) {
IndicateAchievementProgress(t.name.c_str(), nData, std::stoi(t.max_value));
}
}
@ -202,7 +202,7 @@ Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo
} catch(...){}
}
if (indicate_progress) {
if (indicate_progress && (stats_data->second + settings->start_float_min_diff_progress) >= fData) {
IndicateAchievementProgress(t.name.c_str(), (uint32)fData, (uint32)std::stof(t.max_value));
}
}

View File

@ -70,6 +70,13 @@ save_only_higher_stat_achievement_progress=1
# default=10
paginated_achievements_icons=10
# Minimum value to indicate progress being made for the user.
# Usually good for achievement that use stat values and contains high number (ie: kill 200 cops)
# default=1
stat_int_min_diff_progress=1
# default=1f
stat_float_min_diff_progress=1f
[main::connectivity]
# 1=prevent hooking OS networking APIs and allow any external requests
# only used by the experimental builds on **Windows**