Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Powershell readme update + Decimal vs * 10 w/ early return #3

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,24 @@ This is a quick script created to generate a compatible `cardtier.json` for use

With required dependencies installed (git, latest node)

### OSX or Git Bash
```bash
git clone [email protected]:jdb8/hstracker-hsreplay-stats.git
cd hstracker-hsreplay-stats
npm install
node index.mjs
ln -sf "$PWD/cardtier.json" "/Users/$USER/Library/Application Support/HSTracker/arena"
````
```

### Windows PowerShell
``` Open PowerShell as admin
git clone [email protected]:jdb8/hstracker-hsreplay-stats.git
cd hstracker-hsreplay-stats
npm install
node index.mjs
del "%appdata%/HearthstoneDeckTracker\Plugins\data\cardtier.json"
mklink /h "%appdata%/HearthstoneDeckTracker\Plugins\data\cardtier.json" "cardtier.json"
```

### More details

Expand All @@ -31,6 +42,7 @@ ln -sf "$PWD/cardtier.json" "/Users/$USER/Library/Application Support/HSTracker/
1. (optional) back up your existing `cardtier.json` inside `/Users/$USER/Library/Application Support/HSTracker/arena`
1. Copy the `cardtier.json` file into `/Users/$USER/Library/Application Support/HSTracker/arena`, or symlink it for convenience
1. Restart HSTracker
1. To refresh the tier list, just re-run index.mjs until issue 1 is resolved..

The newly-generated `cardtier.json` will now be used by HSTracker to display "deck winrate" in place of arena tierlist score.

Expand Down
9 changes: 5 additions & 4 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,13 @@ async function main() {

const { id, name } = cardData;

const allValue = statsByHeroAndDbfId.get(JSON.stringify(['ALL', dbfId]));
const value = heros.map((h) => {
const key = JSON.stringify([h, dbfId]);
// Multiply by 10 because HSTracker can only display 3 digit numbers
// So percentages like 62.1% will display as 621, or -1 if missing
return `${Math.round(statsByHeroAndDbfId.get(key) * 10 || -1)}`;
const value = statsByHeroAndDbfId.get(key);
if (!value) {
return -1;
}
return Math.round(value * 10) / 10;
});

logData.push({
Expand Down