Skip to content

Instantly share code, notes, and snippets.

@chx
Last active April 14, 2024 16:13
Show Gist options
  • Save chx/22fe4f2fee869a7ecde9e4db12d73a19 to your computer and use it in GitHub Desktop.
Save chx/22fe4f2fee869a7ecde9e4db12d73a19 to your computer and use it in GitHub Desktop.
Expected profit of an Einhar Harvest memory
#!/bin/bash
LEAGUE=$(curl -s https://poe.ninja/api/data/getindexstate|jq -r '.economyLeagues[0].name')
URL="https://poe.ninja/api/data/itemoverview?league=$LEAGUE&type"
# There are nine beasts in a memory and there are nine kinds of harvest beasts with equal chance. Thus, the expected value is one beast per memory and the income is the sum of their value.
# However, only five is worth selling, the two Primal C beasts are worthless, Primal Rhex Matriach (synth map) and Vivid Abberach (guardian map) we run ourselves.
BEASTS=$(curl -s "$URL=Beast" |jq -r '[.lines[]| select(.name==("Wild Hellion Alpha","Wild Brambleback","Wild Bristle Matron","Vivid Vulture","Vivid Watcher"))|.chaosValue]|add')
# There are four non-replica synth maps equally weighted, so calculate the expected value:
SYNTH=$(curl -s "$URL=UniqueMap"|jq -r '[.lines[]| select(.baseType=="Synthesised Map" and .name!="Cortex" and .name!="Replica Cortex")|.chaosValue]|add' | awk '{print $1/4}')
# It's near impossible to calculate the expected value for guardian maps so I am skipping it. It's 20-40c at most anyways.
# Finally, the cost:
COST=$(curl -s "$URL=Memory"|jq -r '.lines[]| select(.name=="Einhar'"'"'s Memory of Harvest Beasts")|.chaosValue')
echo "$BEASTS + $SYNTH - $COST" | bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment