Created
April 2, 2022 23:07
-
-
Save hexaflexahexagon/44b28288663c021dfb053b9b99b60a6d to your computer and use it in GitHub Desktop.
# Find the map with the fewest completions on tempus in a given tier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Find the map with the fewest completions on tempus in a given tier | |
# change these variables if you want to use a different class | |
# or filter by a different tier | |
CLASS="soldier" # Options are "soldier" or "demo" | |
TIER="5" | |
if [ $CLASS == "soldier" ]; then | |
CLASS_NUM="3" | |
elif [ $CLASS == "demo" ]; then | |
CLASS_NUM="4" | |
else | |
echo Error: Invalid value for \$CLASS | |
exit 1 | |
fi | |
rm ${0}-out.txt 2>/dev/null | |
# Download all maps that are a certain tier for a certain class | |
curl -s https://tempus.xyz/api/maps/detailedList | sed 's/}},/}},\n/g'| grep '"3": 5' | cut -d'"' -f6 > ${0}-tmp.txt | |
total=$(cat ${0}-tmp.txt | wc -l) | |
echo $total maps listed | |
# Go through each map one at a time | |
i=0 | |
while IFS= read -r map; do | |
i=$((i+1)) | |
echo Doing $map, $i/$total... | |
completions=$(curl -s https://tempus.xyz/api/maps/name/${map}/zones/typeindex/map/1/records/list?limit=1 | grep -Eo '"'${CLASS}'": [0-9]+,' | cut -d' ' -f2 | tr -d ',') | |
echo $completions - $map >> ${0}-out.txt | |
# Do a small wait to avoid being rate limited | |
sleep 0.2 | |
done < "${0}-tmp.txt" | |
rm ${0}-tmp.txt | |
#rm ${0}-out.txt | |
echo Done - see ${0}-out.txt for full output | |
echo | |
echo Top 3: | |
echo | |
cat ${0}-out.txt | sort -n | head -n3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment