|
| 1 | +#!/bin/bash |
| 2 | +# Run via |
| 3 | +# sh dockerfiles/download_maps.sh |
| 4 | +set -euo pipefail |
| 5 | + |
| 6 | +# Create maps directory if it doesn't exist |
| 7 | +mkdir -p dockerfiles/maps |
| 8 | +cd dockerfiles/maps |
| 9 | + |
| 10 | +# Download function with retries |
| 11 | +download_with_retry() { |
| 12 | + local url=$1 |
| 13 | + local output=$2 |
| 14 | + curl --retry 5 --retry-delay 5 -C - -L "$url" -o "$output" |
| 15 | +} |
| 16 | + |
| 17 | +# Download and process sc2ai.net ladder maps |
| 18 | +for i in {1..7}; do |
| 19 | + case $i in |
| 20 | + 1) url="https://sc2ai.net/wiki/184/plugin/attachments/download/9/" ;; |
| 21 | + 2) url="https://sc2ai.net/wiki/184/plugin/attachments/download/14/" ;; |
| 22 | + 3) url="https://sc2ai.net/wiki/184/plugin/attachments/download/21/" ;; |
| 23 | + 4) url="https://sc2ai.net/wiki/184/plugin/attachments/download/35/" ;; |
| 24 | + 5) url="https://sc2ai.net/wiki/184/plugin/attachments/download/36/" ;; |
| 25 | + 6) url="https://sc2ai.net/wiki/184/plugin/attachments/download/38/" ;; |
| 26 | + 7) url="https://sc2ai.net/wiki/184/plugin/attachments/download/39/" ;; |
| 27 | + esac |
| 28 | + |
| 29 | + download_with_retry "$url" "$i.zip" |
| 30 | + unzip -q -o "$i.zip" |
| 31 | + rm "$i.zip" |
| 32 | +done |
| 33 | + |
| 34 | +# Download and process official blizzard maps |
| 35 | +download_with_retry "http://blzdistsc2-a.akamaihd.net/MapPacks/Ladder2019Season3.zip" "Ladder2019Season3.zip" |
| 36 | +unzip -q -P iagreetotheeula -o "Ladder2019Season3.zip" |
| 37 | +mv Ladder2019Season3/* . |
| 38 | +rm "Ladder2019Season3.zip" |
| 39 | +rmdir Ladder2019Season3 |
| 40 | + |
| 41 | +# Download and process v5.0.6 maps |
| 42 | +download_with_retry "https://github.com/shostyn/sc2patch/raw/4987d4915b47c801adbc05e297abaa9ca2988838/Maps/506.zip" "506.zip" |
| 43 | +unzip -q -o "506.zip" |
| 44 | +rm "506.zip" |
| 45 | + |
| 46 | +# Download and process flat/empty maps |
| 47 | +download_with_retry "http://blzdistsc2-a.akamaihd.net/MapPacks/Melee.zip" "Melee.zip" |
| 48 | +unzip -q -P iagreetotheeula -o "Melee.zip" |
| 49 | +mv Melee/* . |
| 50 | +rm "Melee.zip" |
| 51 | +rmdir Melee |
| 52 | + |
| 53 | +# Remove LE suffix from file names |
| 54 | +for f in *LE.SC2Map; do |
| 55 | + mv -- "$f" "${f%LE.SC2Map}.SC2Map"; |
| 56 | +done |
0 commit comments