Command line utility for parsing detailed Steam stat information.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
James Hofstra 4bbfc98902 Added stats.txt export; changed some functions. 1 个月前
LICENSE.md Initial commit 10 个月前
README.md Added stats.txt export; changed some functions. 1 个月前
steam_stat_utils.py Added stats.txt export; changed some functions. 1 个月前

README.md

Steam Stat Utils

Command line utility for parsing detailed Steam stat information.

Background

steam_stat_utils.py fetches data primarily from two sources: the Steam client’s local filesystem cache and the Steam Web API. With this information you can view global stats as well as signed-in users’ stats.

You can also dump raw data for local/offline playtesting, such as with Goldberg Emulator. Steam’s copy of data can change over time and as your games receive major updates, so this process should be repeated regularly.

Usage

Usage details are in development and likely to change with future commits.

steam_stat_utils.py path/to/steam_dir appid [userid]

Requirements

  • Python 3.5 or higher
  • vdf

Tested Configurations

  • Python 3.5.3 on Debian GNU/Linux (WSL)

Planned Additions and Improvements

  1. Reading/writing average-rate type stats (currently treated the same as floating-point type)
  2. Adding and improving usage parameters
  3. Writing achievements.json file format used by Goldberg Emulator

Limitations

  • Writing raw data back to Steam’s local cache is not supported. If you want to manipulate your own player stats, look up Steam Achievement Manager.
  • The current version of Goldberg Emulator doesn’t support achievements or global stats yet. To enable global stats support, I am using a custom build with the following changes (as of August 2019):
  1. In dll/local_storage.h add the following preprocessor directive next to the other defines near the top of the file:
#define GLOBALSTATS_STORAGE_FOLDER "globalstats"
  1. In dll/steam_user_stats.h replace the two GetGlobalStat placeholder functions with these implementations:
// Gets the lifetime totals for an aggregated stat
bool GetGlobalStat( const char *pchStatName, int64 *pData )
{
    PRINT_DEBUG("GetGlobalStat %s\n", pchStatName);
    if (!pchStatName || !pData) return false;
    std::lock_guard<std::recursive_mutex> lock(global_mutex);

    int read_data = local_storage->get_data(GLOBALSTATS_STORAGE_FOLDER, pchStatName, (char* )pData, sizeof(*pData));
    if (read_data == sizeof(int64))
        return true;

    return false;
}

bool GetGlobalStat( const char *pchStatName, double *pData )
{
    PRINT_DEBUG("GetGlobalStat %s\n", pchStatName);
    if (!pchStatName || !pData) return false;
    std::lock_guard<std::recursive_mutex> lock(global_mutex);

    int read_data = local_storage->get_data(GLOBALSTATS_STORAGE_FOLDER, pchStatName, (char* )pData, sizeof(*pData));
    if (read_data == sizeof(int64))
        return true;

    return false;
}