Coder Social home page Coder Social logo

bzly / hunt-showdown-stat-recording Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 2.0 39 KB

Tools to get statistics from your last Hunt match, with the goal of eventually watching for changes and recording the data after every match.

License: GNU General Public License v3.0

PowerShell 100.00%

hunt-showdown-stat-recording's Introduction

Hunt: Showdown Stat Recording

Tools to get statistics from your last Hunt match, with the goal of eventually watching for changes and recording the data after every match.

Written in PowerShell.

What

Scraping $HuntInstallDirectory\user\profiles\default\attributes.xml for information after every game. I don't know why they're using XML when the structure is entirely flat; this could be easier. I also don't know why some data is stored in there at all (icon paths, etc).

Currently provides the following functions:

  • Hunt:
    • ConvertFrom-HuntAttributes - parses the above and returns the JSON output below (or as an ordered dict if passed -Object)
    • Get-HuntAllMmr - returns a list of teams and players in the game and their MMR.
    • Get-HuntTeamMmr - returns a list of only the players on your team and their MMR.
    • Get-HuntAttributes - returns an array of XmlElements from attributes.xml. Only useful if you want the raw data for some reason.
    • 2x helper functions which are not exported
  • Steam:
    • Get-SteamDirectory - returns Steam install dir as directory object
    • Get-SteamName - returns last logged in Steam display name
    • Get-ValueFromValveFile - returns the value of a specific key from an .vcf or .acf
    • Get-SteamLibraries - returns an array of your Steam library folders as directory objects
    • Get-SteamAppDirectory - returns the install dir of a specific Steam AppID as a directory object

How

  1. Download HuntToolkit.psm1
  2. Import the module into your Powershell session a. If stored in an $env:PSModulePath location it will automatically import b. If storing somewhere else, either:
    • call Import-Module "path\to\module\HuntToolkit.psm1" before every run
    • add the above command to your Powershell profile (location is stored as $profile) and relaunch
  3. Run ConvertFrom-HuntAttributes, and enjoy your JSON.

To-do

  • Complete ConvertFrom-HuntAttributes:
    • Include real number of revives
    • Add number of bounty tokens extracted
    • Add clues discovered
    • Work out how to tell match length
    • Find out more MissionBagEntry_<i>_reward types (including Blood Bonds)
    • Fix XP received calculation (but this is quite obtuse)
      • Validate current methods
  • Function to write the data to storage
    • As an array of JSON objects, each representing a match (?)
  • Function to monitor attributes.xml for changes
  • Function to check whether the match data has changed (file is updated more frequently than after every match)
    • How do we do this? Check to see if a bunch of values are the same?
  • Function to get the game install directory (using $SteamInstallDir\steamapps\libraryfolders.vdf?)
  • Maybe something to plot a couple of quick graphs (MMR distribution of players in last match, your MMR over time, etc)

Current data structure

The output of ConvertFrom-HuntAttributes, when run without the -Object flag, is rendered into JSON like so:

{
  "playedas": "Blankedy Blank",
  "isquickplay": false,
  "rewards": {
    "bounty": 50,
    "xp": 3390,
    "money": 50,
    "bloodbonds": 0
  },
  "performance": {
    "kills": 2,
    "deaths": 2,
    "assists": 1,
    "revives": 69,
    "survived": true
  },
  "teams": [
    {
      "id": 0,
      "handicap": 0,
      "isinvite": true,
      "mmr": 2912,
      "numplayers": 3,
      "ownteam": false,
      "players": [
        {
          "id": 0,
          "blood_line_name": "Crusade",
          "hadWellspring": false,
          "hadbounty": false,
          "killedbyme": 0,
          "killedme": 0,
          "mmr": 2954,
          "profileid": 64424591974,
          "proximity": false,
          "skillbased": true
        },
        {
          "id": 1,
          "blood_line_name": "Cheroro",
          "hadWellspring": false,
          "hadbounty": false,
          "killedbyme": 0,
          "killedme": 0,
          "mmr": 2798,
          "profileid": 4295076022,
          "proximity": false,
          "skillbased": true
        },
        {
          "id": 2,
          "blood_line_name": "Lime Sherbert",
          "hadWellspring": false,
          "hadbounty": false,
          "killedbyme": 0,
          "killedme": 0,
          "mmr": 2950,
          "profileid": 21474911436,
          "proximity": false,
          "skillbased": true
        }
      ]
    },
    {
      "id": 1,
      "handicap": 0,
      "isinvite": true,
      "mmr": 2889,
      "numplayers": 3,
      "ownteam": false,
      "players": [
        {
          "id": 0,
          "blood_line_name": "Commander Xao",
          "hadWellspring": false,
          "hadbounty": false,
          "killedbyme": 0,
          "killedme": 0,
          "mmr": 2806,
          "profileid": 73014527508,
          "proximity": false,
          "skillbased": true
        },
        {
          "id": 1,
          "blood_line_name": "Shuua",
          "hadWellspring": false,
          "hadbounty": false,
          "killedbyme": 1,
          "killedme": 0,
          "mmr": 2975,
          "profileid": 38654774043,
          "proximity": false,
          "skillbased": true
        },
        {
          "id": 2,
          "blood_line_name": "Gameaffobic",
          "hadWellspring": false,
          "hadbounty": false,
          "killedbyme": 0,
          "killedme": 1,
          "mmr": 2848,
          "profileid": 34359747876,
          "proximity": false,
          "skillbased": true
        }
      ]
    },
    {
      "id": 2,
      "handicap": 0,
      "isinvite": true,
      "mmr": 2864,
      "numplayers": 3,
      "ownteam": true,
      "players": [
        {
          "id": 0,
          "blood_line_name": "Blankedy Blank",
          "hadWellspring": false,
          "hadbounty": false,
          "killedbyme": 0,
          "killedme": 0,
          "mmr": 2958,
          "profileid": 64424560816,
          "proximity": true,
          "skillbased": true
        },
        {
          "id": 1,
          "blood_line_name": "DashRendar",
          "hadWellspring": false,
          "hadbounty": true,
          "killedbyme": 0,
          "killedme": 0,
          "mmr": 2772,
          "profileid": 17179947497,
          "proximity": false,
          "skillbased": true
        },
        {
          "id": 2,
          "blood_line_name": "Daario",
          "hadWellspring": false,
          "hadbounty": false,
          "killedbyme": 0,
          "killedme": 0,
          "mmr": 2816,
          "profileid": 81604489802,
          "proximity": false,
          "skillbased": true
        }
      ]
    },
    {
      "id": 3,
      "handicap": 0,
      "isinvite": true,
      "mmr": 2967,
      "numplayers": 3,
      "ownteam": false,
      "players": [
        {
          "id": 0,
          "blood_line_name": "[BB] uzi_01",
          "hadWellspring": false,
          "hadbounty": true,
          "killedbyme": 0,
          "killedme": 0,
          "mmr": 2984,
          "profileid": 47244642844,
          "proximity": false,
          "skillbased": false
        },
        {
          "id": 1,
          "blood_line_name": "死亡! ($DBY$)",
          "hadWellspring": false,
          "hadbounty": false,
          "killedbyme": 1,
          "killedme": 1,
          "mmr": 2994,
          "profileid": 17179973327,
          "proximity": false,
          "skillbased": false
        },
        {
          "id": 2,
          "blood_line_name": "[BB] Fiddler Kid Diddler",
          "hadWellspring": false,
          "hadbounty": true,
          "killedbyme": 0,
          "killedme": 0,
          "mmr": 2917,
          "profileid": 77309435674,
          "proximity": false,
          "skillbased": false
        }
      ]
    }
  ]
}

Example data structure

[
  {
    matchTime: "2021-09-07T00:02:48+00:00",   #can only be calculated when watching file for changes(?)
    matchNumber: 247,                         #can only be calculated when writing to a store(?)
    bosses: {
      butcher: {
        present: true,
        kill: true,
        banish: true,
        extract: false,
      },
      spider: {...},
      assassin: {...},
      scrapbeak: {...},
    },
    ...(rest of the current structure)...
  }
]

hunt-showdown-stat-recording's People

Contributors

bzly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hunt-showdown-stat-recording's Issues

I am attempting ther same but cannot figure out the number of players

Hi, I was attempting the same thing as you are with the game stats. I wanted to log stuff like how many of each monster killed, how much money I made on each day etc.

I also wanted to log the players after each match. I cannot figure out quite a few things, but most importantly there are leftover players in the XML that were not actually in the match and I don't know how to filter them out. Could you help me out please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.