Skip to content

Commit 23783ae

Browse files
committed
add animated forms to handle different variant suffix
1 parent 4301611 commit 23783ae

64 files changed

Lines changed: 43 additions & 19 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

scripts/forms-animated.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"19": "raticate-alola",
3+
"20_1": "raticate-alola",
4+
"26_1": "raichu-alola",
5+
"27_1": "sandshrew-alola",
6+
"28_1": "sandslash-alola",
7+
"37_1": "vulpix-alola",
8+
"50_1": "dugtrio-alola",
9+
"51_1": "dugtrio-alola",
10+
"52_1": "meowth-alola",
11+
"53_1": "persian-alola",
12+
"74_1": "geodude-alola",
13+
"75_1": "graveler-alola",
14+
"76_1": "golem-alola",
15+
"88_1": "grimer-alola",
16+
"89_1": "muk-alola",
17+
"105_1": "marowak-alola"
18+
}

scripts/renameSmogon.sh

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ convert(){
3636
# Folder where images downloaded from the Smogon spreadsheet are stored.
3737
local files="downloads/"
3838
local formDS
39+
local formDSAnimated
3940
formDS=$(jq . forms.json)
41+
formDSAnimated="$formDS" # default to same as formDS
42+
if [ -f forms-animated.json ]; then
43+
# Merge forms-animated.json into forms.json (animated overrides original)
44+
formDSAnimated=$(jq -n --argjson base "$formDS" --argjson animated "$(jq . forms-animated.json)" '$base * $animated')
45+
fi
4046
# echo "$formDS" | jq -r '.["885"]'
4147

4248
cd "$files" || exit
@@ -95,13 +101,18 @@ convert(){
95101
else
96102
echo "[+] Copying GMax $smogonName to $bwDestination/$pokemonID.$fileExt"
97103
if [ "$fileExt" == "png" ]; then
98-
cp "$smogonName" "$destination/$pokemonID.$fileExt"
104+
mv "$smogonName" "$destination/$pokemonID.$fileExt"
99105
fi
100-
cp "$smogonName" "$bwDestination/$pokemonID.$fileExt"
106+
mv "$smogonName" "$bwDestination/$pokemonID.$fileExt"
101107
fi
102108
fi
103109
if [ "$form" ]; then
104-
pokemonName=$(echo "$formDS" | jq -r ".[\"${id}_${form}\"]")
110+
# Use animated forms for .gif, regular forms for .png
111+
if [ "$fileExt" == "gif" ]; then
112+
pokemonName=$(echo "$formDSAnimated" | jq -r ".[\"${id}_${form}\"]")
113+
else
114+
pokemonName=$(echo "$formDS" | jq -r ".[\"${id}_${form}\"]")
115+
fi
105116

106117
if [ $? -ne 0 ] || [ "$pokemonName" == 'null' ]; then
107118
echo "[-] Form ${id}_${form} wasn't found in the JSON mapping"
@@ -113,9 +124,9 @@ convert(){
113124
if [ -n "$pokemonID" ] && [ "$pokemonID" != "null" ]; then
114125
echo "[+] Found variety by name: Moving $smogonName to $bwDestination/$pokemonID.$fileExt"
115126
if [ "$fileExt" == "png" ]; then
116-
cp "$smogonName" "$destination/$pokemonID.$fileExt"
127+
mv "$smogonName" "$destination/$pokemonID.$fileExt"
117128
fi
118-
cp "$smogonName" "$bwDestination/$pokemonID.$fileExt"
129+
mv "$smogonName" "$bwDestination/$pokemonID.$fileExt"
119130
else
120131
# Search all forms from Pokémon API
121132
echo "[!] Variety '$pokemonName' not found directly. Searching in Pokémon forms..."
@@ -134,9 +145,9 @@ convert(){
134145

135146
echo "[+] Found in forms: Moving $smogonName to $bwDestination/$destFile"
136147
if [ "$fileExt" == "png" ]; then
137-
cp "$smogonName" "$destination/$destFile"
148+
mv "$smogonName" "$destination/$destFile"
138149
fi
139-
cp "$smogonName" "$bwDestination/$destFile"
150+
mv "$smogonName" "$bwDestination/$destFile"
140151
else
141152
echo "[!] No matching form found for $pokemonName."
142153
fi
@@ -148,9 +159,9 @@ convert(){
148159
mkdir -p "$destination"
149160
mkdir -p "$bwDestination"
150161
if [ "$fileExt" == "png" ]; then
151-
cp "$smogonName" "$destination/$id.$fileExt"
162+
mv "$smogonName" "$destination/$id.$fileExt"
152163
fi
153-
cp "$smogonName" "$bwDestination/$id.$fileExt"
164+
mv "$smogonName" "$bwDestination/$id.$fileExt"
154165
fi
155166
fi
156167
done

scripts/smogon_download.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,18 @@
99
# Smogon thread:
1010
# https://www.smogon.com/forums/threads/smogon-sprite-project.3647722/
1111
urls = [
12-
"https://play.pokemonshowdown.com/sprites/gen5ani/comfey.gif",
13-
"https://play.pokemonshowdown.com/sprites/gen5ani-back/comfey.gif",
14-
"https://play.pokemonshowdown.com/sprites/gen5ani-shiny/comfey.gif",
15-
"https://play.pokemonshowdown.com/sprites/gen5ani-back-shiny/comfey.gif",
16-
"https://www.smogon.com/forums/attachments/762-gif.369401/",
17-
"https://www.smogon.com/forums/attachments/762b-gif.369402/",
18-
"https://www.smogon.com/forums/attachments/762s-gif.369403/",
19-
"https://www.smogon.com/forums/attachments/762sb-gif.369404/",
12+
"https://www.smogon.com/forums/attachments/019-gif.171350/",
13+
"https://www.smogon.com/forums/attachments/19b-gif.177101/",
14+
"https://www.smogon.com/forums/attachments/019s-gif.173309/",
15+
"https://www.smogon.com/forums/attachments/19sb-gif.177103/",
2016
]
2117

2218
# Set a User-Agent to prevent Smogon from blocking the request
2319
HEADERS = {
2420
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.31"
2521
}
2622

27-
# Mapping Showdown directories to your filename suffixes
23+
# Mapping Showdown directories to filename suffixes
2824
SHOWDOWN_SUFFIX_MAP = {
2925
"gen5ani": "",
3026
"gen5ani-back": "b",
@@ -51,7 +47,6 @@ def download_sprites():
5147
download_dir = script_dir / "downloads"
5248
download_dir.mkdir(exist_ok=True)
5349

54-
# Load and invert the name map
5550
name_to_id = load_forms_map(script_dir)
5651

5752
print(f"📁 Directory ready: {download_dir.absolute()}")
74.7 KB
102 KB
27.6 KB
81.5 KB
5.61 KB
26.8 KB
28.4 KB

0 commit comments

Comments
 (0)