update stats to a % system

This commit is contained in:
Detanup01 2024-09-30 19:26:09 +02:00 committed by GitHub
parent 58ae7e7b0d
commit 70ab93c62f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 21 deletions

View File

@ -259,7 +259,6 @@ public:
// 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 = 0.1;
// 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

View File

@ -1450,19 +1450,11 @@ static void parse_stats_features(class Settings *settings_client, class Settings
}
{
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);
double val_client_d = ini.GetDoubleValue("main::stats", "stat_min_diff_progress", settings_client->stat_min_diff_progress);
settings_client->stat_min_diff_progress = static_cast<float>(val_client_d);
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);
double val_server_d = ini.GetDoubleValue("main::stats", "stat_min_diff_progress", settings_server->stat_min_diff_progress);
settings_server->stat_min_diff_progress = static_cast<float>(val_server_d);
}
}

View File

@ -127,9 +127,9 @@ Steam_User_Stats::InternalSetResult<int32> Steam_User_Stats::set_stat_internal(
}
} catch(...){}
}
// Alternative progress based on %:
// ((nData - std:stoi(t.last_notified_progress)) / std::stoi(t.max_value)) >= settings->stat_int_min_diff_progress_presentage
if (indicate_progress && (nData - std:stoi(t.last_notified_progress)) >= settings->stat_int_min_diff_progress) {
if (indicate_progress && ((nData - std::stof(t.last_notified_progress) / std::stof(t.max_value) >= settings->stat_min_diff_progress)))
{
IndicateAchievementProgress(t.name.c_str(), nData, std::stoi(t.max_value));
t.last_notified_progress = std::to_string(nData);
}
@ -204,9 +204,10 @@ Steam_User_Stats::InternalSetResult<std::pair<GameServerStats_Messages::StatInfo
} catch(...){}
}
if (indicate_progress && ((nData - std:stof(t.last_notified_progress)) >= settings->stat_float_min_diff_progress) {
if (indicate_progress && ((fData - std::stof(t.last_notified_progress) / std::stof(t.max_value) >= settings->stat_min_diff_progress)))
{
IndicateAchievementProgress(t.name.c_str(), (uint32)fData, (uint32)std::stof(t.max_value));
t.last_notified_progress = std::to_string(nData);
t.last_notified_progress = std::to_string(fData);
}
}
}

View File

@ -72,10 +72,8 @@ 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=0.1
stat_float_min_diff_progress=0.1
stat_min_diff_progress=0.1
[main::connectivity]
# 1=prevent hooking OS networking APIs and allow any external requests